1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 06:47:45 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Adam 2017-08-09 23:14:46 +09:00
commit 6235c834aa
7 changed files with 50 additions and 5 deletions

9
.editorconfig Normal file
View file

@ -0,0 +1,9 @@
root = true
# find plugin for your editor here: http://editorconfig.org/#download
[*.{cpp,h,chai,inc}]
indent_style = space
indent_size = 3
end_of_line = lf
trim_trailing_whitespace = true
indent_brace_style = Allman

View file

@ -53,7 +53,7 @@ INSERT INTO `zonepositions` VALUES (1320086,148,158,-24,546,-3,2);
INSERT INTO `zonepositions` VALUES (1317630,153,-366,29,-241,0.8,2);
INSERT INTO `zonepositions` VALUES (1332303,152,-165,6,450,-1.4,2);
INSERT INTO `zonepositions` VALUES (1320082,153,275.5,11.1,-258.7,-0.8,2);
INSERT INTO `zonepositions` VALUES (1317533,132,105,6,9,-0.6,2);
INSERT INTO `zonepositions` VALUES (1317533,132,99.2226,4.78645,16.5797,-0.741859,2);
INSERT INTO `zonepositions` VALUES (1317542,154,452,-1,196,-1,2);
INSERT INTO `zonepositions` VALUES (1320072,133,-205,10,-96,1.6,2);
INSERT INTO `zonepositions` VALUES (1317633,154,14.8739,-55.3396,527.905,-2.44165,2);

View file

@ -243,6 +243,22 @@ void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer
pPlayer->resetDiscovery();
pPlayer->queuePacket( Network::Packets::Server::InitUIPacket( pPlayer ) );
}
else if( subCommand == "classjob" )
{
int32_t id;
sscanf( params.c_str(), "%d", &id );
g_log.debug( std::to_string( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) ) );
if( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) == 0 )
{
pPlayer->setLevelForClass( 1, static_cast<Core::Common::ClassJob> ( id ) );
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
}
else
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
}
}

View file

@ -642,6 +642,8 @@ void Core::Network::GameConnection::zoneLineHandler( Core::Network::Packets::Gam
{
uint32_t zoneLineId = pInPacket->getValAt< uint32_t >( 0x20 );
pPlayer->sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
auto pZone = pPlayer->getCurrentZone();
auto pLine = g_zoneMgr.getZonePosition( zoneLineId );
@ -652,7 +654,7 @@ void Core::Network::GameConnection::zoneLineHandler( Core::Network::Packets::Gam
if( pLine != nullptr )
{
g_log.debug( "ZoneLine " + std::to_string( zoneLineId ) + " found." );
pPlayer->sendDebug( "ZoneLine " + std::to_string( zoneLineId ) + " found." );
targetPos = pLine->getTargetPosition();
targetZone = pLine->getTargetZoneId();
rotation = pLine->getTargetRotation();
@ -667,7 +669,7 @@ void Core::Network::GameConnection::zoneLineHandler( Core::Network::Packets::Gam
else
{
// No zoneline found, revert to last zone
g_log.debug( "ZoneLine " + std::to_string( zoneLineId ) + " not found." );
pPlayer->sendUrgent( "ZoneLine " + std::to_string( zoneLineId ) + " not found." );
targetPos.x = 0;
targetPos.y = 0;
targetPos.z = 0;

View file

@ -700,6 +700,12 @@ uint8_t Core::Entity::Player::getLevel() const
return static_cast< uint8_t >( m_classArray[classJobIndex] );
}
uint8_t Core::Entity::Player::getLevelForClass( Core::Common::ClassJob pClass ) const
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( pClass )].exp_idx;
return static_cast< uint8_t >( m_classArray[classJobIndex] );
}
uint32_t Core::Entity::Player::getExp() const
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
@ -755,6 +761,14 @@ void Core::Entity::Player::setLevel( uint8_t level )
setSyncFlag( PlayerSyncFlags::ExpLevel );
}
void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJob classjob )
{
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( classjob )].exp_idx;
m_classArray[classJobIndex] = level;
setSyncFlag( PlayerSyncFlags::ExpLevel );
}
uint8_t Core::Entity::Player::getUserLevel() const
{
return m_userLevel;

View file

@ -231,6 +231,8 @@ public:
//////////////////////////////////////////////////////////////////////////////////////////////////////
/*! returns the level of the currently active class / job */
uint8_t getLevel() const override;
/*! returns the level of the provided class / job */
uint8_t getLevelForClass( Core::Common::ClassJob pClass ) const;
/*! returns the exp of the currently active class / job */
uint32_t getExp() const;
/*! sets the exp of the currently active class / job */
@ -241,6 +243,8 @@ public:
void gainLevel();
/*! set level on the currently active class / job to given level */
void setLevel( uint8_t level );
/*! set level on the provided class / job to given level */
void setLevelForClass( uint8_t level, Core::Common::ClassJob classjob );
/*! change class or job to given class / job */
void setClassJob( Core::Common::ClassJob classJob );
/*! returns a pointer to the class array */