From 8d3d3b8633d0603f5088bbebbbaf8b91c4d436f0 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Tue, 26 Nov 2013 14:03:49 +0000 Subject: [PATCH] Back out part of r1196 and defer saving the player's GUID. The player's GUID is actually not available at load-time and must wait until more of the game is initialized before the information can be queried. Get the information during PLAYER_LOGIN time instead by adding it to the OnEnable() methods. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1198 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleAura.lua | 2 +- OvaleDamageTaken.lua | 3 ++- OvaleEclipse.lua | 3 ++- OvaleFuture.lua | 5 +++-- OvaleScore.lua | 4 ++-- OvaleSpellDamage.lua | 4 ++-- OvaleSwing.lua | 3 ++- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/OvaleAura.lua b/OvaleAura.lua index 03cdce4..52a5196 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -343,7 +343,7 @@ function OvaleAura:OnInitialize() end function OvaleAura:OnEnable() - self_guid = OvaleGUID:GetGUID("player") + self_guid = API_UnitGUID("player") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("UNIT_AURA") diff --git a/OvaleDamageTaken.lua b/OvaleDamageTaken.lua index 1eb0a26..e9eedbd 100644 --- a/OvaleDamageTaken.lua +++ b/OvaleDamageTaken.lua @@ -25,7 +25,7 @@ local API_GetTime = GetTime local API_UnitGUID = UnitGUID -- Player's GUID. -local self_guid = API_UnitGUID("player") +local self_guid = nil -- Damage event pool. local self_pool = OvalePool("OvaleDamageTaken_pool") -- Damage event queue: new events are inserted at the front of the queue. @@ -54,6 +54,7 @@ function OvaleDamageTaken:OnInitialize() end function OvaleDamageTaken:OnEnable() + self_guid = API_UnitGUID("player") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("PLAYER_REGEN_ENABLED") end diff --git a/OvaleEclipse.lua b/OvaleEclipse.lua index 651d778..bab7748 100644 --- a/OvaleEclipse.lua +++ b/OvaleEclipse.lua @@ -29,7 +29,7 @@ local API_UnitPower = UnitPower local SPELL_POWER_ECLIPSE = SPELL_POWER_ECLIPSE -- Player's GUID. -local self_guid = API_UnitGUID("player") +local self_guid = nil -- Player's class. local self_class = select(2, API_UnitClass("player")) @@ -55,6 +55,7 @@ function OvaleEclipse:OnInitialize() end function OvaleEclipse:OnEnable() + self_guid = API_UnitGUID("player") if self_class == "DRUID" then self:RegisterEvent("ECLIPSE_DIRECTION_CHANGE", "UpdateEclipseDirection") self:RegisterEvent("UNIT_POWER") diff --git a/OvaleFuture.lua b/OvaleFuture.lua index 9466278..f66edab 100644 --- a/OvaleFuture.lua +++ b/OvaleFuture.lua @@ -41,7 +41,7 @@ local API_UnitGUID = UnitGUID local API_UnitName = UnitName -- Player's GUID. -local self_guid = API_UnitGUID("player") +local self_guid = nil -- The spells that the player is casting or has cast but are still in-flight toward their targets. local self_activeSpellcast = {} @@ -270,6 +270,7 @@ function OvaleFuture:OnInitialize() end function OvaleFuture:OnEnable() + self_guid = API_UnitGUID("player") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") @@ -602,4 +603,4 @@ do local state = self return state.counter[id] and state.counter[id] or 0 end -end \ No newline at end of file +end diff --git a/OvaleScore.lua b/OvaleScore.lua index f92f372..8f31f2f 100644 --- a/OvaleScore.lua +++ b/OvaleScore.lua @@ -33,7 +33,6 @@ local OvaleScore = Ovale:NewModule("OvaleScore", "AceEvent-3.0") Ovale.OvaleScore = OvaleScore -- --- Forward declarations for module dependencies. local pairs = pairs local strsplit = string.split local API_RegisterAddonMessagePrefix = RegisterAddonMessagePrefix @@ -41,7 +40,7 @@ local API_SendAddonMessage = SendAddonMessage local API_UnitGUID = UnitGUID -- Player's GUID. -local self_guid = API_UnitGUID("player") +local self_guid = nil -- self_damageMeter[moduleName] = module local self_damageMeter = {} -- self_damageMeterMethod[moduleName] = methodName or function @@ -59,6 +58,7 @@ local self_scoredSpell = {} -- function OvaleScore:OnEnable() + self_guid = API_UnitGUID("player") API_RegisterAddonMessagePrefix("Ovale") self:RegisterEvent("CHAT_MSG_ADDON") self:RegisterEvent("PLAYER_REGEN_ENABLED") diff --git a/OvaleSpellDamage.lua b/OvaleSpellDamage.lua index 05478f4..3322416 100644 --- a/OvaleSpellDamage.lua +++ b/OvaleSpellDamage.lua @@ -15,13 +15,12 @@ local OvaleSpellDamage = Ovale:NewModule("OvaleSpellDamage", "AceEvent-3.0") Ovale.OvaleSpellDamage = OvaleSpellDamage -- --- Forward declarations for module dependencies. local select = select local strfind = string.find local API_UnitGUID = UnitGUID -- Player's GUID. -local self_guid = API_UnitGUID("player") +local self_guid = nil -- -- @@ -30,6 +29,7 @@ OvaleSpellDamage.value = {} -- function OvaleSpellDamage:OnEnable() + self_guid = API_UnitGUID("player") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") end diff --git a/OvaleSwing.lua b/OvaleSwing.lua index 1551b5c..36aca8c 100644 --- a/OvaleSwing.lua +++ b/OvaleSwing.lua @@ -41,7 +41,7 @@ local API_UnitRangedDamage = UnitRangedDamage local BOOKTYPE_SPELL = BOOKTYPE_SPELL -- Player's GUID. -local self_guid = API_UnitGUID("player") +local self_guid = nil local OVALE_AUTOSHOT_NAME = API_GetSpellInfo(75) local OVALE_RESET_SPELLS = {} @@ -65,6 +65,7 @@ OvaleSwing.swingmode = nil -- function OvaleSwing:OnEnable() + self_guid = API_UnitGUID("player") self.ohNext = false -- fired when autoattack is enabled/disabled. self:RegisterEvent("PLAYER_ENTER_COMBAT") -- 1.7.9.5