Mercurial > wow > askmrrobot
comparison ui/ShoppingListTab.lua @ 45:1851d0fd18fa v15
fixed an issue with shopping tab enchant links not working on AH
| author | yellowfive |
|---|---|
| date | Sat, 01 Nov 2014 22:51:36 -0700 |
| parents | a400b906acca |
| children | eaf233ac41e6 |
comparison
equal
deleted
inserted
replaced
| 44:8e853e90af9c | 45:1851d0fd18fa |
|---|---|
| 22 tab:Hide() | 22 tab:Hide() |
| 23 tab:RegisterEvent("AUCTION_HOUSE_CLOSED") | 23 tab:RegisterEvent("AUCTION_HOUSE_CLOSED") |
| 24 tab:RegisterEvent("AUCTION_HOUSE_SHOW") | 24 tab:RegisterEvent("AUCTION_HOUSE_SHOW") |
| 25 tab:RegisterEvent("MAIL_SHOW") | 25 tab:RegisterEvent("MAIL_SHOW") |
| 26 tab:RegisterEvent("MAIL_CLOSED") | 26 tab:RegisterEvent("MAIL_CLOSED") |
| 27 tab:RegisterEvent("GET_ITEM_INFO_RECEIVED") | |
| 27 | 28 |
| 28 tab.isAuctionHouseVisible = false | 29 tab.isAuctionHouseVisible = false |
| 29 | 30 |
| 30 tab:SetScript("OnEvent", function(...) | 31 tab:SetScript("OnEvent", function(...) |
| 31 tab:OnEvent(...) | 32 tab:OnEvent(...) |
| 214 tab.sendTo:SetScript("OnChar", function() | 215 tab.sendTo:SetScript("OnChar", function() |
| 215 AmrDb.SendSettings.SendTo = tab.sendTo:GetText() | 216 AmrDb.SendSettings.SendTo = tab.sendTo:GetText() |
| 216 end) | 217 end) |
| 217 | 218 |
| 218 tab.messageQueue = {} | 219 tab.messageQueue = {} |
| 220 | |
| 221 tab.itemNames = {} | |
| 219 return tab | 222 return tab |
| 220 end | 223 end |
| 221 | 224 |
| 222 -- display a gem icon in a row | 225 -- display a gem icon in a row |
| 223 -- gemInfo is {id, enchantId, color, count } | 226 -- gemInfo is {id, enchantId, color, count } |
| 582 local id = extraData and extraData.itemId or enchantData.optimized | 585 local id = extraData and extraData.itemId or enchantData.optimized |
| 583 local qty = enchantList[id] | 586 local qty = enchantList[id] |
| 584 if qty then | 587 if qty then |
| 585 qty.total = qty.total + 1 | 588 qty.total = qty.total + 1 |
| 586 else | 589 else |
| 587 qty = { count = 0, total = 1, optimized = enchantData.optimized } | 590 qty = { count = 0, total = 1, optimized = enchantData.optimized, itemId = extraData and extraData.itemId } |
| 588 enchantList[id] = qty | 591 enchantList[id] = qty |
| 589 end | 592 end |
| 590 end | 593 end |
| 591 | 594 |
| 592 local enchantMaterials = {} | 595 local enchantMaterials = {} |
| 678 self.gemsHeader:Hide() | 681 self.gemsHeader:Hide() |
| 679 self.gemsQuantityHeader:Hide() | 682 self.gemsQuantityHeader:Hide() |
| 680 self.enchantsHeader:SetPoint("TOPLEFT", self.scrollParent, "TOPLEFT", 0, 0) | 683 self.enchantsHeader:SetPoint("TOPLEFT", self.scrollParent, "TOPLEFT", 0, 0) |
| 681 end | 684 end |
| 682 | 685 |
| 686 self.enchantNames = {} | |
| 683 row = 1 | 687 row = 1 |
| 684 for slot, enchant in AskMrRobot.spairs(enchantList) do | 688 for slot, enchant in AskMrRobot.spairs(enchantList) do |
| 685 self:SetEnchantIcon(row, enchant.optimized) | 689 self:SetEnchantIcon(row, enchant.optimized) |
| 690 local row2 = row | |
| 691 self.enchantIcons[row2].itemName = nil | |
| 692 self:GetItemName(enchant.itemId, function(name) | |
| 693 self.enchantIcons[row2].itemName = name | |
| 694 self.enchantIcons[row2].itemText:SetText(name) | |
| 695 end) | |
| 686 self:SetEnchantQuantity(row, enchant.count, enchant.total) | 696 self:SetEnchantQuantity(row, enchant.count, enchant.total) |
| 687 lastControl = self.enchantIcons[row] | 697 lastControl = self.enchantIcons[row] |
| 688 row = row + 1 | 698 row = row + 1 |
| 689 end | 699 end |
| 690 | 700 |
| 745 self.shoppingPanel:Hide() | 755 self.shoppingPanel:Hide() |
| 746 self.stamp:Show() | 756 self.stamp:Show() |
| 747 end | 757 end |
| 748 end | 758 end |
| 749 | 759 |
| 760 function AskMrRobot.ShoppingListTab:GetItemName(itemId, func) | |
| 761 local name = GetItemInfo(itemId) | |
| 762 if name then | |
| 763 func(name) | |
| 764 else | |
| 765 tinsert(self.itemNames, { itemId = itemId, func = func }) | |
| 766 end | |
| 767 end | |
| 768 | |
| 769 function AskMrRobot.ShoppingListTab:On_GET_ITEM_INFO_RECEIVED() | |
| 770 for i = 1, #self.itemNames do | |
| 771 local name = GetItemInfo(self.itemNames[i].itemId) | |
| 772 if name then | |
| 773 self.itemNames[i].func(name) | |
| 774 tremove(self.itemNames, i) | |
| 775 i = i - 1 | |
| 776 end | |
| 777 end | |
| 778 self.itemNames = itemNames | |
| 779 end | |
| 750 | 780 |
| 751 function AskMrRobot.ShoppingListTab:OnEvent(frame, event, ...) | 781 function AskMrRobot.ShoppingListTab:OnEvent(frame, event, ...) |
| 752 local handler = self["On_" .. event] | 782 local handler = self["On_" .. event] |
| 753 if handler then | 783 if handler then |
| 754 handler(self, ...) | 784 handler(self, ...) |
