Change CyrHUD functions to use self
Sasky [03-23-15 - 07:36]
Change CyrHUD functions to use self
diff --git a/CyrHUD.lua b/CyrHUD.lua
index 3e1216c..f68c496 100644
--- a/CyrHUD.lua
+++ b/CyrHUD.lua
@@ -65,12 +65,13 @@ end
-- Events
----------------------------------------------
function CyrHUD.eventAttackChange(_, keepID, battlegroundContext, underAttack)
+ local self = CyrHUD
if underAttack then
- CyrHUD:add(keepID)
- elseif CyrHUD.battles[keepID] ~= nil then
- CyrHUD.battles[keepID]:update()
+ self:add(keepID)
+ elseif self.battles[keepID] ~= nil then
+ self.battles[keepID]:update()
end
- CyrHUD.battleContext = battlegroundContext
+ self.battleContext = battlegroundContext
end
function CyrHUD.saveWindowPosition( window )
@@ -114,22 +115,22 @@ end
----------------------------------------------
CyrHUD.battles = {}
function CyrHUD:add(keepID)
- if CyrHUD.battles[keepID] == nil then
- CyrHUD.battles[keepID] = CyrHUD.Battle(keepID)
+ if self.battles[keepID] == nil then
+ self.battles[keepID] = self.Battle(keepID)
else
- CyrHUD.battles[keepID]:restart()
+ self.battles[keepID]:restart()
end
end
function CyrHUD:checkAdd(keepID)
- if CyrHUD.battles[keepID] == nil then
- local battle = CyrHUD.Battle(keepID)
+ if self.battles[keepID] == nil then
+ local battle = self.Battle(keepID)
if battle:isBattle() then
d("Battle at " .. keepID)
- CyrHUD.battles[keepID] = battle
+ self.battles[keepID] = battle
end
- elseif CyrHUD.battles[keepID]:isBattle() then
- CyrHUD.battles[keepID]:restart()
+ elseif self.battles[keepID]:isBattle() then
+ self.battles[keepID]:restart()
end
end
@@ -142,11 +143,11 @@ end
function CyrHUD:scanKeeps()
for i=3,20 do
- CyrHUD:checkAdd(i)
+ self:checkAdd(i)
end
for i=132,134 do
- CyrHUD:checkAdd(i)
+ self:checkAdd(i)
end
end
@@ -172,7 +173,6 @@ function CyrHUD:init()
--Add events
EVENT_MANAGER:RegisterForUpdate("CyrHUDKeepCheck", 5000, function()
- d("CyrHUD 5s check")
self:scanKeeps()
self:updateAll()
end)