Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions Bars/Abstract/Bar.lua
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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)
Expand Down
49 changes: 44 additions & 5 deletions Bars/SecondaryResourceBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down