/trunk
debug(L["Weapon base score: %s"], mh_base) |
-- Try on each mainhand weapon |
local score |
for mh_mask,item in pairs(mh_avail) do |
local name, link = GetItemInfo(item) |
debug(L["Equipping mainhand weapon: %s"], link) |
debug(L["Successfully equipped %s"], link) |
local mh_link = GetInventoryItemLink("player", mainslot) |
local mh_score = weightFunction(mh_link, mainslot) - mh_base |
local score = mh_score |
debug(L["Mainhand score: %d"], score) |
if not IsEquippedItemType("Two-Hand") then |
-- Try to equip each off-hand weapon to compliment this one |
for oh_mask,item in pairs(oh_avail) do |
if not blacklist[oh_mask] then |
score = mh_score |
local name, link = GetItemInfo(item) |
debug(L["Equipping offhand weapon: %s"], link) |
if oh_equipped then |
local oh_link = GetInventoryItemLink("player", offslot) or linen_shirt |
local oh_score = weightFunction(oh_link, offslot) |
score = oh_score |
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) |
end |
end |
else |
score = mh_score |
debug("Got score of %s for %s", score, mh_link) |
if score >= weapon_max then |
weapon_max = score |