diff classes/StanceButton.lua @ 179:bf64e71701e2

Remove support for hunter aspects in stance bar. Remove option to disable DK/paladin auras in stance bar. (drycoded)
author Flick <flickerstreak@gmail.com>
date Wed, 20 Oct 2010 23:40:41 +0000
parents df68b5a40490
children e63aefb8a555
line wrap: on
line diff
--- a/classes/StanceButton.lua	Wed Oct 20 18:58:36 2010 +0000
+++ b/classes/StanceButton.lua	Wed Oct 20 23:40:41 2010 +0000
@@ -18,20 +18,6 @@
 --
 local playerClass = select(2,UnitClass("player"))
 
-local aspects = {
-  -- All rank one, so that the usable check works
-  GetSpellInfo(13163), -- monkey
-  GetSpellInfo(13165), -- hawk
-  GetSpellInfo(5118),  -- cheetah
-  GetSpellInfo(34074), -- viper
-  GetSpellInfo(13161), -- beast
-  GetSpellInfo(13159), -- pack
-  GetSpellInfo(20043), -- wild
-  GetSpellInfo(61846), -- dragonhawk
-}
-
-local aspectLinks = { }
-
 local eventList = {
   "PLAYER_REGEN_ENABLED",
   "PLAYER_ENTERING_WORLD",
@@ -42,20 +28,6 @@
   "UPDATE_BINDINGS",
 }
 
-local eventListHunter = {
-  "PLAYER_REGEN_ENABLED",
-  "PLAYER_ENTERING_WORLD",
-  "SPELL_UPDATE_COOLDOWN",
-  "SPELL_UPDATE_USABLE",
-  "UNIT_AURA",
-  "SPELLS_CHANGED",
-  "UPDATE_BINDINGS",
-}
-
-if playerClass == "HUNTER" then
-  eventList = eventListHunter
-end
-
 --
 -- Stance Button class
 --
@@ -68,7 +40,6 @@
  
   self = Super.New(self, name, moduleConfig.buttons[bar:GetName()][idx], bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" )
   self.moduleConfig = moduleConfig
-  self.hunterIdx = 1
 
   local f = self:GetFrame()
   local barFrame = bar:GetFrame()
@@ -110,12 +81,6 @@
   return self
 end
 
-function Stance:GetModuleConfig()
-  -- this is the Stance module config structure,
-  -- not the config structure of the bar itself
-  return self.moduleConfig
-end
-
 function Stance:GetActionID()
   return self.config.stanceID
 end
@@ -127,40 +92,7 @@
     self.updatePending = false
     local idx = self:GetActionID()
     local f = self:GetFrame()
-    local c = self:GetModuleConfig()
-    if playerClass == "HUNTER" then
-      if c.showHunterAspects then
-        -- re-map the index in the case of "hide monkey/hawk"
-        if c.hideMonkeyHawk then
-          local usable, outOfMana = IsUsableSpell(aspects[8])
-          if usable or outOfMana then
-            idx = idx + 2
-            if idx > 8 then
-              f:Hide()
-              return
-            end
-          end
-        end
-        self.hunterIdx = idx
-        -- cache the highest rank spellID
-        if not aspectLinks[aspects[idx]] then
-          aspectLinks[aspects[idx]] = GetSpellLink(aspects[idx],"")
-        end
-        local usable, outOfMana = IsUsableSpell(aspects[idx])
-        if usable or outOfMana then
-          f:SetAttribute("spell",aspects[idx])
-          f:Show()
-          self:Update()
-        else
-          -- haven't learned this spell yet
-          f:Hide()
-        end
-      else
-        f:Hide()
-      end
-    elseif idx > GetNumShapeshiftForms() or
-       playerClass == "PALADIN" and c.hidePaladinAuras or
-       playerClass == "DEATHKNIGHT" and c.hideDKPresences then
+    if idx > GetNumShapeshiftForms() then
       f:Hide()
     else
       f:SetAttribute("spell", select(2,GetShapeshiftFormInfo(idx)))
@@ -177,25 +109,7 @@
 end
 
 function Stance:Update()
-  local texture, isActive, isCastable
-  if playerClass == "HUNTER" then
-    local name, rank
-    local spell = aspects[self.hunterIdx]
-    name, rank, texture = GetSpellInfo(spell)
-    isCastable = IsUsableSpell(spell)
-    for i = 1, 40 do
-      local buff = UnitBuff("player",i,true)
-      if not buff then break end
-      if buff == spell then
-        isActive = true
-        texture = "Interface\\Icons\\Spell_Nature_WispSplode"
-        break
-      end
-    end
-  else
-    local _
-    texture, _, isActive, isCastable = GetShapeshiftFormInfo(self:GetActionID())
-  end
+  local texture, _, isActive, isCastable = GetShapeshiftFormInfo(self:GetActionID())
   
   local icon = self.frames.icon
   icon:SetTexture(texture)
@@ -211,15 +125,7 @@
 end
 
 function Stance:UpdateCooldown()
-  local start, duration, enabled
-  if playerClass == "HUNTER" then
-    local spell = aspects[self.hunterIdx]
-    if spell then
-      start, duration, enabled = GetSpellCooldown(spell)
-    end
-  else
-    start, duration, enabled = GetShapeshiftFormCooldown(self:GetActionID())
-  end
+  local start, duration, enabled = GetShapeshiftFormCooldown(self:GetActionID())
   if start then
     CooldownFrame_SetTimer(self.frames.cooldown, start, duration, enabled)
   end
@@ -231,14 +137,7 @@
   else
     GameTooltip:SetOwner(self:GetFrame(), "ANCHOR_RIGHT")
   end
-  if playerClass == "HUNTER" then
-    local aspect = aspects[self.hunterIdx]
-    if aspect and aspectLinks[aspect] then
-      GameTooltip:SetHyperlink(aspectLinks[aspect])
-    end
-  else
-    GameTooltip:SetShapeshift(self:GetActionID())
-  end
+  GameTooltip:SetShapeshift(self:GetActionID())
 end
 
 function Stance:OnEnter()
@@ -261,9 +160,7 @@
     end
   elseif event == "UPDATE_SHAPESHIFT_COOLDOWN" then
     self:UpdateCooldown()
-  elseif event == "UPDATE_SHAPESHIFT_FORMS" or
-         event == "SPELLS_CHANGED" then
-    aspectLinks = { } -- force repopulate of the spellIDs
+  elseif event == "UPDATE_SHAPESHIFT_FORMS" then
     self:UpdateAction()
   elseif event == "UNIT_AURA" then
     if arg == "player" then