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

Merge pull request #471 from JeidoUran/crashes_fix

Several crashes fixed, GM Jump and Call fixed and closer to retail
This commit is contained in:
Adam 2019-01-09 18:58:06 +11:00 committed by GitHub
commit 07d0dc59ea
5 changed files with 52 additions and 16 deletions

View file

@ -21,7 +21,7 @@ struct FFXIVIpcTell :
uint16_t u2b; uint16_t u2b;
uint8_t preName; uint8_t preName;
uint8_t u3a; uint8_t u3a;
uint8_t u3b; //Setting this to 1 seems to mark the tell as a GM tell (More research needed) bool isGm;
char receipientName[32]; char receipientName[32];
char msg[1031]; char msg[1031];
}; };

View file

@ -1441,7 +1441,7 @@ struct FFXIVIpcPrepareZoning :
uint8_t fadeOut; uint8_t fadeOut;
uint8_t param7; uint8_t param7;
uint8_t fadeOutTime; uint8_t fadeOutTime;
uint8_t unknown; uint8_t unknown; // this changes whether or not the destination zone's name displays during the loading screen. Seems to always be 9 (=hidden) when going to an instance and certain zones, 0 otherwise.
uint16_t padding; uint16_t padding;
}; };

View file

@ -534,7 +534,7 @@ namespace Sapphire::Entity
void teleportQuery( uint16_t aetheryteId, FrameworkPtr pFw ); void teleportQuery( uint16_t aetheryteId, FrameworkPtr pFw );
/*! prepares zoning / fades out the screen */ /*! prepares zoning / fades out the screen */
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 ); void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime = 0, uint16_t animation = 0 );
/*! get player's title list (available titles) */ /*! get player's title list (available titles) */
uint8_t* getTitleList(); uint8_t* getTitleList();

View file

@ -142,8 +142,11 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
for( auto actor : inRange ) for( auto actor : inRange )
{ {
targetPlayer->despawn( actor->getAsPlayer() ); if( actor->isPlayer() )
targetPlayer->spawn( actor->getAsPlayer() ); {
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
} }
break; break;
} }
@ -155,8 +158,11 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
for( auto actor : inRange ) for( auto actor : inRange )
{ {
targetPlayer->despawn( actor->getAsPlayer() ); if( actor->isPlayer() )
targetPlayer->spawn( actor->getAsPlayer() ); {
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
} }
break; break;
} }
@ -168,8 +174,11 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
auto inRange = targetActor->getInRangeActors(); auto inRange = targetActor->getInRangeActors();
for( auto actor : inRange ) for( auto actor : inRange )
{ {
targetPlayer->despawn( actor->getAsPlayer() ); if( actor->isPlayer() )
targetPlayer->spawn( actor->getAsPlayer() ); {
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
} }
break; break;
} }
@ -230,8 +239,11 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
for( auto actor : player.getInRangeActors() ) for( auto actor : player.getInRangeActors() )
{ {
player.despawn( actor->getAsPlayer() ); if( actor->isPlayer() )
player.spawn( actor->getAsPlayer() ); {
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
} }
break; break;
} }
@ -610,12 +622,25 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw,
} }
case GmCommand::Jump: case GmCommand::Jump:
{ {
if( targetPlayer->getZoneId() != player.getZoneId() ) player.prepareZoning( targetPlayer->getZoneId(), true, 1, 0 );
if( player.getCurrentInstance() )
{ {
player.setZone( targetPlayer->getZoneId() ); player.exitInstance();
}
if( targetPlayer->getCurrentZone()->getGuId() != player.getCurrentZone()->getGuId() )
{
// Checks if the target player is in an InstanceContent to avoid binding to a Zone or PublicContent
if( targetPlayer->getCurrentInstance() )
{
auto pInstanceContent = targetPlayer->getCurrentInstance()->getAsInstanceContent();
// Not sure if GMs actually get bound to an instance they jump to on retail. It's mostly here to avoid a crash for now
pInstanceContent->bindPlayer( player.getId() );
}
player.setInstance( targetPlayer->getCurrentZone()->getGuId() );
} }
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z, player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
targetActor->getRot() ); targetActor->getRot() );
player.sendZoneInPackets( 0x00, 0x00, 0, 0, false );
player.sendNotice( "Jumping to {0}", targetPlayer->getName() ); player.sendNotice( "Jumping to {0}", targetPlayer->getName() );
break; break;
} }
@ -627,10 +652,17 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw,
player.sendUrgent( "You are unable to call a player while bound to a battle instance." ); player.sendUrgent( "You are unable to call a player while bound to a battle instance." );
return; return;
} }
targetPlayer->prepareZoning( player.getZoneId(), true, 1, 0 );
targetPlayer->setInstance( player.getCurrentZone() ); if( targetPlayer->getCurrentInstance() )
{
targetPlayer->exitInstance();
}
if( targetPlayer->getCurrentZone()->getGuId() != player.getCurrentZone()->getGuId() )
{
targetPlayer->setInstance( player.getCurrentZone()->getGuId() );
}
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() ); targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() );
targetPlayer->sendZoneInPackets( 0x00, 0x00, 0, 0, false );
player.sendNotice( "Calling {0}", targetPlayer->getName() ); player.sendNotice( "Calling {0}", targetPlayer->getName() );
break; break;
} }

View file

@ -656,6 +656,10 @@ void Sapphire::Network::GameConnection::tellHandler( FrameworkPtr pFw,
//tellPacket.data().u1 = 0x92CD7337; //tellPacket.data().u1 = 0x92CD7337;
//tellPacket.data().u2a = 0x2E; //tellPacket.data().u2a = 0x2E;
//tellPacket.data().u2b = 0x40; //tellPacket.data().u2b = 0x40;
if( player.isActingAsGm() )
{
tellPacket->data().isGm = true;
}
pTargetPlayer->queueChatPacket( tellPacket ); pTargetPlayer->queueChatPacket( tellPacket );
} }