public
Description: WoW Addon - Crowd control assistance
Homepage: http://www.tekkub.net
Clone URL: git://github.com/tekkub/controlfreak.git
Click here to lend your support to: controlfreak and make a donation at www.pledgie.com !
ControlFreak
- Addon loader support!
- Added new WidgetWarlock
- Some debug bits
- Hopefully fixed issues with "controlled" detection, specifically when 
the focus is set AFTER the unit is controlled.
- Fixed debuff name setting not actually getting used

git-svn-id: http://tekkub-wow.googlecode.com/svn/trunk/ControlFreak@530 
86fe6d9a-1522-0410-a387-bf9db416f0a0
tekkub (author)
Fri Sep 14 02:10:10 -0700 2007
commit  e9599786fb788a3f442e028de3cfffcba6593713
tree    8d7324a244d61724c7e84d53c76ab5a18d222e43
parent  349ecc5309e1eaa83e2345d153e8914dd61dcc3e
...
5
6
7
8
9
 
10
11
12
...
25
26
27
28
29
 
 
 
 
30
31
32
33
34
35
 
 
 
 
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 
74
75
76
...
80
81
82
83
84
 
 
85
86
87
...
92
93
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
96
97
...
5
6
7
 
 
8
9
10
11
...
24
25
26
 
 
27
28
29
30
31
32
33
34
 
 
35
36
37
38
39
40
41
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
44
45
46
47
...
51
52
53
 
 
54
55
56
57
58
...
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
0
@@ -5,8 +5,7 @@ if not ControlFreak then return end
0
 
0
 
0
 local DongleFrames = DongleStub("DongleFrames-1.0")
0
-local ww = WidgetWarlock
0
-WidgetWarlock = nil
0
+local ww = LibStub("WidgetWarlock-Alpha1")
0
 local ControlFreak = ControlFreak
0
 
0
 
0
@@ -25,52 +24,24 @@ function ControlFreak:CreatePanel()
0
   frame:SetScript("OnHide", function() self:UnregisterEvent("PLAYER_REGEN_DISABLED") end)
0
 
0
 
0
- local lockpos, lockposlabel = ww.SummonLabeledCheckBox("Lock frame", 22, frame, "TOPLEFT", 15, -10)
0
- ww.EnslaveTooltip(lockpos, "Locks the frame to prevent accidental movement")
0
+ local lockpos = ww:SummonCheckBox(frame, nil, "TOPLEFT", 15, -10)
0
+ ww:EnslaveLabel(lockpos, "Lock frame")
0
+ lockpos:SetHitRectInsets(0, -100, 0, 0)
0
+ ww:EnslaveTooltip(lockpos, "Locks the frame to prevent accidental movement")
0
   lockpos:SetScript("OnClick", function() self.db.profile.frameopts.locked = not self.db.profile.frameopts.locked end)
0
   lockpos:SetChecked(self.db.profile.frameopts.locked)
0
 
0
 
0
- local showtip = ww.SummonLabeledCheckBox("Show tooltip", 22, frame, "TOPLEFT", lockpos, "TOPLEFT", 133, 0)
0
- ww.EnslaveTooltip(showtip, "Show help tooltip on hover")
0
+ local showtip = ww:SummonCheckBox(frame, nil, "TOPLEFT", lockpos, "TOPLEFT", 133, 0)
0
+ showtip:SetHitRectInsets(0, -100, 0, 0)
0
+ ww:EnslaveLabel(showtip, "Show tooltip")
0
+ ww:EnslaveTooltip(showtip, "Show help tooltip on hover")
0
   showtip:SetScript("OnClick", function() self.db.profile.showtooltip = not self.db.profile.showtooltip end)
0
   showtip:SetChecked(self.db.profile.showtooltip)
0
 
0
 
0
- local editbox = CreateFrame("EditBox", nil, frame)
0
- editbox:SetWidth(620) editbox:SetHeight(200)
0
- editbox:SetPoint("BOTTOMLEFT", 5, 5)
0
- editbox:SetFontObject(GameFontHighlight)
0
- editbox:SetTextInsets(8,8,8,8)
0
- editbox:SetBackdrop(ww.TooltipBorderBG)
0
- editbox:SetBackdropColor(.1,.1,.1,.3)
0
- editbox:SetMultiLine(true)
0
- editbox:SetAutoFocus(false)
0
- editbox:SetText(self.db.profile.macrotext or "/script ChatFrame1:AddMessage(\"Error loading macro!\")")
0
- editbox:SetScript("OnTextChanged", function()
0
- self.db.profile.macrotext = editbox:GetText()
0
- self.macroupdated = true
0
- if not InCombatLockdown() then self:PLAYER_REGEN_ENABLED() end
0
- end)
0
- editbox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
0
- local macrolabel = ww.EnslaveLabel(editbox, "Macro", "BOTTOMLEFT", editbox, "TOPLEFT", 5, 0)
0
- self.combatwarn = ww.EnslaveLabel(editbox, "|cffff0000Macro changes will not apply until combat ends!", "BOTTOMRIGHT", editbox, "TOPRIGHT", -5, 0)
0
-
0
- local debuff = CreateFrame("EditBox", nil, frame)
0
- debuff:SetPoint("BOTTOMRIGHT", editbox, "TOPRIGHT", 0, 15) debuff:SetWidth(200) debuff:SetHeight(22)
0
- debuff:SetFontObject(GameFontHighlight)
0
- debuff:SetTextInsets(8,8,8,8)
0
- debuff:SetBackdrop(ww.TooltipBorderBG)
0
- debuff:SetBackdropColor(.1,.1,.1,.3)
0
- debuff:SetAutoFocus(false)
0
- debuff:SetText(self.db.profile.spellname)
0
- debuff:SetScript("OnTextChanged", function() self.db.profile.spellname = debuff:GetText() end)
0
- debuff:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
0
- ww.EnslaveLabel(debuff, "Debuff", "RIGHT", debuff, "LEFT", -5, 0)
0
-
0
-
0
- local threshslider, threshslidertext = ww.SummonSlider(frame, "Break Threshold: "..self.db.profile.breakthreshold.." sec", 0, 10, "TOPLEFT", lockpos, "BOTTOMLEFT", -5, -15)
0
- ww.EnslaveTooltip(threshslider, "Time (in seconds) before spell breaks to unfade frame.")
0
+ local threshslider, threshslidertext = ww:SummonSlider(frame, "Break Threshold: "..self.db.profile.breakthreshold.." sec", 0, 10, "TOPLEFT", lockpos, "BOTTOMLEFT", -5, -15)
0
+ ww:EnslaveTooltip(threshslider, "Time (in seconds) before spell breaks to unfade frame.")
0
   threshslider:SetValue(self.db.profile.breakthreshold)
0
   threshslider:SetValueStep(1)
0
   threshslider:SetScript("OnValueChanged", function()
0
@@ -80,8 +51,8 @@ function ControlFreak:CreatePanel()
0
 
0
 
0
   local alpha = math.floor(self.db.profile.alpha*100 + .5)
0
- local alphaslider, alphaslidertext = ww.SummonSlider(frame, "Alpha: "..alpha.."%", "0%", "100%", "LEFT", threshslider, "RIGHT", 10, 0)
0
- ww.EnslaveTooltip(alphaslider, "Alpha level to fade frame to when focus is controlled, dead, or not set.")
0
+ local alphaslider, alphaslidertext = ww:SummonSlider(frame, "Alpha: "..alpha.."%", "0%", "100%", "LEFT", threshslider, "RIGHT", 10, 0)
0
+ ww:EnslaveTooltip(alphaslider, "Alpha level to fade frame to when focus is controlled, dead, or not set.")
0
   alphaslider:SetValue(self.db.profile.alpha)
0
   alphaslider:SetValueStep(0.05)
0
   alphaslider:SetScript("OnValueChanged", function()
0
@@ -92,6 +63,34 @@ function ControlFreak:CreatePanel()
0
   end)
0
 
0
 
0
+ local debuff = ww:SummonEditBox(frame, 200, "BOTTOMLEFT", threshslider, "TOPLEFT", 5, -55)
0
+ debuff:SetText(self.db.profile.spellname)
0
+ debuff:SetScript("OnTextChanged", function() self.db.profile.spellname = debuff:GetText() end)
0
+ debuff:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
0
+ ww:EnslaveLabel(debuff, "Debuff")
0
+
0
+
0
+ local editbox = CreateFrame("EditBox", nil, frame)
0
+ editbox:SetWidth(620)
0
+ editbox:SetPoint("BOTTOMLEFT", 5, 5)
0
+ editbox:SetPoint("TOP", frame, "BOTTOM", 0, 170)
0
+ editbox:SetFontObject(GameFontHighlight)
0
+ editbox:SetTextInsets(8,8,8,8)
0
+ editbox:SetBackdrop(ww.TooltipBorderBG)
0
+ editbox:SetBackdropColor(.1,.1,.1,.3)
0
+ editbox:SetMultiLine(true)
0
+ editbox:SetAutoFocus(false)
0
+ editbox:SetText(self.db.profile.macrotext or "/script ChatFrame1:AddMessage(\"Error loading macro!\")")
0
+ editbox:SetScript("OnTextChanged", function()
0
+ self.db.profile.macrotext = editbox:GetText()
0
+ self.macroupdated = true
0
+ if not InCombatLockdown() then self:PLAYER_REGEN_ENABLED() end
0
+ end)
0
+ editbox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
0
+ local macrolabel = ww:EnslaveLabel(editbox, "Macro", "BOTTOMLEFT", editbox, "TOPLEFT", 5, 0)
0
+ self.combatwarn = ww:EnslaveLabel(editbox, "|cffff0000Macro changes will not apply until combat ends!", "BOTTOMRIGHT", editbox, "TOPRIGHT", -5, 0)
0
+
0
+
0
   local resetmacro = CreateFrame("Button", name.."ResetMacro", frame, "UIPanelButtonGrayTemplate")
0
   resetmacro:SetPoint("TOPRIGHT", -5, -5) resetmacro:SetWidth(120) resetmacro:SetHeight(22)
0
   resetmacro:SetText("Reset Defaults")
...
27
28
29
 
30
31
32
...
141
142
143
 
144
145
146
147
148
149
 
 
 
 
 
 
150
151
152
...
159
160
161
 
162
163
164
165
 
 
166
167
168
...
189
190
191
192
 
193
194
195
...
27
28
29
30
31
32
33
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
...
167
168
169
170
171
172
173
 
174
175
176
177
178
...
199
200
201
 
202
203
204
205
0
@@ -27,6 +27,7 @@ local L = {
0
 local LegoBlock = DongleStub("LegoBlock-Beta0")
0
 local OptionHouse = DongleStub("OptionHouse-1.0")
0
 ControlFreak = DongleStub("Dongle-1.0"):New("ControlFreak")
0
+if tekDebug then ControlFreak:EnableDebug(1, tekDebug:GetFrame("ControlFreak")) end
0
 
0
 
0
 function ControlFreak:Initialize()
0
@@ -141,12 +142,19 @@ end
0
 
0
 function ControlFreak:PLAYER_FOCUS_CHANGED()
0
   focusexists = UnitExists("focus")
0
+ self:Debug(1, "PLAYER_FOCUS_CHANGED", focusexists)
0
   focusisenemy = focusexists and UnitIsEnemy("player", "focus")
0
   focusdead = focusexists and UnitIsDead("focus")
0
   isvalid.focus = targtypes[UnitCreatureType("focus")]
0
 
0
   lasthp, lasthptime = focusexists and UnitHealth("focus"), 0
0
 
0
+ if focusexists then self:UNIT_AURA("UNIT_AURA", "focus")
0
+ else
0
+ controlled.focus = nil
0
+ self:OnUpdate(true)
0
+ end
0
+
0
   if (not focusexists and not targetexists)
0
     or focusdead and not targetexists
0
     or targetdead and not focusexists
0
@@ -159,10 +167,12 @@ end
0
 function ControlFreak:UNIT_AURA(event, unit)
0
    if unit ~= "focus" then return end
0
 
0
+ self:Debug(1, "UNIT_AURA", controlled[unit])
0
   local wascontrolled = (controlled[unit] ~= nil)
0
   controlled[unit] = nil
0
   for i=1,maxdebuffs do
0
- if UnitDebuff(unit, i) == spellname then controlled[unit] = i end
0
+ self:Debug(1, UnitDebuff(unit, i))
0
+ if UnitDebuff(unit, i) == self.db.profile.spellname then controlled[unit] = i end
0
   end
0
 
0
   if wascontrolled ~= (controlled[unit]~= nil) then self:OnUpdate(true) end
0
@@ -189,7 +199,7 @@ function ControlFreak:OnUpdate(elapsed)
0
   if unit then
0
     if not isvalid[unit] then color, note, tiptext = "grey", "Invalid"
0
     else
0
- if IsSpellInRange(spellname, unit) == 0 then range = "*" end
0
+ if IsSpellInRange(self.db.profile.spellname, unit) == 0 then range = "*" end
0
       if lasthptime and lasthptime >= (GetTime()-damageinterval) then alpha, color, note = 1.0, "red", "Damage"
0
       elseif controlled[unit] then
0
         local _, _, _, _, _, _, timeLeft = UnitDebuff(unit, controlled[unit])
...
12
13
14
 
 
 
 
15
16
17
18
19
 
20
21
22
...
12
13
14
15
16
17
18
19
20
21
22
 
23
24
25
26
0
@@ -12,11 +12,15 @@
0
 
0
 ## OptionalDeps: Dongle, OptionHouse
0
 
0
+## LoadManagers: AddonLoader
0
+## X-LoadOn-NotResting: true
0
+## X-LoadOn-Slash: /freak
0
+
0
 Dongle.lua
0
 OptionHouse.lua
0
 DongleFrames.lua
0
 LegoBlock.lua
0
-WidgetWarlock.lua
0
+WidgetWarlock\WidgetWarlock.xml
0
 
0
 ClassMacrotexts.lua
0
 ControlFreak.lua

Comments

    No one has commented yet.