|: --------------------------------------------------------------------------------------------
|: Tribute everything in bag slot 2
|: --------------------------------------------------------------------------------------------
|: --------------------------------------------------------------------------------------------
|: Intentional for vile bracket matching ([{
|: --------------------------------------------------------------------------------------------
#warning
#event ActionDone "#*#favor for your tribute#*#"
#event ActionDone "#*#told you, 'I will deliver#*#"
#event FullUP "#*#Tribute Favor cap reached#*#"
#event FullUP "#*#until some is spent#*#"
|: --------------------------------------------------------------------------------------------
|: SUB: main
|: --------------------------------------------------------------------------------------------
Sub Main
/declare fromBag int local 1
/declare toBag int local 10
/declare accepted bool outer
/declare fullup bool outer FALSE
/declare junk string outer
/declare actionStr string local ${Param0}
/declare action string local ${Param0}
/if (!${Defined[Param0]}) {
/echo If you have Tribute or Pacel window open, relevant button clicked
/echo For parcel name filled in will be used !
/echo
/echo /mac cleanit bag 1
/echo All items in \agbag 1\ax will be used as tribute or parceled!
/echo /mac cleanit bag 1 BagN
/echo All items in \agbag 1\ax to \agN\ax will be used as tribute or parceled!
/echo /mac cleanit junk
/echo Tribute/Parcel Stone of Tranquility | Small Chunk of Velium
/echo /mac cleanit destroy
/echo |Vegetables|Pod of Water|Roots|Mushroom|Pile of Rust|Phosphorescent Goop|Lichen Roots|Fish Scales|Small Chunk of Velium|Guava|
/return
}
/if (${Param0.Equal[bag]}) {
/if (${Defined[Param1]} && !${Defined[Param2]}) {
/varset fromBag ${Param1}
/varset toBag ${Param1}
} else /if (${Defined[Param1]} && ${Defined[Param2]}) {
/varset fromBag ${Param1}
/varset toBag ${Param2}
} else {
/varset fromBag 1
/varset toBag 1
}
/varset actionStr all
/varset action TributeOrParcel
} else /if (${Param0.Equal[junk]}) {
/varset fromBag 1
/varset toBag 10
/varset actionStr |Stone of Tranquility|Small Chunk of Velium|
/varset action TributeOrParcel
} else /if (${Param0.Equal[destroy]}) {
/varset fromBag 1
/varset toBag 10
/varset actionStr |Vegetables|Pod of Water|Roots|Mushroom|Pile of Rust|Phosphorescent Goop|Lichen Roots|Fish Scales|Small Chunk of Velium|Guava|
/varset action DestroyIt
}
/if (${Bool[${Plugin[mq2autoforage]}]}) /stopforage
/if (${Bool[${Plugin[mq2autoloot]}]}) /autoloot turn off
/if (${Window[MerchantWnd].Open}) /notify MerchantWnd MW_MerchantSubWindows tabselect 3
/call FindIt ${fromBag} ${toBag} "${actionStr}" 0 ${action}
/echo \ag/endm\ax last chance to abort / set parcelname!
/beep
/mqp
/call FindIt ${fromBag} ${toBag} "${actionStr}" 1 ${action}
/echo Hope you are not too upset !
/if (${Bool[${Plugin[mq2autoloot]}]}) /autoloot turn on
/if (${Bool[${Plugin[mq2autoforage]}]}) /startforage
/return
Sub FindIt(int fromBag, int toBag, string itemname, int doit, string action)
/declare bag int local
/declare slot int local
/declare nameinv string local
/declare first 0
/if (${itemname.Equal[all]}) {
/echo Search: bag \ag${fromBag}\ax Item:\apEVERYTHING
} else {
/echo Search: bags \ag${fromBag}\ax to \ag${toBag}\ax Item:\ap${itemname}
}
/for bag ${fromBag} to ${toBag} {
/if (${InvSlot[pack${bag}].Item.Container}) {
/for slot 1 to ${InvSlot[pack${bag}].Item.Container} {
/varset nameinv ${InvSlot[pack${bag}].Item.Item[${slot}].Name}
/if (${nameinv.Equal[null]}) {
/continue
}
/if (${Select[${nameinv},Water Flash,Loaf of Bread]}) /continue
/if (${itemname.NotEqual[all]}) {
/if (!${itemname.Find[|${nameinv}|]}) {
/continue
}
}
/call ${action} ${bag} ${slot} ${doit}
| /if (${doit}) /delay 2s
}
/next slot
}
}
/next bag
/return
Sub DestroyIt(int bag, int slot, int doit)
/declare name string local ${InvSlot[pack${bag}].Item.Item[${slot}]}
/echo Destroy: bag \ag${bag}\ax:\ag${slot}\ax (${InvSlot[pack${bag}].Item.Item[${slot}].Tribute}) \ap${name}
/if (${doit}) {
/nomodkey /shiftkey /itemnotify in pack${bag} ${slot} leftmouseup
/delay 2s
/destroy
}
/return
Sub TributeOrParcel(int bag, int slot, int doit)
/declare name string local ${InvSlot[pack${bag}].Item.Item[${slot}]}
/varset accepted FALSE
/if (${doit}) /shift /nomodkey /itemnotify in pack${bag} ${slot} leftmouseup
/if (${Window[TributeMasterWnd].Open}) {
/if (!${InvSlot[pack${bag}].Item.Item[${slot}].Tribute}) /return
/if (${InvSlot[pack${bag}].Item.Item[${slot}].Value}>100000) /return
/echo Tribute: bag \ag${bag}\ax:\ag${slot}\ax (${InvSlot[pack${bag}].Item.Item[${slot}].Tribute}) \ap${name}
/if (!${doit}) /return
/nomodkey /shiftkey /notify TributeMasterWnd TMW_DonateButton leftmouseup
} else /if (${Window[MerchantWnd].Open}) {
/if (${InvSlot[pack${bag}].Item.Item[${slot}].NoTrade}) /return
/echo Parcel: bag \ag${bag}\ax:\ag${slot}\ax \ap${name}
/if (!${doit}) /return
/nomodkey /shiftkey /notify MerchantWnd MW_Send_Button leftmouseup
} else /if (${Window[RealEstateItemsWnd].Open}) {
/if (${InvSlot[pack${bag}].Item.Item[${slot}].NoTrade}) /return
/echo Store: bag \ag${bag}\ax:\ag${slot}\ax \ap${name}
/if (!${doit}) /return
/nomodkey /shiftkey /notify RealEstateItemsWnd REIW_Move_Closet_Button leftmouseup
/delay 20s !${InvSlot[pack${bag}].Item.Item[${slot}].ID}
/varset accepted TRUE
} else {
/echo Nothing: No tribute/parcel/housing window
/return
}
/delay 2s
/if (${Window[RealEstateItemsWnd].Open}) {
/while (!${Window[RealEstateItemsWnd].Child[REIW_Move_Inventory_Button].Enabled}) {
/delay 15s ${Window[RealEstateItemsWnd].Child[REIW_Move_Inventory_Button].Enabled}
/notify RealEstateItemsWnd REIW_ItemList Listselect 1
/doevents
}
} else {
/while (!${accepted} && !${fullup}) {
/delay 15s !${accepted}
/doevents
/varset name ${InvSlot[pack${bag}].Item.Item[${slot}]}
}
}
/return
Sub Event_ActionDone
/doevents flush
/varset accepted TRUE
/echo \agYou lost it!
/return
Sub Event_FullUP
/doevents flush
/varset fullup TRUE
/echo \awUse some Tribute first!
/endm
/return