Mercurial > wow > reaction
comparison modules/ReAction_Action/ReAction_Action.lua @ 53:7e09c02ae620
Pet Action support
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Fri, 25 Apr 2008 20:35:55 +0000 |
| parents | c9df7866ff31 |
| children | 88283658fec4 |
comparison
equal
deleted
inserted
replaced
| 52:c9df7866ff31 | 53:7e09c02ae620 |
|---|---|
| 1 --[[ | 1 --[[ |
| 2 ReAction Action-button module. | 2 ReAction Action button module. |
| 3 | 3 |
| 4 The button module implements standard action button functionality by wrapping Blizzard's | 4 The button module implements standard action button functionality by wrapping Blizzard's |
| 5 ActionButton frame and associated functions. It also provides some button layout | 5 ActionButton frame and associated functions. It also provides some button layout |
| 6 modification tools. | 6 modification tools. |
| 7 | 7 |
| 10 -- local imports | 10 -- local imports |
| 11 local ReAction = ReAction | 11 local ReAction = ReAction |
| 12 local L = ReAction.L | 12 local L = ReAction.L |
| 13 local _G = _G | 13 local _G = _G |
| 14 local CreateFrame = CreateFrame | 14 local CreateFrame = CreateFrame |
| 15 local print = ReAction.print | |
| 16 | 15 |
| 17 -- module declaration | 16 -- module declaration |
| 18 local moduleID = "Action" | 17 local moduleID = "Action" |
| 19 local module = ReAction:NewModule( moduleID ) | 18 local module = ReAction:NewModule( moduleID ) |
| 20 | 19 |
| 38 } | 37 } |
| 39 }) | 38 }) |
| 40 end | 39 end |
| 41 | 40 |
| 42 function module:OnEnable() | 41 function module:OnEnable() |
| 43 ReAction:RegisterDefaultBarConfig(L["Action Bar"], { type = "actionbar" }, true) | 42 ReAction:RegisterBarType(L["Action Bar"], |
| 43 { | |
| 44 type = moduleID, | |
| 45 defaultButtonSize = 36, | |
| 46 defaultBarRows = 1, | |
| 47 defaultBarCols = 12, | |
| 48 defaultBarSpacing = 3 | |
| 49 }, true) | |
| 44 end | 50 end |
| 45 | 51 |
| 46 function module:OnDisable() | 52 function module:OnDisable() |
| 47 ReAction:UnregisterDefaultBarConfig(L["Action Bar"]) | 53 ReAction:UnregisterBarType(L["Action Bar"]) |
| 48 end | 54 end |
| 49 | 55 |
| 50 function module:ApplyToBar(bar) | 56 function module:ApplyToBar(bar) |
| 51 self:RefreshBar(bar) | 57 self:RefreshBar(bar) |
| 52 end | 58 end |
| 53 | 59 |
| 54 function module:RefreshBar(bar) | 60 function module:RefreshBar(bar) |
| 55 if bar.config.type == "actionbar" then | 61 if bar.config.type == moduleID then |
| 56 if self.buttons[bar] == nil then | 62 if self.buttons[bar] == nil then |
| 57 self.buttons[bar] = { } | 63 self.buttons[bar] = { } |
| 58 end | 64 end |
| 59 local btns = self.buttons[bar] | 65 local btns = self.buttons[bar] |
| 60 local profile = self.db.profile | 66 local profile = self.db.profile |
| 164 end | 170 end |
| 165 | 171 |
| 166 | 172 |
| 167 | 173 |
| 168 -- use-count of action IDs | 174 -- use-count of action IDs |
| 175 local nActionIDs = 120 | |
| 169 local ActionIDList = setmetatable( {}, { | 176 local ActionIDList = setmetatable( {}, { |
| 170 __index = function(self, idx) | 177 __index = function(self, idx) |
| 171 if idx == nil then | 178 if idx == nil then |
| 172 for i = 1, 120 do | 179 for i = 1, nActionIDs do |
| 173 if rawget(self,i) == nil then | 180 if rawget(self,i) == nil then |
| 174 rawset(self,i,1) | 181 rawset(self,i,1) |
| 175 return i | 182 return i |
| 176 end | 183 end |
| 177 end | 184 end |
