[Archive] Rest exp modifiers not affecting rest xp bar visuals?
[Archive] Rest exp modifiers not affecting rest xp bar visuals?
![[Image: OmunFlp.png]](https://i.imgur.com/OmunFlp.png)
Archived author: Kobiesan • Posted: 2019-01-16T05:23:02+00:00
Original source
I'm trying to recreate the Pandaren racial on 3.3.5a TrinityCore to give double rested experience and I made these edits to player.cpp but the rest bar is not increasing anymore than a normal character without the spell. I'm inclined to believe there's an interface limitation for rest exp growth on the bar. Can anyone help?
![[Image: OmunFlp.png]](https://i.imgur.com/OmunFlp.png)
Red indicates what I've changed
From Player::Update in player.cpp - https://pastebin.com/CE8pU0Ft
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING))
{
if (roll_chance_i(3) && _restTime > 0) // freeze update
{
time_t currTime = GameTime::GetGameTime();
time_t timeDiff = currTime - _restTime;
if (timeDiff >= 10) // freeze update
{
_restTime = currTime;
float bubble;
if (HasSpell(90168)) // If has Inner Peace give double rest exp.
{
bubble = 0.125f * sWorld->getRate(RATE_REST_INGAME) * 2;
}
else
{
bubble = 0.125f * sWorld->getRate(RATE_REST_INGAME);
}
float extraPerSec = ((float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 72000.0f) * bubble;
// speed collect rest bonus (section/in hour)
float currRestBonus = GetRestBonus();
SetRestBonus(currRestBonus + timeDiff * extraPerSec);
}
}
}
From Player::LoadFromDB in player.cpp - https://pastebin.com/Ac72z4b8
if (time_diff > 0)
{
//speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
float bubble0;
//speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
float bubble1;
// If has Inner Peace give double rest exp.
if (HasSpell(90168))
{
bubble0 = .062f;
bubble1 = .25f;
}
else
{
bubble0 = 0.031f;
bubble1 = 0.125f;
}
float bubble = fields[28].GetUInt8() > 0
? bubble1*sWorld->getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY)
: bubble0*sWorld->getRate(RATE_REST_OFFLINE_IN_WILDERNESS);
SetRestBonus(GetRestBonus() + time_diff*((float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 72000)*bubble);
}
From Player::GetXPRestBonus in player.cpp - https://pastebin.com/KC0KKKDC
uint32 Player::GetXPRestBonus(uint32 xp)
{
uint32 rested_bonus = (uint32)GetRestBonus(); // xp for each rested bonus
if (rested_bonus > xp) // max rested_bonus == xp or (r+x) = 200% xp
rested_bonus = xp;
SetRestBonus(GetRestBonus() - rested_bonus);
TC_LOG_DEBUG("entities.player", "Player::GetXPRestBonus: Player '%s' (%s) gain %u xp (+%u Rested Bonus). Rested points=%f", GetGUID().ToString().c_str(), GetName().c_str(), xp + rested_bonus, rested_bonus, GetRestBonus());
return HasSpell(90168) ? rested_bonus * 2 : rested_bonus;
}
Additionally, I've tried making direct edits to the bubble variable by removing the rate.rest variables from the equations and putting in exactly the rate that I want and still there is no difference between a player who has the spell and who doesn't.
Archived author: Roarl • Posted: 2019-01-18T23:22:58+00:00
Original source
Try HasAura instead of HasSpell ![]()
EDIT:
It is a passive and I never toyed with passives so I am not sure how they work... Well try it just in case. The only think I can promise you is that there is no interface limitation for xp rate : it's all server-side.
Quote: 19 hours ago, Roarl said:Unfortunately, that did not fix it.
Try HasAura instead of HasSpell
EDIT:
It is a passive and I never toyed with passives so I am not sure how they work... Well try it just in case. The only think I can promise you is that there is no interface limitation for xp rate : it's all server-side.
Archived author: Kobiesan • Posted: 2019-01-19T19:07:09+00:00
Original source
Quote: 19 hours ago, Roarl said:Unfortunately, that did not fix it.
Try HasAura instead of HasSpell
EDIT:
It is a passive and I never toyed with passives so I am not sure how they work... Well try it just in case. The only think I can promise you is that there is no interface limitation for xp rate : it's all server-side.
Archived author: Roarl • Posted: 2019-01-20T12:16:45+00:00
Original source
Could you also post your modification in spell.dbc ?
Quote: 5 hours ago, Roarl said:
Could you also post your modification in spell.dbc ?
![[Image: zIW6nES.png]](https://i.imgur.com/zIW6nES.png)
Archived author: Kobiesan • Posted: 2019-01-20T18:16:23+00:00
Original source
Quote: 5 hours ago, Roarl said:
Could you also post your modification in spell.dbc ?
![[Image: zIW6nES.png]](https://i.imgur.com/zIW6nES.png)
Archived author: wungasaurus • Posted: 2019-01-21T07:47:33+00:00
Original source
Have you tried to make sure it is the buff being the issue by changing the condition to something else, like your name or “true”? Are you sure that at the time of that calculation, auras are actually applied?
Archived author: Roarl • Posted: 2019-01-21T15:55:40+00:00
Original source
Maybe give the player the spell but don't script anything linked with it. Like if you are giving that buff to race = RACE_TAUREN, just check for race == RACE_TAUREN instead of HasAura... Maybe that's kind of hackish though I don't know... And if you want this to be some spell you can learn, then, yeah, it also defeats the purpose.
Quote: On 1/21/2019 at 8:55 AM, Roarl said:It's for a racial switcher so it needs to be available to all races.
Maybe give the player the spell but don't script anything linked with it. Like if you are giving that buff to race = RACE_TAUREN, just check for race == RACE_TAUREN instead of HasAura... Maybe that's kind of hackish though I don't know... And if you want this to be some spell you can learn, then, yeah, it also defeats the purpose.
Archived author: Kobiesan • Posted: 2019-01-23T05:35:12+00:00
Original source
Quote: On 1/21/2019 at 8:55 AM, Roarl said:It's for a racial switcher so it needs to be available to all races.
Maybe give the player the spell but don't script anything linked with it. Like if you are giving that buff to race = RACE_TAUREN, just check for race == RACE_TAUREN instead of HasAura... Maybe that's kind of hackish though I don't know... And if you want this to be some spell you can learn, then, yeah, it also defeats the purpose.
Quote: On 1/21/2019 at 8:47 AM, wungasaurus said:Did you try what he said ?
Have you tried to make sure it is the buff being the issue by changing the condition to something else, like your name or “true”? Are you sure that at the time of that calculation, auras are actually applied?
Archived author: Roarl • Posted: 2019-01-24T11:05:20+00:00
Original source
Quote: On 1/21/2019 at 8:47 AM, wungasaurus said:Did you try what he said ?
Have you tried to make sure it is the buff being the issue by changing the condition to something else, like your name or “true”? Are you sure that at the time of that calculation, auras are actually applied?