comparison ui/ShoppingListTab.lua @ 47:eaf233ac41e6 v16

fixed bug with shopping list tab
author yellowfive
date Sun, 02 Nov 2014 11:56:41 -0800
parents 1851d0fd18fa
children 90175bdc50e6
comparison
equal deleted inserted replaced
46:d28e38e5240f 47:eaf233ac41e6
687 row = 1 687 row = 1
688 for slot, enchant in AskMrRobot.spairs(enchantList) do 688 for slot, enchant in AskMrRobot.spairs(enchantList) do
689 self:SetEnchantIcon(row, enchant.optimized) 689 self:SetEnchantIcon(row, enchant.optimized)
690 local row2 = row 690 local row2 = row
691 self.enchantIcons[row2].itemName = nil 691 self.enchantIcons[row2].itemName = nil
692 self:GetItemName(enchant.itemId, function(name) 692 if not enchant.itemId then
693 self.enchantIcons[row2].itemName = name 693 self.enchantIcons[row2].itemText:SetText("unknown")
694 self.enchantIcons[row2].itemText:SetText(name) 694 else
695 end) 695 self:GetItemName(enchant.itemId, function(name)
696 self.enchantIcons[row2].itemName = name
697 self.enchantIcons[row2].itemText:SetText(name)
698 end)
699 end
696 self:SetEnchantQuantity(row, enchant.count, enchant.total) 700 self:SetEnchantQuantity(row, enchant.count, enchant.total)
697 lastControl = self.enchantIcons[row] 701 lastControl = self.enchantIcons[row]
698 row = row + 1 702 row = row + 1
699 end 703 end
700 704
765 tinsert(self.itemNames, { itemId = itemId, func = func }) 769 tinsert(self.itemNames, { itemId = itemId, func = func })
766 end 770 end
767 end 771 end
768 772
769 function AskMrRobot.ShoppingListTab:On_GET_ITEM_INFO_RECEIVED() 773 function AskMrRobot.ShoppingListTab:On_GET_ITEM_INFO_RECEIVED()
770 for i = 1, #self.itemNames do 774 for i = #self.itemNames, 1, -1 do
771 local name = GetItemInfo(self.itemNames[i].itemId) 775 local name = GetItemInfo(self.itemNames[i].itemId)
772 if name then 776 if name then
773 self.itemNames[i].func(name) 777 self.itemNames[i].func(name)
774 tremove(self.itemNames, i) 778 tremove(self.itemNames, i)
775 i = i - 1
776 end 779 end
777 end 780 end
778 self.itemNames = itemNames
779 end 781 end
780 782
781 function AskMrRobot.ShoppingListTab:OnEvent(frame, event, ...) 783 function AskMrRobot.ShoppingListTab:OnEvent(frame, event, ...)
782 local handler = self["On_" .. event] 784 local handler = self["On_" .. event]
783 if handler then 785 if handler then