Mercurial > wow > wowdb-profiler
comparison Main.lua @ 237:42264feaecd6 5.2.0-2
Added support for recording money drops, since GetLootSourceInfo() finally returns the amounts.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Wed, 06 Mar 2013 14:02:39 -0600 |
parents | 19cd74910fc9 |
children | e9a81d9a6cc5 |
comparison
equal
deleted
inserted
replaced
236:3eb06575c64f | 237:42264feaecd6 |
---|---|
1600 loot_guid_registry[current_loot.label] = loot_guid_registry[current_loot.label] or {} | 1600 loot_guid_registry[current_loot.label] = loot_guid_registry[current_loot.label] or {} |
1601 | 1601 |
1602 for loot_slot = 1, _G.GetNumLootItems() do | 1602 for loot_slot = 1, _G.GetNumLootItems() do |
1603 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) | 1603 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) |
1604 local slot_type = _G.GetLootSlotType(loot_slot) | 1604 local slot_type = _G.GetLootSlotType(loot_slot) |
1605 | 1605 local loot_info = { |
1606 -- TODO: Move LOOT_SLOT_X checks within loop when money is detectable via GetLootSourceInfo | 1606 _G.GetLootSourceInfo(loot_slot) |
1607 if slot_type == _G.LOOT_SLOT_ITEM then | 1607 } |
1608 local loot_info = { | 1608 |
1609 _G.GetLootSourceInfo(loot_slot) | 1609 -- Odd index is GUID, even is count. |
1610 } | 1610 for loot_index = 1, #loot_info, 2 do |
1611 | 1611 local source_guid = loot_info[loot_index] |
1612 -- Odd index is GUID, even is count. | 1612 |
1613 for loot_index = 1, #loot_info, 2 do | 1613 if not loot_guid_registry[current_loot.label][source_guid] then |
1614 local source_guid = loot_info[loot_index] | 1614 local loot_quantity = loot_info[loot_index + 1] |
1615 | 1615 local source_type, source_id = ParseGUID(source_guid) |
1616 if not loot_guid_registry[current_loot.label][source_guid] then | 1616 local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id) |
1617 local loot_quantity = loot_info[loot_index + 1] | 1617 Debug(("GUID: %s - Type:ID: %s - Amount: %d"):format(loot_info[loot_index], source_key, loot_quantity)) |
1618 local source_type, source_id = ParseGUID(source_guid) | 1618 |
1619 local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id) | 1619 if slot_type == _G.LOOT_SLOT_ITEM then |
1620 Debug(("GUID: %s - Type:ID: %s - Amount: %d"):format(loot_info[loot_index], source_key, loot_quantity)) | |
1621 | |
1622 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) | 1620 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) |
1623 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} | 1621 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} |
1624 current_loot.sources[source_guid][item_id] = current_loot.sources[source_guid][item_id] or 0 + loot_quantity | 1622 current_loot.sources[source_guid][item_id] = current_loot.sources[source_guid][item_id] or 0 + loot_quantity |
1625 guids_used[source_guid] = true | 1623 guids_used[source_guid] = true |
1624 elseif slot_type == _G.LOOT_SLOT_MONEY then | |
1625 Debug(("money:%d"):format(_toCopper(item_text))) | |
1626 table.insert(current_loot.list, ("money:%d"):format(_toCopper(item_text))) | |
1627 elseif slot_type == _G.LOOT_SLOT_CURRENCY then | |
1628 Debug(("Found currency: %s"):format(icon_texture)) | |
1629 table.insert(current_loot.list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) | |
1626 end | 1630 end |
1627 end | 1631 end |
1628 -- elseif slot_type == _G.LOOT_SLOT_MONEY then | |
1629 -- table.insert(current_action.loot_list, ("money:%d"):format(_toCopper(item_text))) | |
1630 elseif slot_type == _G.LOOT_SLOT_CURRENCY then | |
1631 Debug(("Found currency: %s"):format(icon_texture)) | |
1632 table.insert(current_loot.list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) | |
1633 end | 1632 end |
1634 end | 1633 end |
1635 | 1634 |
1636 for guid in pairs(guids_used) do | 1635 for guid in pairs(guids_used) do |
1637 loot_guid_registry[current_loot.label][guid] = true | 1636 loot_guid_registry[current_loot.label][guid] = true |