Quantcast

Made some tweaks and added some globally-available functions to support LilSparkys Workshop.

pschifferer [04-09-10 - 05:37]
Made some tweaks and added some globally-available functions to support LilSparkys Workshop.
Filename
CauldronMainUI.lua
CauldronTradeskill.lua
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index 42a8dd7..d971ec4 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -7,6 +7,10 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Cauldron")

 local SLOT_NONE = "none";

+function CauldronFrame_Show()
+	Cauldron:Frame_Show();
+end
+
 function Cauldron:Frame_Show()

 	if Cauldron.vars.enabled and not(IsShiftKeyDown() and IsControlKeyDown()) then
@@ -85,6 +89,10 @@ function Cauldron:Frame_Toggle()

 end

+function CauldronFrame_Update()
+	Cauldron:Frame_Update();
+end
+
 function Cauldron:Frame_Update()

 	local numTradeSkills = GetNumTradeSkills();
@@ -136,13 +144,7 @@ function Cauldron:UpdateSkillInfo(skillName, rank, maxRank)
 	self:debug("UpdateSkillInfo enter");
 	--@end-alpha@

-	local skillCount = 0;
-	if (self.db.realm.userdata[self.vars.playername]) and
-	   (self.db.realm.userdata[self.vars.playername].skills[skillName]) then
-		for _, _ in pairs(self.db.realm.userdata[self.vars.playername].skills[skillName].recipes) do
-			skillCount = skillCount + 1;
-		end
-	end
+	local skillCount = Cauldron:GetSkillCount(skillName);
 	CauldronRankFrameSkillName:SetText(skillName.." ("..skillCount.." "..L["skills"]..")");

 	CauldronRankFrame:SetStatusBarColor(0.0, 0.0, 1.0, 0.5);
diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua
index 6aca034..aeeb2d3 100644
--- a/CauldronTradeskill.lua
+++ b/CauldronTradeskill.lua
@@ -310,7 +310,6 @@ end
 --]]

 function Cauldron:GetSlots(player, skillName)
-	self:debug("GetSlots enter");

 	local slots = {};

@@ -327,6 +326,28 @@ function Cauldron:GetSlots(player, skillName)
 	return slots;
 end

+function Cauldron:GetSkillCount(skillName)
+
+	if not skillName then
+		skillName = CURRENT_TRADESKILL;
+	end
+	if not skillName then
+		-- still couldn't get a skill name, so return 0
+		return 0;
+	end
+
+	local skillCount = 0;
+
+	if (self.db.realm.userdata[self.vars.playername]) and
+	   (self.db.realm.userdata[self.vars.playername].skills[skillName]) then
+		for _, _ in pairs(self.db.realm.userdata[self.vars.playername].skills[skillName].recipes) do
+			skillCount = skillCount + 1;
+		end
+	end
+
+	return skillCount;
+end
+
 function Cauldron:GetSkillList(playername, skillName)
 	self:debug("GetSkillList enter");