Advertisement
Guest User

bRaidTweaks (WoD)

a guest
Oct 15th, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.81 KB | None | 0 0
  1. local important = {
  2.     -- Crowd control
  3.     [GetSpellInfo(55041)]       = 3,    -- Freezing Trap Effect
  4.     [GetSpellInfo(5782)]        = 3,    -- Fear
  5.     [GetSpellInfo(6789)]        = 3,    -- Mortal Coil
  6.     [GetSpellInfo(6358)]        = 3,    -- Seduction
  7.     [GetSpellInfo(5484)]        = 3,    -- Howl of Terror
  8.     [GetSpellInfo(8122)]        = 3,    -- Psychic Scream
  9.     [GetSpellInfo(10326)]       = 3,    -- Turn Evil
  10.     [GetSpellInfo(5246)]        = 3,    -- Intimidating Shout
  11.     [GetSpellInfo(118)]         = 3,    -- Polymorph
  12.     [GetSpellInfo(28272)]       = 3,    -- Polymorph (pig)
  13.     [GetSpellInfo(28271)]       = 3,    -- Polymorph (turtle)
  14.     [GetSpellInfo(61305)]       = 3,    -- Polymorph (black cat)
  15.     [GetSpellInfo(61025)]       = 3,    -- Polymorph (serpent)
  16.     [GetSpellInfo(51514)]       = 3,    -- Hex
  17.     [GetSpellInfo(33786)]       = 3,    -- Cyclone
  18.     [GetSpellInfo(605)]         = 3,    -- Dominate Mind
  19.  
  20.     -- Roots
  21.     [GetSpellInfo(339)]         = 3,    -- Entangling Roots
  22.     [GetSpellInfo(122)]         = 3,    -- Frost Nova
  23.     [GetSpellInfo(13809)]       = 1,    -- Frost Trap
  24.  
  25.     -- Stuns and incapacitates
  26.     [GetSpellInfo(44572)]       = 3,    -- Deep Freeze
  27.     [GetSpellInfo(19386)]       = 3,    -- Wyvern Sting
  28.     [GetSpellInfo(853)]         = 3,    -- Hammer of Justice
  29.     [GetSpellInfo(20066)]       = 3,    -- Repentance
  30.     [GetSpellInfo(91800)]       = 3,    -- Gnaw
  31.     [GetSpellInfo(5211)]        = 3,    -- Mighty Bash
  32.     [GetSpellInfo(1822)]        = 3,    -- Rake
  33.     [GetSpellInfo(107570)]      = 3,    -- Storm Bolt
  34.     [GetSpellInfo(46968)]       = 3,    -- Shockwave
  35.     [GetSpellInfo(30283)]       = 3,    -- Shadowfury
  36.     [GetSpellInfo(6770)]        = 3,    -- Sap
  37.     [GetSpellInfo(115078)]      = 3,    -- Paralysis
  38.     [GetSpellInfo(1833)]        = 3,    -- Cheap Shot
  39.     [GetSpellInfo(2094)]        = 3,    -- Blind
  40.     [GetSpellInfo(88625)]       = 3,    -- Holy Word: Chastise
  41.     [GetSpellInfo(99)]          = 3,    -- Incapacitating Roar
  42.  
  43.     -- Silences
  44.     [GetSpellInfo(15487)]       = 1,    -- Silence
  45.     [GetSpellInfo(47476)]       = 1,    -- Strangulate
  46.     [GetSpellInfo(1330)]        = 1,    -- Garrote - Silence
  47. }
  48.  
  49. local CanDispel = {
  50.     DRUID = { Magic = true, Curse = true, Poison = true, },
  51.     MONK = { Magic = true, Disease = true, Poison = true, },
  52.     PALADIN = { Magic = true, Disease = true, Poison = true, },
  53.     PRIEST = { Magic = true, Disease = true, },
  54.     SHAMAN = { Magic = true, Curse = true, },
  55.     MAGE = { Curse = true, }
  56. }
  57.  
  58. local dispellist = CanDispel[select(2,UnitClass("player"))] or {}
  59. local Texture_SetSize = ActionButton1Icon.SetSize
  60.  
  61. function styleCompactFrame(self)
  62.     self:RegisterForDrag("LeftButton")
  63.    
  64.     self:SetScript("OnDragStart", function(self)
  65.         if (self:GetParent().movable) then
  66.             CompactRaidGroup_StartMoving(self:GetParent())
  67.         else
  68.             CompactRaidFrameManager_ResizeFrame_OnDragStart(CompactRaidFrameManagerContainerResizeFrameMover:GetParent():GetParent())
  69.         end
  70.     end)
  71.    
  72.     CompactUnitFrame_SetMaxDebuffs(self, 1)
  73.    
  74.     self:SetScript("OnDragStop", function(self)
  75.         if (self:GetParent().movable) then
  76.             CompactRaidGroup_StopMoving(self:GetParent())
  77.         else
  78.             CompactRaidFrameManager_ResizeFrame_OnDragStop(CompactRaidFrameManagerContainerResizeFrameMover:GetParent():GetParent())
  79.         end
  80.     end)
  81.  
  82.     self.name:SetFontObject(NumberFontNormal)
  83.     self.name:ClearAllPoints()
  84.     self.name:SetPoint("CENTER")
  85.  
  86.     local buffs = self.buffFrames
  87.     local debuffs = self.debuffFrames
  88.     local d_debuffs = self.dispelDebuffFrames
  89.  
  90.     for i=1,3 do
  91.         Texture_SetSize(buffs[i], 20, 20) --12
  92.         Texture_SetSize(debuffs[i], 26, 26) --32
  93.        
  94.         debuffs[i]:SetAlpha(1)
  95.         debuffs[i]:ClearAllPoints()
  96.         debuffs[i]:SetPoint('CENTER')
  97.         debuffs[i].border:Hide()
  98.         debuffs[i]:EnableMouse(false)
  99.        
  100.         d_debuffs[i]:Hide()
  101.         d_debuffs[i].Show = function() end
  102.        
  103.         if not buffs[i].bg then
  104.             buffs[i].icon:SetTexCoord(.1,.9,.1,.9)
  105.             buffs[i].icon:SetPoint("TOPLEFT", 1, -1)
  106.             buffs[i].icon:SetPoint("BOTTOMRIGHT", -1, 1)
  107.             buffs[i].bg = buffs[i]:CreateTexture(nil, "BORDER")
  108.             buffs[i].bg:SetAllPoints(buffs[i])
  109.             buffs[i].bg:SetTexture(0,0,0,1)
  110.         end
  111.     end
  112.  
  113.     buffs[1]:ClearAllPoints()
  114.     buffs[1]:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -1, 1)
  115.  
  116.     --self.background:SetTexture(0, 0, 0, .5)
  117.  
  118.     --self.statusText:SetFont(STANDARD_TEXT_FONT, 14, "OVERLAY")
  119.     self.statusText:ClearAllPoints()
  120.     self.statusText:SetPoint("BOTTOM", 0, 8)
  121. end
  122.  
  123. function CompactUnitFrame_UtilIsPriorityDebuff(unit, index, filter)
  124.     local _, _, _, _, debuffType = UnitDebuff(unit, index, filter)
  125.     return (debuffType and dispellist[debuffType]) and true or false
  126. end
  127.  
  128. function CompactUnitFrame_UpdateDebuffs(frame)
  129.     if ( not frame.optionTable.displayDebuffs ) then CompactUnitFrame_HideAllDebuffs(frame); return; end
  130.  
  131.     local index = 1
  132.     local _, _, icon, _, debuffType, _, _, _, _, _, spellId = UnitDebuff(frame.displayedUnit, index)
  133.     local debuffFrame = frame.debuffFrames[1]
  134.    
  135.     debuffFrame.unstable = false
  136.     debuffFrame:Hide()
  137.    
  138.     while spellId do
  139.         _, _, icon, _, debuffType, _, _, _, _, _, spellId = UnitDebuff(frame.displayedUnit, index)
  140.         if spellId == 30108 or spellId == 34914 then
  141.             debuffFrame.unstable = true
  142.             CompactUnitFrame_UtilSetDebuff(debuffFrame, frame.displayedUnit, index)
  143.             styleCompactFrame(frame)
  144.             return
  145.         end
  146.         index = index + 1
  147.     end
  148.  
  149.     index = 1
  150.     _, _, icon, _, debuffType, _, _, _, _, _, spellId = UnitDebuff(frame.displayedUnit, index)
  151.    
  152.     while spellId do
  153.         _, _, icon, _, debuffType, _, _, _, _, _, spellId = UnitDebuff(frame.displayedUnit, index)
  154.         if CompactUnitFrame_UtilIsPriorityDebuff(frame.displayedUnit, index) then
  155.             if important[GetSpellInfo(spellId)] then
  156.                 CompactUnitFrame_UtilSetDebuff(debuffFrame, frame.displayedUnit, index)
  157.                 styleCompactFrame(frame)
  158.                 return
  159.             end
  160.         end
  161.         index = index + 1
  162.     end
  163.    
  164.     index = 1
  165.     _, _, icon, _, debuffType, _, _, _, _, _, spellId = UnitDebuff(frame.displayedUnit, index)
  166.    
  167.     while spellId do
  168.         _, _, icon, _, debuffType, _, _, _, _, _, spellId = UnitDebuff(frame.displayedUnit, index)
  169.         if CompactUnitFrame_UtilIsPriorityDebuff(frame.displayedUnit, index) then
  170.             CompactUnitFrame_UtilSetDebuff(debuffFrame, frame.displayedUnit, index)
  171.             styleCompactFrame(frame)
  172.             return
  173.         end
  174.         index = index + 1
  175.     end
  176.    
  177. end
  178.  
  179. hooksecurefunc("CompactUnitFrame_UtilSetDebuff", function(debuffFrame, unit, index, filter)
  180.     local _, _, icon, _, debuffType, _, _, _, _, _, spellId = UnitDebuff(unit, index, filter)
  181.    
  182.     debuffFrame.icon:SetTexCoord(.1,.9,.1,.9)
  183.        
  184.     if debuffFrame.unstable then
  185.         debuffFrame.icon:SetDesaturated(true)
  186.         debuffFrame:Show()
  187.         return
  188.     else
  189.         debuffFrame.icon:SetDesaturated(false)
  190.     end
  191.    
  192.     debuffFrame:Show()
  193. end)
  194.  
  195. hooksecurefunc("DefaultCompactUnitFrameSetup", styleCompactFrame)
  196. hooksecurefunc("DefaultCompactMiniFrameSetup", styleCompactFrame)
  197. hooksecurefunc("CompactRaidFrameReservation_RegisterReservation", function(_, self, _) styleCompactFrame(self) end)
  198.  
  199. --[[
  200. hooksecurefunc("CompactUnitFrame_UpdateName", function(self)
  201.     if self.name and self.name:GetText() then
  202.         if #self.name:GetText() > 8 then
  203.             self.name:SetText(self.name:GetText():sub(1,8))
  204.         end
  205.     end
  206. end)--]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement