comparison SecureMenu.lua @ 31:22fa64c9b2de

Store spellLink instead of spellID
author contrebasse
date Thu, 28 Apr 2011 21:43:06 +0200
parents 15123d11fc64
children 416c307fd00b
comparison
equal deleted inserted replaced
30:fd76c8951b7d 31:22fa64c9b2de
91 end 91 end
92 92
93 GameTooltip:SetOwner(btn,"ANCHOR_LEFT") 93 GameTooltip:SetOwner(btn,"ANCHOR_LEFT")
94 GameTooltip:SetHyperlink(btn.reagentLink) 94 GameTooltip:SetHyperlink(btn.reagentLink)
95 GameTooltip:Show() 95 GameTooltip:Show()
96 if btn.spellID then 96 if btn.spellLink then
97 local link = GetSpellLink(btn.spellID) 97 A.tooltipRecipe:SetOwner(GameTooltip)
98 if link then 98 A.tooltipRecipe:SetHyperlink(btn.spellLink)
99 A.tooltipRecipe:SetOwner(GameTooltip) 99 A.tooltipRecipe:Show()
100 A.tooltipRecipe:SetHyperlink(link) 100 A.tooltipRecipe:ClearAllPoints()
101 A.tooltipRecipe:Show() 101 A.tooltipRecipe:SetPoint("TOPRIGHT",GameTooltip,"BOTTOMRIGHT")
102 A.tooltipRecipe:ClearAllPoints()
103 A.tooltipRecipe:SetPoint("TOPRIGHT",GameTooltip,"BOTTOMRIGHT")
104 end
105 end 102 end
106 end 103 end
107 local function btnLeft(btn) 104 local function btnLeft(btn)
108 btn.textureHighlight:Hide() 105 btn.textureHighlight:Hide()
109 GameTooltip:Hide() 106 GameTooltip:Hide()
204 itemIcon:SetVertexColor(0.5, 0.5, 0.5) 201 itemIcon:SetVertexColor(0.5, 0.5, 0.5)
205 TitleText:SetTextColor(r,g,b,0.7) 202 TitleText:SetTextColor(r,g,b,0.7)
206 end 203 end
207 end 204 end
208 205
209 local function menuAddItem(action,itemID,reagent,spellID) 206 local function menuAddItem(action,itemID,reagent,spellLink)
210 local btn 207 local btn
211 -- Create a button only if necessary 208 -- Create a button only if necessary
212 if numActiveEntries >= #menuEntries then 209 if numActiveEntries >= #menuEntries then
213 btn = createMenuEntry() 210 btn = createMenuEntry()
214 else 211 else
245 -- Save params 242 -- Save params
246 btn.itemID = itemID 243 btn.itemID = itemID
247 btn.reagentID = reagent[1] 244 btn.reagentID = reagent[1]
248 btn.reagentLink = link 245 btn.reagentLink = link
249 btn.reagentsForOneRecipe = reagent[2] 246 btn.reagentsForOneRecipe = reagent[2]
250 btn.spellID = spellID 247 btn.spellLink = spellLink
251 248
252 -- Set action 249 -- Set action
253 if type(action)=="function" then 250 if type(action)=="function" then
254 btn:SetScript("PreClick",action) 251 btn:SetScript("PreClick",action)
255 btn:SetAttribute("type", nil) 252 btn:SetAttribute("type", nil)
293 290
294 -- Loop over the available recipes 291 -- Loop over the available recipes
295 for _,reagent in ipairs(A.data[itemID]) do 292 for _,reagent in ipairs(A.data[itemID]) do
296 if A.data[itemID].spell then 293 if A.data[itemID].spell then
297 -- Special spell 294 -- Special spell
298 menuAddItem(A.data[itemID].spell,itemID,reagent,A.data[itemID].spellID) 295 menuAddItem(A.data[itemID].spell,itemID,reagent,A.data[itemID].spellLink)
299 else 296 else
300 -- Standard tradeskill spell UNTESTED 297 -- Standard tradeskill spell UNTESTED
301 menuAddItem(A.craft,itemID,reagent) 298 menuAddItem(A.craft,itemID,reagent)
302 end -- if 299 end -- if
303 end -- for 300 end -- for