diff 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
line wrap: on
line diff
--- a/classes/PetActionButton.lua	Fri Mar 06 23:44:55 2009 +0000
+++ b/classes/PetActionButton.lua	Fri Mar 06 23:58:02 2009 +0000
@@ -67,7 +67,7 @@
 
   local f = self:GetFrame()
   if not f.autoCastTexture then
-    -- store with the frame for recycling
+    -- store autocast stuff with the frame for recycling
     f.autoCastShine = CreateFrame("Frame",name.."Shine",f,"AutoCastShineTemplate")
     local tex = f:CreateTexture(nil,"OVERLAY")
     tex:SetTexture([[Interface\Buttons\UI-AutoCastableOverlay]])
@@ -75,42 +75,29 @@
     tex:SetWidth(58)
     tex:SetPoint("CENTER")
     f.autoCastTexture = tex
+    -- move the cooldown around
+    local cd = self.frames.cooldown
+    cd:ClearAllPoints()
+    cd:SetWidth(33)
+    cd:SetHeight(33)
+    cd:SetPoint("CENTER", f, "CENTER", -2, -1)
+    -- resize to 30x30
+    f:SetHeight(30)
+    f:SetWidth(30)
   end
   local barFrame = bar:GetFrame()
 
-  local frames = { }
-  self.frames = frames
-  frames.icon          = _G[name.."Icon"]
-  frames.flash         = _G[name.."Flash"]
-  frames.hotkey        = _G[name.."HotKey"]
-  frames.count         = _G[name.."Count"]
-  frames.name          = _G[name.."Name"]
-  frames.border        = _G[name.."Border"]
-  frames.cooldown      = _G[name.."Cooldown"]
-  frames.normalTexture = _G[name.."NormalTexture"]
-
-  -- resize to 30x30
-  f:SetHeight(30)
-  f:SetWidth(30)
-
-  -- move the cooldown around
-	local cd = self.frames.cooldown
-  cd:ClearAllPoints()
-	cd:SetWidth(33)
-	cd:SetHeight(33)
-	cd:SetPoint("CENTER", f, "CENTER", -2, -1)
-
-  self.hotkey = frames.hotkey -- alias for Button methods
-  self.border = frames.border -- alias for Button methods
-
   -- set up the base action ID
   self:SetActionIDPool("pet",10)
   config.actionID = self:AcquireActionID(config.actionID, idHint, true)
 
   -- attribute setup
-  -- In order to get the full behavior of the pet buttons 
-  -- (petattack, toggle autocast, start/stop attack) we need
-  -- to use a secure click proxy type instead of a "pet" type.
+  -- There's no secure way to do PetAutoCastToggle by actionID, so use
+  -- a click-through proxy to the Blizzard pet buttons for right-click
+  -- Note that technically this doesn't do PetStopAttack() when 
+  -- IsPetAttackActive() is true: however that's only true when using
+  -- Eyes of the Beast and appears not to really do anything (at least
+  -- I can't find any difference)
   f:SetAttribute("type","pet")
   f:SetAttribute("type2","click")
   f:SetAttribute("clickbutton2",_G["PetActionButton"..config.actionID])