1/26
v1.3 Fixed stuff
12/19
v1.1 Changed the keep routine so that it will right click to put the item in inventory instead of left clicking. It's a pretty good bit faster this way.
v1.0 Allows you 3 options for every item; Keep, Destroy, and Ignore. Tradeable items default to Keep, No Drop items default to Ignore. If you want to alter the items from the default values, you can set them in your loot.ini, which groups each item into sections based on the first letter of the item's name (It doesn't create them in alpha order for you, if you want it to look nice and pretty, do it yourself).
If you already have a Lore item in your inventory, it will link it in your LootChannel if you set ReportLoot to TRUE. It will also link any No Drop items left on a corpse. If you have a full stack of an item, and no free inventory space available, it will also link it in your LootChannel.
It will not loot if there are mobs inside your MobsTooClose radius.
It will loot any corpses within your CorpseRadius.
It will wait until your CorpseRotTime timer has expired before trying to loot again. The CorpseRotTimer gets reset anytime you encounter a new corpse that you can't loot from, so there will be some lag in the times you start re-looting corpses you leave items on.
It will not loot stackable items unless there's room on a stack for it, or you have a slot in your inventory free to put it in.
Code: Select all
| Ninjadvloot.inc v1.3
#Event ALCantLoot "#*#may not loot this corpse#*#"
Sub SetupAdvLootVars
/declare ALDontLoot int outer
/declare CorpseRotTimer timer outer
/call ALLoadVar Settings LootMobs TRUE bool
/call ALLoadVar Settings CorpseRadius 100 int
/call ALLoadVar Settings MobsTooClose 50 int
/call ALLoadVar Settings CorpseRotTime 440s string
/call ALLoadVar Settings ReportLoot FALSE bool
/call ALLoadVar Settings LootChannel echo string
/if (!${Defined[${AlertList}]}) /declare AlertList int outer 1
/squelch /alert clear 25
/return
Sub ALLoadVar(IniSection,IniVar,IniValue,VarType)
/if (!${Defined[${IniVar}]} && ${Defined[VarType]}) /declare ${IniVar} ${VarType} outer
/declare IniString string local ${Ini[Loot.ini,${IniSection},${IniVar},NOTFOUND]}
/varset ${IniVar} ${IniString}
/if (${IniString.Equal["NOTFOUND"]}) {
/if (${IniString.Equal["NOTFOUND"]}) /varset ${IniVar} ${IniValue}
/ini "Loot.ini" "${IniSection}" "${IniVar}" "${${IniVar}}"
}
/return
Sub LootCorpse
/declare i int local
/declare LootList string local
/call CheckCursor
/loot
/delay 3s ${Corpse.Open}
/doevents CantLoot
/if (${Target.ID}==${ALDontLoot} && ${Spawn[${ALDontLoot}].ID}) /squelch /alert add 25 id ${ALDontLoot}
/delay 3s ${Corpse.Items} || ${Target.ID}==${ALDontLoot}
/if (${Corpse.Open} && ${Corpse.Items}) {
/declare loottotal int local
:ALlootlag
/varset loottotal ${Corpse.Items}
/delay 1s ${loottotal}!=${Corpse.Items}
/if (${loottotal}!=${Corpse.Items}) /goto :ALlootlag
/for i 1 to ${loottotal}
/if (${Corpse.Item[${i}].ID} && !${Select[${Ini[Loot.ini,"${Corpse.Item[${i}].Name.Left[1]}","${Corpse.Item[${i}]}"]},Ignore,Keep,Destroy]}) {
/if (${Corpse.Item[${i}].NoDrop}) /ini "loot.ini" "${Corpse.Item[${i}].Name.Left[1]}" "${Corpse.Item[${i}]}" Ignore
/if (!${Corpse.Item[${i}].NoDrop}) /ini "loot.ini" "${Corpse.Item[${i}].Name.Left[1]}" "${Corpse.Item[${i}]}" Keep
}
/if (${Ini[Loot.ini,"${Corpse.Item[${i}].Name.Left[1]}","${Corpse.Item[${i}]}"].NotEqual[Destroy]} && !${Me.FreeInventory} && (!${FindItemCount[=${Corpse.Item[${i}].Name}]} || (${FindItemCount[=${Corpse.Item[${i}].Name}]} && ${Corpse.Item[${i}].Stackable} && !${Corpse.Item[${i}].FreeStack})) || (${Corpse.Item[${i}].Lore} && ${FindItem[${Corpse.Item[${i}]}].ID}) || ${Ini[Loot.ini,"${Corpse.Item[${i}].Name.Left[1]}","${Corpse.Item[${i}]}"].Equal[Ignore]}) /varset LootList ${LootList}${Corpse.Item[${i}]},
/if ((!${Corpse.Item[${i}].Lore} || !${FindItem[${Corpse.Item[${i}]}].ID}) && (${Me.FreeInventory} || (${FindItemCount[=${Corpse.Item[${i}].Name}]} && ${Corpse.Item[${i}].Stackable} && ${Corpse.Item[${i}].FreeStack})) && ${Ini[Loot.ini,"${Corpse.Item[${i}].Name.Left[1]}","${Corpse.Item[${i}]}"].Equal[Keep]}) /call LootItem ${i} Keep right
/if (${Ini[Loot.ini,"${Corpse.Item[${i}].Name.Left[1]}","${Corpse.Item[${i}]}"].Equal[Destroy]}) /call LootItem ${i} Destroy left
/next i
/if (${Corpse.Items}) {
/if (${ReportLoot}) /${LootChannel} ${LootList} left on corpse.
/if (${Target.ID}) /squelch /alert add 25 id ${Target.ID}
/varset CorpseRotTimer ${CorpseRotTime}
}
}
:clickdoneffs
/nomodkey /notify LootWnd LW_DoneButton leftmouseup
/delay 5s !${Corpse.Open}
/if (${Corpse.Open}) /goto :clickdoneffs
/return
Sub LootItem(int i,DoWhat,WhichButton)
/declare CorpseItemID int local ${Corpse.Item[${i}].ID}
/nomodkey /itemnotify loot${i} ${WhichButton}mouseup
/delay 5s ${Window[ConfirmationDialogBox].Open} || !${Corpse.Item[${i}].NoDrop}
/if (${Window[ConfirmationDialogBox].Open}) /nomodkey /notify ConfirmationDialogBox Yes_Button leftmouseup
/delay 5s ${Cursor.ID} || ${WhichButton.NotEqual[left]}
/if (${DoWhat.Equal[Destroy]} && ${Cursor.ID}==${CorpseItemID}) /destroy
/delay 3s !${Corpse.Item[${i}].ID} && !${Cursor.ID}
/return
Sub LootMobs
/if (!${LootMobs} || ${SpawnCount[npc radius ${MobsTooClose} zradius 100 noalert ${AlertList}]} || !${SpawnCount[corpse radius ${CorpseRadius} zradius 100 noalert 25]} || ${Me.Combat} || (${Cursor.NoDrop} && !${Me.FreeInventory})) /return
/if (!${CorpseRotTimer}) /squelch /alert clear 25
/declare i int local
/declare CorpseList string local |
/for i 1 to ${SpawnCount[corpse radius ${CorpseRadius} zradius 100 noalert 25]}
/varset CorpseList ${CorpseList}${NearestSpawn[${i},corpse radius ${CorpseRadius} noalert 25].ID}|
/next i
/declare DeadCount int local ${SpawnCount[corpse radius ${CorpseRadius} zradius 100 noalert 25]}
/if (${Me.Mount.ID}) /dismount
/for i 1 to ${DeadCount}
/if (${Spawn[${CorpseList.Arg[${i},|]}].Deity.ID} && ${Spawn[${CorpseList.Arg[${i},|]}].ID}) /squelch /alert add 25 id ${Spawn[${CorpseList.Arg[${i},|]}].Deity.ID}
/if (!${Spawn[${CorpseList.Arg[${i},|]}].Deity.ID}) {
/if (${Target.ID}!=${Spawn[${CorpseList.Arg[${i},|]}].ID}) /target id ${Spawn[${CorpseList.Arg[${i},|]}].ID}
/if (!${Me.Standing}) /stand
/delay 2s ${Target.ID}==${Spawn[${CorpseList.Arg[${i},|]}].ID} && ${Me.Standing}
/if (${Spawn[${CorpseList.Arg[${i},|]}].Distance}>10) /moveto loc ${Spawn[${CorpseList.Arg[${i},|]}].Y} ${Spawn[${CorpseList.Arg[${i},|]}].X}
/delay 10s ${Spawn[${CorpseList.Arg[${i},|]}].Distance}<10
/if (${Spawn[${CorpseList.Arg[${i},|]}].Distance}<15) /call LootCorpse
/stick off
}
/next i
/return
Sub Event_ALCantLoot
/varset ALDontLoot ${Target.ID}
/return
Sub CheckCursor
:ALauto_inv
/if (${Cursor.ID}) {
/if (${Cursor.NoDrop} && !${Me.FreeInventory}) /return
/timed 5 /autoinventory
/delay 2s !${Cursor.ID}
/goto :ALauto_inv
}
/return


