Код:
--Change the format of hp/mana text to absolute values ("140k"):
local f=function(v)if(v>=1e4) then return ('%.1fk'):format(v/1e3):gsub('%.?0+([km])$','%1') else return v end end
hooksecurefunc("TextStatusBar_UpdateTextString",function(s)
if not GetCVarBool("statusTextPercentage") then
if s.TextString and s.currValue then
s.TextString:SetText(f(s.currValue))
end
end
end)
--hide macro labels
hooksecurefunc('ActionButton_UpdateHotkeys', function(self)
local macro = _G[self:GetName()..'Name']
if macro then macro:Hide() end
end)
--Blizzard Loss Of Control
hooksecurefunc("CooldownFrame_SetTimer", function(self)
if self.currentCooldownType == COOLDOWN_TYPE_LOSS_OF_CONTROL then
self:SetCooldown(0, 0)
end
end)
select(1,LossOfControlFrame:GetRegions()):SetAlpha(0)
select(2,LossOfControlFrame:GetRegions()):SetAlpha(0)
select(3,LossOfControlFrame:GetRegions()):SetAlpha(0)
select(2,LossOfControlFrame:GetChildren()):SetAlpha(0)
select(4,LossOfControlFrame:GetRegions()):ClearAllPoints ()
LossOfControlFrame:ClearAllPoints() LossOfControlFrame:SetPoint("CENTER",UIParent,"CENTER",70,0)
select(4,LossOfControlFrame:GetRegions()):SetPoint("CENTER",UIParent,"CENTER",70,0)
select(5,LossOfControlFrame:GetRegions()):SetAlpha(0)
--Arena talents
local aftscript = CreateFrame("Frame")
aftscript:RegisterEvent("PLAYER_ENTERING_WORLD")
local function eventHandler(self,event)
if event == "PLAYER_ENTERING_WORLD" then
local _, instanceType = IsInInstance()
if instanceType == "arena" or instanceType == "pvp" then
TalentFrame_LoadUI()
ShowUIPanel(PlayerTalentFrame)
end
end
end
--clean player frame
hooksecurefunc("PlayerFrame_UpdateStatus", function()
if IsResting("player") then
PlayerStatusTexture:Hide()
PlayerRestIcon:Hide()
PlayerRestGlow:Hide()
PlayerStatusGlow:Hide()
elseif PlayerFrame.inCombat then
PlayerStatusTexture:Hide()
PlayerAttackIcon:Hide()
PlayerRestIcon:Hide()
PlayerAttackGlow:Hide()
PlayerRestGlow:Hide()
PlayerStatusGlow:Hide()
PlayerAttackBackground:Hide() end end)
--hide stancebar
RegisterStateDriver(StanceBarFrame, 'visibility', 'hide')
--hide petname
PetName:Hide()
--Woundman DRTracker
USD="UNIT_SPELLCAST_SUCCEEDED";OT="OnEvent";FR="Frame";RF=CreateFrame;RD="Border";UE=UnitName
CS=RF(FR) CS.c=RF("Cooldown","CST",CS.t) CS:RegisterEvent(USD)
CS.c:SetAllPoints(CS) CS:SetPoint("RIGHT",PlayerFrame,22,28)CS:SetSize(25,22)CS.t=CS:CreateTexture(nil,RD)CS.t:SetAllPoints()CS.t:SetTexture("Interface\\Icons\\ability_cheapshot")
CS:SetScript(OT,function(self,event,...)if UE(select(1,...))==UE("player")and select(5,...)==1833 then CST:SetCooldown(GetTime(),23) end if UE(select(1,...))==UE("player")and select(5,...)==408 then CST:SetCooldown(GetTime(),25)end end)
SP=RF(FR) SP.c=RF("Cooldown","SAP",SP.t) SP:RegisterEvent(USD)
SP.c:SetAllPoints(SP) SP:SetPoint("RIGHT",PlayerFrame,22,6)SP:SetSize(25,22)SP.t=SP:CreateTexture(nil,RD)SP.t:SetAllPoints()SP.t:SetTexture("Interface\\Icons\\ability_sap")
SP:SetScript(OT,function(self,event,...)if UE(select(1,...))==UE("player")and select(5,...)==6770 then SAP:SetCooldown(GetTime(),27)end if UE(select(1,...))==UE("player")and select(5,...)==1776 then SAP:SetCooldown(GetTime(),23)end end)
--cd text fix
COOLDOWN_DURATION_MIN = "%dm"
COOLDOWN_DURATION_HOURS = "%dh"
--Combat Text
local ctscript = CreateFrame("Frame")
ctscript:RegisterEvent("ADDON_LOADED")
local function eventHandler(self,event,a1)
if event == "ADDON_LOADED" and a1 == "Blizzard_CombatText" then
--ENTERING_COMBAT = "+Combat"
--LEAVING_COMBAT = "-Combat"
CombatText:SetScale(.7)
--AURA_END = "-%s"
--COMBAT_TEXT_TYPE_INFO["SPELL_AURA_START_HARMFUL"].var = 0
--COMBAT_TEXT_TYPE_INFO["SPELL_AURA_END_HARMFUL"].var = 0
--COMBAT_TEXT_TYPE_INFO["SPELL_AURA_END"].var = 0
--COMBAT_TEXT_TYPE_INFO["SPELL_DAMAGE"].show = nil
--COMBAT_TEXT_TYPE_INFO["SPELL_DAMAGE_CRIT"].show = nil
--COMBAT_TEXT_TYPE_INFO["DAMAGE_CRIT"].show = nil
COMBAT_TEXT_TYPE_INFO["HEAL_CRIT_ABSORB"].show = nil
COMBAT_TEXT_TYPE_INFO["PERIODIC_HEAL"].show = nil
COMBAT_TEXT_TYPE_INFO["HEAL_CRIT"].show = nil
COMBAT_TEXT_TYPE_INFO["HEAL"].show = nil
COMBAT_TEXT_TYPE_INFO["PERIODIC_HEAL_ABSORB"].show = nil
COMBAT_TEXT_TYPE_INFO["HEAL_ABSORB"].show = nil
COMBAT_TEXT_TYPE_INFO["ABSORB_ADDED"].show = nil
--COMBAT_TEXT_COMBO_POINTS = "%d CP"
--COMBAT_TEXT_TYPE_INFO["COMBO_POINTS"].r = 0.1
--COMBAT_TEXT_TYPE_INFO["COMBO_POINTS"].g = 1
--COMBAT_TEXT_TYPE_INFO["COMBO_POINTS"].b = 0.1
--COMBAT_TEXT_TYPE_INFO["ENTERING_COMBAT"].r = 1
--COMBAT_TEXT_TYPE_INFO["ENTERING_COMBAT"].g = 0
--COMBAT_TEXT_TYPE_INFO["ENTERING_COMBAT"].b = 1
--COMBAT_TEXT_TYPE_INFO["LEAVING_COMBAT"].r = 1
--COMBAT_TEXT_TYPE_INFO["LEAVING_COMBAT"].g = 0
--COMBAT_TEXT_TYPE_INFO["LEAVING_COMBAT"].b = 1
end
end
ctscript:SetScript("OnEvent",eventHandler)
--arena statistic
for i=0,1 do teamName,oldTeamRating,newTeamRating, teamRating=GetBattlefieldTeamInfo(i);SendChatMessage(teamName .. " (now: " .. newTeamRating .. "; before: " .. oldTeamRating .. "; mmr: " .. teamRating .. ")", "PARTY"); end
--Disable healing/damage spam over player/pet frame
PlayerHitIndicator:SetText(nil)
PlayerHitIndicator.SetText = function() end
PetHitIndicator:SetText(nil)
PetHitIndicator.SetText = function() end
-- EDIT THIS LINE BELOW TO CHANGE YOUR NAME
NewName = "Diskay"
PN = GetUnitName("player")
-- Change Player UnitFrame Name
PFNC = CreateFrame("Frame", "PlayerFrameNameChange")
local function ChangePlayerName(self)
PlayerFrame.name:SetText(NewName)
end
PFNC:SetScript("OnUpdate", ChangePlayerName)
--group number
PlayerFrameGroupIndicator.Show = function() return end
--Class colors in hp bars
local function colour(statusbar, unit)
local _, class, c
if UnitIsPlayer(unit) and UnitIsConnected(unit) and unit == statusbar.unit and UnitClass(unit) then
_, class = UnitClass(unit)
c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
statusbar:SetStatusBarColor(c.r, c.g, c.b)
PlayerFrameHealthBar:SetStatusBarColor(0,1,0)
end
end
hooksecurefunc("UnitFrameHealthBar_Update", colour)
hooksecurefunc("HealthBar_OnValueChanged", function(self)
colour(self, self.unit)
end)
--FocusFrameSpellBar
FocusFrameSpellBar:ClearAllPoints()
FocusFrameSpellBar:SetPoint("BOTTOM", FocusFrame, "LEFT", -80, 0)
FocusFrameSpellBar.SetPoint = function() end
FocusFrameSpellBar:SetScale(1.3)
--target cast bar
TargetFrameSpellBar:ClearAllPoints()
TargetFrameSpellBar:SetPoint("CENTER", UIParent, "CENTER", 0, 30)
TargetFrameSpellBar.SetPoint = function() end
TargetFrameSpellBar:SetScale(1.3)
--[[
BuffTracker
bl = icon list
bs = icon size
xb = x positon of buff Tracker
yb = y positon of buff Tracker
br = x buffs per line
]]--
bl={73651,5171,1966,108208,1784,126707,118334,51713}
bs=25;xb=-290;yb=35;br=7;bdr="BORDER"be="UNIT_AURA"cbf=CreateFrame;gi=GetSpellInfo;bm=math.ceil;fm=math.floor;st=STANDARD_TEXT_FONT;function cu(s)return UnitBuff("player",gi(s))end
function Cb(i,s)local _,_,t3=gi(s)local f=cbf("Frame")f:SetSize(bs,bs)f.t=f:CreateTexture(nil,bdr)f.t:SetAllPoints(true)f.t:SetTexture(t3)f.f=f:CreateFontString(nil,bdr)f.f:SetFont(st,12,"OUTLINE")f.f:SetPoint("BOTTOMRIGHT",0,0)return f;end
function vb(s,i,row)local b1,_,_,b4=cu(s)local f=_G["B"..i]if b1 then f:Show()f:SetPoint("CENTER",xb+(bs+5)*bm((row-1)%br),yb-(bs+10)*bm(row/br))if(b4>1)then f.f:SetText(b4)end row=row+1;end return row;end
function ub()for i,s in ipairs(bl)do local b,_,_,_,_,_,k=cu(s)if b then local vt=fm(k-GetTime())if(vt>=60)then vt=bm(vt/60)_G["B"..i].c:SetText(vt.."m")elseif vt >=0 then _G["B"..i].c:SetText(vt.."s")end end end end
function Cc(f)f.c=f:CreateFontString(nil,bdr)f.c:SetFont(st,12,"OUTLINE")f.c:SetPoint("CENTER",0,-20)end function db()for i in ipairs(bl)do _G["B"..i]:Hide()end end
for i,s in ipairs(bl)do _G["B"..i]=Cb(i,s)Cc(_G["B"..i])_G["B"..i]:Hide()end function bb()db()local bw=1;for i,s in ipairs(bl)do bw=vb(s,i,bw)end end bk=cbf("Frame")bk:SetScript("OnEvent",bb)bk:SetScript("OnUpdate",ub)bk:RegisterEvent(be)
--hide graphics
MainMenuBarLeftEndCap:Hide()
MainMenuBarRightEndCap:Hide()
MainMenuExpBar:Hide()
MainMenuBarMaxLevelBar:SetAlpha(0)
MainMenuBarTexture0:Hide()
MainMenuBarTexture1:Hide()
MainMenuBarTexture2:Hide()
MainMenuBarTexture3:Hide()
--classicons
UFP = "UnitFramePortrait_Update"
UICC = "Interface\\TargetingFrame\\UI-Classes-Circles"
CIT = CLASS_ICON_TCOORDS
hooksecurefunc(UFP,function(self) if self.portrait then if UnitIsPlayer(self.unit) and UnitIsVisible(self.unit) then self.portrait:SetTexture(UICC) self.portrait:SetTexCoord(unpack(CIT[select(2,UnitClass(self.unit))])) else self.portrait:SetTexCoord(0,1,0,1) end end end)
--Hide pvpicon
TargetFrameTextureFramePVPIcon:SetAlpha(0)
PlayerPVPIcon:SetAlpha(0)
FocusFrameTextureFramePVPIcon:SetAlpha(0)
--combat icon
CTT=CreateFrame("Frame")CTT:SetParent(TargetFrame)CTT:SetPoint("Right",TargetFrameTextureFrame,-38,-17)CTT:SetSize(27,27)CTT.t=CTT:CreateTexture(nil,BORDER)CTT.t:SetAllPoints()CTT.t:SetTexture("Interface\\Icons\\ABILITY_DUALWIELD")CTT:Hide()
local function FrameOnUpdate(self) if UnitAffectingCombat("target") then self:Show() else self:Hide() end end local g = CreateFrame("Frame") g:SetScript("OnUpdate", function(self) FrameOnUpdate(CTT) end)
CFT=CreateFrame("Frame")CFT:SetParent(FocusFrame)CFT:SetPoint("Right",FocusFrame,0,5)CFT:SetSize(30,30)CFT.t=CFT:CreateTexture(nil,BORDER)CFT.t:SetAllPoints()CFT.t:SetTexture("Interface\\Icons\\ABILITY_DUALWIELD")CFT:Hide()
local function FrameOnUpdate(self) if UnitAffectingCombat("focus") then self:Show() else self:Hide() end end local g = CreateFrame("Frame") g:SetScript("OnUpdate", function(self) FrameOnUpdate(CFT) end)
--Big Debuffs
hooksecurefunc("TargetFrame_UpdateAuraPositions", function(self, auraName, numAuras, numOppositeAuras,largeAuraList, updateFunc, maxRowWidth, offsetX)
local AURA_OFFSET_Y = 3
local LARGE_AURA_SIZE = 30 -- развер ВАШИХ баффов/дебаффов.
local SMALL_AURA_SIZE = 23 -- развер чужих баффов/дебаффов.
local size
local offsetY = AURA_OFFSET_Y
local rowWidth = 0
local firstBuffOnRow = 1
for i=1, numAuras do
if ( largeAuraList[i] ) then
size = LARGE_AURA_SIZE
offsetY = AURA_OFFSET_Y + AURA_OFFSET_Y
else
size = SMALL_AURA_SIZE
end
if ( i == 1 ) then
rowWidth = size
self.auraRows = self.auraRows + 1
else
rowWidth = rowWidth + size + offsetX
end
if ( rowWidth > maxRowWidth ) then
updateFunc(self, auraName, i, numOppositeAuras, firstBuffOnRow, size, offsetX, offsetY)
rowWidth = size
self.auraRows = self.auraRows + 1
firstBuffOnRow = i
offsetY = AURA_OFFSET_Y
else
updateFunc(self, auraName, i, numOppositeAuras, i - 1, size, offsetX, offsetY)
end
end
end)
--прозрачные фреймы у таргета и фокуса
hooksecurefunc('TargetFrame_CheckFaction', function(self)
if ( not UnitPlayerControlled(self.unit)
and UnitIsTapped(self.unit)
and not UnitIsTappedByPlayer(self.unit)
and not UnitIsTappedByAllThreatList(self.unit) ) then
self.nameBackground:SetVertexColor(0.0, 0.0, 0.0, 0.5);
if ( self.portrait ) then
self.portrait:SetVertexColor(0.5, 0.5, 0.5);
end
else
self.nameBackground:SetVertexColor(0.0, 0.0, 0.0, 0.5);
if ( self.portrait ) then
self.portrait:SetVertexColor(1.0, 1.0, 1.0);
end
end
end)
--minimap
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
Minimap:EnableMouseWheel(true)
Minimap:SetScript('OnMouseWheel', function(self, delta)
if delta > 0 then
Minimap_ZoomIn()
else
Minimap_ZoomOut()
end
end)
MiniMapTracking:ClearAllPoints()
MiniMapTracking:SetPoint("TOPRIGHT", -26, 7)
--cast bar
CastingBarFrame.timer = CastingBarFrame:CreateFontString(nil);
CastingBarFrame.timer:SetFont(STANDARD_TEXT_FONT,12,"OUTLINE");
CastingBarFrame.timer:SetPoint("TOP", CastingBarFrame, "BOTTOM", 0, 0);
CastingBarFrame.update = .1;
hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
if not self.timer then return end
if self.update and self.update < elapsed then
if self.casting then
self.timer:SetText(format("%2.1f/%1.1f", max(self.maxValue - self.value, 0), self.maxValue))
elseif self.channeling then
self.timer:SetText(format("%.1f", max(self.value, 0)))
else
self.timer:SetText("")
end
self.update = .1
else
self.update = self.update - elapsed
end
end)
--DRTracker
local DRTracker = CreateFrame("Cooldown", "DRTracker", UIParent)
local DRs = {}
local lastChangedFrame = nil
DRTracker:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
DRTracker:RegisterEvent("ADDON_LOADED")
local spellIds = { -- DR Categories listed here [url=http://eu.battle.net/wow/en/forum/topic/11267997531]http://eu.battle.net/wow/en/forum/topic/11267997531[/url]
-- Many thanks to those that assisted the creation of the original list from LoseControl.
-- Categories: Stun (1), Silence (2), Disorient/Fear (3), Incapacitate/Polymorph (4), Roots (5)
-- Death Knight
[108194] = "Stun", -- Asphyxiate
[115001] = "Stun", -- Remorseless Winter
[47476] = "Silence", -- Strangulate
[96294] = "Root", -- Chains of Ice (Chilblains)
-- Death Knight Ghoul
[91800] = "Stun", -- Gnaw
[91797] = "Stun", -- Monstrous Blow (Dark Transformation)
[91807] = "Root", -- Shambling Rush (Dark Transformation)
-- Druid
[113801] = "Stun", -- Bash (Force of Nature - Feral Treants)
[102795] = "Stun", -- Bear Hug
[33786] = "Disorient", -- Cyclone
[99] = "Incap", -- Disorienting (Incapacitating) Roar
[22570] = "Stun", -- Maim
[5211] = "Stun", -- Mighty Bash
[163505] = "Stun", -- Rake
[114238] = "Silence", -- Fae Silence (Glyph of Fae Silence)
[81261] = "Silence", -- Solar Beam
[339] = "Root", -- Entangling Roots
[113770] = "Root", -- Entangling Roots (Force of Nature - Balance Treants)
[19975] = "Root", -- Entangling Roots (Nature's Grasp)
[45334] = "Root", -- Immobilized (Wild Charge - Bear)
[102359] = "Root", -- Mass Entanglement
-- Hunter
[117526] = "Stun", -- Binding Shot
[3355] = "Incap", -- Freezing Trap
[1513] = "Disorient", -- Scare Beast
[19386] = "Incap", -- Wyvern Sting
[34490] = "Silence", -- Silencing Shot
[19185] = "Root", -- Entrapment
[64803] = "Root", -- Entrapment
[128405] = "Root", -- Narrow Escape
-- Mage
[118271] = "Stun", -- Combustion Impact
[44572] = "Stun", -- Deep Freeze
[31661] = "Disorient", -- Dragon's Breath
[118] = "Incap", -- Polymorph
[61305] = "Incap", -- Polymorph: Black Cat
[28272] = "Incap", -- Polymorph: Pig
[61721] = "Incap", -- Polymorph: Rabbit
[61780] = "Incap", -- Polymorph: Turkey
[28271] = "Incap", -- Polymorph: Turtle
[82691] = "Incap", -- Ring of Frost
[102051] = "Silence", -- Frostjaw (also a root)
[122] = "Root", -- Frost Nova
[111340] = "Root", -- Ice Ward
-- Mage Water Elemental
[33395] = "Root", -- Freeze
-- Monk
[123393] = "Incap", -- Breath of Fire (Glyph of Breath of Fire)
[119392] = "Stun", -- Charging Ox Wave
[120086] = "Stun", -- Fists of Fury
[119381] = "Stun", -- Leg Sweep
[115078] = "Incap", -- Paralysis
[137460] = "Incap", -- Silenced (Ring of Peace)
[116706] = "Root", -- Disable
[123407] = "Root", -- Spinning Fire Blossom
-- Paladin
[105421] = "Disorient", -- Blinding Light
[115752] = "Stun", -- Blinding Light (Glyph of Blinding Light)
[105593] = "Stun", -- Fist of Justice
[853] = "Stun", -- Hammer of Justice
[119072] = "Stun", -- Holy Wrath
[20066] = "Incap", -- Repentance
[10326] = "Disorient", -- Turn Evil
[145067] = "Disorient", -- Turn Evil (Evil is a Point of View)
[31935] = "Silence", -- Avenger's Shield
-- Priest
[605] = "Incap", -- Dominate Mind
[88625] = "Incap", -- Holy Word: Chastise
[64044] = "Incap", -- Psychic Horror
[8122] = "Disorient", -- Psychic Scream
[113792] = "Disorient", -- Psychic Terror (Psyfiend)
[9484] = "Disorient", -- Shackle Undead
[15487] = "Silence", -- Silence
[87194] = "Root", -- Glyph of Mind Blast
[114404] = "Root", -- Void Tendril's Grasp
-- Rogue
[2094] = "Disorient", -- Blind
[1833] = "Stun", -- Cheap Shot
[1776] = "Incap", -- Gouge
[408] = "Stun", -- Kidney Shot
[6770] = "Incap", -- Sap
[1330] = "Silence", -- Garrote - Silence
-- Shaman
[51514] = "Incap", -- Hex
[118905] = "Stun", -- Static Charge (Capacitor Totem)
[64695] = "Root", -- Earthgrab (Earthgrab Totem)
[63685] = "Root", -- Freeze (Frozen Power)
-- Shaman Primal Earth Elemental
[118345] = "Stun", -- Pulverize
-- Warlock
[710] = "Incap", -- Banish
[137143] = "Incap", -- Blood Horror
[5782] = "Disorient", -- Fear
[118699] = "Disorient", -- Fear
[130616] = "Disorient", -- Fear (Glyph of Fear)
[5484] = "Disorient", -- Howl of Terror
[22703] = "Stun", -- Infernal Awakening
[6789] = "Incap", -- Mortal Coil
[132412] = "Disorient", -- Seduction (Grimoire of Sacrifice)
[30283] = "Stun", -- Shadowfury
[132409] = "Silence", -- Spell Lock (Grimoire of Sacrifice)
[31117] = "Silence", -- Unstable Affliction
-- Warlock Pets
[89766] = "Stun", -- Axe Toss (Felguard/Wrathguard)
[115268] = "Disorient", -- Mesmerize (Shivarra)
[6358] = "Disorient", -- Seduction (Succubus)
[115782] = "Silence", -- Optical Blast (Observer)
[24259] = "Silence", -- Spell Lock (Felhunter)
-- Warrior
--[7922] = "Root", -- Charge Stun
[5246] = "Disorient", -- Intimidating Shout (aoe)
[20511] = "Disorient", -- Intimidating Shout (targeted)
[132168] = "Stun", -- Shockwave
[107570] = "Stun", -- Storm Bolt
[132169] = "Stun", -- Storm Bolt
[18498] = "Silence", -- Silenced - Gag Order (PvE only)
[107566] = "Root", -- Staggering Shout
[105771] = "Root", -- Warbringer
-- Other
[107079] = "Incap", -- Quaking Palm
[13327] = "Stun", -- Reckless Charge
[20549] = "Stun", -- War Stomp
[25046] = "Silence", -- Arcane Torrent (Energy)
[28730] = "Silence", -- Arcane Torrent (Mana)
[50613] = "Silence", -- Arcane Torrent (Runic Power)
[69179] = "Silence", -- Arcane Torrent (Rage)
[80483] = "Silence", -- Arcane Torrent (Focus)
[129597] = "Silence", -- Arcane Torrent (Chi)
[39965] = "Root", -- Frost Grenade
[55536] = "Root", -- Frostweave Net
[13099] = "Root", -- Net-o-Matic
}
function DRTracker:GetSpellCategory(spellID) -- Returns CC category of the spellIDs listed above
return spellID and spellIds[spellID] or nil
end
function DRTracker:OnEvent(event, ...) -- Runs things, and stuff.
self[event](self, ...)
end
DRTracker:SetScript("OnEvent", DRTracker.OnEvent)
function DRTracker:ADDON_LOADED(addonName) -- Anchor DR trackers
if addonName == "Blizzard_ArenaUI" then
local arenaFrame
for i = 1, 5 do
arenaFrame = "ArenaEnemyFrame"..i
--local loc = -30 -- (Depreciated) Distance between the left edge of each frame. Should match the width of the frame.
for j = 1, 5 do
local DR = CreateFrame("Frame", arenaFrame.."DR"..j, ArenaEnemyFrames)
DR:ClearAllPoints()
DR:SetPoint("BOTTOMRIGHT", arenaFrame, "TOPLEFT", 0, -10)
DR:SetSize(32, 32) -- (Width, Height) of each frame. A perfect square is preferable, otherwise the spell icon will look stretched.
DR.border = DR:CreateTexture(nil, "LOW")
DR.border:SetAllPoints()
DR.border:SetTexture("Interface\\BUTTONS\\UI-Quickslot-Depress.png")
DR.icon = DR:CreateTexture(nil, "BACKGROUND")
DR.shown = false
DR.severity = 1
DR.unit = i
DR.cate = j
DR.applied = 0
DR.sweep = CreateFrame("Cooldown", nil, DR, "CooldownFrameTemplate")
DR.sweep:ClearAllPoints()
DR.sweep:SetAllPoints(DR)
local function OnShow(self)
local curX = 0
for b=1,5 do
local curFrame = DRs["arena"..DR.unit..b]
if curFrame.shown == true and b ~= self.cate then
curX = curX - 30
end
end
self:ClearAllPoints()
self:SetPoint("BOTTOMRIGHT", "ArenaEnemyFrame"..self.unit, "TOPLEFT", curX, -10)
self.shown = true
self.applied = GetTime()
end
DR:HookScript("OnShow", OnShow)
local function OnHide(self)
for b = 1,5 do
local curFrame = DRs["arena"..self.unit..b]
if curFrame and curFrame.shown == true and curFrame.applied > self.applied then
local _, _, _, x = curFrame:GetPoint(1)
curFrame:ClearAllPoints()
curFrame:SetPoint("BOTTOMRIGHT", "ArenaEnemyFrame"..curFrame.unit, "TOPLEFT", x+30, -10)
end
end
self:ClearAllPoints()
self:SetPoint("BOTTOMRIGHT", "ArenaEnemyFrame"..self.unit, "TOPLEFT", 0, -10)
end
DR:HookScript("OnHide", OnHide)
local function DREnd(self, elapsed)
if self.sweep:GetCooldownDuration() == 0 and self.shown == true then
self:Hide()
self.shown = false
self.severity = 1
end
end
DR:HookScript("OnUpdate", DREnd)
DR:Hide()
DRs["arena"..i..j] = DR
end
end
end
end
function DRTracker:SetTexture(Frame, spellID) -- Sets displayed icon to last spell.
if Frame.shown == true then
Frame.dur = Frame.sweep:GetCooldownDuration()
Frame:Hide()
end
lastChangedFrame = Frame
local _, _, icon, _, _, _, _, _, _ = GetSpellInfo(spellID)
Frame.icon:ClearAllPoints()
Frame.icon:SetAllPoints()
Frame.icon:SetTexture(icon)
Frame:Show()
if Frame.severity == 1 then
Frame.border:SetVertexColor(1, 1, 0, 1)
Frame.severity = 2
elseif Frame.severity == 2 then
Frame.border:SetVertexColor(1, .4, 0, 1)
Frame.severity = 3
elseif Frame.severity == 3 then
Frame.border:SetVertexColor(1, 0, 0, 1)
end
end
function DRTracker:TimerStart(GUID, spellID, spellName) -- Primary function; begins CD sweep and icon updates. Not a good idea to edit any of this.
local _, instanceType = IsInInstance()
if instanceType ~= "arena" then
return
end
local cat = DRTracker:GetSpellCategory(spellID)
if(UnitGUID("arena1") == GUID) then
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitDebuff("arena1", spellName)
if(cat=="Stun") then
DRTracker:SetTexture(DRs["arena1"..1], spellID)
CooldownFrame_SetTimer(DRs["arena1"..1].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Silence") then
DRTracker:SetTexture(DRs["arena1"..2], spellID)
CooldownFrame_SetTimer(DRs["arena1"..2].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Disorient") then
DRTracker:SetTexture(DRs["arena1"..3], spellID)
CooldownFrame_SetTimer(DRs["arena1"..3].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Incap") then
DRTracker:SetTexture(DRs["arena1"..4], spellID)
CooldownFrame_SetTimer(DRs["arena1"..4].sweep, GetTime(), 17+duration, 1)
else
DRTracker:SetTexture(DRs["arena1"..5], spellID)
CooldownFrame_SetTimer(DRs["arena1"..5].sweep, GetTime(), 17+duration, 1)
end
elseif(UnitGUID("arena2") == GUID) then
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitDebuff("arena2", spellName)
if(cat=="Stun") then
DRTracker:SetTexture(DRs["arena2"..1], spellID)
CooldownFrame_SetTimer(DRs["arena2"..1].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Silence") then
DRTracker:SetTexture(DRs["arena2"..2], spellID)
CooldownFrame_SetTimer(DRs["arena2"..2].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Disorient") then
DRTracker:SetTexture(DRs["arena2"..3], spellID)
CooldownFrame_SetTimer(DRs["arena2"..3].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Incap") then
DRTracker:SetTexture(DRs["arena2"..4], spellID)
CooldownFrame_SetTimer(DRs["arena2"..4].sweep, GetTime(), 17+duration, 1)
else
DRTracker:SetTexture(DRs["arena2"..5], spellID)
CooldownFrame_SetTimer(DRs["arena2"..5].sweep, GetTime(), 17+duration, 1)
end
elseif(UnitGUID("arena3") == GUID) then
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitDebuff("arena3", spellName)
if(cat=="Stun") then
DRTracker:SetTexture(DRs["arena3"..1], spellID)
CooldownFrame_SetTimer(DRs["arena3"..1].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Silence") then
DRTracker:SetTexture(DRs["arena3"..2], spellID)
CooldownFrame_SetTimer(DRs["arena3"..2].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Disorient") then
DRTracker:SetTexture(DRs["arena3"..3], spellID)
CooldownFrame_SetTimer(DRs["arena3"..3].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Incap") then
DRTracker:SetTexture(DRs["arena3"..4], spellID)
CooldownFrame_SetTimer(DRs["arena3"..4].sweep, GetTime(), 17+duration, 1)
else
DRTracker:SetTexture(DRs["arena3"..5], spellID)
CooldownFrame_SetTimer(DRs["arena3"..5].sweep, GetTime(), 17+duration, 1)
end
elseif(UnitGUID("arena4") == GUID) then
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitDebuff("arena4", spellName)
if(cat=="Stun") then
DRTracker:SetTexture(DRs["arena4"..1], spellID)
CooldownFrame_SetTimer(DRs["arena4"..1].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Silence") then
DRTracker:SetTexture(DRs["arena4"..2], spellID)
CooldownFrame_SetTimer(DRs["arena4"..2].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Disorient") then
DRTracker:SetTexture(DRs["arena4"..3], spellID)
CooldownFrame_SetTimer(DRs["arena4"..3].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Incap") then
DRTracker:SetTexture(DRs["arena4"..4], spellID)
CooldownFrame_SetTimer(DRs["arena4"..4].sweep, GetTime(), 17+duration, 1)
else
DRTracker:SetTexture(DRs["arena4"..5], spellID)
CooldownFrame_SetTimer(DRs["arena4"..5].sweep, GetTime(), 17+duration, 1)
end
elseif(UnitGUID("arena5") == GUID) then
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitDebuff("arena5", spellName)
if(cat=="Stun") then
DRTracker:SetTexture(DRs["arena5"..1], spellID)
CooldownFrame_SetTimer(DRs["arena5"..1].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Silence") then
DRTracker:SetTexture(DRs["arena5"..2], spellID)
CooldownFrame_SetTimer(DRs["arena5"..2].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Disorient") then
DRTracker:SetTexture(DRs["arena5"..3], spellID)
CooldownFrame_SetTimer(DRs["arena5"..3].sweep, GetTime(), 17+duration, 1)
elseif(cat=="Incap") then
DRTracker:SetTexture(DRs["arena5"..4], spellID)
CooldownFrame_SetTimer(DRs["arena5"..4].sweep, GetTime(), 17+duration, 1)
else
DRTracker:SetTexture(DRs["arena5"..5], spellID)
CooldownFrame_SetTimer(DRs["arena5"..5].sweep, GetTime(), 17+duration, 1)
end
end
return
end
function DRTracker:GetDRs()
return DRTracker and DRs
end
function DRTracker:COMBAT_LOG_EVENT_UNFILTERED(timeStamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellID, spellName, spellSchool, auraType)
if eventType == "SPELL_AURA_APPLIED" or eventType == "SPELL_AURA_REFRESH" then -- Crowd control landed, time to do stuff.
if auraType == "DEBUFF" and DRTracker:GetSpellCategory(spellID) then
DRTracker:TimerStart(destGUID, spellID, spellName)
end
end
end
--trinkets
LoadAddOn("Blizzard_ArenaUI")
ArenaEnemyFrame1:ClearAllPoints()
ArenaEnemyFrame2:ClearAllPoints()
ArenaEnemyFrame3:ClearAllPoints()
ArenaEnemyFrame4:ClearAllPoints()
ArenaEnemyFrame5:ClearAllPoints()
ArenaEnemyFrame1:SetPoint("CENTER",UIParent,"CENTER",220,70)
ArenaEnemyFrame2:SetPoint("CENTER",UIParent,"CENTER",220,20)
ArenaEnemyFrame3:SetPoint("CENTER",UIParent,"CENTER",220,-30)
ArenaEnemyFrame4:SetPoint("CENTER",UIParent,"CENTER",220,-80)
ArenaEnemyFrame5:SetPoint("CENTER",UIParent,"CENTER",220,-130)
ArenaEnemyFrame1.SetPoint = function() end
ArenaEnemyFrame2.SetPoint = function() end
ArenaEnemyFrame3.SetPoint = function() end
ArenaEnemyFrame4.SetPoint = function() end
ArenaEnemyFrame5.SetPoint = function() end
ArenaEnemyFrames:SetScale(1.3)
for i=1, 5 do
_G["ArenaEnemyFrame"..i.."CastingBar"]:SetPoint("RIGHT", 95, 0)
end
trinkets = {}
local arenaFrame, trinket
for i = 1, 5 do
arenaFrame = "ArenaEnemyFrame"..i
trinket = CreateFrame("Cooldown", arenaFrame.."Trinket", ArenaEnemyFrames)
trinket:SetPoint("TOPRIGHT", arenaFrame, 30, -6)
trinket:SetSize(32, 32)
trinket.icon = trinket:CreateTexture(nil, "BACKGROUND")
trinket.icon:SetAllPoints()
trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_01")
trinket:Hide()
trinkets["arena"..i] = trinket
end
local events = CreateFrame("Frame")
function events:UNIT_SPELLCAST_SUCCEEDED(unitID, spell, rank, lineID, spellID)
if not trinkets[unitID] then
return
end
if spellID == 59752 or spellID == 42292 then
CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 120, 1)
SendChatMessage("Trinket used by: "..GetUnitName(unitID, true), "PARTY")
end
end
function events:PLAYER_ENTERING_WORLD()
local _, instanceType = IsInInstance()
if instanceType == "arena" then
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
elseif self:IsEventRegistered("UNIT_SPELLCAST_SUCCEEDED") then
self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
for _, trinket in pairs(trinkets) do
trinket:SetCooldown(0, 0)
trinket:Hide()
end
end
end
events:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
events:RegisterEvent("PLAYER_ENTERING_WORLD")