Mercurial > wow > wowdb-profiler
changeset 345:61a9520b5337 WoD
Added support for collecting Timber locations and drop contents. Fixed occassional mining/herb data being classified as zone data.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Fri, 03 Oct 2014 15:18:01 -0400 |
parents | 7bca9a0f9382 |
children | 04343b25c612 |
files | Constants.lua Main.lua |
diffstat | 2 files changed, 82 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/Constants.lua Fri Oct 03 15:09:44 2014 -0400 +++ b/Constants.lua Fri Oct 03 15:18:01 2014 -0400 @@ -15,6 +15,39 @@ ----------------------------------------------------------------------- -- Game Data Constants. ----------------------------------------------------------------------- +-- Map of Alliance Logging NPC Summon spells to all possible Timber objectIDs of the proper tree size +private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP = { + [167902] = { 233604, 233922, 234021, 234080, 234097, 234109, 234110, 234122, 234126, 234193, 234197, 237727, }, + [167969] = { 233634, 234000, 234022, 234098, 234111, 234119, 234123, 234127, 234194, 234196, 234198, }, + [168201] = { 233625, 234007, 234023, 234099, 234120, 234124, 234128, 234195, 234199, }, +} +-- Account for Horde spell IDs +private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[167961] = private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[167902] +private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[168043] = private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[167969] +private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[168200] = private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[168201] + +private.LOOT_SPELL_ID_TO_ITEM_ID_MAP = { + [142397] = 98134, -- Heroic Cache of Treasures + [142901] = 98546, -- Bulging Heroic Cache of Treasures + [143506] = 98095, -- Brawler's Pet Supplies + [143507] = 94207, -- Fabled Pandaren Pet Supplies + [143508] = 89125, -- Sack of Pet Supplies + [143509] = 93146, -- Pandaren Spirit Pet Supplies + [143510] = 93147, -- Pandaren Spirit Pet Supplies + [143511] = 93149, -- Pandaren Spirit Pet Supplies + [143512] = 93148, -- Pandaren Spirit Pet Supplies + [146885] = 103535, -- Bulging Bag of Charms + [147598] = 104014, -- Pouch of Timeless Coins + [149222] = 105911, -- Pouch of Enduring Wisdom + [149223] = 105912, -- Oversized Pouch of Enduring Wisdom + --[168178] = 114116, -- Bag of Salvaged Goods + --[168179] = 114119, -- Crate of Salvage + --[168180] = 114120, -- Big Crate of Salvage + [171513] = 116414, -- Pet Supplies + [175767] = 118697, -- Big Bag of Pet Supplies + [178508] = 120321, -- Mystery Bag +} + private.FACTION_DATA = { -- Used only for private.REP_BUFFS ARGENT_CRUSADE = { 1106, _G.GetFactionInfoByID(1106) }, @@ -230,28 +263,6 @@ }, } -private.LOOT_SPELL_ID_TO_ITEM_ID_MAP = { - [142397] = 98134, -- Heroic Cache of Treasures - [142901] = 98546, -- Bulging Heroic Cache of Treasures - [143506] = 98095, -- Brawler's Pet Supplies - [143507] = 94207, -- Fabled Pandaren Pet Supplies - [143508] = 89125, -- Sack of Pet Supplies - [143509] = 93146, -- Pandaren Spirit Pet Supplies - [143510] = 93147, -- Pandaren Spirit Pet Supplies - [143511] = 93149, -- Pandaren Spirit Pet Supplies - [143512] = 93148, -- Pandaren Spirit Pet Supplies - [146885] = 103535, -- Bulging Bag of Charms - [147598] = 104014, -- Pouch of Timeless Coins - [149222] = 105911, -- Pouch of Enduring Wisdom - [149223] = 105912, -- Oversized Pouch of Enduring Wisdom - [168178] = 114116, -- Bag of Salvaged Goods - [168179] = 114119, -- Crate of Salvage - [168180] = 114120, -- Big Crate of Salvage - [171513] = 116414, -- Pet Supplies - [175767] = 118697, -- Big Bag of Pet Supplies - [178508] = 120321, -- Mystery Bag -} - private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP = { ----------------------------------------------------------------------- -- World Bosses
--- a/Main.lua Fri Oct 03 15:09:44 2014 -0400 +++ b/Main.lua Fri Oct 03 15:18:01 2014 -0400 @@ -158,6 +158,7 @@ local killed_boss_id_timer_handle local killed_npc_id local target_location_timer_handle +local last_timber_spell_id local current_target_id local current_area_id local current_loot @@ -1357,9 +1358,28 @@ do local CHAT_MSG_LOOT_UPDATE_FUNCS = { [AF.NPC] = function(item_id, quantity) - Debug("CHAT_MSG_LOOT: %d (%d)", item_id, quantity) + Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity) + end, + [AF.OBJECT] = function(item_id, quantity) + Debug("CHAT_MSG_LOOT: AF.OBJECT %d (%d)", item_id, quantity) + for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id] do + -- Check for top level object data + local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id][timber_variant])) + local difficulty_token = InstanceDifficultyToken() + if object_entry[difficulty_token] then + -- Increment loot count + object_entry[difficulty_token]["opening_count"] = object_entry[difficulty_token]["opening_count"] or 0 + 1 + + -- Add drop data + local loot_table = LootTable(object_entry, "opening", difficulty_token) + table.insert(loot_table, ("%d:%d"):format(item_id, quantity)) + else + Debug("CHAT_MSG_LOOT: When handling timber, the top level loot data was missing for objectID %s.", private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id][timber_variant]) + end + end end, [AF.ZONE] = function(item_id, quantity) + Debug("CHAT_MSG_LOOT: AF.ZONE %d (%d)", item_id, quantity) InitializeCurrentLoot() current_loot.list[1] = ("%d:%d"):format(item_id, quantity) GenericLootUpdate("zones") @@ -1371,24 +1391,28 @@ function WDP:CHAT_MSG_LOOT(event_name, message) local category - if current_action.spell_label ~= "EXTRACT_GAS" then + local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) + if not item_link then + quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF) + end + local item_id = ItemLinkToID(item_link) + + if not item_id then + return + end + + -- Set update category + if last_timber_spell_id and item_id == TIMBER_ITEM_ID then + category = AF.OBJECT + -- Recently changed from ~= "EXTRACT_GAS" because of some occassional bad data, and, as far as I know, no benefit. + elseif current_action.spell_label == "FISHING" then category = AF.ZONE elseif private.raid_boss_id then category = AF.NPC end + + -- Take action based on update category local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category] - - local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) - - if not item_link then - quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF) - end - local item_id = ItemLinkToID(item_link) - - if not item_id then - return - end - if not category or not update_func then -- We still want to record the item's data, even if it doesn't need its drop location recorded RecordItemData(item_id, item_link, true) @@ -2572,6 +2596,16 @@ private.tracked_line = nil private.previous_spell_id = spell_id + -- Handle Logging spell casts + if private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] then + last_timber_spell_id = spell_id + for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] do + UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id][timber_variant])) + end + return + end + + -- Handle Loot Toast spell casts if private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then ClearKilledBossID() ClearLootToastContainerID() @@ -2579,6 +2613,7 @@ private.loot_toast_container_id = private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] loot_toast_container_timer_handle = WDP:ScheduleTimer(ClearLootToastContainerID, 1) -- we need to assign a handle here to cancel it later + return end if anvil_spell_ids[spell_id] then