Forums WoW Modding Discussion Serverside [Archive] Rest exp modifiers not affecting rest xp bar visuals?

[Archive] Rest exp modifiers not affecting rest xp bar visuals?

[Archive] Rest exp modifiers not affecting rest xp bar visuals?

rektbyfaith
Administrator
0
01-16-2019, 05:23 AM
#1
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]

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.
rektbyfaith
01-16-2019, 05:23 AM #1

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]

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.

rektbyfaith
Administrator
0
01-18-2019, 11:22 PM
#2
Archived author: Roarl • Posted: 2019-01-18T23:22:58+00:00
Original source

Try HasAura instead of HasSpell [Image: smile.png]

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.
rektbyfaith
01-18-2019, 11:22 PM #2

Archived author: Roarl • Posted: 2019-01-18T23:22:58+00:00
Original source

Try HasAura instead of HasSpell [Image: smile.png]

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.

rektbyfaith
Administrator
0
01-19-2019, 07:07 PM
#3
Archived author: Kobiesan • Posted: 2019-01-19T19:07:09+00:00
Original source

Quote: 19 hours ago, Roarl said:

Try HasAura instead of HasSpell [Image: smile.png]

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.
Unfortunately, that did not fix it.
rektbyfaith
01-19-2019, 07:07 PM #3

Archived author: Kobiesan • Posted: 2019-01-19T19:07:09+00:00
Original source

Quote: 19 hours ago, Roarl said:

Try HasAura instead of HasSpell [Image: smile.png]

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.
Unfortunately, that did not fix it.

rektbyfaith
Administrator
0
01-20-2019, 12:16 PM
#4
Archived author: Roarl • Posted: 2019-01-20T12:16:45+00:00
Original source

Could you also post your modification in spell.dbc ?
rektbyfaith
01-20-2019, 12:16 PM #4

Archived author: Roarl • Posted: 2019-01-20T12:16:45+00:00
Original source

Could you also post your modification in spell.dbc ?

rektbyfaith
Administrator
0
01-20-2019, 06:16 PM
#5
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]

I just changed it into an aura (effect 6) so that HasAura would work.
rektbyfaith
01-20-2019, 06:16 PM #5

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]

I just changed it into an aura (effect 6) so that HasAura would work.

rektbyfaith
Administrator
0
01-21-2019, 07:47 AM
#6
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?
rektbyfaith
01-21-2019, 07:47 AM #6

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?

rektbyfaith
Administrator
0
01-21-2019, 03:55 PM
#7
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.
rektbyfaith
01-21-2019, 03:55 PM #7

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.

rektbyfaith
Administrator
0
01-23-2019, 05:35 AM
#8
Archived author: Kobiesan • Posted: 2019-01-23T05:35:12+00:00
Original source

Quote: On 1/21/2019 at 8:55 AM, Roarl said:

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.
It's for a racial switcher so it needs to be available to all races.
rektbyfaith
01-23-2019, 05:35 AM #8

Archived author: Kobiesan • Posted: 2019-01-23T05:35:12+00:00
Original source

Quote: On 1/21/2019 at 8:55 AM, Roarl said:

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.
It's for a racial switcher so it needs to be available to all races.

rektbyfaith
Administrator
0
01-24-2019, 11:05 AM
#9
Archived author: Roarl • Posted: 2019-01-24T11:05:20+00:00
Original source

Quote: On 1/21/2019 at 8:47 AM, wungasaurus 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?
Did you try what he said ? [Image: smile.png] Like both forcing the check to true and outputting something in the error or debug log if the HasSpell (easiest one to check) condition is true ?
rektbyfaith
01-24-2019, 11:05 AM #9

Archived author: Roarl • Posted: 2019-01-24T11:05:20+00:00
Original source

Quote: On 1/21/2019 at 8:47 AM, wungasaurus 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?
Did you try what he said ? [Image: smile.png] Like both forcing the check to true and outputting something in the error or debug log if the HasSpell (easiest one to check) condition is true ?

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)