|** LoocMyCorpse.mac (Shamelessly Based on code by FaNTuM)
This will automatically loot your corpse for you, leaving
the specified number of items on it. Usage: </mac LootMyCorpse 0> where 0
is the number of items to leave on corpse, 0 loots all items.
05/03/2005 **|
| --------------
| -- Main Sub --
| --------------
Sub Main
/declare loottotal int outer
/declare lootslot int outer
/declare lootleft int outer 1
/if (${Defined[Param0]}) {
/varset lootleft ${Param0}
}
/echo LootCorpse.mac activated!
/echo Attempting to loot corpse leaving ${lootleft} item/s on corpse.
/call Loot
/end
| -----------------------
| -- Pull corpse close --
| -----------------------
Sub Loot
:corpsepull
/target mycorpse
/delay 5 ${Target.CleanName.Equal[${Me}'s corpse]}
/if (${Target.CleanName.NotEqual[${Me}'s corpse]} || !${Target.ID}) {
/echo No corpse in this zone
/return
}
/delay 3s
/corpse
/delay 1s ${Target.Distance}<20
/if (${Target.Distance}>20) {
/echo Corpse is too far away
/return
}
| ---------------------
| -- Open the corpse --
| ---------------------
/if (${Target.CleanName.Equal[${Me}'s corpse]}) {
/loot
} else {
/echo where did my corpse go?
/return
}
/delay 5s ${Me.State.Equal[BIND]}
/if (${Me.State.NotEqual[BIND]}) /goto :corpsepull
/varset loottotal 0
| -----------------
| -- Count items --
| -----------------
/delay 3s
:LootLag
/if (${loottotal}!=${Corpse.Items}) {
/varset loottotal ${Corpse.Items}
/delay 2s
/goto :LootLag
}
/if (${loottotal}<=${lootleft}) {
/echo Looting aborted. Error in number of items to be left on corpse.
/notify LootWnd DoneButton leftmouseup
/return
}
/varset loottotal ${Math.Calc[${Corpse.Items}-${lootleft}]}
| ---------------------
| -- Loot the corpse --
| ---------------------
/echo Looting all but ${lootleft} item(s)
/for lootslot 1 to ${loottotal}
:LootItem
/itemnotify loot${lootslot} rightmouseup
/delay 5 !${Corpse.Item[${lootslot}].ID}
/if (!${Corpse.Item[${lootslot}].ID}) {
/next lootslot
} else /goto :LootItem
| -----------------
| -- Doublecheck --
| -----------------
/if (${Math.Calc[${Corpse.Items}-${lootleft}]}>0) /goto :LootLag
/notify LootWnd DoneButton leftmouseup
/echo Done looting. ${lootleft} Item(s) left on your corpse.
/return