diff 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
line wrap: on
line diff
--- a/PetActionButton.lua	Wed May 11 09:53:48 2011 -0700
+++ b/PetActionButton.lua	Sat Jun 11 10:57:00 2011 -0700
@@ -1,5 +1,5 @@
-local addonName, addonTable = ...
-local ReAction = addonTable.ReAction
+local _, ns = ...
+local ReAction = ns.ReAction
 local L = ReAction.L
 local _G = _G
 local CreateFrame = CreateFrame
@@ -31,10 +31,11 @@
 
 local _onReceiveDrag = -- function(self, button, kind, value, ...)
 [[
-  if kind then -- pet spells on the cursor return nil from GetCursorInfo(), which is very strange
+  if kind == "petaction" then
+    return "petaction", self:GetAttribute("action")
+  else
     return kind, value, ...
   end
-  return "petaction", self:GetAttribute("action")
 ]]
 
 --
@@ -79,9 +80,9 @@
 ReAction:RegisterBarType(Pet)
 
 function Pet:New( config, bar, idx, idHint )
-  local name = format("ReAction_%s_PetAction_%d",bar:GetName(),idx)
- 
-  self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" )
+  self = Super.New(self, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" )
+
+  local name = self:GetFrame():GetName()
 
   local f = self:GetFrame()
   if not f.autoCastTexture then
@@ -162,7 +163,7 @@
   Super.SetupBar(self,bar)
 
   -- auto show/hide when pet exists
-  bar:RegisterUnitWatch("pet",true)
+  bar:RegisterUnitWatch("pet",not ReAction:GetConfigMode())
 
   self:UpdateButtonLock(bar)
 end