1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-23 05:07:46 +00:00

Removed old gainExp function in player

This commit is contained in:
Mordred 2025-01-02 09:55:21 +01:00
parent 78b800e36e
commit 8a3d8775fe
2 changed files with 0 additions and 41 deletions

View file

@ -553,44 +553,6 @@ bool Player::hasMount( uint32_t mountId ) const
return m_mountGuide[ index ] & value; return m_mountGuide[ index ] & value;
} }
void Player::gainExp( uint32_t amount )
{
uint32_t currentExp = getCurrentExp();
uint16_t level = getLevel();
auto currentClass = static_cast< uint8_t >( getClass() );
if( level >= Common::MAX_PLAYER_LEVEL )
{
setCurrentExp( 0 );
if( currentExp != 0 )
Network::Util::Packet::sendActorControlSelf( *this, getId(), UpdateUiExp, currentClass, 0 );
return;
}
auto& exdData = Common::Service< Data::ExdData >::ref();
uint32_t neededExpToLevel = exdData.getRow< Excel::ParamGrow >( level )->data().NextExp;
uint32_t neededExpToLevelPlus1 = exdData.getRow< Excel::ParamGrow >( level + 1 )->data().NextExp;
if( ( currentExp + amount ) >= neededExpToLevel )
{
// levelup
amount = ( currentExp + amount - neededExpToLevel ) > neededExpToLevelPlus1 ? neededExpToLevelPlus1 - 1 : ( currentExp + amount - neededExpToLevel );
if( level + 1 >= Common::MAX_PLAYER_LEVEL )
amount = 0;
setCurrentExp( amount );
levelUp();
}
else
setCurrentExp( currentExp + amount );
Network::Util::Packet::sendActorControlSelf( *this, getId(), GainExpMsg, currentClass, amount );
Network::Util::Packet::sendActorControlSelf( *this, getId(), UpdateUiExp, currentClass, getCurrentExp() );
}
void Player::levelUp() void Player::levelUp()
{ {
m_hp = getMaxHp(); m_hp = getMaxHp();

View file

@ -220,9 +220,6 @@ namespace Sapphire::Entity
/*! sets the exp of the currently active class / job */ /*! sets the exp of the currently active class / job */
void setCurrentExp( uint32_t amount ); void setCurrentExp( uint32_t amount );
/*! adds exp to the currently active class / job */
void gainExp( uint32_t amount );
/*! gain a level on the currently active class / job */ /*! gain a level on the currently active class / job */
void levelUp(); void levelUp();