Quantcast

Fix to make PeriodicTable get initialized properly if there isn't another addon that already does it.

pschifferer [01-25-09 - 23:55]
Fix to make PeriodicTable get initialized properly if there isn't another addon that already does it.
Filename
Cauldron.toc
CauldronMain.lua
diff --git a/Cauldron.toc b/Cauldron.toc
index 41f2573..e48f370 100755
--- a/Cauldron.toc
+++ b/Cauldron.toc
@@ -4,18 +4,14 @@
 ## Author: Caendra of Silver Hand
 ## Notes: An improved interface for your trade skills
 ## RequiredDeps:
-## OptionalDeps: Ace3, LibStub, LibDataBroker-1.1
+## OptionalDeps: Ace3, LibStub, LibDataBroker-1.1, LibPeriodicTable-3.1
 ## SavedVariables: CauldronDB
 ## SavedVariablesPerCharacter:
 ## DefaultState: enabled
 ## X-Name: Cauldron
 ## X-Category: Tradeskill
 ## X-eMail: dm AT critical DASH failure DOT org
-## X-Curse-Packaged-Version: r220
-## X-Curse-Packaged-Version: r27
-## X-Curse-Project-Name: Cauldron
-## X-Curse-Project-ID: cauldron
-## X-Curse-Repository-ID: wow/cauldron/mainline
+## X-Embeds: Ace3, LibPeriodicTable-3.1

 #@no-lib-strip@
 #### List of embedded libraries
diff --git a/CauldronMain.lua b/CauldronMain.lua
index 569c1f8..f438bc7 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -68,7 +68,19 @@ function Cauldron:OnInitialize()
 	}

 	-- register slash command with options
-	LibStub("AceConfig-3.0"):RegisterOptionsTable("Cauldron", options, {"cauldron"})
+	LibStub("AceConfig-3.0"):RegisterOptionsTable("Cauldron", options, {"cauldron"});
+
+	-- initialize PT
+	for i=1,GetNumAddOns() do
+		local metadata = GetAddOnMetadata(i, "X-PeriodicTable-3.0-Module");
+		if metadata then
+			local name, _, _, enabled = GetAddOnInfo(i);
+			if enabled then
+				LoadAddOn(name);
+			end
+		end
+	end
+	collectgarbage();

 	-- let the user know the addon is loaded
 	self:Print(L["Cauldron loaded; version "],Cauldron.version);