diff --git a/Bars/Abstract/Bar.lua b/Bars/Abstract/Bar.lua old mode 100755 new mode 100644 index 8bbdad0..52a4135 --- a/Bars/Abstract/Bar.lua +++ b/Bars/Abstract/Bar.lua @@ -871,7 +871,7 @@ function BarMixin:UpdateTicksLayout(layoutName, data) local resource = self:GetResource() local max = 0; if resource == "MAELSTROM_WEAPON" then - max = 5 + max = data.maelstromWeaponUseTenBars and 10 or 5 elseif resource == "TIP_OF_THE_SPEAR" then max = addonTable.TipOfTheSpear.TIP_MAX_STACKS elseif resource == "WHIRLWIND" then @@ -948,7 +948,12 @@ function BarMixin:CreateFragmentedPowerBars(layoutName, data) local resource = self:GetResource() if not resource then return end - local maxPower = resource == "MAELSTROM_WEAPON" and 5 or UnitPowerMax("player", resource) or 0 + local maxPower + if resource == "MAELSTROM_WEAPON" then + maxPower = data.maelstromWeaponUseTenBars and 10 or 5 + else + maxPower = UnitPowerMax("player", resource) or 0 + end for i = 1, maxPower or 0 do if not self.FragmentedPowerBars[i] then @@ -1258,6 +1263,15 @@ function BarMixin:UpdateFragmentedPowerDisplay(layoutName, data, maxPower) local auraData = C_UnitAuras.GetPlayerAuraBySpellID(344179) -- Maelstrom Weapon local current = auraData and auraData.applications or 0 local above5MwColor = addonTable:GetOverrideResourceColor("MAELSTROM_WEAPON_ABOVE_5") or color + + local isRagingMaelstromTalented = C_SpellBook.IsSpellKnown(384143) -- Raging Maelstrom + + if data.maelstromWeaponUseTenBars and not isRagingMaelstromTalented then + data.maelstromWeaponUseTenBars = false; + self:ApplyLayout(layoutName) + end + + local segmentSize = (data and data.maelstromWeaponUseTenBars) and 10 or 5 -- Reuse pre-allocated table for performance local displayOrder = self._displayOrder @@ -1276,6 +1290,7 @@ function BarMixin:UpdateFragmentedPowerDisplay(layoutName, data, maxPower) local idx = displayOrder[pos] local mwFrame = self.FragmentedPowerBars[idx] local mwText = self.FragmentedPowerBarTexts[idx] + if mwFrame then mwFrame:ClearAllPoints() @@ -1291,11 +1306,11 @@ function BarMixin:UpdateFragmentedPowerDisplay(layoutName, data, maxPower) if idx <= current then mwFrame:SetValue(1, data.smoothProgress and Enum.StatusBarInterpolation.ExponentialEaseOut or nil) - if current > 5 and idx <= math.fmod(current - 1, 5) + 1 then - mwFrame:SetStatusBarColor(above5MwColor.r, above5MwColor.g, above5MwColor.b, above5MwColor.a or 1) - else - mwFrame:SetStatusBarColor(color.r, color.g, color.b, color.a or 1) - end + if current > 5 and idx <= math.fmod(current - 1, segmentSize) + 1 then + mwFrame:SetStatusBarColor(above5MwColor.r, above5MwColor.g, above5MwColor.b, above5MwColor.a or 1) + else + mwFrame:SetStatusBarColor(color.r, color.g, color.b, color.a or 1) + end else mwFrame:SetValue(0, data.smoothProgress and Enum.StatusBarInterpolation.ExponentialEaseOut or nil) mwFrame:SetStatusBarColor(color.r * 0.5, color.g * 0.5, color.b * 0.5, color.a or 1) diff --git a/Bars/SecondaryResourceBar.lua b/Bars/SecondaryResourceBar.lua index 811108e..d84273a 100644 --- a/Bars/SecondaryResourceBar.lua +++ b/Bars/SecondaryResourceBar.lua @@ -155,9 +155,9 @@ function SecondaryResourceBarMixin:GetResourceValue(resource) if resource == "MAELSTROM_WEAPON" then local auraData = C_UnitAuras.GetPlayerAuraBySpellID(344179) -- Maelstrom Weapon local current = auraData and auraData.applications or 0 - local max = 10 + local max = data.maelstromWeaponUseTenBars and 10 or 5 - return max / 2, current + return max, current end if resource == "TIP_OF_THE_SPEAR" then @@ -178,7 +178,7 @@ end function SecondaryResourceBarMixin:GetTagValues(resource, max, current, precision) local pFormat = "%." .. (precision or 0) .. "f" - + local data = self:GetData() local tagValues = addonTable.PowerBarMixin.GetTagValues(self, resource, max, current, precision) if resource == "STAGGER" then @@ -202,8 +202,11 @@ function SecondaryResourceBarMixin:GetTagValues(resource, max, current, precisio end if resource == "MAELSTROM_WEAPON" then - local percentStr = string.format(pFormat, (current / (max * 2)) * 100) - local maxStr = string.format("%s", AbbreviateNumbers(max * 2)) + local isRagingMaelstromTalented = C_SpellBook.IsSpellKnown(384143) + local effectiveMax = (data.maelstromWeaponUseTenBars or isRagingMaelstromTalented) and 10 or 5 + + local percentStr = string.format(pFormat, (current / (effectiveMax)) * 100) + local maxStr = string.format("%s", AbbreviateNumbers(effectiveMax)) tagValues["[percent]"] = function() return percentStr end tagValues["[max]"] = function() return maxStr end end @@ -265,6 +268,7 @@ addonTable.RegisteredBar.SecondaryResourceBar = { tickColor = {r = 0, g = 0, b = 0, a = 1}, tickThickness = 1, useResourceAtlas = false, + maelstromWeaponUseTenBars = false, }, lemSettings = function(bar, defaults) local dbName = bar:GetConfig().dbName @@ -403,6 +407,41 @@ addonTable.RegisteredBar.SecondaryResourceBar = { bar:ApplyLayout(layoutName) end, }, + { + parentId = L["CATEGORY_BAR_STYLE"], + order = 406, + name = L["USE_TEN_TICK_MAELSTROM_BAR"], + kind = LEM.SettingType.Checkbox, + default = false, + get = function(layoutName) + local data = SenseiClassResourceBarDB[dbName][layoutName] + if data and data.maelstromWeaponUseTenBars ~= nil then + return data.maelstromWeaponUseTenBars + else + return defaults.maelstromWeaponUseTenBars + end + end, + set = function(layoutName, value) + SenseiClassResourceBarDB[dbName][layoutName] = SenseiClassResourceBarDB[dbName][layoutName] or CopyTable(defaults) + + local isRagingMaelstromTalented = C_SpellBook.IsSpellKnown(384143) -- Raging Maelstrom + if not isRagingMaelstromTalented then + value = false + end + + SenseiClassResourceBarDB[dbName][layoutName].maelstromWeaponUseTenBars = value + + bar:ApplyLayout(layoutName) + + end, + isEnabled = function(layoutName) + local playerClass = select(2, UnitClass("player")) + local spec = C_SpecializationInfo.GetSpecialization() + local specID = C_SpecializationInfo.GetSpecializationInfo(spec) + local isRagingMaelstromTalented = C_SpellBook.IsSpellKnown(384143) -- Raging Maelstrom + return playerClass == "SHAMAN" and isRagingMaelstromTalented and specID == 263 -- Enhancement + end, + }, { parentId = L["CATEGORY_TEXT_SETTINGS"], order = 505, diff --git a/Locales/enUS.lua b/Locales/enUS.lua index 7f9248a..f4b7d06 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -117,6 +117,7 @@ local baseLocale = { ["BACKGROUND"] = "Background", ["USE_BAR_COLOR_FOR_BACKGROUND_COLOR"] = "Use Bar Color For Background Color", ["BORDER"] = "Border", + ["USE_TEN_TICK_MAELSTROM_BAR"] = "Use Ten Tick Maelstrom Bar", -- Text settings category - Edit Mode ["CATEGORY_TEXT_SETTINGS"] = "Text Settings",