Vanguard updated to 2021
This commit is contained in:
@@ -26,7 +26,8 @@ local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
||||
---------------------------------------------------------------------------------------------
|
||||
|
||||
local DB_ANIMATION_TIME_DILATATION = 0.515321
|
||||
|
||||
local CONST_DEBUFF_AMOUNT = 5
|
||||
local CONST_MAX_TANKS = 2
|
||||
|
||||
local _cstr = string.format --> lua library local
|
||||
local _table_insert = table.insert --> lua library local
|
||||
@@ -38,6 +39,14 @@ local _math_abs = math.abs --> lua library local
|
||||
local _math_min = math.min --> lua library local
|
||||
local _table_sort = table.sort
|
||||
|
||||
local ignored_debuffs = {
|
||||
[80354] = true, --temporal displacement
|
||||
[57724] = true, --sated
|
||||
[6788] = true, --weakened soul
|
||||
[124275] = true, --light stagger
|
||||
[124274] = true, --moderate stagger
|
||||
}
|
||||
|
||||
---------------------------------------------------------------------------------------------
|
||||
|
||||
--> Create plugin Object
|
||||
@@ -49,6 +58,11 @@ local onUpdateFrame = CreateFrame("frame")
|
||||
|
||||
Vanguard:SetPluginDescription ("Show debuffs on each tanks in the raid, also shows incoming heal and damage and the last hits you took.")
|
||||
|
||||
Vanguard.auraUpdateFrames = {}
|
||||
for i = 1, CONST_MAX_TANKS do
|
||||
local auraUpdateFrame = CreateFrame("frame", nil, UIParent)
|
||||
Vanguard.auraUpdateFrames[#Vanguard.auraUpdateFrames+1] = auraUpdateFrame
|
||||
end
|
||||
|
||||
local function CreatePluginFrames (data)
|
||||
|
||||
@@ -75,17 +89,15 @@ local function CreatePluginFrames (data)
|
||||
local welcome = CreateFrame ("frame", nil, UIParent, "BackdropTemplate")
|
||||
welcome:SetFrameStrata ("TOOLTIP")
|
||||
welcome:SetPoint ("center", UIParent, "center")
|
||||
welcome:SetSize (400, 175)
|
||||
--welcome:SetBackdrop ({edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", edgeSize = 8,
|
||||
--bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 130, insets = {left = 1, right = 1, top = 5, bottom = 5}})
|
||||
welcome:SetSize (400, 200)
|
||||
DF:ApplyStandardBackdrop(welcome)
|
||||
|
||||
local str = _detalhes.gump:CreateLabel (welcome, "Welcome to Vanguard!\n\n\n- The green-left bar represents the incoming healing plus absorbs on the tank.\n\n- The red-right show the incoming damage.\n\n- Click anywhere to show options.", nil, nil, "GameFontNormal")
|
||||
local str = _detalhes.gump:CreateLabel (welcome, "Welcome to Vanguard!\n\n\n- The green-left bar represents the incoming healing plus absorbs on the tank.\n\n- The red-right show the incoming damage.\n\n- Tanks health bar and debuffs on them are shown in the bottom side.\n\n- Click anywhere to show options.", nil, nil, "GameFontNormal")
|
||||
str:SetPoint (15, -15)
|
||||
str:SetWidth (375)
|
||||
|
||||
local close_button = _detalhes.gump:CreateButton (welcome, function() welcome:Hide() end, 86, 16, "Close")
|
||||
close_button:InstallCustomTexture()
|
||||
local close_button = _detalhes.gump:CreateButton (welcome, function() welcome:Hide() end, 120, 20, "Close")
|
||||
close_button:SetTemplate(_detalhes.gump:GetTemplate ("button", "DETAILS_PLUGINPANEL_BUTTON_TEMPLATE"))
|
||||
close_button:SetPoint ("center", welcome, "center")
|
||||
close_button:SetPoint ("bottom", welcome, "bottom", 0, 10)
|
||||
|
||||
@@ -165,9 +177,14 @@ local function CreatePluginFrames (data)
|
||||
table.wipe (Vanguard.TankList)
|
||||
table.wipe (Vanguard.TankHashNames)
|
||||
table.wipe (Vanguard.TankIncDamage)
|
||||
|
||||
for i = 1, CONST_MAX_TANKS do
|
||||
Vanguard.auraUpdateFrames[i]:UnregisterEvent("UNIT_AURA")
|
||||
end
|
||||
|
||||
--Vanguard.auraUpdateFrame:UnregisterEvent("UNIT_AURA")
|
||||
|
||||
if (IsInRaid()) then
|
||||
|
||||
for i = 1, GetNumGroupMembers(), 1 do
|
||||
local role = _UnitGroupRolesAssigned ("raid" .. i)
|
||||
if (role == "TANK") then
|
||||
@@ -180,6 +197,7 @@ local function CreatePluginFrames (data)
|
||||
Vanguard.TankList [#Vanguard.TankList+1] = name
|
||||
Vanguard.TankHashNames [name] = #Vanguard.TankList
|
||||
Vanguard.TankIncDamage [name] = {}
|
||||
Vanguard.auraUpdateFrames[#Vanguard.TankList]:RegisterUnitEvent("UNIT_AURA", "raid" .. i)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -198,6 +216,7 @@ local function CreatePluginFrames (data)
|
||||
Vanguard.TankList [#Vanguard.TankList+1] = name
|
||||
Vanguard.TankHashNames [name] = #Vanguard.TankList
|
||||
Vanguard.TankIncDamage [name] = {}
|
||||
Vanguard.auraUpdateFrames[#Vanguard.TankList]:RegisterUnitEvent("UNIT_AURA", "party" .. i)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -213,6 +232,7 @@ local function CreatePluginFrames (data)
|
||||
Vanguard.TankList [#Vanguard.TankList+1] = name
|
||||
Vanguard.TankHashNames [name] = #Vanguard.TankList
|
||||
Vanguard.TankIncDamage [name] = {}
|
||||
Vanguard.auraUpdateFrames[#Vanguard.TankList]:RegisterUnitEvent("UNIT_AURA", "player")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -226,6 +246,7 @@ local function CreatePluginFrames (data)
|
||||
Vanguard.TankList [#Vanguard.TankList+1] = name
|
||||
Vanguard.TankHashNames [name] = #Vanguard.TankList
|
||||
Vanguard.TankIncDamage [name] = {}
|
||||
Vanguard.auraUpdateFrames[#Vanguard.TankList]:RegisterUnitEvent("UNIT_AURA", "player")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -263,7 +284,7 @@ local function CreatePluginFrames (data)
|
||||
tblock.debuffs_using = 0
|
||||
tblock.debuffs_next_index = 1
|
||||
|
||||
for i = 1, 3 do
|
||||
for i = 1, CONST_DEBUFF_AMOUNT do
|
||||
local dblock = tblock.debuffs_blocks [i]
|
||||
dblock.texture:SetTexture (nil)
|
||||
dblock.stack:SetText ("")
|
||||
@@ -340,7 +361,7 @@ local function CreatePluginFrames (data)
|
||||
|
||||
local f = CreateFrame ("button", "VanguardTankBlock" .. index, VanguardFrame, "BackdropTemplate")
|
||||
f.SetTank = SetTank
|
||||
f:SetSize (Vanguard.db.tank_block_size or 150, 50)
|
||||
f:SetSize (Vanguard.db.tank_block_size, Vanguard.db.tank_block_size_height)
|
||||
|
||||
f:SetScript ("OnMouseUp", on_click)
|
||||
|
||||
@@ -372,24 +393,20 @@ local function CreatePluginFrames (data)
|
||||
|
||||
--tank name
|
||||
f.tankname = f.statusbar:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
f.tankname:SetPoint ("left", f.specicon, "right", 2, 0)
|
||||
f.tankname:SetPoint ("left", f.specicon, "right", 2, 1)
|
||||
|
||||
--debuff icons
|
||||
f.debufficons = {}
|
||||
|
||||
--inc heals inc damage
|
||||
f.heal_inc = framework:NewSplitBar (VanguardFrame, VanguardFrame, "VanguardDamageVsHeal" .. index, "DamageVsHeal" .. index, 294, Vanguard.db.bar_height)
|
||||
f.heal_inc:SetTexture(SharedMedia:Fetch ("statusbar", Vanguard.db.tank_block_texture))
|
||||
f.heal_inc = DF:CreateSplitBar(f, 294, Vanguard.db.bar_height)
|
||||
f.heal_inc:SetSize(294, Vanguard.db.bar_height)
|
||||
f.heal_inc:SetPoint ("topleft", VanguardFrame, "topleft", 0, ((index - 1) * -Vanguard.db.bar_height))
|
||||
f.heal_inc:SetPoint ("topright", VanguardFrame, "topright", 0, ((index - 1) * -Vanguard.db.bar_height))
|
||||
|
||||
f.heal_inc.fontsize = 10
|
||||
|
||||
_G [f.heal_inc:GetName() .. "_IconRight"]:SetSize(1, 1)
|
||||
f.heal_inc.righticon = ""
|
||||
f.heal_inc:SetTexture(SharedMedia:Fetch ("statusbar", Vanguard.db.tank_block_texture))
|
||||
f.heal_inc:EnableAnimations()
|
||||
|
||||
f.heal_inc.iconright:SetVertexColor (1, .5, .5, 1)
|
||||
|
||||
f.heal_inc:SetScript ("OnMouseUp", on_click)
|
||||
|
||||
--debuffs blocks
|
||||
@@ -397,56 +414,48 @@ local function CreatePluginFrames (data)
|
||||
f.debuffs_using = 0
|
||||
f.debuffs_next_index = 1
|
||||
|
||||
for i = 1, 3 do
|
||||
for i = 1, CONST_DEBUFF_AMOUNT do
|
||||
local support_frame = CreateFrame ("frame", nil, f, "BackdropTemplate")
|
||||
support_frame:SetFrameLevel (f:GetFrameLevel()+1)
|
||||
support_frame:SetSize (24, 24)
|
||||
support_frame:SetScript ("OnMouseUp", on_click)
|
||||
|
||||
--icon texture
|
||||
local texture = support_frame:CreateTexture (nil, "overlay")
|
||||
texture:SetSize (24, 24)
|
||||
texture:SetPoint("center", support_frame, "center", 0, 0)
|
||||
|
||||
local y = 3
|
||||
local y = 3
|
||||
local xOffSet = (i-1) * (texture:GetWidth() + 1)
|
||||
support_frame:SetPoint ("left", f, "left", 5 + xOffSet, -8)
|
||||
|
||||
if (i == 1) then --> left
|
||||
support_frame:SetPoint ("left", f, "left", 5, 0)
|
||||
support_frame:SetPoint ("bottom", f, "bottom", 0, y)
|
||||
|
||||
texture:SetPoint ("left", f, "left", 5, 0)
|
||||
texture:SetPoint ("bottom", f, "bottom", 0, y)
|
||||
|
||||
elseif (i == 2) then --> center
|
||||
support_frame:SetPoint ("center", f, "center", 0, 0)
|
||||
support_frame:SetPoint ("bottom", f, "bottom", 0, y)
|
||||
|
||||
texture:SetPoint ("center", f, "center", 0, 0)
|
||||
texture:SetPoint ("bottom", f, "bottom", 0, y)
|
||||
|
||||
elseif (i == 3) then --> right
|
||||
support_frame:SetPoint ("right", f, "right", -5, 0)
|
||||
support_frame:SetPoint ("bottom", f, "bottom", 0, y)
|
||||
|
||||
texture:SetPoint ("right", f, "right", -5, 0)
|
||||
texture:SetPoint ("bottom", f, "bottom", 0, y)
|
||||
|
||||
end
|
||||
|
||||
local dblock = CreateFrame ("cooldown", "VanguardTankBlock" .. index.. "Cooldown" .. i, support_frame, "CooldownFrameTemplate, BackdropTemplate")
|
||||
dblock:SetAlpha (0.7)
|
||||
dblock:SetPoint ("topleft", texture, "topleft")
|
||||
dblock:SetPoint ("bottomright", texture, "bottomright")
|
||||
dblock:SetScript ("OnMouseUp", on_click)
|
||||
dblock.texture = texture
|
||||
|
||||
dblock:SetHideCountdownNumbers(true)
|
||||
|
||||
dblock:SetScript ("OnEnter", debuff_on_enter)
|
||||
dblock:SetScript ("OnLeave", debuff_on_leave)
|
||||
|
||||
local stack = dblock:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
stack:SetPoint ("bottomright", dblock, "bottomright", 8, 0)
|
||||
local stack_bg = dblock:CreateTexture (nil, "artwork")
|
||||
stack_bg:SetTexture (0, 0, 0)
|
||||
stack_bg:SetPoint ("bottomright", dblock, "bottomright", 8, 0)
|
||||
stack_bg:SetSize (12, 12)
|
||||
local elevateStringsFrame = CreateFrame("frame", nil, support_frame)
|
||||
elevateStringsFrame:SetAllPoints()
|
||||
elevateStringsFrame:SetFrameLevel(dblock:GetFrameLevel()+10)
|
||||
|
||||
local stack = elevateStringsFrame:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
stack:SetPoint ("bottomright", dblock, "bottomright", 0, 0)
|
||||
DetailsFramework:SetFontColor(stack, "yellow")
|
||||
|
||||
local stack_bg = elevateStringsFrame:CreateTexture (nil, "artwork")
|
||||
stack_bg:SetColorTexture(0, 0, 0, 1)
|
||||
stack_bg:SetPoint ("center", stack, "center", 0, 0)
|
||||
stack_bg:SetSize(10, 10)
|
||||
|
||||
dblock.Timer = dblock:CreateFontString(nil, "overlay", "NumberFontNormal")
|
||||
dblock.Timer:SetPoint("center")
|
||||
|
||||
dblock.stack = stack
|
||||
dblock.stack_bg = stack_bg
|
||||
@@ -461,16 +470,26 @@ local function CreatePluginFrames (data)
|
||||
end
|
||||
|
||||
function Vanguard:RefreshTanks()
|
||||
|
||||
Vanguard:ResetBlocks()
|
||||
|
||||
|
||||
for i = 1, #Vanguard.TankList do
|
||||
local block = Vanguard.TankBlocks [i]
|
||||
if (not block) then
|
||||
block = Vanguard:CreateTankBlock (i)
|
||||
end
|
||||
|
||||
block:SetTank (i)
|
||||
block:SetTank(i)
|
||||
block:SetSize(Vanguard.db.tank_block_size, Vanguard.db.tank_block_size_height)
|
||||
|
||||
if (Vanguard.db.show_health_bar) then
|
||||
block.statusbar:Show()
|
||||
block.Center:Show()
|
||||
block:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
else
|
||||
block.statusbar:Hide()
|
||||
block.Center:Hide()
|
||||
block:SetBackdropBorderColor (0, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
if (Vanguard.Running) then
|
||||
@@ -479,6 +498,15 @@ local function CreatePluginFrames (data)
|
||||
end
|
||||
end
|
||||
|
||||
function Vanguard.RefreshWidgets()
|
||||
for i, tankHealthBar in pairs(Vanguard.TankBlocks) do
|
||||
for debuffBlockId = 1, CONST_DEBUFF_AMOUNT do
|
||||
local debuffBlock = tankHealthBar.debuffs_blocks[debuffBlockId]
|
||||
DetailsFramework:SetFontSize(debuffBlock.Timer, Vanguard.db.aura_timer_text_size)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Vanguard.AnimateLeftWithAccel(self, deltaTime)
|
||||
local distance = (self.AnimationStart - self.AnimationEnd) / self.CurrentHealthMax * 100 --scale 1 - 100
|
||||
local minTravel = min (distance / 10, 3) -- 10 = trigger distance to max speed 3 = speed scale on max travel
|
||||
@@ -619,11 +647,15 @@ local function CreatePluginFrames (data)
|
||||
function Vanguard:CombatStart()
|
||||
Vanguard.Running = true
|
||||
VanguardFrame:RegisterEvent ("UNIT_HEALTH")
|
||||
VanguardFrame:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
|
||||
|
||||
for i = 1, CONST_MAX_TANKS do
|
||||
Vanguard.auraUpdateFrames[i]:SetScript("OnEvent", Vanguard.AuraUpdate)
|
||||
end
|
||||
|
||||
if (Vanguard.track_incoming) then
|
||||
Vanguard:CancelTimer (Vanguard.track_incoming)
|
||||
end
|
||||
|
||||
Vanguard.track_incoming = Vanguard:ScheduleRepeatingTimer ("TrackIncoming", 0.1)
|
||||
onUpdateFrame:SetScript("OnUpdate", onUpdateFrame.onUpdate)
|
||||
end
|
||||
@@ -631,7 +663,10 @@ local function CreatePluginFrames (data)
|
||||
function Vanguard:CombatEnd()
|
||||
Vanguard.Running = false
|
||||
VanguardFrame:UnregisterEvent ("UNIT_HEALTH")
|
||||
VanguardFrame:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
|
||||
|
||||
for i = 1, CONST_MAX_TANKS do
|
||||
Vanguard.auraUpdateFrames[i]:SetScript("OnEvent", nil)
|
||||
end
|
||||
|
||||
if (Vanguard.track_incoming) then
|
||||
Vanguard:CancelTimer (Vanguard.track_incoming)
|
||||
@@ -639,123 +674,73 @@ local function CreatePluginFrames (data)
|
||||
|
||||
onUpdateFrame:SetScript("OnUpdate", nil)
|
||||
end
|
||||
|
||||
function Vanguard:DebuffRefreshed (who_name, spellid)
|
||||
local tank_index = Vanguard.TankHashNames [who_name]
|
||||
if (tank_index) then
|
||||
local tframe = Vanguard.TankBlocks [tank_index]
|
||||
for i = 1, 3 do
|
||||
local dblock = tframe.debuffs_blocks [i]
|
||||
if (dblock.support.spellid == spellid) then
|
||||
local debuff_name = GetSpellInfo (spellid)
|
||||
|
||||
local icon, count, duration, expirationTime = "", 0, 0, 0
|
||||
|
||||
for i = 1, 40 do
|
||||
local auraName, icon1, count1, _, duration1, expirationTime1 = _UnitDebuff (who_name, i)
|
||||
if (auraName == debuff_name) then
|
||||
icon, count, duration, expirationTime = icon1, count1, duration1, expirationTime1
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
dblock.texture:SetTexture (icon)
|
||||
if (count and count > 0) then
|
||||
dblock.stack:SetText (count)
|
||||
dblock.stack_bg:Show()
|
||||
else
|
||||
dblock.stack:SetText ("")
|
||||
dblock.stack_bg:Hide()
|
||||
end
|
||||
|
||||
dblock:SetCooldown (GetTime(), expirationTime-GetTime(), 0, 0)
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local formatTime = function(time)
|
||||
if (time >= 3600) then
|
||||
return floor (time / 3600) .. "h"
|
||||
elseif (time >= 60) then
|
||||
return floor (time / 60) .. "m"
|
||||
else
|
||||
return floor (time)
|
||||
end
|
||||
end
|
||||
|
||||
function Vanguard:DebuffRemoved (who_name, spellid)
|
||||
local tank_index = Vanguard.TankHashNames [who_name]
|
||||
if (tank_index) then
|
||||
local tframe = Vanguard.TankBlocks [tank_index]
|
||||
for i = 1, 3 do
|
||||
local dblock = tframe.debuffs_blocks [i]
|
||||
if (dblock.support.spellid == spellid) then
|
||||
dblock.texture:SetTexture (nil)
|
||||
dblock.stack:SetText ("")
|
||||
dblock.stack_bg:Hide()
|
||||
dblock:SetCooldown (0, 0, 0, 0)
|
||||
dblock.in_use = nil
|
||||
dblock.support.spellid = nil
|
||||
for o = 1, 3 do
|
||||
if (not tframe.debuffs_blocks [o].in_use) then
|
||||
tframe.debuffs_next_index = o
|
||||
break
|
||||
end
|
||||
end
|
||||
tframe.debuffs_using = tframe.debuffs_using - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Vanguard:DebuffApplied (who_name, spellid)
|
||||
local tank_index = Vanguard.TankHashNames [who_name]
|
||||
|
||||
function Vanguard.AuraUpdate(self, event, unit)
|
||||
local who_name = GetUnitName(unit, true)
|
||||
local tank_index = Vanguard.TankHashNames[who_name]
|
||||
|
||||
if (tank_index) then
|
||||
local tframe = Vanguard.TankBlocks[tank_index]
|
||||
local debuffBlockId = 1
|
||||
|
||||
local tframe = Vanguard.TankBlocks [tank_index]
|
||||
if (tframe.debuffs_using < 3) then
|
||||
for i = 1, 40 do
|
||||
local name, icon, count, debuffType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer = _UnitDebuff(who_name, i)
|
||||
if (name and not ignored_debuffs[spellId]) then -- and not castByPlayer
|
||||
local dblock = tframe.debuffs_blocks[debuffBlockId]
|
||||
debuffBlockId = debuffBlockId + 1
|
||||
|
||||
local next_index = tframe.debuffs_next_index
|
||||
if (next_index) then
|
||||
dblock.debuffName = name
|
||||
dblock.texture:SetTexture(icon)
|
||||
dblock.texture:SetTexCoord(.1, .9, .1, .9)
|
||||
|
||||
local dblock = tframe.debuffs_blocks [next_index]
|
||||
local icon, count, duration, expirationTime
|
||||
|
||||
local debuff_name = GetSpellInfo (spellid)
|
||||
|
||||
for i = 1, 40 do --doq
|
||||
local auraName, icon1, count1, _, duration1, expirationTime1 = _UnitDebuff (who_name, i)
|
||||
if (auraName == debuff_name) then
|
||||
icon, count, duration, expirationTime = icon1, count1, duration1, expirationTime1
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (not icon) then
|
||||
return
|
||||
end
|
||||
|
||||
if (not duration) then
|
||||
duration = 999
|
||||
end
|
||||
|
||||
dblock.texture:SetTexture (icon)
|
||||
dblock.texture:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875)
|
||||
|
||||
if (count and count > 0) then
|
||||
dblock.stack:SetText (count)
|
||||
if (count and count > 1) then
|
||||
dblock.stack:SetText(count)
|
||||
dblock.stack:Show()
|
||||
dblock.stack_bg:Show()
|
||||
else
|
||||
dblock.stack:SetText ("")
|
||||
dblock.stack:SetText("")
|
||||
dblock.stack_bg:Hide()
|
||||
end
|
||||
|
||||
dblock:SetCooldown (GetTime(), expirationTime-GetTime(), 0, 0)
|
||||
dblock.in_use = true
|
||||
dblock.support.spellid = spellid
|
||||
dblock.spellid = spellid
|
||||
|
||||
for i = 1, 3 do
|
||||
if (not tframe.debuffs_blocks [i].in_use) then
|
||||
tframe.debuffs_next_index = i
|
||||
break
|
||||
|
||||
local timeLeft = expirationTime-GetTime()
|
||||
timeLeft = max(timeLeft, 0)
|
||||
timeLeft = min(timeLeft, 600)
|
||||
dblock.Timer:SetText(formatTime(timeLeft))
|
||||
dblock.Timer:Show()
|
||||
|
||||
if ((timeLeft > 0 and timeLeft < 600) and (floor(expirationTime) ~= dblock.expirationAt or not dblock:IsShown())) then
|
||||
dblock:Show()
|
||||
dblock:SetCooldown(GetTime(), timeLeft, 0, 0)
|
||||
dblock.expirationAt = floor(expirationTime)
|
||||
dblock.expirationAtFloat = expirationTime
|
||||
else
|
||||
if ((timeLeft < 0 or timeLeft > 600)) then
|
||||
dblock:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if (debuffBlockId == CONST_DEBUFF_AMOUNT+1) then
|
||||
break
|
||||
end
|
||||
else
|
||||
if (not name) then
|
||||
for o = debuffBlockId, CONST_DEBUFF_AMOUNT do
|
||||
local dblock = tframe.debuffs_blocks[o]
|
||||
dblock:Hide()
|
||||
dblock.texture:SetTexture(nil)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -776,30 +761,10 @@ local function CreatePluginFrames (data)
|
||||
Vanguard:UpdateHealth (block)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local ignored_debuffs = {
|
||||
[80354] = true, --temporal displacement
|
||||
[57724] = true, --sated
|
||||
[6788] = true, --weakened soul
|
||||
[124275] = true, --light stagger
|
||||
[124274] = true, --moderate stagger
|
||||
}
|
||||
|
||||
function Vanguard:TrackDebuffsAlreadyApplied()
|
||||
for tank_name, block_index in pairs (Vanguard.TankHashNames) do
|
||||
for i = 1, 41 do
|
||||
local auraName, icon, count, _, duration, expirationTime, unitCaster, _, _, spellid = _UnitDebuff (tank_name, i)
|
||||
if (icon and spellid and not ignored_debuffs [spellid]) then
|
||||
Vanguard:DebuffApplied (tank_name, spellid)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local build_options_panel = function()
|
||||
|
||||
local options_frame = Vanguard:CreatePluginOptionsFrame ("VanguardOptionsWindow", "Vanguard Options", 1)
|
||||
|
||||
local tank_texture_set = function (_, _, value)
|
||||
@@ -831,40 +796,22 @@ local build_options_panel = function()
|
||||
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
|
||||
|
||||
local menu = {
|
||||
{
|
||||
type = "toggle",
|
||||
get = function() return Vanguard.db.show_inc_bars end,
|
||||
set = function (self, fixedparam, value) Vanguard.db.show_inc_bars = value; Vanguard:ResetBars() end,
|
||||
desc = "When enabled, shows the incoming heal and damage bars.",
|
||||
name = "Show Incoming Bars"
|
||||
},
|
||||
{
|
||||
type = "range",
|
||||
get = function() return Vanguard.db.tank_block_size end,
|
||||
set = function (self, fixedparam, value) Vanguard.db.tank_block_size = value; Vanguard:RefreshTanks() end,
|
||||
min = 70,
|
||||
max = 250,
|
||||
step = 1,
|
||||
desc = "Set the width of the blocks showing the tanks.",
|
||||
name = "Tank Block Size",
|
||||
},
|
||||
{
|
||||
type = "color",
|
||||
get = function() return Vanguard.db.tank_block_color end,
|
||||
set = function (self, r, g, b, a)
|
||||
local current = Vanguard.db.tank_block_color;
|
||||
current[1], current[2], current[3], current[4] = r, g, b, a;
|
||||
Vanguard:RefreshTanks();
|
||||
end,
|
||||
desc = "Select the color of the tank block background.",
|
||||
name = "Tank Block Background Color"
|
||||
},
|
||||
{
|
||||
type = "select",
|
||||
get = function() return Vanguard.db.tank_block_texture end,
|
||||
values = function() return tank_texture_menu end,
|
||||
desc = "Choose the texture used on tank blocks.",
|
||||
name = "Tank Block Texture"
|
||||
--desc = "Choose the texture used on tank blocks.",
|
||||
name = "Texture"
|
||||
},
|
||||
|
||||
{type = "blank"},
|
||||
|
||||
{
|
||||
type = "toggle",
|
||||
get = function() return Vanguard.db.show_inc_bars end,
|
||||
set = function (self, fixedparam, value) Vanguard.db.show_inc_bars = value; Vanguard:ResetBars() end,
|
||||
--desc = "Shows the incoming heal vs incoming damage.",
|
||||
name = "Show Incoming Damage"
|
||||
},
|
||||
{
|
||||
type = "range",
|
||||
@@ -877,11 +824,65 @@ local build_options_panel = function()
|
||||
min = 10,
|
||||
max = 50,
|
||||
step = 1,
|
||||
desc = "Inc Damage Heigth",
|
||||
name = "Inc Damage Heigth",
|
||||
--desc = "Inc Damage Heigth",
|
||||
name = "Incoming Damage Heigth",
|
||||
},
|
||||
{type = "blank"},
|
||||
|
||||
{
|
||||
type = "toggle",
|
||||
get = function() return Vanguard.db.show_health_bar end,
|
||||
set = function (self, fixedparam, value) Vanguard.db.show_health_bar = value; Vanguard:RefreshTanks(); Vanguard:ResetBars() end,
|
||||
name = "Show Health Bar"
|
||||
},
|
||||
{
|
||||
type = "range",
|
||||
get = function() return Vanguard.db.tank_block_size end,
|
||||
set = function (self, fixedparam, value) Vanguard.db.tank_block_size = value; Vanguard:RefreshTanks() end,
|
||||
min = 70,
|
||||
max = 250,
|
||||
step = 1,
|
||||
--desc = "Set the width of the blocks showing the tanks.",
|
||||
name = "Health Bar Width",
|
||||
},
|
||||
{
|
||||
type = "range",
|
||||
get = function() return Vanguard.db.tank_block_size_height end,
|
||||
set = function (self, fixedparam, value) Vanguard.db.tank_block_size_height = value; Vanguard:RefreshTanks() end,
|
||||
min = 10,
|
||||
max = 60,
|
||||
step = 1,
|
||||
--desc = "Set the width of the blocks showing the tanks.",
|
||||
name = "Health Bar Height",
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
type = "color",
|
||||
get = function() return Vanguard.db.tank_block_color end,
|
||||
set = function (self, r, g, b, a)
|
||||
local current = Vanguard.db.tank_block_color;
|
||||
current[1], current[2], current[3], current[4] = r, g, b, a;
|
||||
Vanguard:RefreshTanks();
|
||||
end,
|
||||
--desc = "Select the color of the tank block background.",
|
||||
name = "Health Bar Background Color"
|
||||
},
|
||||
|
||||
{type = "blank"},
|
||||
|
||||
{
|
||||
type = "range",
|
||||
get = function() return Vanguard.db.aura_timer_text_size end,
|
||||
set = function (self, fixedparam, value) Vanguard.db.aura_timer_text_size = value; Vanguard.RefreshWidgets() end,
|
||||
min = 6,
|
||||
max = 24,
|
||||
step = 1,
|
||||
name = "Debuff Text Size",
|
||||
},
|
||||
}
|
||||
|
||||
options_frame:SetSize(500, 300)
|
||||
Vanguard:GetFramework():BuildMenu (options_frame, menu, 15, -50, 260, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
|
||||
end
|
||||
|
||||
@@ -894,42 +895,11 @@ end
|
||||
|
||||
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
|
||||
|
||||
|
||||
|
||||
function Vanguard:OnEvent (_, event, arg1, token, time, who_serial, who_name, who_flags, _, alvo_serial, alvo_name, alvo_flags, _, spellid, spellname, spellschool, tipo)
|
||||
|
||||
if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
|
||||
|
||||
local arg1, token, time, who_serial, who_name, who_flags, _, alvo_serial, alvo_name, alvo_flags, _, spellid, spellname, spellschool, tipo = CombatLogGetCurrentEventInfo()
|
||||
|
||||
--print (token, Vanguard.TankHashNames [alvo_name], alvo_name, tipo, Vanguard.Running)
|
||||
|
||||
if (token == "SPELL_AURA_APPLIED") then
|
||||
if (Vanguard.TankHashNames [alvo_name] and tipo == "DEBUFF" and Vanguard.Running and not ignored_debuffs [spellid]) then
|
||||
Vanguard:DebuffApplied (alvo_name, spellid)
|
||||
end
|
||||
|
||||
elseif (token == "SPELL_AURA_REMOVED") then
|
||||
if (Vanguard.TankHashNames [alvo_name] and tipo == "DEBUFF" and Vanguard.Running and not ignored_debuffs [spellid]) then
|
||||
Vanguard:DebuffRemoved (alvo_name, spellid)
|
||||
end
|
||||
|
||||
elseif (token == "SPELL_AURA_REFRESH") then
|
||||
if (Vanguard.TankHashNames [alvo_name] and tipo == "DEBUFF" and Vanguard.Running and not ignored_debuffs [spellid]) then
|
||||
Vanguard:DebuffRefreshed (alvo_name, spellid)
|
||||
end
|
||||
|
||||
elseif (token == "SPELL_AURA_APPLIED_DOSE") then
|
||||
if (Vanguard.TankHashNames [alvo_name] and tipo == "DEBUFF" and Vanguard.Running and not ignored_debuffs [spellid]) then
|
||||
Vanguard:DebuffRefreshed (alvo_name, spellid)
|
||||
end
|
||||
|
||||
elseif (token == "SPELL_AURA_REMOVED_DOSE") then
|
||||
if (Vanguard.TankHashNames [alvo_name] and tipo == "DEBUFF" and Vanguard.Running and not ignored_debuffs [spellid]) then
|
||||
Vanguard:DebuffRefreshed (alvo_name, spellid)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
elseif (event == "UNIT_HEALTH") then
|
||||
if (event == "UNIT_HEALTH") then
|
||||
Vanguard:HealthChanged (arg1)
|
||||
|
||||
elseif (event == "ADDON_LOADED") then
|
||||
@@ -939,7 +909,7 @@ function Vanguard:OnEvent (_, event, arg1, token, time, who_serial, who_name, wh
|
||||
|
||||
if (_G._detalhes) then
|
||||
|
||||
if (DetailsFramework.IsTimewalkWoW()) then
|
||||
if (DetailsFramework.IsClassicWow()) then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -952,8 +922,11 @@ function Vanguard:OnEvent (_, event, arg1, token, time, who_serial, who_name, wh
|
||||
tank_block_texture = "Details Serenity",
|
||||
first_run = false,
|
||||
bar_height = 24,
|
||||
aura_timer_text_size = 14,
|
||||
show_health_bar = true,
|
||||
tank_block_size_height = 50,
|
||||
}
|
||||
|
||||
|
||||
--> Install
|
||||
function Vanguard:OnDetailsEvent() end --> dummy func to stop warnings.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user