Mercurial > wow > reaction
comparison classes/PetActionButton.lua @ 131:e39d80bb0b7a
Refactored some code into Button, cleaned up PetActionButton a little
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 06 Mar 2009 23:58:02 +0000 |
parents | 6e4a11b9d290 |
children | 16048f516f5e |
comparison
equal
deleted
inserted
replaced
130:6e4a11b9d290 | 131:e39d80bb0b7a |
---|---|
65 | 65 |
66 self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) | 66 self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) |
67 | 67 |
68 local f = self:GetFrame() | 68 local f = self:GetFrame() |
69 if not f.autoCastTexture then | 69 if not f.autoCastTexture then |
70 -- store with the frame for recycling | 70 -- store autocast stuff with the frame for recycling |
71 f.autoCastShine = CreateFrame("Frame",name.."Shine",f,"AutoCastShineTemplate") | 71 f.autoCastShine = CreateFrame("Frame",name.."Shine",f,"AutoCastShineTemplate") |
72 local tex = f:CreateTexture(nil,"OVERLAY") | 72 local tex = f:CreateTexture(nil,"OVERLAY") |
73 tex:SetTexture([[Interface\Buttons\UI-AutoCastableOverlay]]) | 73 tex:SetTexture([[Interface\Buttons\UI-AutoCastableOverlay]]) |
74 tex:SetHeight(58) | 74 tex:SetHeight(58) |
75 tex:SetWidth(58) | 75 tex:SetWidth(58) |
76 tex:SetPoint("CENTER") | 76 tex:SetPoint("CENTER") |
77 f.autoCastTexture = tex | 77 f.autoCastTexture = tex |
78 -- move the cooldown around | |
79 local cd = self.frames.cooldown | |
80 cd:ClearAllPoints() | |
81 cd:SetWidth(33) | |
82 cd:SetHeight(33) | |
83 cd:SetPoint("CENTER", f, "CENTER", -2, -1) | |
84 -- resize to 30x30 | |
85 f:SetHeight(30) | |
86 f:SetWidth(30) | |
78 end | 87 end |
79 local barFrame = bar:GetFrame() | 88 local barFrame = bar:GetFrame() |
80 | |
81 local frames = { } | |
82 self.frames = frames | |
83 frames.icon = _G[name.."Icon"] | |
84 frames.flash = _G[name.."Flash"] | |
85 frames.hotkey = _G[name.."HotKey"] | |
86 frames.count = _G[name.."Count"] | |
87 frames.name = _G[name.."Name"] | |
88 frames.border = _G[name.."Border"] | |
89 frames.cooldown = _G[name.."Cooldown"] | |
90 frames.normalTexture = _G[name.."NormalTexture"] | |
91 | |
92 -- resize to 30x30 | |
93 f:SetHeight(30) | |
94 f:SetWidth(30) | |
95 | |
96 -- move the cooldown around | |
97 local cd = self.frames.cooldown | |
98 cd:ClearAllPoints() | |
99 cd:SetWidth(33) | |
100 cd:SetHeight(33) | |
101 cd:SetPoint("CENTER", f, "CENTER", -2, -1) | |
102 | |
103 self.hotkey = frames.hotkey -- alias for Button methods | |
104 self.border = frames.border -- alias for Button methods | |
105 | 89 |
106 -- set up the base action ID | 90 -- set up the base action ID |
107 self:SetActionIDPool("pet",10) | 91 self:SetActionIDPool("pet",10) |
108 config.actionID = self:AcquireActionID(config.actionID, idHint, true) | 92 config.actionID = self:AcquireActionID(config.actionID, idHint, true) |
109 | 93 |
110 -- attribute setup | 94 -- attribute setup |
111 -- In order to get the full behavior of the pet buttons | 95 -- There's no secure way to do PetAutoCastToggle by actionID, so use |
112 -- (petattack, toggle autocast, start/stop attack) we need | 96 -- a click-through proxy to the Blizzard pet buttons for right-click |
113 -- to use a secure click proxy type instead of a "pet" type. | 97 -- Note that technically this doesn't do PetStopAttack() when |
98 -- IsPetAttackActive() is true: however that's only true when using | |
99 -- Eyes of the Beast and appears not to really do anything (at least | |
100 -- I can't find any difference) | |
114 f:SetAttribute("type","pet") | 101 f:SetAttribute("type","pet") |
115 f:SetAttribute("type2","click") | 102 f:SetAttribute("type2","click") |
116 f:SetAttribute("clickbutton2",_G["PetActionButton"..config.actionID]) | 103 f:SetAttribute("clickbutton2",_G["PetActionButton"..config.actionID]) |
117 f:SetAttribute("action",config.actionID) | 104 f:SetAttribute("action",config.actionID) |
118 f:SetAttribute("checkselfcast", true) | 105 f:SetAttribute("checkselfcast", true) |