vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 HotCandy = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceDebug-2.0", "AceConsole-2.0", "AceDB-2.0", "AceHook-2.1", "CandyBar-2.0")
2  
3 local compost = AceLibrary:HasInstance("Compost-2.0") and AceLibrary("Compost-2.0")
4 --local paint = AceLibrary("PaintChips-2.0")
5 local BS = AceLibrary("Babble-Spell-2.2")
6 local gratuity = AceLibrary("Gratuity-2.0")
7 --local seea = AceLibrary("SpecialEvents-Aura-2.0")
8  
9 local function getnewtable() return compost and compost:Acquire() or {} end
10 local function reclaimtable(t) if compost then compost:Reclaim(t) end end
11  
12 HotCandy.version = "0.1." .. string.sub("$Revision: 12273 $", 12, -3)
13 HotCandy.date = string.sub("$Date: 2006-09-30 04:50:40 +0200 (Sa, 30 Sep 2006) $", 8, 17)
14  
15 function HotCandy:OnInitialize()
16 self:RegisterDB("HotCandyDB")
17 self:RegisterDefaults("profile", {
18 growup = false,
19 bonus = {druidt2 = false, priestt2 = false},
20 })
21  
22 self.options = {
23 type = "group",
24 args = {
25 anchor = {
26 name = "Show Anchor",
27 desc = "Show the Anchor for moving the Bars",
28 type = "execute",
29 func = "ShowAnchors",
30 },
31 growup = {
32 name = "Grow Up",
33 desc = "Toggle Grow Up of the Bars",
34 type = "toggle",
35 get = function()
36 return self.db.profile.growup
37 end,
38 set = function(v)
39 self.db.profile.growup = v
40 end,
41 },
42 bonus = {
43 type = "group",
44 name = "Bonus",
45 desc = "Configure Set Bonus attributes",
46 args = {
47 druid = {
48 name = "Druid T2 Rejuvenation Bonus",
49 desc = "Toggle the Druid T2 Bonus on/off",
50 type = "toggle",
51 get = function()
52 return self.db.profile.bonus.druidt2
53 end,
54 set = function(v)
55 self.db.profile.bonus.druidt2 = v
56 if self.db.profile.bonus.druidt2 then
57 self.track['Rejuvenation'] = 15
58 else
59 self.track['Rejuvenation'] = 12
60 end
61 end,
62 },
63 priest = {
64 name = "Priest T2 Greater Heal Bonus",
65 desc = "Toggle the Priest T2 Bonus on/off",
66 type = "toggle",
67 get = function()
68 return self.db.profile.bonus.priestt2
69 end,
70 set = function(v)
71 self.db.profile.bonus.priestt2 = v
72 if self.db.profile.bonus.priestt2 then
73 self.track['Greater Heal'] = 15
74 else
75 self.track['Greater Heal'] = nil
76 end
77 end,
78 },
79 }
80 },
81 }
82 }
83  
84 self:RegisterChatCommand({ "/hot", "/hotcandy" }, self.options )
85  
86 self.spell = {}
87 self:SetupFrames()
88  
89 -- spell = duration
90 self.track = {
91 [BS['Rejuvenation']] = self.db.profile.bonus.druidt2 and 15 or 12,
92 [BS['Regrowth']] = 21,
93 [BS['Renew']] = 15,
94 [BS['Greater Heal']] = self.db.profile.bonus.priestt2 and 15 or nil,
95 }
96 self:DoHooking()
97 end
98  
99 function HotCandy:OnEnable()
100 --self:SetDebugging(true)
101 --self:SetDebugLevel(3)
102 self:RegisterEvent("SPELLCAST_FAILED", "SpellCastEvent")
103 self:RegisterEvent("SPELLCAST_STOP", "SpellCastEvent")
104 self:RegisterEvent("SPELLCAST_INTERRUPTED", "SpellCastEvent")
105 end
106  
107 function HotCandy:SpellCastEvent()
108 if ( event == "SPELLCAST_FAILED" or event == "SPELLCAST_INTERRUPTED" ) and self.spell.EndCast then
109 self.spell.Casting = nil
110 self.spell.Target = nil
111 self.spell.EndCast = nil
112 elseif event == "SPELLCAST_STOP" and self.spell.EndCast then
113 self:LevelDebug(2, "SPELLCAST_STOP", self.spell.EndCast, self.spell.Target)
114 self:FireSpell(self.spell.EndCast, self.spell.Target)
115 self.spell.Casting = nil
116 self.spell.Target = nil
117 self.spell.EndCast = nil
118 end
119 end
120  
121 function HotCandy:FireSpell(spellName, spellTarget)
122 if self.track[spellName] then
123 self:LevelDebug(3, "FireSpell", spellName, spellTarget)
124 self:ShowCandyBar(spellName.." - "..(spellTarget or ""), self.track[spellName], BS:GetSpellIcon(spellName), "green", "yellow", "orange", "red")
125 end
126 end
127  
128 function HotCandy:ShowCandyBar(text, time, icon, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
129 local id = "HotCandy"..text
130 local u = self.db.profile.growup
131 self:RegisterCandyBarGroup("HotCandyGroup")
132 self:SetCandyBarGroupPoint("HotCandyGroup", u and "BOTTOM" or "TOP", self.frames.anchor, u and "TOP" or "BOTTOM", 0, 0)
133 self:SetCandyBarGroupGrowth("HotCandyGroup", u)
134  
135 self:RegisterCandyBar(id, time, text, icon, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
136 self:RegisterCandyBarWithGroup(id, "HotCandyGroup")
137 self:SetCandyBarTexture(id, "Interface\\Addons\\HotCandy\\textures\\default")
138 self:SetCandyBarFade(id, 5)
139 self:StartCandyBar(id, true)
140 end