rendered paste body
/* Stealthy's Auto Equip */
variable string PrimStat = Stamina
variable string SecStat = Intellect
variable string WeapType = Dagger
variable bool DualWield = FALSE
variable int LastEquipAttempt
;Thanks for the pointers, M^3.
member ArmorType()
{
;Thanks to Complex for supplying me with the skill # info
;WoWSkill for Plate is 293
if ${Me.Skill[293]} > 0
{
return Plate
}
;wowSkill for Mail is 413
elseif ${Me.Skill[413]} > 0
{
return Mail
}
;WoWSkill for Leather is 414
elseif ${Me.Skill[414]} > 0
{
return Leather
}
;WoWSkill for cloth is 415
elseif ${Me.Skill[415]} > 0
{
return Cloth
}
echo "ArmorType returned nothing, something is wrong with the Skill values"
}
member CanShield()
{
if !${This.DualWield} && ${Me.Skill[433]} > 0
{
return TRUE
}
return FALSE
}
member ShouldEquip(string ItemGUID, string ItemType)
{
if ${ItemType.Equal[Armor]}
{
if ${This.ArmorWeight[${ItemGUID}]} > ${This.ArmorWeight[${Me.Equip[${Item[${ItemGUID}].EquipType}].GUID}]}
{
return TRUE
}
return FALSE
}
if ${ItemType.Equal[Weapon]}
{
if ${This.WeaponWeight[${ItemGUID}]} > ${This.WeaponWeight[${Me.Equip[${Item[${ItemGUID}].EquipType}].GUID}]}
{
return TRUE
}
return FALSE
}
if ${ItemType.Equal[Bag]}
{
if ${This.BagWeight[${ItemGUID}]} > 0
{
return TRUE
}
return FALSE
}
if ${ItemType.Equal[Jewelry]}
{
if ${This.MiscWeight[${ItemGUID}]} > ${This.MiscWeight[${Me.Equip[${Item[${ItemGUID}].EquipType}].GUID}]}
{
return TRUE
}
return FALSE
}
if ${ItemType.Equal[Trinket]}
{
if ${This.MiscWeight[${ItemGUID}]} > ${This.MiscWeight[${Me.Equip[${Item[${ItemGUID}].EquipType}].GUID}]}
{
return TRUE
}
return FALSE
}
}
member MiscWeight(string NewItemGUID)
{
;Possible third stat in the future?
return ${Math.Calc[${Item[${NewItemGUID}].${PrimStat}} + (${Item[${NewItemGUID}].${SecStat}}*.9)]}
}
member ArmorWeight(string NewItemGUID)
{
return ${Math.Calc[${Item[${NewItemGUID}].${PrimStat}} + (${Item[${NewItemGUID}].${SecStat}}*.9) + (${Item[${NewItemGUID}].Armor}*${This.ClassArmorweight})]}
}
member WeaponWeight(string NewItemGUID)
{
return ${Math.Calc[${Item[${NewItemGUID}].${PrimStat}} + (${Item[${NewItemGUID}].${SecStat}}*.9) + (${Item[${NewItemGUID}].DPS}*${This.ClassDPSWeight})]}
}
member BagWeight(string NewItemGUID)
{
if !${Object[${NewItemGUID}](exists)}
return 0
if ${Object[${NewItemGUID}].Slots} > ${Me.Bag[1].Slots}
return 1
if ${Object[${NewItemGUID}].Slots} > ${Me.Bag[2].Slots}
return 2
if ${Object[${NewItemGUID}].Slots} > ${Me.Bag[3].Slots}
return 3
if ${Object[${NewItemGUID}].Slots} > ${Me.Bag[4].Slots}
return 4
if ${Object[${NewItemGUID}].Slots} <= ${Me.Bag[1].Slots}
return 0
if ${Object[${NewItemGUID}].Slots} <= ${Me.Bag[2].Slots}
return 0
if ${Object[${NewItemGUID}].Slots} <= ${Me.Bag[3].Slots}
return 0
if ${Object[${NewItemGUID}].Slots} <= ${Me.Bag[4].Slots}
return 0
}
member ClassArmorWeight()
{
if ${Me.Class.Equal[Warrior]} || ${Me.Class.Equal[Paladin]}
{
return .75
}
if ${Me.Class.Equal[Rogue]} || ${Me.Class.Equal[Shaman]} || ${Me.Class.Equal[Hunter]}
{
return .4
}
if ${Me.Class.Equal[Warlock]} || ${Me.Class.Equal[Priest]} || ${Me.Class.Equal[Mage]}
{
return .25
}
}
member ClassDPSWeight()
{
if ${Me.Class.Equal[Rogue]} || ${Me.Class.Equal[Warrior]}
{
return .9
}
if ${Me.Class.Equal[Shaman]} || ${Me.Class.Equal[Paladin]} || ${Me.Class.Equal[Hunter]}
{
return .75
}
if ${Me.Class.Equal[Warlock]} || ${Me.Class.Equal[Priest]} || ${Me.Class.Equal[Mage]}
{
return .25
}
}
method AutoEquip()
{
variable int counter = 1
variable int counterx = 1
variable guidlist ItemSearch
variable guidlist BaggieSearch
;For now, using PrimStat and SecStat as the stat vars
;Also using WeapType as the preferred weapon type
ItemSearch:Search[-items,-inventory]
BaggieSearch:Search[-containers,-inventory]
echo "AutoEquip: ItemSearch Count - ${ItemSearch.Count}, ItemSearch[${Math.Calc[${ItemSearch.Count}-1]}] - ${ItemSearch.GUID[${Math.Calc[${ItemSearch.Count}-1]}]}"
if ${ItemSearch.Count} > 0
{
do
{
if ${Item[${ItemSearch.GUID[${counter}]}].SubType.Equal[Shield]}
{
echo "AutoEquip: Entered Shield if"
if ${This.CanShield} && ${This.ShouldEquip[${ItemSearch.GUID[${counter}]},Armor]}
{
echo "AutoEquip: Attempting to equip ${Item[${ItemSearch.GUID[${counter}]}].Name}"
Item[${ItemSearch.GUID[${counter}]}]:Use
WoWScript EquipPendingItem(0)
}
}
if ${Item[${ItemSearch.GUID[${counter}]}].SubType.Equal[${This.ArmorType}]}
{
echo "AutoEquip: Entered This.ArmorType if"
if ${This.ShouldEquip[${ItemSearch.GUID[${counter}]},Armor]}
{
echo "AutoEquip: Attempting to equip ${Item[${ItemSearch.GUID[${counter}]}].Name}"
Item[${ItemSearch.GUID[${counter}]}]:Use
WoWScript EquipPendingItem(0)
}
}
if ${Item[${ItemSearch.GUID[${counter}]}].SubType.Equal[Miscellaneous]}
{
echo "AutoEquip: Entered Miscellaneous if"
if ${This.ShouldEquip[${ItemSearch.GUID[${counter}]},Jewelry]}
{
echo "AutoEquip: Attempting to equip ${Item[${ItemSearch.GUID[${counter}]}].Name}"
Item[${ItemSearch.GUID[${counter}]}]:Use
WoWScript EquipPendingItem(0)
}
}
if ${Item[${ItemSearch.GUID[${counter}]}].SubType.Equal[${WeapType}]}
{
echo "AutoEquip: Entered WeapType if"
if ${This.ShouldEquip[${ItemSearch.GUID[${counter}]},Weapon]}
{
echo "AutoEquip: Attempting to equip ${Item[${ItemSearch.GUID[${counter}]}].Name}"
Item[${ItemSearch.GUID[${counter}]}]:Use
WoWScript EquipPendingItem(0)
}
}
counter:Inc
}
while ${ItemSearch.GUID[${counter}](exists)}
}
if ${BaggieSearch.Count} > 0
{
do
{
if ${Object[${BaggieSearch.GUID[${counterx}]}].SubType.Equal[Bag]} && ${This.CanAttemptEquip}
{
echo "AutoEquip: Entered Bag if"
if ${This.ShouldEquip[${BaggieSearch.GUID[${counterx}]},Bag]}
{
echo "AutoEquip: Attempting to equip ${BaggieSearch.GUID[${counterx}]} aka ${BaggieSearch.Name[${counterx}]}"
Object[${BaggieSearch.GUID[${counterx}]}]:PickUp
WoWScript PickupInventoryItem(ContainerIDToInventoryID(${This.BagWeight[${BaggieSearch.GUID[${counterx}]}]}))
WoWScript EquipPendingItem(0)
return
}
}
counterx:Inc
}
while ${counterx} <= ${BaggieSearch.Count}
}
}
member CanAttemptEquip()
{
if (${This.LastEquipAttempt} == 0) || (${LavishScript.RunningTime} > ${LastEquipAttempt})
{
return TRUE
}
return FALSE
}
method SetLastEquipAttempt()
{
LastEquipAttempt:Set[${Math.Calc[${LavishScript.RunningTime} + 10000]}]
}