diff --git a/Mixin/Castbar.mixin.lua b/Mixin/Castbar.mixin.lua index 6c4e293..60e087c 100644 --- a/Mixin/Castbar.mixin.lua +++ b/Mixin/Castbar.mixin.lua @@ -16,6 +16,7 @@ function DragonFlightUICastbarMixin:OnLoad(unit) self:SetCastTimeTextShown(true) self.showTradeSkills = true self.showTicks = false + self.showRank = false end function DragonFlightUICastbarMixin:OnShow() @@ -53,7 +54,12 @@ function DragonFlightUICastbarMixin:OnEvent(event, ...) if (arg1 ~= unit) then return; end if (event == "UNIT_SPELLCAST_START") then - local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = UnitCastingInfo(unit); + local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellId = + UnitCastingInfo(unit); + local subText = GetSpellSubtext(spellId) + if not self.showRank then subText = '' end + if subText ~= '' then subText = ' (' .. subText .. ')' end + if (not name or (not self.showTradeSkills and isTradeSkill)) then -- local desiredShowFalse = false; -- self:UpdateShownState(desiredShowFalse); @@ -73,8 +79,8 @@ function DragonFlightUICastbarMixin:OnEvent(event, ...) self:SetValue(self.value); -- self:UpdateCastTimeText(); if (self.Text) then - self.Text:SetText(text); - self.TextCompact:SetText(text) + self.Text:SetText(text .. subText); + self.TextCompact:SetText(text .. subText) end if (self.Icon) then -- @TODO @@ -96,8 +102,12 @@ function DragonFlightUICastbarMixin:OnEvent(event, ...) self:HandleInterruptOrSpellFailed(false, event, ...); elseif (event == "UNIT_SPELLCAST_DELAYED") then if (self:IsShown()) then - local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = + local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellId = UnitCastingInfo(unit); + local subText = GetSpellSubtext(spellId) + if not self.showRank then subText = '' end + if subText ~= '' then subText = ' (' .. subText .. ')' end + if (not name or (not self.showTradeSkills and isTradeSkill)) then -- if there is no name, there is no bar local desiredShowFalse = false; @@ -125,6 +135,10 @@ function DragonFlightUICastbarMixin:OnEvent(event, ...) end elseif event == "UNIT_SPELLCAST_CHANNEL_START" then local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID = UnitChannelInfo(unit); + local subText = GetSpellSubtext(spellId) + if not self.showRank then subText = '' end + if subText ~= '' then subText = ' (' .. subText .. ')' end + if (not name or (not self.showTradeSkills and isTradeSkill)) then -- if there is no name, there is no bar local desiredShowFalse = false; @@ -147,8 +161,8 @@ function DragonFlightUICastbarMixin:OnEvent(event, ...) self:SetValue(self.value); self:UpdateCastTimeText(); if (self.Text) then - self.Text:SetText(text); - self.TextCompact:SetText(text) + self.Text:SetText(text .. subText); + self.TextCompact:SetText(text .. subText) end if (self.Icon) then self.Icon:SetTexture(texture); end @@ -554,3 +568,7 @@ end function DragonFlightUICastbarMixin:SetShowTicks(showTicks) self.showTicks = showTicks end + +function DragonFlightUICastbarMixin:SetShowRank(showRank) + self.showRank = showRank +end diff --git a/Modules/Castbar.lua b/Modules/Castbar.lua index 6180a6c..d35e53c 100644 --- a/Modules/Castbar.lua +++ b/Modules/Castbar.lua @@ -17,7 +17,8 @@ local defaults = { castTimeMaxEnabled = true, compactLayout = true, showIcon = false, - showTicks = false + showTicks = false, + showRank = false } } Module:SetDefaults(defaults) @@ -120,10 +121,15 @@ local options = { compactLayout = {type = 'toggle', name = 'Compact Layout', order = 106.1}, showIcon = {type = 'toggle', name = 'Show Icon', order = 106.2}, showTicks = {type = 'toggle', name = 'Show Ticks', order = 107.1} - } } +if DF.Era then + local moreOptions = {showRank = {type = 'toggle', name = 'Show Rank', order = 108, new = true}} + + for k, v in pairs(moreOptions) do options.args[k] = v end +end + function Module:OnInitialize() DF:Debug(self, 'Module ' .. mName .. ' OnInitialize()') self.db = DF.db:RegisterNamespace(mName, defaults) @@ -180,6 +186,7 @@ function Module:ApplySettings() Module.Castbar:SetCompactLayout(db.compactLayout) Module.Castbar:SetShowTicks(db.showTicks) Module.Castbar:SetIconShown(db.showIcon) + Module.Castbar:SetShowRank(db.showRank) Module.Castbar.Icon:SetSize(db.sizeY, db.sizeY) end