Mercurial > wow > wowdb-profiler
comparison Main.lua @ 355:06b53a3d2b4a WoD
Added support for parsing the loot from Garrison Cache objects.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Mon, 13 Oct 2014 23:13:41 -0400 |
parents | e13723c37ca4 |
children | ef2e97c210c6 |
comparison
equal
deleted
inserted
replaced
354:e13723c37ca4 | 355:06b53a3d2b4a |
---|---|
164 local name_to_id_map = {} | 164 local name_to_id_map = {} |
165 local killed_boss_id_timer_handle | 165 local killed_boss_id_timer_handle |
166 local killed_npc_id | 166 local killed_npc_id |
167 local target_location_timer_handle | 167 local target_location_timer_handle |
168 local last_timber_spell_id | 168 local last_timber_spell_id |
169 local last_garrison_cache_object_id | |
169 local chat_loot_timer_handle | 170 local chat_loot_timer_handle |
170 local current_target_id | 171 local current_target_id |
171 local current_area_id | 172 local current_area_id |
172 local current_loot | 173 local current_loot |
173 | 174 |
1264 function WDP:UNIT_PET(event_name, unit_id) | 1265 function WDP:UNIT_PET(event_name, unit_id) |
1265 UpdateUnitPet(_G.UnitGUID(unit_id), unit_id) | 1266 UpdateUnitPet(_G.UnitGUID(unit_id), unit_id) |
1266 end | 1267 end |
1267 | 1268 |
1268 | 1269 |
1269 function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity) | 1270 function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity, specID, sex, isPersonal, lootSource) |
1270 if not loot_type or (loot_type ~= "item" and loot_type ~= "money" and loot_type ~= "currency") then | 1271 if not loot_type or (loot_type ~= "item" and loot_type ~= "money" and loot_type ~= "currency") then |
1271 Debug("%s: loot_type is %s. Item link is %s, and quantity is %d.", event_name, loot_type, item_link, quantity) | 1272 Debug("%s: loot_type is %s. Item link is %s, and quantity is %d.", event_name, loot_type, item_link, quantity) |
1272 return | 1273 return |
1273 end | 1274 end |
1274 local container_id = private.loot_toast_container_id | 1275 local container_id = private.loot_toast_container_id |
1275 local npc_id = private.raid_boss_id | 1276 local npc_id = private.raid_boss_id |
1276 | 1277 |
1277 if npc_id then | 1278 -- Handle Garrison cache specially |
1279 if lootSource and last_garrison_cache_object_id and (lootSource == private.GARRISON_CACHE_LOOT_SOURCE_ID) then | |
1280 -- Record location data for cache | |
1281 UpdateDBEntryLocation("objects", ("OPENING:%d"):format(last_garrison_cache_object_id)) | |
1282 | |
1283 -- Add drop data | |
1284 local currency_texture = CurrencyLinkToTexture(item_link) | |
1285 if currency_texture and currency_texture ~= "" then | |
1286 -- Check for top level object data | |
1287 local object_entry = DBEntry("objects", ("OPENING:%d"):format(last_garrison_cache_object_id)) | |
1288 local difficulty_token = InstanceDifficultyToken() | |
1289 if object_entry[difficulty_token] then | |
1290 -- Increment loot count | |
1291 object_entry[difficulty_token]["opening_count"] = (object_entry[difficulty_token]["opening_count"] or 0) + 1 | |
1292 | |
1293 Debug("%s: %s X %d", event_name, currency_texture, quantity) | |
1294 object_entry[difficulty_token]["opening"] = object_entry[difficulty_token]["opening"] or {} | |
1295 table.insert(object_entry[difficulty_token]["opening"], ("currency:%d:%s"):format(quantity, currency_texture)) | |
1296 else | |
1297 Debug("%s: When handling the Garrison cache, the top level loot data was missing for objectID %d.", event_name, last_garrison_cache_object_id) | |
1298 end | |
1299 else | |
1300 Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link) | |
1301 end | |
1302 elseif npc_id then | |
1278 -- Slightly messy hack to workaround duplicate world bosses | 1303 -- Slightly messy hack to workaround duplicate world bosses |
1279 local upper_limit = 0 | 1304 local upper_limit = 0 |
1280 if DUPLICATE_WORLD_BOSS_IDS[npc_id] then | 1305 if DUPLICATE_WORLD_BOSS_IDS[npc_id] then |
1281 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[npc_id] | 1306 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[npc_id] |
1282 end | 1307 end |
1728 end | 1753 end |
1729 end -- do-block | 1754 end -- do-block |
1730 | 1755 |
1731 | 1756 |
1732 function WDP:CURSOR_UPDATE(event_name) | 1757 function WDP:CURSOR_UPDATE(event_name) |
1733 if current_action.fishing_target or _G.Minimap:IsMouseOver() or current_action.spell_label ~= "FISHING" then | 1758 if current_action.fishing_target or _G.Minimap:IsMouseOver() then |
1734 return | 1759 return |
1735 end | 1760 end |
1736 local text = _G["GameTooltipTextLeft1"]:GetText() | 1761 local text = _G["GameTooltipTextLeft1"]:GetText() |
1737 | 1762 |
1738 if not text or text == "Fishing Bobber" then | 1763 -- Handle Fishing |
1739 text = "NONE" | 1764 if (current_action.spell_label == "FISHING") then |
1740 else | 1765 if not text or text == "Fishing Bobber" then |
1741 current_action.fishing_target = true | 1766 text = "NONE" |
1742 end | 1767 else |
1743 current_action.identifier = ("%s:%s"):format(current_action.spell_label, text) | 1768 current_action.fishing_target = true |
1769 end | |
1770 current_action.identifier = ("%s:%s"):format(current_action.spell_label, text) | |
1771 -- Handle Garrison Cache | |
1772 elseif private.GARRISON_CACHE_OBJECT_NAME_TO_OBJECT_ID_MAP[text] then | |
1773 last_garrison_cache_object_id = private.GARRISON_CACHE_OBJECT_NAME_TO_OBJECT_ID_MAP[text] | |
1774 end | |
1744 end | 1775 end |
1745 | 1776 |
1746 | 1777 |
1747 function WDP:ITEM_TEXT_BEGIN(event_name) | 1778 function WDP:ITEM_TEXT_BEGIN(event_name) |
1748 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc")) | 1779 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc")) |