2021-05-17 16:49:54 +02:00
|
|
|
local pairs = pairs
|
|
|
|
local select = select
|
|
|
|
|
|
|
|
local CreateFrame = CreateFrame
|
|
|
|
local GetSpellInfo = GetSpellInfo
|
|
|
|
local UnitChannelInfo = UnitChannelInfo
|
|
|
|
local UnitCastingInfo = UnitCastingInfo
|
|
|
|
local GetTime = GetTime
|
|
|
|
local CASTING_BAR_ALPHA_STEP = CASTING_BAR_ALPHA_STEP
|
|
|
|
local BackdropTemplateMixin = BackdropTemplateMixin
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
-- CORE
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
local Gladdy = LibStub("Gladdy")
|
|
|
|
local L = Gladdy.L
|
|
|
|
local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists
|
2021-05-24 12:41:21 +02:00
|
|
|
local Castbar = Gladdy:NewModule("Cast Bar", 70, {
|
2021-06-15 09:05:07 +02:00
|
|
|
castBarEnabled = true,
|
2021-05-17 16:49:54 +02:00
|
|
|
castBarHeight = 20,
|
|
|
|
castBarWidth = 160,
|
|
|
|
castBarIconSize = 22,
|
|
|
|
castBarBorderSize = 8,
|
|
|
|
castBarFontSize = 12,
|
2022-03-25 22:25:54 +01:00
|
|
|
castBarFontOutline = false,
|
2021-05-17 16:49:54 +02:00
|
|
|
castBarTexture = "Smooth",
|
|
|
|
castBarIconStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
|
|
|
castBarBorderStyle = "Gladdy Tooltip round",
|
|
|
|
castBarColor = { r = 1, g = 0.8, b = 0.2, a = 1 },
|
|
|
|
castBarBgColor = { r = 0, g = 0, b = 0, a = 0.4 },
|
|
|
|
castBarIconColor = { r = 0, g = 0, b = 0, a = 1 },
|
|
|
|
castBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
|
|
|
castBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
|
2022-01-12 22:16:02 +01:00
|
|
|
castBarIconEnabled = true,
|
2021-05-17 16:49:54 +02:00
|
|
|
castBarGuesses = true,
|
|
|
|
castBarXOffset = 0,
|
|
|
|
castBarYOffset = 0,
|
|
|
|
castBarIconPos = "LEFT",
|
|
|
|
castBarFont = "DorisPP",
|
|
|
|
castBarTimerFormat = "LEFT",
|
|
|
|
castBarSparkEnabled = true,
|
|
|
|
castBarSparkColor = { r = 1, g = 1, b = 1, a = 1 },
|
2022-01-12 20:21:53 +01:00
|
|
|
castBarFrameStrata = "MEDIUM",
|
|
|
|
castBarFrameLevel = 5,
|
2021-05-17 16:49:54 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
function Castbar:Initialize()
|
|
|
|
self.frames = {}
|
2022-02-15 22:59:21 +01:00
|
|
|
if Gladdy.db.castBarEnabled then
|
|
|
|
self:RegisterMessage("UNIT_DEATH")
|
|
|
|
self:RegisterMessage("JOINED_ARENA")
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
-- FRAME SETUP
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
function Castbar:CreateFrame(unit)
|
2022-01-11 00:29:17 +01:00
|
|
|
local castBar = CreateFrame("Frame", nil, Gladdy.buttons[unit])
|
2021-05-19 19:30:32 +02:00
|
|
|
castBar:EnableMouse(false)
|
2021-09-24 15:51:24 +02:00
|
|
|
castBar:SetMovable(true)
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.unit = unit
|
2022-01-12 20:21:53 +01:00
|
|
|
castBar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
2021-05-17 16:49:54 +02:00
|
|
|
|
2022-01-11 00:29:17 +01:00
|
|
|
castBar.backdrop = CreateFrame("Frame", nil, castBar, BackdropTemplateMixin and "BackdropTemplate")
|
|
|
|
castBar.backdrop:SetAllPoints(castBar)
|
|
|
|
castBar.backdrop:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "castBarBorderStyle"),
|
2021-05-17 16:49:54 +02:00
|
|
|
edgeSize = Gladdy.db.castBarBorderSize })
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.backdrop:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.castBarBorderColor))
|
2022-01-12 20:21:53 +01:00
|
|
|
castBar.backdrop:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar.backdrop:SetFrameLevel(Gladdy.db.castBarFrameLevel - 1)
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
castBar.bar = CreateFrame("StatusBar", nil, castBar)
|
2021-09-14 23:55:17 +02:00
|
|
|
castBar.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.bar:SetMinMaxValues(0, 100)
|
|
|
|
castBar.bar:SetFrameLevel(0)
|
2022-01-12 20:21:53 +01:00
|
|
|
castBar.bar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar.bar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
castBar.spark = castBar:CreateTexture(nil, "OVERLAY")
|
|
|
|
castBar.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
|
|
|
|
castBar.spark:SetBlendMode("ADD")
|
|
|
|
castBar.spark:SetWidth(16)
|
|
|
|
castBar.spark:SetHeight(Gladdy.db.castBarHeight * 1.8)
|
|
|
|
castBar.spark.position = 0
|
|
|
|
|
|
|
|
castBar.bg = castBar.bar:CreateTexture(nil, "BACKGROUND")
|
|
|
|
castBar.bg:SetAlpha(1)
|
2021-09-14 23:55:17 +02:00
|
|
|
castBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarBgColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.bg:SetAllPoints(castBar.bar)
|
|
|
|
|
|
|
|
castBar.icon = CreateFrame("Frame", nil, castBar)
|
2022-01-12 20:21:53 +01:00
|
|
|
castBar.icon:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar.icon:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.icon.texture = castBar.icon:CreateTexture(nil, "BACKGROUND")
|
2021-05-19 14:57:29 +02:00
|
|
|
castBar.icon.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.icon.texture:SetAllPoints(castBar.icon)
|
|
|
|
castBar.icon.texture.overlay = castBar.icon:CreateTexture(nil, "BORDER")
|
|
|
|
castBar.icon.texture.overlay:SetAllPoints(castBar.icon.texture)
|
|
|
|
castBar.icon.texture.overlay:SetTexture(Gladdy.db.castBarIconStyle)
|
|
|
|
|
|
|
|
castBar.icon:ClearAllPoints()
|
|
|
|
if (Gladdy.db.castBarIconPos == "LEFT") then
|
|
|
|
castBar.icon:SetPoint("RIGHT", castBar, "LEFT", -3, 0) -- Icon of castbar
|
|
|
|
else
|
|
|
|
castBar.icon:SetPoint("LEFT", castBar, "RIGHT", 3, 0) -- Icon of castbar
|
|
|
|
end
|
|
|
|
|
|
|
|
castBar.spellText = castBar:CreateFontString(nil, "LOW")
|
2022-03-25 22:25:54 +01:00
|
|
|
castBar.spellText:SetFont(Gladdy:SMFetch("font", "auraFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.spellText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.spellText:SetShadowOffset(1, -1)
|
|
|
|
castBar.spellText:SetShadowColor(0, 0, 0, 1)
|
|
|
|
castBar.spellText:SetJustifyH("CENTER")
|
|
|
|
castBar.spellText:SetPoint("LEFT", 7, 0) -- Text of the spell
|
|
|
|
|
|
|
|
castBar.timeText = castBar:CreateFontString(nil, "LOW")
|
2022-03-25 22:25:54 +01:00
|
|
|
castBar.timeText:SetFont(Gladdy:SMFetch("font", "auraFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.timeText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.timeText:SetShadowOffset(1, -1)
|
|
|
|
castBar.timeText:SetShadowColor(0, 0, 0, 1)
|
|
|
|
castBar.timeText:SetJustifyH("CENTER")
|
|
|
|
castBar.timeText:SetPoint("RIGHT", -4, 0) -- text of cast timer
|
|
|
|
|
|
|
|
Gladdy.buttons[unit].castBar = castBar
|
|
|
|
self.frames[unit] = castBar
|
|
|
|
self:ResetUnit(unit)
|
|
|
|
end
|
|
|
|
|
2022-02-15 22:59:21 +01:00
|
|
|
function Castbar:UpdateFrameOnce()
|
|
|
|
if Gladdy.db.castBarEnabled then
|
|
|
|
self:RegisterMessage("UNIT_DEATH")
|
|
|
|
self:RegisterMessage("JOINED_ARENA")
|
|
|
|
else
|
|
|
|
self:UnregisterAllMessages()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-17 16:49:54 +02:00
|
|
|
function Castbar:UpdateFrame(unit)
|
|
|
|
local castBar = self.frames[unit]
|
|
|
|
if (not castBar) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-01-12 20:21:53 +01:00
|
|
|
castBar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
|
|
|
castBar.backdrop:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar.backdrop:SetFrameLevel(Gladdy.db.castBarFrameLevel - 1)
|
|
|
|
castBar.bar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar.bar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
|
|
|
castBar.icon:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
|
|
|
castBar.icon:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
|
|
|
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar:SetWidth(Gladdy.db.castBarWidth)
|
|
|
|
castBar:SetHeight(Gladdy.db.castBarHeight)
|
2022-01-11 00:29:17 +01:00
|
|
|
castBar.backdrop:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "castBarBorderStyle"),
|
2021-05-17 16:49:54 +02:00
|
|
|
edgeSize = Gladdy.db.castBarBorderSize })
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.backdrop:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.castBarBorderColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
|
2021-09-14 23:55:17 +02:00
|
|
|
castBar.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.bar:ClearAllPoints()
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.bar:SetPoint("TOPLEFT", castBar, "TOPLEFT", (Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
|
|
|
castBar.bar:SetPoint("BOTTOMRIGHT", castBar, "BOTTOMRIGHT", -(Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
|
|
|
|
2021-09-14 23:55:17 +02:00
|
|
|
castBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarBgColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
if Gladdy.db.castBarSparkEnabled then
|
|
|
|
castBar.spark:SetHeight(Gladdy.db.castBarHeight * 1.8)
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.spark:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarSparkColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
else
|
|
|
|
castBar.spark:SetAlpha(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
castBar.icon:SetWidth(Gladdy.db.castBarIconSize)
|
|
|
|
castBar.icon:SetHeight(Gladdy.db.castBarIconSize)
|
|
|
|
castBar.icon.texture:SetAllPoints(castBar.icon)
|
|
|
|
castBar.icon:ClearAllPoints()
|
2022-01-12 22:16:02 +01:00
|
|
|
if Gladdy.db.castBarIconEnabled then
|
|
|
|
castBar.icon:Show()
|
|
|
|
else
|
|
|
|
castBar.icon:Hide()
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
local rightMargin = 0
|
|
|
|
local leftMargin = 0
|
|
|
|
if (Gladdy.db.castBarIconPos == "LEFT") then
|
|
|
|
castBar.icon:SetPoint("RIGHT", castBar, "LEFT", -1, 0) -- Icon of castbar
|
|
|
|
rightMargin = Gladdy.db.castBarIconSize + 1
|
|
|
|
else
|
|
|
|
castBar.icon:SetPoint("LEFT", castBar, "RIGHT", 1, 0) -- Icon of castbar
|
|
|
|
leftMargin = Gladdy.db.castBarIconSize + 1
|
|
|
|
end
|
|
|
|
|
2022-01-11 00:29:17 +01:00
|
|
|
Gladdy:SetPosition(castBar, unit, "castBarXOffset", "castBarYOffset", Castbar:LegacySetPosition(castBar, unit, leftMargin, rightMargin), Castbar)
|
2021-05-17 16:49:54 +02:00
|
|
|
|
2022-03-25 22:25:54 +01:00
|
|
|
castBar.spellText:SetFont(Gladdy:SMFetch("font", "castBarFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.spellText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
|
2022-03-25 22:25:54 +01:00
|
|
|
castBar.timeText:SetFont(Gladdy:SMFetch("font", "castBarFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.timeText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
|
|
|
|
castBar.icon.texture.overlay:SetTexture(Gladdy.db.castBarIconStyle)
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.icon.texture.overlay:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarIconColor))
|
2021-09-24 15:51:24 +02:00
|
|
|
|
|
|
|
if (unit == "arena1") then
|
2022-01-13 23:11:33 +01:00
|
|
|
Gladdy:CreateMover(castBar, "castBarXOffset", "castBarYOffset", L["Cast Bar"],
|
|
|
|
{"TOPLEFT", "TOPLEFT"}, Gladdy.db.castBarWidth, Gladdy.db.castBarHeight,
|
|
|
|
0, 0, "castBarEnabled")
|
|
|
|
end
|
|
|
|
if not Gladdy.db.castBarEnabled then
|
|
|
|
self:CAST_STOP(unit)
|
2021-09-24 15:51:24 +02:00
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
-- EVENT HANDLING
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
Castbar.TimerFormatFunc = {}
|
|
|
|
Castbar.TimerFormatFunc.LEFT = function(castBar)
|
|
|
|
castBar.timeText:SetFormattedText("%.1f", castBar.casting and (castBar.maxValue - castBar.value) or castBar.value)
|
|
|
|
end
|
|
|
|
Castbar.TimerFormatFunc.TOTAL = function(castBar)
|
|
|
|
castBar.timeText:SetFormattedText("%.1f", castBar.maxValue)
|
|
|
|
end
|
|
|
|
Castbar.TimerFormatFunc.BOTH = function(castBar)
|
|
|
|
castBar.timeText:SetFormattedText("%.1f / %.1f", castBar.casting and (castBar.maxValue - castBar.value) or castBar.value, castBar.maxValue)
|
|
|
|
end
|
|
|
|
|
|
|
|
function Castbar.OnUpdate(castBar, elapsed)
|
|
|
|
if castBar.channeling or castBar.casting then
|
|
|
|
if ((castBar.casting and castBar.value >= castBar.maxValue) or (castBar.channeling and castBar.value <= 0)) then
|
|
|
|
-- cast timed out
|
|
|
|
castBar.holdTime = castBar.casting and (GetTime() + 0.25) or 0
|
|
|
|
castBar.fadeOut = castBar.casting
|
|
|
|
castBar.channeling = nil
|
|
|
|
castBar.casting = nil
|
|
|
|
Castbar:CAST_STOP(castBar.unit, 0, 1, 0, 1)
|
|
|
|
else
|
|
|
|
--cast active
|
|
|
|
castBar.value = castBar.value + (castBar.casting and elapsed or -elapsed)
|
|
|
|
castBar.bar:SetValue(castBar.value)
|
|
|
|
Castbar.TimerFormatFunc[Gladdy.db.castBarTimerFormat](castBar)
|
|
|
|
castBar.spark.position = ((castBar.value) / castBar.maxValue) * (castBar.bar:GetWidth() - (Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset)*2)
|
|
|
|
if ( castBar.spark.position < 0 ) then
|
|
|
|
castBar.spark.position = 0
|
|
|
|
end
|
|
|
|
castBar.spark:SetPoint("CENTER", castBar.bar, "LEFT", castBar.spark.position, 0)
|
|
|
|
castBar.spark:Show()
|
|
|
|
end
|
2022-01-11 03:01:16 +01:00
|
|
|
elseif ( castBar.holdTime and GetTime() < castBar.holdTime ) then
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.timeText:Hide()
|
|
|
|
castBar.spark:Hide()
|
|
|
|
return
|
|
|
|
elseif castBar.fadeOut then
|
|
|
|
local alpha = castBar:GetAlpha() - CASTING_BAR_ALPHA_STEP;
|
|
|
|
if ( alpha > 0 ) then
|
|
|
|
castBar:SetAlpha(alpha)
|
|
|
|
else
|
|
|
|
castBar.fadeOut = nil;
|
|
|
|
castBar.timeText:Show()
|
|
|
|
castBar.spark:Show()
|
2022-01-11 04:27:16 +01:00
|
|
|
castBar:SetAlpha(0)
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Castbar.CastEventsFunc = {}
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_START"] = function(castBar, event, ...)
|
|
|
|
local name, text, texture, startTime, endTime, isTradeSkill, castID = UnitCastingInfo(castBar.unit)
|
|
|
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
2022-01-11 04:27:16 +01:00
|
|
|
castBar:SetAlpha(0)
|
2021-05-17 16:49:54 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if ( castBar.spark ) then
|
|
|
|
castBar.spark:Show()
|
|
|
|
end
|
|
|
|
castBar.value = (GetTime() - (startTime / 1000));
|
|
|
|
castBar.maxValue = (endTime - startTime) / 1000;
|
|
|
|
castBar.holdTime = 0
|
|
|
|
castBar.casting = true
|
|
|
|
castBar.castID = castID
|
|
|
|
castBar.channeling = nil
|
|
|
|
castBar.fadeOut = nil
|
|
|
|
Castbar:CAST_START(castBar.unit, name, texture, castBar.value, castBar.maxValue)
|
|
|
|
end
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_SUCCEEDED"] = function(castBar, event, ...)
|
|
|
|
if (castBar.casting and event == "UNIT_SPELLCAST_SUCCEEDED" and select(2, ...) == castBar.castID) then
|
|
|
|
if ( castBar.spark ) then
|
|
|
|
castBar.spark:Hide()
|
|
|
|
end
|
|
|
|
castBar.casting = nil
|
|
|
|
--castBar.spellText:SetText("Stopped")
|
|
|
|
castBar.flash = true
|
|
|
|
castBar.fadeOut = true
|
|
|
|
castBar.holdTime = GetTime() + 0.25
|
|
|
|
Castbar:CAST_STOP(castBar.unit, 0, 1, 0, 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_STOP"] = function(castBar, event, ...)
|
|
|
|
if ( not castBar:IsVisible() ) then
|
2022-01-11 04:27:16 +01:00
|
|
|
castBar:SetAlpha(0)
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
if ( (castBar.casting and event == "UNIT_SPELLCAST_STOP" and select(2, ...) == castBar.castID) or
|
|
|
|
(castBar.channeling and event == "UNIT_SPELLCAST_CHANNEL_STOP") ) then
|
|
|
|
if ( castBar.spark ) then
|
|
|
|
castBar.spark:Hide()
|
|
|
|
end
|
|
|
|
if ( event == "UNIT_SPELLCAST_STOP" ) then
|
|
|
|
castBar.casting = nil
|
|
|
|
else
|
|
|
|
castBar.channeling = nil
|
|
|
|
end
|
|
|
|
castBar.spellText:SetText("Stopped")
|
|
|
|
castBar.flash = true
|
|
|
|
castBar.fadeOut = true
|
|
|
|
castBar.holdTime = GetTime() + 0.25
|
|
|
|
Castbar:CAST_STOP(castBar.unit, 1, 0, 0, 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_CHANNEL_STOP"] = Castbar.CastEventsFunc["UNIT_SPELLCAST_STOP"]
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_FAILED"] = function(castBar, event, ...)
|
|
|
|
if ( castBar:IsShown() and
|
|
|
|
(castBar.casting and select(2, ...) == castBar.castID) and not castBar.fadeOut ) then
|
|
|
|
if ( castBar.spark ) then
|
|
|
|
castBar.spark:Hide()
|
|
|
|
end
|
|
|
|
if ( castBar.spellText ) then
|
|
|
|
if ( event == "UNIT_SPELLCAST_FAILED" ) then
|
|
|
|
castBar.spellText:SetText("Failed")
|
|
|
|
else
|
|
|
|
castBar.spellText:SetText("Interrupted")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
castBar.bar:SetValue(castBar.maxValue)
|
|
|
|
castBar.casting = nil
|
|
|
|
castBar.channeling = nil
|
|
|
|
castBar.fadeOut = true
|
|
|
|
castBar.holdTime = GetTime() + 1
|
|
|
|
Castbar:CAST_STOP(castBar.unit, 1, 0, 0, 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_INTERRUPTED"] = Castbar.CastEventsFunc["UNIT_SPELLCAST_FAILED"]
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_DELAYED"] = function(castBar, event, ...)
|
|
|
|
if ( castBar:IsShown() ) then
|
|
|
|
local name, text, texture, startTime, endTime, isTradeSkill, castID = UnitCastingInfo(castBar.unit)
|
|
|
|
|
|
|
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
|
|
|
-- if there is no name, there is no bar
|
2022-01-11 04:27:16 +01:00
|
|
|
castBar:SetAlpha(0)
|
2021-05-17 16:49:54 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
castBar.value = (GetTime() - (startTime / 1000))
|
|
|
|
castBar.maxValue = (endTime - startTime) / 1000
|
|
|
|
castBar.bar:SetMinMaxValues(0, castBar.maxValue)
|
|
|
|
if ( not castBar.casting ) then
|
|
|
|
castBar.casting = true
|
|
|
|
castBar.channeling = nil
|
|
|
|
castBar.flash = nil
|
|
|
|
castBar.fadeOut = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_CHANNEL_START"] = function(castBar, event, ...)
|
|
|
|
local name, text, texture, startTime, endTime, isTradeSkill, spellID = UnitChannelInfo(castBar.unit)
|
|
|
|
|
|
|
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
2022-01-11 04:27:16 +01:00
|
|
|
castBar:SetAlpha(0)
|
2021-05-17 16:49:54 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
if ( castBar.spark ) then
|
|
|
|
castBar.spark:Show()
|
|
|
|
end
|
|
|
|
castBar.value = (endTime / 1000) - GetTime()
|
|
|
|
castBar.maxValue = (endTime - startTime) / 1000
|
|
|
|
castBar.holdTime = 0
|
|
|
|
castBar.casting = nil
|
|
|
|
castBar.channeling = true
|
|
|
|
castBar.fadeOut = nil
|
|
|
|
Castbar:CAST_START(castBar.unit, name, texture, castBar.value, castBar.maxValue)
|
|
|
|
end
|
|
|
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_CHANNEL_UPDATE"] = function(castBar, event, ...)
|
|
|
|
if ( castBar:IsShown() ) then
|
|
|
|
local name, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(castBar.unit)
|
|
|
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
2022-01-11 04:27:16 +01:00
|
|
|
castBar:SetAlpha(0)
|
2021-05-17 16:49:54 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
castBar.value = ((endTime / 1000) - GetTime())
|
|
|
|
castBar.maxValue = (endTime - startTime) / 1000
|
|
|
|
Castbar:CAST_START(castBar.unit, name, texture, castBar.value, castBar.maxValue)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function Castbar.OnEvent(self, event, ...)
|
|
|
|
local unit = ...
|
|
|
|
if ( unit ~= self.unit ) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
Castbar.CastEventsFunc[event](self, event, ...)
|
|
|
|
end
|
|
|
|
|
|
|
|
function Castbar:CAST_START(unit, spell, icon, value, maxValue, test)
|
|
|
|
local castBar = self.frames[unit]
|
|
|
|
if (not castBar) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
Gladdy:SendMessage("CAST_START", unit, spell)
|
|
|
|
if test then
|
|
|
|
castBar:SetScript("OnUpdate", Castbar.OnUpdate)
|
|
|
|
castBar.casting = test == "cast"
|
|
|
|
castBar.channeling = test == "channel"
|
|
|
|
end
|
|
|
|
|
2022-01-12 23:07:23 +01:00
|
|
|
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.value = value
|
|
|
|
castBar.maxValue = maxValue
|
|
|
|
castBar.bar:SetMinMaxValues(0, maxValue)
|
|
|
|
castBar.bar:SetValue(value)
|
2022-01-13 23:11:33 +01:00
|
|
|
castBar.icon:SetAlpha(1)
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.icon.texture:SetTexture(icon)
|
|
|
|
castBar.spellText:SetText(spell)
|
|
|
|
castBar.timeText:SetText(maxValue)
|
|
|
|
castBar.bg:Show()
|
2022-01-11 00:29:17 +01:00
|
|
|
castBar.backdrop:Show()
|
|
|
|
if Gladdy.db.castBarSparkEnabled then
|
|
|
|
castBar.spark:Show()
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar:SetAlpha(1)
|
2022-01-12 22:17:28 +01:00
|
|
|
if Gladdy.db.castBarIconEnabled then
|
|
|
|
castBar.icon:Show()
|
|
|
|
else
|
|
|
|
castBar.icon:Hide()
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function Castbar:CAST_STOP(unit, ...)
|
|
|
|
local castBar = self.frames[unit]
|
|
|
|
if (not castBar) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
if not castBar.fadeOut then
|
|
|
|
castBar.casting = nil
|
|
|
|
castBar.channeling = nil
|
|
|
|
castBar.value = 0
|
|
|
|
castBar.maxValue = 0
|
2022-01-13 23:11:33 +01:00
|
|
|
castBar.icon:SetAlpha(0)
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.icon.texture:SetTexture("")
|
|
|
|
castBar.spellText:SetText("")
|
|
|
|
castBar.timeText:SetText("")
|
|
|
|
castBar.bar:SetValue(0)
|
|
|
|
castBar.bg:Hide()
|
2022-01-11 00:29:17 +01:00
|
|
|
castBar.backdrop:Hide()
|
|
|
|
castBar.spark:Hide()
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar.icon:Hide()
|
|
|
|
else
|
|
|
|
castBar.bar:SetStatusBarColor(...)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
-- Gladdy Messages JOINED_ARENA / ResetUnit
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
function Castbar:JOINED_ARENA()
|
2021-06-15 09:05:07 +02:00
|
|
|
if Gladdy.db.castBarEnabled then
|
|
|
|
for i=1, Gladdy.curBracket do
|
|
|
|
local unit = "arena" .. i
|
|
|
|
local castBar = self.frames[unit]
|
|
|
|
castBar:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
|
|
|
|
castBar:RegisterEvent("UNIT_SPELLCAST_DELAYED")
|
|
|
|
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
|
|
|
|
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
|
|
|
|
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
|
|
|
|
castBar:RegisterUnitEvent("UNIT_SPELLCAST_START", unit)
|
|
|
|
castBar:RegisterUnitEvent("UNIT_SPELLCAST_STOP", unit)
|
|
|
|
castBar:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", unit)
|
|
|
|
castBar:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", unit)
|
|
|
|
castBar:SetScript("OnEvent", Castbar.OnEvent)
|
|
|
|
castBar:SetScript("OnUpdate", Castbar.OnUpdate)
|
|
|
|
castBar.fadeOut = nil
|
|
|
|
self:CAST_STOP(unit)
|
|
|
|
--Castbar.OnEvent(castBar, "PLAYER_ENTERING_WORLD")
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function Castbar:ResetUnit(unit)
|
|
|
|
local castBar = self.frames[unit]
|
2021-06-15 09:05:07 +02:00
|
|
|
castBar:UnregisterAllEvents()
|
2021-05-17 16:49:54 +02:00
|
|
|
castBar:SetScript("OnEvent", nil)
|
|
|
|
castBar:SetScript("OnUpdate", nil)
|
|
|
|
castBar.fadeOut = nil
|
|
|
|
self:CAST_STOP(unit)
|
|
|
|
end
|
|
|
|
|
2021-06-15 09:05:07 +02:00
|
|
|
function Castbar:Reset()
|
|
|
|
self.test = nil
|
|
|
|
end
|
|
|
|
|
2021-05-17 16:49:54 +02:00
|
|
|
---------------------------
|
|
|
|
|
|
|
|
-- TEST
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
function Castbar:Test(unit)
|
2021-06-15 09:05:07 +02:00
|
|
|
self.test = true
|
|
|
|
if Gladdy.db.castBarEnabled then
|
|
|
|
local spell, _, icon, value, maxValue, event, endTime, startTime
|
|
|
|
|
|
|
|
if (unit == "arena2") then
|
|
|
|
spell, _, icon = GetSpellInfo(27072)
|
|
|
|
value, maxValue, event = 0, 40, "cast"
|
|
|
|
elseif (unit == "arena1") then
|
|
|
|
spell, _, icon = GetSpellInfo(27220)
|
|
|
|
endTime = GetTime() * 1000 + 60*1000
|
|
|
|
startTime = GetTime() * 1000
|
|
|
|
value = (endTime / 1000) - GetTime()
|
|
|
|
maxValue = (endTime - startTime) / 1000
|
|
|
|
event = "channel"
|
2021-06-17 16:40:02 +02:00
|
|
|
else
|
2021-06-15 09:05:07 +02:00
|
|
|
spell, _, icon = GetSpellInfo(20770)
|
|
|
|
value, maxValue, event = 0, 60, "cast"
|
|
|
|
end
|
2021-05-17 16:49:54 +02:00
|
|
|
|
2021-06-15 09:05:07 +02:00
|
|
|
if (spell) then
|
|
|
|
self:CAST_START(unit, spell, icon, value, maxValue, event)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
self:CAST_STOP(unit)
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
-- OPTIONS
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
local function option(params)
|
|
|
|
local defaults = {
|
|
|
|
get = function(info)
|
|
|
|
local key = info.arg or info[#info]
|
|
|
|
return Gladdy.dbi.profile[key]
|
|
|
|
end,
|
|
|
|
set = function(info, value)
|
|
|
|
local key = info.arg or info[#info]
|
|
|
|
Gladdy.dbi.profile[key] = value
|
2021-05-24 13:11:36 +02:00
|
|
|
Gladdy.options.args["Cast Bar"].args.group.args.barFrame.args.castBarBorderSize.max = Gladdy.db.castBarHeight/2
|
2021-05-17 16:49:54 +02:00
|
|
|
if Gladdy.db.castBarBorderSize > Gladdy.db.castBarHeight/2 then
|
|
|
|
Gladdy.db.castBarBorderSize = Gladdy.db.castBarHeight/2
|
|
|
|
end
|
|
|
|
Gladdy:UpdateFrame()
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
for k, v in pairs(params) do
|
|
|
|
defaults[k] = v
|
|
|
|
end
|
|
|
|
|
|
|
|
return defaults
|
|
|
|
end
|
|
|
|
|
|
|
|
function Castbar:GetOptions()
|
|
|
|
return {
|
|
|
|
header = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Cast Bar"],
|
|
|
|
order = 2,
|
|
|
|
},
|
2021-06-15 09:05:07 +02:00
|
|
|
castBarEnabled = option({
|
|
|
|
type = "toggle",
|
|
|
|
name = L["Enabled"],
|
|
|
|
desc = L["If test is running, type \"/gladdy test\" again"],
|
|
|
|
order = 3,
|
|
|
|
}),
|
2021-05-17 16:49:54 +02:00
|
|
|
group = {
|
|
|
|
type = "group",
|
|
|
|
childGroups = "tree",
|
2021-05-24 12:41:21 +02:00
|
|
|
name = L["Frame"],
|
2021-06-15 09:05:07 +02:00
|
|
|
order = 4,
|
2022-02-15 22:59:21 +01:00
|
|
|
disabled = function() return not Gladdy.db.castBarEnabled end,
|
2021-05-17 16:49:54 +02:00
|
|
|
args = {
|
|
|
|
barFrame = {
|
|
|
|
type = "group",
|
2021-05-24 12:41:21 +02:00
|
|
|
name = L["Bar"],
|
2021-05-17 16:49:54 +02:00
|
|
|
order = 1,
|
|
|
|
args = {
|
|
|
|
headerSize = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Bar Size"],
|
|
|
|
order = 1,
|
|
|
|
},
|
|
|
|
castBarHeight = option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Bar height"],
|
|
|
|
desc = L["Height of the bar"],
|
|
|
|
order = 3,
|
|
|
|
min = 0,
|
2022-01-14 00:36:46 +01:00
|
|
|
max = 200,
|
2021-05-17 16:49:54 +02:00
|
|
|
step = 1,
|
2021-06-15 09:05:07 +02:00
|
|
|
width = "full",
|
2021-05-17 16:49:54 +02:00
|
|
|
}),
|
|
|
|
castBarWidth = option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Bar width"],
|
|
|
|
desc = L["Width of the bars"],
|
|
|
|
order = 4,
|
|
|
|
min = 0,
|
2022-01-14 00:36:46 +01:00
|
|
|
max = 600,
|
2021-05-17 16:49:54 +02:00
|
|
|
step = 1,
|
2021-06-15 09:05:07 +02:00
|
|
|
width = "full",
|
2021-05-17 16:49:54 +02:00
|
|
|
}),
|
|
|
|
headerTexture = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Texture"],
|
|
|
|
order = 5,
|
|
|
|
},
|
|
|
|
castBarTexture = option({
|
|
|
|
type = "select",
|
|
|
|
name = L["Bar texture"],
|
|
|
|
desc = L["Texture of the bar"],
|
|
|
|
order = 9,
|
|
|
|
dialogControl = "LSM30_Statusbar",
|
|
|
|
values = AceGUIWidgetLSMlists.statusbar,
|
|
|
|
}),
|
|
|
|
castBarColor = Gladdy:colorOption({
|
|
|
|
type = "color",
|
|
|
|
name = L["Bar color"],
|
|
|
|
desc = L["Color of the cast bar"],
|
|
|
|
order = 10,
|
|
|
|
hasAlpha = true,
|
|
|
|
}),
|
|
|
|
castBarBgColor = Gladdy:colorOption({
|
|
|
|
type = "color",
|
|
|
|
name = L["Background color"],
|
|
|
|
desc = L["Color of the cast bar background"],
|
|
|
|
order = 11,
|
|
|
|
hasAlpha = true,
|
|
|
|
}),
|
|
|
|
headerBorder = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Border"],
|
|
|
|
order = 12,
|
|
|
|
},
|
|
|
|
castBarBorderSize = option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Border size"],
|
|
|
|
order = 13,
|
|
|
|
min = 0.5,
|
|
|
|
max = Gladdy.db.castBarHeight/2,
|
|
|
|
step = 0.5,
|
2021-06-15 09:05:07 +02:00
|
|
|
width = "full",
|
2021-05-17 16:49:54 +02:00
|
|
|
}),
|
|
|
|
castBarBorderStyle = option({
|
|
|
|
type = "select",
|
|
|
|
name = L["Status Bar border"],
|
|
|
|
order = 51,
|
|
|
|
dialogControl = "LSM30_Border",
|
|
|
|
values = AceGUIWidgetLSMlists.border,
|
|
|
|
}),
|
|
|
|
castBarBorderColor = Gladdy:colorOption({
|
|
|
|
type = "color",
|
|
|
|
name = L["Status Bar border color"],
|
|
|
|
order = 52,
|
|
|
|
hasAlpha = true,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon = {
|
|
|
|
type = "group",
|
2021-05-24 12:41:21 +02:00
|
|
|
name = L["Icon"],
|
2021-05-17 16:49:54 +02:00
|
|
|
order = 2,
|
|
|
|
args = {
|
|
|
|
headerSize = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Icon Size"],
|
|
|
|
order = 1,
|
|
|
|
},
|
2022-01-12 22:16:02 +01:00
|
|
|
castBarIconEnabled = option({
|
|
|
|
type = "toggle",
|
|
|
|
name = L["Icon Enabled"],
|
|
|
|
order = 2,
|
|
|
|
width = "full",
|
|
|
|
}),
|
2021-05-17 16:49:54 +02:00
|
|
|
castBarIconSize = option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Icon size"],
|
|
|
|
order = 21,
|
|
|
|
min = 0,
|
|
|
|
max = 100,
|
|
|
|
step = 1,
|
2021-06-15 09:05:07 +02:00
|
|
|
width = "full",
|
2021-05-17 16:49:54 +02:00
|
|
|
}),
|
|
|
|
headerBorder = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Border"],
|
|
|
|
order = 30,
|
|
|
|
},
|
|
|
|
castBarIconStyle = option({
|
|
|
|
type = "select",
|
|
|
|
name = L["Icon border"],
|
|
|
|
order = 53,
|
|
|
|
values = Gladdy:GetIconStyles(),
|
|
|
|
}),
|
|
|
|
castBarIconColor = Gladdy:colorOption({
|
|
|
|
type = "color",
|
|
|
|
name = L["Icon border color"],
|
|
|
|
order = 54,
|
|
|
|
hasAlpha = true,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
spark = {
|
|
|
|
type = "group",
|
2021-05-24 12:41:21 +02:00
|
|
|
name = L["Spark"],
|
2021-05-17 16:49:54 +02:00
|
|
|
order = 3,
|
|
|
|
args = {
|
|
|
|
header = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Spark"],
|
|
|
|
order = 1,
|
|
|
|
},
|
|
|
|
castBarSparkEnabled = option({
|
|
|
|
type = "toggle",
|
|
|
|
name = L["Spark enabled"],
|
|
|
|
order = 26,
|
|
|
|
}),
|
|
|
|
castBarSparkColor = Gladdy:colorOption({
|
|
|
|
type = "color",
|
|
|
|
name = L["Spark color"],
|
|
|
|
desc = L["Color of the cast bar spark"],
|
|
|
|
order = 27,
|
|
|
|
hasAlpha = true,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
font = {
|
|
|
|
type = "group",
|
2021-05-24 12:41:21 +02:00
|
|
|
name = L["Font"],
|
2021-05-17 16:49:54 +02:00
|
|
|
order = 4,
|
|
|
|
args = {
|
|
|
|
header = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Font"],
|
|
|
|
order = 1,
|
|
|
|
},
|
|
|
|
castBarFont = option({
|
|
|
|
type = "select",
|
|
|
|
name = L["Font"],
|
|
|
|
desc = L["Font of the castbar"],
|
|
|
|
order = 2,
|
|
|
|
dialogControl = "LSM30_Font",
|
|
|
|
values = AceGUIWidgetLSMlists.font,
|
|
|
|
}),
|
|
|
|
castBarFontColor = Gladdy:colorOption({
|
|
|
|
type = "color",
|
|
|
|
name = L["Font color"],
|
|
|
|
desc = L["Color of the text"],
|
|
|
|
order = 3,
|
|
|
|
hasAlpha = true,
|
|
|
|
}),
|
|
|
|
castBarFontSize = option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Font size"],
|
|
|
|
desc = L["Size of the text"],
|
|
|
|
order = 4,
|
|
|
|
min = 1,
|
|
|
|
max = 20,
|
2021-06-15 09:05:07 +02:00
|
|
|
width = "full",
|
2021-05-17 16:49:54 +02:00
|
|
|
}),
|
2022-03-25 22:25:54 +01:00
|
|
|
castBarFontOutline = option({
|
|
|
|
type = "toggle",
|
|
|
|
name = L["Outline"],
|
|
|
|
order = 5,
|
|
|
|
width = "full",
|
|
|
|
}),
|
2021-05-17 16:49:54 +02:00
|
|
|
headerFormat = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Format"],
|
|
|
|
order = 10,
|
|
|
|
},
|
|
|
|
castBarTimerFormat = option({
|
|
|
|
type = "select",
|
|
|
|
name = L["Timer Format"],
|
|
|
|
order = 11,
|
|
|
|
values = {
|
|
|
|
["LEFT"] = L["Remaining"],
|
|
|
|
["TOTAL"] = L["Total"],
|
|
|
|
["BOTH"] = L["Both"],
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
position = {
|
|
|
|
type = "group",
|
2021-05-24 12:41:21 +02:00
|
|
|
name = L["Position"],
|
2021-05-17 16:49:54 +02:00
|
|
|
order = 5,
|
|
|
|
args = {
|
|
|
|
header = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Position"],
|
|
|
|
order = 1,
|
|
|
|
},
|
|
|
|
castBarIconPos = option( {
|
|
|
|
type = "select",
|
|
|
|
name = L["Icon position"],
|
|
|
|
order = 3,
|
|
|
|
values = {
|
|
|
|
["LEFT"] = L["Left"],
|
|
|
|
["RIGHT"] = L["Right"],
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
headerOffset = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Offsets"],
|
|
|
|
order = 10,
|
|
|
|
},
|
|
|
|
castBarXOffset = option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Horizontal offset"],
|
|
|
|
order = 11,
|
|
|
|
min = -400,
|
|
|
|
max = 400,
|
|
|
|
step = 0.1,
|
2021-06-15 09:05:07 +02:00
|
|
|
width = "full",
|
2021-05-17 16:49:54 +02:00
|
|
|
}),
|
|
|
|
castBarYOffset = option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Vertical offset"],
|
|
|
|
order = 12,
|
|
|
|
min = -400,
|
|
|
|
max = 400,
|
|
|
|
step = 0.1,
|
2021-06-15 09:05:07 +02:00
|
|
|
width = "full",
|
2021-05-17 16:49:54 +02:00
|
|
|
}),
|
|
|
|
}
|
|
|
|
},
|
2022-01-12 20:21:53 +01:00
|
|
|
frameStrata = {
|
|
|
|
type = "group",
|
|
|
|
name = L["Frame Strata and Level"],
|
|
|
|
order = 6,
|
|
|
|
args = {
|
|
|
|
headerAuraLevel = {
|
|
|
|
type = "header",
|
|
|
|
name = L["Frame Strata and Level"],
|
|
|
|
order = 1,
|
|
|
|
},
|
|
|
|
castBarFrameStrata = Gladdy:option({
|
|
|
|
type = "select",
|
|
|
|
name = L["Frame Strata"],
|
|
|
|
order = 2,
|
|
|
|
values = Gladdy.frameStrata,
|
|
|
|
sorting = Gladdy.frameStrataSorting,
|
|
|
|
width = "full",
|
|
|
|
}),
|
|
|
|
castBarFrameLevel = Gladdy:option({
|
|
|
|
type = "range",
|
|
|
|
name = L["Frame Level"],
|
|
|
|
min = 1,
|
|
|
|
max = 500,
|
|
|
|
step = 1,
|
|
|
|
order = 3,
|
|
|
|
width = "full",
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
2021-05-17 16:49:54 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2022-01-11 00:29:17 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
-- LAGACY HANDLER
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
function Castbar:LegacySetPosition(castBar, unit, leftMargin, rightMargin)
|
|
|
|
if Gladdy.db.newLayout then
|
|
|
|
return Gladdy.db.newLayout
|
|
|
|
end
|
|
|
|
castBar:ClearAllPoints()
|
2022-01-25 20:41:32 +01:00
|
|
|
if Gladdy.db.castBarWidth <= 0 then
|
|
|
|
castBar:SetWidth(0.1)
|
|
|
|
end
|
|
|
|
if Gladdy.db.castBarHeight <= 0 then
|
|
|
|
castBar:SetHeight(0.1)
|
|
|
|
end
|
2022-01-11 00:29:17 +01:00
|
|
|
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
|
|
|
if (Gladdy.db.castBarPos == "LEFT") then
|
|
|
|
local anchor = Gladdy:GetAnchor(unit, "LEFT")
|
|
|
|
if anchor == Gladdy.buttons[unit].healthBar then
|
|
|
|
castBar:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
|
|
else
|
|
|
|
castBar:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if (Gladdy.db.castBarPos == "RIGHT") then
|
|
|
|
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
|
|
|
|
if anchor == Gladdy.buttons[unit].healthBar then
|
|
|
|
castBar:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
|
|
else
|
|
|
|
castBar:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return Gladdy.db.newLayout
|
2021-05-17 16:49:54 +02:00
|
|
|
end
|