From 45c8ac6dc61dabe0b1511752da002e5984df79bc Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 17 Nov 2013 16:30:59 +0000 Subject: [PATCH] Just call UnitGUID("player") if saving the value in a static property. No need to force a module dependency on OvaleGUID for one tiny thing that is already available at load time. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1196 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleDamageTaken.lua | 6 ++---- OvaleEclipse.lua | 6 ++---- OvaleFuture.lua | 8 +++----- OvaleScore.lua | 11 ++--------- OvaleSpellDamage.lua | 10 ++-------- OvaleSwing.lua | 15 +++------------ 6 files changed, 14 insertions(+), 42 deletions(-) diff --git a/OvaleDamageTaken.lua b/OvaleDamageTaken.lua index 17e347d..1eb0a26 100644 --- a/OvaleDamageTaken.lua +++ b/OvaleDamageTaken.lua @@ -18,14 +18,14 @@ local OvalePool = Ovale.OvalePool local OvaleQueue = Ovale.OvaleQueue -- Forward declarations for module dependencies. -local OvaleGUID = nil local OvaleLatency = nil local select = select local API_GetTime = GetTime +local API_UnitGUID = UnitGUID -- Player's GUID. -local self_guid = nil +local self_guid = API_UnitGUID("player") -- Damage event pool. local self_pool = OvalePool("OvaleDamageTaken_pool") -- Damage event queue: new events are inserted at the front of the queue. @@ -50,12 +50,10 @@ end -- function OvaleDamageTaken:OnInitialize() -- Resolve module dependencies. - OvaleGUID = Ovale.OvaleGUID OvaleLatency = Ovale.OvaleLatency end function OvaleDamageTaken:OnEnable() - self_guid = OvaleGUID:GetGUID("player") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("PLAYER_REGEN_ENABLED") end diff --git a/OvaleEclipse.lua b/OvaleEclipse.lua index 7c0edc0..651d778 100644 --- a/OvaleEclipse.lua +++ b/OvaleEclipse.lua @@ -18,18 +18,18 @@ Ovale.OvaleEclipse = OvaleEclipse -- -- Forward declarations for module dependencies. local OvaleData = nil -local OvaleGUID = nil local OvaleSpellBook = nil local OvaleState = nil local select = select local API_GetEclipseDirection = GetEclipseDirection local API_UnitClass = UnitClass +local API_UnitGUID = UnitGUID local API_UnitPower = UnitPower local SPELL_POWER_ECLIPSE = SPELL_POWER_ECLIPSE -- Player's GUID. -local self_guid = nil +local self_guid = API_UnitGUID("player") -- Player's class. local self_class = select(2, API_UnitClass("player")) @@ -50,14 +50,12 @@ OvaleEclipse.eclipseDirection = 0 function OvaleEclipse:OnInitialize() -- Resolve module dependencies. OvaleData = Ovale.OvaleData - OvaleGUID = Ovale.OvaleGUID OvaleSpellBook = Ovale.OvaleSpellBook OvaleState = Ovale.OvaleState end function OvaleEclipse:OnEnable() if self_class == "DRUID" then - self_guid = OvaleGUID:GetGUID("player") self:RegisterEvent("ECLIPSE_DIRECTION_CHANGE", "UpdateEclipseDirection") self:RegisterEvent("UNIT_POWER") self:RegisterEvent("UNIT_POWER_FREQUENT", "UNIT_POWER") diff --git a/OvaleFuture.lua b/OvaleFuture.lua index f2f7ac7..9466278 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 = nil +local self_guid = API_UnitGUID("player") -- The spells that the player is casting or has cast but are still in-flight toward their targets. local self_activeSpellcast = {} @@ -109,10 +109,9 @@ local function GetDamageMultiplier(spellId) if spellId then local si = OvaleData.spellInfo[spellId] if si and si.damageAura then - local playerGUID = OvaleGUID:GetGUID("player") for filter, auraList in pairs(si.damageAura) do for auraSpellId, multiplier in pairs(auraList) do - local aura = OvaleAura:GetAuraByGUID(playerGUID, auraSpellId, filter, nil, "player") + local aura = OvaleAura:GetAuraByGUID(self_guid, auraSpellId, filter, nil, "player") if aura and aura.stacks > 0 then local auraSpellInfo = OvaleData.spellInfo[auraSpellId] if auraSpellInfo.stacking and auraSpellInfo.stacking > 0 then @@ -271,7 +270,6 @@ function OvaleFuture:OnInitialize() end function OvaleFuture:OnEnable() - self_guid = OvaleGUID:GetGUID("player") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") @@ -465,7 +463,7 @@ function OvaleFuture:COMBAT_LOG_EVENT_UNFILTERED(event, ...) ]]-- -- Called when a missile reaches or misses its target - if sourceGUID == OvaleGUID:GetGUID("player") then + if sourceGUID == self_guid then if OVALE_CLEU_SPELLCAST_RESULTS[event] then local spellId, spellName = select(12, ...) TracePrintf(spellId, "%s: %s (%d)", event, spellName, spellId) diff --git a/OvaleScore.lua b/OvaleScore.lua index 2af313f..f92f372 100644 --- a/OvaleScore.lua +++ b/OvaleScore.lua @@ -34,15 +34,14 @@ Ovale.OvaleScore = OvaleScore -- -- Forward declarations for module dependencies. -local OvaleGUID = nil - local pairs = pairs local strsplit = string.split local API_RegisterAddonMessagePrefix = RegisterAddonMessagePrefix local API_SendAddonMessage = SendAddonMessage +local API_UnitGUID = UnitGUID -- Player's GUID. -local self_guid = nil +local self_guid = API_UnitGUID("player") -- self_damageMeter[moduleName] = module local self_damageMeter = {} -- self_damageMeterMethod[moduleName] = methodName or function @@ -59,13 +58,7 @@ local self_scoredSpell = {} -- -- -function OvaleScore:OnInitialize() - -- Resolve module dependencies. - OvaleGUID = Ovale.OvaleGUID -end - function OvaleScore:OnEnable() - self_guid = OvaleGUID:GetGUID("player") API_RegisterAddonMessagePrefix("Ovale") self:RegisterEvent("CHAT_MSG_ADDON") self:RegisterEvent("PLAYER_REGEN_ENABLED") diff --git a/OvaleSpellDamage.lua b/OvaleSpellDamage.lua index a486c47..05478f4 100644 --- a/OvaleSpellDamage.lua +++ b/OvaleSpellDamage.lua @@ -16,13 +16,12 @@ Ovale.OvaleSpellDamage = OvaleSpellDamage -- -- Forward declarations for module dependencies. -local OvaleGUID = nil - local select = select local strfind = string.find +local API_UnitGUID = UnitGUID -- Player's GUID. -local self_guid = nil +local self_guid = API_UnitGUID("player") -- -- @@ -30,12 +29,7 @@ OvaleSpellDamage.value = {} -- -- -function OvaleSpellDamage:OnInitialize() - OvaleGUID = Ovale.OvaleGUID -end - function OvaleSpellDamage:OnEnable() - self_guid = OvaleGUID:GetGUID("player") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") end diff --git a/OvaleSwing.lua b/OvaleSwing.lua index a125213..1551b5c 100644 --- a/OvaleSwing.lua +++ b/OvaleSwing.lua @@ -30,20 +30,18 @@ local OvaleSwing = Ovale:NewModule("OvaleSwing", "AceEvent-3.0") Ovale.OvaleSwing = OvaleSwing -- --- Forward declarations for module dependencies. -local OvaleGUID = nil - local math_abs = math.abs local unpack = unpack local API_GetSpellInfo = GetSpellInfo local API_GetTime = GetTime local API_IsDualWielding = IsDualWielding local API_UnitAttackSpeed = UnitAttackSpeed +local API_UnitGUID = UnitGUID local API_UnitRangedDamage = UnitRangedDamage local BOOKTYPE_SPELL = BOOKTYPE_SPELL -- Player's GUID. -local self_guid = nil +local self_guid = API_UnitGUID("player") local OVALE_AUTOSHOT_NAME = API_GetSpellInfo(75) local OVALE_RESET_SPELLS = {} @@ -66,14 +64,7 @@ OvaleSwing.swingmode = nil -- -- -function OvaleSwing:OnInitialize() - -- Resolve module dependencies. - OvaleGUID = Ovale.OvaleGUID -end - function OvaleSwing:OnEnable() - self_guid = OvaleGUID:GetGUID("player") - self.ohNext = false -- fired when autoattack is enabled/disabled. self:RegisterEvent("PLAYER_ENTER_COMBAT") @@ -116,7 +107,7 @@ function OvaleSwing:STOP_AUTOREPEAT_SPELL() end function OvaleSwing:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, eventName, srcGUID, srcName, srcFlags, dstName, dstGUID, dstFlags, ...) - if srcGUID == OvaleGUID:GetGUID("player") then + if srcGUID == self_guid then if eventName == "SWING_DAMAGE" or eventName == "SWING_MISSED" then local now = API_GetTime() self:MeleeSwing(now) -- 1.7.9.5