/trunk
-- Calculate weapon base score with nothing equipped |
local linen_shirt = "\124cffffffff\124Hitem:2576:0:0:0:0:0:0:0\124h[White Linen Shirt]\124h\124r" |
local mh_base = weightFunction(linen_shirt, mainslot) or 0 |
local oh_base = mh_base |
local weapon_max, weapon_win = (- math.huge), {} |
debug(L["Weapon base score: %s"], mh_base) |
-- Try on each mainhand weapon |
local score |
for mh_mask,item in pairs(mh_avail) do |
if mh_equipped then |
debug(L["Successfully equipped %s"], link) |
local mh_link = GetInventoryItemLink("player", mainslot) |
local mh_score = weightFunction(mh_link, mainslot) - mh_base |
local mh_score = weightFunction(mh_link, mainslot) |
debug(L["Mainhand score: %d"], mh_score) |
if not IsEquippedItemType("Two-Hand") then |
if oh_equipped then |
local oh_link = GetInventoryItemLink("player", offslot) or linen_shirt |
local oh_score = weightFunction(oh_link, offslot) |
score = score + oh_score |
score = oh_score |
debug(L["Got score of %s for %s/%s"], score, mh_link, oh_link) |
else |
debug(L["Failed to equip %s"], link) |