vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 Name: AceAddon-2.0
3 Revision: $Rev: 7033 $
4 Author(s): ckknight (ckknight@gmail.com)
5 Inspired By: Ace 1.x by Turan (<email here>)
6 Website: http://www.wowace.com/
7 Documentation: http://wiki.wowace.com/index.php/AceAddon-2.0
8 SVN: http://svn.wowace.com/root/trunk/Ace2/AceAddon-2.0
9 Description: Base for all Ace addons to inherit from.
10 Dependencies: AceLibrary, AceOO-2.0, AceEvent-2.0, (optional) AceConsole-2.0
11 ]]
12  
13 local MAJOR_VERSION = "AceAddon-2.0"
14 local MINOR_VERSION = "$Revision: 7033 $"
15  
16 -- This ensures the code is only executed if the libary doesn't already exist, or is a newer version
17 if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
18 if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
19  
20 if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0.") end
21  
22 -- Localization
23 local STANDBY, TITLE, NOTES, VERSION, AUTHOR, DATE, CATEGORY, EMAIL, WEBSITE, CATEGORIES, ABOUT, PRINT_ADDON_INFO
24 if false then -- GetLocale() == "deDE"
25 else -- enUS
26 STANDBY = "|cffff5050(standby)|r"
27  
28 TITLE = "Title"
29 NOTES = "Notes"
30 VERSION = "Version"
31 AUTHOR = "Author"
32 DATE = "Date"
33 CATEGORY = "Category"
34 EMAIL = "E-mail"
35 WEBSITE = "Website"
36  
37 ABOUT = "About"
38 PRINT_ADDON_INFO = "Print out addon info"
39  
40 CATEGORIES = {
41 ["Action Bars"] = "Action Bars",
42 ["Auction"] = "Auction",
43 ["Audio"] = "Audio",
44 ["Battlegrounds/PvP"] = "Battlegrounds/PvP",
45 ["Buffs"] = "Buffs",
46 ["Chat/Communication"] = "Chat/Communication",
47 ["Druid"] = "Druid",
48 ["Hunter"] = "Hunter",
49 ["Mage"] = "Mage",
50 ["Paladin"] = "Paladin",
51 ["Priest"] = "Priest",
52 ["Rogue"] = "Rogue",
53 ["Shaman"] = "Shaman",
54 ["Warlock"] = "Warlock",
55 ["Warrior"] = "Warrior",
56 ["Healer"] = "Healer",
57 ["Tank"] = "Tank",
58 ["Caster"] = "Caster",
59 ["Combat"] = "Combat",
60 ["Compilations"] = "Compilations",
61 ["Data Export"] = "Data Export",
62 ["Development Tools "] = "Development Tools ",
63 ["Guild"] = "Guild",
64 ["Frame Modification"] = "Frame Modification",
65 ["Interface Enhancements"] = "Interface Enhancements",
66 ["Inventory"] = "Inventory",
67 ["Library"] = "Library",
68 ["Map"] = "Map",
69 ["Mail"] = "Mail",
70 ["Miscellaneous"] = "Miscellaneous",
71 ["Quest"] = "Quest",
72 ["Raid"] = "Raid",
73 ["Tradeskill"] = "Tradeskill",
74 ["UnitFrame"] = "UnitFrame",
75 }
76 end
77  
78 setmetatable(CATEGORIES, { __index = function(self, key) -- case-insensitive
79 local lowerKey = string.lower(key)
80 for k,v in CATEGORIES do
81 if string.lower(k) == lowerKey then
82 return v
83 end
84 end
85 end })
86  
87 -- Create the library object
88  
89 local AceOO = AceLibrary("AceOO-2.0")
90 local AceAddon = AceOO.Class()
91 local AceEvent
92 local AceConsole
93 local AceModuleCore
94  
95 function AceAddon:ToString()
96 return "AceAddon"
97 end
98  
99 local function print(text)
100 DEFAULT_CHAT_FRAME:AddMessage(text)
101 end
102  
103 function AceAddon:ADDON_LOADED(name)
104 while table.getn(self.nextAddon) > 0 do
105 local addon = table.remove(self.nextAddon, 1)
106 table.insert(self.addons, addon)
107 if not self.addons[name] then
108 self.addons[name] = addon
109 end
110 self:InitializeAddon(addon, name)
111 end
112 end
113  
114 local function RegisterOnEnable(self)
115 if DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.defaultLanguage then -- HACK
116 AceAddon.playerLoginFired = true
117 end
118 if AceAddon.playerLoginFired then
119 AceAddon.addonsStarted[self] = true
120 if (type(self.IsActive) ~= "function" or self:IsActive()) and (not AceModuleCore or not AceModuleCore:IsModule(self) or AceModuleCore:IsModuleActive(self)) then
121 local current = self.class
122 while true do
123 if current == AceOO.Class then
124 break
125 end
126 if current.mixins then
127 for mixin in pairs(current.mixins) do
128 if type(mixin.OnEmbedEnable) == "function" then
129 mixin:OnEmbedEnable(self)
130 end
131 end
132 end
133 current = current.super
134 end
135 if type(self.OnEnable) == "function" then
136 self:OnEnable()
137 end
138 end
139 else
140 if not AceAddon.addonsToOnEnable then
141 AceAddon.addonsToOnEnable = {}
142 end
143 table.insert(AceAddon.addonsToOnEnable, self)
144 end
145 end
146  
147 function AceAddon:InitializeAddon(addon, name)
148 if addon.name == nil then
149 addon.name = name
150 end
151 if GetAddOnMetadata then
152 -- TOC checks
153 if addon.title == nil then
154 addon.title = GetAddOnMetadata(name, "Title")
155 if addon.title then
156 local num = string.find(addon.title, " |cff7fff7f %-Ace2%-|r$")
157 if num then
158 addon.title = string.sub(addon.title, 1, num - 1)
159 end
160 end
161 end
162 if addon.notes == nil then
163 addon.notes = GetAddOnMetadata(name, "Notes")
164 end
165 if addon.version == nil then
166 addon.version = GetAddOnMetadata(name, "Version")
167 if addon.version then
168 if string.find(addon.version, "%$Revision: (%d+) %$") then
169 addon.version = string.gsub(addon.version, "%$Revision: (%d+) %$", "%1")
170 elseif string.find(addon.version, "%$Rev: (%d+) %$") then
171 addon.version = string.gsub(addon.version, "%$Rev: (%d+) %$", "%1")
172 elseif string.find(addon.version, "%$LastChangedRevision: (%d+) %$") then
173 addon.version = string.gsub(addon.version, "%$LastChangedRevision: (%d+) %$", "%1")
174 end
175 end
176 end
177 if addon.author == nil then
178 addon.author = GetAddOnMetadata(name, "Author")
179 end
180 if addon.date == nil then
181 addon.date = GetAddOnMetadata(name, "X-Date") or GetAddOnMetadata(name, "X-ReleaseDate")
182 if addon.date then
183 if string.find(addon.date, "%$Date: (.-) %$") then
184 addon.date = string.gsub(addon.date, "%$Date: (.-) %$", "%1")
185 elseif string.find(addon.date, "%$LastChangedDate: (.-) %$") then
186 addon.date = string.gsub(addon.date, "%$LastChangedDate: (.-) %$", "%1")
187 end
188 end
189 end
190 if addon.category == nil then
191 addon.category = GetAddOnMetadata(name, "X-Category")
192 end
193 if addon.email == nil then
194 addon.email = GetAddOnMetadata(name, "X-eMail") or GetAddOnMetadata(name, "X-Email")
195 end
196 if addon.website == nil then
197 addon.website = GetAddOnMetadata(name, "X-Website")
198 end
199 end
200 local current = addon.class
201 while true do
202 if current == AceOO.Class then
203 break
204 end
205 if current.mixins then
206 for mixin in pairs(current.mixins) do
207 if type(mixin.OnEmbedInitialize) == "function" then
208 mixin:OnEmbedInitialize(addon, name)
209 end
210 end
211 end
212 current = current.super
213 end
214 if type(addon.OnInitialize) == "function" then
215 addon:OnInitialize(name)
216 end
217 RegisterOnEnable(addon)
218 end
219  
220 function AceAddon.prototype:PrintAddonInfo()
221 local x
222 if self.title then
223 x = "|cffffff7f" .. tostring(self.title) .. "|r"
224 elseif self.name then
225 x = "|cffffff7f" .. tostring(self.name) .. "|r"
226 else
227 x = "|cffffff7f<" .. tostring(self.class) .. " instance>|r"
228 end
229 if type(self.IsActive) == "function" then
230 if not self:IsActive() then
231 x = x .. " " .. STANDBY
232 end
233 end
234 if self.version then
235 x = x .. " - |cffffff7f" .. tostring(self.version) .. "|r"
236 end
237 if self.notes then
238 x = x .. " - " .. tostring(self.notes)
239 end
240 print(x)
241 if self.author then
242 print(" - |cffffff7f" .. AUTHOR .. ":|r " .. tostring(self.author))
243 end
244 if self.date then
245 print(" - |cffffff7f" .. DATE .. ":|r " .. tostring(self.date))
246 end
247 if self.category then
248 local category = CATEGORIES[self.category]
249 if category then
250 print(" - |cffffff7f" .. CATEGORY .. ":|r " .. category)
251 end
252 end
253 if self.email then
254 print(" - |cffffff7f" .. EMAIL .. ":|r " .. tostring(self.email))
255 end
256 if self.website then
257 print(" - |cffffff7f" .. WEBSITE .. ":|r " .. tostring(self.website))
258 end
259 end
260  
261 local options
262 function AceAddon:GetAceOptionsDataTable(target)
263 if not options then
264 options = {
265 about = {
266 name = ABOUT,
267 desc = PRINT_ADDON_INFO,
268 type = "execute",
269 func = "PrintAddonInfo",
270 order = -1,
271 }
272 }
273 end
274 return options
275 end
276  
277 function AceAddon:PLAYER_LOGIN()
278 self.playerLoginFired = true
279 if self.addonsToOnEnable then
280 while table.getn(self.addonsToOnEnable) > 0 do
281 local addon = table.remove(self.addonsToOnEnable, 1)
282 self.addonsStarted[addon] = true
283 if (type(addon.IsActive) ~= "function" or addon:IsActive()) and (not AceModuleCore or not AceModuleCore:IsModule(addon) or AceModuleCore:IsModuleActive(addon)) then
284 local current = addon.class
285 while true do
286 if current == AceOO.Class then
287 break
288 end
289 if current.mixins then
290 for mixin in pairs(current.mixins) do
291 if type(mixin.OnEmbedEnable) == "function" then
292 mixin:OnEmbedEnable(addon)
293 end
294 end
295 end
296 current = current.super
297 end
298 if type(addon.OnEnable) == "function" then
299 addon:OnEnable()
300 end
301 end
302 end
303 self.addonsToOnEnable = nil
304 end
305 end
306  
307 function AceAddon.prototype:Inject(t)
308 AceAddon:argCheck(t, 2, "table")
309 for k,v in pairs(t) do
310 self[k] = v
311 end
312 end
313  
314 function AceAddon.prototype:init()
315 if not AceEvent then
316 error(MAJOR_VERSION .. " requires AceEvent-2.0", 4)
317 end
318 AceAddon.super.prototype.init(self)
319  
320 self.super = self.class.prototype
321  
322 AceAddon:RegisterEvent("ADDON_LOADED", "ADDON_LOADED", true)
323 table.insert(AceAddon.nextAddon, self)
324 end
325  
326 function AceAddon.prototype:ToString()
327 local x
328 if type(self.title) == "string" then
329 x = self.title
330 elseif type(self.name) == "string" then
331 x = self.name
332 else
333 x = "<" .. tostring(self.class) .. " instance>"
334 end
335 if (type(self.IsActive) == "function" and not self:IsActive()) or (AceModuleCore and AceModuleCore:IsModule(addon) and AceModuleCore:IsModuleActive(addon)) then
336 x = x .. " " .. STANDBY
337 end
338 return x
339 end
340  
341 AceAddon.new = function(self, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16, m17, m18, m19, m20)
342 local class = AceAddon:pcall(AceOO.Classpool, self, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16, m17, m18, m19, m20)
343 return class:new()
344 end
345  
346 local function external(self, major, instance)
347 if major == "AceEvent-2.0" then
348 AceEvent = instance
349  
350 AceEvent:embed(self)
351  
352 self:RegisterEvent("PLAYER_LOGIN", "PLAYER_LOGIN", true)
353 elseif major == "AceConsole-2.0" then
354 AceConsole = instance
355  
356 local slashCommands = { "/ace2" }
357 local _,_,_,enabled,loadable = GetAddOnInfo("Ace")
358 if not enabled or not loadable then
359 table.insert(slashCommands, "/ace")
360 end
361 local function listAddon(addon, depth)
362 if not depth then
363 depth = 0
364 end
365  
366 local s = string.rep(" ", depth) .. " - " .. tostring(addon)
367 if addon.version then
368 s = s .. " - |cffffff7f" .. tostring(addon.version) .. "|r"
369 end
370 if addon.slashCommand then
371 s = s .. " |cffffff7f(" .. tostring(addon.slashCommand) .. ")|r"
372 end
373 print(s)
374 if type(addon.modules) == "table" then
375 local i = 0
376 for k,v in pairs(addon.modules) do
377 i = i + 1
378 if i == 6 then
379 print(string.rep(" ", depth + 1) .. " - more...")
380 break
381 else
382 listAddon(v, depth + 1)
383 end
384 end
385 end
386 end
387 local function listNormalAddon(i)
388 local name,_,_,enabled,loadable = GetAddOnInfo(i)
389 if not loadable then
390 enabled = false
391 end
392 if self.addons[name] then
393 local addon = self.addons[name]
394 if not AceCoreAddon or not AceCoreAddon:IsModule(addon) then
395 listAddon(addon)
396 end
397 else
398 local s = " - " .. tostring(GetAddOnMetadata(i, "Title") or name)
399 local version = GetAddOnMetadata(i, "Version")
400 if version then
401 if string.find(version, "%$Revision: (%d+) %$") then
402 version = string.gsub(version, "%$Revision: (%d+) %$", "%1")
403 elseif string.find(version, "%$Rev: (%d+) %$") then
404 version = string.gsub(version, "%$Rev: (%d+) %$", "%1")
405 elseif string.find(version, "%$LastChangedRevision: (%d+) %$") then
406 version = string.gsub(version, "%$LastChangedRevision: (%d+) %$", "%1")
407 end
408 s = s .. " - |cffffff7f" .. version .. "|r"
409 end
410 if not enabled then
411 s = s .. " |cffff0000(disabled)|r"
412 end
413 if IsAddOnLoadOnDemand(i) then
414 s = s .. " |cff00ff00[LoD]|r"
415 end
416 print(s)
417 end
418 end
419 local function mySort(alpha, bravo)
420 return tostring(alpha) < tostring(bravo)
421 end
422 AceConsole.RegisterChatCommand(self, slashCommands, {
423 desc = "AddOn development framework",
424 name = "Ace2",
425 type = "group",
426 args = {
427 about = {
428 desc = "Get information about Ace2",
429 name = "About",
430 type = "execute",
431 func = function()
432 print("|cffffff7fAce2|r - |cffffff7f2.0." .. string.gsub(MINOR_VERSION, "%$Revision: (%d+) %$", "%1") .. "|r - AddOn development framework")
433 print(" - |cffffff7f" .. AUTHOR .. ":|r Ace Development Team")
434 print(" - |cffffff7f" .. WEBSITE .. ":|r http://www.wowace.com/")
435 end
436 },
437 list = {
438 desc = "List addons",
439 name = "List",
440 type = "group",
441 args = {
442 ace2 = {
443 desc = "List addons using Ace2",
444 name = "Ace2",
445 type = "execute",
446 func = function()
447 print("|cffffff7fAddon list:|r")
448 local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0")
449 table.sort(self.addons, mySort)
450 for _,v in ipairs(self.addons) do
451 if not AceCoreAddon or not AceCoreAddon:IsModule(v) then
452 listAddon(v)
453 end
454 end
455 end
456 },
457 all = {
458 desc = "List all addons",
459 name = "All",
460 type = "execute",
461 func = function()
462 print("|cffffff7fAddon list:|r")
463 local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0")
464 local count = GetNumAddOns()
465 for i = 1, count do
466 listNormalAddon(i)
467 end
468 end
469 },
470 enabled = {
471 desc = "List all enabled addons",
472 name = "Enabled",
473 type = "execute",
474 func = function()
475 print("|cffffff7fAddon list:|r")
476 local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0")
477 local count = GetNumAddOns()
478 for i = 1, count do
479 local _,_,_,enabled,loadable = GetAddOnInfo(i)
480 if enabled and loadable then
481 listNormalAddon(i)
482 end
483 end
484 end
485 },
486 disabled = {
487 desc = "List all disabled addons",
488 name = "Disabled",
489 type = "execute",
490 func = function()
491 print("|cffffff7fAddon list:|r")
492 local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0")
493 local count = GetNumAddOns()
494 for i = 1, count do
495 local _,_,_,enabled,loadable = GetAddOnInfo(i)
496 if not enabled or not loadable then
497 listNormalAddon(i)
498 end
499 end
500 end
501 },
502 lod = {
503 desc = "List all LoadOnDemand addons",
504 name = "LoadOnDemand",
505 type = "execute",
506 func = function()
507 print("|cffffff7fAddon list:|r")
508 local AceCoreAddon = AceLibrary:HasInstance("AceCoreAddon-2.0") and AceLibrary("AceCoreAddon-2.0")
509 local count = GetNumAddOns()
510 for i = 1, count do
511 if IsAddOnLoadOnDemand(i) then
512 listNormalAddon(i)
513 end
514 end
515 end
516 },
517 ace1 = {
518 desc = "List all addons using Ace1",
519 name = "Ace 1.x",
520 type = "execute",
521 func = function()
522 print("|cffffff7fAddon list:|r")
523 local count = GetNumAddOns()
524 for i = 1, count do
525 local dep1, dep2, dep3, dep4 = GetAddOnDependencies(i)
526 if dep1 == "Ace" or dep2 == "Ace" or dep3 == "Ace" or dep4 == "Ace" then
527 listNormalAddon(i)
528 end
529 end
530 end
531 },
532 libs = {
533 desc = "List all libraries using AceLibrary",
534 name = "Libraries",
535 type = "execute",
536 func = function()
537 if type(AceLibrary) == "table" and type(AceLibrary.libs) == "table" then
538 print("|cffffff7fLibrary list:|r")
539 for name, data in pairs(AceLibrary.libs) do
540 local s
541 if data.minor then
542 s = " - " .. tostring(name) .. "." .. tostring(data.minor)
543 else
544 s = " - " .. tostring(name)
545 end
546 if AceLibrary(name).slashCommand then
547 s = s .. " |cffffff7f(" .. tostring(AceLibrary(name).slashCommand) .. "|cffffff7f)"
548 end
549 print(s)
550 end
551 end
552 end
553 },
554 search = {
555 desc = "Search by name",
556 name = "Search",
557 type = "text",
558 usage = "<keyword>",
559 input = true,
560 get = false,
561 set = function(...)
562 for i,v in ipairs(arg) do
563 arg[i] = string.lower(string.gsub(string.gsub(v, '%*', '.*'), '%%', '%%%%'))
564 end
565 local count = GetNumAddOns()
566 for i = 1, count do
567 local name = GetAddOnInfo(i)
568 local good = true
569 for _,v in ipairs(arg) do
570 if not string.find(string.lower(name), v) then
571 good = false
572 break
573 end
574 end
575 if good then
576 listNormalAddon(i)
577 end
578 end
579 end
580 }
581 },
582 },
583 enable = {
584 desc = "Enable addon",
585 name = "Enable",
586 type = "text",
587 usage = "<addon>",
588 get = false,
589 set = function(text)
590 local name,title,_,_,_,reason = GetAddOnInfo(text)
591 if reason == "MISSING" then
592 print(string.format("|cffffff7fAce2:|r AddOn %q does not exist", text))
593 else
594 EnableAddOn(text)
595 print(string.format("|cffffff7fAce2:|r %s is now enabled", title or name))
596 end
597 end,
598 },
599 disable = {
600 desc = "Disable addon",
601 name = "Disable",
602 type = "text",
603 usage = "<addon>",
604 get = false,
605 set = function(text)
606 local name,title,_,_,_,reason = GetAddOnInfo(text)
607 if reason == "MISSING" then
608 print(string.format("|cffffff7fAce2:|r AddOn %q does not exist", text))
609 else
610 DisableAddOn(text)
611 print(string.format("|cffffff7fAce2:|r %s is now disabled", title or name))
612 end
613 end,
614 },
615 load = {
616 desc = "Load addon",
617 name = "Load",
618 type = "text",
619 usage = "<addon>",
620 get = false,
621 set = function(text)
622 local name,title,_,_,loadable,reason = GetAddOnInfo(text)
623 if reason == "MISSING" then
624 print(string.format("|cffffff7fAce2:|r AddOn %q does not exist.", text))
625 elseif not loadable then
626 print(string.format("|cffffff7fAce2:|r AddOn %q is not loadable. Reason: %s", text, reason))
627 else
628 LoadAddOn(text)
629 print(string.format("|cffffff7fAce2:|r %s is now loaded", title or name))
630 end
631 end
632 },
633 info = {
634 desc = "Display information",
635 name = "Information",
636 type = "execute",
637 func = function()
638 local mem, threshold = gcinfo()
639 print(string.format(" - |cffffff7fMemory usage [|r%.3f MiB|cffffff7f]|r", mem / 1024))
640 print(string.format(" - |cffffff7fThreshold [|r%.3f MiB|cffffff7f]|r", threshold / 1024))
641 print(string.format(" - |cffffff7fFramerate [|r%.0f fps|cffffff7f]|r", GetFramerate()))
642 local bandwidthIn, bandwidthOut, latency = GetNetStats()
643 bandwidthIn, bandwidthOut = floor(bandwidthIn * 1024), floor(bandwidthOut * 1024)
644 print(string.format(" - |cffffff7fLatency [|r%.0f ms|cffffff7f]|r", latency))
645 print(string.format(" - |cffffff7fBandwidth in [|r%.0f B/s|cffffff7f]|r", bandwidthIn))
646 print(string.format(" - |cffffff7fBandwidth out [|r%.0f B/s|cffffff7f]|r", bandwidthOut))
647 print(string.format(" - |cffffff7fTotal addons [|r%d|cffffff7f]|r", GetNumAddOns()))
648 print(string.format(" - |cffffff7fAce2 addons [|r%d|cffffff7f]|r", table.getn(self.addons)))
649 local ace = 0
650 local enabled = 0
651 local disabled = 0
652 local lod = 0
653 for i = 1, GetNumAddOns() do
654 local dep1, dep2, dep3, dep4 = GetAddOnDependencies(i)
655 if dep1 == "Ace" or dep2 == "Ace" or dep3 == "Ace" or dep4 == "Ace" then
656 ace = ace + 1
657 end
658 if IsAddOnLoadOnDemand(i) then
659 lod = lod + 1
660 end
661 local _,_,_,IsActive,loadable = GetAddOnInfo(i)
662 if not IsActive or not loadable then
663 disabled = disabled + 1
664 else
665 enabled = enabled + 1
666 end
667 end
668 print(string.format(" - |cffffff7fAce 1.x addons [|r%d|cffffff7f]|r", ace))
669 print(string.format(" - |cffffff7fLoadOnDemand addons [|r%d|cffffff7f]|r", lod))
670 print(string.format(" - |cffffff7fenabled addons [|r%d|cffffff7f]|r", enabled))
671 print(string.format(" - |cffffff7fdisabled addons [|r%d|cffffff7f]|r", disabled))
672 local libs = 0
673 if type(AceLibrary) == "table" and type(AceLibrary.libs) == "table" then
674 for _ in pairs(AceLibrary.libs) do
675 libs = libs + 1
676 end
677 end
678 print(string.format(" - |cffffff7fAceLibrary instances [|r%d|cffffff7f]|r", libs))
679 end
680 }
681 }
682 })
683 elseif major == "AceModuleCore-2.0" then
684 AceModuleCore = instance
685 end
686 end
687  
688 local function activate(self, oldLib, oldDeactivate)
689 AceAddon = self
690  
691 if oldLib then
692 self.playerLoginFired = oldLib.playerLoginFired or DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.defaultLanguage
693 self.addonsToOnEnable = oldLib.addonsToOnEnable
694 self.addons = oldLib.addons
695 self.nextAddon = oldLib.nextAddon
696 self.addonsStarted = oldLib.addonsStarted
697 end
698 if not self.addons then
699 self.addons = {}
700 end
701 if not self.nextAddon then
702 self.nextAddon = {}
703 end
704 if not self.addonsStarted then
705 self.addonsStarted = {}
706 end
707 if oldDeactivate then
708 oldDeactivate(oldLib)
709 end
710 end
711  
712 AceLibrary:Register(AceAddon, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)
713 AceAddon = AceLibrary(MAJOR_VERSION)