comparison Main.lua @ 552:37eca5900db5

Updated for compatibility with Patch 8.0.1.
author Caleb Atherton <atcaleb@twitch.tv>
date Tue, 01 May 2018 19:27:15 -0400
parents c6fafd40a7b7
children 98eb25ffc0c4
comparison
equal deleted inserted replaced
551:27a45688eef4 552:37eca5900db5
25 25
26 local LibStub = _G.LibStub 26 local LibStub = _G.LibStub
27 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0") 27 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0")
28 28
29 local deformat = LibStub("LibDeformat-3.0") 29 local deformat = LibStub("LibDeformat-3.0")
30 local HereBeDragons = LibStub("HereBeDragons-1.0") 30 local HereBeDragons -- This is set later, using 2.0 for BFA
31 31
32 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate") 32 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate")
33 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE") 33 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE")
34 34
35 35
36 -- CONSTANTS ---------------------------------------------------------- 36 -- CONSTANTS ----------------------------------------------------------
37 37
38 local AF = private.ACTION_TYPE_FLAGS 38 local AF = private.ACTION_TYPE_FLAGS
39 local CLIENT_LOCALE = _G.GetLocale() 39 local CLIENT_LOCALE = _G.GetLocale()
40 local DB_VERSION = 18 40 local DB_VERSION = 18 -- This is increased to 19 later for BFA
41 local DEBUGGING = false 41 local DEBUGGING = false
42 local EVENT_DEBUG = false 42 local EVENT_DEBUG = false
43 local IS_BFA = false -- This is set later if the Interface version is 80000
43 44
44 -- Timer durations in seconds 45 -- Timer durations in seconds
45 local DELAY_PROCESS_ITEMS = 30 46 local DELAY_PROCESS_ITEMS = 30
46 local DELAY_PROCESS_WORLD_QUESTS = 60 47 local DELAY_PROCESS_WORLD_QUESTS = 60
47 local DELAY_UPDATE_TARGET_LOCATION = 0.5 48 local DELAY_UPDATE_TARGET_LOCATION = 0.5
876 global_db = db.global 877 global_db = db.global
877 char_db = db.char 878 char_db = db.char
878 879
879 local raw_db = _G.WoWDBProfilerData 880 local raw_db = _G.WoWDBProfilerData
880 local build_num = tonumber(private.build_num) 881 local build_num = tonumber(private.build_num)
882
883 -- Check if it is Battle for Azeroth
884 if (tonumber(private.interface_num) == 80000) then
885 IS_BFA = true
886 HereBeDragons = LibStub("HereBeDragons-2.0")
887 DB_VERSION = 19
888 else
889 HereBeDragons = LibStub("HereBeDragons-1.0")
890 end
881 891
882 -- Get current region from API (flawed) 892 -- Get current region from API (flawed)
883 local current_region = _G.GetCurrentRegionName() or "XX" 893 local current_region = _G.GetCurrentRegionName() or "XX"
884 894
885 -- Wipe all data if DB version or build number changed 895 -- Wipe all data if DB version or build number changed
1807 [218136] = true, -- Arcane Invigoration (cast by Duskwatch Rune Scribes in The Arcway) 1817 [218136] = true, -- Arcane Invigoration (cast by Duskwatch Rune Scribes in The Arcway)
1808 [224762] = true, -- Leyline Rift (summoned by players with Leyline Mastery in Suramar) 1818 [224762] = true, -- Leyline Rift (summoned by players with Leyline Mastery in Suramar)
1809 [225832] = true, -- Nightglow Wisp (cast by players using Wisp in a Bottle toy) 1819 [225832] = true, -- Nightglow Wisp (cast by players using Wisp in a Bottle toy)
1810 } 1820 }
1811 1821
1812 local function RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1822 local function RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id)
1813 if not spell_id or BLACKLISTED_SPELLS[spell_id] then 1823 if not spell_id or BLACKLISTED_SPELLS[spell_id] then
1814 return 1824 return
1815 end 1825 end
1816 local source_type, source_id = ParseGUID(source_guid) 1826 local source_type, source_id = ParseGUID(source_guid)
1817 1827
1831 local previous_combat_event = {} 1841 local previous_combat_event = {}
1832 1842
1833 local COMBAT_LOG_FUNCS = { 1843 local COMBAT_LOG_FUNCS = {
1834 SPELL_AURA_APPLIED = RecordNPCSpell, 1844 SPELL_AURA_APPLIED = RecordNPCSpell,
1835 SPELL_CAST_START = RecordNPCSpell, 1845 SPELL_CAST_START = RecordNPCSpell,
1836 SPELL_CAST_SUCCESS = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1846 SPELL_CAST_SUCCESS = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id)
1837 if spell_id == HEAL_BATTLE_PETS_SPELL_ID then 1847 if spell_id == HEAL_BATTLE_PETS_SPELL_ID then
1838 local unit_type, unit_idnum = ParseGUID(source_guid) 1848 local unit_type, unit_idnum = ParseGUID(source_guid)
1839 1849
1840 if unit_idnum and UnitTypeIsNPC(unit_type) then 1850 if unit_idnum and UnitTypeIsNPC(unit_type) then
1841 NPCEntry(unit_idnum).stable_master = true 1851 NPCEntry(unit_idnum).stable_master = true
1842 end 1852 end
1843 end 1853 end
1844 RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1854 RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id)
1845 end, 1855 end,
1846 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1856 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id)
1847 local unit_type, unit_idnum = ParseGUID(dest_guid) 1857 local unit_type, unit_idnum = ParseGUID(dest_guid)
1848 1858
1849 if not unit_idnum or not UnitTypeIsNPC(unit_type) then 1859 if not unit_idnum or not UnitTypeIsNPC(unit_type) then
1850 --Debug("%s: %s is not an NPC, or has no ID.", sub_event, dest_name or _G.UNKNOWN) -- we really don't need to know this 1860 --Debug("%s: %s is not an NPC, or has no ID.", sub_event, dest_name or _G.UNKNOWN) -- we really don't need to know this
1851 ClearKilledNPC() 1861 ClearKilledNPC()
1887 SPELL_PERIODIC_DAMAGE = true, 1897 SPELL_PERIODIC_DAMAGE = true,
1888 SWING_DAMAGE = true, 1898 SWING_DAMAGE = true,
1889 } 1899 }
1890 1900
1891 1901
1892 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, ...) 1902 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, ...)
1903 if IS_BFA then
1904 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()
1905 end
1906
1893 local combat_log_func = COMBAT_LOG_FUNCS[sub_event] 1907 local combat_log_func = COMBAT_LOG_FUNCS[sub_event]
1894 1908
1895 if not combat_log_func then 1909 if not combat_log_func then
1896 if DAMAGE_EVENTS[sub_event] then 1910 if DAMAGE_EVENTS[sub_event] then
1897 table.wipe(previous_combat_event) 1911 table.wipe(previous_combat_event)
1901 previous_combat_event.party_damage = true 1915 previous_combat_event.party_damage = true
1902 end 1916 end
1903 end 1917 end
1904 return 1918 return
1905 end 1919 end
1906 combat_log_func(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, ...) 1920 combat_log_func(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id)
1907 1921
1908 if NON_DAMAGE_EVENTS[sub_event] then 1922 if NON_DAMAGE_EVENTS[sub_event] then
1909 table.wipe(previous_combat_event) 1923 table.wipe(previous_combat_event)
1910 end 1924 end
1911 end 1925 end