All pastes #632176 Raw Edit

Mine

public text v1 · immutable
#632176 ·published 2007-07-24 17:34 UTC
rendered paste body
	;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 ShouldEquip(string ItemGUID, string ItemType)
	{
		if ${ItemType.Equal[Armor]}
		{
			if ${This.ArmorWeight[${ItemGUID}]} > ${This.ArmorWeight[${Me.Equip[${Item[${ItemGUID}].EquipSlot}].GUID}]}
			{
				return TRUE
			}
			return FALSE
		}
		if ${ItemType.Equal[Weapon]}
		{
			if ${This.WeaponWeight[${ItemGUID}]} > ${This.WeaponWeight[${Me.Equip[${Item[${ItemGUID}].Equipslot}].GUID}]}
			{
				return TRUE
			}
			return FALSE
		}
		if ${ItemType.Equal[Bag]}
		{
			if ${This.Bagweight[${ItemGUID}]} > 0
			{
				return TRUE
			}
			return FALSE
		}
	}
	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)
	{
		;This will just go slots.
		if ${Item[${NewItemGUID}].Slots} > (${Me.Bag[1].Slots} || ${Me.Bag[2].Slots} || ${Me.Bag[3].Slots} || ${Me.Bag[4].Slots})
		{
			if ${Item[${NewItemGUID}].Slots} > ${Me.Bag[1].Slots}
				return 1
			if ${Item[${NewItemGUID}].Slots} > ${Me.Bag[2].Slots}
				return 2
			if ${Item[${NewItemGUID}].Slots} > ${Me.Bag[3].Slots}
				return 3
			if ${Item[${NewItemGUID}].Slots} > ${Me.Bag[4].Slots}
				return 4
		}
	}
	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 guidlist ItemSearch
		;For now, using PrimStat and SecStat as the stat vars
		;Also using WeapType as the preferred weapon type
		ItemSearch:Search[-items,-inventory]
		echo "AutoEquip: ItemSearch Count - ${ItemSearch.Count}, ItemSearch[${Math.Calc[${ItemSearch.Count}-1]}] - ${ItemSearch[${Math.Calc[${ItemSearch.Count}-1]}]}"
		do
		{
			if ${ItemSearch[${counter}].SubType.Equal[${This.ArmorType}]}
			{
				echo "AutoEquip: Entered This.ArmorType if"
				if ${This.ShouldEquip[${ItemSearch[${counter}].GUID},Armor]}
				{
					echo "AutoEquip: Attempting to equip ${ItemSearch[${counter}].Name}"
					ItemSearch[${counter}]:Use
					WoWScript EquipPendingItem(0)
				}
			}
			if ${ItemSearch[${counter}].SubType.Equal[${WeapType}]}
			{
				echo "AutoEquip: Entered WeapType if"
				if ${This.ShouldEquip[${ItemSearch[${counter}].GUID},Weapon]}
				{
					echo "AutoEquip: Attempting to equip ${ItemSearch[${counter}].Name}"
					ItemSearch[${counter}]:Use
					WoWScript EquipPendingItem(0)
				}
			}
			if ${ItemSearch[${counter}].SubType.Equal[Bag]}
			{
				echo "AutoEquip: Entered Bag if"
				if ${This.ShouldEquip[${ItemSearch[${counter}].GUID},Bag]}
				{
					echo "AutoEquip: Attempting to equip ${ItemSearch[${counter}].Name}"
					ItemSearch[${counter}]:PickUp
					WoWScript PickupInventoryItem(ContainerIDToInventoryID(${This.BagWeight}))
					WoWScript EquipPendingItem(0)
				}	
			}
			counter:Inc
		}
		while ${ItemSearch[${counter}](exists)}
	}