Page 4 of 4

Posted: Mon Jan 07, 2008 8:59 pm
by mystikule
Since this seems to be the only official thread for ninjadvloot.inc.......
I'm sure there are versions exactly like this floating around in zips and whatnot, but here is SELL option added....

Code: Select all

| Ninjadvloot.inc v1.5
#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  30    int
/call ALLoadVar Settings CorpseRotTime 440s  string
/call ALLoadVar Settings ReportLoot    TRUE bool
/call ALLoadVar Settings LootChannel   g  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,Sell]}) {
    /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 ((${Ini[Loot.ini,"${Corpse.Item[${i}].Name.Left[1]}","${Corpse.Item[${i}]}"].Equal[Keep]} || ${Ini[Loot.ini,"${Corpse.Item[${i}].Name.Left[1]}","${Corpse.Item[${i}]}"].Equal[Sell]}) && (!${Corpse.Item[${i}].Lore} || !${FindItem[${Corpse.Item[${i}]}].ID}) && (${Me.FreeInventory} || (${FindItemCount[=${Corpse.Item[${i}].Name}]} && ${Corpse.Item[${i}].Stackable} && ${Corpse.Item[${i}].FreeStack}))) /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} && ${LootList.Length}) {
      /notify LootWND LW_BroadcastButton leftmouseup
      /keypress enter chat
    }
    /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 /shift /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}
/if (${Cursor.ID}) /call CheckCursor
/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},|]}].ID} && ${Spawn[${CorpseList.Arg[${i},|]}].LineOfSight} && !${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}>5) /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}<10) /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

Posted: Wed May 27, 2009 4:02 am
by ounvme
Heres a challenging one......How can this be modified to keep all spells and all tomes without listing them in the ini. Is there a way to look for just Spell: and default to Keep?

Posted: Wed May 27, 2009 5:04 am
by dont_know_at_all

Code: Select all

/if (${Corpse.Item[${i}].Name.Find[Spell:]}) /ini "loot.ini" "${Corpse.Item[${i}].Name.Left[1]}" "${Corpse.Item[${i}]}" Keep 

See if you can figure out where it goes...

Posted: Wed May 27, 2009 5:23 pm
by ounvme
Tried this

Code: Select all

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}].Name.Find[Song:]}) /ini "loot.ini" "${Corpse.Item[${i}].Name.Left[1]}" "${Corpse.Item[${i}]}" Keep 
/if (${Corpse.Item[${i}].Name.Find[Spell:]}) /ini "loot.ini" "${Corpse.Item[${i}].Name.Left[1]}" "${Corpse.Item[${i}]}" Keep 
/if (${Corpse.Item[${i}].Name.Find[Tome]}) /ini "loot.ini" "${Corpse.Item[${i}].Name.Left[1]}" "${Corpse.Item[${i}]}" Keep 
    
/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}]}" Destroy 
  } 
  /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 
Still not keeping Spells Songs or Tomes
Is this the correct spot?

From the INI added
Spell: Ruinous Venin Rk. II=Destroy

I have it set to destroy all the new added things but would like new spells tomes and songs saved

Posted: Wed May 27, 2009 6:47 pm
by drzoon
Not quite, where you've added it, it will set the item as Keep momentarily, and then the 2 lines afterwards:

Code: Select all

/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}]}" Destroy
Will immediately set it to Destroy or Ignore, depending on whether it's no drop or droppable.

dkaa cleverly hasn't given you the full solution :) The 2nd line of the two I've quoted above will set any item that does not already have an entry in the INI file (everything new) to "Destroy". What you want to do is modify/add to that line, to first check if the item is a spell, and then add it as "Keep" and if not, then add it as "Destroy".

You need to use an if else statement to make it work. Give it a go and see what you can come up with.

question about Ver 1.5

Posted: Thu Oct 08, 2009 9:46 pm
by tekno
I was looking at ver 1.5 and the posts following it about things that needed to be fixed and was wondering if the post that have ver 1.5 into is the updated / working macro

Posted: Tue Jan 12, 2010 5:16 pm
by pantaloonz
Hi!

Anyone out there?

I'm using this include. It works great: /call LootCorpse

Except I can't loot stacked items. The accept button just mocks me.

I have not created an ini file I just want it to loot everything on the corpse.

Pantz

Posted: Tue Jan 12, 2010 5:44 pm
by dont_know_at_all

Code: Select all

/loot
/delay 3s ${Corpse.Open} 
/nomodkey /notify LW_LootAllButton leftmouseup 
/nomodkey /notify LootWnd LW_DoneButton leftmouseup 

Posted: Wed Jan 13, 2010 10:00 am
by pantaloonz
Greets

dkaa, don't know where you get the time to monitor all this stuff, but it IS appreciated. (at least by me)
Added code, testing after patch, thanks.

Code: Select all

/target dkaa
/give coffee
/if (!${target.type.want[coffee]}) /give Beer
/if (${target.type.want[money]}) /say Check is in the mail.
/return 
Pantz.

Posted: Thu Jan 14, 2010 1:45 pm
by pantaloonz
I added this into the include (in red)

Code: Select all

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 1s
[color=red]/nomodkey /notify QuantityWnd QTYW_Accept_Button leftmouseup[/color]
/delay 5s ${Cursor.ID} || ${WhichButton.NotEqual[left]}
/if (${DoWhat.Equal[Destroy]} && ${Cursor.ID}==${CorpseItemID}) /destroy
/delay 3s !${Corpse.Item[${i}].ID}
/if (${Cursor.ID}) /call CheckCursor
/return
I know it's not awesome design to just have a line executed no matter what the condition, however,This seems to have made my quantity accept problem go away.

The tests continue.

Pantz

Posted: Thu Jan 14, 2010 1:57 pm
by drzoon
Or change this line:

Code: Select all

/nomodkey /itemnotify loot${i} ${WhichButton}mouseup
to

Code: Select all

/nomodkey /shiftkey /itemnotify loot${i} ${WhichButton}mouseup
This change is actually in the v1.5 code at the top of this page, which I assumed you were using.

Posted: Thu Jan 14, 2010 2:58 pm
by pantaloonz
Thanks,

I'll give that a go, I'm all for clean code.

I was using the original post as I was assuming edits were being made to it.

I'll grab the 1.5 and be happy about it.!

Pantz