Mercurial > wow > askmrrobot
comparison Gear.lua @ 161:35612aee8e15
Added junk list.
author | yellowfive |
---|---|
date | Mon, 06 May 2019 14:08:03 -0700 |
parents | 31386c009f03 |
children | 3be9cc6f7d20 |
comparison
equal
deleted
inserted
replaced
160:d670336e8c89 | 161:35612aee8e15 |
---|---|
535 container:AddChild(_panelGear) | 535 container:AddChild(_panelGear) |
536 _panelGear:SetPoint("TOPLEFT", container.content, "TOPLEFT", 144, -58) | 536 _panelGear:SetPoint("TOPLEFT", container.content, "TOPLEFT", 144, -58) |
537 _panelGear:SetPoint("BOTTOMRIGHT", container.content, "BOTTOMRIGHT") | 537 _panelGear:SetPoint("BOTTOMRIGHT", container.content, "BOTTOMRIGHT") |
538 | 538 |
539 local btnShop = AceGUI:Create("AmrUiButton") | 539 local btnShop = AceGUI:Create("AmrUiButton") |
540 container:AddChild(btnShop) | |
540 btnShop:SetText(L.GearButtonShop) | 541 btnShop:SetText(L.GearButtonShop) |
541 btnShop:SetBackgroundColor(Amr.Colors.Blue) | 542 btnShop:SetBackgroundColor(Amr.Colors.Blue) |
542 btnShop:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.White)) | 543 btnShop:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.White)) |
543 btnShop:SetWidth(245) | 544 btnShop:SetWidth(200) |
544 btnShop:SetHeight(26) | 545 btnShop:SetHeight(26) |
545 btnShop:SetCallback("OnClick", function(widget) Amr:ShowShopWindow() end) | 546 btnShop:SetCallback("OnClick", function(widget) Amr:ShowShopWindow() end) |
546 container:AddChild(btnShop) | 547 btnShop:SetPoint("TOPRIGHT", container.content, "TOPRIGHT", -42, -25) |
547 btnShop:SetPoint("TOPRIGHT", container.content, "TOPRIGHT", -20, -25) | 548 |
549 local btnJunk = AceGUI:Create("AmrUiButton") | |
550 container:AddChild(btnJunk) | |
551 btnJunk:SetText(L.GearButtonJunk) | |
552 btnJunk:SetBackgroundColor(Amr.Colors.Blue) | |
553 btnJunk:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.White)) | |
554 btnJunk:SetWidth(200) | |
555 btnJunk:SetHeight(26) | |
556 btnJunk:SetCallback("OnClick", function(widget) Amr:ShowJunkWindow() end) | |
557 btnJunk:SetPoint("CENTER", btnShop.frame, "CENTER", 0, 36) | |
548 | 558 |
549 -- pick a default tab based on player's current spec if none is already specified | 559 -- pick a default tab based on player's current spec if none is already specified |
550 if not _activeSetupId then | 560 if not _activeSetupId then |
551 Amr:PickFirstSetupForSpec() | 561 Amr:PickFirstSetupForSpec() |
552 end | 562 end |
598 local _gearOpWaiting = nil | 608 local _gearOpWaiting = nil |
599 | 609 |
600 local beginEquipGearSet, processCurrentGearOp, nextGearOp | 610 local beginEquipGearSet, processCurrentGearOp, nextGearOp |
601 | 611 |
602 -- find the first empty slot in the player's backpack+bags | 612 -- find the first empty slot in the player's backpack+bags |
603 local function findFirstEmptyBagSlot() | 613 local function findFirstEmptyBagSlot(usedBagSlots) |
604 | 614 |
605 local bagIds = {} | 615 local bagIds = {} |
606 table.insert(bagIds, BACKPACK_CONTAINER) | 616 table.insert(bagIds, BACKPACK_CONTAINER) |
607 for bagId = 1, NUM_BAG_SLOTS do | 617 for bagId = 1, NUM_BAG_SLOTS do |
608 table.insert(bagIds, bagId) | 618 table.insert(bagIds, bagId) |
609 end | 619 end |
610 | 620 |
611 for i, bagId in ipairs(bagIds) do | 621 for i, bagId in ipairs(bagIds) do |
612 local numSlots = GetContainerNumSlots(bagId) | 622 local numSlots = GetContainerNumSlots(bagId) |
613 for slotId = 1, numSlots do | 623 for slotId = 1, numSlots do |
614 local _, _, _, _, _, _, itemLink = GetContainerItemInfo(bagId, slotId) | 624 if not usedBagSlots or not usedBagSlots[bagId] or not usedBagSlots[bagId][slotId] then |
615 if not itemLink then | 625 local _, _, _, _, _, _, itemLink = GetContainerItemInfo(bagId, slotId) |
616 return bagId, slotId | 626 if not itemLink then |
627 -- this prevents repeated calls to this from returning the same bag slot if desired | |
628 if usedBagSlots then | |
629 if not usedBagSlots[bagId] then | |
630 usedBagSlots[bagId] = {} | |
631 end | |
632 usedBagSlots[bagId][slotId] = true | |
633 end | |
634 | |
635 return bagId, slotId | |
636 end | |
617 end | 637 end |
618 end | 638 end |
619 end | 639 end |
620 | 640 |
621 return nil, nil | 641 return nil, nil |
622 end | 642 end |
643 | |
644 | |
623 | 645 |
624 -- scan a bag for the best matching item | 646 -- scan a bag for the best matching item |
625 local function scanBagForItem(item, bagId, bestItem, bestDiff, bestLink) | 647 local function scanBagForItem(item, bagId, bestItem, bestDiff, bestLink) |
626 local numSlots = GetContainerNumSlots(bagId) | 648 local numSlots = GetContainerNumSlots(bagId) |
627 local loc = ItemLocation.CreateEmpty() | 649 local loc = ItemLocation.CreateEmpty() |
1260 Amr:RefreshGearDisplay() | 1282 Amr:RefreshGearDisplay() |
1261 end) | 1283 end) |
1262 | 1284 |
1263 Amr:AddEventHandler("ITEM_UNLOCKED", handleItemUnlocked) | 1285 Amr:AddEventHandler("ITEM_UNLOCKED", handleItemUnlocked) |
1264 end | 1286 end |
1287 | |
1288 | |
1289 -- export some local methods we need elsewhere | |
1290 Amr.CountItemDifferences = countItemDifferences | |
1291 Amr.FindFirstEmptyBagSlot = findFirstEmptyBagSlot |