flickerstreak@1: --[[ flickerstreak@1: Name: AceAddon-2.0 flickerstreak@1: Revision: $Rev: 19844 $ flickerstreak@1: Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team) flickerstreak@1: Inspired By: Ace 1.x by Turan (turan@gryphon.com) flickerstreak@1: Website: http://www.wowace.com/ flickerstreak@1: Documentation: http://www.wowace.com/index.php/AceAddon-2.0 flickerstreak@1: SVN: http://svn.wowace.com/root/trunk/Ace2/AceAddon-2.0 flickerstreak@1: Description: Base for all Ace addons to inherit from. flickerstreak@1: Dependencies: AceLibrary, AceOO-2.0, AceEvent-2.0, (optional) AceConsole-2.0 flickerstreak@1: ]] flickerstreak@1: flickerstreak@1: local MAJOR_VERSION = "AceAddon-2.0" flickerstreak@1: local MINOR_VERSION = "$Revision: 19844 $" flickerstreak@1: flickerstreak@1: -- This ensures the code is only executed if the libary doesn't already exist, or is a newer version flickerstreak@1: if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end flickerstreak@1: if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end flickerstreak@1: flickerstreak@1: if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0.") end flickerstreak@1: flickerstreak@1: local function safecall(func,...) flickerstreak@1: local success, err = pcall(func,...) flickerstreak@1: if not success then geterrorhandler()(err) end flickerstreak@1: end flickerstreak@1: -- Localization flickerstreak@1: local STANDBY, TITLE, NOTES, VERSION, AUTHOR, DATE, CATEGORY, EMAIL, CREDITS, WEBSITE, CATEGORIES, ABOUT, PRINT_ADDON_INFO flickerstreak@1: if GetLocale() == "deDE" then flickerstreak@1: STANDBY = "|cffff5050(Standby)|r" -- capitalized flickerstreak@1: flickerstreak@1: TITLE = "Titel" flickerstreak@1: NOTES = "Anmerkung" flickerstreak@1: VERSION = "Version" flickerstreak@1: AUTHOR = "Autor" flickerstreak@1: DATE = "Datum" flickerstreak@1: CATEGORY = "Kategorie" flickerstreak@1: EMAIL = "E-mail" flickerstreak@1: WEBSITE = "Webseite" flickerstreak@1: CREDITS = "Credits" -- fix flickerstreak@1: flickerstreak@1: ABOUT = "\195\188ber" flickerstreak@1: PRINT_ADDON_INFO = "Gibt Addondaten aus" flickerstreak@1: flickerstreak@1: CATEGORIES = { flickerstreak@1: ["Action Bars"] = "Aktionsleisten", flickerstreak@1: ["Auction"] = "Auktion", flickerstreak@1: ["Audio"] = "Audio", flickerstreak@1: ["Battlegrounds/PvP"] = "Schlachtfeld/PvP", flickerstreak@1: ["Buffs"] = "Buffs", flickerstreak@1: ["Chat/Communication"] = "Chat/Kommunikation", flickerstreak@1: ["Druid"] = "Druide", flickerstreak@1: ["Hunter"] = "J?r", flickerstreak@1: ["Mage"] = "Magier", flickerstreak@1: ["Paladin"] = "Paladin", flickerstreak@1: ["Priest"] = "Priester", flickerstreak@1: ["Rogue"] = "Schurke", flickerstreak@1: ["Shaman"] = "Schamane", flickerstreak@1: ["Warlock"] = "Hexenmeister", flickerstreak@1: ["Warrior"] = "Krieger", flickerstreak@1: ["Healer"] = "Heiler", flickerstreak@1: ["Tank"] = "Tank", -- noone use "Brecher"... flickerstreak@1: ["Caster"] = "Caster", flickerstreak@1: ["Combat"] = "Kampf", flickerstreak@1: ["Compilations"] = "Compilations", -- whats that o_O flickerstreak@1: ["Data Export"] = "Datenexport", flickerstreak@1: ["Development Tools"] = "Entwicklungs Tools", flickerstreak@1: ["Guild"] = "Gilde", flickerstreak@1: ["Frame Modification"] = "Frame Modifikation", flickerstreak@1: ["Interface Enhancements"] = "Interface Verbesserungen", flickerstreak@1: ["Inventory"] = "Inventar", flickerstreak@1: ["Library"] = "Library", flickerstreak@1: ["Map"] = "Map", flickerstreak@1: ["Mail"] = "Mail", flickerstreak@1: ["Miscellaneous"] = "Diverses", flickerstreak@1: ["Quest"] = "Quest", flickerstreak@1: ["Raid"] = "Schlachtzug", flickerstreak@1: ["Tradeskill"] = "Handelsf\195\164higkeit", flickerstreak@1: ["UnitFrame"] = "UnitFrame", flickerstreak@1: } flickerstreak@1: elseif GetLocale() == "frFR" then flickerstreak@1: STANDBY = "|cffff5050(attente)|r" flickerstreak@1: flickerstreak@1: TITLE = "Titre" flickerstreak@1: NOTES = "Notes" flickerstreak@1: VERSION = "Version" flickerstreak@1: AUTHOR = "Auteur" flickerstreak@1: DATE = "Date" flickerstreak@1: CATEGORY = "Cat\195\169gorie" flickerstreak@1: EMAIL = "E-mail" flickerstreak@1: WEBSITE = "Site web" flickerstreak@1: CREDITS = "Credits" -- fix flickerstreak@1: flickerstreak@1: ABOUT = "A propos" flickerstreak@1: PRINT_ADDON_INFO = "Afficher les informations sur l'addon" flickerstreak@1: flickerstreak@1: CATEGORIES = { flickerstreak@1: ["Action Bars"] = "Barres d'action", flickerstreak@1: ["Auction"] = "H\195\180tel des ventes", flickerstreak@1: ["Audio"] = "Audio", flickerstreak@1: ["Battlegrounds/PvP"] = "Champs de bataille/JcJ", flickerstreak@1: ["Buffs"] = "Buffs", flickerstreak@1: ["Chat/Communication"] = "Chat/Communication", flickerstreak@1: ["Druid"] = "Druide", flickerstreak@1: ["Hunter"] = "Chasseur", flickerstreak@1: ["Mage"] = "Mage", flickerstreak@1: ["Paladin"] = "Paladin", flickerstreak@1: ["Priest"] = "Pr\195\170tre", flickerstreak@1: ["Rogue"] = "Voleur", flickerstreak@1: ["Shaman"] = "Chaman", flickerstreak@1: ["Warlock"] = "D\195\169moniste", flickerstreak@1: ["Warrior"] = "Guerrier", flickerstreak@1: ["Healer"] = "Soigneur", flickerstreak@1: ["Tank"] = "Tank", flickerstreak@1: ["Caster"] = "Casteur", flickerstreak@1: ["Combat"] = "Combat", flickerstreak@1: ["Compilations"] = "Compilations", flickerstreak@1: ["Data Export"] = "Exportation de donn\195\169es", flickerstreak@1: ["Development Tools"] = "Outils de d\195\169veloppement", flickerstreak@1: ["Guild"] = "Guilde", flickerstreak@1: ["Frame Modification"] = "Modification des fen\195\170tres", flickerstreak@1: ["Interface Enhancements"] = "Am\195\169liorations de l'interface", flickerstreak@1: ["Inventory"] = "Inventaire", flickerstreak@1: ["Library"] = "Biblioth\195\168ques", flickerstreak@1: ["Map"] = "Carte", flickerstreak@1: ["Mail"] = "Courrier", flickerstreak@1: ["Miscellaneous"] = "Divers", flickerstreak@1: ["Quest"] = "Qu\195\170tes", flickerstreak@1: ["Raid"] = "Raid", flickerstreak@1: ["Tradeskill"] = "M\195\169tiers", flickerstreak@1: ["UnitFrame"] = "Fen\195\170tres d'unit\195\169", flickerstreak@1: } flickerstreak@1: elseif GetLocale() == "koKR" then flickerstreak@1: STANDBY = "|cffff5050(????)|r" flickerstreak@1: flickerstreak@1: TITLE = "??" flickerstreak@1: NOTES = "??" flickerstreak@1: VERSION = "??" flickerstreak@1: AUTHOR = "???" flickerstreak@1: DATE = "??" flickerstreak@1: CATEGORY = "??" flickerstreak@1: EMAIL = "E-mail" flickerstreak@1: WEBSITE = "????" flickerstreak@1: CREDITS = "Credits" -- fix flickerstreak@1: flickerstreak@1: ABOUT = "??" flickerstreak@1: PRINT_ADDON_INFO = "??? ?? ??" flickerstreak@1: flickerstreak@1: CATEGORIES = { flickerstreak@1: ["Action Bars"] = "???", flickerstreak@1: ["Auction"] = "??", flickerstreak@1: ["Audio"] = "??", flickerstreak@1: ["Battlegrounds/PvP"] = "??/PvP", flickerstreak@1: ["Buffs"] = "??", flickerstreak@1: ["Chat/Communication"] = "??/????", flickerstreak@1: ["Druid"] = "????", flickerstreak@1: ["Hunter"] = "???", flickerstreak@1: ["Mage"] = "???", flickerstreak@1: ["Paladin"] = "???", flickerstreak@1: ["Priest"] = "??", flickerstreak@1: ["Rogue"] = "??", flickerstreak@1: ["Shaman"] = "???", flickerstreak@1: ["Warlock"] = "????", flickerstreak@1: ["Warrior"] = "??", flickerstreak@1: ["Healer"] = "??", flickerstreak@1: ["Tank"] = "??", flickerstreak@1: ["Caster"] = "???", flickerstreak@1: ["Combat"] = "??", flickerstreak@1: ["Compilations"] = "??", flickerstreak@1: ["Data Export"] = "?? ??", flickerstreak@1: ["Development Tools"] = "?? ??", flickerstreak@1: ["Guild"] = "??", flickerstreak@1: ["Frame Modification"] = "?? ??", flickerstreak@1: ["Interface Enhancements"] = "????? ??", flickerstreak@1: ["Inventory"] = "????", flickerstreak@1: ["Library"] = "?????", flickerstreak@1: ["Map"] = "??", flickerstreak@1: ["Mail"] = "??", flickerstreak@1: ["Miscellaneous"] = "??", flickerstreak@1: ["Quest"] = "???", flickerstreak@1: ["Raid"] = "???", flickerstreak@1: ["Tradeskill"] = "????", flickerstreak@1: ["UnitFrame"] = "?? ???", flickerstreak@1: } flickerstreak@1: elseif GetLocale() == "zhTW" then flickerstreak@1: STANDBY = "|cffff5050(??)|r" flickerstreak@1: flickerstreak@1: TITLE = "??" flickerstreak@1: NOTES = "??" flickerstreak@1: VERSION = "??" flickerstreak@1: AUTHOR = "??" flickerstreak@1: DATE = "??" flickerstreak@1: CATEGORY = "??" flickerstreak@1: EMAIL = "E-mail" flickerstreak@1: WEBSITE = "??" flickerstreak@1: CREDITS = "Credits" -- fix flickerstreak@1: flickerstreak@1: ABOUT = "??" flickerstreak@1: PRINT_ADDON_INFO = "??????" flickerstreak@1: flickerstreak@1: CATEGORIES = { flickerstreak@1: ["Action Bars"] = "???", flickerstreak@1: ["Auction"] = "??", flickerstreak@1: ["Audio"] = "??", flickerstreak@1: ["Battlegrounds/PvP"] = "??/PvP", flickerstreak@1: ["Buffs"] = "??", flickerstreak@1: ["Chat/Communication"] = "??/??", flickerstreak@1: ["Druid"] = "???", flickerstreak@1: ["Hunter"] = "??", flickerstreak@1: ["Mage"] = "??", flickerstreak@1: ["Paladin"] = "???", flickerstreak@1: ["Priest"] = "??", flickerstreak@1: ["Rogue"] = "??", flickerstreak@1: ["Shaman"] = "??", flickerstreak@1: ["Warlock"] = "??", flickerstreak@1: ["Warrior"] = "??", flickerstreak@1: ["Healer"] = "???", flickerstreak@1: ["Tank"] = "??", flickerstreak@1: ["Caster"] = "???", flickerstreak@1: ["Combat"] = "??", flickerstreak@1: ["Compilations"] = "??", flickerstreak@1: ["Data Export"] = "????", flickerstreak@1: ["Development Tools"] = "????", flickerstreak@1: ["Guild"] = "??", flickerstreak@1: ["Frame Modification"] = "????", flickerstreak@1: ["Interface Enhancements"] = "????", flickerstreak@1: ["Inventory"] = "??", flickerstreak@1: ["Library"] = "???", flickerstreak@1: ["Map"] = "??", flickerstreak@1: ["Mail"] = "??", flickerstreak@1: ["Miscellaneous"] = "??", flickerstreak@1: ["Quest"] = "??", flickerstreak@1: ["Raid"] = "??", flickerstreak@1: ["Tradeskill"] = "????", flickerstreak@1: ["UnitFrame"] = "????", flickerstreak@1: } flickerstreak@1: elseif GetLocale() == "zhCN" then flickerstreak@1: STANDBY = "|cffff5050(\230\154\130\230\140\130)|r" flickerstreak@1: flickerstreak@1: TITLE = "\230\160\135\233\162\152" flickerstreak@1: NOTES = "\233\153\132\230\179\168" flickerstreak@1: VERSION = "\231\137\136\230\156\172" flickerstreak@1: AUTHOR = "\228\189\156\232\128\133" flickerstreak@1: DATE = "\230\151\165\230\156\159" flickerstreak@1: CATEGORY = "\229\136\134\231\177\187" flickerstreak@1: EMAIL = "\231\148\181\229\173\144\233\130\174\228\187\182" flickerstreak@1: WEBSITE = "\231\189\145\231\171\153" flickerstreak@1: CREDITS = "Credits" -- fix flickerstreak@1: flickerstreak@1: ABOUT = "\229\133\179\228\186\142" flickerstreak@1: PRINT_ADDON_INFO = "\229\141\176\229\136\151\229\135\186\230\143\146\228\187\182\228\191\161\230\129\175" flickerstreak@1: flickerstreak@1: CATEGORIES = { flickerstreak@1: ["Action Bars"] = "\229\138\168\228\189\156\230\157\161", flickerstreak@1: ["Auction"] = "\230\139\141\229\141\150", flickerstreak@1: ["Audio"] = "\233\159\179\233\162\145", flickerstreak@1: ["Battlegrounds/PvP"] = "\230\136\152\229\156\186/PvP", flickerstreak@1: ["Buffs"] = "\229\162\158\231\155\138\233\173\148\230\179\149", flickerstreak@1: ["Chat/Communication"] = "\232\129\138\229\164\169/\228\186\164\230\181\129", flickerstreak@1: ["Druid"] = "\229\190\183\233\178\129\228\188\138", flickerstreak@1: ["Hunter"] = "\231\140\142\228\186\186", flickerstreak@1: ["Mage"] = "\230\179\149\229\184\136", flickerstreak@1: ["Paladin"] = "\229\156\163\233\170\145\229\163\171", flickerstreak@1: ["Priest"] = "\231\137\167\229\184\136", flickerstreak@1: ["Rogue"] = "\231\155\151\232\180\188", flickerstreak@1: ["Shaman"] = "\232\144\168\230\187\161\231\165\173\229\143\184", flickerstreak@1: ["Warlock"] = "\230\156\175\229\163\171", flickerstreak@1: ["Warrior"] = "\230\136\152\229\163\171", flickerstreak@1: -- ["Healer"] = "\230\178\187\231\150\151\228\191\157\233\154\156", flickerstreak@1: -- ["Tank"] = "\232\191\145\230\136\152\230\142\167\229\136\182", flickerstreak@1: -- ["Caster"] = "\232\191\156\231\168\139\232\190\147\229\135\186", flickerstreak@1: ["Combat"] = "\230\136\152\230\150\151", flickerstreak@1: ["Compilations"] = "\231\188\150\232\175\145", flickerstreak@1: ["Data Export"] = "\230\149\176\230\141\174\229\175\188\229\135\186", flickerstreak@1: ["Development Tools"] = "\229\188\128\229\143\145\229\183\165\229\133\183", flickerstreak@1: ["Guild"] = "\229\133\172\228\188\154", flickerstreak@1: ["Frame Modification"] = "\230\161\134\230\158\182\228\191\174\230\148\185", flickerstreak@1: ["Interface Enhancements"] = "\231\149\140\233\157\162\229\162\158\229\188\186", flickerstreak@1: ["Inventory"] = "\232\131\140\229\140\133", flickerstreak@1: ["Library"] = "\229\186\147", flickerstreak@1: ["Map"] = "\229\156\176\229\155\190", flickerstreak@1: ["Mail"] = "\233\130\174\228\187\182", flickerstreak@1: ["Miscellaneous"] = "\230\157\130\233\161\185", flickerstreak@1: ["Quest"] = "\228\187\187\229\138\161", flickerstreak@1: ["Raid"] = "\229\155\162\233\152\159", flickerstreak@1: ["Tradeskill"] = "\229\149\134\228\184\154\230\138\128\232\131\189", flickerstreak@1: ["UnitFrame"] = "\229\164\180\229\131\143\230\161\134\230\158\182", flickerstreak@1: } flickerstreak@1: else -- enUS flickerstreak@1: STANDBY = "|cffff5050(standby)|r" flickerstreak@1: flickerstreak@1: TITLE = "Title" flickerstreak@1: NOTES = "Notes" flickerstreak@1: VERSION = "Version" flickerstreak@1: AUTHOR = "Author" flickerstreak@1: DATE = "Date" flickerstreak@1: CATEGORY = "Category" flickerstreak@1: EMAIL = "E-mail" flickerstreak@1: WEBSITE = "Website" flickerstreak@1: CREDITS = "Credits" flickerstreak@1: flickerstreak@1: ABOUT = "About" flickerstreak@1: PRINT_ADDON_INFO = "Show information about the addon." flickerstreak@1: flickerstreak@1: CATEGORIES = { flickerstreak@1: ["Action Bars"] = "Action Bars", flickerstreak@1: ["Auction"] = "Auction", flickerstreak@1: ["Audio"] = "Audio", flickerstreak@1: ["Battlegrounds/PvP"] = "Battlegrounds/PvP", flickerstreak@1: ["Buffs"] = "Buffs", flickerstreak@1: ["Chat/Communication"] = "Chat/Communication", flickerstreak@1: ["Druid"] = "Druid", flickerstreak@1: ["Hunter"] = "Hunter", flickerstreak@1: ["Mage"] = "Mage", flickerstreak@1: ["Paladin"] = "Paladin", flickerstreak@1: ["Priest"] = "Priest", flickerstreak@1: ["Rogue"] = "Rogue", flickerstreak@1: ["Shaman"] = "Shaman", flickerstreak@1: ["Warlock"] = "Warlock", flickerstreak@1: ["Warrior"] = "Warrior", flickerstreak@1: ["Healer"] = "Healer", flickerstreak@1: ["Tank"] = "Tank", flickerstreak@1: ["Caster"] = "Caster", flickerstreak@1: ["Combat"] = "Combat", flickerstreak@1: ["Compilations"] = "Compilations", flickerstreak@1: ["Data Export"] = "Data Export", flickerstreak@1: ["Development Tools"] = "Development Tools", flickerstreak@1: ["Guild"] = "Guild", flickerstreak@1: ["Frame Modification"] = "Frame Modification", flickerstreak@1: ["Interface Enhancements"] = "Interface Enhancements", flickerstreak@1: ["Inventory"] = "Inventory", flickerstreak@1: ["Library"] = "Library", flickerstreak@1: ["Map"] = "Map", flickerstreak@1: ["Mail"] = "Mail", flickerstreak@1: ["Miscellaneous"] = "Miscellaneous", flickerstreak@1: ["Quest"] = "Quest", flickerstreak@1: ["Raid"] = "Raid", flickerstreak@1: ["Tradeskill"] = "Tradeskill", flickerstreak@1: ["UnitFrame"] = "UnitFrame", flickerstreak@1: } flickerstreak@1: end flickerstreak@1: flickerstreak@1: setmetatable(CATEGORIES, { __index = function(self, key) -- case-insensitive flickerstreak@1: local lowerKey = key:lower() flickerstreak@1: for k,v in pairs(CATEGORIES) do flickerstreak@1: if k:lower() == lowerKey then flickerstreak@1: return v flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end }) flickerstreak@1: flickerstreak@1: -- Create the library object flickerstreak@1: flickerstreak@1: local AceOO = AceLibrary("AceOO-2.0") flickerstreak@1: local AceAddon = AceOO.Class() flickerstreak@1: local AceEvent flickerstreak@1: local AceConsole flickerstreak@1: local AceModuleCore flickerstreak@1: flickerstreak@1: function AceAddon:GetLocalizedCategory(name) flickerstreak@1: self:argCheck(name, 2, "string") flickerstreak@1: return CATEGORIES[name] or UNKNOWN flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon:ToString() flickerstreak@1: return "AceAddon" flickerstreak@1: end flickerstreak@1: flickerstreak@1: local function print(text) flickerstreak@1: DEFAULT_CHAT_FRAME:AddMessage(text) flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon:ADDON_LOADED(name) flickerstreak@1: while table.getn(self.nextAddon) > 0 do flickerstreak@1: local addon = table.remove(self.nextAddon, 1) flickerstreak@1: table.insert(self.addons, addon) flickerstreak@1: if not self.addons[name] then flickerstreak@1: self.addons[name] = addon flickerstreak@1: end flickerstreak@1: self:InitializeAddon(addon, name) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: flickerstreak@1: local function RegisterOnEnable(self) flickerstreak@1: if DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.defaultLanguage then -- HACK flickerstreak@1: AceAddon.playerLoginFired = true flickerstreak@1: end flickerstreak@1: if AceAddon.playerLoginFired then flickerstreak@1: AceAddon.addonsStarted[self] = true flickerstreak@1: if (type(self.IsActive) ~= "function" or self:IsActive()) and (not AceModuleCore or not AceModuleCore:IsModule(self) or AceModuleCore:IsModuleActive(self)) then flickerstreak@1: local current = self.class flickerstreak@1: while true do flickerstreak@1: if current == AceOO.Class then flickerstreak@1: break flickerstreak@1: end flickerstreak@1: if current.mixins then flickerstreak@1: for mixin in pairs(current.mixins) do flickerstreak@1: if type(mixin.OnEmbedEnable) == "function" then flickerstreak@1: safecall(mixin.OnEmbedEnable,mixin,self) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: current = current.super flickerstreak@1: end flickerstreak@1: if type(self.OnEnable) == "function" then flickerstreak@1: safecall(self.OnEnable,self) flickerstreak@1: end flickerstreak@1: if AceEvent then flickerstreak@1: AceEvent:TriggerEvent("Ace2_AddonEnabled", self) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: else flickerstreak@1: if not AceAddon.addonsToOnEnable then flickerstreak@1: AceAddon.addonsToOnEnable = {} flickerstreak@1: end flickerstreak@1: table.insert(AceAddon.addonsToOnEnable, self) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: flickerstreak@1: local function stripSpaces(text) flickerstreak@1: if type(text) == "string" then flickerstreak@1: return strtrim(text) flickerstreak@1: end flickerstreak@1: return text flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon:InitializeAddon(addon, name) flickerstreak@1: if addon.name == nil then flickerstreak@1: addon.name = name flickerstreak@1: end flickerstreak@1: if GetAddOnMetadata then flickerstreak@1: -- TOC checks flickerstreak@1: if addon.title == nil then flickerstreak@1: addon.title = GetAddOnMetadata(name, "Title") flickerstreak@1: end flickerstreak@1: if type(addon.title) == "string" then flickerstreak@1: local num = addon.title:find(" |cff7fff7f %-Ace2%-|r$") flickerstreak@1: if num then flickerstreak@1: addon.title = addon.title:sub(1, num - 1) flickerstreak@1: end flickerstreak@1: addon.title = addon.title:trim() flickerstreak@1: end flickerstreak@1: if addon.notes == nil then flickerstreak@1: addon.notes = GetAddOnMetadata(name, "Notes") flickerstreak@1: end flickerstreak@1: if type(addon.notes) == "string" then flickerstreak@1: addon.notes = addon.notes:trim() flickerstreak@1: end flickerstreak@1: if addon.version == nil then flickerstreak@1: addon.version = GetAddOnMetadata(name, "Version") flickerstreak@1: end flickerstreak@1: if type(addon.version) == "string" then flickerstreak@1: if addon.version:find("%$Revision: (%d+) %$") then flickerstreak@1: addon.version = addon.version:gsub("%$Revision: (%d+) %$", "%1") flickerstreak@1: elseif addon.version:find("%$Rev: (%d+) %$") then flickerstreak@1: addon.version = addon.version:gsub("%$Rev: (%d+) %$", "%1") flickerstreak@1: elseif addon.version:find("%$LastChangedRevision: (%d+) %$") then flickerstreak@1: addon.version = addon.version:gsub("%$LastChangedRevision: (%d+) %$", "%1") flickerstreak@1: end flickerstreak@1: addon.version = addon.version:trim() flickerstreak@1: end flickerstreak@1: if addon.author == nil then flickerstreak@1: addon.author = GetAddOnMetadata(name, "Author") flickerstreak@1: end flickerstreak@1: if type(addon.author) == "string" then flickerstreak@1: addon.author = addon.author:trim() flickerstreak@1: end flickerstreak@1: if addon.credits == nil then flickerstreak@1: addon.credits = GetAddOnMetadata(name, "X-Credits") flickerstreak@1: end flickerstreak@1: if type(addon.credits) == "string" then flickerstreak@1: addon.credits = addon.credits:trim() flickerstreak@1: end flickerstreak@1: if addon.date == nil then flickerstreak@1: addon.date = GetAddOnMetadata(name, "X-Date") or GetAddOnMetadata(name, "X-ReleaseDate") flickerstreak@1: end flickerstreak@1: if type(addon.date) == "string" then flickerstreak@1: if addon.date:find("%$Date: (.-) %$") then flickerstreak@1: addon.date = addon.date:gsub("%$Date: (.-) %$", "%1") flickerstreak@1: elseif addon.date:find("%$LastChangedDate: (.-) %$") then flickerstreak@1: addon.date = addon.date:gsub("%$LastChangedDate: (.-) %$", "%1") flickerstreak@1: end flickerstreak@1: addon.date = addon.date:trim() flickerstreak@1: end flickerstreak@1: flickerstreak@1: if addon.category == nil then flickerstreak@1: addon.category = GetAddOnMetadata(name, "X-Category") flickerstreak@1: end flickerstreak@1: if type(addon.category) == "string" then flickerstreak@1: addon.category = addon.category:trim() flickerstreak@1: end flickerstreak@1: if addon.email == nil then flickerstreak@1: addon.email = GetAddOnMetadata(name, "X-eMail") or GetAddOnMetadata(name, "X-Email") flickerstreak@1: end flickerstreak@1: if type(addon.email) == "string" then flickerstreak@1: addon.email = addon.email:trim() flickerstreak@1: end flickerstreak@1: if addon.website == nil then flickerstreak@1: addon.website = GetAddOnMetadata(name, "X-Website") flickerstreak@1: end flickerstreak@1: if type(addon.website) == "string" then flickerstreak@1: addon.website = addon.website:trim() flickerstreak@1: end flickerstreak@1: end flickerstreak@1: local current = addon.class flickerstreak@1: while true do flickerstreak@1: if current == AceOO.Class then flickerstreak@1: break flickerstreak@1: end flickerstreak@1: if current.mixins then flickerstreak@1: for mixin in pairs(current.mixins) do flickerstreak@1: if type(mixin.OnEmbedInitialize) == "function" then flickerstreak@1: mixin:OnEmbedInitialize(addon, name) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: current = current.super flickerstreak@1: end flickerstreak@1: if type(addon.OnInitialize) == "function" then flickerstreak@1: safecall(addon.OnInitialize, addon, name) flickerstreak@1: end flickerstreak@1: if AceEvent then flickerstreak@1: AceEvent:TriggerEvent("Ace2_AddonInitialized", addon) flickerstreak@1: end flickerstreak@1: RegisterOnEnable(addon) flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon.prototype:PrintAddonInfo() flickerstreak@1: local x flickerstreak@1: if self.title then flickerstreak@1: x = "|cffffff7f" .. tostring(self.title) .. "|r" flickerstreak@1: elseif self.name then flickerstreak@1: x = "|cffffff7f" .. tostring(self.name) .. "|r" flickerstreak@1: else flickerstreak@1: x = "|cffffff7f<" .. tostring(self.class) .. " instance>|r" flickerstreak@1: end flickerstreak@1: if type(self.IsActive) == "function" then flickerstreak@1: if not self:IsActive() then flickerstreak@1: x = x .. " " .. STANDBY flickerstreak@1: end flickerstreak@1: end flickerstreak@1: if self.version then flickerstreak@1: x = x .. " - |cffffff7f" .. tostring(self.version) .. "|r" flickerstreak@1: end flickerstreak@1: if self.notes then flickerstreak@1: x = x .. " - " .. tostring(self.notes) flickerstreak@1: end flickerstreak@1: print(x) flickerstreak@1: if self.author then flickerstreak@1: print(" - |cffffff7f" .. AUTHOR .. ":|r " .. tostring(self.author)) flickerstreak@1: end flickerstreak@1: if self.credits then flickerstreak@1: print(" - |cffffff7f" .. CREDITS .. ":|r " .. tostring(self.credits)) flickerstreak@1: end flickerstreak@1: if self.date then flickerstreak@1: print(" - |cffffff7f" .. DATE .. ":|r " .. tostring(self.date)) flickerstreak@1: end flickerstreak@1: if self.category then flickerstreak@1: local category = CATEGORIES[self.category] flickerstreak@1: if category then flickerstreak@1: print(" - |cffffff7f" .. CATEGORY .. ":|r " .. category) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: if self.email then flickerstreak@1: print(" - |cffffff7f" .. EMAIL .. ":|r " .. tostring(self.email)) flickerstreak@1: end flickerstreak@1: if self.website then flickerstreak@1: print(" - |cffffff7f" .. WEBSITE .. ":|r " .. tostring(self.website)) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: flickerstreak@1: local options flickerstreak@1: function AceAddon:GetAceOptionsDataTable(target) flickerstreak@1: if not options then flickerstreak@1: options = { flickerstreak@1: about = { flickerstreak@1: name = ABOUT, flickerstreak@1: desc = PRINT_ADDON_INFO, flickerstreak@1: type = "execute", flickerstreak@1: func = "PrintAddonInfo", flickerstreak@1: order = -1, flickerstreak@1: } flickerstreak@1: } flickerstreak@1: end flickerstreak@1: return options flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon:PLAYER_LOGIN() flickerstreak@1: self.playerLoginFired = true flickerstreak@1: if self.addonsToOnEnable then flickerstreak@1: while table.getn(self.addonsToOnEnable) > 0 do flickerstreak@1: local addon = table.remove(self.addonsToOnEnable, 1) flickerstreak@1: self.addonsStarted[addon] = true flickerstreak@1: if (type(addon.IsActive) ~= "function" or addon:IsActive()) and (not AceModuleCore or not AceModuleCore:IsModule(addon) or AceModuleCore:IsModuleActive(addon)) then flickerstreak@1: local current = addon.class flickerstreak@1: while true do flickerstreak@1: if current == AceOO.Class then flickerstreak@1: break flickerstreak@1: end flickerstreak@1: if current.mixins then flickerstreak@1: for mixin in pairs(current.mixins) do flickerstreak@1: if type(mixin.OnEmbedEnable) == "function" then flickerstreak@1: safecall(mixin.OnEmbedEnable,mixin,addon) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: current = current.super flickerstreak@1: end flickerstreak@1: if type(addon.OnEnable) == "function" then flickerstreak@1: safecall(addon.OnEnable,addon) flickerstreak@1: end flickerstreak@1: if AceEvent then flickerstreak@1: AceEvent:TriggerEvent("Ace2_AddonEnabled", addon) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: self.addonsToOnEnable = nil flickerstreak@1: end flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon.prototype:Inject(t) flickerstreak@1: AceAddon:argCheck(t, 2, "table") flickerstreak@1: for k,v in pairs(t) do flickerstreak@1: self[k] = v flickerstreak@1: end flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon.prototype:init() flickerstreak@1: if not AceEvent then flickerstreak@1: error(MAJOR_VERSION .. " requires AceEvent-2.0", 4) flickerstreak@1: end flickerstreak@1: AceAddon.super.prototype.init(self) flickerstreak@1: flickerstreak@1: self.super = self.class.prototype flickerstreak@1: flickerstreak@1: AceAddon:RegisterEvent("ADDON_LOADED", "ADDON_LOADED", true) flickerstreak@1: table.insert(AceAddon.nextAddon, self) flickerstreak@1: end flickerstreak@1: flickerstreak@1: function AceAddon.prototype:ToString() flickerstreak@1: local x flickerstreak@1: if type(self.title) == "string" then flickerstreak@1: x = self.title flickerstreak@1: elseif type(self.name) == "string" then flickerstreak@1: x = self.name flickerstreak@1: else flickerstreak@1: x = "<" .. tostring(self.class) .. " instance>" flickerstreak@1: end flickerstreak@1: if (type(self.IsActive) == "function" and not self:IsActive()) or (AceModuleCore and AceModuleCore:IsModule(addon) and AceModuleCore:IsModuleActive(addon)) then flickerstreak@1: x = x .. " " .. STANDBY flickerstreak@1: end flickerstreak@1: return x flickerstreak@1: end flickerstreak@1: flickerstreak@1: AceAddon.new = function(self, ...) flickerstreak@1: local class = AceAddon:pcall(AceOO.Classpool, self, ...) flickerstreak@1: return class:new() flickerstreak@1: end flickerstreak@1: flickerstreak@1: local function external(self, major, instance) flickerstreak@1: if major == "AceEvent-2.0" then flickerstreak@1: AceEvent = instance flickerstreak@1: flickerstreak@1: AceEvent:embed(self) flickerstreak@1: flickerstreak@1: self:RegisterEvent("PLAYER_LOGIN", "PLAYER_LOGIN", true) flickerstreak@1: elseif major == "AceConsole-2.0" then flickerstreak@1: AceConsole = instance flickerstreak@1: flickerstreak@1: local slashCommands = { "/ace2" } flickerstreak@1: local _,_,_,enabled,loadable = GetAddOnInfo("Ace") flickerstreak@1: if not enabled or not loadable then flickerstreak@1: table.insert(slashCommands, "/ace") flickerstreak@1: end flickerstreak@1: local function listAddon(addon, depth) flickerstreak@1: if not depth then flickerstreak@1: depth = 0 flickerstreak@1: end flickerstreak@1: flickerstreak@1: local s = (" "):rep(depth) .. " - " .. tostring(addon) flickerstreak@1: if rawget(addon, 'version') then flickerstreak@1: s = s .. " - |cffffff7f" .. tostring(addon.version) .. "|r" flickerstreak@1: end flickerstreak@1: if rawget(addon, 'slashCommand') then flickerstreak@1: s = s .. " |cffffff7f(" .. tostring(addon.slashCommand) .. ")|r" flickerstreak@1: end flickerstreak@1: print(s) flickerstreak@1: if type(rawget(addon, 'modules')) == "table" then flickerstreak@1: local i = 0 flickerstreak@1: for k,v in pairs(addon.modules) do flickerstreak@1: i = i + 1 flickerstreak@1: if i == 6 then flickerstreak@1: print((" "):rep(depth + 1) .. " - more...") flickerstreak@1: break flickerstreak@1: else flickerstreak@1: listAddon(v, depth + 1) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: local function listNormalAddon(i) flickerstreak@1: local name,_,_,enabled,loadable = GetAddOnInfo(i) flickerstreak@1: if not loadable then flickerstreak@1: enabled = false flickerstreak@1: end flickerstreak@1: if self.addons[name] then flickerstreak@1: local addon = self.addons[name] flickerstreak@1: if not AceCoreAddon or not AceCoreAddon:IsModule(addon) then flickerstreak@1: listAddon(addon) flickerstreak@1: end flickerstreak@1: else flickerstreak@1: local s = " - " .. tostring(GetAddOnMetadata(i, "Title") or name) flickerstreak@1: local version = GetAddOnMetadata(i, "Version") flickerstreak@1: if version then flickerstreak@1: if version:find("%$Revision: (%d+) %$") then flickerstreak@1: version = version:gsub("%$Revision: (%d+) %$", "%1") flickerstreak@1: elseif version:find("%$Rev: (%d+) %$") then flickerstreak@1: version = version:gsub("%$Rev: (%d+) %$", "%1") flickerstreak@1: elseif version:find("%$LastChangedRevision: (%d+) %$") then flickerstreak@1: version = version:gsub("%$LastChangedRevision: (%d+) %$", "%1") flickerstreak@1: end flickerstreak@1: s = s .. " - |cffffff7f" .. version .. "|r" flickerstreak@1: end flickerstreak@1: if not enabled then flickerstreak@1: s = s .. " |cffff0000(disabled)|r" flickerstreak@1: end flickerstreak@1: if IsAddOnLoadOnDemand(i) then flickerstreak@1: s = s .. " |cff00ff00[LoD]|r" flickerstreak@1: end flickerstreak@1: print(s) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: local function mySort(alpha, bravo) flickerstreak@1: return tostring(alpha) < tostring(bravo) flickerstreak@1: end flickerstreak@1: AceConsole.RegisterChatCommand(self, slashCommands, { flickerstreak@1: desc = "AddOn development framework", flickerstreak@1: name = "Ace2", flickerstreak@1: type = "group", flickerstreak@1: args = { flickerstreak@1: about = { flickerstreak@1: desc = "Get information about Ace2", flickerstreak@1: name = "About", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: print("|cffffff7fAce2|r - |cffffff7f2.0." .. MINOR_VERSION:gsub("%$Revision: (%d+) %$", "%1") .. "|r - AddOn development framework") flickerstreak@1: print(" - |cffffff7f" .. AUTHOR .. ":|r Ace Development Team") flickerstreak@1: print(" - |cffffff7f" .. WEBSITE .. ":|r http://www.wowace.com/") flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: list = { flickerstreak@1: desc = "List addons", flickerstreak@1: name = "List", flickerstreak@1: type = "group", flickerstreak@1: args = { flickerstreak@1: ace2 = { flickerstreak@1: desc = "List addons using Ace2", flickerstreak@1: name = "Ace2", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: print("|cffffff7fAddon list:|r") flickerstreak@1: local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0") flickerstreak@1: table.sort(self.addons, mySort) flickerstreak@1: for _,v in ipairs(self.addons) do flickerstreak@1: if not AceCoreAddon or not AceCoreAddon:IsModule(v) then flickerstreak@1: listAddon(v) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: all = { flickerstreak@1: desc = "List all addons", flickerstreak@1: name = "All", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: print("|cffffff7fAddon list:|r") flickerstreak@1: local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0") flickerstreak@1: local count = GetNumAddOns() flickerstreak@1: for i = 1, count do flickerstreak@1: listNormalAddon(i) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: enabled = { flickerstreak@1: desc = "List all enabled addons", flickerstreak@1: name = "Enabled", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: print("|cffffff7fAddon list:|r") flickerstreak@1: local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0") flickerstreak@1: local count = GetNumAddOns() flickerstreak@1: for i = 1, count do flickerstreak@1: local _,_,_,enabled,loadable = GetAddOnInfo(i) flickerstreak@1: if enabled and loadable then flickerstreak@1: listNormalAddon(i) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: disabled = { flickerstreak@1: desc = "List all disabled addons", flickerstreak@1: name = "Disabled", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: print("|cffffff7fAddon list:|r") flickerstreak@1: local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0") flickerstreak@1: local count = GetNumAddOns() flickerstreak@1: for i = 1, count do flickerstreak@1: local _,_,_,enabled,loadable = GetAddOnInfo(i) flickerstreak@1: if not enabled or not loadable then flickerstreak@1: listNormalAddon(i) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: lod = { flickerstreak@1: desc = "List all LoadOnDemand addons", flickerstreak@1: name = "LoadOnDemand", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: print("|cffffff7fAddon list:|r") flickerstreak@1: local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0") flickerstreak@1: local count = GetNumAddOns() flickerstreak@1: for i = 1, count do flickerstreak@1: if IsAddOnLoadOnDemand(i) then flickerstreak@1: listNormalAddon(i) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: ace1 = { flickerstreak@1: desc = "List all addons using Ace1", flickerstreak@1: name = "Ace 1.x", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: print("|cffffff7fAddon list:|r") flickerstreak@1: local count = GetNumAddOns() flickerstreak@1: for i = 1, count do flickerstreak@1: local dep1, dep2, dep3, dep4 = GetAddOnDependencies(i) flickerstreak@1: if dep1 == "Ace" or dep2 == "Ace" or dep3 == "Ace" or dep4 == "Ace" then flickerstreak@1: listNormalAddon(i) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: libs = { flickerstreak@1: desc = "List all libraries using AceLibrary", flickerstreak@1: name = "Libraries", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: if type(AceLibrary) == "table" and type(AceLibrary.libs) == "table" then flickerstreak@1: print("|cffffff7fLibrary list:|r") flickerstreak@1: for name, data in pairs(AceLibrary.libs) do flickerstreak@1: local s flickerstreak@1: if data.minor then flickerstreak@1: s = " - " .. tostring(name) .. "." .. tostring(data.minor) flickerstreak@1: else flickerstreak@1: s = " - " .. tostring(name) flickerstreak@1: end flickerstreak@1: if rawget(AceLibrary(name), 'slashCommand') then flickerstreak@1: s = s .. " |cffffff7f(" .. tostring(AceLibrary(name).slashCommand) .. "|cffffff7f)" flickerstreak@1: end flickerstreak@1: print(s) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: search = { flickerstreak@1: desc = "Search by name", flickerstreak@1: name = "Search", flickerstreak@1: type = "text", flickerstreak@1: usage = "", flickerstreak@1: input = true, flickerstreak@1: get = false, flickerstreak@1: set = function(...) flickerstreak@1: local arg = { ... } flickerstreak@1: for i,v in ipairs(arg) do flickerstreak@1: arg[i] = v:gsub('%*', '.*'):gsub('%%', '%%%%'):lower() flickerstreak@1: end flickerstreak@1: local count = GetNumAddOns() flickerstreak@1: for i = 1, count do flickerstreak@1: local name = GetAddOnInfo(i) flickerstreak@1: local good = true flickerstreak@1: for _,v in ipairs(arg) do flickerstreak@1: if not name:lower():find(v) then flickerstreak@1: good = false flickerstreak@1: break flickerstreak@1: end flickerstreak@1: end flickerstreak@1: if good then flickerstreak@1: listNormalAddon(i) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: end flickerstreak@1: } flickerstreak@1: }, flickerstreak@1: }, flickerstreak@1: enable = { flickerstreak@1: desc = "Enable addon", flickerstreak@1: name = "Enable", flickerstreak@1: type = "text", flickerstreak@1: usage = "", flickerstreak@1: get = false, flickerstreak@1: set = function(text) flickerstreak@1: local name,title,_,enabled,_,reason = GetAddOnInfo(text) flickerstreak@1: if reason == "MISSING" then flickerstreak@1: print(string.format("|cffffff7fAce2:|r AddOn %q does not exist", text)) flickerstreak@1: elseif not enabled then flickerstreak@1: EnableAddOn(text) flickerstreak@1: print(string.format("|cffffff7fAce2:|r %s is now enabled", title or name)) flickerstreak@1: else flickerstreak@1: print(string.format("|cffffff7fAce2:|r %s is already enabled", title or name)) flickerstreak@1: end flickerstreak@1: end, flickerstreak@1: }, flickerstreak@1: disable = { flickerstreak@1: desc = "Disable addon", flickerstreak@1: name = "Disable", flickerstreak@1: type = "text", flickerstreak@1: usage = "", flickerstreak@1: get = false, flickerstreak@1: set = function(text) flickerstreak@1: local name,title,_,enabled,_,reason = GetAddOnInfo(text) flickerstreak@1: if reason == "MISSING" then flickerstreak@1: print(string.format("|cffffff7fAce2:|r AddOn %q does not exist", text)) flickerstreak@1: elseif enabled then flickerstreak@1: DisableAddOn(text) flickerstreak@1: print(string.format("|cffffff7fAce2:|r %s is now disabled", title or name)) flickerstreak@1: else flickerstreak@1: print(string.format("|cffffff7fAce2:|r %s is already disabled", title or name)) flickerstreak@1: end flickerstreak@1: end, flickerstreak@1: }, flickerstreak@1: load = { flickerstreak@1: desc = "Load addon", flickerstreak@1: name = "Load", flickerstreak@1: type = "text", flickerstreak@1: usage = "", flickerstreak@1: get = false, flickerstreak@1: set = function(text) flickerstreak@1: local name,title,_,_,loadable,reason = GetAddOnInfo(text) flickerstreak@1: if reason == "MISSING" then flickerstreak@1: print(string.format("|cffffff7fAce2:|r AddOn %q does not exist.", text)) flickerstreak@1: elseif not loadable then flickerstreak@1: print(string.format("|cffffff7fAce2:|r AddOn %q is not loadable. Reason: %s", text, reason)) flickerstreak@1: else flickerstreak@1: LoadAddOn(text) flickerstreak@1: print(string.format("|cffffff7fAce2:|r %s is now loaded", title or name)) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: }, flickerstreak@1: info = { flickerstreak@1: desc = "Display information", flickerstreak@1: name = "Information", flickerstreak@1: type = "execute", flickerstreak@1: func = function() flickerstreak@1: local mem, threshold = gcinfo() flickerstreak@1: print(string.format(" - |cffffff7fMemory usage [|r%.3f MiB|cffffff7f]|r", mem / 1024)) flickerstreak@1: if threshold then flickerstreak@1: print(string.format(" - |cffffff7fThreshold [|r%.3f MiB|cffffff7f]|r", threshold / 1024)) flickerstreak@1: end flickerstreak@1: print(string.format(" - |cffffff7fFramerate [|r%.0f fps|cffffff7f]|r", GetFramerate())) flickerstreak@1: local bandwidthIn, bandwidthOut, latency = GetNetStats() flickerstreak@1: bandwidthIn, bandwidthOut = floor(bandwidthIn * 1024), floor(bandwidthOut * 1024) flickerstreak@1: print(string.format(" - |cffffff7fLatency [|r%.0f ms|cffffff7f]|r", latency)) flickerstreak@1: print(string.format(" - |cffffff7fBandwidth in [|r%.0f B/s|cffffff7f]|r", bandwidthIn)) flickerstreak@1: print(string.format(" - |cffffff7fBandwidth out [|r%.0f B/s|cffffff7f]|r", bandwidthOut)) flickerstreak@1: print(string.format(" - |cffffff7fTotal addons [|r%d|cffffff7f]|r", GetNumAddOns())) flickerstreak@1: print(string.format(" - |cffffff7fAce2 addons [|r%d|cffffff7f]|r", table.getn(self.addons))) flickerstreak@1: local ace = 0 flickerstreak@1: local enabled = 0 flickerstreak@1: local disabled = 0 flickerstreak@1: local lod = 0 flickerstreak@1: for i = 1, GetNumAddOns() do flickerstreak@1: local dep1, dep2, dep3, dep4 = GetAddOnDependencies(i) flickerstreak@1: if dep1 == "Ace" or dep2 == "Ace" or dep3 == "Ace" or dep4 == "Ace" then flickerstreak@1: ace = ace + 1 flickerstreak@1: end flickerstreak@1: if IsAddOnLoadOnDemand(i) then flickerstreak@1: lod = lod + 1 flickerstreak@1: end flickerstreak@1: local _,_,_,IsActive,loadable = GetAddOnInfo(i) flickerstreak@1: if not IsActive or not loadable then flickerstreak@1: disabled = disabled + 1 flickerstreak@1: else flickerstreak@1: enabled = enabled + 1 flickerstreak@1: end flickerstreak@1: end flickerstreak@1: print(string.format(" - |cffffff7fAce 1.x addons [|r%d|cffffff7f]|r", ace)) flickerstreak@1: print(string.format(" - |cffffff7fLoadOnDemand addons [|r%d|cffffff7f]|r", lod)) flickerstreak@1: print(string.format(" - |cffffff7fenabled addons [|r%d|cffffff7f]|r", enabled)) flickerstreak@1: print(string.format(" - |cffffff7fdisabled addons [|r%d|cffffff7f]|r", disabled)) flickerstreak@1: local libs = 0 flickerstreak@1: if type(AceLibrary) == "table" and type(AceLibrary.libs) == "table" then flickerstreak@1: for _ in pairs(AceLibrary.libs) do flickerstreak@1: libs = libs + 1 flickerstreak@1: end flickerstreak@1: end flickerstreak@1: print(string.format(" - |cffffff7fAceLibrary instances [|r%d|cffffff7f]|r", libs)) flickerstreak@1: end flickerstreak@1: } flickerstreak@1: } flickerstreak@1: }) flickerstreak@1: elseif major == "AceModuleCore-2.0" then flickerstreak@1: AceModuleCore = instance flickerstreak@1: end flickerstreak@1: end flickerstreak@1: flickerstreak@1: local function activate(self, oldLib, oldDeactivate) flickerstreak@1: AceAddon = self flickerstreak@1: flickerstreak@1: if oldLib then flickerstreak@1: self.playerLoginFired = oldLib.playerLoginFired or DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.defaultLanguage flickerstreak@1: self.addonsToOnEnable = oldLib.addonsToOnEnable flickerstreak@1: self.addons = oldLib.addons flickerstreak@1: self.nextAddon = oldLib.nextAddon flickerstreak@1: self.addonsStarted = oldLib.addonsStarted flickerstreak@1: end flickerstreak@1: if not self.addons then flickerstreak@1: self.addons = {} flickerstreak@1: end flickerstreak@1: if not self.nextAddon then flickerstreak@1: self.nextAddon = {} flickerstreak@1: end flickerstreak@1: if not self.addonsStarted then flickerstreak@1: self.addonsStarted = {} flickerstreak@1: end flickerstreak@1: if oldDeactivate then flickerstreak@1: oldDeactivate(oldLib) flickerstreak@1: end flickerstreak@1: end flickerstreak@1: flickerstreak@1: AceLibrary:Register(AceAddon, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)