• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Spirit

Status
Not open for further replies.

yvoms

Exalted Member
Greetings emudevs,

I have a minor issue, i've set trinitycore to be able to make players level up to level 255,
However spirit is not calculating as it should.
The subeffect of the stat is kind of bugged,
As you would think it should increase more and more each level.
Instead it drops a bit each level

at level 1 its http://prntscr.com/8d3eo0

at level 50 its http://prntscr.com/8d3f3a

and at level 255 http://prntscr.com/8d3ej3


If anyone has any idea on how to fix this i would greatly appreciate it, im thinking it has something to do with the GT_MAX_LEVEL in DBCstructure am i correct?
I've tried setting it to 255, however it provided me with the same issue, so would i want to set it to something lower or higher, and is it even possible that that is the cause?
 

slp13at420

Mad Scientist
did you populate `player_levelstats` for up to level 255 in your world db sql?

ag3WASH.png


`spi` is for spirit.

by default its only populated for up to level 80.

fyi. I have tools in the donor hub for creating sql's for race/class stats from x level to x level.
 
Last edited:

yvoms

Exalted Member
yes, i have actually i made a procedure for those.
Code:
BEGIN
 
  DECLARE intMaxStats        INT   DEFAULT 2556541;   
  DECLARE sngStatsInc        FLOAT DEFAULT 0.00000000001;  
  DECLARE intStartLvl        INT   DEFAULT 80;    
  DECLARE intFinishLvl       INT   DEFAULT 255;  
 
  DECLARE intRecordDone      INT   DEFAULT 0;
  DECLARE intRace            INT   DEFAULT 0;
  DECLARE intClass           INT   DEFAULT 0;
  DECLARE intLevel           INT   DEFAULT 0;
  DECLARE intCurrSTR         INT   DEFAULT 0;
  DECLARE intCurrAGI         INT   DEFAULT 0;
  DECLARE intCurrSTA         INT   DEFAULT 0;
  DECLARE intCurrINT         INT   DEFAULT 0;
  DECLARE intCurrSPI         INT   DEFAULT 0;
 
  DECLARE curPlayerStat  CURSOR FOR SELECT `race`, `class`, `level`, `str`, `agi`, `sta`, `inte`, `spi` FROM player_levelstats;
  DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET intRecordDone = 1;

  OPEN curPlayerStat;
  REPEAT

    FETCH curPlayerStat INTO intRace, intClass, intLevel, intCurrSTR, intCurrAGI, intCurrSTA, intCurrINT, intCurrSPI;
    IF intLevel = intStartLvl THEN
       REPEAT
        SET intLevel = intLevel + 1;
         DELETE FROM player_levelstats WHERE `race` = intRace AND `class` = intClass AND `level` = intLevel;
 
         IF (ROUND(intCurrSTR * (1 + sngStatsInc) + 10)) <= intMaxStats THEN
           SET intCurrSTR = ROUND(intCurrSTR * (1 + sngStatsInc) + 10);
         ELSE
           SET intCurrSTR = intMaxStats;
         END IF;
         IF (ROUND(intCurrAGI * (1 + sngStatsInc) + 10)) <= intMaxStats THEN
           SET intCurrAGI = ROUND(intCurrAGI * (1 + sngStatsInc) + 10);
         ELSE
           SET intCurrAGI = intMaxStats;
         END IF;
         IF (ROUND(intCurrSTA * (1 + sngStatsInc) + 10)) <= intMaxStats THEN
           SET intCurrSTA = ROUND(intCurrSTA * (1 + sngStatsInc) + 10);
         ELSE
           SET intCurrSTA = intMaxStats;
         END IF;
         IF (ROUND(intCurrINT * (1 + sngStatsInc) + 10)) <= intMaxStats THEN
           SET intCurrINT = ROUND(intCurrINT * (1 + sngStatsInc) + 10);
         ELSE
           SET intCurrINT = intMaxStats;
         END IF;
         IF (ROUND(intCurrSPI * (1 + sngStatsInc) + 10)) <= intMaxStats THEN
           SET intCurrSPI = ROUND(intCurrSPI * (1 + sngStatsInc) + 10);
         ELSE
           SET intCurrSPI = intMaxStats;
         END IF;
 
         INSERT INTO player_levelstats
         (`race`, `class`, `level`, `str`, `agi`, `sta`, `inte`, `spi`)
         VALUES
         (intRace, intClass, intLevel, intCurrSTR, intCurrAGI, intCurrSTA, intCurrINT, intCurrSPI);
       UNTIL intLevel = intFinishLvl END REPEAT;
    END IF;
  UNTIL intRecordDone END REPEAT;
 
  CLOSE curPlayerStat;
 
END

Its populated, and i even updated all the stats to be 255. (For testing purposes)
tsGDh5o.png


I dont think thats the issue, it does give spirit, but the subeffect doesnt seem to work on levels beyond 180.
it go's from 1>80 working 80>100 using same subeffect value as 80, and 100>180 uses value of level 1>80.
at level 180+ it doesn't regen mana at all anymore its at 0 untill level 255
 
Last edited:

yvoms

Exalted Member
Does anyone know where the formula on calculation of sub effects for spirit is saved?
Maybe i can take a look at that ^^
 

Tommy

Founder
As you would think it should increase more and more each level.
Instead it drops a bit each level

Did you look at the screenshots? It is all the same stats from 1-255, mainly since all the stats in your player_levelstats table are all the same, which is wrong. If you look at the default player_levelstats table it scales low to high (1-80), what you are doing is high to high (1-255). If I'm not mistaken the stats going from level 81-255 should be much higher. However, is there not client limitations when dealing with such things? I know for a fact that you'd have to increase the uint types & types sizes (tinyint 0-255, smallint~, etc) when dealing with higher values than it supports via DB & code.

I'm not implying what I mentioned is a fix for spirit or whatever else is broken, just giving out facts.
 

yvoms

Exalted Member
[MENTION=1]Tommy[/MENTION] i did that on purpose, because i wanted to make sure it wasn't that that was causing it,
However, i'm not sure if its a client limitation, i don't think so to be honest, its just weard,
Starter gear and level 1 will regen 117k mana per seccond.
Starter gear and level 2 will regen 90k mana per seccond,
starter gear and level 20 will regen 9k mana per seccond.

Its really weard, im not sure how this is being calculated hehe.

I have checked the statsystem.cpp
Code:
void Player::UpdateManaRegen()
{
    float Intellect = GetStat(STAT_INTELLECT);
    // Mana regen from spirit and intellect
    float power_regen = std::sqrt(Intellect) * OCTRegenMPPerSpirit();
    // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
    power_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);

    // Mana regen from SPELL_AURA_MOD_POWER_REGEN aura
    float power_regen_mp5 = (GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) + m_baseManaRegen) / 5.0f;

    // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
    AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);
    for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
    {
        power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f;
    }

    // Set regen rate in cast state apply only on spirit based regen
    int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
    if (modManaRegenInterrupt > 100)
        modManaRegenInterrupt = 100;
    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));

    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
}
That looks okay doesn't it?

Edit :
i think i found the issue

Code:
float Player::OCTRegenMPPerSpirit()
{
    uint8 level = getLevel();
    uint32 pclass = getClass();

    if (level > GT_MAX_LEVEL)
        level = GT_MAX_LEVEL;

//    GtOCTRegenMPEntry     const* baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
    GtRegenMPPerSptEntry  const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
    if (moreRatio == NULL)
        return 0.0f;

    // Formula get from PaperDollFrame script
    float spirit    = GetStat(STAT_SPIRIT);
    float regen     = spirit * moreRatio->ratio;
    return regen;
}

My GT_MAX_LEVEL is set to 100, should i set it to 256?
 
Last edited:

Tommy

Founder
To be honest I'm not the person to give you advice on the stats. I have never messed with stats in TrinityCore, let alone deal with level 255 stats, etc.
 
Status
Not open for further replies.
Top