Mercurial > wow > wowdb-profiler
changeset 306:7feb687b1b22
Fixes
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Tue, 23 Jul 2013 18:07:07 -0500 |
parents | 4986ef8a338a |
children | c33ab3413737 |
files | Constants.lua Main.lua |
diffstat | 2 files changed, 231 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/Constants.lua Mon Jul 08 16:35:15 2013 -0500 +++ b/Constants.lua Tue Jul 23 18:07:07 2013 -0500 @@ -68,10 +68,12 @@ [_G.GetSpellInfo(8613)] = "SKINNING", } + private.NON_LOOT_SPELL_LABELS = { MIND_CONTROL = true, } + local AF = private.ACTION_TYPE_FLAGS private.SPELL_FLAGS_BY_LABEL = { @@ -90,6 +92,20 @@ SKINNING = AF.NPC, } + +private.LOOT_SPELL_ID_TO_ITEM_ID_MAP = { + [142397] = 98134, -- Heroic Cache of Treasures + [143506] = 98095, -- Brawler's Pet Supplies + [143507] = 94207, -- Fabled Pandaren Pet Supplies + [143512] = 93148, -- Pandaren Spirit Pet Supplies + [143511] = 93149, -- Pandaren Spirit Pet Supplies + [143510] = 93147, -- Pandaren Spirit Pet Supplies + [143509] = 93146, -- Pandaren Spirit Pet Supplies + [143508] = 89125, -- Sack of Pet Supplies + --[??????] = 104014, -- Pouch of Timeless Coins +} + + private.RAID_FINDER_BOSS_IDS = { ----------------------------------------------------------------------- -- Mogu'shan Vaults @@ -149,6 +165,36 @@ [68904] = true, -- Suen [68905] = true, -- Lu'lin [68397] = true, -- Lei Shen + + ----------------------------------------------------------------------- + -- Siege of Orgrimmar + ----------------------------------------------------------------------- + [71543] = true, -- Immerseus + [71475] = true, -- Rook Stonetoe (Fallen Protectors encounter) + [71479] = true, -- He Softfoot (Fallen Protectors encounter) + [71480] = true, -- Sun Tenderheart (Fallen Protectors encounter) + [71967] = true, -- Norushen (Norushen encounter) + [72276] = true, -- Amalgam of Corruption (Norushen encounter) + [71734] = true, -- Sha of Pride + [72249] = true, -- Galakras + [71466] = true, -- Iron Juggernaut + [71858] = true, -- Wavebinder Kardris (Kor'kron Dark Shaman encounter) + [71859] = true, -- Earthbreaker Haromm (Kor'kron Dark Shaman encounter) + [71515] = true, -- General Nazgrim + [71454] = true, -- Malkorok + [71889] = true, -- Secured Stockpile of Pandaren Spoils (Spoils of Pandaria encounter) + [71529] = true, -- Thok the Bloodthirsty + [71504] = true, -- Siegecrafter Blackfuse + [71152] = true, -- Skeer the Bloodseeker (Paragons of the Klaxxi encounter) + [71153] = true, -- Hisek the Swarmkeeper (Paragons of the Klaxxi encounter) + [71154] = true, -- Ka'roz the Locust (Paragons of the Klaxxi encounter) + [71155] = true, -- Korven the Prime (Paragons of the Klaxxi encounter) + [71156] = true, -- Kaz'tik the Manipulator (Paragons of the Klaxxi encounter) + [71157] = true, -- Xaril the Poisoned Mind (Paragons of the Klaxxi encounter) + [71158] = true, -- Rik'kal the Dissector (Paragons of the Klaxxi encounter) + [71160] = true, -- Iyyokuk the Lucid (Paragons of the Klaxxi encounter) + [71161] = true, -- Kil'ruk the Wind-Reaver (Paragons of the Klaxxi encounter) + [71865] = true, -- Garrosh Hellscream } @@ -157,4 +203,89 @@ [62346] = true, -- Galleon [69099] = true, -- Nalak [69161] = true, -- Oondasta + [71952] = true, -- Chi-Ji + [71953] = true, -- Xuen + [71954] = true, -- Niuzao + [71955] = true, -- Yu'lon + [72057] = true, -- Ordos } + + +private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP = { + ----------------------------------------------------------------------- + -- Mogu'shan Vaults + ----------------------------------------------------------------------- + [125144] = 59915, -- Stone Guard Bonus (Jasper Guardian) + [132189] = 60009, -- Feng the Accursed Bonus (Feng the Accursed) + [132190] = 60143, -- Gara'jal the Spiritbinder Bonus (Gara'jal the Spiritbinder) + [132191] = 60709, -- Spirit Kings Bonus (Qiang the Merciless) + [132192] = 60410, -- Elegon Bonus (Elegon) + [132193] = 60399, -- Will of the Emperor Bonus (Qin-xi) + + ----------------------------------------------------------------------- + -- Terrace of Endless Spring + ----------------------------------------------------------------------- + [132200] = 60583, -- Protectors of the Endless Bonus (Protector Kaolan) + [132204] = 60583, -- Protectors of the Endless (Elite) Bonus (Protector Kaolan) + [132201] = 62442, -- Tsulong Bonus (Tsulong) + [132202] = 62983, -- Lei Shi Bonus (Lei Shi) + [132203] = 60999, -- Sha of Fear Bonus (Sha of Fear) + + ----------------------------------------------------------------------- + -- Heart of Fear + ----------------------------------------------------------------------- + [132194] = 62980, -- Imperial Vizier Zor'lok Bonus (Imperial Vizier Zor'lok) + [132195] = 62543, -- Blade Lord Tay'ak Bonus (Blade Lord Ta'yak) + [132196] = 62164, -- Garalon Bonus (Garalon) + [132197] = 62397, -- Wind Lord Mel'jarak Bonus (Wind Lord Mel'jarak) + [132198] = 62511, -- Amber-Shaper Un'sok Bonus (Amber-Shaper Un'sok) + [132199] = 62837, -- Grand Empress Shek'zeer Bonus (Grand Empress Shek'zeer) + + ----------------------------------------------------------------------- + -- Throne of Thunder + ----------------------------------------------------------------------- + [139674] = 69465, -- Jin'rokh the Breaker Bonus (Jin'rokh the Breaker) + [139677] = 68476, -- Horridon Bonus (Horridon) + [139679] = 69078, -- Zandalari Troll Council Bonus (Sul the Sandcrawler) + [139680] = 67977, -- Tortos Bonus (Tortos) + [139682] = 68065, -- Magaera Bonus (Megaera) + [139684] = 69712, -- Ji'kun, the Ancient Mother Bonus (Ji-Kun) + [139686] = 68036, -- Durumu the Forgotten Bonus (Durumu the Forgotten) + [139687] = 69017, -- Primordious Bonus (Primordius) + [139688] = 69427, -- Dark Animus Bonus (Dark Animus) + [139689] = 68078, -- Iron Qon Bonus (Iron Qon) + [139690] = 68904, -- The Empyreal Queens Bonus (Suen) + [139691] = 68397, -- Lei Shen, The Thunder King Bonus (Lei Shen) + [139692] = 69473, -- Ra-den Bonus (Ra-den) + + ----------------------------------------------------------------------- + -- Siege of Orgrimmar + ----------------------------------------------------------------------- + [145909] = 71543, -- Immerseus Bonus (Immerseus) + [145910] = 71475, -- Fallen Protectors Bonus (Rook Stonetoe) + [145911] = 72276, -- Norushen Bonus (Amalgam of Corruption) + [145912] = 71734, -- Sha of Pride Bonus (Sha of Pride) + [145913] = 72249, -- Galakras Bonus (Galakras) + [145914] = 71466, -- Iron Juggernaut Bonus (Iron Juggernaut) + [145915] = 71859, -- Dark Shaman Bonus (Earthbreaker Haromm) + [145916] = 71515, -- General Nazgrim Bonus (General Nazgrim) + [145917] = 71454, -- Malkorok Bonus (Malkorok) + [145919] = 71889, -- Spoils of Pandaria Bonus (Secured Stockpile of Pandaren Spoils) + [145920] = 71529, -- Thok the Bloodthirsty Bonus (Thok the Bloodthirsty) + [145918] = 71504, -- Siegecrafter Blackfuse Bonus (Siegecrafter Blackfuse) + [145921] = 71161, -- Klaxxi Paragons Bonus (Kil'ruk the Wind-Reaver) + [145922] = 71865, -- Garrosh Hellscream Bonus (Garrosh Hellscream) +} + + +private.WORLD_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP = { + [132205] = 60491, -- Sha of Anger Bonus (Sha of Anger) + [132206] = 62346, -- Galleon Bonus (Galleon) + [136381] = 69099, -- Nalak Bonus (Nalak) + [137554] = 69161, -- Oondasta Bonus (Oondasta) + --[NYI] = 71952, -- Chi-Ji + --[NYI] = 71953, -- Xuen + --[NYI] = 71954, -- Niuzao + --[NYI] = 71955, -- Yu'lon + --[NYI] = 72057, -- Ordos +}
--- a/Main.lua Mon Jul 08 16:35:15 2013 -0500 +++ b/Main.lua Tue Jul 23 18:07:07 2013 -0500 @@ -10,6 +10,7 @@ local table = _G.table local select = _G.select +local unpack = _G.unpack -- ADDON NAMESPACE ---------------------------------------------------- @@ -99,6 +100,7 @@ QUEST_LOG_UPDATE = true, QUEST_PROGRESS = true, SHOW_LOOT_TOAST = true, + SPELL_CONFIRMATION_PROMPT = true, TAXIMAP_OPENED = true, TRADE_SKILL_SHOW = true, TRAINER_CLOSED = true, @@ -132,7 +134,9 @@ local faction_standings = {} local forge_spell_ids = {} local languages_known = {} +local loot_toast_container_timer_handle local name_to_id_map = {} +local killed_boss_id_timer_handle local killed_npc_id local target_location_timer_handle local current_target_id @@ -157,10 +161,17 @@ -- HELPERS ------------------------------------------------------------ local function Debug(message, ...) - if not DEBUGGING then + if not DEBUGGING or not message or not ... then return end - _G.print(message:format(...)) + local args = { ... } + + for index = 1, #args do + if args[index] == nil then + args[index] = "nil" + end + end + _G.print(message:format(unpack(args))) end @@ -168,7 +179,6 @@ do local header_list = {} - -- iter_func returns true to indicate that the loop should be broken function TradeSkillExecutePer(iter_func) if not _G.TradeSkillFrame or not _G.TradeSkillFrame:IsVisible() then return @@ -278,8 +288,23 @@ local function ClearKilledBossID() + if killed_boss_id_timer_handle then + WDP:CancelTimer(killed_boss_id_timer_handle) + end + private.boss_loot_toasting = false private.raid_finder_boss_id = nil private.world_boss_id = nil + killed_boss_id_timer_handle = nil +end + + +local function ClearLootToastContainerID() + if loot_toast_container_timer_handle then + WDP:CancelTimer(loot_toast_container_timer_handle) + end + private.container_loot_toasting = false + private.loot_toast_container_id = nil + loot_toast_container_timer_handle = nil end @@ -515,9 +540,8 @@ if not current_line then break end - local is_ptr = select(4, _G.GetBuildInfo()) ~= 50100 - - if is_ptr or current_line:GetText() == _G.ITEM_OPENABLE then + + if current_line:GetText() == _G.ITEM_OPENABLE then table.wipe(current_action) current_action.target_type = AF.ITEM current_action.identifier = item_id @@ -612,7 +636,7 @@ if not source_list[source_id] then if top_field then entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1 - else + elseif not private.container_loot_toasting then entry[loot_count] = (entry[loot_count] or 0) + 1 end source_list[source_id] = true @@ -1113,29 +1137,44 @@ function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity) + if not loot_type or (loot_type ~= "item" and loot_type ~= "money") then + Debug("%s: loot_type is %s. Item link is %s, and quantity is %d.", event_name, loot_type, item_link, quantity) + return + end local container_id = private.loot_toast_container_id local item_id = ItemLinkToID(item_link) local npc = NPCEntry(private.raid_finder_boss_id or private.world_boss_id) - ClearKilledBossID() if npc then if not item_id then Debug("%s: ItemID is nil, from item link %s", event_name, item_link) return end - local loot_type = "drops" + local loot_label = "drops" local encounter_data = npc:EncounterData(InstanceDifficultyToken()) - encounter_data[loot_type] = encounter_data[loot_type] or {} + encounter_data[loot_label] = encounter_data[loot_label] or {} encounter_data.loot_counts = encounter_data.loot_counts or {} - encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1 - - table.insert(encounter_data[loot_type], ("%d:%d"):format(item_id, quantity)) - Debug("%s: %sX%d (%d)", event_name, item_link, quantity, item_id) + + if not private.boss_loot_toasting then + encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1 + end + + if loot_type == "item" then + Debug("%s: %sX%d (%d)", event_name, item_link, quantity, item_id) + table.insert(encounter_data[loot_label], ("%d:%d"):format(item_id, quantity)) + elseif loot_type == "money" then + Debug("%s: money - %d", event_name, quantity) + table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) + end + private.boss_loot_toasting = true -- Do not count further loots until timer expires or another boss is killed elseif container_id then - private.loot_toast_container_id = nil - InitializeCurrentLoot() + -- Fake the loot characteristics to match that of an actual container item + current_loot.identifier = container_id + current_loot.label = "contains" + current_loot.target_type = AF.ITEM + if loot_type == "item" then if not item_id then Debug("%s: ItemID is nil, from item link %s", event_name, item_link) @@ -1149,6 +1188,7 @@ end GenericLootUpdate("items") current_loot = nil + private.container_loot_toasting = true -- do not count further loots until timer expires or another container is opened else Debug("%s: NPC and Container are nil.", event_name) end @@ -1349,23 +1389,11 @@ Debug("%s: %s was killed by %s (not group member or pet).", sub_event, dest_name or _G.UNKNOWN, killer_name or _G.UNKNOWN) table.wipe(previous_combat_event) ClearKilledNPC() - ClearKilledBossID() - return - end - Debug("%s: %s was killed by %s.", sub_event, dest_name or _G.UNKNOWN, killer_name or _G.UNKNOWN) - - if private.RAID_FINDER_BOSS_IDS[unit_idnum] then - Debug("%s: Matching boss %s.", sub_event, dest_name) - ClearKilledBossID() - private.raid_finder_boss_id = unit_idnum - elseif private.WORLD_BOSS_IDS[unit_idnum] then - Debug("%s: Matching world boss %s.", sub_event, dest_name) - ClearKilledBossID() - private.world_boss_id = unit_idnum + else + Debug("%s: %s was killed by %s.", sub_event, dest_name or _G.UNKNOWN, killer_name or _G.UNKNOWN) end killed_npc_id = unit_idnum WDP:ScheduleTimer(ClearKilledNPC, 0.1) - WDP:ScheduleTimer(ClearKilledBossID, 1) end, } @@ -2171,6 +2199,7 @@ if not spell_label then return end + local item_name, item_link = _G.GameTooltip:GetItem() local unit_name, unit_id = _G.GameTooltip:GetUnit() @@ -2223,36 +2252,48 @@ end -do - local LOOT_SPELL_ID_TO_ITEM_ID_MAP = { - [142397] = 98134, -- Heroic Cache of Treasures - [143506] = 98095, -- Brawler's Pet Supplies - [143507] = 94207, -- Fabled Pandaren Pet Supplies - [143512] = 93148, -- Pandaren Spirit Pet Supplies - [143511] = 93149, -- Pandaren Spirit Pet Supplies - [143510] = 93147, -- Pandaren Spirit Pet Supplies - [143509] = 93146, -- Pandaren Spirit Pet Supplies - [143508] = 89125, -- Sack of Pet Supplies - } - - function WDP:UNIT_SPELLCAST_SUCCEEDED(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) - if unit_id ~= "player" then - return - end - private.tracked_line = nil - private.previous_spell_id = spell_id - private.loot_toast_container_id = LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] - - if anvil_spell_ids[spell_id] then - UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL) - elseif forge_spell_ids[spell_id] then - UpdateDBEntryLocation("objects", OBJECT_ID_FORGE) - elseif spell_name:match("^Harvest.+") then - killed_npc_id = current_target_id - private.harvesting = true - end +function WDP:SPELL_CONFIRMATION_PROMPT(event_name, spell_id, confirm_type, text, duration, currency_id) + if private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] then + ClearKilledBossID() + ClearLootToastContainerID() + private.raid_finder_boss_id = private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] + elseif private.WORLD_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] then + ClearKilledBossID() + ClearLootToastContainerID() + private.world_boss_id = private.WORLD_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] + else + Debug("%s: Spell ID %d is not a known raid or world boss 'Bonus' spell.", event_name, spell_id) + return end -end -- do-block + + killed_boss_id_timer_handle = WDP:ScheduleTimer(ClearKilledBossID, 1) -- we need to assign a handle here to cancel it later +end + + +function WDP:UNIT_SPELLCAST_SUCCEEDED(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) + if unit_id ~= "player" then + return + end + private.tracked_line = nil + private.previous_spell_id = spell_id + + if private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then + ClearKilledBossID() + ClearLootToastContainerID() + + 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 + end + + if anvil_spell_ids[spell_id] then + UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL) + elseif forge_spell_ids[spell_id] then + UpdateDBEntryLocation("objects", OBJECT_ID_FORGE) + elseif spell_name:match("^Harvest.+") then + killed_npc_id = current_target_id + private.harvesting = true + end +end function WDP:HandleSpellFailure(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id)