vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2 local sels = SpecialEventsEmbed:GetInstance("Learn Spell 1")
3 local gratuity = Gratuity:GetInstance("1")
4 gratuity:RegisterTooltip(Lern2SpellTooltip)
5  
6 Lern2Spell = AceAddon:new({
7 name = "Lern2Spell",
8 description = "Automatically updates actionbar spells",
9 version = tonumber(string.sub("$Revision: 1706 $", 12, -3)),
10 releaseDate = string.sub("$Date: 2006-05-11 21:45:32 -0500 (Thu, 11 May 2006) $", 8, 17),
11 aceCompatible = 102,
12 author = "Tekkub Stoutwrithe",
13 email = "tekkub@gmail.com",
14 category = "interface",
15 cmd = AceChatCmd:new({"/l2s", "/lern2spell"}, {}),
16 })
17  
18  
19 function Lern2Spell:Enable()
20 sels:RegisterEvent(self, "SPECIAL_LEARNED_SPELL")
21 end
22  
23  
24 function Lern2Spell:SPECIAL_LEARNED_SPELL(spell, rank)
25 for btn=1,120 do
26 local n, r = self:ActionIsSpell(btn)
27 if n and n == spell and ((r or "") ~= rank) then
28 local i = self:GetSpellIndex(spell, rank)
29 if not i then return end
30  
31 local n, r = GetSpellName(i,BOOKTYPE_SPELL)
32 self.cmd:msg("Upgrading button #%s - %s ~ %s", btn, n, r or "??")
33 PickupSpell(i, BOOKTYPE_SPELL)
34 PlaceAction(btn)
35  
36 repeat
37 if CursorHasItem() or CursorHasSpell() then PickupSpell(1, BOOKTYPE_SPELL) end
38 until not CursorHasItem() and not CursorHasSpell()
39 end
40 end
41 end
42  
43  
44 function Lern2Spell:GetSpellIndex(spell, rank)
45 assert(spell, "No spell passed")
46  
47 local i, n, r = 1
48 repeat
49 n, r = GetSpellName(i, BOOKTYPE_SPELL)
50 if n and n == spell and r == rank then return i end
51 i = i+1
52 until not n
53 end
54  
55  
56 function Lern2Spell:ActionIsSpell(id)
57 if not id or GetActionText(id) then return end
58  
59 gratuity:SetAction(id)
60 return gratuity:GetLine(1)
61 end
62  
63  
64 -----------------------------------
65 -- Load this bitch up! --
66 -----------------------------------
67 Lern2Spell:RegisterForLoad()
68