From d4d8c3c1557702a89d3143c0d51218fd04077166 Mon Sep 17 00:00:00 2001 From: Toofy Date: Tue, 18 Apr 2023 16:42:25 +0100 Subject: [PATCH 1/3] Moving around level up logic to make gm level up command behave 'normally' --- src/world/Actor/Player.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index c667fe39..5d0115cf 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -642,11 +642,6 @@ void Player::levelUp() m_mp = getMaxMp(); setLevel( getLevel() + 1 ); - Network::Util::Packet::sendActorControl( getInRangePlayerIds( true ), getId(), LevelUpEffect, static_cast< uint8_t >( getClass() ), getLevel(), getLevel() - 1 ); - - auto& achvMgr = Common::Service< World::Manager::AchievementMgr >::ref(); - achvMgr.progressAchievementByType< Common::Achievement::Type::Classjob >( *this, static_cast< uint32_t >( getClass() ) ); - Service< World::Manager::MapMgr >::ref().updateQuests( *this ); } uint8_t Player::getLevel() const @@ -733,6 +728,11 @@ void Player::setLevel( uint8_t level ) Network::Util::Packet::sendBaseParams( *this ); Network::Util::Packet::sendHudParam( *this ); Network::Util::Packet::sendStatusUpdate( *this ); + Network::Util::Packet::sendActorControl( getInRangePlayerIds( true ), getId(), LevelUpEffect, static_cast< uint8_t >( getClass() ), getLevel(), getLevel() - 1 ); + + auto& achvMgr = Common::Service< World::Manager::AchievementMgr >::ref(); + achvMgr.progressAchievementByType< Common::Achievement::Type::Classjob >( *this, static_cast< uint32_t >( getClass() ) ); + Service< World::Manager::MapMgr >::ref().updateQuests( *this ); } void Player::setLevelForClass( uint8_t level, Common::ClassJob classjob ) From f0e1990cbd0cf700959de52a707b1270e5dbd79c Mon Sep 17 00:00:00 2001 From: Toofy Date: Tue, 18 Apr 2023 17:33:29 +0100 Subject: [PATCH 2/3] Some bug fixes --- src/world/Territory/Territory.cpp | 1 + src/world/WorldServer.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/world/Territory/Territory.cpp b/src/world/Territory/Territory.cpp index de4a5c4f..1948a207 100644 --- a/src/world/Territory/Territory.cpp +++ b/src/world/Territory/Territory.cpp @@ -836,6 +836,7 @@ Entity::BNpcPtr Territory::createBNpcFromLayoutId( uint32_t layoutId, uint32_t h return nullptr; auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(), infoPtr->second, *this, hp, bnpcType ); + pBNpc->init(); pBNpc->setTriggerOwnerId( triggerOwnerId ); pushActor( pBNpc ); return pBNpc; diff --git a/src/world/WorldServer.cpp b/src/world/WorldServer.cpp index 4748e1e9..8c888209 100644 --- a/src/world/WorldServer.cpp +++ b/src/world/WorldServer.cpp @@ -144,6 +144,11 @@ std::string readFileToString( const std::string& filename ) // Close the file file.close(); + // Remove all newlines from the file contents + fileContents.erase(std::remove(fileContents.begin(), fileContents.end(), '\n'), fileContents.end()); + fileContents.erase(std::remove(fileContents.begin(), fileContents.end(), '\r'), fileContents.end()); + + // Return the file contents as a string return fileContents; } From b3e86d38775d70f89b746dc9cc369d1cd614296b Mon Sep 17 00:00:00 2001 From: Toofy Date: Sun, 23 Apr 2023 16:42:24 +0100 Subject: [PATCH 3/3] Formatting --- src/world/WorldServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/world/WorldServer.cpp b/src/world/WorldServer.cpp index 8c888209..c89cf550 100644 --- a/src/world/WorldServer.cpp +++ b/src/world/WorldServer.cpp @@ -145,8 +145,8 @@ std::string readFileToString( const std::string& filename ) file.close(); // Remove all newlines from the file contents - fileContents.erase(std::remove(fileContents.begin(), fileContents.end(), '\n'), fileContents.end()); - fileContents.erase(std::remove(fileContents.begin(), fileContents.end(), '\r'), fileContents.end()); + fileContents.erase( std::remove( fileContents.begin(), fileContents.end(), '\n' ), fileContents.end() ); + fileContents.erase( std::remove( fileContents.begin(), fileContents.end(), '\r' ), fileContents.end() ); // Return the file contents as a string