Johnny C. Lam [10-12-12 - 00:46]
diff --git a/Ovale.lua b/Ovale.lua
index 43ec48d..f78b662 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -13,6 +13,10 @@ Ovale = LibStub("AceAddon-3.0"):NewAddon("Ovale", "AceEvent-3.0", "AceConsole-3.
local L = LibStub("AceLocale-3.0"):GetLocale("Ovale")
local Recount = Recount
local Skada = Skada
+
+local pairs, strsplit = pairs, string.split
+local SendAddonMessage, UnitAura, UnitCanAttack = SendAddonMessage, UnitAura, UnitCanAttack
+local UnitExists, UnitInVehicle, UnitIsDead = UnitExists, UnitInVehicle, UnitIsDead
--</private-static-properties>
--<public-static-properties>
diff --git a/OvaleActionBar.lua b/OvaleActionBar.lua
index 1a89b83..4a6bfde 100644
--- a/OvaleActionBar.lua
+++ b/OvaleActionBar.lua
@@ -10,6 +10,10 @@
-- Keep data about the player action bars (key bindings mostly)
OvaleActionBar = LibStub("AceAddon-3.0"):NewAddon("OvaleActionBar", "AceEvent-3.0")
+--<private-static-properties>
+local GetActionInfo, GetActionText = GetActionInfo, GetActionText
+--</private-static-properties>
+
--<public-static-properties>
--key: spell name / value: action icon id
OvaleActionBar.actionSort = {}
diff --git a/OvaleAura.lua b/OvaleAura.lua
index 0c28f0d..188b2ec 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -24,6 +24,9 @@ OvaleAura.playerGUID = nil
--<private-static-properties>
local baseDamageMultiplier = 1
+
+local pairs, select, strfind = pairs, select, string.find
+local GetSpecialization, GetShapeshiftForm, UnitAura = GetSpecialization, GetShapeshiftForm, UnitAura
--</private-static-properties>
-- Events
@@ -52,7 +55,7 @@ end
function OvaleAura:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
local time, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = select(1, ...)
- if string.find(event, "SPELL_AURA_") == 1 then
+ if strfind(event, "SPELL_AURA_") == 1 then
local spellId, spellName, spellSchool, auraType = select(12, ...)
local unitId = OvaleGUID:GetUnitId(destGUID)
diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua
index a10b785..e751faf 100644
--- a/OvaleBestAction.lua
+++ b/OvaleBestAction.lua
@@ -10,7 +10,12 @@
OvaleBestAction = {}
--<private-static-properties>
-local tostring = tostring
+local floor, ipairs, loadstring, pairs = math.floor, ipairs, loadstring, pairs
+local strfind, tonumber, tostring = string.find, tonumber, tostring
+local GetActionCooldown, GetActionTexture, GetInventorySlotInfo = GetActionCooldown, GetActionTexture, GetInventorySlotInfo
+local GetItemIcon, GetItemCooldown, GetItemSpell, GetSpellInfo = GetItemIcon, GetItemCooldown, GetItemSpell, GetSpellInfo
+local GetSpellTexture, IsActionInRange, IsCurrentAction = GetSpellTexture, IsActionInRange, IsCurrentAction
+local IsItemInRange, IsSpellInRange, IsUsableAction, IsUsableSpell = IsItemInRange, IsSpellInRange, IsUsableAction, IsUsableSpell
--</private-static-properties>
--<private-static-methods>
@@ -141,7 +146,7 @@ function OvaleBestAction:GetActionInfo(element)
if (type(element.params[1]) == "number") then
itemId = element.params[1]
else
- local _,_,id = string.find(GetInventoryItemLink("player",GetInventorySlotInfo(element.params[1])) or "","item:(%d+):%d+:%d+:%d+")
+ local _,_,id = strfind(GetInventoryItemLink("player",GetInventorySlotInfo(element.params[1])) or "","item:(%d+):%d+:%d+:%d+")
if not id then
return nil
end
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 17be368..896e5f3 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -16,6 +16,11 @@ local node={}
local defines = {}
local customFunctions = {}
local unknownSpellNodes = {}
+
+local ipairs, pairs, tonumber = ipairs, pairs, tonumber
+local strfind, strgmatch, strgsub = string.find, string.gmatch, string.gsub
+local strlen, strlower, strmatch, strsub = string.len, string.lower, string.match, string.sub
+local GetGlyphSocketInfo, GetNumGlyphSockets, GetSpecialization = GetGlyphSocketInfo, GetNumGlyphSockets, GetSpecialization
--</private-static-properties>
--<private-static-methods>
@@ -30,19 +35,19 @@ local function ParseParameters(params)
if not params then
return paramList
end
- for k,v in string.gmatch(params, "([%w_]+)=([-%w\\_%.]+)") do
- if (string.match(v,"^%-?%d+%.?%d*$")) then
+ for k,v in strgmatch(params, "([%w_]+)=([-%w\\_%.]+)") do
+ if (strmatch(v,"^%-?%d+%.?%d*$")) then
v = tonumber(v)
end
- if (string.match(k,"^%-?%d+%.?%d*$")) then
+ if (strmatch(k,"^%-?%d+%.?%d*$")) then
k = tonumber(k)
end
paramList[k] = v
end
- params = string.gsub(params,"[%w_]+=[-%w\\_%.]+","")
+ params = strgsub(params,"[%w_]+=[-%w\\_%.]+","")
local n=0
- for w in string.gmatch(params, "[-%w_\\%.]+") do
- if (string.match(w,"^%-?%d+%.?%d*$")) then
+ for w in strgmatch(params, "[-%w_\\%.]+") do
+ if (strmatch(w,"^%-?%d+%.?%d*$")) then
w = tonumber(w)
end
paramList[n+1] = w
@@ -151,9 +156,9 @@ local function ParseFunction(prefix, func, params)
end
if not paramList.target then
- if string.find(func, "Target") == 1 then
+ if strfind(func, "Target") == 1 then
paramList.target = "target"
- func = string.sub(func, 7)
+ func = strsub(func, 7)
end
end
@@ -161,7 +166,7 @@ local function ParseFunction(prefix, func, params)
return customFunctions[func]
end
- func = string.lower(func)
+ func = strlower(func)
local newNode = { type="function", func=func, params=paramList}
local newNodeName = AddNode(newNode)
@@ -257,7 +262,7 @@ local function ParseSpellInfo(params)
end
local function ParseScoreSpells(params)
- for v in string.gmatch(params, "(%d+)") do
+ for v in strgmatch(params, "(%d+)") do
local spellId = tonumber(v)
if spellId then
--Ovale:Print("Add spell to score "..spellId)
@@ -271,7 +276,7 @@ end
local function ParseSpellList(name, params)
OvaleData.buffSpellList[name] = {}
local i = 1
- for v in string.gmatch(params, "(%d+)") do
+ for v in strgmatch(params, "(%d+)") do
OvaleData.buffSpellList[name][i] = tonumber(v)
i = i + 1
end
@@ -335,13 +340,13 @@ end
local function ParseGroup(text)
local nodes={}
- for w in string.gmatch(text, "node(%d+)") do
+ for w in strgmatch(text, "node(%d+)") do
nodes[#nodes+1] = node[tonumber(w)]
end
- text = string.gsub(text, "node%d+", "")
+ text = strgsub(text, "node%d+", "")
- if (string.match(text,"[^ ]")) then
+ if (strmatch(text,"[^ ]")) then
Ovale:Print("syntax error:"..text)
return nil
end
@@ -353,7 +358,7 @@ end
local function subtest(text, pattern, func)
while (1==1) do
local was = text
- text = string.gsub(text, pattern, func)
+ text = strgsub(text, pattern, func)
if (was == text) then
break
end
@@ -399,21 +404,21 @@ local function ParseDefine(key, value)
end
local function ParseLua(text)
- local newNode = {type="lua", lua = string.sub(text, 2, string.len(text)-1)}
+ local newNode = {type="lua", lua = strsub(text, 2, strlen(text)-1)}
return AddNode(newNode)
end
local function ParseCommands(text)
local original = text
- text = string.gsub(text,"(%b[])", ParseLua)
+ text = strgsub(text,"(%b[])", ParseLua)
while (1==1) do
local was = text
- text = string.gsub(text, "(%w+)%.?(%w*)%s*%((.-)%)", ParseFunction)
- text = string.gsub(text, "(%d+%.?%d*)s", ParseTime)
- text = string.gsub(text, "([^%w])(%d+%.?%d*)", ParseNumber)
- text = string.gsub(text, "node(%d+)%s*([%*%/%%])%s*node(%d+)", ParseOp)
- text = string.gsub(text, "node(%d+)%s*([%+%-])%s*node(%d+)", ParseOp)
- text = string.gsub(text, "{([node%d ]*)}", ParseGroup)
+ text = strgsub(text, "(%w+)%.?(%w*)%s*%((.-)%)", ParseFunction)
+ text = strgsub(text, "(%d+%.?%d*)s", ParseTime)
+ text = strgsub(text, "([^%w])(%d+%.?%d*)", ParseNumber)
+ text = strgsub(text, "node(%d+)%s*([%*%/%%])%s*node(%d+)", ParseOp)
+ text = strgsub(text, "node(%d+)%s*([%+%-])%s*node(%d+)", ParseOp)
+ text = strgsub(text, "{([node%d ]*)}", ParseGroup)
if was == text then
break
end
@@ -421,9 +426,9 @@ local function ParseCommands(text)
while (1==1) do
local was = text
- text = string.gsub(text, "node(%d+)%s*([%>%<]=?)%s*node(%d+)", ParseOp)
- text = string.gsub(text, "node(%d+)%s*(==)%s*node(%d+)", ParseOp)
- text = string.gsub(text, "{([node%d ]*)}", ParseGroup)
+ text = strgsub(text, "node(%d+)%s*([%>%<]=?)%s*node(%d+)", ParseOp)
+ text = strgsub(text, "node(%d+)%s*(==)%s*node(%d+)", ParseOp)
+ text = strgsub(text, "{([node%d ]*)}", ParseGroup)
if was == text then
break
end
@@ -431,15 +436,15 @@ local function ParseCommands(text)
while (1==1) do
local was = text
- text = string.gsub(text, "not%s+node(%d+)", ParseNot)
- text = string.gsub(text, "between%s+node(%d+)%s+and%s+node(%d+)", ParseBetween)
- text = string.gsub(text, "from%s+node(%d+)%s+until%s+node(%d+)", ParseFromUntil)
- text = string.gsub(text, "(more)%s+than%s+node(%d+)%s+node(%d+)", ParseCompare)
- text = string.gsub(text, "(less)%s+than%s+node(%d+)%s+node(%d+)", ParseCompare)
- text = string.gsub(text, "(at least)%s+node(%d+)%s+node(%d+)", ParseCompare)
- text = string.gsub(text, "(at most)%s+node(%d+)%s+node(%d+)", ParseCompare)
- text = string.gsub(text, "node(%d+)%s+before%s+node(%d+)", ParseBefore)
- text = string.gsub(text, "node(%d+)%s+after%s+node(%d+)", ParseAfter)
+ text = strgsub(text, "not%s+node(%d+)", ParseNot)
+ text = strgsub(text, "between%s+node(%d+)%s+and%s+node(%d+)", ParseBetween)
+ text = strgsub(text, "from%s+node(%d+)%s+until%s+node(%d+)", ParseFromUntil)
+ text = strgsub(text, "(more)%s+than%s+node(%d+)%s+node(%d+)", ParseCompare)
+ text = strgsub(text, "(less)%s+than%s+node(%d+)%s+node(%d+)", ParseCompare)
+ text = strgsub(text, "(at least)%s+node(%d+)%s+node(%d+)", ParseCompare)
+ text = strgsub(text, "(at most)%s+node(%d+)%s+node(%d+)", ParseCompare)
+ text = strgsub(text, "node(%d+)%s+before%s+node(%d+)", ParseBefore)
+ text = strgsub(text, "node(%d+)%s+after%s+node(%d+)", ParseAfter)
if (was == text) then
break
end
@@ -447,13 +452,13 @@ local function ParseCommands(text)
while (1==1) do
local was = text
- text = string.gsub(text, "not%s+node(%d+)", ParseNot)
- text = string.gsub(text, "node(%d+)%s*([%*%+%-%/%>%<]=?|==)%s*node(%d+)", ParseOp)
- text = string.gsub(text, "node(%d+)%s+and%s+node(%d+)", ParseAnd)
- text = string.gsub(text, "node(%d+)%s+or%s+node(%d+)", ParseOr)
- text = string.gsub(text, "if%s+node(%d+)%s+node(%d+)",ParseIf)
- text = string.gsub(text, "unless%s+node(%d+)%s+node(%d+)",ParseUnless)
- text = string.gsub(text, "{([node%d ]*)}", ParseGroup)
+ text = strgsub(text, "not%s+node(%d+)", ParseNot)
+ text = strgsub(text, "node(%d+)%s*([%*%+%-%/%>%<]=?|==)%s*node(%d+)", ParseOp)
+ text = strgsub(text, "node(%d+)%s+and%s+node(%d+)", ParseAnd)
+ text = strgsub(text, "node(%d+)%s+or%s+node(%d+)", ParseOr)
+ text = strgsub(text, "if%s+node(%d+)%s+node(%d+)",ParseIf)
+ text = strgsub(text, "unless%s+node(%d+)%s+node(%d+)",ParseUnless)
+ text = strgsub(text, "{([node%d ]*)}", ParseGroup)
if (was == text) then
break
end
@@ -462,7 +467,7 @@ local function ParseCommands(text)
local masterNode
if (text) then
- masterNode = string.match(text, "node(%d+)")
+ masterNode = strmatch(text, "node(%d+)")
end
if (not masterNode) then
Ovale:Print("no master node")
@@ -470,8 +475,8 @@ local function ParseCommands(text)
end
-- Si il reste autre chose que des espaces, c'est une erreur de syntaxe
- text = string.gsub(text, "node%d+", "", 1)
- if (string.match(text,"[^ ]")) then
+ text = strgsub(text, "node%d+", "", 1)
+ if (strmatch(text,"[^ ]")) then
Ovale:Print("Group:"..original)
Ovale:Print("syntax error:"..text)
return nil
@@ -522,8 +527,8 @@ function OvaleCompile:CompileInputs(text)
Ovale.casesACocher = {}
Ovale.listes = {}
- text = string.gsub(text, "AddListItem%s*%(%s*([%w_]+)%s+([%w_]+)%s+\"(.-)\"%s*(.-)%s*%)", ParseAddListItem)
- text = string.gsub(text, "AddCheckBox%s*%(%s*([%w_]+)%s+\"(.-)\"%s*(.-)%s*%)", ParseAddCheckBox)
+ text = strgsub(text, "AddListItem%s*%(%s*([%w_]+)%s+([%w_]+)%s+\"(.-)\"%s*(.-)%s*%)", ParseAddListItem)
+ text = strgsub(text, "AddCheckBox%s*%(%s*([%w_]+)%s+\"(.-)\"%s*(.-)%s*%)", ParseAddCheckBox)
return text
end
@@ -535,11 +540,11 @@ function OvaleCompile:Compile(text)
unknownSpellNodes = {}
-- Suppression des commentaires
- text = string.gsub(text, "#.-\n","")
- text = string.gsub(text, "#.*$","")
+ text = strgsub(text, "#.-\n","")
+ text = strgsub(text, "#.*$","")
-- Define(CONSTANTE valeur)
- text = string.gsub(text, "Define%s*%(%s*([%w_]+)%s+(%w+)%s*%)", ParseDefine)
+ text = strgsub(text, "Define%s*%(%s*([%w_]+)%s+(%w+)%s*%)", ParseDefine)
-- On remplace les constantes par leur valeur
for k,v in pairs(defines) do
@@ -547,29 +552,29 @@ function OvaleCompile:Compile(text)
end
-- Fonctions
- text = string.gsub(text, "SpellName%s*%(%s*(%w+)%s*%)", ParseSpellName)
- text = string.gsub(text, "L%s*%(%s*(%w+)%s*%)", ParseL)
+ text = strgsub(text, "SpellName%s*%(%s*(%w+)%s*%)", ParseSpellName)
+ text = strgsub(text, "L%s*%(%s*(%w+)%s*%)", ParseL)
-- Options diverses
OvaleData:ResetSpellInfo()
- text = string.gsub(text, "CanStopChannelling%s*%(%s*(%w+)%s*%)", ParseCanStopChannelling)
- text = string.gsub(text, "SpellAddBuff%s*%((.-)%)", ParseSpellAddBuff)
- text = string.gsub(text, "SpellAddDebuff%s*%((.-)%)", ParseSpellAddDebuff)
- text = string.gsub(text, "SpellAddTargetDebuff%s*%((.-)%)", ParseSpellAddTargetDebuff)
- text = string.gsub(text, "SpellDamageBuff%s*%((.-)%)", ParseSpellDamageBuff)
- text = string.gsub(text, "SpellDamageDebuff%s*%((.-)%)", ParseSpellDamageDebuff)
- text = string.gsub(text, "SpellInfo%s*%((.-)%)", ParseSpellInfo)
- text = string.gsub(text, "ScoreSpells%s*%((.-)%)", ParseScoreSpells)
- text = string.gsub(text, "SpellList%s*%(%s*([%w_]+)%s*(.-)%)", ParseSpellList)
+ text = strgsub(text, "CanStopChannelling%s*%(%s*(%w+)%s*%)", ParseCanStopChannelling)
+ text = strgsub(text, "SpellAddBuff%s*%((.-)%)", ParseSpellAddBuff)
+ text = strgsub(text, "SpellAddDebuff%s*%((.-)%)", ParseSpellAddDebuff)
+ text = strgsub(text, "SpellAddTargetDebuff%s*%((.-)%)", ParseSpellAddTargetDebuff)
+ text = strgsub(text, "SpellDamageBuff%s*%((.-)%)", ParseSpellDamageBuff)
+ text = strgsub(text, "SpellDamageDebuff%s*%((.-)%)", ParseSpellDamageDebuff)
+ text = strgsub(text, "SpellInfo%s*%((.-)%)", ParseSpellInfo)
+ text = strgsub(text, "ScoreSpells%s*%((.-)%)", ParseScoreSpells)
+ text = strgsub(text, "SpellList%s*%(%s*([%w_]+)%s*(.-)%)", ParseSpellList)
-- On vire les espaces en trop
- text = string.gsub(text, "\n", " ")
- text = string.gsub(text, "%s+", " ")
+ text = strgsub(text, "\n", " ")
+ text = strgsub(text, "%s+", " ")
-- On compile les AddCheckBox et AddListItem
text = self:CompileInputs(text)
- for p,t in string.gmatch(text, "AddFunction%s+(%w+)%s*(%b{})") do
+ for p,t in strgmatch(text, "AddFunction%s+(%w+)%s*(%b{})") do
local newNode = ParseCommands(t)
if newNode then
customFunctions[p] = "node"..newNode
@@ -579,14 +584,14 @@ function OvaleCompile:Compile(text)
local masterNodes ={}
-- On compile les AddIcon
- for p,t in string.gmatch(text, "AddActionIcon%s*(.-)%s*(%b{})") do
+ for p,t in strgmatch(text, "AddActionIcon%s*(.-)%s*(%b{})") do
local newNode = ParseAddIcon(p,t,true)
if newNode then
masterNodes[#masterNodes+1] = newNode
end
end
- for p,t in string.gmatch(text, "AddIcon%s*(.-)%s*(%b{})") do
+ for p,t in strgmatch(text, "AddIcon%s*(.-)%s*(%b{})") do
local newNode = ParseAddIcon(p,t)
if newNode then
masterNodes[#masterNodes+1] = newNode
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 61f3261..c318598 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -42,7 +42,20 @@ local savedHealth = {}
local targetGUID = {}
local lastSPD = {}
-local tostring = tostring
+local floor, pairs, select, strfind, tostring = math.floor, pairs, select, string.find, tostring
+local GetGlyphSocketInfo, GetInventoryItemID, GetInventoryItemLink = GetGlyphSocketInfo, GetInventoryItemID, GetInventoryItemLink
+local GetInventorySlotInfo, GetItemCooldown, GetItemCount = GetInventorySlotInfo, GetItemCooldown, GetItemCount
+local GetItemInfo, GetMasteryEffect, GetRune = GetItemInfo, GetMasteryEffect, GetRune
+local GetRuneCount, GetSpellBonusDamage, GetSpellCharges = GetRuneCount, GetSpellBonusDamage, GetSpellCharges
+local GetSpellInfo, GetTotemInfo, GetTrackingInfo = GetSpellInfo, GetTotemInfo, GetTrackingInfo
+local GetUnitSpeed, HasFullControl, IsSpellInRange = GetUnitSpeed, HasFullControl, IsSpellInRange
+local IsStealthed, IsUsableSpell, UnitAttackPower = IsStealthed, IsUsableSpell, UnitAttackPower
+local UnitCastingInfo, UnitChannelInfo, UnitClass = UnitCastingInfo, UnitChannelInfo, UnitClass
+local UnitClassification, UnitCreatureFamily, UnitCreatureType = UnitClassification, UnitCreatureFamily, UnitCreatureType
+local UnitDebuff, UnitDetailedThreatSituation, UnitExists = UnitDebuff, UnitDetailedThreatSituation, UnitExists
+local UnitHealth, UnitHealthMax, UnitIsDead = UnitHealth, UnitHealthMax, UnitIsDead
+local UnitIsFriend, UnitIsUnit, UnitLevel = UnitIsFriend, UnitIsUnit, UnitLevel
+local UnitPower, UnitPowerMax = UnitPower, UnitPowerMax
--</private-static-properties>
@@ -1051,7 +1064,7 @@ OvaleCondition.conditions=
-- returns: bool or number
eclipse = function(condition)
return compare(OvaleState.state.eclipse, condition[1], condition[2])
- end
+ end,
eclipsedir = function(condition)
return compare(OvaleState:GetEclipseDir(), condition[1], condition[2])
@@ -1219,7 +1232,7 @@ OvaleCondition.conditions=
-- if HasShield() Spell(shield_wall)
hasshield = function(condition)
- local _,_,id = string.find(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")) or "","(item:%d+:%d+:%d+:%d+)")
+ local _,_,id = strfind(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")) or "","(item:%d+:%d+:%d+:%d+)")
if (not id) then
return testbool(false, condition[1])
end
diff --git a/OvaleData.lua b/OvaleData.lua
index 0c145b9..8398807 100644
--- a/OvaleData.lua
+++ b/OvaleData.lua
@@ -9,6 +9,14 @@
OvaleData = LibStub("AceAddon-3.0"):NewAddon("OvaleData", "AceEvent-3.0")
+--<private-static-properties>
+local pairs, tonumber = pairs, tonumber
+local GetShapeshiftForm, GetSpellBookItemInfo, GetSpellBookItemName = GetShapeshiftForm, GetSpellBookItemInfo, GetSpellBookItemName
+local GetSpellInfo, GetSpellTabInfo, GetTalentInfo = GetSpellInfo, GetSpellTabInfo, GetTalentInfo
+local HasPetSpells, UnitBuff, UnitClass = HasPetSpells, UnitBuff, UnitClass
+local BOOKTYPE_SPELL, BOOKTYPE_PET = BOOKTYPE_SPELL, BOOKTYPE_PET
+--</private-static-properties>
+
--<public-static-properties>
OvaleData.spellList = {}
OvaleData.firstInit = false
diff --git a/OvaleEnemies.lua b/OvaleEnemies.lua
index 48cd617..0bb9162 100644
--- a/OvaleEnemies.lua
+++ b/OvaleEnemies.lua
@@ -11,6 +11,12 @@
OvaleEnemies = LibStub("AceAddon-3.0"):NewAddon("OvaleEnemies", "AceEvent-3.0")
+--<private-static-properties>
+local bit_band, pairs, select = bit.band, pairs, select
+local COMBATLOG_OBJECT_AFFILIATION_OUTSIDER = COMBATLOG_OBJECT_AFFILIATION_OUTSIDER
+local COMBATLOG_OBJECT_REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE
+--</private-static-properties>
+
--<public-static-properties>
OvaleEnemies.numberOfEnemies = 0
OvaleEnemies.enemies = {}
@@ -40,16 +46,16 @@ function OvaleEnemies:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
--Ovale:Print("enemy die")
end
end
- elseif sourceFlags and not self.enemies[sourceGUID] and bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE)>0
- and bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) > 0 and
- destFlags and bit.band(destFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0 then
+ elseif sourceFlags and not self.enemies[sourceGUID] and bit_band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE)>0
+ and bit_band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) > 0 and
+ destFlags and bit_band(destFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0 then
self.enemies[sourceGUID] = true
--Ovale:Print("new ennemy source=".. sourceName)
self.numberOfEnemies = self.numberOfEnemies + 1
Ovale.refreshNeeded["player"] = true
- elseif destGUID and not self.enemies[destGUID] and bit.band(destFlags, COMBATLOG_OBJECT_REACTION_HOSTILE)>0
- and bit.band(destFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) > 0 and
- sourceFlags and bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0 then
+ elseif destGUID and not self.enemies[destGUID] and bit_band(destFlags, COMBATLOG_OBJECT_REACTION_HOSTILE)>0
+ and bit_band(destFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) > 0 and
+ sourceFlags and bit_band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0 then
self.enemies[destGUID] = true
--Ovale:Print("new ennemy dest=".. destName)
self.numberOfEnemies = self.numberOfEnemies + 1
diff --git a/OvaleEquipement.lua b/OvaleEquipement.lua
index 5efedce..42d0d1f 100644
--- a/OvaleEquipement.lua
+++ b/OvaleEquipement.lua
@@ -9,6 +9,11 @@
OvaleEquipement = LibStub("AceAddon-3.0"):NewAddon("OvaleEquipement", "AceEvent-3.0")
+--<private-static-properties>
+local strfind, tonumber = string.find, tonumber
+local GetInventoryItemLink = GetInventoryItemLink
+--</private-static-properties>
+
--<public-static-properties>
OvaleEquipement.nombre = {}
--</public-static-properties>
@@ -28,7 +33,7 @@ end
function OvaleEquipement:GetItemId(slot)
local link = GetInventoryItemLink("player", GetInventorySlotInfo(slot))
if not link then return nil end
- local a, b, itemId = string.find(link, "item:(%d+)");
+ local a, b, itemId = strfind(link, "item:(%d+)");
return tonumber(itemId);
end
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index c3b3a71..c79ec20 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -16,6 +16,9 @@ do
local Type = "OvaleFrame"
local Version = 7
+
+ local pairs = pairs
+ local CreateFrame, GetSpellInfo = CreateFrame, GetSpellInfo
--</private-static-properties>
--<public-methods>
diff --git a/OvaleFuture.lua b/OvaleFuture.lua
index cf791c1..9c67dd3 100644
--- a/OvaleFuture.lua
+++ b/OvaleFuture.lua
@@ -11,6 +11,13 @@
OvaleFuture = LibStub("AceAddon-3.0"):NewAddon("OvaleFuture", "AceEvent-3.0")
+--<private-static-properties>
+local ipairs, pairs, strfind, tremove = ipairs, pairs, string.find, table.remove
+local GetComboPoints, GetMasteryEffect, GetSpellBonusDamage = GetComboPoints, GetMasteryEffect, GetSpellBonusDamage
+local GetSpellInfo, UnitAttackPower, UnitBuff = GetSpellInfo, UnitAttackPower, UnitBuff
+local UnitGUID = UnitGUID
+--</private-static-properties>
+
--<public-static-properties>
--spell counter (see Counter function)
OvaleFuture.counter = {}
@@ -169,7 +176,7 @@ function OvaleFuture:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
--Do not use SPELL_CAST_SUCCESS because it is sent when the missile has not reached the target
--Ovale:Print("SPELL_CAST_START " .. GetTime())
- --if string.find(event, "SPELL") == 1 then
+ --if strfind(event, "SPELL") == 1 then
-- local spellId, spellName = select(12, ...)
-- Ovale:Print(event .. " " ..spellName .. " " ..GetTime())
--end
@@ -180,18 +187,18 @@ function OvaleFuture:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
--end
if
- string.find(event, "SPELL_AURA_APPLIED")==1
- or string.find(event, "SPELL_AURA_REFRESH")==1
- or string.find(event, "SPELL_DAMAGE")==1
- or string.find(event, "SPELL_MISSED") == 1
- or string.find(event, "SPELL_CAST_SUCCESS") == 1
- or string.find(event, "SPELL_CAST_FAILED") == 1 then
+ strfind(event, "SPELL_AURA_APPLIED")==1
+ or strfind(event, "SPELL_AURA_REFRESH")==1
+ or strfind(event, "SPELL_DAMAGE")==1
+ or strfind(event, "SPELL_MISSED") == 1
+ or strfind(event, "SPELL_CAST_SUCCESS") == 1
+ or strfind(event, "SPELL_CAST_FAILED") == 1 then
local spellId, spellName = select(12, ...)
for i,v in ipairs(self.lastSpell) do
if (v.spellId == spellId or v.auraSpellId == spellId) and v.allowRemove then
if not v.channeled and (v.removeOnSuccess or
- string.find(event, "SPELL_CAST_SUCCESS") ~= 1) then
- table.remove(self.lastSpell, i)
+ strfind(event, "SPELL_CAST_SUCCESS") ~= 1) then
+ tremove(self.lastSpell, i)
Ovale.refreshNeeded["player"] = true
--Ovale:Print("LOG_EVENT on supprime "..spellId.." a "..GetTime())
end
@@ -300,7 +307,7 @@ end
function OvaleFuture:RemoveSpellFromList(spellId, lineId)
for i,v in ipairs(self.lastSpell) do
if v.lineId == lineId then
- table.remove(self.lastSpell, i)
+ tremove(self.lastSpell, i)
--Ovale:Print("RemoveSpellFromList on supprime "..spellId)
break
end
@@ -323,7 +330,7 @@ function OvaleFuture:Apply()
OvaleState:AddSpellToStack(v.spellId, v.start, v.stop, v.stop, v.nocd, v.target)
else
--Ovale:Print("Removing obsolete "..v.spellId)
- table.remove(self.lastSpell, i)
+ tremove(self.lastSpell, i)
end
end
end
diff --git a/OvaleGUID.lua b/OvaleGUID.lua
index cd25d80..b562940 100644
--- a/OvaleGUID.lua
+++ b/OvaleGUID.lua
@@ -12,6 +12,11 @@
OvaleGUID = LibStub("AceAddon-3.0"):NewAddon("OvaleGUID", "AceEvent-3.0", "AceConsole-3.0")
+--<private-static-properties>
+local strfind, strsub = string.find, string.sub
+local GetNumGroupMembers, UnitGUID, UnitName = GetNumGroupMembers, UnitGUID, UnitName
+--</private-static-properties>
+
--<public-static-properties>
OvaleGUID.unitId = {}
OvaleGUID.guid = {}
@@ -101,11 +106,11 @@ function OvaleGUID:GROUP_ROSTER_UPDATE(event)
end
function OvaleGUID:UNIT_PET(event, unitId)
- if string.find(unitId, "party") == 0 then
- local petId = "partypet" .. string.sub(unitId, 6)
+ if strfind(unitId, "party") == 0 then
+ local petId = "partypet" .. strsub(unitId, 6)
self:UpdateWithTarget(petId)
- elseif string.find(unitId, "raid") == 0 then
- local petId = "raidpet" .. string.sub(unitId, 5)
+ elseif strfind(unitId, "raid") == 0 then
+ local petId = "raidpet" .. strsub(unitId, 5)
self:UpdateWithTarget(petId)
elseif unitId == "player" then
self:UpdateWithTarget("pet")
diff --git a/OvaleIcone.lua b/OvaleIcone.lua
index 277e7ee..380923c 100644
--- a/OvaleIcone.lua
+++ b/OvaleIcone.lua
@@ -11,6 +11,10 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Ovale")
--inherits ActionButtonTemplate
+--<private-static-properties>
+local strfind, strformat, strsub = string.find, string.format, string.sub
+--</private-static-properties>
+
--<public-methods>
local function SetValue(self, value, actionTexture)
self.icone:Show()
@@ -22,9 +26,9 @@ local function SetValue(self, value, actionTexture)
self.shortcut:Hide()
if value then
if value<10 then
- value = string.format("%.1f", value)
+ value = strformat("%.1f", value)
else
- value = string.format("%d", value)
+ value = strformat("%d", value)
end
self.remains:SetText(value)
else
@@ -122,7 +126,7 @@ local function Update(self, element, minAttente, actionTexture, actionInRange, a
-- Le temps restant
if ((OvaleOptions:GetApparence().numeric or self.params.text == "always") and minAttente > OvaleState.maintenant) then
- self.remains:SetText(string.format("%.1f", minAttente - OvaleState.maintenant))
+ self.remains:SetText(strformat("%.1f", minAttente - OvaleState.maintenant))
self.remains:Show()
else
self.remains:Hide()
@@ -186,10 +190,10 @@ local function SetParams(self, params, secure)
self.actionButton = false
if secure then
for k,v in pairs(params) do
- local f = string.find(k, "spell")
+ local f = strfind(k, "spell")
if f then
- local prefix = string.sub(k, 1, f-1)
- local suffix = string.sub(k, f + 5)
+ local prefix = strsub(k, 1, f-1)
+ local suffix = strsub(k, f + 5)
local param
Ovale:Print(prefix.."type"..suffix)
self:SetAttribute(prefix.."type"..suffix, "spell")
diff --git a/OvaleOptions.lua b/OvaleOptions.lua
index 699be2a..a81764e 100644
--- a/OvaleOptions.lua
+++ b/OvaleOptions.lua
@@ -11,6 +11,10 @@
OvaleOptions = LibStub("AceAddon-3.0"):NewAddon("OvaleOptions", "AceEvent-3.0", "AceConsole-3.0")
+--<private-static-properties>
+local strgsub = string.gsub
+--</private-static-properties>
+
--<public-static-properties>
OvaleOptions.firstInit = false
OvaleOptions.db = nil
@@ -278,7 +282,7 @@ local options =
multiline = 15,
name = L["Code"],
get = function(info)
- return string.gsub(OvaleOptions.db.profile.code, "\t", " ")
+ return strgsub(OvaleOptions.db.profile.code, "\t", " ")
end,
set = function(info,v)
OvaleOptions.db.profile.code = v
diff --git a/OvaleSpellDamage.lua b/OvaleSpellDamage.lua
index d0b7a3a..208f6ac 100644
--- a/OvaleSpellDamage.lua
+++ b/OvaleSpellDamage.lua
@@ -11,6 +11,11 @@
OvaleSpellDamage = LibStub("AceAddon-3.0"):NewAddon("OvaleSpellDamage", "AceEvent-3.0")
+--<private-static-properties>
+local select, strfind = select, string.find
+local UnitGUID = UnitGUID
+--</private-static-properties>
+
--<public-static-properties>
OvaleSpellDamage.value = {}
OvaleSpellDamage.playerGUID = nil
@@ -31,7 +36,7 @@ function OvaleSpellDamage:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
local time, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = select(1, ...)
if sourceGUID == self.playerGUID then
- if string.find(event, "SPELL_PERIODIC_DAMAGE")==1 or string.find(event, "SPELL_DAMAGE")==1 then
+ if strfind(event, "SPELL_PERIODIC_DAMAGE")==1 or strfind(event, "SPELL_DAMAGE")==1 then
local spellId, spellName, spellSchool, amount = select(12, ...)
self.value[spellId] = amount
end
diff --git a/OvaleState.lua b/OvaleState.lua
index bc97ece..1dcea2c 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -34,8 +34,10 @@ OvaleState.lastSpellId = nil
--</public-static-properties>
--<private-static-properties>
-local UnitGUID = UnitGUID
-local tostring = tostring
+local floor, pairs, tostring = math.floor, pairs, tostring
+local GetComboPoints, GetRuneCooldown, GetRuneType = GetComboPoints, GetRuneCooldown, GetRuneType
+local GetSpellInfo, UnitGUID, UnitHealth = GetSpellInfo, UnitGUID, UnitHealth
+local UnitHealthMax, UnitPower, UnitPowerMax = UnitHealthMax, UnitPower, UnitPowerMax
--</private-static-properties>
--<public-static-methods>
diff --git a/OvaleSwing.lua b/OvaleSwing.lua
index 37b410a..329e257 100644
--- a/OvaleSwing.lua
+++ b/OvaleSwing.lua
@@ -42,11 +42,12 @@ local delayspells = {
}
local resetautoshotspells = {
}
-
local _, playerclass = UnitClass('player')
+
local unpack = unpack
local math_abs = math.abs
-local GetTime = GetTime
+local GetSpellInfo, GetTime, UnitAttackSpeed = GetSpellInfo, GetTime, UnitAttackSpeed
+local UnitDamage, UnitRangedDamage = UnitDamage, UnitRangedDamage
local BOOKTYPE_SPELL = BOOKTYPE_SPELL
--</private-static-properties>