1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 08:27:46 +00:00

removed all unused state flags, mapped more client actions

This commit is contained in:
Mordred 2018-02-15 23:50:28 +01:00
parent 50f90d960b
commit 5d8b5786d6
11 changed files with 48 additions and 86 deletions

View file

@ -380,73 +380,21 @@ namespace Common {
InvincibilityStayAlive, InvincibilityStayAlive,
}; };
enum struct PlayerStateFlag : uint8_t enum PlayerStateFlag : uint8_t
{ {
NoCombat, HideUILockChar = 0, // as the name suggests, hides the ui and logs the char...
Combat, InCombat = 1, // in Combat, locks gearchange/return/teleport
Casting, Casting = 2,
StatusAffliction, InNpcEvent = 7, // when talking to an npc, locks ui giving "occupied" message
StatusAffliction1,
Occupied,
Occupied1,
Occupied2,
Occupied3,
BoundByDuty, InNpcEvent1 = 10, // Sent together with InNpcEvent, when waiting for input? just a guess...
Occupied4,
DuelingArea,
TradeOpen,
Occupied5,
HandlingItems,
Crafting,
PreparingToCraft,
Gathering,
Fishing,
BeingRaised, BoundByDuty = 11,
BetweenAreas,
Stealthed,
InnRoom,
Jumping,
AutoRun,
Occupied6,
BetweenAreas1,
SystemError,
LoggingOut,
InvalidLocation, BetweenAreas = 24,
WaitingForDuty,
BoundByDuty1,
Mounting,
WatchingCutscene,
WaitingForDutyFinder,
CreatingCharacter,
Jumping1,
PvpDisplay,
StatusAfflication2,
Mounting1, WatchingCutscene = 50, // this is actually just a dummy, this id is different
CarryingItem,
UsingPartyFinder,
HousingFunctions,
Transformed,
FreeTrail,
BeingMoved,
Mounting2,
StatusAffliction3,
StatusAffliction4,
RegisteringRaceOrMatch,
WaitingForRaceOrMatch,
WaitingForTripleTriadMatch,
InFlight,
WatchingCutscene1,
DeepDungeon,
Swimming,
Diving,
RegisteringTripleTriad,
WaitingTripleTriad,
InCrossWorldParty
}; };

View file

@ -826,10 +826,8 @@ struct FFXIVIpcActorOwner : FFXIVIpcBasePacket<ActorOwner>
*/ */
struct FFXIVIpcPlayerStateFlags : FFXIVIpcBasePacket<PlayerStateFlags> struct FFXIVIpcPlayerStateFlags : FFXIVIpcBasePacket<PlayerStateFlags>
{ {
uint8_t flags[7]; uint8_t flags[12];
uint8_t padding1[3]; uint32_t padding;
uint32_t padding2;
uint16_t padding;
}; };
/** /**

View file

@ -83,7 +83,7 @@ void Core::Action::ActionCast::onInterrupt()
if( !m_pSource ) if( !m_pSource )
return; return;
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 ); //m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting ); m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,

View file

@ -94,7 +94,7 @@ void Core::Action::ActionMount::onInterrupt()
if( !m_pSource ) if( !m_pSource )
return; return;
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 ); //m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting ); m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,

View file

@ -53,7 +53,7 @@ void Core::Action::EventAction::onStart()
if( m_pSource->isPlayer() ) if( m_pSource->isPlayer() )
{ {
m_pSource->sendToInRangeSet( control, true ); m_pSource->sendToInRangeSet( control, true );
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Occupied2 ); //m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Occupied2 );
} }
else else
m_pSource->sendToInRangeSet( control ); m_pSource->sendToInRangeSet( control );
@ -82,7 +82,7 @@ void Core::Action::EventAction::onFinish()
if( m_pSource->isPlayer() ) if( m_pSource->isPlayer() )
{ {
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied2 ); //m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied2 );
m_pSource->sendToInRangeSet( control, true ); m_pSource->sendToInRangeSet( control, true );
} }
else else
@ -110,8 +110,8 @@ void Core::Action::EventAction::onInterrupt()
{ {
auto control1 = ActorControlPacket143( m_pSource->getId(), ActorControlType::FreeEventPos, m_eventId ); auto control1 = ActorControlPacket143( m_pSource->getId(), ActorControlType::FreeEventPos, m_eventId );
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::NoCombat ); //m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::NoCombat );
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 ); //m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
m_pSource->sendToInRangeSet( control ); m_pSource->sendToInRangeSet( control );
m_pSource->sendToInRangeSet( control1 ); m_pSource->sendToInRangeSet( control1 );

View file

@ -177,7 +177,7 @@ Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
if( m_onlineStatus & rpMask ) if( m_onlineStatus & rpMask )
status = OnlineStatus::Roleplaying; status = OnlineStatus::Roleplaying;
if( hasStateFlag( PlayerStateFlag::WatchingCutscene ) || hasStateFlag( PlayerStateFlag::WatchingCutscene1 ) ) if( hasStateFlag( PlayerStateFlag::WatchingCutscene ) )
status = OnlineStatus::ViewingCutscene; status = OnlineStatus::ViewingCutscene;
// TODO: add all the logic for returning the proper online status, there probably is a better way for this alltogether // TODO: add all the logic for returning the proper online status, there probably is a better way for this alltogether

View file

@ -637,7 +637,7 @@ private:
boost::shared_ptr< Common::QuestActive > m_activeQuests[30]; boost::shared_ptr< Common::QuestActive > m_activeQuests[30];
int16_t m_questTracking[5]; int16_t m_questTracking[5];
uint8_t m_stateFlags[7]; uint8_t m_stateFlags[12];
uint8_t m_gmRank; uint8_t m_gmRank;
uint16_t zoneId; uint16_t zoneId;

View file

@ -84,7 +84,7 @@ void Core::Entity::Player::eventStart( uint64_t actorId, uint32_t eventId,
addEvent( newEvent ); addEvent( newEvent );
setStateFlag( PlayerStateFlag::Occupied2 ); setStateFlag( PlayerStateFlag::InNpcEvent );
EventStartPacket eventStart( getId(), actorId, eventId, eventType, eventParam1, eventParam2 ); EventStartPacket eventStart( getId(), actorId, eventId, eventType, eventParam1, eventParam2 );
@ -218,7 +218,7 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
removeEvent( pEvent->getId() ); removeEvent( pEvent->getId() );
if( freePlayer == 1 ) if( freePlayer == 1 )
unsetStateFlag( PlayerStateFlag::Occupied2 ); unsetStateFlag( PlayerStateFlag::InNpcEvent );
} }
void Core::Entity::Player::eventActionStart( uint32_t eventId, void Core::Entity::Player::eventActionStart( uint32_t eventId,
@ -290,7 +290,6 @@ void Core::Entity::Player::onDeath()
} }
// TODO: slightly ugly here and way too static. Needs too be done properly // TODO: slightly ugly here and way too static. Needs too be done properly
void Core::Entity::Player::onTick() void Core::Entity::Player::onTick()
{ {

View file

@ -117,6 +117,10 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
player.getCurrentAction()->setInterrupted(); player.getCurrentAction()->setInterrupted();
break; break;
} }
case 0x12D: // Mark player
{
break;
}
case 0x12E: // Set player title case 0x12E: // Set player title
{ {
player.setTitle( static_cast< uint16_t >( param1 ) ); player.setTitle( static_cast< uint16_t >( param1 ) );
@ -132,7 +136,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
} }
case 0x133: // Update howtos seen case 0x133: // Update howtos seen
{ {
uint32_t howToId = static_cast< uint32_t >( param1 ); uint32_t howToId = param11;
player.updateHowtosSeen( howToId ); player.updateHowtosSeen( howToId );
break; break;
} }
@ -144,7 +148,23 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
player.sendToInRangeSet( ActorControlPacket144( player.getId(), Emote, emoteId, 0, 0, 0, targetId ) ); player.sendToInRangeSet( ActorControlPacket144( player.getId(), Emote, emoteId, 0, 0, 0, targetId ) );
break; break;
} }
case 0xC8: // return dead case 0x1F7: // cancel persistant emote
{
break;
}
case 0x1F9: // change pose
{
break;
}
case 0x1FA: // reapply pose
{
break;
}
case 0x1FB: // cancel pose
{
break;
}
case 0xC8: // return dead / accept raise
{ {
switch ( static_cast < ResurrectType >( param1 ) ) switch ( static_cast < ResurrectType >( param1 ) )
{ {
@ -193,7 +213,6 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
player.setZoningType( Common::ZoneingType::None ); player.setZoningType( Common::ZoneingType::None );
player.unsetStateFlag( PlayerStateFlag::BetweenAreas ); player.unsetStateFlag( PlayerStateFlag::BetweenAreas );
player.unsetStateFlag( PlayerStateFlag::BetweenAreas1 );
break; break;
} }

View file

@ -564,16 +564,14 @@ void Core::Network::GameConnection::tellHandler( const Packets::GamePacket& inPa
auto pTargetPlayer = pSession->getPlayer(); auto pTargetPlayer = pSession->getPlayer();
if( pTargetPlayer->hasStateFlag( PlayerStateFlag::BetweenAreas ) || if( pTargetPlayer->hasStateFlag( PlayerStateFlag::BetweenAreas ) )
pTargetPlayer->hasStateFlag( PlayerStateFlag::BetweenAreas1 ) )
{ {
// send error for player between areas // send error for player between areas
// TODO: implement me // TODO: implement me
return; return;
} }
if( pTargetPlayer->hasStateFlag( PlayerStateFlag::BoundByDuty ) || if( pTargetPlayer->hasStateFlag( PlayerStateFlag::BoundByDuty ) )
pTargetPlayer->hasStateFlag( PlayerStateFlag::BoundByDuty1 ) )
{ {
// send error for player bound by duty // send error for player bound by duty
// TODO: implement me // TODO: implement me

View file

@ -26,8 +26,8 @@ public:
PlayerStateFlagsPacket( Entity::Player& player, std::vector< Common::PlayerStateFlag > flags ) : PlayerStateFlagsPacket( Entity::Player& player, std::vector< Common::PlayerStateFlag > flags ) :
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() ) ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() )
{ {
uint8_t newFlags[7]; uint8_t newFlags[12];
memset( newFlags, 0, 7 ); memset( newFlags, 0, 12 );
for( auto& flag : flags ) for( auto& flag : flags )
{ {
@ -46,7 +46,7 @@ public:
private: private:
void initialize( const uint8_t* flags ) void initialize( const uint8_t* flags )
{ {
memcpy( m_data.flags, flags, 7 ); memcpy( m_data.flags, flags, 12 );
}; };
}; };