changeset 19:f7b23db7bcc6

Correct tooltips for external tradeskills like milling
author contrebasse
date Fri, 08 Apr 2011 19:58:08 +0200
parents c37c2a46723c
children 4ea38bae4174
files ReagentMaker.lua SecureMenu.lua
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ReagentMaker.lua	Fri Apr 08 19:24:22 2011 +0200
+++ b/ReagentMaker.lua	Fri Apr 08 19:58:08 2011 +0200
@@ -208,14 +208,15 @@
 	end
 
 	-- Tooltips
-	local reagentIndex = A.findSkillIndex(reagentID)
-	if reagentIndex then
+	local link
+	if A.data[reagentID].spell then
+		link = GetSpellLink(A.data[reagentID].spellID)
+	else
+		link = GetTradeSkillRecipeLink(A.findSkillIndex(reagentID))
+	end
+	if link then
 		A.tooltipRecipe:SetOwner(btn)
-		if A.data[reagentID].spell then
-			A.tooltipRecipe:SetHyperlink(GetSpellLink(A.data[reagentID].spellID))
-		else
-			A.tooltipRecipe:SetHyperlink(GetTradeSkillRecipeLink(reagentIndex))
-		end
+		A.tooltipRecipe:SetHyperlink(link)
 		A.tooltipRecipe:Show()
 		A.tooltipRecipe:ClearAllPoints()
 		--A.tooltipRecipe:SetPoint("TOPLEFT",btn,"TOPRIGHT")
--- a/SecureMenu.lua	Fri Apr 08 19:24:22 2011 +0200
+++ b/SecureMenu.lua	Fri Apr 08 19:58:08 2011 +0200
@@ -10,12 +10,15 @@
 tinsert(UISpecialFrames,"ReagentMaker_ExternalFrame") -- make it closable with escape
 
 MenuFrame:SetScript("OnEvent",function(self,event,...)
-	if event == "TRADE_SKILL_CLOSE" or event == "PLAYER_REGEN_DISABLED" then
+	if event == "TRADE_SKILL_UPDATE" then
+		MenuFrame.updateCounts()
+	elseif event == "TRADE_SKILL_CLOSE" or event == "PLAYER_REGEN_DISABLED" then
 		MenuFrame:Hide()
 	end
 end)
 MenuFrame:RegisterEvent("TRADE_SKILL_CLOSE")
 MenuFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
+MenuFrame:RegisterEvent("TRADE_SKILL_UPDATE")
 A.MenuFrame = MenuFrame
 
 -- Background adaptable vertically
@@ -153,7 +156,7 @@
 	action(itemID,reagentIndex,IsShiftKeyDown())
 end
 
-local function updateCounts()
+function MenuFrame.updateCounts()
 	local anyMakable
 	for i=1,numActiveEntries do
 		btn = menuEntries[i]
@@ -285,7 +288,7 @@
 	MenuFrame:ClearAllPoints()
 	MenuFrame:SetPoint("TOPLEFT",TradeSkillFrame,"TOPRIGHT",-2,14)
 
-	updateCounts()
+	MenuFrame.updateCounts()
 
 	MenuFrame:Show()
 end