/Mac Cleanbags
This is
|playj's quick and dirty addition to Ninjadvloot
|destroys items in bags
|utilizes Ninjadvloot ini system and subs
|anything Itemname=Destroy is destroyed rest (Keep/Ignore/Sell) is kept
|I highly recommend using custom .ini files for example /mac cleanbags "destroy.ini"
#include Ninjadvloot.inc
Sub Main
/declare IniFile string outer
/echo starting cleanbags.mac
/if (${Defined[Param0]}) {
/echo going to use ${Param0} for ini file
/varset IniFile ${Param0}
/call SetupAdvLootVars ${IniFile}
/goto :StartCleaning
}
/echo we are going to use default loot.ini
/call SetupAdvLootVars
:StartCleaning
/call CleanBags
/echo finished cleaning bags from junk
/return
Sub CleanBags
/declare i int local
/declare j int local
/declare k int local
/declare LootItem string
| Top level inv has its own loop since ${FindItem[=${ItemToSell}].InvSlot} looks at top lev inv slots first in Sub SellToVendor for the item to sell.
| Loop through top level inventory slots for sellable items
/for k 1 to 10
| Check if top level inv slot is not a container/bag
/if (${InvSlot[pack${k}].Item.Container}==0) {
| If top level inv slot is empty check for an item marked sell
/if (${InvSlot[pack${k}].Item.ID}) {
/varset LootItem ${InvSlot[pack${k}].Item}
/if (${Ini[${NinjaIniFile},"${LootItem.Left[1]}","${LootItem}"].Equal[Destroy]}) /call DestroyAll "${LootItem}"
}
}
/next k
| Loop through top level inventory slots for containers
/for i 1 to 10
| Check if top level inv slot has a bag
/if (${InvSlot[pack${i}].Item.Container}==0) /next i
| Set j 1 to number of bag slots and loop through slots looking for items marked sell
/for j 1 to ${InvSlot[pack${i}].Item.Container}
/if (${InvSlot[pack${i}].Item.Item[${j}].ID}) {
/varset LootItem ${InvSlot[pack${i}].Item.Item[${j}].Name}
/if (${Ini[${NinjaIniFile},"${LootItem.Left[1]}","${LootItem}"].Equal[Destroy]}) /call DestroyAll "${LootItem}"
}
/next j
/next i
/return
Sub DestroyAll(ItemName)
/keypress OPEN_INV_BAGS
/echo Destroying all ${ItemName} in inventory
/while (${FindItem[=${ItemName}].InvSlot}) {
/shift /itemnotify "${ItemName}" leftmouseup
/delay 5
/if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
/delay 5
}
/echo all ${ItemName} should be destroyed
/keypress CLOSE_INV_BAGS
/return