From 250adfc2dbd5b439e7f74e1c114bf09f75787760 Mon Sep 17 00:00:00 2001 From: Parnic Date: Fri, 17 Sep 2010 05:41:04 +0000 Subject: [PATCH] - removed the last remnants of Ace2 (AceOO-2.0 and AceLibrary) thanks to a huge amount of help from ckknight for metatables --- .pkgmeta | 2 -- IceBarElement.lua | 14 ++++---- IceCastBar.lua | 7 +--- IceCore.lua | 27 ++++++++++---- IceElement.lua | 7 ++-- IceHUD.lua | 4 +-- IceHUD.toc | 4 +-- IceUnitBar.lua | 5 +-- embeds.xml | 2 -- modules/CastBar.lua | 4 +-- modules/ClassPowerCounter.lua | 4 +-- modules/ComboPoints.lua | 4 +-- modules/ComboPointsBar.lua | 6 ++-- modules/CustomBar.lua | 4 +-- modules/CustomCDBar.lua | 4 +-- modules/CustomCount.lua | 4 +-- modules/CustomHealth.lua | 4 +-- modules/CustomMana.lua | 4 +-- modules/DruidMana.lua | 6 ++-- modules/EclipseBar.lua | 4 +-- modules/FocusCC.lua | 6 ++-- modules/FocusCast.lua | 4 +-- modules/FocusHealth.lua | 4 +-- modules/FocusMana.lua | 16 ++++----- modules/FocusThreat.lua | 4 +-- modules/GlobalCoolDown.lua | 4 +-- modules/HolyPower.lua | 4 +-- modules/HungerForBlood.lua | 8 ++--- modules/LacerateCount.lua | 14 ++++---- modules/MaelstromCount.lua | 14 ++++---- modules/MirrorBar.lua | 6 ++-- modules/PetHealth.lua | 4 +-- modules/PetInfo.lua | 3 +- modules/PetMana.lua | 12 +++---- modules/PlayerCC.lua | 6 ++-- modules/PlayerHealth.lua | 10 +++--- modules/PlayerInfo.lua | 3 +- modules/PlayerInvuln.lua | 6 ++-- modules/PlayerMana.lua | 40 ++++++++++----------- modules/RangeCheck.lua | 14 +++----- modules/Runes.lua | 4 +-- modules/Shards.lua | 4 +-- modules/SliceAndDice.lua | 10 +++--- modules/SunderCount.lua | 14 ++++---- modules/TargetCC.lua | 4 +-- modules/TargetCast.lua | 4 +-- modules/TargetHealth.lua | 4 +-- modules/TargetInfo.lua | 58 +++++++++++++++--------------- modules/TargetInvuln.lua | 4 +-- modules/TargetMana.lua | 4 +-- modules/TargetOfTarget.lua | 61 ++++++++++++++++---------------- modules/TargetOfTargetCast.lua | 4 +-- modules/TargetOfTargetHealth.lua | 6 ++-- modules/TargetOfTargetMana.lua | 6 ++-- modules/Threat.lua | 4 +-- modules/Totems.lua | 4 +-- 56 files changed, 203 insertions(+), 294 deletions(-) diff --git a/.pkgmeta b/.pkgmeta index f38ec8c..5632471 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -4,7 +4,6 @@ externals: libs/LibStub: url: svn://svn.wowace.com/wow/ace3/mainline/trunk/LibStub tag: latest - libs/AceLibrary: svn://svn.wowace.com/wow/ace2/mainline/trunk/AceLibrary libs/CallbackHandler-1.0: url: svn://svn.wowace.com/wow/ace3/mainline/trunk/CallbackHandler-1.0 tag: latest @@ -26,7 +25,6 @@ externals: libs/AceGUI-3.0: url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0 tag: latest - libs/AceOO-2.0: svn://svn.wowace.com/wow/ace2/mainline/trunk/AceOO-2.0 libs/AceAddon-3.0: url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0 tag: latest diff --git a/IceBarElement.lua b/IceBarElement.lua index 877b4a8..52387ce 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -1,9 +1,6 @@ -local AceOO = AceLibrary("AceOO-2.0") - local DogTag = nil -IceBarElement = AceOO.Class(IceElement) -IceBarElement.virtual = true +IceBarElement = IceCore_CreateClass(IceElement) IceBarElement.BarTextureWidth = 128 @@ -14,6 +11,7 @@ IceBarElement.prototype.LastScale = 1 IceBarElement.prototype.DesiredScale = 1 IceBarElement.prototype.CurrScale = 1 IceBarElement.prototype.Markers = {} +IceBarElement.prototype.IsBarElement = true -- cheating to avoid crawling up the 'super' references looking for this class. see IceCore.lua local lastMarkerPosConfig = 50 local lastMarkerColorConfig = {r=1, b=0, g=0, a=1} @@ -33,9 +31,11 @@ end function IceBarElement.prototype:Enable() IceBarElement.super.prototype.Enable(self) - if IceHUD.IceCore:ShouldUseDogTags() and AceLibrary:HasInstance("LibDogTag-3.0") then - DogTag = AceLibrary("LibDogTag-3.0") - AceLibrary("LibDogTag-Unit-3.0") + if IceHUD.IceCore:ShouldUseDogTags() then + DogTag = LibStub("LibDogTag-3.0", true) + if DogTag then + LibStub("LibDogTag-Unit-3.0", true) + end end if self.moduleSettings.myTagVersion < IceHUD.CurrTagVersion then diff --git a/IceCastBar.lua b/IceCastBar.lua index 9120e97..0762643 100644 --- a/IceCastBar.lua +++ b/IceCastBar.lua @@ -1,9 +1,4 @@ -local AceOO = AceLibrary("AceOO-2.0") - -local SPELLINTERRUPTOTHERSELF = SPELLINTERRUPTOTHERSELF -local SPELLFAILCASTSELF = SPELLFAILCASTSELF - -IceCastBar = AceOO.Class(IceBarElement) +IceCastBar = IceCore_CreateClass(IceBarElement) IceCastBar.Actions = { None = 0, Cast = 1, Channel = 2, Instant = 3, Success = 4, Failure = 5 } diff --git a/IceCore.lua b/IceCore.lua index 0d0dbcc..ae35211 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -1,6 +1,22 @@ -local AceOO = AceLibrary("AceOO-2.0") +function IceCore_CreateClass(parent) + local class = { prototype = {} } + if parent then + class.super = parent + setmetatable(class.prototype, { __index = parent.prototype }) + end + local mt = { __index = class.prototype } + function class.new(...) + local self = setmetatable({}, mt) + if self.init then + self:init(...) + end + return self + end -IceCore = AceOO.Class() + return class +end + +IceCore = IceCore_CreateClass() IceCore.Side = { Left = "LEFT", Right = "RIGHT" } @@ -27,7 +43,6 @@ IceCore.prototype.bConfigMode = false -- Constructor -- function IceCore.prototype:init() - IceCore.super.prototype.init(self) IceHUD:Debug("IceCore.prototype:init()") self.IceHUDFrame = CreateFrame("Frame","IceHUDFrame", UIParent) @@ -617,7 +632,7 @@ function IceCore.prototype:ConfigModeToggle(bWantConfig) if self.elements[i]:IsEnabled() then self.elements[i].frame:Show() self.elements[i]:Redraw() - if AceOO.inherits(self.elements[i], IceBarElement) then + if self.elements[i].IsBarElement then self.elements[i]:SetBottomText1(self.elements[i].elementName) end end @@ -629,7 +644,7 @@ function IceCore.prototype:ConfigModeToggle(bWantConfig) end -- blank the bottom text that we set before. if the module uses this text, it will reset itself on redraw - if AceOO.inherits(self.elements[i], IceBarElement) then + if self.elements[i].IsBarElement then self.elements[i]:SetBottomText1() end @@ -639,7 +654,7 @@ function IceCore.prototype:ConfigModeToggle(bWantConfig) end function IceCore.prototype:ShouldUseDogTags() - return AceLibrary:HasInstance("LibDogTag-3.0") and self.settings.bShouldUseDogTags + return LibStub("LibDogTag-3.0", true) and self.settings.bShouldUseDogTags end function IceCore.prototype:SetShouldUseDogTags(should) diff --git a/IceElement.lua b/IceElement.lua index 9a25491..db4df94 100644 --- a/IceElement.lua +++ b/IceElement.lua @@ -1,8 +1,6 @@ -local AceOO = AceLibrary("AceOO-2.0") -local SML = AceLibrary("LibSharedMedia-3.0") +local SML = LibStub("LibSharedMedia-3.0") -IceElement = AceOO.Class() -IceElement.virtual = true +IceElement = IceCore_CreateClass() IceElement.TexturePath = IceHUD.Location .. "\\textures\\" @@ -31,7 +29,6 @@ IceElement.prototype.bIsVisible = true -- Therefore we can wait for IceCore to load and then register our -- module to the core with another event. function IceElement.prototype:init(name) - IceElement.super.prototype.init(self) assert(name, "IceElement must have a name") self.elementName = name diff --git a/IceHUD.lua b/IceHUD.lua index 3747635..04a42c8 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -1,6 +1,6 @@ IceHUD = LibStub("AceAddon-3.0"):NewAddon("IceHUD", "AceConsole-3.0") -local SML = AceLibrary("LibSharedMedia-3.0") +local SML = LibStub("LibSharedMedia-3.0") local ACR = LibStub("AceConfigRegistry-3.0") local ConfigDialog = LibStub("AceConfigDialog-3.0") local icon = LibStub("LibDBIcon-1.0") @@ -652,7 +652,7 @@ Expand "|cffffdc42Module Settings|r", expand PlayerInfo (or TargetInfo for targe StaticPopup_Show("ICEHUD_CHANGED_DOGTAG") end, hidden = function() - return not AceLibrary:HasInstance("LibDogTag-3.0") + return not LibStub("LibDogTag-3.0", true) end, order = 96 }, diff --git a/IceHUD.toc b/IceHUD.toc index 1ecfb2b..2ad3b12 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -1,11 +1,11 @@ ## Interface: 30300 ## Author: Parnic, originally created by Iceroth ## Name: IceHUD -## Title: IceHUD |cff7fff7f -Ace2/3-|r +## Title: IceHUD |cff7fff7f -Ace3-|r ## Notes: Another HUD addon ## Version: @project-version@ (Revision: @project-revision@) ## SavedVariables: IceCoreDB -## OptionalDeps: Ace2, Ace3, LibSharedMedia-3.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibRangeCheck-2.0, LibHealComm-4.0 +## OptionalDeps: Ace3, LibSharedMedia-3.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibRangeCheck-2.0, LibHealComm-4.0 ## X-Category: HUDs ## X-Website: http://www.wowace.com/projects/ice-hud/ ## X-Compatible-With: 40000 diff --git a/IceUnitBar.lua b/IceUnitBar.lua index 59661a4..fd32af6 100644 --- a/IceUnitBar.lua +++ b/IceUnitBar.lua @@ -1,7 +1,4 @@ -local AceOO = AceLibrary("AceOO-2.0") - -IceUnitBar = AceOO.Class(IceBarElement) -IceUnitBar.virtual = true +IceUnitBar = IceCore_CreateClass(IceBarElement) IceUnitBar.prototype.unit = nil IceUnitBar.prototype.alive = nil diff --git a/embeds.xml b/embeds.xml index 1838bd0..47b7e22 100644 --- a/embeds.xml +++ b/embeds.xml @@ -1,8 +1,6 @@