Mercurial > wow > reaction
comparison PetActionButton.lua @ 286:77609bfa804e stable
Merge 1.1 beta 8 to stable
author | Flick |
---|---|
date | Sat, 11 Jun 2011 10:57:00 -0700 |
parents | 499ca4edf033 |
children | 276165a0e860 |
comparison
equal
deleted
inserted
replaced
272:71d1a5e47e72 | 286:77609bfa804e |
---|---|
1 local addonName, addonTable = ... | 1 local _, ns = ... |
2 local ReAction = addonTable.ReAction | 2 local ReAction = ns.ReAction |
3 local L = ReAction.L | 3 local L = ReAction.L |
4 local _G = _G | 4 local _G = _G |
5 local CreateFrame = CreateFrame | 5 local CreateFrame = CreateFrame |
6 local format = string.format | 6 local format = string.format |
7 local GetCVar = GetCVar | 7 local GetCVar = GetCVar |
29 end | 29 end |
30 ]] | 30 ]] |
31 | 31 |
32 local _onReceiveDrag = -- function(self, button, kind, value, ...) | 32 local _onReceiveDrag = -- function(self, button, kind, value, ...) |
33 [[ | 33 [[ |
34 if kind then -- pet spells on the cursor return nil from GetCursorInfo(), which is very strange | 34 if kind == "petaction" then |
35 return "petaction", self:GetAttribute("action") | |
36 else | |
35 return kind, value, ... | 37 return kind, value, ... |
36 end | 38 end |
37 return "petaction", self:GetAttribute("action") | |
38 ]] | 39 ]] |
39 | 40 |
40 -- | 41 -- |
41 -- private | 42 -- private |
42 -- | 43 -- |
77 | 78 |
78 ReAction.Button.PetAction = Pet | 79 ReAction.Button.PetAction = Pet |
79 ReAction:RegisterBarType(Pet) | 80 ReAction:RegisterBarType(Pet) |
80 | 81 |
81 function Pet:New( config, bar, idx, idHint ) | 82 function Pet:New( config, bar, idx, idHint ) |
82 local name = format("ReAction_%s_PetAction_%d",bar:GetName(),idx) | 83 self = Super.New(self, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) |
83 | 84 |
84 self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) | 85 local name = self:GetFrame():GetName() |
85 | 86 |
86 local f = self:GetFrame() | 87 local f = self:GetFrame() |
87 if not f.autoCastTexture then | 88 if not f.autoCastTexture then |
88 -- store autocast stuff with the frame for recycling | 89 -- store autocast stuff with the frame for recycling |
89 local tex = f:CreateTexture(nil,"OVERLAY") | 90 local tex = f:CreateTexture(nil,"OVERLAY") |
160 | 161 |
161 function Pet:SetupBar(bar) | 162 function Pet:SetupBar(bar) |
162 Super.SetupBar(self,bar) | 163 Super.SetupBar(self,bar) |
163 | 164 |
164 -- auto show/hide when pet exists | 165 -- auto show/hide when pet exists |
165 bar:RegisterUnitWatch("pet",true) | 166 bar:RegisterUnitWatch("pet",not ReAction:GetConfigMode()) |
166 | 167 |
167 self:UpdateButtonLock(bar) | 168 self:UpdateButtonLock(bar) |
168 end | 169 end |
169 | 170 |
170 function Pet:UpdateButtonLock(bar) | 171 function Pet:UpdateButtonLock(bar) |