From 9c3cf8d3a3ec81f9155f6591b7ea31f923042e70 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sat, 2 Mar 2013 17:57:40 +0000 Subject: [PATCH] Convert all Ovale helper classes into Ace3 modules of Ovale addon. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@706 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Ovale.lua | 6 ++++-- OvaleActionBar.lua | 5 ++--- OvaleAura.lua | 3 ++- OvaleBestAction.lua | 1 + OvaleComboPoints.lua | 3 ++- OvaleCompile.lua | 4 ++-- OvaleCondition.lua | 2 +- OvaleData.lua | 5 ++--- OvaleEnemies.lua | 3 ++- OvaleEquipement.lua | 5 ++--- OvaleFrame.lua | 5 ++++- OvaleFuture.lua | 3 ++- OvaleGUID.lua | 3 ++- OvaleIcone.lua | 3 ++- OvaleOptions.lua | 3 ++- OvalePaperDoll.lua | 5 ++--- OvaleSpellDamage.lua | 3 ++- OvaleStance.lua | 5 ++--- OvaleState.lua | 1 + OvaleSwing.lua | 3 ++- compiler.pl | 11 +++++++++++ 21 files changed, 52 insertions(+), 30 deletions(-) diff --git a/Ovale.lua b/Ovale.lua index 49ee079..f8354d9 100644 --- a/Ovale.lua +++ b/Ovale.lua @@ -7,12 +7,13 @@ file accompanying this program. ----------------------------------------------------------------------]] -Ovale = LibStub("AceAddon-3.0"):NewAddon("Ovale", "AceEvent-3.0", "AceConsole-3.0") +local _, Ovale = ... +_G.Ovale = LibStub("AceAddon-3.0"):NewAddon(Ovale, "Ovale", "AceConsole-3.0", "AceEvent-3.0") -- -local L = LibStub("AceLocale-3.0"):GetLocale("Ovale") local Recount = Recount local Skada = Skada +local L = LibStub("AceLocale-3.0"):GetLocale("Ovale") local ipairs, pairs, strsplit, tinsert, tsort = ipairs, pairs, string.split, table.insert, table.sort local SendAddonMessage, UnitAura, UnitCanAttack = SendAddonMessage, UnitAura, UnitCanAttack @@ -20,6 +21,7 @@ local UnitExists, UnitHasVehicleUI, UnitIsDead = UnitExists, UnitHasVehicleUI, U -- -- +Ovale.L = L --Default scripts (see "defaut" directory) Ovale.defaut = {} --The table of check boxes definition diff --git a/OvaleActionBar.lua b/OvaleActionBar.lua index 0f932ef..088deed 100644 --- a/OvaleActionBar.lua +++ b/OvaleActionBar.lua @@ -8,11 +8,10 @@ ----------------------------------------------------------------------]] -- Keep data about the player action bars (key bindings mostly) -OvaleActionBar = LibStub("AceAddon-3.0"):NewAddon("OvaleActionBar", "AceEvent-3.0") +local _, Ovale = ... +OvaleActionBar = Ovale:NewModule("OvaleActionBar", "AceEvent-3.0") -- -local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") - local GetActionInfo = GetActionInfo local GetActionText = GetActionText local tonumber = tonumber diff --git a/OvaleAura.lua b/OvaleAura.lua index e241bee..72c4385 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -10,7 +10,8 @@ -- This addon keep the list of all the aura for all the units -- Fore each aura, it saves the state of the player when it was refreshed -OvaleAura = LibStub("AceAddon-3.0"):NewAddon("OvaleAura", "AceEvent-3.0") +local _, Ovale = ... +OvaleAura = Ovale:NewModule("OvaleAura", "AceEvent-3.0") -- OvaleAura.aura = {} diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua index 7dc55f1..311675a 100644 --- a/OvaleBestAction.lua +++ b/OvaleBestAction.lua @@ -7,6 +7,7 @@ file accompanying this program. ----------------------------------------------------------------------]] +local _, Ovale = ... OvaleBestAction = {} -- diff --git a/OvaleComboPoints.lua b/OvaleComboPoints.lua index 361e056..7193b72 100644 --- a/OvaleComboPoints.lua +++ b/OvaleComboPoints.lua @@ -9,7 +9,8 @@ -- This addon tracks the number of combo points by the player on the current target. -OvaleComboPoints = LibStub("AceAddon-3.0"):NewAddon("OvaleComboPoints", "AceEvent-3.0") +local _, Ovale = ... +OvaleComboPoints = Ovale:NewModule("OvaleComboPoints", "AceEvent-3.0") -- local strfind = string.find diff --git a/OvaleCompile.lua b/OvaleCompile.lua index 5a4290b..e8c26c2 100644 --- a/OvaleCompile.lua +++ b/OvaleCompile.lua @@ -7,11 +7,11 @@ file accompanying this program. ----------------------------------------------------------------------]] +local _, Ovale = ... OvaleCompile = {} -- -local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") -local L = LibStub("AceLocale-3.0"):GetLocale("Ovale") +local L = Ovale.L local node={} local defines = {} diff --git a/OvaleCondition.lua b/OvaleCondition.lua index b0c0ac0..7ff1d1a 100644 --- a/OvaleCondition.lua +++ b/OvaleCondition.lua @@ -7,10 +7,10 @@ file accompanying this program. ----------------------------------------------------------------------]] +local _, Ovale = ... OvaleCondition = {} -- - local LBCT = LibStub("LibBabble-CreatureType-3.0"):GetLookupTable() local LRC = LibStub("LibRangeCheck-2.0", true) diff --git a/OvaleData.lua b/OvaleData.lua index 5efdb62..e1f6e15 100644 --- a/OvaleData.lua +++ b/OvaleData.lua @@ -7,11 +7,10 @@ file accompanying this program. ----------------------------------------------------------------------]] -OvaleData = LibStub("AceAddon-3.0"):NewAddon("OvaleData", "AceEvent-3.0") +local _, Ovale = ... +OvaleData = Ovale:NewModule("OvaleData", "AceEvent-3.0") -- -local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") - local ipairs, pairs, tinsert, tonumber, tostring, tsort = ipairs, pairs, table.insert, tonumber, tostring, table.sort local GetNumGlyphSockets = GetNumGlyphSockets local GetGlyphSocketInfo = GetGlyphSocketInfo diff --git a/OvaleEnemies.lua b/OvaleEnemies.lua index f43732f..fbf0f00 100644 --- a/OvaleEnemies.lua +++ b/OvaleEnemies.lua @@ -9,7 +9,8 @@ -- Gather information about ennemies -OvaleEnemies = LibStub("AceAddon-3.0"):NewAddon("OvaleEnemies", "AceEvent-3.0") +local _, Ovale = ... +OvaleEnemies = Ovale:NewModule("OvaleEnemies", "AceEvent-3.0") -- local bit_band, pairs, select, tostring = bit.band, pairs, select, tostring diff --git a/OvaleEquipement.lua b/OvaleEquipement.lua index 4571c33..42f0e76 100644 --- a/OvaleEquipement.lua +++ b/OvaleEquipement.lua @@ -7,11 +7,10 @@ file accompanying this program. ----------------------------------------------------------------------]] -OvaleEquipement = LibStub("AceAddon-3.0"):NewAddon("OvaleEquipement", "AceEvent-3.0") +local _, Ovale = ... +OvaleEquipement = Ovale:NewModule("OvaleEquipement", "AceEvent-3.0") -- -local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") - local pairs = pairs local strfind = string.find local tonumber = tonumber diff --git a/OvaleFrame.lua b/OvaleFrame.lua index 87f8962..d9684f9 100644 --- a/OvaleFrame.lua +++ b/OvaleFrame.lua @@ -7,18 +7,21 @@ file accompanying this program. ----------------------------------------------------------------------]] +local _, Ovale = ... + --inherits Frame do -- local AceGUI = LibStub("AceGUI-3.0") local Masque = LibStub("Masque", true) - local GetTime = GetTime + local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") local Type = "OvaleFrame" local Version = 7 local pairs = pairs local CreateFrame, GetSpellInfo = CreateFrame, GetSpellInfo + local GetTime = GetTime -- -- diff --git a/OvaleFuture.lua b/OvaleFuture.lua index 88af9bd..cbd9e32 100644 --- a/OvaleFuture.lua +++ b/OvaleFuture.lua @@ -9,7 +9,8 @@ -- The travelling missiles or spells that have been cast but whose effects were not still not applied -OvaleFuture = LibStub("AceAddon-3.0"):NewAddon("OvaleFuture", "AceEvent-3.0") +local _, Ovale = ... +OvaleFuture = Ovale:NewModule("OvaleFuture", "AceEvent-3.0") -- local ipairs = ipairs diff --git a/OvaleGUID.lua b/OvaleGUID.lua index 1ea9648..d5e2aa5 100644 --- a/OvaleGUID.lua +++ b/OvaleGUID.lua @@ -10,7 +10,8 @@ -- This addon translates a GUID to a target name -- Usage: OvaleGUID:GetUnitId(guid) -OvaleGUID = LibStub("AceAddon-3.0"):NewAddon("OvaleGUID", "AceEvent-3.0", "AceConsole-3.0") +local _, Ovale = ... +OvaleGUID = Ovale:NewModule("OvaleGUID", "AceEvent-3.0", "AceConsole-3.0") -- local strfind, strsub = string.find, string.sub diff --git a/OvaleIcone.lua b/OvaleIcone.lua index 380923c..aafdac3 100644 --- a/OvaleIcone.lua +++ b/OvaleIcone.lua @@ -7,11 +7,12 @@ file accompanying this program. ----------------------------------------------------------------------]] -local L = LibStub("AceLocale-3.0"):GetLocale("Ovale") +local _, Ovale = ... --inherits ActionButtonTemplate -- +local L = Ovale.L local strfind, strformat, strsub = string.find, string.format, string.sub -- diff --git a/OvaleOptions.lua b/OvaleOptions.lua index 09aa291..6a38025 100644 --- a/OvaleOptions.lua +++ b/OvaleOptions.lua @@ -9,7 +9,8 @@ -- Ovale options and UI -OvaleOptions = LibStub("AceAddon-3.0"):NewAddon("OvaleOptions", "AceEvent-3.0", "AceConsole-3.0") +local _, Ovale = ... +OvaleOptions = Ovale:NewModule("OvaleOptions", "AceConsole-3.0") -- local strgmatch, strgsub, tostring = string.gmatch, string.gsub, tostring diff --git a/OvalePaperDoll.lua b/OvalePaperDoll.lua index 8af05ed..3dd8822 100644 --- a/OvalePaperDoll.lua +++ b/OvalePaperDoll.lua @@ -9,11 +9,10 @@ -- This addon tracks the player's stats as available on the in-game paper doll. -OvalePaperDoll = LibStub("AceAddon-3.0"):NewAddon("OvalePaperDoll", "AceEvent-3.0") +local _, Ovale = ... +OvalePaperDoll = Ovale:NewModule("OvalePaperDoll", "AceEvent-3.0") -- -local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") - local GetMasteryEffect = GetMasteryEffect local GetMeleeHaste = GetMeleeHaste local GetSpellBonusDamage = GetSpellBonusDamage diff --git a/OvaleSpellDamage.lua b/OvaleSpellDamage.lua index 208f6ac..1a72de5 100644 --- a/OvaleSpellDamage.lua +++ b/OvaleSpellDamage.lua @@ -9,7 +9,8 @@ -- Add-on that registers how many damage made the last spell cast by the player -OvaleSpellDamage = LibStub("AceAddon-3.0"):NewAddon("OvaleSpellDamage", "AceEvent-3.0") +local _, Ovale = ... +OvaleSpellDamage = Ovale:NewModule("OvaleSpellDamage", "AceEvent-3.0") -- local select, strfind = select, string.find diff --git a/OvaleStance.lua b/OvaleStance.lua index cbef216..100ed59 100644 --- a/OvaleStance.lua +++ b/OvaleStance.lua @@ -9,11 +9,10 @@ -- This addon tracks the player's current stance. -OvaleStance = LibStub("AceAddon-3.0"):NewAddon("OvaleStance", "AceEvent-3.0") +local _, Ovale = ... +OvaleStance = Ovale:NewModule("OvaleStance", "AceEvent-3.0") -- -local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") - local ipairs = ipairs local pairs = pairs local strfind = string.find diff --git a/OvaleState.lua b/OvaleState.lua index c229943..302d2e4 100644 --- a/OvaleState.lua +++ b/OvaleState.lua @@ -9,6 +9,7 @@ -- Keep the current state in the simulation +local Ovale = LibStub("AceAddon-3.0"):GetAddon("Ovale") OvaleState = {} -- diff --git a/OvaleSwing.lua b/OvaleSwing.lua index 329e257..5bee842 100644 --- a/OvaleSwing.lua +++ b/OvaleSwing.lua @@ -18,7 +18,8 @@ Modifed for Ovale ]] -OvaleSwing = LibStub("AceAddon-3.0"):NewAddon("OvaleSwing", "AceEvent-3.0") +local _, Ovale = ... +OvaleSwing = Ovale:NewModule("OvaleSwing", "AceEvent-3.0") -- OvaleSwing.ohNext = nil diff --git a/compiler.pl b/compiler.pl index 5b8df95..9188a1f 100644 --- a/compiler.pl +++ b/compiler.pl @@ -100,6 +100,7 @@ while (defined($r = readdir(DIR))) { if ($1 =~ m/AceAddon/) { + $m{$class}{NewModule} = true; $m{$class}{Print} = true; $m{$class}{RegisterEvent} = true; $m{$class}{UnregisterEvent} = true; @@ -109,6 +110,16 @@ while (defined($r = readdir(DIR))) } } + if ($content =~ m/$class\s*=\s*Ovale:NewModule\(([^)]+)\)/) + { + $m{$class}{Print} = true; + $m{$class}{RegisterEvent} = true; + $m{$class}{UnregisterEvent} = true; + $m{$class}{RegisterMessage} = true; + $m{$class}{UnregisterMessage} = true; + $m{$class}{SendMessage} = true; + } + if ($content =~ m/(.*)<\/private-static-properties>/s) { my $psp = $1; -- 1.7.9.5