Updated with changes made so far. Still a ways to go, but it's getting there
Code: Select all
; NinjaLoot.inc for InnerSpace with ISXEQ v.alpha
; Ripped from NinjaLoot.inc v1.2 by Mystikule
; by aChallenged1
; This is a work in progress and is nowhere near ready at this time
AddTrigger Event_NotYourKill "You may not loot this Corpse at this time."
AddTrigger Event_SetAutoLoot "[IS] SetAutoLoot#*#"
AddTrigger Event_Autolootstatus "[IS] Autoloot Status#*#"
function NLPresetup()
{
; Make any undefined variables
if (!${Defined[LootINIFile]}) variable string NLLootINIFile="loot.ini"
if (!${Defined[NLVersion]}) variable string NLVersion="1.2"
if (!${Defined[NLlootdist]}) variable int NLlootdist="100"
if (!${Defined[NLlootmode]}) variable string NLlootmode
; Check version in ini and skip aliases if current
if (${Ini[${NLLootINIFile},Loot,Version].Equal[${NLVersion}]}) call LoadAliases
; variable corpseskip ID arrays
variable int NLCorpseskip[20,2]
variable int NLTempCorpse[20]
; If empty ini build it up
if (!${Ini[${NLLootINIFile},Loot,AutoLootMode].Length}) call BuildINI
; Load variables from ini
if (${Ini[${NLLootINIFile},Loot,AutoLootMode].Length}) NLlootmode:Set[${Ini[${NLLootINIFile},Loot,AutoLootMode]}]
if (${Ini[${NLLootINIFile},Loot,AutoLootDistance].Length}) NLlootdist:Set[${Ini[${NLLootINIFile},Loot,AutoLootDistance]}]
; Echo NL status upon load
echo Ninjaloot.inc Loaded.
echo Ninjaloot Usage:
echo /autoloot <all|drop|nditem|off> <radius#>
echo /lootstatus <displays Autoloot status>
echo Autoloot Status
if (${NLlootmode.Equal[ALL]}) EQExecute /lootnodrop never
if (${NLlootmode.Equal[DROP]}) EQExecute /lootnodrop always
if (${NLlootmode.Equal[NDITEM]}) EQExecute /lootnodrop always
if (${NLlootmode.Equal[OFF]}) EQExecute /lootnodrop always
}
function NLAutoloot()
{
ExecuteQueued SetAutoLoot
ExecuteQueued Autolootstatus
if (${NLlootmode.Equal[OFF]}) }
if (!${Defined[lootslot]}) variable int lootslot
if (!${Defined[loottotal]}) variable int loottotal="-1"
if (!${Defined[w]}) variable int w
if (!${Defined[e]}) variable int e
call Updatecorpse
; Check for avialable corpses to loot
for e 1 to 20
NLTempCorpse[${e}]:Set[${NearestSpawn[${e},NPC Corpse radius ${NLlootdist}].ID}]
next e
for e 1 to 20
if (${NLTempCorpse[${e}]}<=0) {
echo Autoloot: No More Corpses Found
}
}
; Check if corpse is listed in Skip array
for w 1 to 20
if (${NLTempCorpse[${e}]}==${NLCorpseskip[${w},1]}) {
echo Autoloot: Skipping ${NLTempCorpse[${e}]}; Per Skip List
next e
}
next w
; Test Z distance
if (${Spawn[${NLTempCorpse[${e}]}].DistanceZ}>50) {
call Addcorpse
echo Autoloot: Skipping ${NLTempCorpse[${e}]}; Z Plane out of limits
next e
}
; Make sure Spawnid is a corpse
if (${Spawn[${NLTempCorpse[${e}]}].Type.NotEqual[Corpse]}) {
echo Autoloot: Skipping ${NLTempCorpse[${e}]}; Not a corpse!
next e
}
; Check if corpse is players corpse
if (${Spawn[${NLTempCorpse[${e}]}].Deity.ID}!=0) {
echo Autoloot: Skipping ${NLTempCorpse[${e}]}; Is a PLAYERS corpse!
next e
}
;Target corpse and begin looting
wait 1
squelch /target id ${NLTempCorpse[${e}]}
wait 12 ${Target.ID}==${NLTempCorpse[${e}]}
echo Autoloot: Looting ${Target.CleanName}
wait 50 ${Target.ID}==${NLTempCorpse[${e}]}
if (${Target.ID}!=${NLTempCorpse[${e}]}) next e
; Get 5 seconds (max) closer; warning, no detecting being stuck!
face fast ${If[${Me.Underwater},,nolook]}
if (${Me.Buff[Summon Drogmor].ID} || ${Me.Buff[Summon Horse].ID}) /dismount
keypress forward hold
wait 50 ${Target.Distance}<5
keypress forward
; Check for full inventory
if (!${Me.FreeInventory}) {
;/beep
echo Autoloot: ** INVENTORY FULL !
NLlootmode:Set[OFF]
echo Autoloot: ** AutoLooting is now OFF!
}
}
wait 10
loot
wait 10 ${Window[LootWnd].Open}
; Check if unable to loot at this time
ExecuteQueued NotYourKill
; Corpse with no items
if (!${Corpse.Items}) {
echo Autoloot: NO LOOT! Cheap Bastard!
notify LootWnd DoneButton leftmouseup
wait 10 !${Corpse.Open}
next e
}
; Get total count of items on corpse
loottotal:Set[${Math.Calc[${Corpse.Items}]}]
:autoxplootlag
if (${loottotal}!=${Corpse.Items}) {
loottotal:Set[${Corpse.Items}]
/goto :autoxplootlag
}
; Check items on Corpse
for lootslot 1 to ${loottotal}
wait 10 ${InvSlot[loot${lootslot}].Item.ID}!=0
; Check if item is LORE
if (${InvSlot[loot${lootslot}].Item.Lore}) {
echo Autoloot: Lore ITEM Found
if (${FindItem[${InvSlot[loot${lootslot}].Item.Name}].InvSlot}) {
echo Autoloot: Skipping; Found Loreitem in Characters Inventory
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
if (${FindItem[${InvSlot[loot${lootslot}].Item.Name}].InvSlot.Pack}) {
echo Autoloot: Skipping; Found Loreitem in Characters Bags
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
}
; Handling of NODROP items on corpse
if (${InvSlot[loot${lootslot}].Item.NoDrop}) {
echo Autoloot: NO DROP ITEM Found
if (!${Ini[${NLLootINIFile},"${InvSlot[loot${lootslot}].Item.Name.Left[1]}","${InvSlot[loot${lootslot}].Item.Name}"].Length}) {
ini "${NLLootINIFile}" "${InvSlot[loot${lootslot}].Item.Name.Left[1]}" "${InvSlot[loot${lootslot}].Item.Name}" NDITEM
echo Autoloot: Adding ${InvSlot[loot${lootslot}].Item.Name} to ${NLLootINIFile} defaulting as NDITEM
}
if (${NLlootmode.Equal[DROP]}) {
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
if (${NLlootmode.Equal[NDITEM]}) {
if (${Ini[${NLLootINIFile},"${InvSlot[loot${lootslot}].Item.Name.Left[1]}","${InvSlot[loot${lootslot}].Item.Name}"].Equal[NDKeep]}) {
call LootItem ${lootslot} KEEP
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
if (${Ini[${NLLootINIFile},"${InvSlot[loot${lootslot}].Item.Name.Left[1]}","${InvSlot[loot${lootslot}].Item.Name}"].Equal[NDDestroy]}) {
call LootItem ${lootslot} DESTROY
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
if (${Ini[${NLLootINIFile},"${InvSlot[loot${lootslot}].Item.Name.Left[1]}","${InvSlot[loot${lootslot}].Item.Name}"].Equal[NDITEM]}) {
echo Autoloot: Skipping ${InvSlot[loot${lootslot}].Item.Name} per NDITEM flag
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
}
if (${NLlootmode.Equal[ALL]}) {
call LootItem ${lootslot} KEEP
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
}
; Loot droppable items and Keep/Destroy by ini flags
if (!${Ini[${NLLootINIFile},"${InvSlot[loot${lootslot}].Item.Name.Left[1]}","${InvSlot[loot${lootslot}].Item.Name}"].Length}) {
ini "${NLLootINIFile}" "${InvSlot[loot${lootslot}].Item.Name.Left[1]}" "${InvSlot[loot${lootslot}].Item.Name}" Keep
echo Autoloot: Adding ${InvSlot[loot${lootslot}].Item.Name} to ${NLLootINIFile} defaulting as Keep
}
if (${Ini[${NLLootINIFile},"${InvSlot[loot${lootslot}].Item.Name.Left[1]}","${InvSlot[loot${lootslot}].Item.Name}"].Equal[Keep]}) {
call LootItem ${lootslot} KEEP
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
if (${Ini[${NLLootINIFile},"${InvSlot[loot${lootslot}].Item.Name.Left[1]}","${InvSlot[loot${lootslot}].Item.Name}"].Equal[Destroy]}) {
call LootItem ${lootslot} Destroy
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
}
if (${lootslot}>=${loottotal}) {
call Itemsleft
next e
}
next lootslot
next e
}
function Itemsleft()
{
;Link remaining items on corpse
if (${Corpse.Items}) {
notify LootWND LW_BroadcastButton leftmouseup
keypress enter chat
call Addcorpse
}
notify LootWnd DoneButton leftmouseup
wait 10 !${Corpse.Open}
}
function Addcorpse()
{
if (!${Defined[e]}) variable int e
for e 20 downto 2
NLCorpseskip[${e},1]:Set[${NLCorpseskip[${Math.Calc[${e}-1]},1]}]
NLCorpseskip[${e},2]:Set[${NLCorpseskip[${Math.Calc[${e}-1]},2]}]
next e
NLCorpseskip[1,1]:Set[${Target.ID}]
NLCorpseskip[1,2]:Set[${Math.Calc[${MacroQuest.Running}+1800000]}]
}
function addnotmykill()
{
if (!${Defined[e]}) variable int e
for e 20 downto 2
if (${NLCorpseskip[${e},1]}!=0) next e
NLCorpseskip[${e},1]:Set[${Target.ID}]
NLCorpseskip[${e},2]:Set[${Math.Calc[${MacroQuest.Running}+180000]}]
}
function Updatecorpse()
{
if (!${Defined[e]}) variable int e
for e 1 to 20
if (!${Spawn[${NLCorpseskip[${e},1]}].ID}) NLCorpseskip[${e},1]:Set[0]
if (${NLCorpseskip[${e},2]}<=${MacroQuest.Running} && ${NLCorpseskip[${e},1]}!=0) NLCorpseskip[${e},1]:Set[0]
next e
}
function LootItem(int lootslot, string handling)
{
if (${handling.Equal[KEEP]}) echo Autoloot: Keeping a ${InvSlot[loot${lootslot}].Item.Name}... WOOT!
if (${handling.Equal[DESTROY]}) echo Autoloot: Destroying a ${InvSlot[loot${lootslot}].Item.Name}... Bubbye!
:retryloot
itemnotify loot${lootslot} leftmouseup
if (!${Cursor.ID} && ${NLlootmode.Equal[DROP]}) {
if (${Window[ConfirmationDialogBox].Open}) notify ConfirmationDialogBox No_Button leftmouseup
/goto :retryloot
}
if (!${Cursor.ID} && ${NLlootmode.NotEqual[DROP]}) {
if (${Window[ConfirmationDialogBox].Open}) notify ConfirmationDialogBox Yes_Button leftmouseup
/goto :retryloot
}
:NLLootItem
if (${handling.Equal[KEEP]}) /autoinventory
if (${handling.Equal[DESTROY]}) /destroy
if (${Cursor.ID}) /goto :NLLootItem
}
function LoadAliases()
{
ini "${NLLootINIFile}" Loot Version "${NLVersion}"
/squelch /alias /autoloot echo SetAutoLoot
/squelch /alias /lootstatus echo Autoloot Status
}
function BuildINI()
{
; Build a retarded ini, but it makes it alpha ordered
echo Building INI file
ini "${NLLootINIFile}" Loot AutoLootMode OFF
ini "${NLLootINIFile}" Loot AutoLootDistance 100
ini "${NLLootINIFile}" A A NULL
ini "${NLLootINIFile}" B B NULL
ini "${NLLootINIFile}" C C NULL
ini "${NLLootINIFile}" D D NULL
ini "${NLLootINIFile}" E E NULL
ini "${NLLootINIFile}" F F NULL
ini "${NLLootINIFile}" G G NULL
ini "${NLLootINIFile}" H H NULL
ini "${NLLootINIFile}" I I NULL
ini "${NLLootINIFile}" J J NULL
ini "${NLLootINIFile}" K K NULL
ini "${NLLootINIFile}" L L NULL
ini "${NLLootINIFile}" M M NULL
ini "${NLLootINIFile}" N N NULL
ini "${NLLootINIFile}" O O NULL
ini "${NLLootINIFile}" P P NULL
ini "${NLLootINIFile}" Q Q NULL
ini "${NLLootINIFile}" R R NULL
ini "${NLLootINIFile}" S S NULL
ini "${NLLootINIFile}" T T NULL
ini "${NLLootINIFile}" U U NULL
ini "${NLLootINIFile}" V V NULL
ini "${NLLootINIFile}" W W NULL
ini "${NLLootINIFile}" X X NULL
ini "${NLLootINIFile}" Y Y NULL
ini "${NLLootINIFile}" Z Z NULL
}
function Updateini()
{
ini "${NLLootINIFile}" "Loot" "AutoLootMode" "${NLlootmode}"
ini "${NLLootINIFile}" "Loot" "AutoLootDistance" "${NLlootdist}"
}
function Event_SetAutoLoot(string Line)
{
; Set the new loot distance, if supplied
if (${Line.Arg[4].Length}) NLlootdist:Set[${Line.Arg[4]}]
; Set the mode
if (${Line.Arg[3].Equal[ALL]}) {
NLlootmode:Set[ALL]
echo ** AutoLoot ON - Will loot ALL items
echo ****CAUTION**** Turning off requestor for NODROP items!!! ****CAUTION****
echo ** AutoLoot distance is ${NLlootdist} ft.
EQExecute /lootnodrop never
call Updateini
}
}
if (${Line.Arg[3].Equal[DROP]}) {
NLlootmode:Set[DROP]
echo ** AutoLoot ON - Will loot only DROPABLE items
echo ** AutoLoot distance is ${NLlootdist} ft.
EQExecute /lootnodrop always
call Updateini
}
}
if (${Line.Arg[3].Equal[NDITEM]}) {
NLlootmode:Set[NDITEM]
echo ** AutoLoot ON - Will loot only SPECIFIED NO-DROP items
echo ** AutoLoot distance is ${NLlootdist} ft.
EQExecute /lootnodrop always
call Updateini
}
}
if (${Line.Arg[3].Equal[OFF]})
{
NLlootmode:Set[OFF]
echo ** AutoLoot OFF - Will NOT loot any items
call Updateini
}
}
echo Syntax:
echo /autoloot <all|drop|nditem|off> <radius#>
echo Defaulting to OFF
NLlootmode:Set[OFF]
call Updateini
}
function Event_Autolootstatus()
{
if (${NLlootmode.Equal[ALL]})
{
echo ** AutoLoot ON - Will loot ALL items
echo ****CAUTION**** Turning off requestor for NODROP items!!! ****CAUTION****
echo ** AutoLoot distance is ${NLlootdist} ft.
}
if (${NLlootmode.Equal[DROP]})
{
echo ** AutoLoot ON - Will loot only DROPABLE items
echo ** AutoLoot distance is ${NLlootdist} ft.
}
if (${NLlootmode.Equal[NDITEM]})
{
echo ** AutoLoot ON - Will loot only SPECIFIED NO-DROP items
echo ** AutoLoot distance is ${NLlootdist} ft.
}
if (${NLlootmode.Equal[OFF]})
{
echo ** AutoLoot OFF - Will NOT loot any items
}
}
function Event_NotYourKill()
{
echo Autoloot: Adding corpse to unable to loot list
call addnotmykill
}
Variable string NLlootdist
NLlootmode:Set[${Ini[${NLLootINIFile},Loot,AutoLootMode]}]
NLlootdist:Set[${Ini[${NLLootINIFile},Loot,AutoLootDistance]}]
