Kobiesan Posted January 16, 2019 Share Posted January 16, 2019 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? 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. Link to comment Share on other sites More sharing options...
Roarl Posted January 18, 2019 Share Posted January 18, 2019 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. Link to comment Share on other sites More sharing options...
Kobiesan Posted January 19, 2019 Author Share Posted January 19, 2019 19 hours ago, Roarl said: 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. Unfortunately, that did not fix it. Link to comment Share on other sites More sharing options...
Roarl Posted January 20, 2019 Share Posted January 20, 2019 Could you also post your modification in spell.dbc ? Link to comment Share on other sites More sharing options...
Kobiesan Posted January 20, 2019 Author Share Posted January 20, 2019 5 hours ago, Roarl said: Could you also post your modification in spell.dbc ? I just changed it into an aura (effect 6) so that HasAura would work. Link to comment Share on other sites More sharing options...
wungasaurus Posted January 21, 2019 Share Posted January 21, 2019 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? Link to comment Share on other sites More sharing options...
Roarl Posted January 21, 2019 Share Posted January 21, 2019 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. Link to comment Share on other sites More sharing options...
Kobiesan Posted January 23, 2019 Author Share Posted January 23, 2019 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. Link to comment Share on other sites More sharing options...
Roarl Posted January 24, 2019 Share Posted January 24, 2019 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 ? 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 ? Link to comment Share on other sites More sharing options...
Rest exp modifiers not affecting rest xp bar visuals?
By Kobiesanin Serverside
Recommended Posts