Mercurial > wow > wowdb-profiler
comparison Main.lua @ 217:719fe69d3af2
Move from a singular GUID loot registry to a registry per loot type - this fixes a bug where, for example, looting an NPC and then using herb gathering on it would not record what was gained from the herb gathering.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Tue, 22 Jan 2013 15:21:44 -0600 |
parents | 1af96c9a930e |
children | 54e268151cd2 |
comparison
equal
deleted
inserted
replaced
216:1af96c9a930e | 217:719fe69d3af2 |
---|---|
1211 ClearKilledBossID() | 1211 ClearKilledBossID() |
1212 private.harvesting = nil | 1212 private.harvesting = nil |
1213 return | 1213 return |
1214 end | 1214 end |
1215 | 1215 |
1216 if dest_guid ~= _G.UnitGUID("target") then | |
1217 ClearKilledNPC() | |
1218 ClearKilledBossID() | |
1219 return | |
1220 end | |
1221 | |
1216 if private.RAID_FINDER_BOSS_IDS[unit_idnum] then | 1222 if private.RAID_FINDER_BOSS_IDS[unit_idnum] then |
1217 Debug(("%s: Matching boss %s."):format(sub_event, dest_name)) | 1223 Debug(("%s: Matching boss %s."):format(sub_event, dest_name)) |
1218 ClearKilledBossID() | 1224 ClearKilledBossID() |
1219 private.raid_finder_boss_id = unit_idnum | 1225 private.raid_finder_boss_id = unit_idnum |
1220 elseif private.WORLD_BOSS_IDS[unit_idnum] then | 1226 elseif private.WORLD_BOSS_IDS[unit_idnum] then |
1223 private.world_boss_id = unit_idnum | 1229 private.world_boss_id = unit_idnum |
1224 else | 1230 else |
1225 Debug(("%s: Killed NPC %s (ID: %d) is not in LFG or World boss list."):format(sub_event, dest_name, unit_idnum)) | 1231 Debug(("%s: Killed NPC %s (ID: %d) is not in LFG or World boss list."):format(sub_event, dest_name, unit_idnum)) |
1226 end | 1232 end |
1227 | 1233 |
1228 if dest_guid ~= _G.UnitGUID("target") then | |
1229 ClearKilledNPC() | |
1230 ClearKilledBossID() | |
1231 return | |
1232 end | |
1233 killed_npc_id = unit_idnum | 1234 killed_npc_id = unit_idnum |
1234 WDP:ScheduleTimer(ClearKilledNPC, 0.1) | 1235 WDP:ScheduleTimer(ClearKilledNPC, 0.1) |
1235 WDP:ScheduleTimer(ClearKilledBossID, 1) | 1236 WDP:ScheduleTimer(ClearKilledBossID, 1) |
1236 end, | 1237 end, |
1237 } | 1238 } |
1572 y = current_action.y, | 1573 y = current_action.y, |
1573 zone_data = current_action.zone_data, | 1574 zone_data = current_action.zone_data, |
1574 } | 1575 } |
1575 table.wipe(current_action) | 1576 table.wipe(current_action) |
1576 | 1577 |
1578 loot_guid_registry[current_loot.label] = loot_guid_registry[current_loot.label] or {} | |
1579 | |
1577 for loot_slot = 1, _G.GetNumLootItems() do | 1580 for loot_slot = 1, _G.GetNumLootItems() do |
1578 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) | 1581 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) |
1579 local slot_type = _G.GetLootSlotType(loot_slot) | 1582 local slot_type = _G.GetLootSlotType(loot_slot) |
1580 | 1583 |
1581 -- TODO: Move LOOT_SLOT_X checks within loop when money is detectable via GetLootSourceInfo | 1584 -- TODO: Move LOOT_SLOT_X checks within loop when money is detectable via GetLootSourceInfo |
1586 | 1589 |
1587 -- Odd index is GUID, even is count. | 1590 -- Odd index is GUID, even is count. |
1588 for loot_index = 1, #loot_info, 2 do | 1591 for loot_index = 1, #loot_info, 2 do |
1589 local source_guid = loot_info[loot_index] | 1592 local source_guid = loot_info[loot_index] |
1590 | 1593 |
1591 if not loot_guid_registry[source_guid] then | 1594 if not loot_guid_registry[current_loot.label][source_guid] then |
1592 local loot_quantity = loot_info[loot_index + 1] | 1595 local loot_quantity = loot_info[loot_index + 1] |
1593 local source_type, source_id = ParseGUID(source_guid) | 1596 local source_type, source_id = ParseGUID(source_guid) |
1594 -- TODO: Remove debugging | |
1595 local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id) | 1597 local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id) |
1596 Debug(("GUID: %s - Type:ID: %s - Amount: %d"):format(loot_info[loot_index], source_key, loot_quantity)) | 1598 Debug(("GUID: %s - Type:ID: %s - Amount: %d"):format(loot_info[loot_index], source_key, loot_quantity)) |
1597 | 1599 |
1598 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) | 1600 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) |
1599 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} | 1601 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {} |
1607 table.insert(current_loot.list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) | 1609 table.insert(current_loot.list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) |
1608 end | 1610 end |
1609 end | 1611 end |
1610 | 1612 |
1611 for guid in pairs(guids_used) do | 1613 for guid in pairs(guids_used) do |
1612 loot_guid_registry[guid] = true | 1614 loot_guid_registry[current_loot.label][guid] = true |
1613 end | 1615 end |
1614 update_func() | 1616 update_func() |
1615 end | 1617 end |
1616 end -- do-block | 1618 end -- do-block |
1617 | 1619 |