changeset 558:d423605eccf0

Updated Interface for Patch 8.0.1. Consolidated many constants left in Main.lua file. Removed Legion support. Added new BFA data.
author Caleb Atherton <atcaleb@twitch.tv>
date Tue, 17 Jul 2018 18:52:43 -0400
parents b1db703b7340
children eb77bf9c8e2f
files Constants.lua Main.lua WoWDBProfiler.toc
diffstat 3 files changed, 165 insertions(+), 143 deletions(-) [+]
line wrap: on
line diff
--- a/Constants.lua	Fri May 04 23:46:22 2018 -0400
+++ b/Constants.lua	Tue Jul 17 18:52:43 2018 -0400
@@ -13,8 +13,45 @@
 
 
 -----------------------------------------------------------------------
--- Boss/Loot Data Constants.
+-- Boss/Item/Spell Data Constants.
 -----------------------------------------------------------------------
+private.BLACKLISTED_ITEMS = {
+    [114116] = true,
+    [114119] = true,
+    [114120] = true,
+    [116980] = true,
+    [120319] = true,
+    [120320] = true,
+    [139593] = true,
+    [139594] = true,
+    [140590] = true,
+}
+
+-- Spells that are cast by players/NPCs that are mistakenly assigned as being cast by the target; must be blacklisted
+private.BLACKLISTED_SPELLS = {
+    [117526] = true, -- Binding Shot (cast by Hunters)
+    [121308] = true, -- Disguise (cast by Rogues)
+    [132464] = true, -- Chi Wave (cast by Monks)
+    [132467] = true, -- Chi Wave (cast by Monks)
+    [167432] = true, -- Savagery (cast by Warsong Commander)
+    [175077] = true, -- Fearsome Battle Standard (cast by Fearsome Battle Standard item)
+    [176813] = true, -- Itchy Spores (cast by Marsh Creatures in Ashran)
+    [183901] = true, -- Stolen Strength (cast by Felblood NPCs in Tanaan Jungle)
+    [183904] = true, -- Stolen Speed (cast by Felblood NPCs in Tanaan Jungle)
+    [183907] = true, -- Stolen Fervor (cast by Felblood NPCs in Tanaan Jungle)
+    [195802] = true, -- Moonkin Feather (applied by Moonfeather Statue; first stage buff)
+    [195805] = true, -- Moonkin Molting (applied by Moonfeather Statue; second stage buff)
+    [195810] = true, -- Feeling Moonkin (applied by Moonfeather Statue; third stage buff)
+    [195816] = true, -- Owlvercome wth the Fever (applied by Moonfeather Statue; final stage buff)
+    [213738] = true, -- Taste of Blood (applied by Fate and Fortune, Combat Rogue artifacts)
+    [213877] = true, -- Vampiric Aura (used by Nathrezim Invasion bosses and transformed players)
+    [215377] = true, -- The Maw Must Feed (applied by Maw of the Damned, Blood Death Knight artifact)
+    [218136] = true, -- Arcane Invigoration (cast by Duskwatch Rune Scribes in The Arcway)
+    [223971] = true, -- Hunter's Rush (applied by Fangs of Ashamane, Feral Druid artifacts)
+    [224762] = true, -- Leyline Rift (summoned by players with Leyline Mastery in Suramar)
+    [225832] = true, -- Nightglow Wisp (cast by players using Wisp in a Bottle toy)
+}
+
 private.EPHEMERAL_CRYSTAL_OBJECT_IDS = {
     251168,
     251183,
@@ -860,6 +897,28 @@
     [156688] = true,
     [156689] = true,
     [156698] = true,
+    [159783] = true,
+    [160439] = true,
+    [161083] = true,
+    [161084] = true,
+    [163059] = true,
+    [163139] = true,
+    [163141] = true,
+    [163142] = true,
+    [163144] = true,
+    [163146] = true,
+    [163148] = true,
+    [163734] = true,
+    [164251] = true,
+    [164252] = true,
+    [164257] = true,
+    [164258] = true,
+    [164259] = true,
+    [164260] = true,
+    [164261] = true,
+    [164262] = true,
+    [164263] = true,
+    [164264] = true,
 }
 for key, value in next, private.DELAYED_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP do
     private.CONTAINER_ITEM_ID_LIST[value] = false
@@ -910,6 +969,10 @@
     [254446] = 124555, -- 7.3 Raid World Boss - Bonus Roll Prompt (Sotanathor)
 
     -----------------------------------------------------------------------
+    -- Uldir
+    -----------------------------------------------------------------------
+
+    -----------------------------------------------------------------------
     -- Antorus, the Burning Throne
     -----------------------------------------------------------------------
     [250588] = 122450, -- 7.3 Raid Antorus - Bonus Roll Prompt - Boss 01 (Garothi Worldbreaker)
@@ -1021,6 +1084,43 @@
 -----------------------------------------------------------------------
 private.wow_version, private.build_num, _, private.interface_num = _G.GetBuildInfo()
 
+private.GENDER_NAMES = {
+    "UNKNOWN",
+    "MALE",
+    "FEMALE",
+}
+
+private.REACTION_NAMES = {
+    "HATED",
+    "HOSTILE",
+    "UNFRIENDLY",
+    "NEUTRAL",
+    "FRIENDLY",
+    "HONORED",
+    "REVERED",
+    "EXALTED",
+}
+
+private.STANDING_DISCOUNTS = {
+    HATED = 0,
+    HOSTILE = 0,
+    UNFRIENDLY = 0,
+    NEUTRAL = 0,
+    FRIENDLY = 0.05,
+    HONORED = 0.1,
+    REVERED = 0.15,
+    EXALTED = 0.2,
+}
+    
+-- We should just use IDs here someday; WoWDB site knows all about different power types
+private.POWER_TYPE_NAMES = {
+    ["0"] = "MANA",
+    ["1"] = "RAGE",
+    ["2"] = "FOCUS",
+    ["3"] = "ENERGY",
+    ["6"] = "RUNIC_POWER",
+}
+
 private.UNIT_TYPES = {
     PLAYER = "Player",
     OBJECT = "GameObject",
@@ -1158,6 +1258,20 @@
     NIGHTFALLEN = { 1859, true, _G.GetFactionInfoByID(1859) },
     VALARJAR = { 1948, true, _G.GetFactionInfoByID(1948) },
     WARDENS = { 1894, true, _G.GetFactionInfoByID(1894) },
+    ARMIES_OF_LEGIONFALL = { 2045, true, _G.GetFactionInfoByID(2045) },
+    ARMY_OF_THE_LIGHT = { 2165, true, _G.GetFactionInfoByID(2165) },
+    ARGUSSIAN_REACH = { 2170, true, _G.GetFactionInfoByID(2170) },
+    -- BFA reps (blacklisted because of world quests)
+    ZANDALARI_EMPIRE = { 2103, true, _G.GetFactionInfoByID(2103) },
+    PROUDMOORE_ADMIRALITY = { 2160, true, _G.GetFactionInfoByID(2160) },
+    TALNAJIS_EXPEDITION = { 2156, true, _G.GetFactionInfoByID(2156) },
+    ORDER_OF_EMBERS = { 2161, true, _G.GetFactionInfoByID(2161) },
+    VOLDUNAI = { 2158, true, _G.GetFactionInfoByID(2158) },
+    STORMS_WAKE = { 2162, true, _G.GetFactionInfoByID(2162) },
+    THE_HONORBOUND = { 2157, true, _G.GetFactionInfoByID(2157) },
+    SEVENTH_LEGION = { 2159, true, _G.GetFactionInfoByID(2159) },
+    CHAMPIONS_OF_AZEROTH = { 2164, true, _G.GetFactionInfoByID(2164) },
+    TORTOLLAN_SEEKERS = { 2163, true, _G.GetFactionInfoByID(2163) },
 }
 
 private.REP_BUFFS = {
--- a/Main.lua	Fri May 04 23:46:22 2018 -0400
+++ b/Main.lua	Tue Jul 17 18:52:43 2018 -0400
@@ -27,7 +27,7 @@
 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0")
 
 local deformat = LibStub("LibDeformat-3.0")
-local HereBeDragons -- This is set later, using 2.0 for BFA
+local HereBeDragons = LibStub("HereBeDragons-2.0")
 
 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate")
 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE")
@@ -37,10 +37,9 @@
 
 local AF = private.ACTION_TYPE_FLAGS
 local CLIENT_LOCALE = _G.GetLocale()
-local DB_VERSION = 18 -- This is increased to 19 later for BFA
+local DB_VERSION = 18
 local DEBUGGING = false
 local EVENT_DEBUG = false
-local IS_BFA = false -- This is set later if the Interface version is 80000
 
 -- Timer durations in seconds
 local DELAY_PROCESS_ITEMS = 30
@@ -280,18 +279,6 @@
 do
     local BARTERING_SPELL_ID = 83964
 
-    local STANDING_DISCOUNTS = {
-        HATED = 0,
-        HOSTILE = 0,
-        UNFRIENDLY = 0,
-        NEUTRAL = 0,
-        FRIENDLY = 0.05,
-        HONORED = 0.1,
-        REVERED = 0.15,
-        EXALTED = 0.2,
-    }
-
-
     function ActualCopperCost(copper_cost, rep_standing)
         if not copper_cost or copper_cost == 0 then
             return 0
@@ -304,9 +291,9 @@
 
         if rep_standing then
             if PLAYER_RACE == "Goblin" then
-                modifier = modifier - STANDING_DISCOUNTS["EXALTED"]
-            elseif STANDING_DISCOUNTS[rep_standing] then
-                modifier = modifier - STANDING_DISCOUNTS[rep_standing]
+                modifier = modifier - private.STANDING_DISCOUNTS["EXALTED"]
+            elseif private.STANDING_DISCOUNTS[rep_standing] then
+                modifier = modifier - private.STANDING_DISCOUNTS[rep_standing]
             end
         end
         return math.floor(copper_cost / modifier)
@@ -878,15 +865,6 @@
 
     local raw_db = _G.WoWDBProfilerData
     local build_num = tonumber(private.build_num)
-    
-    -- Check if it is Battle for Azeroth
-    if (tonumber(private.interface_num) == 80000) then
-        IS_BFA = true
-        HereBeDragons = LibStub("HereBeDragons-2.0")
-        DB_VERSION = 19
-    else
-        HereBeDragons = LibStub("HereBeDragons-1.0")
-    end
 
     -- Get current region from API (flawed)
     local current_region = _G.GetCurrentRegionName() or "XX"
@@ -1183,81 +1161,49 @@
 end
 
 
-local TargetedNPC
-do
-    local GENDER_NAMES = {
-        "UNKNOWN",
-        "MALE",
-        "FEMALE",
-    }
-
-
-    local REACTION_NAMES = {
-        "HATED",
-        "HOSTILE",
-        "UNFRIENDLY",
-        "NEUTRAL",
-        "FRIENDLY",
-        "HONORED",
-        "REVERED",
-        "EXALTED",
-    }
-
-
-    -- We should just use IDs here someday; WoWDB site knows all about different power types
-    local POWER_TYPE_NAMES = {
-        ["0"] = "MANA",
-        ["1"] = "RAGE",
-        ["2"] = "FOCUS",
-        ["3"] = "ENERGY",
-        ["6"] = "RUNIC_POWER",
-    }
-
-
-    function TargetedNPC()
-        if not _G.UnitExists("target") or _G.UnitPlayerControlled("target") or currently_drunk then
-            current_target_id = nil
-            return
+local function TargetedNPC()
+    if not _G.UnitExists("target") or _G.UnitPlayerControlled("target") or currently_drunk then
+        current_target_id = nil
+        return
+    end
+    local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
+
+    if not unit_idnum or not UnitTypeIsNPC(unit_type) then
+        return
+    end
+    current_target_id = unit_idnum
+
+    local npc = NPCEntry(unit_idnum)
+    local _, class_token = _G.UnitClass("target")
+    npc.class = class_token
+    npc.faction = UnitFactionStanding("target")
+    npc.genders = npc.genders or {}
+    npc.genders[private.GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED"] = true
+    npc.is_pvp = _G.UnitIsPVP("target") and true or nil
+    npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), private.REACTION_NAMES[_G.UnitReaction("player", "target")])
+
+    local encounter_data = npc:EncounterData(InstanceDifficultyToken()).stats
+    local npc_level = ("level_%d"):format(_G.UnitLevel("target"))
+    local level_data = encounter_data[npc_level]
+
+    if not level_data then
+        level_data = {}
+        encounter_data[npc_level] = level_data
+    end
+    level_data.max_health = level_data.max_health or _G.UnitHealthMax("target")
+
+    -- May not capture as much data as it could, since the API changed in Legion to report multiple types of power
+    if not level_data.power then
+        local max_power = _G.UnitPowerMax("target")
+
+        if max_power > 0 then
+            local power_type = _G.UnitPowerType("target")
+            level_data.power = ("%s:%d"):format(private.POWER_TYPE_NAMES[tostring(power_type)] or power_type, max_power)
         end
-        local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
-
-        if not unit_idnum or not UnitTypeIsNPC(unit_type) then
-            return
-        end
-        current_target_id = unit_idnum
-
-        local npc = NPCEntry(unit_idnum)
-        local _, class_token = _G.UnitClass("target")
-        npc.class = class_token
-        npc.faction = UnitFactionStanding("target")
-        npc.genders = npc.genders or {}
-        npc.genders[GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED"] = true
-        npc.is_pvp = _G.UnitIsPVP("target") and true or nil
-        npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")])
-
-        local encounter_data = npc:EncounterData(InstanceDifficultyToken()).stats
-        local npc_level = ("level_%d"):format(_G.UnitLevel("target"))
-        local level_data = encounter_data[npc_level]
-
-        if not level_data then
-            level_data = {}
-            encounter_data[npc_level] = level_data
-        end
-        level_data.max_health = level_data.max_health or _G.UnitHealthMax("target")
-
-        -- May not capture as much data as it could, since the API changed in Legion to report multiple types of power
-        if not level_data.power then
-            local max_power = _G.UnitPowerMax("target")
-
-            if max_power > 0 then
-                local power_type = _G.UnitPowerType("target")
-                level_data.power = ("%s:%d"):format(POWER_TYPE_NAMES[tostring(power_type)] or power_type, max_power)
-            end
-        end
-        name_to_id_map[_G.UnitName("target")] = unit_idnum
-        return npc, unit_idnum
     end
-end -- do-block
+    name_to_id_map[_G.UnitName("target")] = unit_idnum
+    return npc, unit_idnum
+end
 
 
 do
@@ -1600,19 +1546,6 @@
     end
 
 
-    local BLACKLISTED_ITEMS = {
-        [114116] = true,
-        [114119] = true,
-        [114120] = true,
-        [116980] = true,
-        [120319] = true,
-        [120320] = true,
-        [139593] = true,
-        [139594] = true,
-        [140590] = true,
-    }
-
-
     local CHAT_MSG_LOOT_UPDATE_FUNCS = {
         [AF.ITEM] = function(item_id, quantity)
             -- Verify that we're still assigning data to the right items
@@ -1684,7 +1617,7 @@
 
         -- Take action based on update category
         local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category]
-        if not category or not update_func or BLACKLISTED_ITEMS[item_id] then
+        if not category or not update_func or private.BLACKLISTED_ITEMS[item_id] then
             return
         end
         update_func(item_id, quantity)
@@ -1797,32 +1730,8 @@
     local FLAGS_NPC = bit.bor(_G.COMBATLOG_OBJECT_TYPE_GUARDIAN, _G.COMBATLOG_OBJECT_CONTROL_NPC)
     local FLAGS_NPC_CONTROL = bit.bor(_G.COMBATLOG_OBJECT_AFFILIATION_OUTSIDER, _G.COMBATLOG_OBJECT_CONTROL_NPC)
 
-    -- Spells that are cast by players/NPCs that are mistakely assigned as being cast by the target; must be blacklisted
-    local BLACKLISTED_SPELLS = {
-        [117526] = true, -- Binding Shot (cast by Hunters)
-        [121308] = true, -- Disguise (cast by Rogues)
-        [132464] = true, -- Chi Wave (cast by Monks)
-        [132467] = true, -- Chi Wave (cast by Monks)
-        [167432] = true, -- Savagery (cast by Warsong Commander)
-        [175077] = true, -- Fearsome Battle Standard (cast by Fearsome Battle Standard item)
-        [176813] = true, -- Itchy Spores (cast by Marsh Creatures in Ashran)
-        [183901] = true, -- Stolen Strength (cast by Felblood NPCs in Tanaan Jungle)
-        [183904] = true, -- Stolen Speed (cast by Felblood NPCs in Tanaan Jungle)
-        [183907] = true, -- Stolen Fervor (cast by Felblood NPCs in Tanaan Jungle)
-        [195802] = true, -- Moonkin Feather (applied by Moonfeather Statue; first stage buff)
-        [195805] = true, -- Moonkin Molting (applied by Moonfeather Statue; second stage buff)
-        [195810] = true, -- Feeling Moonkin (applied by Moonfeather Statue; third stage buff)
-        [195816] = true, -- Owlvercome wth the Fever (applied by Moonfeather Statue; final stage buff)
-        [213738] = true, -- Taste of Blood (applied by Fate and Fortune, Combat Rogue artifacts)
-        [213877] = true, -- Vampiric Aura (used by Nathrezim Invasion bosses and transformed players)
-        [215377] = true, -- The Maw Must Feed (applied by Maw of the Damned, Blood Death Knight artifact)
-        [218136] = true, -- Arcane Invigoration (cast by Duskwatch Rune Scribes in The Arcway)
-        [224762] = true, -- Leyline Rift (summoned by players with Leyline Mastery in Suramar)
-        [225832] = true, -- Nightglow Wisp (cast by players using Wisp in a Bottle toy)
-    }
-
     local function RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id)
-        if not spell_id or BLACKLISTED_SPELLS[spell_id] then
+        if not spell_id or private.BLACKLISTED_SPELLS[spell_id] then
             return
         end
         local source_type, source_id = ParseGUID(source_guid)
@@ -1902,9 +1811,7 @@
 
 
     function WDP:COMBAT_LOG_EVENT_UNFILTERED(event_name, time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, spell_id, ...)
-        if IS_BFA then
-            time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, spell_id = CombatLogGetCurrentEventInfo()
-        end
+        time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, spell_id = CombatLogGetCurrentEventInfo()
 
         local combat_log_func = COMBAT_LOG_FUNCS[sub_event]
 
--- a/WoWDBProfiler.toc	Fri May 04 23:46:22 2018 -0400
+++ b/WoWDBProfiler.toc	Tue Jul 17 18:52:43 2018 -0400
@@ -1,4 +1,4 @@
-## Interface: 70300
+## Interface: 80000
 ## Title: WoWDB Profiler
 ## Notes: WoW datamining tool.
 ## Author: James D. Callahan III (Torhal)