From 32f299a7dcca06800429a87512a8ac17aba00294 Mon Sep 17 00:00:00 2001 From: pschifferer Date: Thu, 22 Jan 2009 22:18:13 +0000 Subject: [PATCH] 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. --- Cauldron/CauldronMain.lua | 12 ++++++------ Cauldron/CauldronMain.xml | 6 +++--- Cauldron/CauldronMainUI.lua | 16 ++++++---------- Cauldron/CauldronQueue.lua | 11 ++++++----- 4 files changed, 21 insertions(+), 24 deletions(-) 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 of this skill that must be executed ["priority"] = , -- priority of the skill, for ordering in the queue ["icon"] = "", -- the icon path of the skill, for display - ["index"] = , -- the index of the skill, for API call usage + ["skillIndex"] = , -- the index of the skill, for API call usage + ["reagentIndex"] = , -- the index of the reagent, for API call usage }, }, ["main"] = { @@ -590,7 +590,7 @@ end ["amount"] = , ["priority"] = , ["icon"] = "", - ["index"] = , + ["skillIndex"] = , }, }, ["reagents"] = { @@ -598,9 +598,9 @@ end ["tradeskill"] = "", ["name"] = "", ["amount"] = , - ["index"] = , -- the index of the reagent, for API call usage ["icon"] = "", ["skillIndex"] = , + ["reagentIndex"] = , -- 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 @@ GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT"); - GameTooltip:SetTradeSkillItem(self.skillIndex, self:reagentIndex); + GameTooltip:SetTradeSkillItem(self.skillIndex, self.reagentIndex); CursorUpdate(self); @@ -41,7 +41,7 @@ CursorOnUpdate(self); - -- HandleModifiedItemClick(GetTradeSkillReagentItemLink(TradeSkillFrame.selectedSkill, self:GetID())); + HandleModifiedItemClick(GetTradeSkillReagentItemLink(self.skillIndex, self.reagentIndex)); @@ -341,7 +341,7 @@ -- self.hasItem = 1; - -- HandleModifiedItemClick(GetTradeSkillItemLink(TradeSkillFrame.selectedSkill)); + HandleModifiedItemClick(GetTradeSkillItemLink(self.skillIndex, self.reagentIndex)); 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 -- 1.7.9.5