Skip to content
Draft
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ stds.ecs = {
"GetUICameraInfo",
"GetUITextureKitInfo",
"GetUnitHealthModifier",
"GetUnitHealthRegenRateFromSpirit",
"GetUnitMaxHealthModifier",
"GetUnitPowerModifier",
"GetUnitSpeed",
Expand Down Expand Up @@ -2767,6 +2768,7 @@ stds.ecs = {
"WOW_PROJECT_WRATH_CLASSIC",
"-----------------------------------------------------> Enums",
"LE_EXPANSION_BURNING_CRUSADE",
"LE_UNIT_STAT_SPIRIT",
"-----------------------------------------------------> GlobalStrings",
"CLOSE",
"DEFENSE",
Expand Down
26 changes: 26 additions & 0 deletions Modules/Config/GeneralSection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@ function _Config:LoadGeneralSection()
Stats.RebuildStatInfos()
end,
},
healthRegeneration = {
type = "toggle",
order = 2,
name = function() return i18n("Health Regeneration") end,
desc = function() return i18n("Shows/Hides the health regeneration value.") end,
width = 1.5,
disabled = function() return (not ExtendedCharacterStats.profile.general.display); end,
get = function () return ExtendedCharacterStats.profile.general.healthRegeneration.display; end,
set = function (_, value)
ExtendedCharacterStats.profile.general.healthRegeneration.display = value
Stats.RebuildStatInfos()
end,
},
healthRegenerationCombat = {
type = "toggle",
order = 2.1,
name = function() return i18n("Combat Health Regeneration") end,
desc = function() return i18n("Shows/Hides the combat health regeneration value.") end,
width = 1.5,
disabled = function() return (not ExtendedCharacterStats.profile.general.display); end,
get = function () return ExtendedCharacterStats.profile.general.healthRegenerationCombat.display; end,
set = function (_, value)
ExtendedCharacterStats.profile.general.healthRegenerationCombat.display = value
Stats.RebuildStatInfos()
end,
},
},
}
end
172 changes: 172 additions & 0 deletions Modules/Data/Constants.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
local IsClassic = ECS.IsClassic
local IsWotlk = ECS.IsWotlk

---@class Data
local Data = ECSLoader:ImportModule("Data")

Expand Down Expand Up @@ -79,6 +82,90 @@ Data.Aura = {
[17800] = (ECS.IsWotlk and -5 or nil), -- Shadow Mastery 5/5
[22959] = (ECS.IsWotlk and -5 or nil), -- Improved Scorch
},
HealthRegen = {
[433] = 17, -- Food
[434] = 58, -- Food
[435] = 115, -- Food
[1127] = 162, -- Food
[1129] = 232, -- Food
[1131] = 358, -- Food
[2639] = 70, -- Food
[5004] = 17, -- Food
[5005] = 58, -- Food
[5006] = 115, -- Food
[5007] = 162, -- Food
[6410] = 70, -- Food
[7737] = 10, -- Food
[9177] = 134, -- Tigule's Strawberry Ice Cream
[10256] = 232, -- Food
[10257] = 358, -- Food
[12732] = 13, -- Shard of Afrasa
[13787] = 7, -- Demon Armor
[18124] = 358, -- Blessed Sunfruit
[18229] = 162, -- Food
[18230] = 162, -- Food
[18231] = 162, -- Food
[18232] = 162, -- Food
[18233] = 162, -- Food
[18234] = (IsClassic and 358 or 720), -- Food
[20798] = 3, -- Demon Skin
[21149] = 17, -- Egg Nog
[22731] = 358, -- Food
[24800] = 358, -- Food
[25660] = (IsClassic and 425 or 720), -- Food
[25695] = 358, -- Food
[25697] = 358, -- Old Enriched Manna Biscuit
[25700] = 37, -- Food
[25702] = 90, -- Food
[25886] = 135, -- Food
[25888] = 200, -- Food
[26030] = 358, -- Windblossom Berries
[26260] = 735, -- Food
[26401] = (IsClassic and 425 or 720), -- Food
[26472] = 268, -- Food
[26474] = 37, -- Food
[28616] = 597, -- Food
[29008] = 358, -- Food
[29038] = 200, -- Fizzy Energy Drink
[29041] = 368, -- Tasty Summer Treat
[29073] = (IsClassic and 530 or 720), -- Food
[446713] = 538, -- Food
[470362] = 358, -- Food
[470369] = 232, -- Food
[1225769] = 425, -- Food
[1225771] = 425, -- Food
[1225772] = 425, -- Food
[1225774] = 425, -- Food
},
HealthRegenModifier = {
[3150] = -0.5, -- Rabies
[8384] = 0.5, -- Pure Water
[16143] = (IsWotlk and -0.5 or -1), -- Cadaver Worms
[16573] = (IsWotlk and -0.5 or -1), -- Putrid Bile
[24705] = (IsClassic and 0.25 or nil), -- Invocation of the Wickerman
[25794] = 1, -- Ahn'Qiraj Reward Buff (Melee - 20)
[25795] = 1, -- Ahn'Qiraj Reward Buff (Melee - 40)
[25796] = 1, -- Ahn'Qiraj Reward Buff (Melee - 60)
[30843] = -1, -- Enfeeble
[41292] = -1, -- Aura of Suffering
[430493] = -0.99, -- WoW Variety Show - Unhealthy!
},
IsFelOrDemonArmor = {
[706] = true,
[1086] = true,
[11733] = true,
[11734] = true,
[11735] = true,
[27260] = true,
[28176] = true,
[28189] = true,
[44520] = true,
[44977] = true,
[47793] = true,
[47889] = true,
[47892] = true,
[47893] = true,
},
IsFeralForm = {
[768] = true, -- Cat Form
[5487] = true, -- Bear Form
Expand Down Expand Up @@ -257,6 +344,76 @@ Data.Aura = {
[58776] = 5/2, -- Mana Spring rank 7
[58777] = 5/2, -- Mana Spring rank 8
},
PercentageHealthRegen = {
[1234] = 1.01*5, -- Tony's God Mode
[1908] = (IsClassic and 1/3 or 1/0.5)*5, -- Uber Heal Over Time
[16488] = (IsWotlk and 0.01/3 or 0.01/6)*5, -- Blood Craze Rank 1
[16490] = (IsWotlk and 0.01/1.5 or 0.01/3)*5, -- Blood Craze Rank 2
[16491] = (IsWotlk and 0.01 or 0.01/2)*5, -- Blood Craze Rank 3
[18790] = (IsClassic and 0.03 or 0.02)/4*5, -- Fel Stamina
[20578] = 0.07/2*5, -- Cannibalize
[24005] = 0.02*5, -- Food
[24707] = 0.03*5, -- Food
[24869] = 0.02*5, -- Food
[25990] = 0.05*5, -- Graccu's Mince Meat Fruitcake
[26263] = 0.04*5, -- Dim Sum
[28176] = (IsWotlk and 0.02/5*5 or nil), -- Fel Armor Rank 1
[28189] = (IsWotlk and 0.02/5*5 or nil), -- Fel Armor Rank 2
[29055] = 0.04*5, -- Refreshing Red Apple
[29841] = 0.01/2*5, -- Second Wind
[29842] = 0.02/2*5, -- Second Wind
[29963] = 0.06*5, -- Mass Polymorph
[30839] = 1/3*5, -- Debuff Uber Heal Over Time
[30874] = 0.05*5, -- Gift of the Water Spirit
[36506] = 0.05*5, -- Energy Charge
[37460] = 0.05*5, -- Regeneration
[37709] = 0.04/2*5, -- Wild Regeneration
[38730] = 0.09/2*5, -- Refreshing Mist
[39578] = 0.05*5, -- Spirit Bond
[40503] = 0.2*5, -- Possession Transfer
[41962] = 0.2*5, -- Possession Transfer
[42771] = 0.01*5, -- Second Wind
[47892] = 0.02/5*5, -- Fel Armor Rank 3
[47893] = 0.02/5*5, -- Fel Armor Rank 4
[48082] = 0.05/5*5, -- Seed Pod
[48591] = 1*5, -- Periodic Heal Full Health Self
[48775] = 0.05*5, -- Healing Beam
[52011] = 0.04/2*5, -- Renewing Beam
[52067] = 0.04/2*5, -- Aura of Regeneration
[52979] = 0.05*5, -- Frigid Absorbtion
[53073] = 0.02*5, -- Worgen's Blood
[53087] = 0.02*5, -- Worgen's Blood
[53088] = 0.02*5, -- Worgen's Blood
[53089] = 0.02*5, -- Worgen's Blood
[53642] = 0.2*5, -- The Might of Mograine
[55549] = 0.1/2*5, -- Healing Winds
[55694] = 0.03*5, -- Enraged Regeneration
[57056] = 0.04/2*5, -- Aura of Regeneration
[58026] = 0.1/2*5, -- Blessing of the Crusade
[58361] = 0.25/2*5, -- The Might of Mograine
[60509] = 0.1*5, -- Strength of Wrynn
[60964] = 0.25*5, -- Strength of Wrynn
[61212] = 0.25*5, -- Warchief's Blessing
[61874] = 0.02*5, -- Food
[64660] = 0.3*5, -- First Aid Kit
[64670] = 0.25*5, -- Warchief's Blessing
[69634] = 0.05/2*5, -- Taste of Blood
[71068] = 0.04*5, -- Food
[71071] = 0.04*5, -- Food
[71073] = 0.04/5, -- Food
[71953] = 0.03/3*5, -- Radiance Aura
[74079] = 0.25*5, -- Elemental Blessing
[74503] = 0.25*5, -- Surgeon General's Warding
[75341] = 0.25*5, -- Elemental Blessing
[402913] = 0.04*5, -- Enraged Regeneration
[403619] = 0.02, -- Fel Armor
[413433] = 1.01/5*5, -- Degreelessness Mode
[413548] = 1.01, -- Degreelessness Mode
[437791] = 0.2*5, -- Ritual Leader
[449879] = 0.06*5, -- Dream Fog
[1226808] = 0.05*5, -- Food
[1231444] = 0.04/2*5, -- Eat Apple
},
PercentageMp5 = {
[12051] = ((not ECS.IsClassic) and 0.15/2*5 or nil), -- Evocation
[18792] = (ECS.IsClassic and 0.02/4 or 0.03/4)*5, -- Fel Energy
Expand Down Expand Up @@ -431,6 +588,10 @@ Data.Enchant = {
[3849] = 81, -- Titanium Plating
[7633] = 15, -- Presence of Valor
},
CombatHealthRegen = {
[2656] = 4, -- Enchant Boots - Vitality
[3244] = 7, -- Enchant Boots - Greater Vitality
},
Ids = {
BIZNICK_SCOPE = 2523, -- 3% Hit from Biznicks 247x128 Accurascope
},
Expand Down Expand Up @@ -802,3 +963,14 @@ Data.setNames = {
VESTMENTS_OF_TRANSCENDENCE = "Vestments of Transcendence",
WINDHAWK_ARMOR = "Windhawk Armor",
}
Data.SpiritToHP5Constants = {
[Data.DRUID] = {0.09, 6.5},
[Data.HUNTER] = {0.25, 6},
[Data.MAGE] = {0.10, 6},
[Data.PALADIN] = {0.25, 6},
[Data.PRIEST] = {0.10, 6},
[Data.ROGUE] = {0.50, 2},
[Data.SHAMAN] = {0.11, 7},
[Data.WARLOCK] = {0.07, 6},
[Data.WARRIOR] = {0.80, 6},
}
8 changes: 8 additions & 0 deletions Modules/Data/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ end

dataFunctionRefs = {
["MovementSpeed"] = function() return Data:GetMovementSpeed() end,
["HealthRegen"] = function()
local hp5, _ = Data:GetHP5()
return hp5
end,
["HealthRegenCombat"] = function()
local _, hp5 = Data:GetHP5()
return hp5
end,
-- Melee
["MeleeAttackPower"] = function() return Data:GetMeleeAttackPower() end,
["MeleeCritChance"] = function() return Data:MeleeCrit() end,
Expand Down
93 changes: 92 additions & 1 deletion Modules/Data/General.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
local GetBuffDataByIndex = C_UnitAuras.GetBuffDataByIndex
local GetDebuffDataByIndex = C_UnitAuras.GetDebuffDataByIndex
local GetInventoryItemLink = GetInventoryItemLink
local GetItemStats = GetItemStats
local GetUnitHealthRegenRateFromSpirit = GetUnitHealthRegenRateFromSpirit
local IsClassic = ECS.IsClassic
local IsSpellKnown = C_SpellBook.IsSpellKnown
local UnitHealthMax = UnitHealthMax
local UnitStat = UnitStat

---@class Data
local Data = ECSLoader:ImportModule("Data")
---@type DataUtils
local DataUtils = ECSLoader:ImportModule("DataUtils")

local _HP5 = {}
local _, _, classId = UnitClass("player")

---@return string
function Data:GetMovementSpeed()
Expand All @@ -20,4 +32,83 @@ function Data:GetMovementSpeed()

currentSpeed = currentSpeed / 7 * 100
return DataUtils:Round(currentSpeed, 0) .. "%"
end
end

---@return number, number
function Data:GetHP5()
local bonusHp5 = IsClassic and _HP5:GetHP5FromSpirit() or 5 * GetUnitHealthRegenRateFromSpirit("player")
local bonusCombatHp5 = 0
local mod = 1
local talentMod = _HP5:GetDemonicAegisTalentModifier() + 1
local combatModifier = 0
local maxhealth = UnitHealthMax("player")

if IsSpellKnown(20555) then -- Troll passive
mod = mod + 0.1
combatModifier = combatModifier + 0.1
end

for i = 1, 18 do
local itemLink = GetInventoryItemLink("player", i)
if itemLink then
local stats = GetItemStats(itemLink)
if stats then
local statHP5 = stats["ITEM_MOD_HEALTH_REGENERATION_SHORT"]
if statHP5 then
bonusHp5 = bonusHp5 + statHP5 + 1
end
end
local enchant = DataUtils:GetEnchantFromItemLink(itemLink)
if enchant then
bonusCombatHp5 = bonusCombatHp5 + (Data.Enchant.CombatHealthRegen[enchant] or 0)
end
end
end

local i = 1
repeat
local aura = GetBuffDataByIndex("player", i)
if aura and aura.spellId then
local DemonicAegis = (Data.Aura.IsFelOrDemonArmor[aura.spellId] and talentMod or 1)
if aura.spellId == 2645 and IsSpellKnown(59289) then
bonusHp5 = bonusHp5 + 0.01 * 5 * maxhealth -- Glyph of Ghost Wolf
end
mod = mod + (Data.Aura.HealthRegenModifier[aura.spellId] or 0)
bonusHp5 = bonusHp5 + (Data.Aura.HealthRegen[aura.spellId] or 0) * DemonicAegis
bonusHp5 = bonusHp5 + (Data.Aura.PercentageHealthRegen[aura.spellId] or 0) * maxhealth * DemonicAegis
end
i = i + 1
until (not aura)

i = 1
repeat
local aura = GetDebuffDataByIndex("player", i)
if aura and aura.spellId then
bonusHp5 = bonusHp5 + (Data.Aura.PercentageHealthRegen[aura.spellId] or 0) * maxhealth
mod = mod + (Data.Aura.HealthRegenModifier[aura.spellId] or 0)
end
i = i + 1
until (not aura)

local hp5 = bonusHp5 * mod
local combatHp5 = bonusCombatHp5 * mod + hp5 * combatModifier
return hp5, combatHp5
end

---@return number
function _HP5:GetHP5FromSpirit()
local c = Data.SpiritToHP5Constants[classId]
local spirit, _, _, _ = UnitStat("player", LE_UNIT_STAT_SPIRIT)
local hp5 = c[1] * spirit
if spirit >= 50 then
hp5 = hp5 + c[2]
else
hp5 = hp5 + c[2] * spirit / 50
end
return DataUtils:Round(hp5 * 5, 2)
end

---@return number
function _HP5:GetDemonicAegisTalentModifier()
return 0.1 * DataUtils:GetActiveTalentSpell({30143,30144,30145}) -- Demonic Aegis
end
2 changes: 1 addition & 1 deletion Modules/EventHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function EventHandler.HandleOnEvent(self,event, ...)
event == "UNIT_ATTACK_SPEED" or
event == "UNIT_AURA" or
event == "UNIT_DAMAGE" or
event == "UNIT_MAXHEALTH" or
(event == "UNIT_MAXPOWER" and args[2] == "MANA") or
event == "UNIT_SPELL_HASTE" or
event == "UNIT_STATS" or
Expand All @@ -70,7 +71,6 @@ function EventHandler.HandleOnEvent(self,event, ...)
statsFrame:SetScript("OnUpdate", DelayedUpdateInformation)
end
end

if (event == "INSPECT_READY" and args[1] == UnitGUID("player")) or event == "PLAYER_EQUIPMENT_CHANGED" then
DelayedUpdateGearColorFrames()
end
Expand Down
Loading
Loading