changeset 426:de0795cfbe56

Removed new kill count system for raid encounters while it undergoes further testing.
author MMOSimca <MMOSimca@gmail.com>
date Tue, 13 Jan 2015 02:51:55 -0500
parents 5bd49f0b635c
children 181c7f8cd087
files Constants.lua Main.lua
diffstat 2 files changed, 2 insertions(+), 151 deletions(-) [+]
line wrap: on
line diff
--- a/Constants.lua	Wed Jan 07 19:05:01 2015 -0500
+++ b/Constants.lua	Tue Jan 13 02:51:55 2015 -0500
@@ -312,58 +312,6 @@
     private.CONTAINER_ITEM_ID_LIST[value] = false
 end
 
--- Mapping of NPC IDs for use with GetLFGDungeonEncounterInfo and GetSavedInstanceEncounterInfo.
--- Non-english clients can't partcipate due to these poorly-thought-out API functions.
-private.RAID_ENCOUNTER_NAME_TO_NPC_ID_MAP = {
-    -----------------------------------------------------------------------
-    -- Blackrock Foundry
-    -----------------------------------------------------------------------
-    ["Oregorger the Devourer"] = 77182,
-    ["Gruul"] = 76877,
-    ["Hans'gar & Franzok"] = 76973,
-    ["Beastlord Darmac"] = 76865,
-    ["Flamebender Ka'graz"] = 76814,
-    ["Operator Thogar"] = 76906,
-    ["Blast Furnace"] = 76809,
-    ["Kromog, Legend of the Mountain"] = 77692,
-    ["The Iron Maidens"] = 77557,
-    ["Blackhand"] = 77325,
-
-    -----------------------------------------------------------------------
-    -- Highmaul
-    -----------------------------------------------------------------------
-    ["Kargath Bladefist"] = 78714,
-    ["The Butcher"] = 77404,
-    ["Brackenspore"] = 78491,
-    ["Tectus, The Living Mountain"] = 78948,
-    ["Twin Ogron"] = 78237,
-    ["Ko'ragh"] = 79015,
-    ["Imperator Mar'gok"] = 77428,
-
-    -----------------------------------------------------------------------
-    -- Mists of Pandaria
-    -----------------------------------------------------------------------
-    ["Immerseus"] = 71543,
-    ["Fallen Protectors"] = 71475,
-    ["Norushen"] = 72276,
-    ["Sha of Pride"] = 71734,
-    ["Galakras"] = 72249,
-    ["Iron Juggernaut"] = 71466,
-    ["Kor'kron Dark Shaman"] = 71859,
-    ["General Nazgrim"] = 71515,
-    ["Malkorok"] = 71454,
-    ["Spoils of Pandaria"] = 71889,
-    ["Thok the Bloodthirsty"] = 71529,
-    ["Siegecrafter Blackfuse"] = 71504,
-    ["Paragons of the Klaxxi"] = 71161,
-    ["Garrosh Hellscream"] = 71865,
-}
--- To prevent kill count from being incremented in the old fashion (only when using personal loot for now)
-private.RAID_ENCOUNTER_NPC_ID_LIST = {}
-for key, value in next, private.RAID_ENCOUNTER_NAME_TO_NPC_ID_MAP do
-    private.RAID_ENCOUNTER_NPC_ID_LIST[value] = true
-end
-
 -- Mapping of Spell IDs for bonus roll confirmation prompts to raid bosses
 -- In some cases this records only bonus loot, and in other cases this is needed for all loot.
 private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP = {
--- a/Main.lua	Wed Jan 07 19:05:01 2015 -0500
+++ b/Main.lua	Tue Jan 13 02:51:55 2015 -0500
@@ -103,7 +103,6 @@
     COMBAT_LOG_EVENT_UNFILTERED = true,
     COMBAT_TEXT_UPDATE = true,
     CURSOR_UPDATE = true,
-    ENCOUNTER_END = true,
     FORGE_MASTER_OPENED = true,
     GARRISON_MISSION_BONUS_ROLL_COMPLETE = "HandleBadChatLootData",
     GARRISON_MISSION_COMPLETE_RESPONSE = "HandleBadChatLootData",
@@ -121,7 +120,6 @@
     MERCHANT_UPDATE = "UpdateMerchantItems",
     PET_BAR_UPDATE = true,
     --PET_JOURNAL_LIST_UPDATE = true,
-    PLAYER_LOGOUT = true,
     PLAYER_REGEN_DISABLED = true,
     PLAYER_REGEN_ENABLED = true,
     PLAYER_TARGET_CHANGED = true,
@@ -182,9 +180,6 @@
 local current_target_id
 local current_area_id
 local current_loot
-local saved_raid_encounter_data
-local update_raid_encounter_timer_handle
-local saved_difficulty_token
 
 
 -- Data for our current action. Including possible values as a reference.
@@ -928,66 +923,6 @@
 end
 
 
--- This wipes a timer as well
-local UpdateRaidEncounterInfo
-do
-    local fresh_raid_encounter_data = {}
-
-    function UpdateRaidEncounterInfo()
-        -- Clear timer info
-        if update_raid_encounter_timer_handle then
-            update_raid_encounter_timer_handle:Cancel()
-            update_raid_encounter_timer_handle = nil
-        end
-        table.wipe(fresh_raid_encounter_data)
-
-        -- Collect encounter data for LFR difficulty via RF functions
-        for i = 1, _G.GetNumRFDungeons() do
-            local dungeon_ID = _G.GetRFDungeonInfo(i)
-            fresh_raid_encounter_data[dungeon_ID] = fresh_raid_encounter_data[dungeon_ID] or {}
-            for j = 1, _G.GetLFGDungeonNumEncounters(dungeon_ID) do
-                local boss_name, _, is_killed = _G.GetLFGDungeonEncounterInfo(dungeon_ID, j)
-                fresh_raid_encounter_data[dungeon_ID][boss_name] = is_killed
-            end
-        end
-
-        -- Collect encounter data for Normal/Heroic/Mythic difficulty via saved instance functions
-        for i = 1, _G.GetNumSavedInstances() do
-            local _, dungeon_ID, _, _, _, _, _, _, _, _, num_encounters = _G.GetSavedInstanceInfo(i)
-            fresh_raid_encounter_data[dungeon_ID] = fresh_raid_encounter_data[dungeon_ID] or {}
-            for j = 1, num_encounters do
-                local boss_name, _, is_killed = _G.GetSavedInstanceEncounterInfo(i, j)
-                fresh_raid_encounter_data[dungeon_ID][boss_name] = is_killed
-            end
-        end
-
-        Debug("UpdateRaidEncounterInfo: Collected fresh raid encounter data.")
-        if saved_raid_encounter_data then
-            -- Compare old data vs new table to find changes
-            for dungeon_ID, sub_table in next, saved_raid_encounter_data do
-                for boss_name, is_killed in next, saved_raid_encounter_data[dungeon_ID] do
-                    if private.RAID_ENCOUNTER_NAME_TO_NPC_ID_MAP[boss_name] and saved_raid_encounter_data[dungeon_ID][boss_name] == false and fresh_raid_encounter_data[dungeon_ID] and fresh_raid_encounter_data[dungeon_ID][boss_name] == true then
-                        Debug("UpdateRaidEncounterInfo: Incrementing kill count for boss %s with ID %d.", boss_name, private.RAID_ENCOUNTER_NAME_TO_NPC_ID_MAP[boss_name])
-                        -- Increment kill count for NPC IDs with detected changes
-                        local npc = NPCEntry(private.RAID_ENCOUNTER_NAME_TO_NPC_ID_MAP[boss_name])
-                        if npc then
-                            local encounter_data = npc:EncounterData(saved_difficulty_token)
-                            encounter_data["drops"] = encounter_data["drops"] or {}
-                            encounter_data.loot_counts = encounter_data.loot_counts or {}
-                            encounter_data.loot_counts["drops"] = (encounter_data.loot_counts["drops"] or 0) + 1
-                        end
-                    end
-                end
-            end
-        end
-
-        -- Assign new table over old one
-        saved_raid_encounter_data = fresh_raid_encounter_data
-        saved_difficulty_token = nil
-    end
-end
-
-
 -- METHODS ------------------------------------------------------------
 
 function WDP:OnInitialize()
@@ -1058,10 +993,6 @@
         WDP:UpdateTargetLocation()
     end, 100000)
 
-    if ALLOWED_LOCALES[CLIENT_LOCALE] then
-        update_raid_encounter_timer_handle = C_Timer.NewTimer(10, UpdateRaidEncounterInfo)
-    end
-
     _G.hooksecurefunc("UseContainerItem", function(bag_index, slot_index, target_unit)
         if target_unit then
             return
@@ -1359,26 +1290,6 @@
 
 -- EVENT HANDLERS -----------------------------------------------------
 
-function WDP:ENCOUNTER_END(event_name)
-    local loot_method = _G.GetLootMethod()
-    -- This will only work for english clients due to questionable API design choices
-    -- Currently only testing this method of kill count recording for personal loot.
-    -- Master looting has too many edge cases, such as chest objects and multiple NPCs with split loot.
-    if loot_method ~= "personalloot" or not ALLOWED_LOCALES[CLIENT_LOCALE] then
-        return
-    end
-
-    saved_difficulty_token = InstanceDifficultyToken()
-    update_raid_encounter_timer_handle = C_Timer.NewTimer(30, UpdateRaidEncounterInfo)
-end
-
-
-function WDP:PLAYER_LOGOUT(event_name)
-    if update_raid_encounter_timer_handle then
-        UpdateRaidEncounterInfo()
-    end
-end
-
 -- For now, bonus roll data only pollutes the true drop percentages. We still want to capture the data from SPELL_CONFIRMATION_PROMPT because of legendary quest items though.
 function WDP:BONUS_ROLL_RESULT(event_name)
     Debug("%s: Bonus roll detected; stopping loot recording for this boss to avoid recording bonus loot.", event_name)
@@ -1476,7 +1387,6 @@
             Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link)
         end
     elseif raid_boss_id then
-        local loot_method = _G.GetLootMethod()
         -- Slightly messy hack to workaround duplicate world bosses
         local upper_limit = 0
         if DUPLICATE_WORLD_BOSS_IDS[raid_boss_id] then
@@ -1521,12 +1431,7 @@
                 end
 
                 if not boss_loot_toasting[temp_npc_id] then
-                    -- In some situations, we will increment kill count by watching what the player is saved to
-                    if not update_raid_encounter_timer_handle or not private.RAID_ENCOUNTER_NPC_ID_LIST[temp_npc_id] or loot_method ~= "personalloot" then
-                        encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1
-                    else
-                        Debug("%s: Skipping incrementing kill count for NPC ID %d.", event_name, temp_npc_id)
-                    end
+                    encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1
                     boss_loot_toasting[temp_npc_id] = true -- Do not count further loots until timer expires or another boss is killed
                 end
             end
@@ -2106,7 +2011,6 @@
             GenericLootUpdate("items")
         end,
         [AF.NPC] = function()
-            local loot_method = _G.GetLootMethod()
             local difficulty_token = InstanceDifficultyToken()
             local loot_label = current_loot.label
             local source_list = {}
@@ -2121,12 +2025,7 @@
 
                     if not source_list[source_guid] then
                         encounter_data.loot_counts = encounter_data.loot_counts or {}
-                        -- In some situations, we will increment kill count by watching what the player is saved to
-                        if not update_raid_encounter_timer_handle or not private.RAID_ENCOUNTER_NPC_ID_LIST[source_id] or loot_method ~= "personalloot" then
-                            encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1
-                        else
-                            
-                        end
+                        encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1
                         source_list[source_guid] = true
                     end