diff --git a/.luacheckrc b/.luacheckrc index 2e903fee..8d8ff494 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1497,6 +1497,7 @@ stds.ecs = { "GetUICameraInfo", "GetUITextureKitInfo", "GetUnitHealthModifier", + "GetUnitManaRegenRateFromSpirit", "GetUnitMaxHealthModifier", "GetUnitPowerModifier", "GetUnitSpeed", @@ -2767,6 +2768,7 @@ stds.ecs = { "WOW_PROJECT_WRATH_CLASSIC", "-----------------------------------------------------> Enums", "LE_EXPANSION_BURNING_CRUSADE", + "LE_UNIT_STAT_SPIRIT", "-----------------------------------------------------> GlobalStrings", "CLOSE", "DEFENSE", diff --git a/Modules/Config/ManaSection.lua b/Modules/Config/ManaSection.lua index d62c4f5c..a0e4ef9c 100755 --- a/Modules/Config/ManaSection.lua +++ b/Modules/Config/ManaSection.lua @@ -28,16 +28,16 @@ function _Config:LoadManaSection() Stats.RebuildStatInfos() end, }, - mp5Items = { + mp5CastingModifier = { type = "toggle", order = 1, - name = function() return i18n("MP5 Items") end, - desc = function() return i18n("Shows/Hides the MP5 value from items.") end, + name = function() return i18n("MP5 Casting Modifier") end, + desc = function() return i18n("Shows/Hides the MP5 casting modifier.") end, width = 1.5, disabled = function() return (not ExtendedCharacterStats.profile.regen.display); end, - get = function () return ExtendedCharacterStats.profile.regen.mp5Items.display; end, + get = function () return ExtendedCharacterStats.profile.regen.mp5CastingModifier.display; end, set = function (_, value) - ExtendedCharacterStats.profile.regen.mp5Items.display = value + ExtendedCharacterStats.profile.regen.mp5CastingModifier.display = value Stats.RebuildStatInfos() end, }, @@ -54,16 +54,16 @@ function _Config:LoadManaSection() Stats.RebuildStatInfos() end, }, - mp5Buffs = { + mp5Periodic = { type = "toggle", order = 3, - name = function() return i18n("MP5 Buffs") end, - desc = function() return i18n("Shows/Hides the MP5 value from buffs.") end, + name = function() return i18n("MP5 Periodic") end, + desc = function() return i18n("Shows/Hides the periodic MP5 value.") end, width = 1.5, disabled = function() return (not ExtendedCharacterStats.profile.regen.display); end, - get = function () return ExtendedCharacterStats.profile.regen.mp5Buffs.display; end, + get = function () return ExtendedCharacterStats.profile.regen.mp5Periodic.display; end, set = function (_, value) - ExtendedCharacterStats.profile.regen.mp5Buffs.display = value + ExtendedCharacterStats.profile.regen.mp5Periodic.display = value Stats.RebuildStatInfos() end, }, diff --git a/Modules/Data/Constants.lua b/Modules/Data/Constants.lua index 30a7edaa..3cbc247a 100755 --- a/Modules/Data/Constants.lua +++ b/Modules/Data/Constants.lua @@ -284,6 +284,46 @@ Data.Aura = { [25894] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 1 [25918] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 2 }, + PowerRegenPercentModifier = { + [Enum.PowerType.Energy] = { + [13750] = 1, -- Adrenaline Rush + [58427] = 0.3, -- Overkill + [66203] = -1, -- Steam Blast + [69470] = -1, -- Heat Drain + [70385] = -1, -- Abomination Vehicle Power Drain + [72242] = -1, -- Zero Power + [1231381] = 0.26, -- Feral Dedication + }, + [Enum.PowerType.Mana] = { + [5419] = (ECS.IsTBC and -0.11 or nil), -- Travel Form (Passive) + [5421] = (ECS.IsTBC and -0.11 or nil), -- Aquatic Form (Passive) + [12051] = (ECS.IsClassic and 15 or nil), -- Evocation + [18371] = (ECS.IsClassic and 0.5 or nil), -- Soul Siphon + [24705] = (ECS.IsClassic and 0.25 or nil), -- Invocation of the Wickerman + [27747] = -1, -- Steam Tank Passive + [29166] = ((not ECS.IsWotlk) and 4 or nil), -- Innervate + [33948] = (ECS.IsTBC and -0.11 or nil), -- Flight Form (Passive) + [34754] = (ECS.IsWotlk and 0.16 or nil), -- Holy Concentration + [40121] = (ECS.IsTBC and -0.11 or nil), -- Swift Flight Form (Passive) + [42514] = 1, -- Arcane Surge + [49307] = 1, -- Full Mana Regen + [51623] = 5, -- Sholazar Guardian Heartbeat + [63724] = 0.32, -- Holy Concentration + [63725] = 0.5, -- Holy Concentration + [456195] = 4, -- Innervate + [468466] = 1, -- Unmaking the Simulacrum + }, + [Enum.PowerType.RuneBlood] = { + [50469] = -0.5, -- Rhythm of the Fallen + [50779] = 1, -- Blood Rune Mastery + }, + [Enum.PowerType.RuneFrost] = { + [50469] = -0.5, -- Rhythm of the Fallen + }, + [Enum.PowerType.RuneUnholy] = { + [50469] = -0.5, -- Rhythm of the Fallen + }, + }, SpellCrit = { [24907] = ((not ECS.IsClassic) and 5 or nil), -- Moonkin Aura [29177] = 6, -- Elemental Devastation Rank 2 diff --git a/Modules/Data/Data.lua b/Modules/Data/Data.lua index 4d1f3fe1..e52ae63e 100755 --- a/Modules/Data/Data.lua +++ b/Modules/Data/Data.lua @@ -77,12 +77,12 @@ dataFunctionRefs = { ["SpellHasteBonus"] = function() return Data:GetSpellHasteBonus() end, ["SpellPenetration"] = function() return Data:GetSpellPenetration() end, -- MP5 - ["MP5Items"] = function() return Data:GetMP5FromItems() end, - ["MP5Spirit"] = function() return Data:GetMP5FromSpirit() end, - ["MP5Buffs"] = function() - local _, mp5Buffs = Data:GetMP5FromBuffs() - return mp5Buffs + ["MP5Periodic"] = function() + local _, _, _, periodicMana = Data:GetMP5FromBuffs() + return periodicMana end, + ["MP5Spirit"] = function() return Data:GetMP5FromSpirit() end, + ["MP5CastingModifier"] = function() return Data:GetMP5CastingModifier() end, ["MP5Casting"] = function() return Data:GetMP5WhileCasting() end, ["MP5NotCasting"] = function() return Data:GetMP5OutsideCasting() end, -- Spell Power by school diff --git a/Modules/Data/MP5.lua b/Modules/Data/MP5.lua index 4703d81c..1bd441ba 100755 --- a/Modules/Data/MP5.lua +++ b/Modules/Data/MP5.lua @@ -55,17 +55,6 @@ function _MP5:GetMP5ValueOnItems() if enchant then mp5 = mp5 + (Data.Enchant.MP5[enchant] or 0) end - -- Check for socketed gems (TODO: check for socket bonus) - local gem1, gem2, gem3 = DataUtils:GetSocketedGemsFromItemLink(itemLink) - if gem1 then - mp5 = mp5 + (Data.Gem.MP5[tonumber(gem1)] or 0) - end - if gem2 then - mp5 = mp5 + (Data.Gem.MP5[tonumber(gem2)] or 0) - end - if gem3 then - mp5 = mp5 + (Data.Gem.MP5[tonumber(gem3)] or 0) - end end end @@ -78,48 +67,69 @@ function _MP5:GetMP5ValueOnItems() return mp5 end -local lastManaReg = 0 - ---@return number function Data:GetMP5FromSpirit() - local base, _ = GetManaRegen() -- Returns mana reg per 1 second (including talent and buff modifiers) - if base < 1 then - base = lastManaReg + local regen + if ECS.IsClassic then + -- GetUnitManaRegenRateFromSpirit uses TBC formula in classic + local _, spirit, _, _ = UnitStat("player", LE_UNIT_STAT_SPIRIT) + if spirit < 50 then + regen = 0.25 * spirit + else + if classId == Data.PRIEST or classId == Data.MAGE then + regen = (12.5 + spirit/4)/2 + elseif classId == Data.DRUID and (not DataUtils:IsShapeshifted()) then + regen = (15 + spirit/4.5)/2 + else + regen = (15 + spirit/5)/2 + end + end + else + regen = GetUnitManaRegenRateFromSpirit("player") end - lastManaReg = base + return DataUtils:Round(regen * 5, 1) +end - return DataUtils:Round(base * 5, 2) +-- Get mana regen while casting +---@return number +function Data:GetMP5CastingModifier() + local _, castingModifier, _, _ = Data:GetMP5FromBuffs() + castingModifier = min(1,castingModifier + _MP5:GetTalentModifier() + Data:GetSetBonusModifierMP5()) -- capped at 100% + return DataUtils:Round(castingModifier, 2) end -- Get mana regen while casting ---@return number function Data:GetMP5WhileCasting() - local _, casting = GetManaRegen() -- Returns mana reg per 1 second (including talent and buff modifiers) - if casting < 0.1 then - casting = 0 + -- Returns mana reg per 1 second (including talent and buff casting modifiers) + local _, casting = GetManaRegen() + local modifier, _, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs() + casting = casting * 5 + if ECS.IsClassic then + -- in classic GetManaRegen doesn't account for mp5 from items nor buffs + casting = casting + Data:GetMP5FromItems() + mp5BuffBonus end - - local castingModifier, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs() - castingModifier = min(1,castingModifier + _MP5:GetTalentModifier() + Data:GetSetBonusModifierMP5()) -- capped at 100% - local mp5Items = Data:GetMP5FromItems() - casting = (casting * 5) + mp5Items + mp5BuffBonus * castingModifier + periodicMana - - return DataUtils:Round(casting, 2) + casting = casting * modifier + mp5BuffBonus + periodicMana + return DataUtils:Round(casting, 1) end ---@return number function Data:GetMP5OutsideCasting() - local mp5FromSpirit = Data:GetMP5FromSpirit() - local _, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs() - local mp5FromItems = Data:GetMP5FromItems() - - local totalMP5 = mp5FromSpirit + mp5FromItems + mp5BuffBonus + periodicMana - return DataUtils:Round(totalMP5, 2) + local base, _ = GetManaRegen() + local modifier, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs() + local totalMP5 = base * 5 + if ECS.IsClassic then + -- in classic GetManaRegen doesn't account for mp5 from items nor buffs + totalMP5 = totalMP5 + Data:GetMP5FromItems() + mp5BuffBonus + end + totalMP5 = totalMP5 * modifier + periodicMana + return DataUtils:Round(totalMP5, 1) end ---@return number, number, number function Data:GetMP5FromBuffs() - local mod = 0 + local mod = 1 + local castingMod = 0 local bonus = 0 local periodic = 0 local maxmana = UnitPowerMax("player", Enum.PowerType.Mana) @@ -131,7 +141,8 @@ function Data:GetMP5FromBuffs() bonus = bonus + (Data.Aura.MP5[aura.spellId] or 0) bonus = bonus + (Data.Aura.PercentageMp5[aura.spellId] or 0) * maxmana periodic = periodic + (Data.Aura.PeriodicallyGiveMana[aura.spellId] or 0) - mod = mod + (Data.Aura.AllowCastingManaRegeneration[aura.spellId] or 0) -- assuming buffs stacking, to be investigated + castingMod = castingMod + (Data.Aura.AllowCastingManaRegeneration[aura.spellId] or 0) + mod = mod + (Data.Aura.PowerRegenPercentModifier[Enum.PowerType.Mana][aura.spellId] or 0) if Data.Aura.IsLightningShield[aura.spellId] and Data:IsSetBonusActive(Data.setNames.THE_EARTHSHATTERER, 8) then bonus = bonus + 15 -- 15 MP5 from Shaman T3 8 piece bonus when Lightning Shield is active end @@ -157,7 +168,7 @@ function Data:GetMP5FromBuffs() end i = i + 1 until (not aura) - return min(mod,1), bonus, periodic + return max(mod,0), min(castingMod,1), bonus, periodic end ---@return number diff --git a/Modules/Migration.lua b/Modules/Migration.lua index 0f1bf19b..4e5928a8 100644 --- a/Modules/Migration.lua +++ b/Modules/Migration.lua @@ -15,6 +15,8 @@ function Migration:ToLatestProfileVersion(profileVersion) return end + local defaultProfile = Profile:GetDefaultProfile() + if profileVersion < 24 then ExtendedCharacterStats.profile.defense.resilienceRating = ExtendedCharacterStats.profile.defense.resilience ExtendedCharacterStats.profile.defense.resilience = nil @@ -22,4 +24,10 @@ function Migration:ToLatestProfileVersion(profileVersion) if profileVersion < 25 then ExtendedCharacterStats.profile.defense.resilience = nil end + if profileVersion < 26 then + ExtendedCharacterStats.profile.regen.mp5Buffs = nil + ExtendedCharacterStats.profile.regen.mp5Items = nil + ExtendedCharacterStats.profile.regen.mp5Periodic = defaultProfile.profile.regen.mp5Periodic + ExtendedCharacterStats.profile.regen.mp5CastingModifier = defaultProfile.profile.regen.mp5CastingModifier + end end diff --git a/Modules/Profile.lua b/Modules/Profile.lua index 2a2152fe..48adadae 100755 --- a/Modules/Profile.lua +++ b/Modules/Profile.lua @@ -6,7 +6,7 @@ local Utils = ECSLoader:ImportModule("Utils") ---@return number function Profile.GetProfileVersion() - return 25 + return 26 end ---@return ECSProfile @@ -296,10 +296,10 @@ local function GetDefaultStatsProfile() refName = "ManaHeader", text = "Mana", - mp5Items = { + mp5CastingModifier = { display = true, - refName = "MP5Items", - text = "MP5 (Items)", + refName = "MP5CastingModifier", + text = "MP5 Casting Modifier", textColor = colors.MP5_SECONDARY, statColor = colors.MP5_PRIMARY }, @@ -310,10 +310,10 @@ local function GetDefaultStatsProfile() textColor = colors.MP5_SECONDARY, statColor = colors.MP5_PRIMARY }, - mp5Buffs = { + mp5Periodic = { display = true, - refName = "MP5Buffs", - text = "MP5 (Buffs)", + refName = "MP5Periodic", + text = "MP5 (Periodic)", textColor = colors.MP5_SECONDARY, statColor = colors.MP5_PRIMARY }, diff --git a/Modules/Stats.lua b/Modules/Stats.lua index 31c6fb5f..277fd5b6 100755 --- a/Modules/Stats.lua +++ b/Modules/Stats.lua @@ -322,7 +322,14 @@ _CreateStatInfos = function() if UnitHasMana("player") then category = profile.regen - _CreateStatInfo(category, category.mp5Items, category.mp5Spirit, category.mp5Buffs, category.mp5Casting, category.mp5NotCasting) + _CreateStatInfo( + category, + category.mp5Spirit, + category.mp5Periodic, + category.mp5CastingModifier, + category.mp5Casting, + category.mp5NotCasting + ) end category = profile.spell diff --git a/Modules/i18n/translations/ConfigTranslations/ManaConfigTranslations.lua b/Modules/i18n/translations/ConfigTranslations/ManaConfigTranslations.lua index 21443840..508b4591 100644 --- a/Modules/i18n/translations/ConfigTranslations/ManaConfigTranslations.lua +++ b/Modules/i18n/translations/ConfigTranslations/ManaConfigTranslations.lua @@ -22,45 +22,45 @@ local manaConfigTranslations = { ["esMX"] = "Muestra/oculta todas estadísticas de maná", ["ptBR"] = "Mostra/oculta todas as estatísticas de mana" }, - ["MP5 Items"] = { + ["MP5 Periodic"] = { ["enUS"] = true, - ["deDE"] = "MP5 Gegenstände", - ["frFR"] = "MP5 (Objets)", - ["zhCN"] = "装备回蓝", - ["ruRU"] = "MP5 (экипировка)", - ["esES"] = "MP5 (Objetos)", - ["esMX"] = "MP5 (Objetos)", - ["ptBR"] = "MP5 (Itens)" + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = false, }, - ["Shows/Hides the MP5 value from items."] = { + ["Shows/Hides the periodic MP5 value."] = { ["enUS"] = true, - ["deDE"] = "Zeigt/Versteckt den MP5-Wert von Gegenständen.", - ["frFR"] = "Affiche/cache la valeur MP5 des objets.", - ["zhCN"] = "显示/隐藏 装备回蓝", - ["ruRU"] = "Показать/скрыть значение MP5 (восполнение маны каждые 5 сек вне боя) от экипировки", - ["esES"] = "Muestra/oculta el valor de MP5 de objetos", - ["esMX"] = "Muestra/oculta el valor de MP5 de objetos", - ["ptBR"] = "Mostra/oculta o valor de MP5 de itens" + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = false, }, - ["MP5 Buffs"] = { + ["MP5 Casting Modifier"] = { ["enUS"] = true, - ["deDE"] = "MP5 Stärkungszauber", - ["frFR"] = "MP5 (Amélioration)", - ["zhCN"] = "增益回蓝", - ["ruRU"] = "MP5 (баффы)", - ["esES"] = "MP5 (Beneficios)", - ["esMX"] = "MP5 (Beneficios)", - ["ptBR"] = "MP5 (Bônus)" + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = "" }, - ["Shows/Hides the MP5 value from buffs."] = { + ["Shows/Hides the MP5 casting modifier."] = { ["enUS"] = true, - ["deDE"] = "Zeigt/Versteckt den MP5-Wert Stärkungszauber.", - ["frFR"] = "Affiche/cache la valeur MP5 de Amélioration.", - ["zhCN"] = "显示/隐藏 增益回蓝", - ["ruRU"] = "Показать/скрыть значение MP5 (восполнение маны каждые 5 сек вне боя) от баффов", - ["esES"] = "Muestra/oculta el valor de MP5 de beneficios", - ["esMX"] = "Muestra/oculta el valor de MP5 de beneficios", - ["ptBR"] = "Mostra/oculta o valor de MP5 de bônus" + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = false, }, ["MP5 Spirit"] = { ["enUS"] = true, diff --git a/Modules/i18n/translations/StatTranslations.lua b/Modules/i18n/translations/StatTranslations.lua index 6bf9140e..c6cf1e05 100644 --- a/Modules/i18n/translations/StatTranslations.lua +++ b/Modules/i18n/translations/StatTranslations.lua @@ -382,15 +382,15 @@ local statTranslations = { ["esMX"] = "Maná", ["ptBR"] = true }, - ["MP5 (Items)"] = { + ["MP5 Casting Modifier"] = { ["enUS"] = true, - ["deDE"] = "MP5 (Gegenstände)", - ["frFR"] = "MP5 (Objets)", - ["zhCN"] = "装备回蓝", - ["ruRU"] = "MP5 (экип.)", - ["esES"] = "MP5 (Objetos)", - ["esMX"] = "MP5 (Objetos)", - ["ptBR"] = "MP5 (Itens)" + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = false, }, ["MP5 (Spirit)"] = { ["enUS"] = true, @@ -402,15 +402,15 @@ local statTranslations = { ["esMX"] = "MP5 (Espíritu)", ["ptBR"] = "MP5 (Espírito)" }, - ["MP5 (Buffs)"] = { + ["MP5 (Periodic)"] = { ["enUS"] = true, - ["deDE"] = "MP5 (Stärkungszauber)", - ["frFR"] = "MP5 (Améliorations)", - ["zhCN"] = "增益回蓝", - ["ruRU"] = "MP5 (баффы)", - ["esES"] = "MP5 (Beneficios)", - ["esMX"] = "MP5 (Beneficios)", - ["ptBR"] = "MP5 (Bônus)" + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = false, }, ["MP5 (Casting)"] = { ["enUS"] = true,