comparison Main.lua @ 302:ca7abdbda078

Use quantity from GetLootSlotQuantity() instead of what's returned by GetLootSourceInfo().
author James D. Callahan III <jcallahan@curse.com>
date Mon, 08 Jul 2013 10:47:55 -0500
parents 216f807df434
children e54e370e3a01
comparison
equal deleted inserted replaced
301:216f807df434 302:ca7abdbda078
1728 1728
1729 InitializeCurrentLoot() 1729 InitializeCurrentLoot()
1730 loot_guid_registry[current_loot.label] = loot_guid_registry[current_loot.label] or {} 1730 loot_guid_registry[current_loot.label] = loot_guid_registry[current_loot.label] or {}
1731 1731
1732 for loot_slot = 1, _G.GetNumLootItems() do 1732 for loot_slot = 1, _G.GetNumLootItems() do
1733 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) 1733 local icon_texture, item_text, slot_quantity, quality, locked = _G.GetLootSlotInfo(loot_slot)
1734 local slot_type = _G.GetLootSlotType(loot_slot) 1734 local slot_type = _G.GetLootSlotType(loot_slot)
1735 local loot_info = { 1735 local loot_info = {
1736 _G.GetLootSourceInfo(loot_slot) 1736 _G.GetLootSourceInfo(loot_slot)
1737 } 1737 }
1738 1738
1742 1742
1743 if not loot_guid_registry[current_loot.label][source_guid] then 1743 if not loot_guid_registry[current_loot.label][source_guid] then
1744 local loot_quantity = loot_info[loot_index + 1] 1744 local loot_quantity = loot_info[loot_index + 1]
1745 local source_type, source_id = ParseGUID(source_guid) 1745 local source_type, source_id = ParseGUID(source_guid)
1746 local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id) 1746 local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id)
1747 Debug("GUID: %s - Type:ID: %s - Amount: %d", loot_info[loot_index], source_key, loot_quantity) 1747 Debug("GUID: %s - Type:ID: %s - Amount: %d (%d)", loot_info[loot_index], source_key, loot_quantity, slot_quantity)
1748 1748
1749 if slot_type == _G.LOOT_SLOT_ITEM then 1749 if slot_type == _G.LOOT_SLOT_ITEM then
1750 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) 1750 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot))
1751 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} 1751 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {}
1752 current_loot.sources[source_guid][item_id] = current_loot.sources[source_guid][item_id] or 0 + loot_quantity 1752 current_loot.sources[source_guid][item_id] = current_loot.sources[source_guid][item_id] or 0 + slot_quantity
1753 guids_used[source_guid] = true 1753 guids_used[source_guid] = true
1754 elseif slot_type == _G.LOOT_SLOT_MONEY then 1754 elseif slot_type == _G.LOOT_SLOT_MONEY then
1755 Debug("money:%d", _toCopper(item_text)) 1755 Debug("money:%d", _toCopper(item_text))
1756 table.insert(current_loot.list, ("money:%d"):format(_toCopper(item_text))) 1756 table.insert(current_loot.list, ("money:%d"):format(_toCopper(item_text)))
1757 elseif slot_type == _G.LOOT_SLOT_CURRENCY then 1757 elseif slot_type == _G.LOOT_SLOT_CURRENCY then
1758 Debug("Found currency: %s", icon_texture) 1758 Debug("Found currency: %s", icon_texture)
1759 table.insert(current_loot.list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) 1759 table.insert(current_loot.list, ("currency:%d:%s"):format(slot_quantity, icon_texture:match("[^\\]+$"):lower()))
1760 end 1760 end
1761 end 1761 end
1762 end 1762 end
1763 end 1763 end
1764 1764