Quantcast

Fixed an issue when viewing linked trade skills.

Paul Schifferer [12-12-10 - 23:52]
Fixed an issue when viewing linked trade skills.
Fixed button display for linked and guild trade skills.
Filename
CauldronMainUI.lua
CauldronTradeskill.lua
Locale/Cauldron-enUS.lua
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index b4ae009..316b0be 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -25,7 +25,7 @@ self:debug("frame show: "..tostring(CauldronQueueWindowFrame));
 		CauldronFrameTitleText:SetText(L["Cauldron"].." "..Cauldron.version);

 		-- show queue UI
-		if Cauldron.vars.showQueue then
+		if Cauldron.vars.showQueue and not(IsTradeSkillLinked() or IsTradeSkillGuild()) then
 			ShowUIPanel(CauldronQueueWindowFrame);
 			SetPortraitToTexture(CauldronQueueWindowFramePortrait, GetTradeSkillTexture());
 			CauldronQueueWindowFrameTitleText:SetText(L["Queue"]);
@@ -84,7 +84,7 @@ function Cauldron:Frame_Hide()
  	end
  	--]]

- 	CloseTradeSkill();
+-- 	CloseTradeSkill();

 end

@@ -145,22 +145,37 @@ function Cauldron:Frame_Update()
 end

 function Cauldron:UpdateSkillInfo(skillName, rank, maxRank)
-	--@alpha@
-	self:debug("UpdateSkillInfo enter");
-	--@end-alpha@

+	if IsTradeSkillGuild() then
+		CauldronRankFrame:Hide();
+		CauldronLinkFrame:Hide();
+	else
+		CauldronRankFrame:Show();
+		CauldronLinkFrame:Show();
+	end
+
 	local skillCount = Cauldron:GetSkillCount(skillName);
 --[==[
 	CauldronRankFrameSkillName:SetText(skillName.." ("..skillCount.." "..L["skills"]..")");
 --]==]
 	CauldronSkillNameText:SetText(skillName);
-		local prof_title = "";
+	local prof_title = "";
+	if IsTradeSkillGuild() then
+		prof_title = L["Guild"];
+	else
 		for i=1,#PROFESSION_RANKS do
-		    local value,title = PROFESSION_RANKS[i][1], PROFESSION_RANKS[i][2];
+			local value,title = PROFESSION_RANKS[i][1], PROFESSION_RANKS[i][2];
 			if maxRank < value then break end
 			prof_title = title;
 		end
-	CauldronRankInfoText:SetText(prof_title..", "..skillCount.." "..L["skills"]);
+	end
+	local linked, linkedName = IsTradeSkillLinked();
+	if linked then
+		linkedName = "["..linkedName.."] ";
+	else
+		linkedName = "";
+	end
+	CauldronRankInfoText:SetText(linkedName..prof_title..", "..skillCount.." "..L["skills"]);

 	CauldronRankFrame:SetStatusBarColor(0.0, 0.0, 1.0, 0.5);
 	CauldronRankFrameBackground:SetVertexColor(0.0, 0.0, 0.75, 0.5);
@@ -592,32 +607,32 @@ end

 function Cauldron:UpdateButtons()

-	if IsTradeSkillLinked() then
-		CauldronQueueAllButton:Disable();
-		CauldronQueueButton:Disable();
-		-- CauldronAmountDecrementButton:Hide();
-		-- CauldronAmountInputBox:Hide();
-		-- CauldronAmountIncrementButton:Hide();
-		-- CauldronCreateAllButton:Hide();
-		-- CauldronCreateButton:Hide();
-		CauldronProcessButton:Disable();
+	if IsTradeSkillLinked() or IsTradeSkillGuild() then
+		CauldronQueueAllButton:Hide();
+		CauldronQueueButton:Hide();
+		CauldronDecrementButton:Hide();
+		CauldronInputBox:Hide();
+		CauldronIncrementButton:Hide();
+		CauldronCreateAllButton:Hide();
+		CauldronCreateButton:Hide();
+		-- CauldronProcessButton:Disable();
 		-- CauldronClearQueueButton:();
+		CauldronShowQueueButton:Hide();
 		return;
 	end

-		CauldronQueueAllButton:Enable();
-		CauldronQueueButton:Enable();
-		-- CauldronAmountDecrementButton:Show();
-		-- CauldronAmountInputBox:Show();
-		-- CauldronAmountIncrementButton:Show();
-		-- CauldronCreateAllButton:Show();
-		-- CauldronCreateButton:Show();
-		-- CauldronProcessButton:();
-		-- CauldronClearQueueButton:Show();
-
+	CauldronQueueAllButton:Show();
+	CauldronQueueButton:Show();
+	CauldronDecrementButton:Show();
+	CauldronInputBox:Show();
+	CauldronIncrementButton:Show();
+	CauldronCreateAllButton:Show();
+	CauldronCreateButton:Show();
+	-- CauldronProcessButton:();
+	-- CauldronClearQueueButton:Show();
+
 	local skillInfo = Cauldron:GetSelectedSkill();

---[[
 	if skillInfo then
 		CauldronCreateButton:SetText(skillInfo.verb or CREATE);
 		if skillInfo.verb then
@@ -627,9 +642,7 @@ function Cauldron:UpdateButtons()
 		CauldronQueueAllButton:Enable();
 		CauldronQueueButton:Enable();

-		CauldronCreateButton:Show();
-
-		if skillInfo.available ~= 0 then
+		if skillInfo.available > 0 then
 			CauldronCreateAllButton:Enable();
 			CauldronCreateButton:Enable();
 		else
@@ -642,8 +655,8 @@ function Cauldron:UpdateButtons()
 		CauldronCreateAllButton:Disable();
 		CauldronCreateButton:Disable();
 	end
---]]

+--[[
 	if not IsTradeSkillLinked() then
 		if #CauldronQueue:GetItems(self.db.realm.userdata[self.vars.playername].queue, CURRENT_TRADESKILL) > 0 then
 			CauldronProcessButton:Enable();
@@ -653,7 +666,8 @@ function Cauldron:UpdateButtons()
 			CauldronClearQueueButton:Disable();
 		end
 	end
-
+--]]
+
 	if CauldronQueueWindowFrame:IsShown() then
 		CauldronShowQueueButton:Hide();
 	else
@@ -1886,7 +1900,7 @@ function CauldronLinkDropDown_Init(self, level)

 	info = UIDropDownMenu_CreateInfo();
 	info.notCheckable = true;
-	info.func = CauldronLinkDropDown_LinkPost
+	info.func = CauldronLinkDropDown_LinkPost;

 	info.text = GUILD;
 	info.arg1 = SLASH_GUILD1;
@@ -1908,12 +1922,12 @@ function CauldronLinkDropDown_Init(self, level)

 	info.disabled = false
 	local name;
-	local chanels = {GetChannelList()};
-	local channelCount = #chanels/2;
+	local channels = {GetChannelList()};
+	local channelCount = #channels/2;
 	for i=1, MAX_CHANNEL_BUTTONS, 1 do
 		if ( i <= channelCount) then
-			info.text = chanels[i*2];
-			info.arg1 = "/"..chanels[(i-1)*2 + 1];
+			info.text = channels[i*2];
+			info.arg1 = "/"..channels[(i-1)*2 + 1];
 			UIDropDownMenu_AddButton(info);
 		end
 	end
diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua
index da30155..db52a4c 100644
--- a/CauldronTradeskill.lua
+++ b/CauldronTradeskill.lua
@@ -12,6 +12,9 @@ function Cauldron:NeedsSkillUpdate()
 		return false;
 	end
 	local skillName = CURRENT_TRADESKILL;
+	if IsTradeSkillLinked() then
+		skillName = "Linked-"..skillName;
+	end

 	-- initialize the trade skill entry
 	if not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName] then
@@ -424,9 +427,9 @@ function Cauldron:GetSkillCount(skillName)

 	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
+	if (Cauldron.db.realm.userdata[Cauldron.vars.playername]) and
+	   (Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName]) then
+		for _, _ in pairs(Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].recipes) do
 			skillCount = skillCount + 1;
 		end
 	end
diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index b1aefcc..de3eb62 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -36,6 +36,7 @@ L["Queue"] = true
 L["Queue All"] = true
 L["Process"] = true
 L["Clear Queue"] = true
+L["Guild"] = true

 L["General"] = true
 L["Auto-open shopping list?"] = true