Quantcast

Fixed an issue where the skill list wasn't updating when learning a new glyph.

pschifferer [01-22-09 - 22:18]
Fixed an issue where the skill list wasn't updating when learning a new glyph.
Fixed an issue with skill item and reagent tooltips not showing the correct item, any item, or throwing an error.
Filename
Cauldron/CauldronMain.lua
Cauldron/CauldronMain.xml
Cauldron/CauldronMainUI.lua
Cauldron/CauldronQueue.lua
diff --git a/Cauldron/CauldronMain.lua b/Cauldron/CauldronMain.lua
index f6d31a2..4e36071 100644
--- a/Cauldron/CauldronMain.lua
+++ b/Cauldron/CauldronMain.lua
@@ -97,8 +97,9 @@ function Cauldron:OnEnable()
 	self:debug("OnEnable enter");

 	self:InitPlayer();
+
 	self:RegisterEvent("TRADE_SKILL_SHOW", "OnTradeShow");
-	self:RegisterEvent("TRADE_SKILL_UPDATE", "OnTradeUpdate");
+	self:RegisterEvent("TRADE_SKILL_UPDATE", "OnSkillUpdate");
 	self:RegisterEvent("TRADE_SKILL_CLOSE", "OnTradeClose");
 	self:RegisterEvent("SKILL_LINES_CHANGED", "OnSkillUpdate");
 	self:RegisterEvent("ADDON_LOADED", "OnAddonLoaded");
@@ -117,8 +118,6 @@ function Cauldron:OnEnable()
 --	self:RegisterEvent("PLAYER_REGEN_ENABLED");
 --	self:RegisterEvent("AUCTION_HOUSE_CLOSED");
 --	self:RegisterEvent("AUCTION_HOUSE_SHOW");
-	self:RegisterEvent("CRAFT_SHOW", "OnCraftShow");
-	self:RegisterEvent("CRAFT_CLOSE", "OnCraftClose");
 --	self:RegisterEvent("PLAYER_LOGOUT");
 	self:RegisterEvent("UI_ERROR_MESSAGE", "OnError");
 	self:HookTooltips();
@@ -580,7 +579,8 @@ end
 						["amount"] = <amount>, -- amount of this skill that must be executed
 						["priority"] = <priority>, -- priority of the skill, for ordering in the queue
 						["icon"] = "<icon>", -- the icon path of the skill, for display
-						["index"] = <skill index>, -- the index of the skill, for API call usage
+						["skillIndex"] = <skill index>, -- the index of the skill, for API call usage
+						["reagentIndex"] = <reagent index>, -- the index of the reagent, for API call usage
 					},
 				},
 				["main"] = {
@@ -590,7 +590,7 @@ end
 						["amount"] = <amount>,
 						["priority"] = <priority>,
 						["icon"] = "<icon>",
-						["index"] = <skill index>,
+						["skillIndex"] = <skill index>,
 					},
 				},
 				["reagents"] = {
@@ -598,9 +598,9 @@ end
 						["tradeskill"] = "<tradeskill>",
 						["name"] = "<reagent>",
 						["amount"] = <amount>,
-						["index"] = <reagent index>, -- the index of the reagent, for API call usage
 						["icon"] = "<icon>",
 						["skillIndex"] = <skill index>,
+						["reagentIndex"] = <reagent index>, -- the index of the reagent, for API call usage
 					},
 				},
 			},
diff --git a/Cauldron/CauldronMain.xml b/Cauldron/CauldronMain.xml
index c64bccc..3351691 100644
--- a/Cauldron/CauldronMain.xml
+++ b/Cauldron/CauldronMain.xml
@@ -30,7 +30,7 @@
 		<Scripts>
 			<OnEnter>
 				GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT");
-				GameTooltip:SetTradeSkillItem(self.skillIndex, self:reagentIndex);
+				GameTooltip:SetTradeSkillItem(self.skillIndex, self.reagentIndex);
 				CursorUpdate(self);
 			</OnEnter>
 			<OnLeave>
@@ -41,7 +41,7 @@
 				CursorOnUpdate(self);
 			</OnUpdate>
 			<OnClick>
-				-- HandleModifiedItemClick(GetTradeSkillReagentItemLink(TradeSkillFrame.selectedSkill, self:GetID()));
+				HandleModifiedItemClick(GetTradeSkillReagentItemLink(self.skillIndex, self.reagentIndex));
 			</OnClick>
 		</Scripts>
 	</Button>
@@ -341,7 +341,7 @@
 						-- self.hasItem = 1;
 					</OnLoad>
 					<OnClick>
-						-- HandleModifiedItemClick(GetTradeSkillItemLink(TradeSkillFrame.selectedSkill));
+						HandleModifiedItemClick(GetTradeSkillItemLink(self.skillIndex, self.reagentIndex));
 					</OnClick>
 					<OnEnter>
 						GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
diff --git a/Cauldron/CauldronMainUI.lua b/Cauldron/CauldronMainUI.lua
index f461f27..ce83b46 100644
--- a/Cauldron/CauldronMainUI.lua
+++ b/Cauldron/CauldronMainUI.lua
@@ -560,9 +560,8 @@ function Cauldron:UpdateQueue()
 		-- set the icon
 		frame = _G["CauldronQueueItem"..i.."Icon"];
 		frame:SetNormalTexture(queueInfo.icon);
-		if skillInfo then
-			frame.skillIndex = skillInfo.index;
-		end
+		frame.skillIndex = queueInfo.skillIndex;
+		frame.reagentIndex = nil;

 		-- set the amount
 		frame = _G["CauldronQueueItem"..i.."IconCount"];
@@ -695,9 +694,8 @@ function Cauldron:UpdateQueue()
 			-- set the icon
 			frame = _G["CauldronQueueIntItem"..i.."Icon"];
 			frame:SetNormalTexture(queueInfo.icon);
-			if skillInfo then
-				frame.skillIndex = skillInfo.index;
-			end
+			frame.skillIndex = queueInfo.skillIndex;
+			frame.reagentIndex = queueInfo.reagentIndex;

 			-- set the amount
 			frame = _G["CauldronQueueIntItem"..i.."IconCount"];
@@ -814,10 +812,8 @@ function Cauldron:UpdateQueue()
 		-- set the icon
 		frame = _G["CauldronQueueReagentItem"..i.."Icon"];
 		frame:SetNormalTexture(queueInfo.icon);
-		if skillInfo then
-			frame.skillIndex = queueInfo.skillIndex;
-			frame.reagentIndex = queueInfo.index;
-		end
+		frame.skillIndex = queueInfo.skillIndex;
+		frame.reagentIndex = queueInfo.reagentIndex;
 --		local playerReagentCount = 0; -- TODO
 --		if playerReagentCount < queueInfo.amount then
 --			frame:SetVertexColor(0.5, 0.5, 0.5, 1.0);
diff --git a/Cauldron/CauldronQueue.lua b/Cauldron/CauldronQueue.lua
index ec01e06..ee2573a 100644
--- a/Cauldron/CauldronQueue.lua
+++ b/Cauldron/CauldronQueue.lua
@@ -36,13 +36,14 @@ function CauldronQueue:NewQueue()
 	return queue;
 end

-function CauldronQueue:NewItem(name, icon, tradeskill, index, amount, priority)
+function CauldronQueue:NewItem(name, icon, tradeskill, index, amount, priority, reagentIndex)

 	local queueItem = {
 		["name"] = name or "",
 		["icon"] = icon or "",
 		["tradeskill"] = tradeskill or "",
-		["index"] = index,
+		["skillIndex"] = index,
+		["reagentIndex"] = reagentIndex,
 		["amount"] = amount or 1,
 		["priority"] = priority or 0,
 	};
@@ -50,7 +51,7 @@ function CauldronQueue:NewItem(name, icon, tradeskill, index, amount, priority)
 	return queueItem;
 end

-function CauldronQueue:NewReagent(name, icon, amount, tradeskill, index, skillIndex)
+function CauldronQueue:NewReagent(name, icon, amount, tradeskill, reagentIndex, skillIndex)

 	local reagent = {
 		["name"] = name or "",
@@ -58,7 +59,7 @@ function CauldronQueue:NewReagent(name, icon, amount, tradeskill, index, skillIn
 		["amount"] = amount or 1,
 		["tradeskill"] = tradeskill,
 		["skillIndex"] = skillIndex,
-		["index"] = index,
+		["reagentIndex"] = reagentIndex,
 	};

 	return reagent;
@@ -270,7 +271,7 @@ function CauldronQueue:AddIntermediate(queue, reagent, amount)
 		local skillInfo = Cauldron:GetSkillInfoForItem(reagent.name);

 		-- it's not there, so create a new instance
-		queue.intermediate[reagent.name] = CauldronQueue:NewItem(reagent.name, reagent.icon, skillInfo.tradeskill, skillInfo.index, amount);
+		queue.intermediate[reagent.name] = CauldronQueue:NewItem(reagent.name, reagent.icon, skillInfo.tradeskill, skillInfo.index, amount, reagent.index);
 	end

 end