Mercurial > wow > askmrrobot
diff Gear.lua @ 61:cf2b6b9a8337 v23
6.2 update, shopping list bug fixes, ui scale option
author | yellowfive |
---|---|
date | Tue, 23 Jun 2015 00:27:21 -0700 |
parents | ee701ce45354 |
children | 932885bb1a6f |
line wrap: on
line diff
--- a/Gear.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Gear.lua Tue Jun 23 00:27:21 2015 -0700 @@ -159,7 +159,7 @@ end) panelGear:AddChild(btnEquip) - local btnShop = AceGUI:Create("AmrUiButton") + --[[local btnShop = AceGUI:Create("AmrUiButton") btnShop:SetText(L.GearButtonShop) btnShop:SetBackgroundColor(Amr.Colors.Blue) btnShop:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.White)) @@ -168,7 +168,7 @@ btnShop:SetPoint("LEFT", btnEquip.frame, "RIGHT", 75, 0) btnShop:SetPoint("RIGHT", panelMods.content, "RIGHT", -20, 0) btnShop:SetCallback("OnClick", function(widget) Amr:ShowShopWindow() end) - panelMods:AddChild(btnShop) + panelMods:AddChild(btnShop)]] -- each physical item can only be used once, this tracks ones we have already used local usedItems = {} @@ -393,6 +393,17 @@ container:AddChild(t) _gearTabs = t; + local btnShop = AceGUI:Create("AmrUiButton") + btnShop:SetText(L.GearButtonShop) + btnShop:SetBackgroundColor(Amr.Colors.Blue) + btnShop:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.White)) + btnShop:SetWidth(245) + btnShop:SetHeight(26) + btnShop:SetPoint("TOPRIGHT", container.content, "TOPRIGHT", -20, -25) + btnShop:SetCallback("OnClick", function(widget) Amr:ShowShopWindow() end) + container:AddChild(btnShop) + + if not _activeTab then _activeTab = tostring(GetActiveSpecGroup()) end @@ -475,6 +486,7 @@ _pendingEquip.tries = _pendingEquip.tries + 1 if _pendingEquip.tries > 16 then + -- too many tries, just give up (shouldn't happen but just to be safe) _pendingEquip = nil else -- start over again, trying any items that could not be equipped in the previous pass (unique constraints) @@ -494,18 +506,20 @@ -- find the best matching item - -- equipped items + -- 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] - local itemLink = GetInventoryItemLink("player", slotId) - if itemLink then - local invItem = Amr.ParseItemLink(itemLink) - if invItem ~= nil then - local diff = countItemDifferences(item, invItem) - if diff < bestDiff then - bestItem = { slot = slotId } - bestDiff = diff - bestLink = itemLink + if not _pendingEquip.doneSlots[slotId] then + local itemLink = GetInventoryItemLink("player", slotId) + if itemLink then + local invItem = Amr.ParseItemLink(itemLink) + if invItem ~= nil then + local diff = countItemDifferences(item, invItem) + if diff < bestDiff then + bestItem = { slot = slotId } + bestDiff = diff + bestLink = itemLink + end end end end @@ -577,6 +591,8 @@ end PickupInventoryItem(slotId) ClearCursor() + + -- wait for game events to continue end end @@ -607,6 +623,7 @@ end -- move on to the next item, this item is done + _pendingEquip.doneSlots[_pendingEquip.destSlot] = true _pendingEquip.itemsToEquip[_pendingEquip.destSlot] = nil _pendingEquip.destSlot = nil _pendingEquip.bag = nil @@ -670,6 +687,7 @@ spec = spec, itemsToEquip = itemsToEquip, remaining = remaining, + doneSlots = {}, nextSlot = firstSlot }