comparison SecureMenu.lua @ 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 c369a2e16ab6
children c8d527a9fb3a
comparison
equal deleted inserted replaced
95:910cf3da8edb 96:e3147b41ea9d
116 end 116 end
117 117
118 GameTooltip:SetOwner(btn,"ANCHOR_LEFT") 118 GameTooltip:SetOwner(btn,"ANCHOR_LEFT")
119 GameTooltip:SetHyperlink(btn.reagentLink) 119 GameTooltip:SetHyperlink(btn.reagentLink)
120 GameTooltip:Show() 120 GameTooltip:Show()
121 if btn.spellLink then 121 if btn.spellLink and btn.spellLink~=btn.reagentLink then
122 A.tooltipRecipe:SetOwner(GameTooltip) 122 A.tooltipRecipe:SetOwner(GameTooltip)
123 A.tooltipRecipe:SetHyperlink(btn.spellLink) 123 A.tooltipRecipe:SetHyperlink(btn.spellLink)
124 A.tooltipRecipe:Show() 124 A.tooltipRecipe:Show()
125 A.tooltipRecipe:ClearAllPoints() 125 A.tooltipRecipe:ClearAllPoints()
126 A.tooltipRecipe:SetPoint("TOPRIGHT",GameTooltip,"BOTTOMRIGHT") 126 A.tooltipRecipe:SetPoint("TOPRIGHT",GameTooltip,"BOTTOMRIGHT")
189 189
190 return btn 190 return btn
191 end 191 end
192 192
193 local function WarnNotMakable(btn) 193 local function WarnNotMakable(btn)
194 A.Error(A.L["You do not have enough [%s] to craft [%s]"]:format(btn.itemNameString,TitleText:GetText())) 194 if not btn.reagentID then
195 A.Error(A.L["You do not have enough reagents to craft [%s]"]:format(TitleText:GetText()))
196 else
197 A.Error(A.L["You do not have enough [%s] to craft [%s]"]:format(btn.itemNameString,TitleText:GetText()))
198 end
195 end 199 end
196 200
197 -- Update counts and button actions 201 -- Update counts and button actions
198 function MenuFrame.updateCounts() 202 function MenuFrame.updateCounts()
199 local anyMakable 203 local anyMakable
253 else 257 else
254 btn = menuEntries[numActiveEntries+1] 258 btn = menuEntries[numActiveEntries+1]
255 end 259 end
256 260
257 -- Set text and icon 261 -- Set text and icon
258 local name, link, _, _, _, _, _, _, _, texture = GetItemInfo(reagent[1]) 262 local name, link, texture, _
259 if not (name and link and texture) then 263 if reagent[1] then
260 -- Will be retried on next OnUpdate 264 name, link, _, _, _, _, _, _, _, texture = GetItemInfo(reagent[1])
261 return 265 if not (name and link and texture) then
262 end 266 -- Will be retried on next OnUpdate
267 return
268 end
269 elseif reagent.spellLink then
270 --name, rank, icon, powerCost, isFunnel, powerType, castingTime, minRange, maxRange = GetSpellInfo(id)
271 name, _, texture = GetSpellInfo(A.link2ID(reagent.spellLink))
272 if not (name and texture) then
273 -- Will be retried on next OnUpdate
274 return
275 end
276 link = reagent.spellLink
277 end
278
263 btn.itemName:SetText(name) 279 btn.itemName:SetText(name)
264 btn.icon:SetTexture(texture) 280 btn.icon:SetTexture(texture)
265 281
266 -- Set chance to have the item or the number of items created 282 -- Set chance to have the item or the number of items created
267 btn.resultNumber:Hide() 283 btn.resultNumber:Hide()