Mercurial > wow > reaction
comparison modules/ReAction_PetAction/ReAction_PetAction.lua @ 90:7cabc8ac6c16
Updates for wow 3.0
- TOC update
- updated changed APIs/frame names
- rewrote state code per new SecureHandlers API
- cleaned up Bar, ActionButton code
- removed AceLibrary/Dewdrop, menu from bar right-click
- fixed various small bugs
Updated WowAce external locations
Updated README.html
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Wed, 15 Oct 2008 16:29:41 +0000 |
| parents | fc83b3f5b322 |
| children | c2504a8b996c |
comparison
equal
deleted
inserted
replaced
| 89:491a6ffe7260 | 90:7cabc8ac6c16 |
|---|---|
| 59 | 59 |
| 60 function module:OnCreateBar(event, bar, name) | 60 function module:OnCreateBar(event, bar, name) |
| 61 if bar.config.type == moduleID then | 61 if bar.config.type == moduleID then |
| 62 -- auto show/hide when pet exists | 62 -- auto show/hide when pet exists |
| 63 bar:GetFrame():SetAttribute("unit","pet") | 63 bar:GetFrame():SetAttribute("unit","pet") |
| 64 RegisterUnitWatch(bar:GetFrame()) | 64 if not ReAction:GetConfigMode() then |
| 65 RegisterUnitWatch(bar:GetFrame()) | |
| 66 end | |
| 65 self:OnRefreshBar(event, bar, name) | 67 self:OnRefreshBar(event, bar, name) |
| 66 end | 68 end |
| 67 end | 69 end |
| 68 | 70 |
| 69 function module:OnRefreshBar(event, bar, name) | 71 function module:OnRefreshBar(event, bar, name) |
| 190 rawset(self,idx,value) | 192 rawset(self,idx,value) |
| 191 end | 193 end |
| 192 }) | 194 }) |
| 193 | 195 |
| 194 local frameRecycler = {} | 196 local frameRecycler = {} |
| 197 local meta = { __index = Button } | |
| 195 | 198 |
| 196 function Button:New( bar, idx, config ) | 199 function Button:New( bar, idx, config ) |
| 197 -- create new self | 200 -- create new self |
| 198 self = setmetatable( { }, { __index = Button } ) | 201 self = setmetatable( |
| 199 self.bar, self.idx, self.config = bar, idx, config | 202 { |
| 203 bar = bar, | |
| 204 idx = idx, | |
| 205 config = config, | |
| 206 }, meta ) | |
| 200 | 207 |
| 201 local name = config.name or ("ReAction_%s_%s_%d"):format(bar:GetName(),moduleID,idx) | 208 local name = config.name or ("ReAction_%s_%s_%d"):format(bar:GetName(),moduleID,idx) |
| 202 config.name = name | 209 config.name = name |
| 203 self.name = name | 210 self.name = name |
| 204 config.actionID = ActionIDList[config.actionID] -- gets a free one if none configured | 211 config.actionID = ActionIDList[config.actionID] -- gets a free one if none configured |
| 205 | 212 |
| 206 -- have to recycle frames with the same name: | 213 -- have to recycle frames with the same name: |
| 207 -- otherwise you either get references to old textures because named CreateFrame() | 214 -- otherwise you either get references to old textures because named CreateFrame() |
| 208 -- doesn't overwrite existing globals (below) | 215 -- doesn't overwrite existing globals. Can't set them to nil in the global table, |
| 209 -- or, if you set them to nil in the global table, you get taint because of the | 216 -- as it causes taint. |
| 210 -- crappy PetActionBar code. | 217 local parent = bar:GetFrame() |
| 211 local parent = bar:GetButtonFrame() | |
| 212 local f = frameRecycler[name] | 218 local f = frameRecycler[name] |
| 213 if f then | 219 if f then |
| 214 f:SetParent(parent) | 220 f:SetParent(parent) |
| 215 else | 221 else |
| 216 f = CreateFrame("CheckButton", name, parent, "PetActionButtonTemplate") | 222 f = CreateFrame("CheckButton", name, parent, "PetActionButtonTemplate") |
| 220 end | 226 end |
| 221 f:SetFrameStrata("MEDIUM") | 227 f:SetFrameStrata("MEDIUM") |
| 222 self.frame = f | 228 self.frame = f |
| 223 self.icon = _G[("%sIcon"):format(name)] | 229 self.icon = _G[("%sIcon"):format(name)] |
| 224 self.acTex = _G[("%sAutoCastable"):format(name)] | 230 self.acTex = _G[("%sAutoCastable"):format(name)] |
| 225 self.acModel = _G[("%sAutoCast"):format(name)] | 231 self.acModel = _G[("%sShine"):format(name)] |
| 226 self.cooldown = _G[("%sCooldown"):format(name)] | 232 self.cooldown = _G[("%sCooldown"):format(name)] |
| 227 self.hotkey = _G[("%sHotKey"):format(name)] | 233 self.hotkey = _G[("%sHotKey"):format(name)] |
| 228 | 234 |
| 229 f:HookScript("OnDragStart", function() self:Update() end) | 235 f:HookScript("OnDragStart", function() self:Update() end) |
| 230 f:HookScript("OnReceiveDrag", function() self:Update() end) | 236 f:HookScript("OnReceiveDrag", function() self:Update() end) |
| 247 else | 253 else |
| 248 self:Update() | 254 self:Update() |
| 249 end | 255 end |
| 250 end) | 256 end) |
| 251 | 257 |
| 252 self.binder = ReAction:AttachBinder(self) | 258 --self.binder = ReAction:AttachBinder(self) |
| 253 | 259 |
| 254 self:Refresh() | 260 self:Refresh() |
| 255 return self | 261 return self |
| 256 end | 262 end |
| 257 | 263 |
