vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --<< ====================================================================== >>--
2 -- Module Setup --
3 --<< ====================================================================== >>--
4 AceTimerSkill = AceTimer:AddModule({
5 option = ACETIMER.OPT_SKILL,
6 method = "CareOptSkill",
7 desc = ACETIMER.OPT_SKILL_DESC,
8 })
9  
10 function AceTimerSkill:Enable()
11 if self.GetOpt("NoSkill") then return self:Disable() end
12 if self.timers[ACETIMER.SKILL] then
13 self:Hook("ActionButton_UpdateUsable")
14 end
15 end
16  
17 function AceTimerSkill:Disable()
18 self:UnregisterAllEvents(self)
19 self:UnhookAllScripts()
20 end
21  
22 --<< ====================================================================== >>--
23 -- Main --
24 --<< ====================================================================== >>--
25 function AceTimerSkill:ActionButton_UpdateUsable()
26 local slot = ActionButton_GetPagedID(this)
27 AceTimerTooltip:SetAction(slot)
28 local name = AceTimerTooltipTextLeft1:GetText()
29 local timer = self.timers[ACETIMER.SKILL][name]
30 if timer then
31 if IsUsableAction(slot) then
32 if not timer.v or timer.v < GetTime() then
33 timer.v = GetTime() + 5
34 self:StartTimer(timer, name)
35 end
36 else
37 if timer.v then
38 timer.v = nil
39 self:KillBar(name, "none")
40 end
41 end
42 end
43 return self:CallHook("ActionButton_UpdateUsable")
44 end
45  
46 --<< ====================================================================== >>--
47 -- Command Handlers --
48 --<< ====================================================================== >>--
49 function AceTimerSkill:CareOptSkill()
50 if self.TogOpt("NoSkill") then self:Disable() else self:Enable() end
51 return self:Report()
52 end
53  
54 function AceTimerSkill:Report()
55 return self.cmd:result(
56 ACETIMER.OPT_SKILL_TEXT,
57 ACETIMER.MAP_ONOFF[self.GetOpt("NoSkill") or 0]
58 )
59 end