1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

Merge pull request #108 from Minoost/master

Offset eorzea time
This commit is contained in:
Mordred 2017-09-22 15:40:52 +02:00 committed by GitHub
commit d4a99fd45a
5 changed files with 33 additions and 6 deletions

View file

@ -116,6 +116,7 @@ namespace Packets {
WeatherChange = 0x01AF, // updated for sb
Discovery = 0x01B2, // updated for sb
EorzeaTimeOffset = 0x01B4,
CFAvailableContents = 0x01CF,

View file

@ -1281,6 +1281,11 @@ struct FFXIVIpcCFMemberStatus : FFXIVIpcBasePacket<CFMemberStatus>
uint32_t unknown3;
};
struct FFXIVIpcEorzeaTimeOffset : FFXIVIpcBasePacket<EorzeaTimeOffset>
{
uint64_t timestamp;
};
} /* Server */

View file

@ -1668,3 +1668,14 @@ void Core::Entity::Player::setOpeningSequence( uint8_t seq )
setSyncFlag( OpeningSeq );
m_openingSequence = seq;
}
/// Tells client to offset their eorzean time by given timestamp.
void Core::Entity::Player::setEorzeaTimeOffset( uint64_t timestamp )
{
// TODO: maybe change to persistent?
GamePacketNew< FFXIVIpcEorzeaTimeOffset, ServerZoneIpcType > packet ( getId() );
packet.data().timestamp = timestamp;
// Send to single player
queuePacket( packet );
}

View file

@ -499,6 +499,10 @@ public:
uint32_t getCFPenaltyMinutes() const;
void setCFPenaltyMinutes( uint32_t minutes );
void setEorzeaTimeOffset( uint64_t timestamp );
private:
uint32_t m_lastWrite;
uint32_t m_lastPing;

View file

@ -40,7 +40,6 @@ extern Core::ServerZone g_serverZone;
// instanciate and initialize commands
Core::DebugCommandHandler::DebugCommandHandler()
{
// Push all commands onto the register map ( command name - function - description - required GM level )
registerCommand( "set", &DebugCommandHandler::set, "Loads and injects a premade Packet.", 1 );
registerCommand( "get", &DebugCommandHandler::get, "Loads and injects a premade Packet.", 1 );
@ -186,8 +185,8 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
else if( ( subCommand == "unlockaetheryte" ) && ( params != "" ) )
{
for( uint8_t i = 0; i < 255; i++ )
pPlayer->registerAetheryte( i );
for( uint8_t i = 0; i < 255; i++ )
pPlayer->registerAetheryte( i );
}
else if( ( subCommand == "discovery" ) && ( params != "" ) )
@ -255,18 +254,25 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
else if( subCommand == "aaah" )
{
int32_t id;
sscanf( params.c_str(), "%d", &id );
pPlayer->sendDebug( std::to_string( pPlayer->actionHasCastTime( id ) ) );
}
else if ( subCommand == "cfpenalty" )
{
int32_t minutes;
sscanf( params.c_str(), "%d", &minutes );
pPlayer->setCFPenaltyMinutes( minutes );
}
else if ( subCommand == "eorzeatime" )
{
uint64_t timestamp;
sscanf( params.c_str(), "%llu", &timestamp );
pPlayer->setEorzeaTimeOffset( timestamp );
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) );
}
}