Log in

View Full Version : Character:RestRegenTimeToActivate not working


Lighted Shadows
11-09-2013, 10:35 AM
I been trying to get Character:RestRegenTimeToActivate to work

I set
Character:RestRegenPercent 10
Character:RestRegenTimeToActivate=30

When a player sits they do regen 10% every tick but no matter what I set Character:RestRegenTimeToActivate to they start to regen as soon as they sit down.

Now I did test this out of combat by casting a few spells on myself and then sitting down. I noticed a hate check in the code. Is this a case that regen time does not work unless the player is on a hate list?

Kingly_Krab
11-09-2013, 12:29 PM
Here's the code for the regen in the source. Rest Regen occurs when they're out of combat for XX seconds, the Regen Percent occurs when they sit down. This is in client_process.cpp.

void Client::CalcRestState() {

// This method calculates rest state HP and mana regeneration.
// The client must have been out of combat for RuleI(Character, RestRegenTimeToActivate) seconds,
// must be sitting down, and must not have any detrimental spells affecting them.
//
if(!RuleI(Character, RestRegenPercent))
return;

RestRegenHP = RestRegenMana = RestRegenEndurance = 0;

if(AggroCount || !IsSitting())
return;

if(!rest_timer.Check(false))
return;

uint32 buff_count = GetMaxTotalSlots();
for (unsigned int j = 0; j < buff_count; j++) {
if(buffs[j].spellid != SPELL_UNKNOWN) {
if(IsDetrimentalSpell(buffs[j].spellid) && (buffs[j].ticsremaining > 0))
if(!DetrimentalSpellAllowsRest(buffs[j].spellid))
return;
}
}

RestRegenHP = (GetMaxHP() * RuleI(Character, RestRegenPercent) / 100);

RestRegenMana = (GetMaxMana() * RuleI(Character, RestRegenPercent) / 100);

if(RuleB(Character, RestRegenEndurance))
RestRegenEndurance = (GetMaxEndurance() * RuleI(Character, RestRegenPercent) / 100);
}

Lighted Shadows
11-09-2013, 03:26 PM
So
// The client must have been out of combat for RuleI(Character, RestRegenTimeToActivate) seconds,

I am OK with that I understand now. I was testing it by casting speels on myself sitting in a safe spot and then sitting down. Seams to work as coded when in combat.

I am not too concerned about it kicking in if the player has been out of combat for some time. I was just concerned about players sitting in the middle of a fight to get mana regen when OOM. Seams to work fine when in combat.

Off now to try and correct the jumping Mana/HP bar that goes up 23,24,25,26
then down back to 24 and starting to regen again. Been reading about it here and there just have not found a fix really that is not dateed.