mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 22:37:45 +00:00
commit
b10b3029f3
14 changed files with 399 additions and 357 deletions
|
@ -11,7 +11,7 @@
|
|||
<LobbyHost>127.0.0.1</LobbyHost>
|
||||
<!-- IP of the frontier server -->
|
||||
<FrontierHost>127.0.0.1</FrontierHost>
|
||||
<!-- Secret used for server auth -->
|
||||
<!-- Secret used for server auth - you *must* change this for public servers -->
|
||||
<ServerSecret>default</ServerSecret>
|
||||
<!-- Web server port -->
|
||||
<HttpPort>80</HttpPort>
|
||||
|
@ -23,4 +23,9 @@
|
|||
<Database>sapphire</Database>
|
||||
</Mysql>
|
||||
</General>
|
||||
|
||||
<Parameters>
|
||||
<!-- GM Rank for newly created characters - should be changed to 0 for public servers -->
|
||||
<DefaultGMRank>255</DefaultGMRank>
|
||||
</Parameters>
|
||||
</Settings>
|
|
@ -69,6 +69,7 @@ CREATE TABLE IF NOT EXISTS `charadetail` (
|
|||
`PathId` int(10) DEFAULT NULL,
|
||||
`StepIndex` int(5) DEFAULT NULL,
|
||||
`ChocoboTaxiStandFlags` binary(8) DEFAULT NULL,
|
||||
`GMRank` int(3) DEFAULT '0',
|
||||
`unlocks` binary(64) DEFAULT NULL,
|
||||
`CharacterId` int(20) NOT NULL DEFAULT '0',
|
||||
`IS_DELETE` int(3) DEFAULT '0',
|
||||
|
|
|
@ -218,7 +218,7 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin
|
|||
|
||||
uint64_t lookupId = *reinterpret_cast< uint64_t* >( &packet.data[0] + 0x18 );
|
||||
|
||||
uint32_t logInCharId;
|
||||
uint32_t logInCharId = -1;
|
||||
std::string logInCharName;
|
||||
auto charList = g_restConnector.getCharList( ( char * )m_pSession->getSessionId() );
|
||||
for( uint32_t i = 0; i < charList.size(); i++ )
|
||||
|
@ -233,6 +233,8 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin
|
|||
}
|
||||
}
|
||||
|
||||
if( logInCharId == -1 )
|
||||
return;
|
||||
|
||||
g_log.info( "[" + std::to_string( m_pSession->getAccountID() ) + "] Logging in as " + logInCharName + "(" + std::to_string( logInCharId ) + ")" );
|
||||
|
||||
|
|
|
@ -270,6 +270,7 @@ namespace Core {
|
|||
" unlocks, "
|
||||
" QuestTracking, "
|
||||
" Aetheryte, "
|
||||
" GMRank, "
|
||||
" UPDATE_DATE ) "
|
||||
" VALUES (" + std::to_string( m_iD ) + ", "
|
||||
+ std::to_string( m_guardianDeity ) + ", "
|
||||
|
@ -283,7 +284,8 @@ namespace Core {
|
|||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questComplete, 200 ) ) + "'), "
|
||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)unlocks, 64 ) ) + "'), "
|
||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)questTracking, 10 ) ) + "'), "
|
||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)aetherytes, 12 ) ) + "'), NOW());" );
|
||||
+ "UNHEX('" + std::string( Util::binaryToHexString( (uint8_t*)aetherytes, 12 ) ) + "'),"
|
||||
+ std::to_string( m_gmRank ) + ", NOW());" );
|
||||
|
||||
|
||||
g_database.execute( "INSERT INTO characlass (CharacterId, Lv_" + std::to_string( g_exdData.m_classJobInfoMap[m_class].exp_idx ) + ", UPDATE_DATE ) "
|
||||
|
|
|
@ -140,6 +140,16 @@ namespace Core {
|
|||
m_tribe = tribe;
|
||||
}
|
||||
|
||||
uint8_t getGmRank()
|
||||
{
|
||||
return m_birthMonth;
|
||||
}
|
||||
|
||||
void setGmRank( uint8_t rank )
|
||||
{
|
||||
m_gmRank = rank;
|
||||
}
|
||||
|
||||
uint32_t m_modelEquip[10];
|
||||
|
||||
private:
|
||||
|
@ -162,6 +172,8 @@ namespace Core {
|
|||
std::map<uint8_t, uint16_t> m_classMap;
|
||||
uint8_t m_look[26];
|
||||
|
||||
uint8_t m_gmRank;
|
||||
|
||||
char m_name[34];
|
||||
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ bool Core::Network::SapphireAPI::createAccount( const std::string& username, con
|
|||
|
||||
}
|
||||
|
||||
int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std::string& name, const std::string& infoJson )
|
||||
int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std::string& name, const std::string& infoJson, const int& gmRank )
|
||||
{
|
||||
Core::PlayerMinimal newPlayer;
|
||||
|
||||
|
@ -166,6 +166,7 @@ int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std
|
|||
newPlayer.setBirthDay( tmpVector2.at( 3 ), tmpVector2.at( 2 ) );
|
||||
newPlayer.setClass( tmpVector2.at( 4 ) );
|
||||
newPlayer.setTribe( tmpVector2.at( 5 ) );
|
||||
newPlayer.setGmRank( gmRank );
|
||||
|
||||
newPlayer.saveAsNew();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Core
|
|||
|
||||
bool createAccount( const std::string& username, const std::string& pass, std::string& sId );
|
||||
|
||||
int32_t createCharacter( const int& accountId, const std::string& name, const std::string& infoJson );
|
||||
int32_t createCharacter( const int& accountId, const std::string& name, const std::string& infoJson, const int& gmRank );
|
||||
|
||||
void deleteCharacter( std::string name, uint32_t accountId );
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson );
|
||||
int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson, m_pConfig->getValue< uint8_t >( "Settings.Parameters.DefaultGMRank", 255 ) );
|
||||
|
||||
std::string json_string = "{\"result\":\"" + std::to_string( charId ) + "\"}";
|
||||
*response << "HTTP/1.1 200\r\nContent-Length: " << json_string.length() << "\r\n\r\n" << json_string;
|
||||
|
|
|
@ -110,6 +110,16 @@ uint16_t Core::Entity::Player::getZoneId() const
|
|||
return m_zoneId;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getGmRank() const
|
||||
{
|
||||
return m_gmRank;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setGmRank( uint8_t rank )
|
||||
{
|
||||
m_gmRank = rank;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getMode() const
|
||||
{
|
||||
return m_mode;
|
||||
|
@ -780,11 +790,6 @@ void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJ
|
|||
setSyncFlag( PlayerSyncFlags::ExpLevel );
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getUserLevel() const
|
||||
{
|
||||
return m_userLevel;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::eventActionStart( uint32_t eventId,
|
||||
uint32_t action,
|
||||
ActionCallback finishCallback,
|
||||
|
|
|
@ -478,6 +478,9 @@ public:
|
|||
|
||||
uint16_t getZoneId() const;
|
||||
|
||||
uint8_t getGmRank() const;
|
||||
void setGmRank( uint8_t rank );
|
||||
|
||||
uint8_t getMode() const;
|
||||
void setMode( uint8_t mode );
|
||||
|
||||
|
@ -589,7 +592,7 @@ private:
|
|||
boost::shared_ptr< Common::QuestActive > m_activeQuests[30];
|
||||
int16_t m_questTracking[5];
|
||||
uint8_t m_stateFlags[7];
|
||||
uint8_t m_userLevel;
|
||||
uint8_t m_gmRank;
|
||||
uint16_t zoneId;
|
||||
|
||||
bool m_bInCombat;
|
||||
|
|
|
@ -80,7 +80,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
|||
"cd.GrandCompany, "
|
||||
"cd.GrandCompanyRank, "
|
||||
"cd.CFPenaltyUntil, "
|
||||
"cd.OpeningSequence "
|
||||
"cd.OpeningSequence, "
|
||||
"cd.GMRank "
|
||||
"FROM charabase AS c "
|
||||
" INNER JOIN charadetail AS cd "
|
||||
" ON c.CharacterId = cd.CharacterId "
|
||||
|
@ -171,13 +172,13 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
|||
|
||||
m_openingSequence = field[36].getUInt32();
|
||||
|
||||
m_gmRank = field[37].getUInt8();
|
||||
|
||||
m_pCell = nullptr;
|
||||
|
||||
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
||||
g_log.error( "Player id " + char_id_str + " data corrupt!" );
|
||||
|
||||
m_userLevel = 1;
|
||||
|
||||
m_maxHp = getMaxHp();
|
||||
m_maxMp = getMaxMp();
|
||||
|
||||
|
|
|
@ -70,6 +70,12 @@ void Core::DebugCommandHandler::registerCommand( const std::string& n, Core::Deb
|
|||
void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr pPlayer )
|
||||
{
|
||||
|
||||
if( pPlayer->getGmRank() <= 0 )
|
||||
{
|
||||
pPlayer->sendUrgent( "You are not allowed to use debug commands." );
|
||||
return;
|
||||
}
|
||||
|
||||
// define callback pointer
|
||||
void ( DebugCommandHandler::*pf )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
|
||||
|
||||
|
|
|
@ -86,9 +86,11 @@ enum GmCommand
|
|||
Jump = 0x025E,
|
||||
JumpNpc = 0x025F,
|
||||
};
|
||||
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
{
|
||||
if( pPlayer->getGmRank() <= 0 )
|
||||
return;
|
||||
|
||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
uint32_t param1 = inPacket.getValAt< uint32_t >( 0x24 );
|
||||
uint32_t param2 = inPacket.getValAt< uint32_t >( 0x28 );
|
||||
|
@ -335,9 +337,11 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
{
|
||||
if( pPlayer->getGmRank() <= 0 )
|
||||
return;
|
||||
|
||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
std::string param1 = inPacket.getStringAt( 0x34 );
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Server {
|
|||
m_data.tPCurr = pPlayer->getTp();
|
||||
m_data.hPMax = pPlayer->getMaxHp();
|
||||
m_data.mPMax = pPlayer->getMaxMp();
|
||||
m_data.gmRank = 0xff;
|
||||
m_data.gmRank = pPlayer->getGmRank();
|
||||
//m_data.tPMax = 3000;
|
||||
m_data.level = pPlayer->getLevel();
|
||||
memcpy( m_data.look, pPlayer->getLookArray(), 26 );
|
||||
|
|
Loading…
Add table
Reference in a new issue