CharacterStatsClassic (Character Stats Classic)

CharacterStatsClassic (Character Stats Classic)

8M Downloads

Mana Regeneration from Spirit

W4gs opened this issue ยท 0 comments

commented

This is Pseudo code pulled from my WeakAura and may require tweaking to work under your addon.
GetManaRegen() records inside/outside the 5 second rule

local playerClass, _, classID = UnitClass("player");
tblPlayerStats = { }
tblPlayerStats["ID"] = classID;
tblPlayerStats["Class"] = playerClass

There's Coefficients for mana regen for spirit:
tblClassRegen = { }
tblClassRegen[1] = {0, 0}; -- 1 Warrior
tblClassRegen[2] = {15, 5}; -- 2 Paladin
tblClassRegen[3] = {15, 5}; -- 3 Hunter
tblClassRegen[4] = {0, 0}; -- 4 Rogue
tblClassRegen[5] = {13,4}; -- 5 Priest
tblClassRegen[6] = {0, 0}; -- 6 ??
tblClassRegen[7] = {15, 5}; -- 7 Shaman
tblClassRegen[8] = {13, 4}; -- 8 Mage
tblClassRegen[9] = {8, 4}; -- 9 Warlock
tblClassRegen[10] = {0, 0}; -- 10 ??
tblClassRegen[11] = {0, 0}; -- 11 Druid

This is mana per tick (A tick is roughly 2.5 seconds)
tblPlayerStats["NotCasting"] = (tblClassRegen[tblPlayerStats["ID"]][1] + (UnitStat("player", 5) / tblClassRegen[tblPlayerStats["ID"]][2]));

Casting mp5 is then calculated from this specific number:
Mage Example:
for i=1,40 do
if (UnitBuff("player",i)) then
local buffName = select(1, UnitBuff("player",i))

    -- Mage: Mage Armor (Flat 30%)
    if (buffName == "Mage Armor") then

tblPlayerStats["Modifiers"] = tblPlayerStats["Modifiers"] + .30;
end
end
end

if (tblPlayerStats["Class"] == "Mage") then
-- Arcane Meditation 5/10/15%
tblPlayerStats["Modifiers"] = tblPlayerStats["Modifiers"] + ((select(5, GetTalentInfo(1, 12)) * 5) / 100);
end

tblPlayerStats["Casting"] = tblPlayerStats["NotCasting"] * tblPlayerStats["Modifiers"];

if (GetManaRegen() < 1) then
RetVal = "MPT: " .. tblColors["Red"] .. format("%.0f", tblPlayerStats["NotCasting"]) .. " (NC)|r " .. tblColors["Green"] .. format("%.0f", tblPlayerStats["Casting"]) .. " (C)|r";
else
RetVal = "MPT: " .. tblColors["Green"] .. format("%.0f", tblPlayerStats["NotCasting"]) .. " (NC)|r " .. tblColors["Red"] .. format("%.0f", tblPlayerStats["Casting"]) .. " (C)|r";
end

An example of this can be seen here: https://media.wago.io/screenshots/j4WOs4U4U/5e0aa74bd0b1d019c8dca11c.png
https://wago.io/j4WOs4U4U <- Weakaura I wrote for Regen code