All pastes #631551 Raw Edit

Someone

public text v1 · immutable
#631551 ·published 2007-07-24 02:19 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)
{
	if ${This.ItemWeight[${ItemGUID}]} > ${This.ItemWeight[${Me.Equip[${Item[${ItemGUID}].EquipSlot}].GUID}]}
	{
		return TRUE
	}
	return FALSE
}

member ItemWeight(string NewItemGUID)
{
	return ${Math.Calc[${Item[${NewItemGUID}].${PrimStat}} + (${Item[${NewItemGUID}].${SecStat}}*.9) + (${Item[${NewItemGUID}].Armor}*${This.ClassArmorweight})]}
}
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
	}
}
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}]}
		{
			if ${This.ShouldEquip[${ItemSearch[${counter}].GUID}]
			{
				ItemSearch[${counter}]:Use
				WoWScript EquipPendingItem(0)
			}
		}
		counter:Inc
	}
	while ${ItemSearch[${counter}](exists)}
}