changeset 96:e3147b41ea9d v1.0beta9

Correct display, tooltips and error message when there are actual tradeskill spells in the SecureMenu. Still not sure that it works with enough reagents...
author contrebasse
date Fri, 20 May 2011 00:53:42 +0200
parents 910cf3da8edb
children 61439697f8c5
files SecureMenu.lua
diffstat 1 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/SecureMenu.lua	Thu May 19 20:26:21 2011 +0200
+++ b/SecureMenu.lua	Fri May 20 00:53:42 2011 +0200
@@ -118,7 +118,7 @@
 	GameTooltip:SetOwner(btn,"ANCHOR_LEFT")
 	GameTooltip:SetHyperlink(btn.reagentLink)
 	GameTooltip:Show()
-	if btn.spellLink then
+	if btn.spellLink and btn.spellLink~=btn.reagentLink then
 		A.tooltipRecipe:SetOwner(GameTooltip)
 		A.tooltipRecipe:SetHyperlink(btn.spellLink)
 		A.tooltipRecipe:Show()
@@ -191,7 +191,11 @@
 end
 
 local function WarnNotMakable(btn)
-	A.Error(A.L["You do not have enough [%s] to craft [%s]"]:format(btn.itemNameString,TitleText:GetText()))
+	if not btn.reagentID then
+		A.Error(A.L["You do not have enough reagents to craft [%s]"]:format(TitleText:GetText()))
+	else
+		A.Error(A.L["You do not have enough [%s] to craft [%s]"]:format(btn.itemNameString,TitleText:GetText()))
+	end
 end
 
 -- Update counts and button actions
@@ -255,11 +259,23 @@
 	end
 
 	-- Set text and icon
-	local name, link, _, _, _, _, _, _, _, texture = GetItemInfo(reagent[1])
-	if not (name and link and texture) then
-		-- Will be retried on next OnUpdate
-		return
+	local name, link, texture, _
+	if reagent[1] then
+		name, link, _, _, _, _, _, _, _, texture = GetItemInfo(reagent[1])
+		if not (name and link and texture) then
+			-- Will be retried on next OnUpdate
+			return
+		end
+	elseif reagent.spellLink then
+		--name, rank, icon, powerCost, isFunnel, powerType, castingTime, minRange, maxRange = GetSpellInfo(id)
+		name, _, texture = GetSpellInfo(A.link2ID(reagent.spellLink))
+		if not (name and texture) then
+			-- Will be retried on next OnUpdate
+			return
+		end
+		link = reagent.spellLink
 	end
+
 	btn.itemName:SetText(name)
 	btn.icon:SetTexture(texture)