mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37:45 +00:00
Merge pull request #286 from AcedArmy/actor_rewrite
Added a whole lot of GM Stuff
This commit is contained in:
commit
d35a406f7a
6 changed files with 94 additions and 44 deletions
|
@ -150,6 +150,16 @@ namespace Core {
|
||||||
m_gmRank = rank;
|
m_gmRank = rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getGmInvis() const
|
||||||
|
{
|
||||||
|
return m_gmInvis;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setGmInvis( bool invis )
|
||||||
|
{
|
||||||
|
m_gmInvis = invis;
|
||||||
|
}
|
||||||
|
|
||||||
void createInvDbContainer( uint16_t slot ) const;
|
void createInvDbContainer( uint16_t slot ) const;
|
||||||
|
|
||||||
uint32_t m_modelEquip[10];
|
uint32_t m_modelEquip[10];
|
||||||
|
@ -177,6 +187,7 @@ namespace Core {
|
||||||
uint8_t m_look[26];
|
uint8_t m_look[26];
|
||||||
|
|
||||||
uint8_t m_gmRank;
|
uint8_t m_gmRank;
|
||||||
|
bool m_gmInvis;
|
||||||
|
|
||||||
char m_name[34];
|
char m_name[34];
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,16 @@ void Core::Entity::Player::setGmRank( uint8_t rank )
|
||||||
m_gmRank = rank;
|
m_gmRank = rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Core::Entity::Player::getGmInvis() const
|
||||||
|
{
|
||||||
|
return m_gmInvis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Player::setGmInvis( bool invis )
|
||||||
|
{
|
||||||
|
m_gmInvis = invis;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t Core::Entity::Player::getMode() const
|
uint8_t Core::Entity::Player::getMode() const
|
||||||
{
|
{
|
||||||
return m_mode;
|
return m_mode;
|
||||||
|
@ -159,43 +169,32 @@ bool Core::Entity::Player::isMarkedForRemoval() const
|
||||||
|
|
||||||
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
|
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
|
||||||
{
|
{
|
||||||
uint64_t newMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::NewAdventurer );
|
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||||
uint64_t afkMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::AwayfromKeyboard );
|
if( !pExdData )
|
||||||
uint64_t busyMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Busy );
|
return OnlineStatus::Online;
|
||||||
uint64_t dcMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Disconnected );
|
|
||||||
uint64_t meldMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LookingtoMeldMateria );
|
|
||||||
uint64_t ptMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::LookingforParty );
|
|
||||||
uint64_t rpMask = uint64_t( 1 ) << static_cast< uint32_t >( OnlineStatus::Roleplaying );
|
|
||||||
|
|
||||||
OnlineStatus status = OnlineStatus::Online;
|
uint32_t statusDisplayOrder = 0xFF14;
|
||||||
|
uint32_t applicableStatus = 0;
|
||||||
|
|
||||||
//if( hasStateFlag( Common::PlayerStateFlag::NewAdventurer ) )
|
for( uint32_t i = 0; i < std::numeric_limits< decltype( m_onlineStatus ) >::digits; i++ )
|
||||||
if( m_onlineStatus & newMask )
|
{
|
||||||
status = OnlineStatus::NewAdventurer;
|
bool bit = ( m_onlineStatus >> i ) & 1;
|
||||||
|
|
||||||
if( m_onlineStatus & afkMask )
|
if( !bit )
|
||||||
status = OnlineStatus::AwayfromKeyboard;
|
continue;
|
||||||
|
|
||||||
if( m_onlineStatus & busyMask )
|
auto pOnlineStatus = pExdData->get< Data::OnlineStatus >( i );
|
||||||
status = OnlineStatus::Busy;
|
if( !pOnlineStatus )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( m_onlineStatus & dcMask )
|
if( pOnlineStatus->priority < statusDisplayOrder )
|
||||||
status = OnlineStatus::Disconnected;
|
{
|
||||||
|
// todo: also check that the status can actually be set here, otherwise we need to ignore it (and ban the player obv)
|
||||||
if( m_onlineStatus & meldMask )
|
statusDisplayOrder = pOnlineStatus->priority;
|
||||||
status = OnlineStatus::LookingtoMeldMateria;
|
applicableStatus = i;
|
||||||
|
return static_cast< OnlineStatus >( applicableStatus );
|
||||||
if( m_onlineStatus & ptMask )
|
}
|
||||||
status = OnlineStatus::LookingforParty;
|
}
|
||||||
|
|
||||||
if( m_onlineStatus & rpMask )
|
|
||||||
status = OnlineStatus::Roleplaying;
|
|
||||||
|
|
||||||
if( hasStateFlag( PlayerStateFlag::WatchingCutscene ) )
|
|
||||||
status = OnlineStatus::ViewingCutscene;
|
|
||||||
|
|
||||||
// TODO: add all the logic for returning the proper online status, there probably is a better way for this alltogether
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setOnlineStatusMask( uint64_t status )
|
void Core::Entity::Player::setOnlineStatusMask( uint64_t status )
|
||||||
|
@ -1601,16 +1600,34 @@ void Core::Entity::Player::sendTitleList()
|
||||||
queuePacket( titleListPacket );
|
queuePacket( titleListPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Player::sendZoneInPackets( uint32_t param1, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, bool shouldSetStatus = false )
|
||||||
|
{
|
||||||
|
auto zoneInPacket = ActorControlPacket143( getId(), ZoneIn, param1, param2, param3, param4 );
|
||||||
|
auto SetStatusPacket = ActorControlPacket142( getId(), SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) );
|
||||||
|
|
||||||
|
if( !getGmInvis() )
|
||||||
|
sendToInRangeSet( zoneInPacket, true );
|
||||||
|
if( shouldSetStatus )
|
||||||
|
sendToInRangeSet( SetStatusPacket );
|
||||||
|
else
|
||||||
|
queuePacket( zoneInPacket );
|
||||||
|
if ( shouldSetStatus )
|
||||||
|
queuePacket( SetStatusPacket );
|
||||||
|
|
||||||
|
setZoningType( Common::ZoneingType::None );
|
||||||
|
unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
||||||
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::finishZoning()
|
void Core::Entity::Player::finishZoning()
|
||||||
{
|
{
|
||||||
switch( getZoningType() )
|
switch( getZoningType() )
|
||||||
{
|
{
|
||||||
case ZoneingType::None:
|
case ZoneingType::None:
|
||||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01 ), true );
|
sendZoneInPackets( 0x01 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZoneingType::Teleport:
|
case ZoneingType::Teleport:
|
||||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01, 0, 0, 110 ), true );
|
sendZoneInPackets( 0x01, 0, 0, 110 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZoneingType::Return:
|
case ZoneingType::Return:
|
||||||
|
@ -1621,22 +1638,16 @@ void Core::Entity::Player::finishZoning()
|
||||||
resetHp();
|
resetHp();
|
||||||
resetMp();
|
resetMp();
|
||||||
setStatus( Entity::Chara::ActorStatus::Idle );
|
setStatus( Entity::Chara::ActorStatus::Idle );
|
||||||
|
sendZoneInPackets( 0x01, 0x01, 0, 111, true );
|
||||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), SetStatus,
|
|
||||||
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) ), true );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sendToInRangeSet( ActorControlPacket143( getId(), ZoneIn, 0x01, 0x00, 0, 111 ), true );
|
sendZoneInPackets( 0x01, 0x00, 0, 111 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZoneingType::FadeIn:
|
case ZoneingType::FadeIn:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setZoningType( Common::ZoneingType::None );
|
|
||||||
unsetStateFlag( PlayerStateFlag::BetweenAreas );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::emote( uint32_t emoteId, uint64_t targetId )
|
void Core::Entity::Player::emote( uint32_t emoteId, uint64_t targetId )
|
||||||
|
|
|
@ -509,6 +509,8 @@ public:
|
||||||
|
|
||||||
void emote( uint32_t emoteId, uint64_t targetId );
|
void emote( uint32_t emoteId, uint64_t targetId );
|
||||||
|
|
||||||
|
void sendZoneInPackets( uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, bool pSetStatus );
|
||||||
|
|
||||||
void finishZoning();
|
void finishZoning();
|
||||||
|
|
||||||
void sendZonePackets();
|
void sendZonePackets();
|
||||||
|
@ -546,6 +548,9 @@ public:
|
||||||
uint8_t getGmRank() const;
|
uint8_t getGmRank() const;
|
||||||
void setGmRank( uint8_t rank );
|
void setGmRank( uint8_t rank );
|
||||||
|
|
||||||
|
bool getGmInvis() const;
|
||||||
|
void setGmInvis( bool invis );
|
||||||
|
|
||||||
uint8_t getMode() const;
|
uint8_t getMode() const;
|
||||||
void setMode( uint8_t mode );
|
void setMode( uint8_t mode );
|
||||||
|
|
||||||
|
@ -671,6 +676,7 @@ private:
|
||||||
uint8_t m_stateFlags[12];
|
uint8_t m_stateFlags[12];
|
||||||
uint8_t m_gmRank;
|
uint8_t m_gmRank;
|
||||||
uint16_t zoneId;
|
uint16_t zoneId;
|
||||||
|
bool m_gmInvis = false;
|
||||||
|
|
||||||
uint8_t m_equipDisplayFlags;
|
uint8_t m_equipDisplayFlags;
|
||||||
|
|
||||||
|
|
|
@ -224,6 +224,19 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
||||||
player.sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
player.sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GmCommand::Invis:
|
||||||
|
{
|
||||||
|
player.setGmInvis( !player.getGmInvis() );
|
||||||
|
player.sendNotice( "Invisibility flag for " + player.getName() +
|
||||||
|
" was toggled to " + std::to_string( !player.getGmInvis() ) );
|
||||||
|
|
||||||
|
for( auto actor : player.getInRangeActors() )
|
||||||
|
{
|
||||||
|
player.despawn( actor->getAsPlayer() );
|
||||||
|
player.spawn( actor->getAsPlayer() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case GmCommand::Kill:
|
case GmCommand::Kill:
|
||||||
{
|
{
|
||||||
targetActor->getAsChara()->takeDamage( 9999999 );
|
targetActor->getAsChara()->takeDamage( 9999999 );
|
||||||
|
|
|
@ -515,16 +515,25 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
||||||
{
|
{
|
||||||
case ChatType::Say:
|
case ChatType::Say:
|
||||||
{
|
{
|
||||||
|
if (player.getGmRank() > 0)
|
||||||
|
chatPacket.data().chatType = ChatType::GMSay;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatType::Yell:
|
case ChatType::Yell:
|
||||||
{
|
{
|
||||||
|
if( player.getGmRank() > 0 )
|
||||||
|
chatPacket.data().chatType = ChatType::GMYell;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatType::Shout:
|
case ChatType::Shout:
|
||||||
{
|
{
|
||||||
|
if( player.getGmRank() > 0 )
|
||||||
|
chatPacket.data().chatType = ChatType::GMShout;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace Server {
|
||||||
// 0x20 == spawn hidden to be displayed by the spawneffect control
|
// 0x20 == spawn hidden to be displayed by the spawneffect control
|
||||||
m_data.displayFlags = player.getStance();
|
m_data.displayFlags = player.getStance();
|
||||||
|
|
||||||
if( player.getZoningType() != Common::ZoneingType::None )
|
if( player.getZoningType() != Common::ZoneingType::None || player.getGmInvis() == true )
|
||||||
{
|
{
|
||||||
m_data.displayFlags |= Entity::Chara::DisplayFlags::Invisible;
|
m_data.displayFlags |= Entity::Chara::DisplayFlags::Invisible;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue