diff SecureMenu.lua @ 31:22fa64c9b2de

Store spellLink instead of spellID
author contrebasse
date Thu, 28 Apr 2011 21:43:06 +0200
parents 15123d11fc64
children 416c307fd00b
line wrap: on
line diff
--- a/SecureMenu.lua	Thu Apr 28 20:31:25 2011 +0200
+++ b/SecureMenu.lua	Thu Apr 28 21:43:06 2011 +0200
@@ -93,15 +93,12 @@
 	GameTooltip:SetOwner(btn,"ANCHOR_LEFT")
 	GameTooltip:SetHyperlink(btn.reagentLink)
 	GameTooltip:Show()
-	if btn.spellID then
-		local link = GetSpellLink(btn.spellID)
-		if link then
-			A.tooltipRecipe:SetOwner(GameTooltip)
-			A.tooltipRecipe:SetHyperlink(link)
-			A.tooltipRecipe:Show()
-			A.tooltipRecipe:ClearAllPoints()
-			A.tooltipRecipe:SetPoint("TOPRIGHT",GameTooltip,"BOTTOMRIGHT")
-		end
+	if btn.spellLink then
+		A.tooltipRecipe:SetOwner(GameTooltip)
+		A.tooltipRecipe:SetHyperlink(btn.spellLink)
+		A.tooltipRecipe:Show()
+		A.tooltipRecipe:ClearAllPoints()
+		A.tooltipRecipe:SetPoint("TOPRIGHT",GameTooltip,"BOTTOMRIGHT")
 	end
 end
 local function btnLeft(btn)
@@ -206,7 +203,7 @@
 	end
 end
 
-local function menuAddItem(action,itemID,reagent,spellID)
+local function menuAddItem(action,itemID,reagent,spellLink)
 	local btn
 	-- Create a button only if necessary
 	if numActiveEntries >= #menuEntries then
@@ -247,7 +244,7 @@
 	btn.reagentID = reagent[1]
 	btn.reagentLink = link
 	btn.reagentsForOneRecipe = reagent[2]
-	btn.spellID = spellID
+	btn.spellLink = spellLink
 
 	-- Set action
 	if type(action)=="function" then
@@ -295,7 +292,7 @@
 	for _,reagent in ipairs(A.data[itemID]) do
 		if A.data[itemID].spell then
 			-- Special spell
-			menuAddItem(A.data[itemID].spell,itemID,reagent,A.data[itemID].spellID)
+			menuAddItem(A.data[itemID].spell,itemID,reagent,A.data[itemID].spellLink)
 		else
 			-- Standard tradeskill spell UNTESTED
 			menuAddItem(A.craft,itemID,reagent)