mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-10 12:47:44 +00:00
Greatly reduced usage of smart pointers to remove overhead from needlesly increasing reference count all the time
This commit is contained in:
parent
86fd30b4e1
commit
4981003789
26 changed files with 601 additions and 610 deletions
|
@ -76,7 +76,7 @@ void Core::Action::ActionCast::onFinish()
|
|||
0x219, m_id, m_id, m_id, m_id );
|
||||
m_pSource->sendToInRangeSet( control, true );*/
|
||||
|
||||
g_scriptMgr.onCastFinish( pPlayer, m_pTarget, m_id );
|
||||
g_scriptMgr.onCastFinish( *pPlayer, m_pTarget, m_id );
|
||||
}
|
||||
|
||||
void Core::Action::ActionCast::onInterrupt()
|
||||
|
|
|
@ -234,7 +234,7 @@ void Core::Entity::BattleNpc::setOwner( Core::Entity::PlayerPtr pPlayer )
|
|||
|
||||
void Core::Entity::BattleNpc::sendPositionUpdate()
|
||||
{
|
||||
MoveActorPacket movePacket( shared_from_this(), 0x3A, 0x00, 0, 0x5A );
|
||||
MoveActorPacket movePacket( *this, 0x3A, 0x00, 0, 0x5A );
|
||||
sendToInRangeSet( movePacket );
|
||||
}
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
|
|||
}
|
||||
queuePacket( contentFinderList );
|
||||
|
||||
Server::InitUIPacket initUIPacket( pPlayer );
|
||||
Server::InitUIPacket initUIPacket( *pPlayer );
|
||||
queuePacket( initUIPacket );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcPlayerClassInfo > classInfoPacket( getId() );
|
||||
|
@ -707,7 +707,7 @@ void Core::Entity::Player::gainLevel()
|
|||
|
||||
void Core::Entity::Player::unlock()
|
||||
{
|
||||
queuePacket( PlayerStateFlagsPacket( getAsPlayer(), PlayerStateFlagList{} ) );
|
||||
queuePacket( PlayerStateFlagsPacket( *getAsPlayer(), PlayerStateFlagList{} ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::sendStatusUpdate( bool toSelf )
|
||||
|
@ -809,7 +809,7 @@ void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJ
|
|||
|
||||
void Core::Entity::Player::sendModel()
|
||||
{
|
||||
ModelEquipPacket modelEquip( getAsPlayer() );
|
||||
ModelEquipPacket modelEquip( *getAsPlayer() );
|
||||
sendToInRangeSet( modelEquip, true );
|
||||
}
|
||||
|
||||
|
@ -877,7 +877,7 @@ void Core::Entity::Player::spawn( Core::Entity::PlayerPtr pTarget )
|
|||
getName() + " for " +
|
||||
pTarget->getName() );
|
||||
|
||||
PlayerSpawnPacket spawnActor( getAsPlayer(), pTarget );
|
||||
PlayerSpawnPacket spawnActor( *getAsPlayer(), *pTarget );
|
||||
pTarget->queuePacket( spawnActor );
|
||||
}
|
||||
|
||||
|
@ -996,7 +996,7 @@ void Core::Entity::Player::setStateFlags( std::vector< Common::PlayerStateFlag >
|
|||
|
||||
void Core::Entity::Player::sendStateFlags()
|
||||
{
|
||||
queuePacket( PlayerStateFlagsPacket( getAsPlayer() ) );
|
||||
queuePacket( PlayerStateFlagsPacket( *getAsPlayer() ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::unsetStateFlag( Core::Common::PlayerStateFlag flag )
|
||||
|
@ -1099,7 +1099,7 @@ void Core::Entity::Player::update( int64_t currTime )
|
|||
|
||||
void Core::Entity::Player::onMobKill( uint16_t nameId )
|
||||
{
|
||||
g_scriptMgr.onMobKill( getAsPlayer(), nameId );
|
||||
g_scriptMgr.onMobKill( *getAsPlayer(), nameId );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::freePlayerSpawnId( uint32_t actorId )
|
||||
|
@ -1300,12 +1300,12 @@ void Core::Entity::Player::sendNotice( const std::string& message ) //Purple Tex
|
|||
|
||||
void Core::Entity::Player::sendUrgent( const std::string& message ) //Red Text
|
||||
{
|
||||
queuePacket( ChatPacket( getAsPlayer(), ChatType::ServerUrgent, message ) );
|
||||
queuePacket( ChatPacket( *getAsPlayer(), ChatType::ServerUrgent, message ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::sendDebug( const std::string& message ) //Grey Text
|
||||
{
|
||||
queuePacket( ChatPacket( getAsPlayer(), ChatType::ServerDebug, message ) );
|
||||
queuePacket( ChatPacket( *getAsPlayer(), ChatType::ServerDebug, message ) );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
|
||||
|
|
|
@ -10,14 +10,11 @@ namespace Core {
|
|||
|
||||
class DebugCommandHandler;
|
||||
|
||||
// CGameCommand is used to define in game text command callbacks
|
||||
// TODO it should probably be renamed to something more intuitive
|
||||
// TODO the command identifier, currently '@' should probably be defined in here aswell so it is easily replaced
|
||||
class DebugCommand
|
||||
{
|
||||
public:
|
||||
|
||||
using pFunc = void ( DebugCommandHandler::* )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
|
||||
using pFunc = void ( DebugCommandHandler::* )( char *, Entity::Player&, boost::shared_ptr< DebugCommand > );
|
||||
|
||||
// String for the command
|
||||
std::string m_commandName;
|
||||
|
|
|
@ -66,15 +66,15 @@ Core::DebugCommandHandler::~DebugCommandHandler()
|
|||
void Core::DebugCommandHandler::registerCommand( const std::string& n, Core::DebugCommand::pFunc functionPtr,
|
||||
const std::string& hText, uint8_t uLevel )
|
||||
{
|
||||
m_commandMap[std::string( n )] = boost::make_shared<DebugCommand>( n, functionPtr, hText, uLevel );
|
||||
m_commandMap[std::string( n )] = boost::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
|
||||
}
|
||||
|
||||
// try to retrieve the command in question, execute if found
|
||||
void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr pPlayer )
|
||||
void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::Player& player )
|
||||
{
|
||||
|
||||
// define callback pointer
|
||||
void ( DebugCommandHandler::*pf )( char *, Entity::PlayerPtr, boost::shared_ptr< DebugCommand > );
|
||||
void ( DebugCommandHandler::*pf )( char *, Entity::Player&, boost::shared_ptr< DebugCommand > );
|
||||
|
||||
std::string commandString;
|
||||
|
||||
|
@ -94,18 +94,18 @@ void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPt
|
|||
|
||||
if( it == m_commandMap.end() )
|
||||
// no command found, do something... or not
|
||||
pPlayer->sendUrgent( "Command not found." );
|
||||
player.sendUrgent( "Command not found." );
|
||||
else
|
||||
{
|
||||
if( pPlayer->getGmRank() < it->second->getRequiredGmLevel() )
|
||||
if( player.getGmRank() < it->second->getRequiredGmLevel() )
|
||||
{
|
||||
pPlayer->sendUrgent( "You are not allowed to use this command." );
|
||||
player.sendUrgent( "You are not allowed to use this command." );
|
||||
return;
|
||||
}
|
||||
|
||||
// command found, call the callback function and pass parameters if present.
|
||||
pf = ( *it ).second->m_pFunc;
|
||||
( this->*pf )( data, pPlayer, ( *it ).second );
|
||||
( this->*pf )( data, player, ( *it ).second );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,26 +117,26 @@ void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPt
|
|||
// Definition of the commands
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::PlayerPtr pPlayer,
|
||||
void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::Player& player,
|
||||
boost::shared_ptr<Core::DebugCommand> command )
|
||||
{
|
||||
g_scriptMgr.reload();
|
||||
pPlayer->sendDebug( "Scripts reloaded." );
|
||||
player.sendDebug( "Scripts reloaded." );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
pPlayer->sendDebug( "Registered debug commands:" );
|
||||
player.sendDebug( "Registered debug commands:" );
|
||||
for ( auto cmd : m_commandMap )
|
||||
{
|
||||
if ( pPlayer->getGmRank( ) >= cmd.second->m_gmLevel )
|
||||
if ( player.getGmRank( ) >= cmd.second->m_gmLevel )
|
||||
{
|
||||
pPlayer->sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText( ) );
|
||||
player.sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText( ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
|
||||
void Core::DebugCommandHandler::set( char * data, Core::Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
std::string subCommand = "";
|
||||
std::string params = "";
|
||||
|
@ -156,7 +156,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
|
||||
g_log.debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
|
@ -170,25 +170,25 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
if( ( posX == 0xcccccccc ) || ( posY == 0xcccccccc ) || ( posZ == 0xcccccccc ) )
|
||||
{
|
||||
pPlayer->sendUrgent( "Syntaxerror." );
|
||||
player.sendUrgent( "Syntaxerror." );
|
||||
return;
|
||||
}
|
||||
|
||||
if( subCommand == "pos" )
|
||||
pPlayer->setPosition( static_cast< float >( posX ),
|
||||
player.setPosition( static_cast< float >( posX ),
|
||||
static_cast< float >( posY ),
|
||||
static_cast< float >( posZ ) );
|
||||
else
|
||||
pPlayer->setPosition( pPlayer->getPos().x + static_cast< float >( posX ),
|
||||
pPlayer->getPos().y + static_cast< float >( posY ),
|
||||
pPlayer->getPos().z + static_cast< float >( posZ ) );
|
||||
player.setPosition( player.getPos().x + static_cast< float >( posX ),
|
||||
player.getPos().y + static_cast< float >( posY ),
|
||||
player.getPos().z + static_cast< float >( posZ ) );
|
||||
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
|
||||
setActorPosPacket( pPlayer->getId() );
|
||||
setActorPosPacket.data().x = pPlayer->getPos().x;
|
||||
setActorPosPacket.data().y = pPlayer->getPos().y;
|
||||
setActorPosPacket.data().z = pPlayer->getPos().z;
|
||||
pPlayer->queuePacket( setActorPosPacket );
|
||||
setActorPosPacket( player.getId() );
|
||||
setActorPosPacket.data().x = player.getPos().x;
|
||||
setActorPosPacket.data().y = player.getPos().y;
|
||||
setActorPosPacket.data().z = player.getPos().z;
|
||||
player.queuePacket( setActorPosPacket );
|
||||
|
||||
}
|
||||
else if( ( subCommand == "tele" ) && ( params != "" ) )
|
||||
|
@ -196,7 +196,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
int32_t aetheryteId;
|
||||
sscanf( params.c_str(), "%i", &aetheryteId );
|
||||
|
||||
pPlayer->teleport( aetheryteId );
|
||||
player.teleport( aetheryteId );
|
||||
}
|
||||
else if( ( subCommand == "discovery" ) && ( params != "" ) )
|
||||
{
|
||||
|
@ -204,10 +204,10 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
int32_t discover_id;
|
||||
sscanf( params.c_str(), "%i %i", &map_id, &discover_id );
|
||||
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcDiscovery > discoveryPacket( pPlayer->getId() );
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcDiscovery > discoveryPacket( player.getId() );
|
||||
discoveryPacket.data().map_id = map_id;
|
||||
discoveryPacket.data().map_part_id = discover_id;
|
||||
pPlayer->queuePacket( discoveryPacket );
|
||||
player.queuePacket( discoveryPacket );
|
||||
}
|
||||
|
||||
else if( ( subCommand == "discovery_pos" ) && ( params != "" ) )
|
||||
|
@ -231,8 +231,8 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
else if( subCommand == "discovery_reset" )
|
||||
{
|
||||
pPlayer->resetDiscovery();
|
||||
pPlayer->queuePacket( Network::Packets::Server::InitUIPacket( pPlayer ) );
|
||||
player.resetDiscovery();
|
||||
player.queuePacket( Network::Packets::Server::InitUIPacket( player ) );
|
||||
}
|
||||
else if( subCommand == "classjob" )
|
||||
{
|
||||
|
@ -240,28 +240,28 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%d", &id );
|
||||
|
||||
if( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) == 0 )
|
||||
if( player.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 ) );
|
||||
player.setLevelForClass( 1, static_cast<Core::Common::ClassJob> ( id ) );
|
||||
player.setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
|
||||
}
|
||||
else
|
||||
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
|
||||
player.setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
|
||||
}
|
||||
else if ( subCommand == "cfpenalty" )
|
||||
{
|
||||
int32_t minutes;
|
||||
sscanf( params.c_str(), "%d", &minutes );
|
||||
|
||||
pPlayer->setCFPenaltyMinutes( minutes );
|
||||
player.setCFPenaltyMinutes( minutes );
|
||||
}
|
||||
else if ( subCommand == "eorzeatime" )
|
||||
{
|
||||
uint64_t timestamp;
|
||||
sscanf( params.c_str(), "%" SCNu64, ×tamp );
|
||||
|
||||
pPlayer->setEorzeaTimeOffset( timestamp );
|
||||
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) );
|
||||
player.setEorzeaTimeOffset( timestamp );
|
||||
player.sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) );
|
||||
}
|
||||
else if ( subCommand == "model" )
|
||||
{
|
||||
|
@ -269,26 +269,26 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
uint32_t val;
|
||||
sscanf( params.c_str(), "%d %d", &slot, &val );
|
||||
|
||||
pPlayer->setModelForSlot( static_cast<Inventory::EquipSlot>( slot ), val );
|
||||
pPlayer->sendModel();
|
||||
pPlayer->sendDebug( "Model updated" );
|
||||
player.setModelForSlot( static_cast<Inventory::EquipSlot>( slot ), val );
|
||||
player.sendModel();
|
||||
player.sendDebug( "Model updated" );
|
||||
}
|
||||
else if ( subCommand == "mount" )
|
||||
{
|
||||
int32_t id;
|
||||
sscanf( params.c_str(), "%d", &id );
|
||||
|
||||
pPlayer->dismount();
|
||||
pPlayer->mount( id );
|
||||
player.dismount();
|
||||
player.mount( id );
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( subCommand + " is not a valid SET command." );
|
||||
player.sendUrgent( subCommand + " is not a valid SET command." );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
|
||||
void Core::DebugCommandHandler::add( char * data, Core::Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
std::string subCommand;
|
||||
std::string params = "";
|
||||
|
@ -311,7 +311,7 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
|
||||
g_log.debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
|
@ -323,18 +323,18 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%d %d %hu", &id, &duration, ¶m );
|
||||
|
||||
StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, pPlayer, pPlayer, duration, 3000 ) );
|
||||
StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, player.getAsPlayer(), player.getAsPlayer(), duration, 3000 ) );
|
||||
effect->setParam( param );
|
||||
|
||||
pPlayer->addStatusEffect( effect );
|
||||
player.addStatusEffect( effect );
|
||||
}
|
||||
else if ( subCommand == "title" )
|
||||
{
|
||||
uint32_t titleId;
|
||||
sscanf( params.c_str(), "%u", &titleId );
|
||||
|
||||
pPlayer->addTitle( titleId );
|
||||
pPlayer->sendNotice( "Added title (ID: " + std::to_string( titleId ) + ")" );
|
||||
player.addTitle( titleId );
|
||||
player.sendNotice( "Added title (ID: " + std::to_string( titleId ) + ")" );
|
||||
}
|
||||
else if( subCommand == "spawn" )
|
||||
{
|
||||
|
@ -342,9 +342,9 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%d %d", &model, &name );
|
||||
|
||||
Entity::BattleNpcPtr pBNpc( new Entity::BattleNpc( model, name, pPlayer->getPos() ) );
|
||||
Entity::BattleNpcPtr pBNpc( new Entity::BattleNpc( model, name, player.getPos() ) );
|
||||
|
||||
auto pZone = pPlayer->getCurrentZone();
|
||||
auto pZone = player.getCurrentZone();
|
||||
pBNpc->setCurrentZone( pZone );
|
||||
pZone->pushActor( pBNpc );
|
||||
|
||||
|
@ -354,8 +354,8 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
// temporary research packet
|
||||
int32_t opcode;
|
||||
sscanf( params.c_str(), "%x", &opcode );
|
||||
Network::Packets::GamePacketPtr pPe( new Network::Packets::GamePacket( opcode, 0x30, pPlayer->getId(), pPlayer->getId() ) );
|
||||
pPlayer->queuePacket( pPe );
|
||||
Network::Packets::GamePacketPtr pPe( new Network::Packets::GamePacket( opcode, 0x30, player.getId(), player.getId() ) );
|
||||
player.queuePacket( pPe );
|
||||
}
|
||||
else if( subCommand == "actrl" )
|
||||
{
|
||||
|
@ -373,9 +373,9 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
|
||||
sscanf( params.c_str(), "%x %x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId );
|
||||
|
||||
pPlayer->sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||
player.sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, pPlayer->getId() );
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, player.getId() );
|
||||
actorControl.data().category = opcode;
|
||||
actorControl.data().param1 = param1;
|
||||
actorControl.data().param2 = param2;
|
||||
|
@ -383,29 +383,29 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
actorControl.data().param4 = param4;
|
||||
actorControl.data().param5 = param5;
|
||||
actorControl.data().param6 = param6;
|
||||
pPlayer->queuePacket( actorControl );
|
||||
player.queuePacket( actorControl );
|
||||
|
||||
|
||||
/*sscanf(params.c_str(), "%x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId);
|
||||
|
||||
Network::Packets::Server::ServerNoticePacket noticePacket(pPlayer, "Injecting ACTOR_CONTROL " + std::to_string(opcode));
|
||||
Network::Packets::Server::ServerNoticePacket noticePacket( player, "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||
|
||||
pPlayer->queuePacket(noticePacket);
|
||||
player.queuePacket(noticePacket);
|
||||
|
||||
Network::Packets::Server::ActorControlPacket143 controlPacket(pPlayer, opcode,
|
||||
param1, param2, param3, param4, param5, param6, playerId);
|
||||
pPlayer->queuePacket(controlPacket);*/
|
||||
Network::Packets::Server::ActorControlPacket143 controlPacket( player, opcode,
|
||||
param1, param2, param3, param4, param5, param6, playerId );
|
||||
player.queuePacket( controlPacket );*/
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( subCommand + " is not a valid ADD command." );
|
||||
player.sendUrgent( subCommand + " is not a valid ADD command." );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
|
||||
void Core::DebugCommandHandler::get( char * data, Core::Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
std::string subCommand;
|
||||
std::string params = "";
|
||||
|
@ -425,45 +425,45 @@ void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlaye
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
|
||||
g_log.debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
if( ( subCommand == "pos" ) )
|
||||
{
|
||||
|
||||
int16_t map_id = g_exdData.m_zoneInfoMap[pPlayer->getCurrentZone()->getId()].map_id;
|
||||
int16_t map_id = g_exdData.m_zoneInfoMap[player.getCurrentZone()->getId()].map_id;
|
||||
|
||||
pPlayer->sendNotice( "Pos:\n" +
|
||||
std::to_string( pPlayer->getPos().x ) + "\n" +
|
||||
std::to_string( pPlayer->getPos().y ) + "\n" +
|
||||
std::to_string( pPlayer->getPos().z ) + "\n" +
|
||||
std::to_string( pPlayer->getRotation() ) + "\nMapId: " +
|
||||
player.sendNotice( "Pos:\n" +
|
||||
std::to_string( player.getPos().x ) + "\n" +
|
||||
std::to_string( player.getPos().y ) + "\n" +
|
||||
std::to_string( player.getPos().z ) + "\n" +
|
||||
std::to_string( player.getRotation() ) + "\nMapId: " +
|
||||
std::to_string( map_id ) + "\nZoneID: " +
|
||||
std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" );
|
||||
std::to_string( player.getCurrentZone()->getId() ) + "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( subCommand + " is not a valid GET command." );
|
||||
player.sendUrgent( subCommand + " is not a valid GET command." );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::injectPacket( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::injectPacket( char * data, Core::Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( pPlayer->getId() );
|
||||
auto pSession = g_serverZone.getSession( player.getId() );
|
||||
if( pSession )
|
||||
pSession->getZoneConnection()->injectPacket( data + 7, pPlayer );
|
||||
pSession->getZoneConnection()->injectPacket( data + 7, player );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::injectChatPacket( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::injectChatPacket( char * data, Core::Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( pPlayer->getId() );
|
||||
auto pSession = g_serverZone.getSession( player.getId() );
|
||||
if( pSession )
|
||||
pSession->getChatConnection()->injectPacket( data + 8, pPlayer );
|
||||
pSession->getChatConnection()->injectPacket( data + 8, player );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command )
|
||||
void Core::DebugCommandHandler::nudge( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
std::string subCommand;
|
||||
|
||||
|
@ -472,7 +472,7 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, b
|
|||
|
||||
std::size_t spos = tmpCommand.find_first_of( " " );
|
||||
|
||||
auto& pos = pPlayer->getPos();
|
||||
auto& pos = player.getPos();
|
||||
|
||||
int32_t offset = 0;
|
||||
char direction[20];
|
||||
|
@ -480,45 +480,44 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, b
|
|||
|
||||
sscanf( tmpCommand.c_str(), "%d %s", &offset, direction );
|
||||
|
||||
|
||||
if( direction[0] == 'u' || direction[0] == '+' )
|
||||
{
|
||||
pos.y += offset;
|
||||
pPlayer->sendNotice( "nudge: Placing up " + std::to_string( offset ) + " yalms" );
|
||||
player.sendNotice( "nudge: Placing up " + std::to_string( offset ) + " yalms" );
|
||||
}
|
||||
else if( direction[0] == 'd' || direction[0] == '-' )
|
||||
{
|
||||
pos.y -= offset;
|
||||
pPlayer->sendNotice( "nudge: Placing down " + std::to_string( offset ) + " yalms" );
|
||||
player.sendNotice( "nudge: Placing down " + std::to_string( offset ) + " yalms" );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
float angle = pPlayer->getRotation() + ( PI / 2 );
|
||||
float angle = player.getRotation() + ( PI / 2 );
|
||||
pos.x -= offset * cos( angle );
|
||||
pos.z += offset * sin( angle );
|
||||
pPlayer->sendNotice( "nudge: Placing forward " + std::to_string( offset ) + " yalms" );
|
||||
player.sendNotice( "nudge: Placing forward " + std::to_string( offset ) + " yalms" );
|
||||
}
|
||||
if( offset != 0 )
|
||||
{
|
||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
|
||||
setActorPosPacket( pPlayer->getId() );
|
||||
setActorPosPacket.data().x = pPlayer->getPos().x;
|
||||
setActorPosPacket.data().y = pPlayer->getPos().y;
|
||||
setActorPosPacket.data().z = pPlayer->getPos().z;
|
||||
setActorPosPacket.data().r16 = Math::Util::floatToUInt16Rot( pPlayer->getRotation() );
|
||||
pPlayer->queuePacket( setActorPosPacket );
|
||||
setActorPosPacket( player.getId() );
|
||||
setActorPosPacket.data().x = player.getPos().x;
|
||||
setActorPosPacket.data().y = player.getPos().y;
|
||||
setActorPosPacket.data().z = player.getPos().z;
|
||||
setActorPosPacket.data().r16 = Math::Util::floatToUInt16Rot( player.getRotation() );
|
||||
player.queuePacket( setActorPosPacket );
|
||||
}
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::serverInfo( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::serverInfo( char * data, Core::Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
pPlayer->sendDebug( "SapphireServer " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
||||
pPlayer->sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
||||
pPlayer->sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) );
|
||||
player.sendDebug( "SapphireServer " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
||||
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
||||
player.sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) );
|
||||
}
|
||||
|
||||
void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
|
||||
void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< Core::DebugCommand > command )
|
||||
{
|
||||
pPlayer->unlock( );
|
||||
player.unlock( );
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class DebugCommandHandler
|
|||
{
|
||||
private:
|
||||
// container mapping command string to command object
|
||||
std::map<std::string, boost::shared_ptr<DebugCommand> > m_commandMap;
|
||||
std::map< std::string, boost::shared_ptr< DebugCommand > > m_commandMap;
|
||||
|
||||
public:
|
||||
DebugCommandHandler();
|
||||
|
@ -25,25 +25,25 @@ public:
|
|||
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel );
|
||||
|
||||
// execute command if registered
|
||||
void execCommand( char * data, Entity::PlayerPtr pPlayer );
|
||||
void execCommand( char * data, Entity::Player& player );
|
||||
|
||||
// help command
|
||||
void help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
// command handler callbacks
|
||||
void set( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void get( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void add( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
//void debug( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void scriptReload( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void set( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void get( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void add( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
//void debug( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void scriptReload( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
void injectPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void injectChatPacket( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void serverInfo( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void injectPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void injectChatPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void nudge( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void serverInfo( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
void unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void targetInfo( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
|
||||
void unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
void targetInfo( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -133,8 +133,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t > & buffer )
|
|||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if( headerResult == Malformed )
|
||||
else if( headerResult == Malformed )
|
||||
{
|
||||
g_log.info( "Dropping connection due to malformed packet header." );
|
||||
Disconnect();
|
||||
|
@ -153,8 +152,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t > & buffer )
|
|||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (packetResult == Malformed)
|
||||
else if( packetResult == Malformed )
|
||||
{
|
||||
g_log.info( "Dropping connection due to malformed packets." );
|
||||
Disconnect();
|
||||
|
@ -198,7 +196,7 @@ void Core::Network::GameConnection::handleZonePacket( const Packets::GamePacket&
|
|||
boost::str( boost::format( "%|04X|" ) %
|
||||
static_cast< uint32_t >( pPacket.getSubType() & 0xFFFF ) ) + " )" );
|
||||
|
||||
( this->*( it->second ) )( pPacket, m_pSession->getPlayer() );
|
||||
( this->*( it->second ) )( pPacket, *m_pSession->getPlayer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -226,7 +224,7 @@ void Core::Network::GameConnection::handleChatPacket( const Packets::GamePacket&
|
|||
boost::str( boost::format( "%|04X|" ) %
|
||||
static_cast< uint32_t >( pPacket.getSubType() & 0xFFFF ) ) + " )" );
|
||||
|
||||
( this->*( it->second ) )( pPacket, m_pSession->getPlayer() );
|
||||
( this->*( it->second ) )( pPacket, *m_pSession->getPlayer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -309,7 +307,7 @@ void Core::Network::GameConnection::sendSinglePacket( Packets::GamePacket* pPack
|
|||
sendPackets( &pRP );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::injectPacket( const std::string& packetpath, Core::Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::injectPacket( const std::string& packetpath, Core::Entity::Player& pPlayer )
|
||||
{
|
||||
|
||||
char packet[0x11570];
|
||||
|
@ -338,7 +336,7 @@ void Core::Network::GameConnection::injectPacket( const std::string& packetpath,
|
|||
// cycle through the packet entries and queue each one
|
||||
for( int32_t k = 0x18; k < size; )
|
||||
{
|
||||
uint32_t tmpId = pPlayer->getId();
|
||||
uint32_t tmpId = pPlayer.getId();
|
||||
// replace ids in the entryheader if needed
|
||||
if( !memcmp( packet + k + 0x04, packet + k + 0x08, 4 ) )
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
|
||||
#define DECLARE_HANDLER( x ) void x( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
#define DECLARE_HANDLER( x ) void x( const Packets::GamePacket& inPacket, Entity::Player& player )
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -29,18 +29,18 @@ class GameConnection : public Connection
|
|||
{
|
||||
|
||||
private:
|
||||
typedef void ( GameConnection::* Handler )( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer );
|
||||
typedef void ( GameConnection::* Handler )( const Packets::GamePacket& inPacket, Entity::Player& player );
|
||||
|
||||
using HandlerMap = std::map< uint16_t, Handler >;
|
||||
using HandlerStrMap = std::map< uint16_t, std::string >;
|
||||
|
||||
AcceptorPtr m_pAcceptor;
|
||||
|
||||
// handler for game packets (main type 0x03, connection type 1)
|
||||
// handler for game packets ( main type 0x03, connection type 1 )
|
||||
HandlerMap m_zoneHandlerMap;
|
||||
HandlerStrMap m_zoneHandlerStrMap;
|
||||
|
||||
// handler for game packets (main type 0x03, connection type 2)
|
||||
// handler for game packets ( main type 0x03, connection type 2 )
|
||||
HandlerMap m_chatHandlerMap;
|
||||
HandlerStrMap m_chatHandlerStrMap;
|
||||
|
||||
|
@ -80,11 +80,11 @@ public:
|
|||
|
||||
void handleChatPacket( const Packets::GamePacket& pPacket );
|
||||
|
||||
void sendPackets( Packets::PacketContainer * pPacket );
|
||||
void sendPackets( Packets::PacketContainer* pPacket );
|
||||
|
||||
void sendSinglePacket( Packets::GamePacket * pPacket );
|
||||
void sendSinglePacket( Packets::GamePacket* pPacket );
|
||||
|
||||
void injectPacket( const std::string& packetpath, Entity::PlayerPtr pPlayer );
|
||||
void injectPacket( const std::string& packetpath, Entity::Player& player );
|
||||
|
||||
DECLARE_HANDLER( initHandler );
|
||||
DECLARE_HANDLER( finishLoadingHandler );
|
||||
|
|
|
@ -46,7 +46,7 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint16_t commandId = inPacket.getValAt< uint16_t >( 0x20 );
|
||||
uint64_t param1 = inPacket.getValAt< uint64_t >( 0x24 );
|
||||
|
@ -70,14 +70,14 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
case 0x01: // Toggle sheathe
|
||||
{
|
||||
if ( param11 == 1 )
|
||||
pPlayer->setStance( Entity::Actor::Stance::Active );
|
||||
player.setStance( Entity::Actor::Stance::Active );
|
||||
else
|
||||
{
|
||||
pPlayer->setStance( Entity::Actor::Stance::Passive );
|
||||
pPlayer->setAutoattack( false );
|
||||
player.setStance( Entity::Actor::Stance::Passive );
|
||||
player.setAutoattack( false );
|
||||
}
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 0, param11, 1 ) );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), 0, param11, 1 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
{
|
||||
if ( param11 == 1 )
|
||||
{
|
||||
pPlayer->setAutoattack( true );
|
||||
pPlayer->setStance( Entity::Actor::Stance::Active );
|
||||
player.setAutoattack( true );
|
||||
player.setStance( Entity::Actor::Stance::Active );
|
||||
}
|
||||
else
|
||||
pPlayer->setAutoattack( false );
|
||||
player.setAutoattack( false );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 1, param11, 1 ) );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), 1, param11, 1 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -99,51 +99,51 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
{
|
||||
|
||||
uint64_t targetId = inPacket.getValAt< uint64_t >( 0x24 );
|
||||
pPlayer->changeTarget( targetId );
|
||||
player.changeTarget( targetId );
|
||||
break;
|
||||
}
|
||||
case 0x65:
|
||||
{
|
||||
pPlayer->dismount();
|
||||
player.dismount();
|
||||
break;
|
||||
}
|
||||
case 0x68: // Remove status (clicking it off)
|
||||
{
|
||||
// todo: check if status can be removed by client from exd
|
||||
pPlayer->removeSingleStatusEffectById( static_cast< uint32_t >( param1 ) );
|
||||
player.removeSingleStatusEffectById( static_cast< uint32_t >( param1 ) );
|
||||
break;
|
||||
}
|
||||
case 0x69: // Cancel cast
|
||||
{
|
||||
if( pPlayer->getCurrentAction() )
|
||||
pPlayer->getCurrentAction()->setInterrupted();
|
||||
if( player.getCurrentAction() )
|
||||
player.getCurrentAction()->setInterrupted();
|
||||
break;
|
||||
}
|
||||
case 0x12E: // Set player title
|
||||
{
|
||||
pPlayer->setTitle( static_cast< uint16_t >( param1 ) );
|
||||
player.setTitle( static_cast< uint16_t >( param1 ) );
|
||||
break;
|
||||
}
|
||||
case 0x12F: // Get title list
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcPlayerTitleList > titleListPacket( pPlayer->getId() );
|
||||
memcpy( titleListPacket.data().titleList, pPlayer->getTitleList(), sizeof( titleListPacket.data().titleList ) );
|
||||
ZoneChannelPacket< FFXIVIpcPlayerTitleList > titleListPacket( player.getId() );
|
||||
memcpy( titleListPacket.data().titleList, player.getTitleList(), sizeof( titleListPacket.data().titleList ) );
|
||||
|
||||
pPlayer->queuePacket( titleListPacket );
|
||||
player.queuePacket( titleListPacket );
|
||||
break;
|
||||
}
|
||||
case 0x133: // Update howtos seen
|
||||
{
|
||||
uint32_t howToId = static_cast< uint32_t >( param1 );
|
||||
pPlayer->updateHowtosSeen( howToId );
|
||||
player.updateHowtosSeen( howToId );
|
||||
break;
|
||||
}
|
||||
case 0x1F4: // emote
|
||||
{
|
||||
uint64_t targetId = pPlayer->getTargetId();
|
||||
uint64_t targetId = player.getTargetId();
|
||||
uint32_t emoteId = inPacket.getValAt< uint32_t >( 0x24 );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket144( pPlayer->getId(), Emote, emoteId, 0, 0, 0, targetId ) );
|
||||
player.sendToInRangeSet( ActorControlPacket144( player.getId(), Emote, emoteId, 0, 0, 0, targetId ) );
|
||||
break;
|
||||
}
|
||||
case 0xC8: // return dead
|
||||
|
@ -152,10 +152,10 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
{
|
||||
case ResurrectType::RaiseSpell:
|
||||
// todo: handle raise case (set position to raiser, apply weakness status, set hp/mp/tp as well as packet)
|
||||
pPlayer->returnToHomepoint();
|
||||
player.returnToHomepoint();
|
||||
break;
|
||||
case ResurrectType::Return:
|
||||
pPlayer->returnToHomepoint();
|
||||
player.returnToHomepoint();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -164,39 +164,39 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
}
|
||||
case 0xC9: // Finish zoning
|
||||
{
|
||||
switch( pPlayer->getZoningType() )
|
||||
switch( player.getZoningType() )
|
||||
{
|
||||
case ZoneingType::None:
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01 ), true );
|
||||
break;
|
||||
case ZoneingType::Teleport:
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
||||
break;
|
||||
case ZoneingType::Return:
|
||||
case ZoneingType::ReturnDead:
|
||||
{
|
||||
if( pPlayer->getStatus() == Entity::Actor::ActorStatus::Dead )
|
||||
if( player.getStatus() == Entity::Actor::ActorStatus::Dead )
|
||||
{
|
||||
pPlayer->resetHp();
|
||||
pPlayer->resetMp();
|
||||
pPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||
player.resetHp();
|
||||
player.resetMp();
|
||||
player.setStatus( Entity::Actor::ActorStatus::Idle );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||
}
|
||||
else
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
||||
player.sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
||||
}
|
||||
break;
|
||||
case ZoneingType::FadeIn:
|
||||
break;
|
||||
}
|
||||
|
||||
pPlayer->setZoningType( Common::ZoneingType::None );
|
||||
player.setZoningType( Common::ZoneingType::None );
|
||||
|
||||
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
pPlayer->unsetStateFlag( PlayerStateFlag::BetweenAreas1 );
|
||||
pPlayer->sendStateFlags();
|
||||
player.unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
player.unsetStateFlag( PlayerStateFlag::BetweenAreas1 );
|
||||
player.sendStateFlags();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
|
||||
if( targetAetheryte )
|
||||
{
|
||||
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[pPlayer->getZoneId()].aetheryte_index );
|
||||
auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[player.getZoneId()].aetheryte_index );
|
||||
|
||||
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
||||
auto cost = static_cast< uint16_t > ( ( sqrt( pow( fromAetheryte->map_coord_x - targetAetheryte->map_coord_x, 2 ) +
|
||||
|
@ -216,14 +216,14 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
|||
// cap at 999 gil
|
||||
cost = cost > uint16_t{999} ? uint16_t{999} : cost;
|
||||
|
||||
bool insufficientGil = pPlayer->getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
||||
bool insufficientGil = player.getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
||||
// todo: figure out what param1 really does
|
||||
pPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), TeleportStart, insufficientGil ? 2 : 0, param11 ) );
|
||||
player.queuePacket( ActorControlPacket143( player.getId(), TeleportStart, insufficientGil ? 2 : 0, param11 ) );
|
||||
|
||||
if( !insufficientGil )
|
||||
{
|
||||
Action::ActionTeleportPtr pActionTeleport( new Action::ActionTeleport( pPlayer, param11, cost ) );
|
||||
pPlayer->setCurrentAction( pActionTeleport );
|
||||
Action::ActionTeleportPtr pActionTeleport( new Action::ActionTeleport( player.getAsPlayer(), param11, cost ) );
|
||||
player.setCurrentAction( pActionTeleport );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -25,11 +25,11 @@ using namespace Core::Network::Packets::Server;
|
|||
|
||||
|
||||
void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcCFDutyInfo > dutyInfoPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcCFDutyInfo > dutyInfoPacket( player.getId() );
|
||||
|
||||
auto penaltyMinutes = pPlayer->getCFPenaltyMinutes();
|
||||
auto penaltyMinutes = player.getCFPenaltyMinutes();
|
||||
if (penaltyMinutes > 255)
|
||||
{
|
||||
// cap it since it's uint8_t in packets
|
||||
|
@ -39,13 +39,13 @@ void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::GamePacket
|
|||
|
||||
queueOutPacket( dutyInfoPacket );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcCFPlayerInNeed > inNeedsPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcCFPlayerInNeed > inNeedsPacket( player.getId() );
|
||||
queueOutPacket( inNeedsPacket );
|
||||
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer)
|
||||
Entity::Player& player)
|
||||
{
|
||||
// TODO use for loop for this
|
||||
auto contentId1 = inPacket.getValAt< uint16_t >( 46 );
|
||||
|
@ -54,28 +54,28 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& i
|
|||
auto contentId4 = inPacket.getValAt< uint16_t >( 52 );
|
||||
auto contentId5 = inPacket.getValAt< uint16_t >( 54 );
|
||||
|
||||
pPlayer->sendDebug("Duty register request");
|
||||
pPlayer->sendDebug("ContentId1" + std::to_string(contentId1));
|
||||
pPlayer->sendDebug("ContentId2" + std::to_string(contentId2));
|
||||
pPlayer->sendDebug("ContentId3" + std::to_string(contentId3));
|
||||
pPlayer->sendDebug("ContentId4" + std::to_string(contentId4));
|
||||
pPlayer->sendDebug("ContentId5" + std::to_string(contentId5));
|
||||
player.sendDebug("Duty register request");
|
||||
player.sendDebug("ContentId1" + std::to_string(contentId1));
|
||||
player.sendDebug("ContentId2" + std::to_string(contentId2));
|
||||
player.sendDebug("ContentId3" + std::to_string(contentId3));
|
||||
player.sendDebug("ContentId4" + std::to_string(contentId4));
|
||||
player.sendDebug("ContentId5" + std::to_string(contentId5));
|
||||
|
||||
// let's cancel it because otherwise you can't register it again
|
||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( player.getId() );
|
||||
cfCancelPacket.data().state1 = 3;
|
||||
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
||||
queueOutPacket( cfCancelPacket );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::cfRegisterRoulette( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer)
|
||||
Entity::Player& player)
|
||||
{
|
||||
pPlayer->sendDebug("Roulette register");
|
||||
player.sendDebug("Roulette register");
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::cfDutyAccepted( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer)
|
||||
Entity::Player& player)
|
||||
{
|
||||
pPlayer->sendDebug("TODO: Duty accept");
|
||||
player.sendDebug("TODO: Duty accept");
|
||||
}
|
||||
|
|
|
@ -27,22 +27,22 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint16_t eventHandlerId = inPacket.getValAt< uint16_t >( 0x12 );
|
||||
|
||||
// we need to abort the event in case it has not been scripted so the player wont be locked up
|
||||
auto abortEventFunc = []( Core::Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId )
|
||||
auto abortEventFunc = []( Core::Entity::Player& player, uint64_t actorId, uint32_t eventId )
|
||||
{
|
||||
pPlayer->queuePacket( EventStartPacket( pPlayer->getId(), actorId, eventId, 1, 0, 0 ) );
|
||||
pPlayer->queuePacket( EventFinishPacket( pPlayer->getId(), eventId, 1, 0 ) );
|
||||
player.queuePacket( EventStartPacket( player.getId(), actorId, eventId, 1, 0, 0 ) );
|
||||
player.queuePacket( EventFinishPacket( player.getId(), eventId, 1, 0 ) );
|
||||
// this isn't ideal as it will also reset any other status that might be active
|
||||
pPlayer->queuePacket( PlayerStateFlagsPacket( pPlayer, PlayerStateFlagList{} ) );
|
||||
player.queuePacket( PlayerStateFlagsPacket( player, PlayerStateFlagList{} ) );
|
||||
};
|
||||
|
||||
std::string eventIdStr = boost::str( boost::format( "%|04X|" ) % static_cast< uint32_t >( eventHandlerId & 0xFFFF ) );
|
||||
pPlayer->sendDebug( "---------------------------------------" );
|
||||
pPlayer->sendDebug( "EventHandler ( " + eventIdStr + " )" );
|
||||
player.sendDebug( "---------------------------------------" );
|
||||
player.sendDebug( "EventHandler ( " + eventIdStr + " )" );
|
||||
|
||||
switch( eventHandlerId )
|
||||
{
|
||||
|
@ -52,8 +52,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
uint64_t actorId = inPacket.getValAt< uint64_t >( 0x20 );
|
||||
uint32_t eventId = inPacket.getValAt< uint32_t >( 0x28 );
|
||||
|
||||
if( !g_scriptMgr.onTalk( pPlayer, actorId, eventId ) )
|
||||
abortEventFunc( pPlayer, actorId, eventId );
|
||||
if( !g_scriptMgr.onTalk( player, actorId, eventId ) )
|
||||
abortEventFunc( player, actorId, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onEmote( pPlayer, actorId, eventId, static_cast< uint8_t >( emoteId ) ) )
|
||||
abortEventFunc( pPlayer, actorId, eventId );
|
||||
if( !g_scriptMgr.onEmote( player, actorId, eventId, static_cast< uint8_t >( emoteId ) ) )
|
||||
abortEventFunc( player, actorId, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onWithinRange( pPlayer, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onWithinRange( player, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onOutsideRange( pPlayer, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onOutsideRange( player, eventId, eventParam1, x, y, z ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onEnterTerritory( pPlayer, eventId, eventParam1, eventParam2 ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onEnterTerritory( player, eventId, eventParam1, eventParam2 ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -125,8 +125,8 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
|
||||
std::string eventName = Event::getEventName( eventId );
|
||||
|
||||
if( !g_scriptMgr.onEventHandlerReturn( pPlayer, eventId, subEvent, param1, param2, param3 ) )
|
||||
abortEventFunc( pPlayer, 0, eventId );
|
||||
if( !g_scriptMgr.onEventHandlerReturn( player, eventId, subEvent, param1, param2, param3 ) )
|
||||
abortEventFunc( player, 0, eventId );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -137,14 +137,12 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
|
|||
uint16_t subEvent = inPacket.getValAt< uint16_t >( 0x24 );
|
||||
std::string lsName = inPacket.getStringAt( 0x27 );
|
||||
|
||||
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcEventLinkshell > linkshellEvent( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcEventLinkshell > linkshellEvent( player.getId() );
|
||||
linkshellEvent.data().eventId = eventId;
|
||||
linkshellEvent.data().scene = static_cast< uint8_t >(subEvent);
|
||||
linkshellEvent.data().scene = static_cast< uint8_t >( subEvent );
|
||||
linkshellEvent.data().param3 = 1;
|
||||
linkshellEvent.data().unknown1 = 0x15a;
|
||||
pPlayer->queuePacket( linkshellEvent );
|
||||
player.queuePacket( linkshellEvent );
|
||||
|
||||
// abortEventFunc( pPlayer, 0, eventId );
|
||||
break;
|
||||
|
|
|
@ -92,9 +92,9 @@ enum GmCommand
|
|||
JumpNpc = 0x025F,
|
||||
};
|
||||
|
||||
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket, Entity::Player& player )
|
||||
{
|
||||
if( pPlayer->getGmRank() <= 0 )
|
||||
if( player.getGmRank() <= 0 )
|
||||
return;
|
||||
|
||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
|
@ -102,20 +102,20 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
uint32_t param2 = inPacket.getValAt< uint32_t >( 0x28 );
|
||||
uint32_t param3 = inPacket.getValAt< uint32_t >( 0x38 );
|
||||
|
||||
g_log.debug( pPlayer->getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
||||
g_log.debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
||||
", params: " + std::to_string( param1 ) + ", " +
|
||||
std::to_string( param2 ) + ", " + std::to_string( param3 ) );
|
||||
|
||||
Core::Entity::ActorPtr targetActor;
|
||||
|
||||
|
||||
if( pPlayer->getId() == param3 )
|
||||
if( player.getId() == param3 )
|
||||
{
|
||||
targetActor = pPlayer;
|
||||
targetActor = player.getAsPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto inRange = pPlayer->getInRangeActors();
|
||||
auto inRange = player.getInRangeActors();
|
||||
for( auto actor : inRange )
|
||||
{
|
||||
if( actor->getId() == param3 )
|
||||
|
@ -132,13 +132,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::Lv:
|
||||
{
|
||||
targetPlayer->setLevel( param1 );
|
||||
pPlayer->sendNotice( "Level for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Level for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Race:
|
||||
{
|
||||
targetPlayer->setLookAt( CharaLook::Race, param1 );
|
||||
pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->spawn( targetPlayer );
|
||||
auto inRange = targetPlayer->getInRangeActors();
|
||||
for ( auto actor : inRange )
|
||||
|
@ -151,7 +151,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::Tribe:
|
||||
{
|
||||
targetPlayer->setLookAt( CharaLook::Tribe, param1 );
|
||||
pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->spawn( targetPlayer );
|
||||
auto inRange = targetPlayer->getInRangeActors();
|
||||
for ( auto actor : inRange )
|
||||
|
@ -164,7 +164,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::Sex:
|
||||
{
|
||||
targetPlayer->setLookAt( CharaLook::Gender, param1 );
|
||||
pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->spawn( targetPlayer );
|
||||
auto inRange = targetActor->getInRangeActors();
|
||||
for ( auto actor : inRange )
|
||||
|
@ -176,30 +176,30 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
}
|
||||
case GmCommand::Time:
|
||||
{
|
||||
pPlayer->setEorzeaTimeOffset( param2 );
|
||||
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( param2 ) );
|
||||
player.setEorzeaTimeOffset( param2 );
|
||||
player.sendNotice( "Eorzea time offset: " + std::to_string( param2 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Weather:
|
||||
{
|
||||
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
|
||||
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
||||
player.sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
|
||||
targetPlayer->getName() + " set in range." );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Call:
|
||||
{
|
||||
if ( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
||||
targetPlayer->setZone( pPlayer->getZoneId() );
|
||||
if ( targetPlayer->getZoneId() != player.getZoneId() )
|
||||
targetPlayer->setZone( player.getZoneId() );
|
||||
|
||||
targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z,
|
||||
pPlayer->getRotation() );
|
||||
pPlayer->sendNotice( "Calling " + targetPlayer->getName() );
|
||||
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z,
|
||||
player.getRotation() );
|
||||
player.sendNotice( "Calling " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Inspect:
|
||||
{
|
||||
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
|
||||
player.sendNotice( "Name: " + targetPlayer->getName() +
|
||||
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
|
||||
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
|
||||
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
|
||||
|
@ -212,14 +212,14 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
}
|
||||
case GmCommand::Speed:
|
||||
{
|
||||
targetPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), Flee, param1 ) );
|
||||
pPlayer->sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
targetPlayer->queuePacket( ActorControlPacket143( player.getId(), Flee, param1 ) );
|
||||
player.sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Kill:
|
||||
{
|
||||
targetActor->takeDamage( 9999999 );
|
||||
pPlayer->sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
|
||||
player.sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Icon:
|
||||
|
@ -236,34 +236,34 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
strcpy( searchInfoPacket.data().searchMessage, targetPlayer->getSearchMessage() );
|
||||
targetPlayer->queuePacket( searchInfoPacket );
|
||||
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( player.getOnlineStatus() ) ),
|
||||
true );
|
||||
pPlayer->sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Hp:
|
||||
{
|
||||
targetPlayer->setHp( param1 );
|
||||
pPlayer->sendNotice( "Hp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Hp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Mp:
|
||||
{
|
||||
targetPlayer->setMp( param1 );
|
||||
pPlayer->sendNotice( "Mp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Mp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Gp:
|
||||
{
|
||||
targetPlayer->setHp( param1 );
|
||||
pPlayer->sendNotice( "Gp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
player.sendNotice( "Gp for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Exp:
|
||||
{
|
||||
targetPlayer->gainExp( param1 );
|
||||
pPlayer->sendNotice( std::to_string( param1 ) + " Exp was added to " + targetPlayer->getName() );
|
||||
player.sendNotice( std::to_string( param1 ) + " Exp was added to " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Inv:
|
||||
|
@ -273,7 +273,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
else
|
||||
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityRefill );
|
||||
|
||||
pPlayer->sendNotice( "Invincibility for " + targetPlayer->getName() +
|
||||
player.sendNotice( "Invincibility for " + targetPlayer->getName() +
|
||||
" was switched." );
|
||||
break;
|
||||
}
|
||||
|
@ -286,13 +286,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
for ( uint8_t i = 0; i < 255; i++ )
|
||||
targetActor->getAsPlayer()->learnSong( i, 0 );
|
||||
|
||||
pPlayer->sendNotice( "All Songs for " + targetPlayer->getName() +
|
||||
player.sendNotice( "All Songs for " + targetPlayer->getName() +
|
||||
" were turned on." );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetActor->getAsPlayer()->learnSong( param2, 0 );
|
||||
pPlayer->sendNotice( "Song " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
player.sendNotice( "Song " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
" was turned on." );
|
||||
}
|
||||
}
|
||||
|
@ -308,18 +308,18 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
|
||||
if( ( param1 == 0xcccccccc ) )
|
||||
{
|
||||
pPlayer->sendUrgent( "Syntaxerror." );
|
||||
player.sendUrgent( "Syntaxerror." );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !targetPlayer->addItem( -1, param1, param2 ) )
|
||||
pPlayer->sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
||||
player.sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Gil:
|
||||
{
|
||||
targetPlayer->addCurrency( 1, param1 );
|
||||
pPlayer->sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
|
||||
player.sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Collect:
|
||||
|
@ -328,12 +328,12 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
|
||||
if ( gil < param1 )
|
||||
{
|
||||
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
||||
player.sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPlayer->removeCurrency( 1, param1 );
|
||||
pPlayer->sendNotice( "Removed " + std::to_string( param1 ) +
|
||||
player.sendNotice( "Removed " + std::to_string( param1 ) +
|
||||
" Gil from " + targetPlayer->getName() +
|
||||
"(" + std::to_string( gil ) + " before)" );
|
||||
}
|
||||
|
@ -367,14 +367,14 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::GC:
|
||||
{
|
||||
targetPlayer->setGc( param1 );
|
||||
pPlayer->sendNotice( "GC for " + targetPlayer->getName() +
|
||||
player.sendNotice( "GC for " + targetPlayer->getName() +
|
||||
" was set to " + std::to_string( targetPlayer->getGc() ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::GCRank:
|
||||
{
|
||||
targetPlayer->setGcRankAt( targetPlayer->getGc() - 1, param1 );
|
||||
pPlayer->sendNotice( "GC Rank for " + targetPlayer->getName() +
|
||||
player.sendNotice( "GC Rank for " + targetPlayer->getName() +
|
||||
" for GC " + std::to_string( targetPlayer->getGc() ) +
|
||||
" was set to " + std::to_string( targetPlayer->getGcRankArray()[targetPlayer->getGc() - 1] ) );
|
||||
break;
|
||||
|
@ -388,13 +388,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
for ( uint8_t i = 0; i < 255; i++ )
|
||||
targetActor->getAsPlayer()->registerAetheryte( i );
|
||||
|
||||
pPlayer->sendNotice( "All Aetherytes for " + targetPlayer->getName() +
|
||||
player.sendNotice( "All Aetherytes for " + targetPlayer->getName() +
|
||||
" were turned on." );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetActor->getAsPlayer()->registerAetheryte( param2 );
|
||||
pPlayer->sendNotice( "Aetheryte " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
player.sendNotice( "Aetheryte " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
|
||||
" was turned on." );
|
||||
}
|
||||
}
|
||||
|
@ -406,55 +406,55 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
auto zoneInfo = g_zoneMgr.getZone( param1 );
|
||||
if ( !zoneInfo )
|
||||
{
|
||||
pPlayer->sendUrgent( "Invalid zone " + std::to_string( param1 ) );
|
||||
player.sendUrgent( "Invalid zone " + std::to_string( param1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPlayer->setPosition( targetPlayer->getPos() );
|
||||
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 );
|
||||
pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" );
|
||||
player.sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GmCommand::TeriInfo:
|
||||
{
|
||||
pPlayer->sendNotice( "ZoneId: " + std::to_string( pPlayer->getZoneId() ) + "\nName: " +
|
||||
pPlayer->getCurrentZone()->getName() + "\nInternalName: " +
|
||||
pPlayer->getCurrentZone()->getInternalName() + "\nPopCount: " +
|
||||
std::to_string( pPlayer->getCurrentZone()->getPopCount() ) +
|
||||
"\nCurrentWeather:" + std::to_string( pPlayer->getCurrentZone()->getCurrentWeather() ) +
|
||||
"\nNextWeather:" + std::to_string( pPlayer->getCurrentZone()->getNextWeather() ) );
|
||||
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) + "\nName: " +
|
||||
player.getCurrentZone()->getName() + "\nInternalName: " +
|
||||
player.getCurrentZone()->getInternalName() + "\nPopCount: " +
|
||||
std::to_string( player.getCurrentZone()->getPopCount() ) +
|
||||
"\nCurrentWeather:" + std::to_string( player.getCurrentZone()->getCurrentWeather() ) +
|
||||
"\nNextWeather:" + std::to_string( player.getCurrentZone()->getNextWeather() ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Jump:
|
||||
{
|
||||
|
||||
auto inRange = pPlayer->getInRangeActors();
|
||||
auto inRange = player.getInRangeActors();
|
||||
for( auto actor : inRange )
|
||||
{
|
||||
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
targetActor->getRotation() );
|
||||
}
|
||||
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
|
||||
player.sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
pPlayer->sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) );
|
||||
player.sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::Player& player )
|
||||
{
|
||||
if( pPlayer->getGmRank() <= 0 )
|
||||
if( player.getGmRank() <= 0 )
|
||||
return;
|
||||
|
||||
uint32_t commandId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
std::string param1 = inPacket.getStringAt( 0x34 );
|
||||
|
||||
g_log.debug( pPlayer->getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
||||
g_log.debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
||||
|
||||
auto targetSession = g_serverZone.getSession( param1 );
|
||||
Core::Entity::ActorPtr targetActor;
|
||||
|
@ -467,11 +467,11 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
|||
{
|
||||
if( param1 == "self" )
|
||||
{
|
||||
targetActor = pPlayer;
|
||||
targetActor = player.getAsPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sendUrgent( "Player " + param1 + " not found on this server." );
|
||||
player.sendUrgent( "Player " + param1 + " not found on this server." );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -489,25 +489,25 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
|||
targetPlayer->resetMp();
|
||||
targetPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus,
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatus,
|
||||
static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||
pPlayer->sendNotice( "Raised " + targetPlayer->getName() );
|
||||
player.sendNotice( "Raised " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Jump:
|
||||
{
|
||||
if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
|
||||
if( targetPlayer->getZoneId() != player.getZoneId() )
|
||||
{
|
||||
pPlayer->setZone( targetPlayer->getZoneId() );
|
||||
player.setZone( targetPlayer->getZoneId() );
|
||||
}
|
||||
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
|
||||
targetActor->getRotation() );
|
||||
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() );
|
||||
player.sendNotice( "Jumping to " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
pPlayer->sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
||||
player.sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace Core::Network::Packets::Server;
|
|||
|
||||
|
||||
void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t seq = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
uint8_t action = inPacket.getValAt< uint8_t >( 0x24 );
|
||||
|
@ -46,10 +46,10 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GameP
|
|||
uint16_t fromContainer = inPacket.getValAt< uint16_t >( 0x2C );
|
||||
uint16_t toContainer = inPacket.getValAt< uint16_t >( 0x40 );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( player.getId() );
|
||||
ackPacket.data().sequence = seq;
|
||||
ackPacket.data().type = 7;
|
||||
pPlayer->queuePacket( ackPacket );
|
||||
player.queuePacket( ackPacket );
|
||||
|
||||
|
||||
g_log.debug( inPacket.toString() );
|
||||
|
@ -61,19 +61,19 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GameP
|
|||
|
||||
case 0x07: // discard item action
|
||||
{
|
||||
pPlayer->getInventory()->discardItem( fromContainer, fromSlot );
|
||||
player.getInventory()->discardItem( fromContainer, fromSlot );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x08: // move item action
|
||||
{
|
||||
pPlayer->getInventory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
player.getInventory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x09: // swap item action
|
||||
{
|
||||
pPlayer->getInventory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
player.getInventory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -50,15 +50,15 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::fcInfoReqHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, pPlayer->getId(), pPlayer->getId() ) );
|
||||
GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, player.getId(), player.getId() ) );
|
||||
pPe->setValAt< uint8_t >( 0x48, 0x01 );
|
||||
queueOutPacket( pPe );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t inval = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
uint32_t inval1 = inPacket.getValAt< uint32_t >( 0x24 );
|
||||
|
@ -66,54 +66,53 @@ void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePac
|
|||
|
||||
uint8_t selectRegion = inPacket.getValAt< uint8_t >( 0x31 );
|
||||
|
||||
pPlayer->setSearchInfo( selectRegion, 0, inPacket.getStringAt( 0x32 ) );
|
||||
player.setSearchInfo( selectRegion, 0, inPacket.getStringAt( 0x32 ) );
|
||||
|
||||
pPlayer->setOnlineStatusMask( status );
|
||||
player.setOnlineStatusMask( status );
|
||||
|
||||
if( pPlayer->isNewAdventurer() && !( inval & 0x01000000 ) )
|
||||
if( player.isNewAdventurer() && !( inval & 0x01000000 ) )
|
||||
// mark player as not new adventurer anymore
|
||||
pPlayer->setNewAdventurer( false );
|
||||
player.setNewAdventurer( false );
|
||||
else if( inval & 0x01000000 )
|
||||
// mark player as new adventurer
|
||||
pPlayer->setNewAdventurer( true );
|
||||
player.setNewAdventurer( true );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( player.getId() );
|
||||
statusPacket.data().onlineStatusFlags = status;
|
||||
queueOutPacket( statusPacket );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( player.getId() );
|
||||
searchInfoPacket.data().onlineStatusFlags = status;
|
||||
searchInfoPacket.data().selectRegion = pPlayer->getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, pPlayer->getSearchMessage() );
|
||||
searchInfoPacket.data().selectRegion = player.getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, player.getSearchMessage() );
|
||||
queueOutPacket( searchInfoPacket );
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
|
||||
true );
|
||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatusIcon,
|
||||
static_cast< uint8_t >( player.getOnlineStatus() ) ), true );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::reqSearchInfoHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcInitSearchInfo > searchInfoPacket( pPlayer->getId() );
|
||||
searchInfoPacket.data().onlineStatusFlags = pPlayer->getOnlineStatusMask();
|
||||
searchInfoPacket.data().selectRegion = pPlayer->getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, pPlayer->getSearchMessage() );
|
||||
ZoneChannelPacket< FFXIVIpcInitSearchInfo > searchInfoPacket( player.getId() );
|
||||
searchInfoPacket.data().onlineStatusFlags = player.getOnlineStatusMask();
|
||||
searchInfoPacket.data().selectRegion = player.getSearchSelectRegion();
|
||||
strcpy( searchInfoPacket.data().searchMessage, player.getSearchMessage() );
|
||||
queueOutPacket( searchInfoPacket );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::linkshellListHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcLinkshellList > linkshellListPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcLinkshellList > linkshellListPacket( player.getId() );
|
||||
queueOutPacket( linkshellListPacket );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
// if the player is marked for zoning we no longer want to update his pos
|
||||
if( pPlayer->isMarkedForZoning() )
|
||||
if( player.isMarkedForZoning() )
|
||||
return;
|
||||
|
||||
struct testMov
|
||||
|
@ -178,23 +177,23 @@ void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePa
|
|||
//pInPacket->debugPrint();
|
||||
|
||||
bool bPosChanged = false;
|
||||
if( ( pPlayer->getPos().x != inPacket.getValAt< float >( 0x2c ) ) ||
|
||||
( pPlayer->getPos().y != inPacket.getValAt< float >( 0x30 ) ) ||
|
||||
( pPlayer->getPos().z != inPacket.getValAt< float >( 0x34 ) ) )
|
||||
if( ( player.getPos().x != inPacket.getValAt< float >( 0x2c ) ) ||
|
||||
( player.getPos().y != inPacket.getValAt< float >( 0x30 ) ) ||
|
||||
( player.getPos().z != inPacket.getValAt< float >( 0x34 ) ) )
|
||||
bPosChanged = true;
|
||||
if( !bPosChanged && pPlayer->getRotation() == inPacket.getValAt< float >( 0x20 ) )
|
||||
if( !bPosChanged && player.getRotation() == inPacket.getValAt< float >( 0x20 ) )
|
||||
return;
|
||||
|
||||
pPlayer->setRotation( inPacket.getValAt< float >( 0x20 ) );
|
||||
pPlayer->setPosition( inPacket.getValAt< float >( 0x2c ),
|
||||
player.setRotation( inPacket.getValAt< float >( 0x20 ) );
|
||||
player.setPosition( inPacket.getValAt< float >( 0x2c ),
|
||||
inPacket.getValAt< float >( 0x30 ),
|
||||
inPacket.getValAt< float >( 0x34 ) );
|
||||
|
||||
if( ( pPlayer->getCurrentAction() != nullptr ) && bPosChanged )
|
||||
pPlayer->getCurrentAction()->setInterrupted();
|
||||
if( ( player.getCurrentAction() != nullptr ) && bPosChanged )
|
||||
player.getCurrentAction()->setInterrupted();
|
||||
|
||||
// if no one is in range, don't bother trying to send a position update
|
||||
if( !pPlayer->hasInRangeActor() )
|
||||
if( !player.hasInRangeActor() )
|
||||
return;
|
||||
|
||||
uint8_t unk = inPacket.getValAt< uint8_t >( 0x29 );
|
||||
|
@ -278,26 +277,26 @@ void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePa
|
|||
}
|
||||
}
|
||||
|
||||
MoveActorPacket movePacket( pPlayer, unk1, unk2, unk3, unk4 );
|
||||
pPlayer->sendToInRangeSet( movePacket );
|
||||
MoveActorPacket movePacket( player, unk1, unk2, unk3, unk4 );
|
||||
player.sendToInRangeSet( movePacket );
|
||||
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::reqEquipDisplayFlagsHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
g_log.info( "[" + std::to_string( pPlayer->getId() ) + "] Setting EquipDisplayFlags to " + std::to_string( inPacket.getValAt< uint8_t >( 0x20 ) ) );
|
||||
pPlayer->setEquipDisplayFlags( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
g_log.info( "[" + std::to_string( player.getId() ) + "] Setting EquipDisplayFlags to " + std::to_string( inPacket.getValAt< uint8_t >( 0x20 ) ) );
|
||||
player.setEquipDisplayFlags( inPacket.getValAt< uint8_t >( 0x20 ) );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t zoneLineId = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
|
||||
pPlayer->sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
|
||||
player.sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
|
||||
|
||||
auto pZone = pPlayer->getCurrentZone();
|
||||
auto pZone = player.getCurrentZone();
|
||||
|
||||
auto pLine = g_zoneMgr.getZonePosition( zoneLineId );
|
||||
|
||||
|
@ -307,34 +306,34 @@ void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket&
|
|||
|
||||
if( pLine != nullptr )
|
||||
{
|
||||
pPlayer->sendDebug( "ZoneLine " + std::to_string( zoneLineId ) + " found." );
|
||||
player.sendDebug( "ZoneLine " + std::to_string( zoneLineId ) + " found." );
|
||||
targetPos = pLine->getTargetPosition();
|
||||
targetZone = pLine->getTargetZoneId();
|
||||
rotation = pLine->getTargetRotation();
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( player.getId() );
|
||||
preparePacket.data().targetZone = targetZone;
|
||||
|
||||
//ActorControlPacket143 controlPacket( pPlayer, ActorControlType::DespawnZoneScreenMsg,
|
||||
// 0x03, pPlayer->getId(), 0x01, targetZone );
|
||||
pPlayer->queuePacket( preparePacket );
|
||||
// 0x03, player.getId(), 0x01, targetZone );
|
||||
player.queuePacket( preparePacket );
|
||||
}
|
||||
else
|
||||
{
|
||||
// No zoneline found, revert to last zone
|
||||
pPlayer->sendUrgent( "ZoneLine " + std::to_string( zoneLineId ) + " not found." );
|
||||
player.sendUrgent( "ZoneLine " + std::to_string( zoneLineId ) + " not found." );
|
||||
targetPos.x = 0;
|
||||
targetPos.y = 0;
|
||||
targetPos.z = 0;
|
||||
targetZone = pZone->getId();
|
||||
}
|
||||
|
||||
pPlayer->performZoning( targetZone, targetPos, rotation);
|
||||
player.performZoning( targetZone, targetPos, rotation);
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::discoveryHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint32_t ref_position_id = inPacket.getValAt< uint32_t >( 0x20 );
|
||||
|
||||
|
@ -344,47 +343,47 @@ void Core::Network::GameConnection::discoveryHandler( const Packets::GamePacket&
|
|||
|
||||
if( !pQR->next() )
|
||||
{
|
||||
pPlayer->sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) + " not found. " );
|
||||
player.sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) + " not found. " );
|
||||
return;
|
||||
}
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcDiscovery > discoveryPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcDiscovery > discoveryPacket( player.getId() );
|
||||
discoveryPacket.data().map_id = pQR->getUInt( 2 );
|
||||
discoveryPacket.data().map_part_id = pQR->getUInt( 3 );
|
||||
|
||||
pPlayer->queuePacket( discoveryPacket );
|
||||
pPlayer->sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) );
|
||||
player.queuePacket( discoveryPacket );
|
||||
player.sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) );
|
||||
|
||||
pPlayer->discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
||||
player.discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::playTimeHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcPlayTime > playTimePacket( pPlayer->getId() );
|
||||
playTimePacket.data().playTimeInMinutes = pPlayer->getPlayTime() / 60;
|
||||
pPlayer->queuePacket( playTimePacket );
|
||||
ZoneChannelPacket< FFXIVIpcPlayTime > playTimePacket( player.getId() );
|
||||
playTimePacket.data().playTimeInMinutes = player.getPlayTime() / 60;
|
||||
player.queuePacket( playTimePacket );
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::initHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
// init handler means this is a login procedure
|
||||
pPlayer->setIsLogin( true );
|
||||
player.setIsLogin( true );
|
||||
|
||||
pPlayer->setZone( pPlayer->getZoneId() );
|
||||
player.setZone( player.getZoneId() );
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::blackListHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint8_t count = inPacket.getValAt< uint8_t >( 0x21 );
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcBlackList > blackListPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcBlackList > blackListPacket( player.getId() );
|
||||
blackListPacket.data().sequence = count;
|
||||
// TODO: Fill with actual blacklist data
|
||||
//blackListPacket.data().entry[0].contentId = 1;
|
||||
|
@ -395,39 +394,39 @@ void Core::Network::GameConnection::blackListHandler( const Packets::GamePacket&
|
|||
|
||||
|
||||
void Core::Network::GameConnection::pingHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
int32_t inVal = inPacket.getValAt< int32_t >( 0x20 );
|
||||
PingPacket pingPacket( pPlayer, inVal );
|
||||
PingPacket pingPacket( player, inVal );
|
||||
queueOutPacket( pingPacket );
|
||||
|
||||
pPlayer->setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
||||
player.setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::finishLoadingHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
// player is done zoning
|
||||
pPlayer->setLoadingComplete( true );
|
||||
player.setLoadingComplete( true );
|
||||
|
||||
// if this is a login event
|
||||
if( pPlayer->isLogin() )
|
||||
if( player.isLogin() )
|
||||
{
|
||||
// fire the onLogin Event
|
||||
pPlayer->onLogin();
|
||||
pPlayer->setIsLogin( false );
|
||||
player.onLogin();
|
||||
player.setIsLogin( false );
|
||||
}
|
||||
|
||||
// spawn the player for himself
|
||||
pPlayer->spawn( pPlayer );
|
||||
player.spawn( player.getAsPlayer() );
|
||||
|
||||
// notify the zone of a change in position to force an "inRangeActor" update
|
||||
pPlayer->getCurrentZone()->changeActorPosition( pPlayer );
|
||||
player.getCurrentZone()->changeActorPosition( player.getAsPlayer() );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
|
||||
uint8_t type = inPacket.getValAt< uint8_t >( 0x2A );
|
||||
|
@ -436,7 +435,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
if( type == 0x02 )
|
||||
{ // party list
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() );;
|
||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( player.getId() );
|
||||
|
||||
listPacket.data().type = 2;
|
||||
listPacket.data().sequence = count;
|
||||
|
@ -444,26 +443,26 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
int32_t entrysizes = sizeof( listPacket.data().entries );
|
||||
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
|
||||
|
||||
listPacket.data().entries[0].bytes[2] = pPlayer->getCurrentZone()->getId();
|
||||
listPacket.data().entries[0].bytes[2] = player.getCurrentZone()->getId();
|
||||
listPacket.data().entries[0].bytes[3] = 0x80;
|
||||
listPacket.data().entries[0].bytes[4] = 0x02;
|
||||
listPacket.data().entries[0].bytes[6] = 0x3B;
|
||||
listPacket.data().entries[0].bytes[11] = 0x10;
|
||||
listPacket.data().entries[0].classJob = static_cast< uint8_t >( pPlayer->getClass() );
|
||||
listPacket.data().entries[0].contentId = pPlayer->getContentId();
|
||||
listPacket.data().entries[0].level = pPlayer->getLevel();
|
||||
listPacket.data().entries[0].zoneId = pPlayer->getCurrentZone()->getId();
|
||||
listPacket.data().entries[0].classJob = static_cast< uint8_t >( player.getClass() );
|
||||
listPacket.data().entries[0].contentId = player.getContentId();
|
||||
listPacket.data().entries[0].level = player.getLevel();
|
||||
listPacket.data().entries[0].zoneId = player.getCurrentZone()->getId();
|
||||
listPacket.data().entries[0].zoneId1 = 0x0100;
|
||||
// TODO: no idea what this does
|
||||
//listPacket.data().entries[0].one = 1;
|
||||
|
||||
memcpy( listPacket.data().entries[0].name, pPlayer->getName().c_str(), strlen( pPlayer->getName().c_str() ) );
|
||||
memcpy( listPacket.data().entries[0].name, player.getName().c_str(), strlen( player.getName().c_str() ) );
|
||||
|
||||
// TODO: actually store and read language from somewhere
|
||||
listPacket.data().entries[0].bytes1[0] = 0x01;//flags (lang)
|
||||
// TODO: these flags need to be figured out
|
||||
//listPacket.data().entries[0].bytes1[1] = 0x00;//flags
|
||||
listPacket.data().entries[0].onlineStatusMask = pPlayer->getOnlineStatusMask();
|
||||
listPacket.data().entries[0].onlineStatusMask = player.getOnlineStatusMask();
|
||||
|
||||
queueOutPacket( listPacket );
|
||||
|
||||
|
@ -471,7 +470,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
else if( type == 0x0b )
|
||||
{ // friend list
|
||||
|
||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( player.getId() );
|
||||
listPacket.data().type = 0x0B;
|
||||
listPacket.data().sequence = count;
|
||||
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
|
||||
|
@ -485,7 +484,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
}
|
||||
|
||||
void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
|
||||
std::string chatString( inPacket.getStringAt( 0x3a ) );
|
||||
|
@ -495,35 +494,35 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
if( chatString.at( 0 ) == '!' )
|
||||
{
|
||||
// execute game console command
|
||||
g_gameCommandMgr.execCommand( const_cast< char * >( chatString.c_str() ) + 1, pPlayer );
|
||||
g_gameCommandMgr.execCommand( const_cast< char * >( chatString.c_str() ) + 1, player );
|
||||
return;
|
||||
}
|
||||
|
||||
ChatType chatType = static_cast<ChatType>( inPacket.getValAt< uint8_t >( 0x38 ) );
|
||||
ChatType chatType = static_cast< ChatType >( inPacket.getValAt< uint8_t >( 0x38 ) );
|
||||
|
||||
//ToDo, need to implement sending GM chat types.
|
||||
ChatPacket chatPacket( pPlayer, chatType, chatString );
|
||||
ChatPacket chatPacket( player, chatType, chatString );
|
||||
|
||||
switch( chatType )
|
||||
{
|
||||
case ChatType::Say:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange( pPlayer, 50, chatPacket );
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Yell:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange(pPlayer, 6000, chatPacket);
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Shout:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange( pPlayer, 6000, chatPacket );
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pPlayer->getCurrentZone()->queueOutPacketForRange( pPlayer, 50, chatPacket );
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -535,19 +534,19 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
// log right back in.
|
||||
// Also the packet needs to be converted to an ipc structure
|
||||
void Core::Network::GameConnection::logoutHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcLogout > logoutPacket( pPlayer->getId() );
|
||||
ZoneChannelPacket< FFXIVIpcLogout > logoutPacket( player.getId() );
|
||||
logoutPacket.data().flags1 = 0x02;
|
||||
logoutPacket.data().flags2 = 0x2000;
|
||||
queueOutPacket( logoutPacket );
|
||||
|
||||
pPlayer->setMarkedForRemoval();
|
||||
player.setMarkedForRemoval();
|
||||
}
|
||||
|
||||
|
||||
void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
std::string targetPcName = inPacket.getStringAt( 0x21 );
|
||||
std::string msg = inPacket.getStringAt( 0x41 );
|
||||
|
@ -556,7 +555,7 @@ void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPa
|
|||
|
||||
if( !pSession )
|
||||
{
|
||||
ChatChannelPacket< FFXIVIpcTellErrNotFound > tellErrPacket( pPlayer->getId() );
|
||||
ChatChannelPacket< FFXIVIpcTellErrNotFound > tellErrPacket( player.getId() );
|
||||
strcpy( tellErrPacket.data().receipientName, targetPcName.c_str() );
|
||||
sendSinglePacket( tellErrPacket );
|
||||
|
||||
|
@ -589,9 +588,9 @@ void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPa
|
|||
return;
|
||||
}
|
||||
|
||||
ChatChannelPacket< FFXIVIpcTell > tellPacket( pPlayer->getId() );
|
||||
ChatChannelPacket< FFXIVIpcTell > tellPacket( player.getId() );
|
||||
strcpy( tellPacket.data().msg, msg.c_str() );
|
||||
strcpy( tellPacket.data().receipientName, pPlayer->getName().c_str() );
|
||||
strcpy( tellPacket.data().receipientName, player.getName().c_str() );
|
||||
// TODO: do these have a meaning?
|
||||
//tellPacket.data().u1 = 0x92CD7337;
|
||||
//tellPacket.data().u2a = 0x2E;
|
||||
|
@ -601,12 +600,12 @@ void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPa
|
|||
}
|
||||
|
||||
void Core::Network::GameConnection::performNoteHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
GamePacketNew< FFXIVIpcPerformNote, ServerZoneIpcType > performPacket( pPlayer->getId() );
|
||||
GamePacketNew< FFXIVIpcPerformNote, ServerZoneIpcType > performPacket( player.getId() );
|
||||
|
||||
uint8_t inVal = inPacket.getValAt< uint8_t >( 0x20 );
|
||||
memcpy( &performPacket.data().data[0], &inVal, 32 );
|
||||
|
||||
pPlayer->sendToInRangeSet( performPacket );
|
||||
player.sendToInRangeSet( performPacket );
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::PlayerPtr pPlayer )
|
||||
Entity::Player& player )
|
||||
{
|
||||
uint8_t type = inPacket.getValAt< uint32_t >( 0x21 );
|
||||
|
||||
|
@ -49,7 +49,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
|
||||
uint64_t targetId = inPacket.getValAt< uint64_t >( 0x30 );
|
||||
|
||||
pPlayer->sendDebug( "Skill type:" + std::to_string( type ) );
|
||||
player.sendDebug( "Skill type:" + std::to_string( type ) );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
|
@ -58,16 +58,16 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
if( action < 1000000 ) // normal action
|
||||
{
|
||||
std::string actionIdStr = boost::str( boost::format( "%|04X|" ) % action );
|
||||
pPlayer->sendDebug( "---------------------------------------" );
|
||||
pPlayer->sendDebug( "ActionHandler ( " + actionIdStr + " | " +
|
||||
player.sendDebug( "---------------------------------------" );
|
||||
player.sendDebug( "ActionHandler ( " + actionIdStr + " | " +
|
||||
g_exdData.getActionInfo( action )->name +
|
||||
" | " + std::to_string( targetId ) + " )" );
|
||||
|
||||
pPlayer->queuePacket( ActorControlPacket142( pPlayer->getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||
player.queuePacket( ActorControlPacket142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||
|
||||
if( action == 5 )
|
||||
{
|
||||
auto currentAction = pPlayer->getCurrentAction();
|
||||
auto currentAction = player.getCurrentAction();
|
||||
|
||||
// we should always have an action here, if not there is a bug
|
||||
assert( currentAction );
|
||||
|
@ -75,22 +75,22 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
}
|
||||
else
|
||||
{
|
||||
Core::Entity::ActorPtr targetActor = pPlayer;
|
||||
if( targetId != pPlayer->getId() )
|
||||
Core::Entity::ActorPtr targetActor = player.getAsPlayer();
|
||||
if( targetId != player.getId() )
|
||||
{
|
||||
targetActor = pPlayer->lookupTargetById( targetId );
|
||||
targetActor = player.lookupTargetById( targetId );
|
||||
}
|
||||
|
||||
if( !pPlayer->actionHasCastTime( action ) )
|
||||
if( !player.actionHasCastTime( action ) )
|
||||
{
|
||||
g_scriptMgr.onCastFinish( pPlayer, targetActor, action );
|
||||
g_scriptMgr.onCastFinish( player, targetActor, action );
|
||||
}
|
||||
else
|
||||
{
|
||||
Action::ActionCastPtr pActionCast( new Action::ActionCast( pPlayer, targetActor, action ) );
|
||||
pPlayer->setCurrentAction( pActionCast );
|
||||
pPlayer->sendDebug( "setCurrentAction()" );
|
||||
pPlayer->getCurrentAction()->onStart();
|
||||
Action::ActionCastPtr pActionCast( new Action::ActionCast( player.getAsPlayer(), targetActor, action ) );
|
||||
player.setCurrentAction( pActionCast );
|
||||
player.sendDebug( "setCurrentAction()" );
|
||||
player.getCurrentAction()->onStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
if( info )
|
||||
{
|
||||
g_log.debug( info->name );
|
||||
g_scriptMgr.onEventItem( pPlayer, action, info->eventId, info->castTime, targetId );
|
||||
g_scriptMgr.onEventItem( player, action, info->eventId, info->castTime, targetId );
|
||||
}
|
||||
}
|
||||
else if( action > 3000000 ) // unknown
|
||||
|
@ -116,12 +116,12 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
|
||||
case Common::SkillType::MountSkill:
|
||||
|
||||
pPlayer->sendDebug( "Request mount " + std::to_string( action ) );
|
||||
player.sendDebug( "Request mount " + std::to_string( action ) );
|
||||
|
||||
Action::ActionMountPtr pActionMount( new Action::ActionMount(pPlayer, action) );
|
||||
pPlayer->setCurrentAction( pActionMount );
|
||||
pPlayer->sendDebug("setCurrentAction()");
|
||||
pPlayer->getCurrentAction()->onStart();
|
||||
Action::ActionMountPtr pActionMount( new Action::ActionMount( player.getAsPlayer(), action ) );
|
||||
player.setCurrentAction( pActionMount );
|
||||
player.sendDebug( "setCurrentAction()" );
|
||||
player.getCurrentAction()->onStart();
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -18,17 +18,17 @@ class ChatPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcChat >
|
||||
{
|
||||
public:
|
||||
ChatPacket( Entity::PlayerPtr player, Common::ChatType chatType, const std::string& msg ) :
|
||||
ZoneChannelPacket< FFXIVIpcChat >( player->getId(), player->getId() )
|
||||
ChatPacket( Entity::Player& player, Common::ChatType chatType, const std::string& msg ) :
|
||||
ZoneChannelPacket< FFXIVIpcChat >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player, chatType, msg );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player, Common::ChatType chatType, const std::string& msg )
|
||||
void initialize( Entity::Player& player, Common::ChatType chatType, const std::string& msg )
|
||||
{
|
||||
m_data.chatType = chatType;
|
||||
strcpy( m_data.name, player->getName().c_str() );
|
||||
strcpy( m_data.name, player.getName().c_str() );
|
||||
strcpy( m_data.msg, msg.c_str() );
|
||||
};
|
||||
};
|
||||
|
|
|
@ -18,59 +18,59 @@ namespace Server {
|
|||
class InitUIPacket : public ZoneChannelPacket< FFXIVIpcInitUI >
|
||||
{
|
||||
public:
|
||||
InitUIPacket( Entity::PlayerPtr player ) :
|
||||
ZoneChannelPacket< FFXIVIpcInitUI >( player->getId(), player->getId() )
|
||||
InitUIPacket( Entity::Player& player ) :
|
||||
ZoneChannelPacket< FFXIVIpcInitUI >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player )
|
||||
void initialize( Entity::Player& player )
|
||||
{
|
||||
m_data.contentId = player->getContentId();
|
||||
m_data.contentId = player.getContentId();
|
||||
|
||||
// TODO: Support rested experience.
|
||||
m_data.restedExp = 0;
|
||||
//m_data.padding = 0x100;
|
||||
m_data.charId = player->getId();
|
||||
m_data.race = player->getLookAt( Common::CharaLook::Race );
|
||||
m_data.tribe = player->getLookAt( Common::CharaLook::Tribe );
|
||||
m_data.gender = player->getLookAt( Common::CharaLook::Gender );
|
||||
m_data.currentClass = static_cast< uint8_t >( player->getClass() );
|
||||
m_data.currentJob = static_cast< uint8_t >( player->getClass() );
|
||||
m_data.deity = static_cast< uint8_t >( player->getGuardianDeity() );
|
||||
m_data.namedayMonth = player->getBirthMonth();
|
||||
m_data.namedayDay = player->getBirthDay();
|
||||
m_data.charId = player.getId();
|
||||
m_data.race = player.getLookAt( Common::CharaLook::Race );
|
||||
m_data.tribe = player.getLookAt( Common::CharaLook::Tribe );
|
||||
m_data.gender = player.getLookAt( Common::CharaLook::Gender );
|
||||
m_data.currentClass = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.currentJob = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.deity = static_cast< uint8_t >( player.getGuardianDeity() );
|
||||
m_data.namedayMonth = player.getBirthMonth();
|
||||
m_data.namedayDay = player.getBirthDay();
|
||||
// TODO: Support grand company status.
|
||||
m_data.grandCompany = static_cast< Common::GrandCompany >( player->getGc() );
|
||||
m_data.grandCompany = static_cast< Common::GrandCompany >( player.getGc() );
|
||||
//m_data.gcRank = GCRank::None;
|
||||
|
||||
// TODO: Support starting city.
|
||||
//m_data.startCity = Town::Gridania;
|
||||
m_data.homepoint = player->getHomepoint();
|
||||
m_data.homepoint = player.getHomepoint();
|
||||
|
||||
memset( &m_data.name[0], 0, sizeof( m_data.name ) );
|
||||
|
||||
strcpy( &m_data.name[0], player->getName().c_str() );
|
||||
strcpy( &m_data.name[0], player.getName().c_str() );
|
||||
|
||||
memcpy( m_data.aetheryte, player->getAetheryteArray(), sizeof ( m_data.aetheryte ) );
|
||||
memcpy( m_data.aetheryte, player.getAetheryteArray(), sizeof ( m_data.aetheryte ) );
|
||||
|
||||
// Set the class levels and exp.
|
||||
for( uint8_t i = 0; i < 25; i++ )
|
||||
{
|
||||
m_data.levels[i] = player->getClassArray()[i];
|
||||
m_data.exp[i] = player->getExpArray()[i];
|
||||
m_data.levels[i] = player.getClassArray()[i];
|
||||
m_data.exp[i] = player.getExpArray()[i];
|
||||
}
|
||||
|
||||
memcpy( m_data.orchestrionMask, player->getOrchestrionBitmask(), sizeof( m_data.orchestrionMask ) );
|
||||
memcpy( m_data.orchestrionMask, player.getOrchestrionBitmask(), sizeof( m_data.orchestrionMask ) );
|
||||
|
||||
memcpy( m_data.mountGuideMask, player->getMountGuideBitmask(), sizeof( m_data.mountGuideMask) );
|
||||
memcpy( m_data.mountGuideMask, player.getMountGuideBitmask(), sizeof( m_data.mountGuideMask) );
|
||||
|
||||
memcpy( m_data.unlockBitmask, player->getUnlockBitmask(), sizeof( m_data.unlockBitmask ) );
|
||||
memcpy( m_data.unlockBitmask, player.getUnlockBitmask(), sizeof( m_data.unlockBitmask ) );
|
||||
|
||||
memcpy( m_data.discovery, player->getDiscoveryBitmask(), sizeof( m_data.discovery ) );
|
||||
memcpy( m_data.discovery, player.getDiscoveryBitmask(), sizeof( m_data.discovery ) );
|
||||
|
||||
memcpy( m_data.howto, player->getHowToArray(), sizeof( m_data.howto ) );
|
||||
memcpy( m_data.howto, player.getHowToArray(), sizeof( m_data.howto ) );
|
||||
|
||||
m_data.unknown_13 = 0x46;
|
||||
m_data.expansion = 2;
|
||||
|
|
|
@ -17,22 +17,22 @@ class ModelEquipPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcModelEquip >
|
||||
{
|
||||
public:
|
||||
ModelEquipPacket( Entity::PlayerPtr player ) :
|
||||
ZoneChannelPacket< FFXIVIpcModelEquip >( player->getId(), player->getId() )
|
||||
ModelEquipPacket( Entity::Player& player ) :
|
||||
ZoneChannelPacket< FFXIVIpcModelEquip >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player )
|
||||
void initialize( Entity::Player& player )
|
||||
{
|
||||
m_data.mainWeapon = player->getModelMainWeapon();
|
||||
m_data.offWeapon = player->getModelSubWeapon();
|
||||
m_data.models[0] = player->getModelForSlot( Inventory::EquipSlot::Head );
|
||||
m_data.models[1] = player->getModelForSlot( Inventory::EquipSlot::Body );
|
||||
m_data.models[2] = player->getModelForSlot( Inventory::EquipSlot::Hands );
|
||||
m_data.models[3] = player->getModelForSlot( Inventory::EquipSlot::Legs );
|
||||
m_data.models[4] = player->getModelForSlot( Inventory::EquipSlot::Feet );
|
||||
m_data.mainWeapon = player.getModelMainWeapon();
|
||||
m_data.offWeapon = player.getModelSubWeapon();
|
||||
m_data.models[0] = player.getModelForSlot( Inventory::EquipSlot::Head );
|
||||
m_data.models[1] = player.getModelForSlot( Inventory::EquipSlot::Body );
|
||||
m_data.models[2] = player.getModelForSlot( Inventory::EquipSlot::Hands );
|
||||
m_data.models[3] = player.getModelForSlot( Inventory::EquipSlot::Legs );
|
||||
m_data.models[4] = player.getModelForSlot( Inventory::EquipSlot::Feet );
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -21,24 +21,24 @@ class MoveActorPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcActorMove >
|
||||
{
|
||||
public:
|
||||
MoveActorPacket( Entity::ActorPtr actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) :
|
||||
ZoneChannelPacket< FFXIVIpcActorMove >( actor->getId(), actor->getId() )
|
||||
MoveActorPacket( Entity::Actor& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) :
|
||||
ZoneChannelPacket< FFXIVIpcActorMove >( actor.getId(), actor.getId() )
|
||||
{
|
||||
initialize( actor, unk1, unk2, unk3, unk4 );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::ActorPtr actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 )
|
||||
void initialize( Entity::Actor& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 )
|
||||
{
|
||||
|
||||
m_data.rotation = Math::Util::floatToUInt8Rot( actor->getRotation() );
|
||||
m_data.rotation = Math::Util::floatToUInt8Rot( actor.getRotation() );
|
||||
m_data.unknown_1 = unk1;
|
||||
m_data.unknown_2 = unk2;
|
||||
m_data.unknown_3 = unk3;
|
||||
m_data.unknown_4 = unk4;
|
||||
m_data.posX = Math::Util::floatToUInt16( actor->getPos().x );
|
||||
m_data.posY = Math::Util::floatToUInt16( actor->getPos().y );
|
||||
m_data.posZ = Math::Util::floatToUInt16( actor->getPos().z );
|
||||
m_data.posX = Math::Util::floatToUInt16( actor.getPos().x );
|
||||
m_data.posY = Math::Util::floatToUInt16( actor.getPos().y );
|
||||
m_data.posZ = Math::Util::floatToUInt16( actor.getPos().z );
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -17,14 +17,14 @@ class PingPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcPing >
|
||||
{
|
||||
public:
|
||||
PingPacket( Entity::PlayerPtr player, int32_t inVal ) :
|
||||
ZoneChannelPacket< FFXIVIpcPing >( player->getId(), player->getId() )
|
||||
PingPacket( Entity::Player& player, int32_t inVal ) :
|
||||
ZoneChannelPacket< FFXIVIpcPing >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( player, inVal );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr player, int32_t inVal )
|
||||
void initialize( Entity::Player& player, int32_t inVal )
|
||||
{
|
||||
m_data.timeInMilliseconds = 0x000014D00000000 + inVal;
|
||||
};
|
||||
|
|
|
@ -22,97 +22,97 @@ namespace Server {
|
|||
public GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >
|
||||
{
|
||||
public:
|
||||
PlayerSpawnPacket( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget ) :
|
||||
GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >( pPlayer->getId(), pTarget->getId() )
|
||||
PlayerSpawnPacket( Entity::Player& player, Entity::Player& target ) :
|
||||
GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >( player.getId(), target.getId() )
|
||||
{
|
||||
initialize( pPlayer, pTarget );
|
||||
initialize( player, target );
|
||||
};
|
||||
|
||||
private:
|
||||
void initialize( Entity::PlayerPtr pPlayer, Entity::PlayerPtr pTarget )
|
||||
void initialize( Entity::Player& player, Entity::Player& target )
|
||||
{
|
||||
// todo: figure out unkown offsets
|
||||
// TODO: temporary gm rank
|
||||
//m_data.gmRank = 0xff;
|
||||
|
||||
m_data.classJob = static_cast< uint8_t >( pPlayer->getClass() );
|
||||
m_data.classJob = static_cast< uint8_t >( player.getClass() );
|
||||
//m_data.status = static_cast< uint8_t >( pPlayer->getStatus() );
|
||||
|
||||
m_data.hPCurr = pPlayer->getHp();
|
||||
m_data.mPCurr = pPlayer->getMp();
|
||||
m_data.tPCurr = pPlayer->getTp();
|
||||
m_data.hPMax = pPlayer->getMaxHp();
|
||||
m_data.mPMax = pPlayer->getMaxMp();
|
||||
m_data.hPCurr = player.getHp();
|
||||
m_data.mPCurr = player.getMp();
|
||||
m_data.tPCurr = player.getTp();
|
||||
m_data.hPMax = player.getMaxHp();
|
||||
m_data.mPMax = player.getMaxMp();
|
||||
|
||||
//m_data.tPMax = 3000;
|
||||
m_data.level = pPlayer->getLevel();
|
||||
m_data.gmRank = pPlayer->getGmRank();
|
||||
m_data.level = player.getLevel();
|
||||
m_data.gmRank = player.getGmRank();
|
||||
m_data.pose = 0;
|
||||
|
||||
memcpy( m_data.look, pPlayer->getLookArray(), 26 );
|
||||
memcpy( m_data.look, player.getLookArray(), 26 );
|
||||
|
||||
auto item = pPlayer->getInventory()->getItemAt( Inventory::GearSet0, Inventory::EquipSlot::MainHand );
|
||||
auto item = player.getInventory()->getItemAt( Inventory::GearSet0, Inventory::EquipSlot::MainHand );
|
||||
if( item )
|
||||
m_data.mainWeaponModel = item->getModelId1();
|
||||
m_data.secWeaponModel = pPlayer->getModelSubWeapon();
|
||||
m_data.secWeaponModel = player.getModelSubWeapon();
|
||||
|
||||
m_data.models[0] = pPlayer->getModelForSlot( Inventory::EquipSlot::Head );
|
||||
m_data.models[1] = pPlayer->getModelForSlot( Inventory::EquipSlot::Body );
|
||||
m_data.models[2] = pPlayer->getModelForSlot( Inventory::EquipSlot::Hands );
|
||||
m_data.models[3] = pPlayer->getModelForSlot( Inventory::EquipSlot::Legs );
|
||||
m_data.models[4] = pPlayer->getModelForSlot( Inventory::EquipSlot::Feet );
|
||||
strcpy( m_data.name, pPlayer->getName().c_str() );
|
||||
m_data.models[0] = player.getModelForSlot( Inventory::EquipSlot::Head );
|
||||
m_data.models[1] = player.getModelForSlot( Inventory::EquipSlot::Body );
|
||||
m_data.models[2] = player.getModelForSlot( Inventory::EquipSlot::Hands );
|
||||
m_data.models[3] = player.getModelForSlot( Inventory::EquipSlot::Legs );
|
||||
m_data.models[4] = player.getModelForSlot( Inventory::EquipSlot::Feet );
|
||||
strcpy( m_data.name, player.getName().c_str() );
|
||||
|
||||
m_data.pos.x = pPlayer->getPos().x;
|
||||
m_data.pos.y = pPlayer->getPos().y;
|
||||
m_data.pos.z = pPlayer->getPos().z;
|
||||
m_data.rotation = Math::Util::floatToUInt16Rot( pPlayer->getRotation() );
|
||||
m_data.pos.x = player.getPos().x;
|
||||
m_data.pos.y = player.getPos().y;
|
||||
m_data.pos.z = player.getPos().z;
|
||||
m_data.rotation = Math::Util::floatToUInt16Rot( player.getRotation() );
|
||||
|
||||
|
||||
m_data.title = pPlayer->getTitle();
|
||||
m_data.voice = pPlayer->getVoiceId();
|
||||
m_data.currentMount = pPlayer->getCurrentMount();
|
||||
m_data.title = player.getTitle();
|
||||
m_data.voice = player.getVoiceId();
|
||||
m_data.currentMount = player.getCurrentMount();
|
||||
|
||||
m_data.onlineStatus = static_cast< uint8_t >( pPlayer->getOnlineStatus() );
|
||||
m_data.onlineStatus = static_cast< uint8_t >( player.getOnlineStatus() );
|
||||
|
||||
//m_data.u23 = 0x04;
|
||||
//m_data.u24 = 256;
|
||||
m_data.state = static_cast< uint8_t >( pPlayer->getStatus() );
|
||||
m_data.state = static_cast< uint8_t >( player.getStatus() );
|
||||
m_data.type = 1;
|
||||
if( pTarget == pPlayer )
|
||||
if( target.getId() == player.getId() )
|
||||
{
|
||||
m_data.spawnIndex = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data.spawnIndex = pTarget->getSpawnIdForActorId( pPlayer->getId() );
|
||||
m_data.spawnIndex = target.getSpawnIdForActorId( player.getId() );
|
||||
}
|
||||
// 0x20 == spawn hidden to be displayed by the spawneffect control
|
||||
m_data.displayFlags = pPlayer->getStance();
|
||||
m_data.displayFlags = player.getStance();
|
||||
|
||||
if( pPlayer->getZoningType() != Common::ZoneingType::None )
|
||||
if( player.getZoningType() != Common::ZoneingType::None )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::Invisible;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead )
|
||||
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::HideHead;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon )
|
||||
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::HideWeapon;
|
||||
}
|
||||
|
||||
if( pPlayer->getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor )
|
||||
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor )
|
||||
{
|
||||
m_data.displayFlags |= Entity::Actor::DisplayFlags::Visor;
|
||||
}
|
||||
|
||||
m_data.currentMount = pPlayer->getCurrentMount();
|
||||
m_data.currentMount = player.getCurrentMount();
|
||||
|
||||
m_data.targetId = pPlayer->getTargetId();
|
||||
m_data.targetId = player.getTargetId();
|
||||
//m_data.type = 1;
|
||||
//m_data.unknown_33 = 4;
|
||||
//m_data.unknown_38 = 0x70;
|
||||
|
@ -121,7 +121,7 @@ namespace Server {
|
|||
|
||||
uint64_t currentTimeMs = Util::getTimeMs();
|
||||
|
||||
for( auto const& effect : pPlayer->getStatusEffectMap() )
|
||||
for( auto const& effect : player.getStatusEffectMap() )
|
||||
{
|
||||
m_data.effect[effect.first].effect_id = effect.second->getId();
|
||||
m_data.effect[effect.first].duration = static_cast< float >( effect.second->getDuration() -
|
||||
|
|
|
@ -17,14 +17,14 @@ class PlayerStateFlagsPacket :
|
|||
public ZoneChannelPacket< FFXIVIpcPlayerStateFlags >
|
||||
{
|
||||
public:
|
||||
PlayerStateFlagsPacket( Entity::PlayerPtr pActor ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( pActor->getId(), pActor->getId() )
|
||||
PlayerStateFlagsPacket( Entity::Player& player ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() )
|
||||
{
|
||||
initialize( pActor->getStateFlags() );
|
||||
initialize( player.getStateFlags() );
|
||||
}
|
||||
|
||||
PlayerStateFlagsPacket( Entity::PlayerPtr pActor, std::vector< Common::PlayerStateFlag > flags ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( pActor->getId(), pActor->getId() )
|
||||
PlayerStateFlagsPacket( Entity::Player& player, std::vector< Common::PlayerStateFlag > flags ) :
|
||||
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() )
|
||||
{
|
||||
uint8_t newFlags[7];
|
||||
memset( newFlags, 0, 7 );
|
||||
|
|
|
@ -55,11 +55,11 @@ void Core::Scripting::ScriptManager::loadDir( std::string dirname, std::set<std:
|
|||
|
||||
}
|
||||
|
||||
void Core::Scripting::ScriptManager::onPlayerFirstEnterWorld( Core::Entity::PlayerPtr pPlayer )
|
||||
void Core::Scripting::ScriptManager::onPlayerFirstEnterWorld( Core::Entity::Player& player )
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string test = m_onFirstEnterWorld( *pPlayer );
|
||||
std::string test = m_onFirstEnterWorld( player );
|
||||
}
|
||||
catch( const std::exception &e )
|
||||
{
|
||||
|
@ -87,12 +87,12 @@ const boost::shared_ptr< chaiscript::ChaiScript >& Core::Scripting::ScriptManage
|
|||
}
|
||||
|
||||
|
||||
bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId )
|
||||
bool Core::Scripting::ScriptManager::onTalk( Core::Entity::Player& player, uint64_t actorId, uint32_t eventId )
|
||||
{
|
||||
std::string eventName = "onTalk";
|
||||
std::string objName = Event::getEventName( eventId );
|
||||
|
||||
pPlayer->sendDebug( "Actor: " +
|
||||
player.sendDebug( "Actor: " +
|
||||
std::to_string( actorId ) + " -> " +
|
||||
std::to_string( Core::Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
|
||||
" \neventId: " +
|
||||
|
@ -106,26 +106,26 @@ bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, ui
|
|||
{
|
||||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( objName );
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( actorId, eventId, Event::Event::Talk, 0, 0 );
|
||||
player.eventStart( actorId, eventId, Event::Event::Talk, 0, 0 );
|
||||
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &,
|
||||
uint32_t, Entity::Player&, uint64_t ) > >( eventName );
|
||||
fn( obj, eventId, *pPlayer, actorId );
|
||||
fn( obj, eventId, player, actorId );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what( ) );
|
||||
player.sendDebug( e.what( ) );
|
||||
|
||||
if( eventType == Common::EventType::Quest )
|
||||
{
|
||||
auto questInfo = g_exdData.getQuestInfo( eventId );
|
||||
if( questInfo )
|
||||
{
|
||||
pPlayer->sendUrgent( "Quest not implemented: " + questInfo->name );
|
||||
player.sendUrgent( "Quest not implemented: " + questInfo->name );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, ui
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEnterTerritory( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
|
||||
bool Core::Scripting::ScriptManager::onEnterTerritory( Core::Entity::Player& player, uint32_t eventId,
|
||||
uint16_t param1, uint16_t param2 )
|
||||
{
|
||||
std::string eventName = "onEnterTerritory";
|
||||
|
@ -146,25 +146,25 @@ bool Core::Scripting::ScriptManager::onEnterTerritory( Core::Entity::PlayerPtr p
|
|||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( objName );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::EnterTerritory, 0, pPlayer->getZoneId() );
|
||||
player.eventStart( player.getId(), eventId, Event::Event::EnterTerritory, 0, player.getZoneId() );
|
||||
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t,
|
||||
Entity::Player&, uint16_t, uint16_t ) > >( eventName );
|
||||
fn( obj, eventId, *pPlayer, param1, param2 );
|
||||
fn( obj, eventId, player, param1, param2 );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what() );
|
||||
player.sendDebug( e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onWithinRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1,
|
||||
bool Core::Scripting::ScriptManager::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||
float x, float y, float z )
|
||||
{
|
||||
std::string eventName = "onWithinRange";
|
||||
|
@ -175,25 +175,25 @@ bool Core::Scripting::ScriptManager::onWithinRange( Entity::PlayerPtr pPlayer, u
|
|||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::WithinRange, 1, param1 );
|
||||
player.eventStart( player.getId(), eventId, Event::Event::WithinRange, 1, param1 );
|
||||
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint32_t,
|
||||
float, float, float ) > >( eventName );
|
||||
fn( obj, eventId, *pPlayer, param1, x, y, z );
|
||||
fn( obj, eventId, player, param1, x, y, z );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what() );
|
||||
player.sendDebug( e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onOutsideRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1,
|
||||
bool Core::Scripting::ScriptManager::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||
float x, float y, float z )
|
||||
{
|
||||
std::string eventName = "onOutsideRange";
|
||||
|
@ -204,25 +204,25 @@ bool Core::Scripting::ScriptManager::onOutsideRange( Entity::PlayerPtr pPlayer,
|
|||
// Get object from engine
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( pPlayer->getId(), eventId, Event::Event::OutsideRange, 1, param1 );
|
||||
player.eventStart( player.getId(), eventId, Event::Event::OutsideRange, 1, param1 );
|
||||
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&, uint32_t,
|
||||
float, float, float ) > >( eventName );
|
||||
fn( obj, eventId, *pPlayer, param1, x, y, z );
|
||||
fn( obj, eventId, player, param1, x, y, z );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendDebug( e.what() );
|
||||
player.sendDebug( e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, uint64_t actorId,
|
||||
bool Core::Scripting::ScriptManager::onEmote( Core::Entity::Player& player, uint64_t actorId,
|
||||
uint32_t eventId, uint8_t emoteId )
|
||||
{
|
||||
std::string eventName = "onEmote";
|
||||
|
@ -232,15 +232,15 @@ bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, u
|
|||
{
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( actorId, eventId, Event::Event::Emote, 0, emoteId );
|
||||
player.eventStart( actorId, eventId, Event::Event::Emote, 0, emoteId );
|
||||
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&,
|
||||
uint64_t, uint8_t ) > >( eventName );
|
||||
fn( obj, eventId, *pPlayer, actorId, emoteId );
|
||||
fn( obj, eventId, player, actorId, emoteId );
|
||||
|
||||
pPlayer->checkEvent( eventId );
|
||||
player.checkEvent( eventId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, u
|
|||
auto questInfo = g_exdData.getQuestInfo( eventId );
|
||||
if( questInfo )
|
||||
{
|
||||
pPlayer->sendDebug( "Quest not implemented: " + questInfo->name + "\n" + e.what() );
|
||||
player.sendDebug( "Quest not implemented: " + questInfo->name + "\n" + e.what() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -260,12 +260,12 @@ bool Core::Scripting::ScriptManager::onEmote( Core::Entity::PlayerPtr pPlayer, u
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerReturn( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerReturn( Core::Entity::Player& player, uint32_t eventId,
|
||||
uint16_t subEvent, uint16_t param1, uint16_t param2,
|
||||
uint16_t param3 )
|
||||
{
|
||||
|
||||
pPlayer->sendDebug( "eventId: " +
|
||||
player.sendDebug( "eventId: " +
|
||||
std::to_string( eventId ) +
|
||||
" ( 0x" + boost::str( boost::format( "%|08X|" ) % ( uint64_t ) ( eventId & 0xFFFFFFF ) ) + " ) " +
|
||||
" scene: " + std::to_string( subEvent ) +
|
||||
|
@ -275,7 +275,7 @@ bool Core::Scripting::ScriptManager::onEventHandlerReturn( Core::Entity::PlayerP
|
|||
|
||||
try
|
||||
{
|
||||
auto pEvent = pPlayer->getEvent( eventId );
|
||||
auto pEvent = player.getEvent( eventId );
|
||||
if( pEvent )
|
||||
{
|
||||
pEvent->setPlayedScene( false );
|
||||
|
@ -284,27 +284,27 @@ bool Core::Scripting::ScriptManager::onEventHandlerReturn( Core::Entity::PlayerP
|
|||
// if there is one, proceed to call it
|
||||
if( eventCallback )
|
||||
{
|
||||
eventCallback( *pPlayer, eventId, param1, param2, param3 );
|
||||
eventCallback( player, eventId, param1, param2, param3 );
|
||||
if( !pEvent->hasPlayedScene() )
|
||||
pPlayer->eventFinish( eventId, 1 );
|
||||
player.eventFinish( eventId, 1 );
|
||||
else
|
||||
pEvent->setPlayedScene( false );
|
||||
}
|
||||
// else, finish the event.
|
||||
else
|
||||
pPlayer->eventFinish( eventId, 1 );
|
||||
player.eventFinish( eventId, 1 );
|
||||
}
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendNotice( e.what() );
|
||||
player.sendNotice( e.what() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::PlayerPtr pPlayer, uint32_t eventId,
|
||||
bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::Player& player, uint32_t eventId,
|
||||
uint16_t subEvent, uint16_t param, uint32_t catalogId )
|
||||
{
|
||||
std::string eventName = Event::getEventName( eventId ) + "_TRADE";
|
||||
|
@ -313,7 +313,7 @@ bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::Pl
|
|||
{
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( Entity::Player&, uint32_t,
|
||||
uint16_t, uint16_t, uint32_t ) > >( eventName );
|
||||
fn( *pPlayer, eventId, subEvent, param, catalogId );
|
||||
fn( player, eventId, subEvent, param, catalogId );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Core::Entity::Pl
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onEventItem( Entity::PlayerPtr pPlayer, uint32_t eventItemId,
|
||||
bool Core::Scripting::ScriptManager::onEventItem( Entity::Player& player, uint32_t eventItemId,
|
||||
uint32_t eventId, uint32_t castTime, uint64_t targetId )
|
||||
{
|
||||
std::string eventName = "onEventItem";
|
||||
|
@ -333,17 +333,17 @@ bool Core::Scripting::ScriptManager::onEventItem( Entity::PlayerPtr pPlayer, uin
|
|||
{
|
||||
auto obj = m_pChaiHandler->eval( Event::getEventName( eventId ) );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
pPlayer->eventStart( targetId, eventId, Event::Event::Item, 0, 0 );
|
||||
player.eventStart( targetId, eventId, Event::Event::Item, 0, 0 );
|
||||
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, uint32_t, Entity::Player&,
|
||||
uint32_t, uint32_t, uint64_t ) > >( eventName );
|
||||
fn( obj, eventId, *pPlayer, eventItemId, castTime, targetId );
|
||||
fn( obj, eventId, player, eventItemId, castTime, targetId );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendNotice( e.what() );
|
||||
player.sendNotice( e.what() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ bool Core::Scripting::ScriptManager::onEventItem( Entity::PlayerPtr pPlayer, uin
|
|||
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint16_t nameId )
|
||||
bool Core::Scripting::ScriptManager::onMobKill( Entity::Player& player, uint16_t nameId )
|
||||
{
|
||||
std::string eventName = "onBnpcKill_" + std::to_string( nameId );
|
||||
|
||||
|
@ -359,7 +359,7 @@ bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint1
|
|||
// loop through all active quests and try to call available onMobKill callbacks
|
||||
for( size_t i = 0; i < 30; i++ )
|
||||
{
|
||||
auto activeQuests = pPlayer->getQuestActive( static_cast< uint16_t >( i ) );
|
||||
auto activeQuests = player.getQuestActive( static_cast< uint16_t >( i ) );
|
||||
if( !activeQuests )
|
||||
continue;
|
||||
|
||||
|
@ -369,12 +369,12 @@ bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint1
|
|||
auto obj = m_pChaiHandler->eval( Event::getEventName( 0x00010000 | questId ) );
|
||||
std::string objName = Event::getEventName( 0x00010000 | questId );
|
||||
|
||||
pPlayer->sendDebug("Calling: " + objName + "." + eventName);
|
||||
player.sendDebug("Calling: " + objName + "." + eventName);
|
||||
|
||||
try
|
||||
{
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Player& ) > >(eventName);
|
||||
fn( obj, *pPlayer );
|
||||
fn( obj, player );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ bool Core::Scripting::ScriptManager::onMobKill( Entity::PlayerPtr pPlayer, uint1
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Core::Scripting::ScriptManager::onCastFinish( Entity::PlayerPtr pPlayer, Entity::ActorPtr pTarget, uint32_t actionId )
|
||||
bool Core::Scripting::ScriptManager::onCastFinish( Entity::Player& player, Entity::ActorPtr pTarget, uint32_t actionId )
|
||||
{
|
||||
std::string eventName = "onFinish";
|
||||
|
||||
|
@ -396,14 +396,14 @@ bool Core::Scripting::ScriptManager::onCastFinish( Entity::PlayerPtr pPlayer, En
|
|||
auto obj = m_pChaiHandler->eval( "skillDef_" + std::to_string( actionId ) );
|
||||
std::string objName = "skillDef_" + std::to_string( actionId );
|
||||
|
||||
pPlayer->sendDebug( "Calling: " + objName + "." + eventName );
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
auto fn = m_pChaiHandler->eval< std::function< void( chaiscript::Boxed_Value &, Entity::Player&,
|
||||
Entity::Actor& ) > >( eventName );
|
||||
fn( obj, *pPlayer, *pTarget );
|
||||
fn( obj, player, *pTarget );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
pPlayer->sendUrgent( e.what() );
|
||||
player.sendUrgent( e.what() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -37,20 +37,20 @@ namespace Core
|
|||
|
||||
const boost::shared_ptr< chaiscript::ChaiScript >& getHandler() const;
|
||||
|
||||
void onPlayerFirstEnterWorld( Entity::PlayerPtr pPlayer );
|
||||
void onPlayerFirstEnterWorld( Entity::Player& player );
|
||||
|
||||
static bool registerBnpcTemplate( std::string templateName, uint32_t bnpcBaseId, uint32_t bnpcNameId, uint32_t modelId, std::string aiName );
|
||||
|
||||
bool onTalk( Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId );
|
||||
bool onEnterTerritory( Entity::PlayerPtr pPlayer, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
||||
bool onWithinRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
bool onOutsideRange( Entity::PlayerPtr pPlayer, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
bool onEmote( Entity::PlayerPtr pPlayer, uint64_t actorId, uint32_t eventId, uint8_t emoteId );
|
||||
bool onEventItem( Entity::PlayerPtr pPlayer, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId );
|
||||
bool onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId );
|
||||
bool onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
||||
bool onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
bool onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
bool onEmote( Entity::Player& player, uint64_t actorId, uint32_t eventId, uint8_t emoteId );
|
||||
bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId );
|
||||
|
||||
bool onMobKill( Entity::PlayerPtr pPlayer, uint16_t nameId );
|
||||
bool onMobKill( Entity::Player& player, uint16_t nameId );
|
||||
|
||||
bool onCastFinish( Entity::PlayerPtr pPlayer, Entity::ActorPtr pTarget, uint32_t actionId );
|
||||
bool onCastFinish( Entity::Player& pPlayer, Entity::ActorPtr pTarget, uint32_t actionId );
|
||||
|
||||
bool onStatusReceive( Entity::ActorPtr pActor, uint32_t effectId );
|
||||
bool onStatusTick( Entity::ActorPtr pActor, Core::StatusEffect::StatusEffect& effect );
|
||||
|
@ -58,8 +58,8 @@ namespace Core
|
|||
|
||||
bool onZoneInit( ZonePtr pZone );
|
||||
|
||||
bool onEventHandlerReturn( Entity::PlayerPtr pPlayer, uint32_t eventId, uint16_t subEvent, uint16_t param1, uint16_t param2, uint16_t param3 );
|
||||
bool onEventHandlerTradeReturn( Entity::PlayerPtr pPlayer, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId );
|
||||
bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1, uint16_t param2, uint16_t param3 );
|
||||
bool onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId );
|
||||
|
||||
|
||||
void loadDir( std::string dirname, std::set<std::string>& chaiFiles );
|
||||
|
|
|
@ -354,18 +354,18 @@ void Zone::removeActor( Entity::ActorPtr pActor )
|
|||
|
||||
}
|
||||
|
||||
void Zone::queueOutPacketForRange( Entity::PlayerPtr pSourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry )
|
||||
void Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry )
|
||||
{
|
||||
for( auto it = m_playerMap.begin(); it != m_playerMap.end(); ++it )
|
||||
{
|
||||
float distance = Math::Util::distance( pSourcePlayer->getPos().x,
|
||||
pSourcePlayer->getPos().y,
|
||||
pSourcePlayer->getPos().z,
|
||||
float distance = Math::Util::distance( sourcePlayer.getPos().x,
|
||||
sourcePlayer.getPos().y,
|
||||
sourcePlayer.getPos().z,
|
||||
( *it ).second->getPos().x,
|
||||
( *it ).second->getPos().y,
|
||||
( *it ).second->getPos().z );
|
||||
|
||||
if( ( distance < range ) && pSourcePlayer->getId() != ( *it ).second->getId() )
|
||||
if( ( distance < range ) && sourcePlayer.getId() != ( *it ).second->getId() )
|
||||
{
|
||||
auto pSession = g_serverZone.getSession( ( *it ).second->getId() );
|
||||
pPacketEntry->setValAt<uint32_t>( 0x08, ( *it ).second->getId() );
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
||||
|
||||
void queueOutPacketForRange( Entity::PlayerPtr pSourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry );
|
||||
void queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry );
|
||||
|
||||
virtual uint32_t getId();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue