Mercurial > wow > askmrrobot
diff Gear.lua @ 73:304d7ebb8e30 v29
small bug fixes for item upgrades, gear swapping
author | yellowfive |
---|---|
date | Tue, 17 Nov 2015 20:52:06 -0800 |
parents | 6abc0858b45e |
children | 0515882856f1 |
line wrap: on
line diff
--- a/Gear.lua Sat Jul 18 01:05:00 2015 -0700 +++ b/Gear.lua Tue Nov 17 20:52:06 2015 -0800 @@ -40,6 +40,7 @@ local function findMatchingItemFromTable(item, list, bestLink, bestItem, bestDiff, bestLoc, usedItems, tableType) if not list then return nil end + local found = false for k,v in pairs(list) do local listItem = Amr.ParseItemLink(v) if listItem then @@ -52,9 +53,10 @@ bestItem = listItem bestDiff = diff bestLoc = string.format("%s_%s", tableType, k) + found = true end end - if diff == 0 then break end + if found then break end end end @@ -506,6 +508,12 @@ -- find the best matching item + -- inventory + bestItem, bestDiff, bestLink = scanBagForItem(item, BACKPACK_CONTAINER, bestItem, bestDiff, bestLink) + for bagId = 1, NUM_BAG_SLOTS do + bestItem, bestDiff, bestLink = scanBagForItem(item, bagId, bestItem, bestDiff, bestLink) + end + -- equipped items, but skip slots we have just equipped (to avoid e.g. just moving 2 of the same item back and forth between mh oh weapon slots) for slotNum = 1, #Amr.SlotIds do local slotId = Amr.SlotIds[slotNum] @@ -525,12 +533,6 @@ end end - -- inventory - bestItem, bestDiff, bestLink = scanBagForItem(item, BACKPACK_CONTAINER, bestItem, bestDiff, bestLink) - for bagId = 1, NUM_BAG_SLOTS do - bestItem, bestDiff, bestLink = scanBagForItem(item, bagId, bestItem, bestDiff, bestLink) - end - -- bank bestItem, bestDiff, bestLink = scanBagForItem(item, BANK_CONTAINER, bestItem, bestDiff, bestLink) for bagId = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do @@ -688,7 +690,7 @@ spec = spec, itemsToEquip = itemsToEquip, remaining = remaining, - doneSlots = {}, + doneSlots = _pendingEquip and _pendingEquip.spec == spec and _pendingEquip.doneSlots or {}, nextSlot = firstSlot }