shanecol had a post earlier this year for how to modify KA11 to speed up the PetToys routine. I've modified that for KA12 to incorporate his speedup AND allow for passing out more than two items per pettoys#=.
This should be pasted over everything from
to
My 110 Mage INI's Pet Toys section looks like this:
This should be pasted over everything from
| SUB: Check PetToys - Based on code from el_nene's autobot. Used with permission.to
| SUB: Check PluginMy 110 Mage INI's Pet Toys section looks like this:
Code:
PetToysOn=1
PetToysSize=4
PetToys1=Grant Wirn's Armaments|Summoned: Gorstruck Fireblade|Summoned: Gorstruck Fireblade
PetToys2=Grant Ioulin's Heirlooms|Arcronite Linked Bracelet|Arcronite Jade Bracelet|Arcronite Gold Ring|Arcronite Ridged Earhoop|Arcronite Satin Choker|Arcronite Woven Shawl
PetToys3=Grant Wirn's Plate|Magmaforged Plate Breastplate|Magmaforged Plate Helm|Magmaforged Plate Vambraces|Magmaforged Plate Greaves|Magmaforged Plate Boots|Magmaforged Plate Gauntlets|Magmaforged Plate Bracers|Summoned: Magmaforged Belt
PetToys4=Grant Visor of Gobeker|Summoned: Visor of Gobeker
Code:
| SUB: Check PetToys - Based on code from el_nene's autobot. Used with permission.
| Autobot is available at www.Macroquest2.com VIP macro section.
| Updated and Revised for KissAssist
| ----------------------------------------------------------------------------
Sub PetToys(string petName)
/if (!${Me.Pet.ID}) /return w
DEBUGPET PetToys Enter
/declare i int local
/declare j int local
/declare GiveCnt int local 0
/declare GrabItem int local 0
/declare PetToySpell string local 0
/declare FullText string local
/declare 2ndPart string local
/declare 3rdPart string local
/declare 4thPart string local
/declare 5thPart string local
/declare 6thPart string local
/declare 7thPart string local
/declare 8thPart string local
/declare 9thPart string local
/declare PetToysTemp string local ${Ini[${IniFileName},Pet,PetToysGave]}
/declare GaveItem int local 1
/declare CondNo int local 0
/call OpenInvSlot
/declare petID int local ${Spawn[pet ${petName}].ID}
/if (!${Defined[PetToysOn]}) /return
/if (!${PetToysOn}) /return 0
/if (${BagNum}==0) {
/echo You must have an empty Top Inventory slot for Pet Toys to work.
/varset PetToysOn 0
/return X
}
/if (!${InvSlot[pack${BagNum}].Item.Container} && !${Me.FreeInventory}) {
/echo Inventory is full
/varset PetToysOn 0
/return X
}
| reset if different pet name only on my pet
/if (!${PetToysTemp.Find[${petName}]} && ${Me.Pet.CleanName.Equal[${petName}]}) {
/ini "${IniFileName}" "Pet" "PetToysGave" "0"
/varset PetToysTemp 0
}
/for i 1 to ${PetToys.Size}
DEBUGPET CHECKING: ${PetToys[${i}]}
/if (${ConOn} && ${PetToys[${i}].Find[|cond]}) {
/varset CondNo ${PetToys[${i}].Mid[${Math.Calc[${PetToys[${i}].Find[|cond]}+5]},3]}
} else {
/varset CondNo 0
}
/if (${DebugPet}) {
/echo \atPetDebug PetToys 1: ${PetToys[${i}]}
/echo \atPetDebug PetToys 2: ${PetToysTemp}
/echo \atPetDebug PetToys 3: ${PetToys[${i}].Equal[Null]} || ${PetToysTemp.Find[${petName}]} && ${PetToysTemp.Find[${PetToys[${i}]}]}
/echo \atPetDebug PetToys 4: ${If[CondNo,${Cond[${CondNo}]},0]}
}
/if (${CondNo}) {
/if (${If[${Cond[${CondNo}]},0,1]}) /continue
}
| Had to add pet name check else it will always skip giving weapons to OTHER pets.
DEBUGPET PetToys ${PetToys[${i}].Equal[Null]} || (${Me.Pet.CleanName.Equal[${petName}]} && ${PetToysTemp.Find[${petName}]} && ${PetToysTemp.Find[${PetToys[${i}]}]}) SkipPetToy 1
/if (${PetToys[${i}].Equal[Null]} || (${Me.Pet.CleanName.Equal[${petName}]} && ${PetToysTemp.Find[${petName}]} && ${PetToysTemp.Find[${PetToys[${i}]}]})) /continue
| Are we handing weapons to the pet
/if (${PetToys[${i}].Arg[2,|].Length} && ${PetToys[${i}].Arg[2,|].NotEqual[null]}) {
/varset FullText ${PetToys[${i}]}
/varset PetToySpell ${PetToys[${i}].Arg[1,|]}
/varset 2ndPart ${PetToys[${i}].Arg[2,|]}
/varset 3rdPart ${PetToys[${i}].Arg[3,|]}
/varset 4thPart ${PetToys[${i}].Arg[4,|]}
/varset 5thPart ${PetToys[${i}].Arg[5,|]}
/varset 6thPart ${PetToys[${i}].Arg[6,|]}
/varset 7thPart ${PetToys[${i}].Arg[7,|]}
/varset 8thPart ${PetToys[${i}].Arg[8,|]}
/varset 9thPart ${PetToys[${i}].Arg[9,|]}
} else {
/varset FullText
/varset PetToySpell ${PetToys[${i}]}
/varset 2ndPart
/varset 3rdPart
/varset 4thPart
/varset 5thPart
/varset 6thPart
/varset 7thPart
/varset 8thPart
/varset 9thPart
}
/varset GiveCnt 0
DEBUGPET PetToys ${Me.Pet.CleanName.Equal[${petName}]} && ${2ndPart.Length} && ${PetToysTemp.Find[1]} && ${PetToysTemp.Find[2]} SkipPetToy 2
/if (${Me.Pet.CleanName.Equal[${petName}]} && ${2ndPart.Length} && ${PetToysTemp.Find[1]} && ${PetToysTemp.Find[2]}) /continue
| Check if spell level less than 76 because mage pets auto equipped after that.
/if (${Me.Pet.CleanName.Equal[${petName}]} && ${Spell[${PetToySpell}].Level}>=76 && (${PetToySpell.Find[Plate]} || ${PetToySpell.Find[Muzzle]} || ${PetToySpell.Find[Visor]} || ${PetToySpell.Find[Belt]})) /continue
| Check for pet toy spells in book to prevent double casting of items
/if (${Me.Book[${PetToySpell}]}) {
/call CastWhat "${PetToySpell}" ${Me.ID} Pet-nomem 0
/if (!${PetToysTemp.Find[${petName}]} && ${Me.Pet.CleanName.Equal[${petName}]}) {
/ini "${IniFileName}" "Pet" "PetToysGave" "${petName}"
/varset PetToysTemp ${Ini[${IniFileName},Pet,PetToysGave]}
}
/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
/echo Casting pet toy spell >> ${PetToySpell} <<
}
/delay 15s ${Cursor.ID}
/if (!${Cursor.ID}) /return 0
| Check if spell has summoned a bag or folded pack
/if (${Cursor.Container} || ${Cursor.Name.Find[Folded]}) {
| If item is in Inv Slot exchange it with bag on cursor
/if (${InvSlot[pack${i}].Item.ID}) /nomodkey /itemnotify pack${BagNum} leftmouseup
/while (1) {
/delay 2s ${Cursor.ID}
| Drop bag or item into inventory
/autoinventory
/delay 1s
| Drop exchanged item into inventory after bag is dropped
/if (${Cursor.ID}) /autoinventory
| If folded pack right click to convert to phantom satchel
/if (${InvSlot[pack${BagNum}].Item.Name.Find[folded]}) {
/nomodkey /itemnotify pack${BagNum} rightmouseup
/echo Opening ${InvSlot[pack${BagNum}].Item.Name}
/delay 3s
} else {
/break
}
}
}
/if (${InvSlot[pack${BagNum}].Item.Container} && (${InvSlot[pack${BagNum}].Item.Name.Find[Phantom Satchel]} || ${InvSlot[pack${BagNum}].Item.Name.Find[Pouch of Quellious]})) {
| Open the bag
/nomodkey /itemnotify pack${BagNum} rightmouseup
/delay 10
DEBUGPET PetToys ${i} ${PetToySpell} ${2ndPart} ${3rdPart}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${2ndPart}1]}) && ${2ndPart.Length} && ${FindItemCount[=${2ndPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${2ndPart.Length} && ${FindItemCount[=${2ndPart}]})) {
/call GiveTo "${2ndPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${2ndPart}1
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${3rdPart}2]}) && ${3rdPart.Length} && ${FindItemCount[=${3rdPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${3rdPart.Length} && ${FindItemCount[=${3rdPart}]})) {
/call GiveTo "${3rdPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${3rdPart}2
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${4thPart}2]}) && ${4thPart.Length} && ${FindItemCount[=${4thPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${4thPart.Length} && ${FindItemCount[=${4thPart}]})) {
/call GiveTo "${4thPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${4thPart}2
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${5thPart}2]}) && ${5thPart.Length} && ${FindItemCount[=${5thPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${5thPart.Length} && ${FindItemCount[=${5thPart}]})) {
/call GiveTo "${5thPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${5thPart}2
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
/if (${GiveCnt}>=4) {
/call PressGive
/varset GiveCnt 0
}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${6thPart}2]}) && ${6thPart.Length} && ${FindItemCount[=${6thPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${6thPart.Length} && ${FindItemCount[=${6thPart}]})) {
/call GiveTo "${6thPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${6thPart}2
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${7thPart}2]}) && ${7thPart.Length} && ${FindItemCount[=${7thPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${7thPart.Length} && ${FindItemCount[=${7thPart}]})) {
/call GiveTo "${7thPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${7thPart}2
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${8thPart}2]}) && ${8thPart.Length} && ${FindItemCount[=${8thPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${8thPart.Length} && ${FindItemCount[=${8thPart}]})) {
/call GiveTo "${8thPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${8thPart}2
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
| Condition revised to allow for pet weapons to be given to other people's pets.
/if (((${Me.Pet.CleanName.Equal[${petName}]} && !${PetToysTemp.Find[${9thPart}2]}) && ${9thPart.Length} && ${FindItemCount[=${9thPart}]}) || (!${Me.Pet.CleanName.Equal[${petName}]} && ${9thPart.Length} && ${FindItemCount[=${9thPart}]})) {
/call GiveTo "${9thPart}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${9thPart}2
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
/if (${GiveCnt}>=4) {
/call PressGive
/varset GiveCnt 0
}
/if (!${2ndPart.Length}) {
/for j 0 to ${InvSlot[pack${BagNum}].Item.Container}
/if (${InvSlot[pack${BagNum}].Item.Item[${j}].ID} && ${InvSlot[pack${BagNum}].Item.Item[${j}].Name.Length}) {
/call GiveTo "${InvSlot[pack${BagNum}].Item.Item[${j}].Name}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
}
/if (${GiveCnt}>=4) {
/call PressGive
/varset GiveCnt 0
}
/next j
/if (${j}>=8 && !${PetToysTemp.Find[${PetToySpell}]} && ${Me.Pet.CleanName.Equal[${petName}]}) {
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}
/ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
}
}
}
/if (${Cursor.Name.Find[Summoned:]}) {
/if (${2ndPart.Length} && !${PetToysTemp.Find[1]}) {
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${2ndPart}1
} else /if (${2ndPart.Length} && ${PetToysTemp.Find[1]} ) {
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${2ndPart}2
} else /if (!${2ndPart.Length} && !${PetToysTemp.Find[${PetToySpell}]}) {
/varset PetToysTemp ${PetToysTemp}|${PetToySpell}:${Cursor.Name}
}
/call GiveTo "${Cursor.Name}" ${petID}
/varcalc GiveCnt ${GiveCnt}+1
/if (${Me.Pet.CleanName.Equal[${petName}]}) /ini "${IniFileName}" "Pet" "PetToysGave" "${PetToysTemp}"
/varset GaveItem 0
}
/call PressGive
/if (${InvSlot[pack${BagNum}].Item.Name.Find[Phantom Satchel]} || ${InvSlot[pack${BagNum}].Item.Name.Find[Pouch of Quellious]}) /call DestroyBag
}
/next i
| MUST reset PetToysGave after cycle complete in order to stop calling PetToys all the time.
/varset PetToysGave ${PetToysTemp}
/if (${Window[InventoryWindow].Open} && !${GaveItem}) /keypress inventory
/varset PetToysDone 1
/call DoWeMove 1 PetToys
DEBUGPET PetToys Leave
/return
| ----------------------------------------------------------------------------
| SUB: Check OpenInvSlot - Based on code from el_nene's autobot. Used with permission.
| Autobot is available at www.Macroquest2.com VIP macro section.
| Updated and Revised for KissAssist
| ----------------------------------------------------------------------------
Sub OpenInvSlot
DEBUGBUFF OpenInvSlot Enter
/if (${BagNum}) /return
/declare i int local
/varset BagNum 0
/for i 1 to 10
/if (${InvSlot[pack${i}].Item.Container}) /continue
/if (!${InvSlot[pack${i}].Item.Container} || ${InvSlot[pack${i}].Item.ID}==0) {
| Must have at least 2 inv slots open in order to swap bags and items
/if (${Me.FreeInventory}>=2) /varset BagNum ${i}
}
/if (${BagNum}) {
/echo Pet Toys: Inventory slot ${i} is empty using that one.
/delay .5
/return
}
/next i
DEBUGBUFF OpenInvSlot Leave
/return
| ----------------------------------------------------------------------------
| SUB: Check DestroyBag - Based on code from el_nene's autobot. Used with permission.
| Autobot is available at www.Macroquest2.com VIP macro section.
| Updated and Revised for KissAssist
| ----------------------------------------------------------------------------
Sub DestroyBag
DEBUGBUFF DestroyBag Enter
/declare j int local
| Make sure bag has no items other than summoned in it before deleting.
/if (${InvSlot[pack${BagNum}].Item.Items}) {
/for j 0 to ${InvSlot[pack${BagNum}].Item.Container}
/if (!${InvSlot[pack${BagNum}].Item.Item[${j}].NoRent} && ${InvSlot[pack${BagNum}].Item.Item[${j}].Name.Length}) {
/echo Bag has non summoned item(s) in it. Aborting delete. Pet Toys Off
/varset PetToysOn 0
/return
}
/next j
}
/if (${InvSlot[pack${BagNum}].Item.Name.Find[Phantom Satchel]} || ${InvSlot[pack${BagNum}].Item.Name.Find[Pouch of Quellious]}) {
/nomodkey /itemnotify pack${BagNum} leftmouseup
/delay 5s ${Cursor.ID}
/if (${Cursor.Name.Find[Phantom Satchel]} || ${Cursor.Name.Find[Pouch of Quellious]}) /destroy
/delay 20 !${Cursor.ID}
}
DEBUGBUFF Leave
/return
| ----------------------------------------------------------------------------
| SUB: Check GiveTo - Based on code from el_nene's autobot. Used with permission.
| Autobot is available at www.Macroquest2.com VIP macro section.
| Updated and Revised for KissAssist
| ----------------------------------------------------------------------------
Sub GiveTo(string GItem, int GTarget)
DEBUGBUFF GiveTo Enter
/declare ItemSummoned int local 0
/if (${Target.ID}!=${GTarget}) {
/target id ${GTarget}
/delay 2s ${Target.ID}==${GTarget}
}
/if (${Target.Distance}>5 && ${Target.Distance}<=${CampRadius}) {
/moveto id ${Target.ID} mdist 5
/delay 50 ${MoveTo.Stopped}
}
/if (${Me.Mount.ID}) {
/dismount
/delay 20 !${Me.Mount.ID}
}
/if (${Me.Levitating}) {
/removelev
/delay 20 !${Me.Levitating}
}
/while (!${Cursor.ID} && ${FindItemCount[=${GItem}]}>0) {
/shift /itemnotify "${GItem}" leftmouseup
/delay 20 ${Cursor.ID}
}
/while (${Cursor.ID} && ${Cursor.NoRent}) {
/if (${Cursor.ID}==${FindItem[=${GItem}].ID}) {
/varset ItemSummoned 1
/nomodkey /click left target
}
/delay 2
}
DEBUGBUFF GiveTo Leave
/return
| ----------------------------------------------------------------------------
| SUB: PressGive
| ----------------------------------------------------------------------------
Sub PressGive()
/delay 30 ${Window[GiveWnd].Open}
/if (${Window[GiveWnd].Open}) {
/notify GiveWnd GVW_Give_Button leftmouseup
}
/delay 15
| New pet patch gives back item if pet has equipped. Delete item from cursor.
/if (${Cursor.ID} && (${Cursor.NoRent} || ${Cursor.Name.Find[muzzle]} || ${Cursor.Name.Find[visor]} || ${Cursor.Name.Find[belt]})) {
/while (${Cursor.ID}) {
/destroy
/delay 10
}
}
/delay 200 !${Window[GiveWnd].Open}
/return
| ----------------------------------------------------------------------------
| SUB: Check Plugin

