1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 08:57:44 +00:00

Simplified actorcontrol creation

This commit is contained in:
Mordred 2018-08-28 19:05:52 +02:00
parent c3e715128f
commit eb5a567730
27 changed files with 192 additions and 179 deletions

View file

@ -63,6 +63,36 @@ namespace Common {
CardStand = 0x0E, CardStand = 0x0E,
}; };
enum Stance : uint8_t
{
Passive = 0,
Active = 1,
};
enum class DisplayFlags : uint16_t
{
ActiveStance = 0x001,
Invisible = 0x020,
HideHead = 0x040,
HideWeapon = 0x080,
Faded = 0x100,
Visor = 0x800,
};
enum struct ActorStatus : uint8_t
{
Idle = 0x01,
Dead = 0x02,
Sitting = 0x03,
Mounted = 0x04,
Crafting = 0x05,
Gathering = 0x06,
Melding = 0x07,
SMachine = 0x08,
Carry = 0x09,
EmoteMode = 0x0B
};
enum GearSetSlot : uint8_t enum GearSetSlot : uint8_t
{ {
MainHand = 0, MainHand = 0,

View file

@ -41,6 +41,12 @@ boost::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
return boost::make_shared< ZoneChannelPacket< T > >( args... ); return boost::make_shared< ZoneChannelPacket< T > >( args... );
} }
template< class T, typename... Args >
boost::shared_ptr< T > makeWrappedPacket( Args... args )
{
return boost::make_shared< T >( args... );
}
template< class T, typename... Args > template< class T, typename... Args >
boost::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args ) boost::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
{ {

View file

@ -92,8 +92,7 @@ void Core::Action::ActionCast::onInterrupt()
//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 = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt, auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );
0x219, 1, m_id, 0 );
// Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example: // Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example:
// auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 ); // auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );

View file

@ -97,8 +97,7 @@ void Core::Action::ActionMount::onInterrupt()
//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 = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt, auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );
0x219, 1, m_id, 0 );
// Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example: // Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example:
// auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 ); // auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );

View file

@ -81,7 +81,7 @@ void Core::Action::ActionTeleport::onFinish()
pPlayer->unsetStateFlag( PlayerStateFlag::Casting ); pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
// TODO: not sure if this ever gets sent // TODO: not sure if this ever gets sent
//auto control = Network::Packets::Server::ActorControlPacket142( m_pSource->getId(), Common::ActorControlType::TeleportDone ); //auto control = makeActorControl142( m_pSource->getId(), Common::ActorControlType::TeleportDone );
//m_pSource->sendToInRangeSet( control, false ); //m_pSource->sendToInRangeSet( control, false );
pPlayer->setZoningType( ZoneingType::Teleport ); pPlayer->setZoningType( ZoneingType::Teleport );
@ -101,8 +101,7 @@ void Core::Action::ActionTeleport::onInterrupt()
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting ); m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt, auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 0x04, m_id, 0 );
0x219, 0x04, m_id, 0 );
m_pSource->sendToInRangeSet( control, true ); m_pSource->sendToInRangeSet( control, true );
} }

View file

@ -52,8 +52,7 @@ void Core::Action::EventAction::onStart()
m_startTime = Util::getTimeMs(); m_startTime = Util::getTimeMs();
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastStart, auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastStart, 1, m_id, 0x4000004E );
1, m_id, 0x4000004E );
if( m_pSource->isPlayer() ) if( m_pSource->isPlayer() )
{ {
@ -79,8 +78,7 @@ void Core::Action::EventAction::onFinish()
if( m_onActionFinishClb ) if( m_onActionFinishClb )
m_onActionFinishClb( *m_pSource->getAsPlayer(), m_eventId, m_additional ); m_onActionFinishClb( *m_pSource->getAsPlayer(), m_eventId, m_additional );
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastStart, auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastStart, 0, m_id );
0, m_id );
if( !pEvent->hasPlayedScene() ) if( !pEvent->hasPlayedScene() )
m_pSource->getAsPlayer()->eventFinish( m_eventId, 1 ); m_pSource->getAsPlayer()->eventFinish( m_eventId, 1 );
@ -111,13 +109,11 @@ void Core::Action::EventAction::onInterrupt()
try try
{ {
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt, auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 0x04, m_id );
0x219, 0x04, m_id );
if( m_pSource->isPlayer() ) if( m_pSource->isPlayer() )
{ {
auto control1 = boost::make_shared< ActorControlPacket143 >( m_pSource->getId(), ActorControlType::FreeEventPos, auto control1 = makeActorControl143( m_pSource->getId(), ActorControlType::FreeEventPos, m_eventId );
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 );

View file

@ -96,8 +96,7 @@ void Core::Action::EventItemAction::onInterrupt()
try try
{ {
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt, auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 0x04, m_id );
0x219, 0x04, m_id );
if( m_pSource->isPlayer() ) if( m_pSource->isPlayer() )
{ {
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting ); m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );

View file

@ -26,6 +26,7 @@
#include "Player.h" #include "Player.h"
#include "Zone/TerritoryMgr.h" #include "Zone/TerritoryMgr.h"
#include "Framework.h" #include "Framework.h"
#include "Common.h"
extern Core::Framework g_fw; extern Core::Framework g_fw;
@ -57,7 +58,7 @@ std::string Core::Entity::Chara::getName() const
/*! \return current stance of the actors */ /*! \return current stance of the actors */
Core::Entity::Chara::Stance Core::Entity::Chara::getStance() const Core::Common::Stance Core::Entity::Chara::getStance() const
{ {
return m_currentStance; return m_currentStance;
} }
@ -188,7 +189,7 @@ void Core::Entity::Chara::setInvincibilityType( Common::InvincibilityType type )
} }
/*! \return current status of the actor */ /*! \return current status of the actor */
Core::Entity::Chara::ActorStatus Core::Entity::Chara::getStatus() const Core::Common::ActorStatus Core::Entity::Chara::getStatus() const
{ {
return m_status; return m_status;
} }
@ -216,15 +217,13 @@ void Core::Entity::Chara::die()
// if the actor is a player, the update needs to be send to himself too // if the actor is a player, the update needs to be send to himself too
bool selfNeedsUpdate = isPlayer(); bool selfNeedsUpdate = isPlayer();
FFXIVPacketBasePtr packet FFXIVPacketBasePtr packet = makeActorControl142( m_id, SetStatus, static_cast< uint8_t >( ActorStatus::Dead ) );
= boost::make_shared< ActorControlPacket142 >( m_id, SetStatus, static_cast< uint8_t >( ActorStatus::Dead ) );
sendToInRangeSet( packet, selfNeedsUpdate ); sendToInRangeSet( packet, selfNeedsUpdate );
// TODO: not all actor show the death animation when they die, some quest npcs might just despawn // TODO: not all actor show the death animation when they die, some quest npcs might just despawn
// although that might be handled by setting the HP to 1 and doing some script magic // although that might be handled by setting the HP to 1 and doing some script magic
FFXIVPacketBasePtr packet1 FFXIVPacketBasePtr packet1 = makeActorControl142( m_id, DeathAnimation, 0, 0, 0, 0x20 );
= boost::make_shared< ActorControlPacket142 >( m_id, DeathAnimation, 0, 0, 0, 0x20 );
sendToInRangeSet( packet1, selfNeedsUpdate ); sendToInRangeSet( packet1, selfNeedsUpdate );
} }
@ -258,7 +257,7 @@ void Core::Entity::Chara::setStance( Stance stance )
{ {
m_currentStance = stance; m_currentStance = stance;
FFXIVPacketBasePtr packet = boost::make_shared< ActorControlPacket142 >( m_id, ToggleWeapon, stance, 0 ); FFXIVPacketBasePtr packet = makeActorControl142( m_id, ToggleWeapon, stance, 0 );
sendToInRangeSet( packet ); sendToInRangeSet( packet );
} }
@ -289,7 +288,7 @@ Change the current target and propagate to in range players
void Core::Entity::Chara::changeTarget( uint64_t targetId ) void Core::Entity::Chara::changeTarget( uint64_t targetId )
{ {
setTargetId( targetId ); setTargetId( targetId );
FFXIVPacketBasePtr packet = boost::make_shared< ActorControlPacket144 >( m_id, SetTarget, 0, 0, 0, 0, targetId ); FFXIVPacketBasePtr packet = makeActorControl144( m_id, SetTarget, 0, 0, 0, 0, targetId );
sendToInRangeSet( packet ); sendToInRangeSet( packet );
} }
@ -648,7 +647,7 @@ void Core::Entity::Chara::removeStatusEffect( uint8_t effectSlotId )
auto pEffect = pEffectIt->second; auto pEffect = pEffectIt->second;
pEffect->removeStatus(); pEffect->removeStatus();
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), StatusEffectLose, pEffect->getId() ), isPlayer() ); sendToInRangeSet( makeActorControl142( getId(), StatusEffectLose, pEffect->getId() ), isPlayer() );
m_statusEffectMap.erase( effectSlotId ); m_statusEffectMap.erase( effectSlotId );
@ -744,15 +743,15 @@ void Core::Entity::Chara::updateStatusEffects()
if( thisTickDmg != 0 ) if( thisTickDmg != 0 )
{ {
takeDamage( thisTickDmg ); takeDamage( thisTickDmg );
sendToInRangeSet( sendToInRangeSet( makeActorControl142( getId(), HPFloatingText, 0,
boost::make_shared< ActorControlPacket142 >( getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Damage ), thisTickDmg ) ); static_cast< uint8_t >( ActionEffectType::Damage ), thisTickDmg ) );
} }
if( thisTickHeal != 0 ) if( thisTickHeal != 0 )
{ {
heal( thisTickDmg ); heal( thisTickDmg );
sendToInRangeSet( sendToInRangeSet( makeActorControl142( getId(), HPFloatingText, 0,
boost::make_shared< ActorControlPacket142 >( getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Heal ), thisTickHeal ) ); static_cast< uint8_t >( ActionEffectType::Heal ), thisTickHeal ) );
} }
} }
@ -763,7 +762,7 @@ bool Core::Entity::Chara::hasStatusEffect( uint32_t id )
return false; return false;
} }
Core::Common::ObjKind Chara::getModelType() const Core::Common::ObjKind Chara::getObjKind() const
{ {
return m_modelType; return m_modelType;
} }

View file

@ -21,46 +21,6 @@ namespace Entity {
class Chara : public Actor class Chara : public Actor
{ {
public: public:
enum Stance : uint8_t
{
Passive = 0,
Active = 1,
};
enum DisplayFlags : uint16_t
{
ActiveStance = 0x001,
Invisible = 0x020,
HideHead = 0x040,
HideWeapon = 0x080,
Faded = 0x100,
Visor = 0x800,
};
enum struct ActorStatus : uint8_t
{
Idle = 0x01,
Dead = 0x02,
Sitting = 0x03,
Mounted = 0x04,
Crafting = 0x05,
Gathering = 0x06,
Melding = 0x07,
SMachine = 0x08,
Carry = 0x09,
EmoteMode = 0x0B
};
/*! ModelType as found in eventsystemdefine.exd */
enum ModelType : uint8_t
{
Human = 1,
DemiHuman = 2,
Monster = 3,
SharedGroup = 4,
Parts = 5
};
struct ActorStats struct ActorStats
{ {
uint32_t max_mp = 0; uint32_t max_mp = 0;
@ -115,9 +75,9 @@ protected:
/*! Last time the actor was updated ( in ms ) */ /*! Last time the actor was updated ( in ms ) */
uint64_t m_lastUpdate; uint64_t m_lastUpdate;
/*! Current stance of the actor */ /*! Current stance of the actor */
Stance m_currentStance; Common::Stance m_currentStance;
/*! Current staus of the actor */ /*! Current staus of the actor */
ActorStatus m_status; Common::ActorStatus m_status;
/*! Max HP of the actor ( based on job / class ) */ /*! Max HP of the actor ( based on job / class ) */
uint32_t m_maxHp; uint32_t m_maxHp;
/*! Max MP of the actor ( based on job / class ) */ /*! Max MP of the actor ( based on job / class ) */
@ -184,9 +144,9 @@ public:
bool face( const Common::FFXIVARR_POSITION3& p ); bool face( const Common::FFXIVARR_POSITION3& p );
Stance getStance() const; Common::Stance getStance() const;
void setStance( Stance stance ); void setStance( Common::Stance stance );
ActorStats getStats() const; ActorStats getStats() const;
@ -199,7 +159,7 @@ public:
Common::ClassJob getClass() const; Common::ClassJob getClass() const;
Common::ObjKind getModelType() const; Common::ObjKind getObjKind() const;
uint8_t getClassAsInt() const; uint8_t getClassAsInt() const;
@ -225,9 +185,9 @@ public:
void die(); void die();
ActorStatus getStatus() const; Common::ActorStatus getStatus() const;
void setStatus( ActorStatus status ); void setStatus( Common::ActorStatus status );
void handleScriptSkill( uint32_t type, uint16_t actionId, uint64_t param1, uint64_t param2, Entity::Chara& target ); void handleScriptSkill( uint32_t type, uint16_t actionId, uint64_t param1, uint64_t param2, Entity::Chara& target );

View file

@ -83,14 +83,14 @@ void Core::Entity::EventObject::setState( uint8_t state )
for( const auto& player : m_inRangePlayers ) for( const auto& player : m_inRangePlayers )
{ {
player->queuePacket( boost::make_shared< ActorControlPacket142 >( getId(), DirectorEObjMod, state ) ); player->queuePacket( makeActorControl142( getId(), DirectorEObjMod, state ) );
} }
} }
void Core::Entity::EventObject::setAnimationFlag( uint32_t flag, uint32_t animationFlag ) { void Core::Entity::EventObject::setAnimationFlag( uint32_t flag, uint32_t animationFlag ) {
for( const auto& player : m_inRangePlayers ) for( const auto& player : m_inRangePlayers )
{ {
player->queuePacket( boost::make_shared< ActorControlPacket142 >( getId(), EObjAnimation, flag, animationFlag ) ); player->queuePacket( makeActorControl142( getId(), EObjAnimation, flag, animationFlag ) );
} }
} }

View file

@ -358,19 +358,19 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
if( type == 1 ) // teleport if( type == 1 ) // teleport
{ {
prepareZoning( data->territory, true, 1, 112 ); // TODO: Really? prepareZoning( data->territory, true, 1, 112 ); // TODO: Really?
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorDespawnEffect, 0x04 ) ); sendToInRangeSet( makeActorControl142( getId(), ActorDespawnEffect, 0x04 ) );
setZoningType( Common::ZoneingType::Teleport ); setZoningType( Common::ZoneingType::Teleport );
} }
else if( type == 2 ) // aethernet else if( type == 2 ) // aethernet
{ {
prepareZoning( data->territory, true, 1, 112 ); prepareZoning( data->territory, true, 1, 112 );
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorDespawnEffect, 0x04 ) ); sendToInRangeSet( makeActorControl142( getId(), ActorDespawnEffect, 0x04 ) );
setZoningType( Common::ZoneingType::Teleport ); setZoningType( Common::ZoneingType::Teleport );
} }
else if( type == 3 ) // return else if( type == 3 ) // return
{ {
prepareZoning( data->territory, true, 1, 111 ); prepareZoning( data->territory, true, 1, 111 );
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorDespawnEffect, 0x03 ) ); sendToInRangeSet( makeActorControl142( getId(), ActorDespawnEffect, 0x03 ) );
setZoningType( Common::ZoneingType::Return ); setZoningType( Common::ZoneingType::Return );
} }
@ -496,7 +496,7 @@ void Core::Entity::Player::registerAetheryte( uint8_t aetheryteId )
Util::valueToFlagByteIndexValue( aetheryteId, value, index ); Util::valueToFlagByteIndexValue( aetheryteId, value, index );
m_aetheryte[index] |= value; m_aetheryte[index] |= value;
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), LearnTeleport, aetheryteId, 1 ) ); queuePacket( makeActorControl143( getId(), LearnTeleport, aetheryteId, 1 ) );
} }
bool Core::Entity::Player::isAetheryteRegistered( uint8_t aetheryteId ) const bool Core::Entity::Player::isAetheryteRegistered( uint8_t aetheryteId ) const
@ -587,7 +587,7 @@ void Core::Entity::Player::learnAction( uint16_t actionId )
m_unlocks[index] |= value; m_unlocks[index] |= value;
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ToggleActionUnlock, actionId, 1 ) ); queuePacket( makeActorControl143( getId(), ToggleActionUnlock, actionId, 1 ) );
} }
void Core::Entity::Player::learnSong( uint8_t songId, uint32_t itemId ) void Core::Entity::Player::learnSong( uint8_t songId, uint32_t itemId )
@ -598,7 +598,7 @@ void Core::Entity::Player::learnSong( uint8_t songId, uint32_t itemId )
m_orchestrion[index] |= value; m_orchestrion[index] |= value;
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ToggleOrchestrionUnlock, songId, 1, itemId ) ); queuePacket( makeActorControl143( getId(), ToggleOrchestrionUnlock, songId, 1, itemId ) );
} }
bool Core::Entity::Player::isActionLearned( uint8_t actionId ) const bool Core::Entity::Player::isActionLearned( uint8_t actionId ) const
@ -622,11 +622,11 @@ void Core::Entity::Player::gainExp( uint32_t amount )
uint32_t neededExpToLevelplus1 = pExdData->get< Core::Data::ParamGrow >( level + 1 )->expToNext; uint32_t neededExpToLevelplus1 = pExdData->get< Core::Data::ParamGrow >( level + 1 )->expToNext;
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) ); queuePacket( makeActorControl143( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
if( level >= 70 ) // temporary fix for leveling over levelcap if( level >= 70 ) // temporary fix for leveling over levelcap
{ {
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) ); queuePacket( makeActorControl143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
return; return;
} }
@ -638,12 +638,12 @@ void Core::Entity::Player::gainExp( uint32_t amount )
( currentExp + amount - neededExpToLevel ); ( currentExp + amount - neededExpToLevel );
setExp( amount ); setExp( amount );
gainLevel(); gainLevel();
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) ); queuePacket( makeActorControl143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
} }
else else
{ {
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), currentExp + amount ) ); queuePacket( makeActorControl143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), currentExp + amount ) );
setExp( currentExp + amount ); setExp( currentExp + amount );
} }
@ -672,7 +672,7 @@ void Core::Entity::Player::gainLevel()
effectListPacket->data().max_mp = getMaxMp(); effectListPacket->data().max_mp = getMaxMp();
sendToInRangeSet( effectListPacket, true ); sendToInRangeSet( effectListPacket, true );
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), LevelUpEffect, static_cast< uint8_t >( getClass() ), sendToInRangeSet( makeActorControl142( getId(), LevelUpEffect, static_cast< uint8_t >( getClass() ),
getLevel(), getLevel() - 1 ), true ); getLevel(), getLevel() - 1 ), true );
auto classInfoPacket = makeZonePacket< FFXIVIpcUpdateClassInfo >( getId() ); auto classInfoPacket = makeZonePacket< FFXIVIpcUpdateClassInfo >( getId() );
@ -752,7 +752,7 @@ void Core::Entity::Player::setClassJob( Common::ClassJob classJob )
classInfoPacket->data().level = getLevel(); classInfoPacket->data().level = getLevel();
queuePacket( classInfoPacket ); queuePacket( classInfoPacket );
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ClassJobChange, 0x04 ), true ); sendToInRangeSet( makeActorControl142( getId(), ClassJobChange, 0x04 ), true );
sendStatusUpdate( true ); sendStatusUpdate( true );
} }
@ -857,7 +857,7 @@ void Core::Entity::Player::despawn( Entity::PlayerPtr pTarget )
pPlayer->freePlayerSpawnId( getId() ); pPlayer->freePlayerSpawnId( getId() );
pPlayer->queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), DespawnZoneScreenMsg, 0x04, getId(), 0x01 ) ); pPlayer->queuePacket( makeActorControl143( getId(), DespawnZoneScreenMsg, 0x04, getId(), 0x01 ) );
} }
Core::Entity::ActorPtr Core::Entity::Player::lookupTargetById( uint64_t targetId ) Core::Entity::ActorPtr Core::Entity::Player::lookupTargetById( uint64_t targetId )
@ -953,7 +953,7 @@ void Core::Entity::Player::setStateFlag( Common::PlayerStateFlag flag )
auto newOnlineStatus = getOnlineStatus(); auto newOnlineStatus = getOnlineStatus();
if( prevOnlineStatus != newOnlineStatus ) if( prevOnlineStatus != newOnlineStatus )
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), SetStatusIcon, sendToInRangeSet( makeActorControl142( getId(), SetStatusIcon,
static_cast< uint8_t >( getOnlineStatus() ) ), true ); static_cast< uint8_t >( getOnlineStatus() ) ), true );
} }
@ -990,8 +990,7 @@ void Core::Entity::Player::unsetStateFlag( Common::PlayerStateFlag flag )
auto newOnlineStatus = getOnlineStatus(); auto newOnlineStatus = getOnlineStatus();
if( prevOnlineStatus != newOnlineStatus ) if( prevOnlineStatus != newOnlineStatus )
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), SetStatusIcon, sendToInRangeSet( makeActorControl142( getId(), SetStatusIcon, static_cast< uint8_t >( getOnlineStatus() ) ), true );
static_cast< uint8_t >( getOnlineStatus() ) ), true );
} }
void Core::Entity::Player::update( int64_t currTime ) void Core::Entity::Player::update( int64_t currTime )
@ -1032,7 +1031,7 @@ void Core::Entity::Player::update( int64_t currTime )
if( !checkAction() ) if( !checkAction() )
{ {
if( m_targetId && m_currentStance == Entity::Chara::Stance::Active && isAutoattackOn() ) if( m_targetId && m_currentStance == Common::Stance::Active && isAutoattackOn() )
{ {
auto mainWeap = getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand ); auto mainWeap = getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand );
@ -1104,7 +1103,7 @@ void Core::Entity::Player::setHomepoint( uint8_t aetheryteId )
{ {
m_homePoint = aetheryteId; m_homePoint = aetheryteId;
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), SetHomepoint, aetheryteId ) ); queuePacket( makeActorControl143( getId(), SetHomepoint, aetheryteId ) );
} }
/*! get homepoint */ /*! get homepoint */
@ -1364,7 +1363,7 @@ void Core::Entity::Player::setTitle( uint16_t titleId )
m_activeTitle = titleId; m_activeTitle = titleId;
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), SetTitle, titleId ), true ); sendToInRangeSet( makeActorControl142( getId(), SetTitle, titleId ), true );
} }
void Core::Entity::Player::setEquipDisplayFlags( uint8_t state ) void Core::Entity::Player::setEquipDisplayFlags( uint8_t state )
@ -1383,8 +1382,9 @@ uint8_t Core::Entity::Player::getEquipDisplayFlags() const
void Core::Entity::Player::mount( uint32_t id ) void Core::Entity::Player::mount( uint32_t id )
{ {
m_mount = id; m_mount = id;
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Mounted )), true ); sendToInRangeSet( makeActorControl142( getId(), ActorControlType::SetStatus,
sendToInRangeSet( boost::make_shared< ActorControlPacket143 >( getId(), 0x39e, 12 ), true ); //? static_cast< uint8_t >( Common::ActorStatus::Mounted ) ), true );
sendToInRangeSet( makeActorControl143( getId(), 0x39e, 12 ), true ); //?
auto mountPacket = makeZonePacket< FFXIVIpcMount >( getId() ); auto mountPacket = makeZonePacket< FFXIVIpcMount >( getId() );
mountPacket->data().id = id; mountPacket->data().id = id;
@ -1393,9 +1393,9 @@ void Core::Entity::Player::mount( uint32_t id )
void Core::Entity::Player::dismount() void Core::Entity::Player::dismount()
{ {
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorControlType::SetStatus, sendToInRangeSet( makeActorControl142( getId(), ActorControlType::SetStatus,
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle )), true ); static_cast< uint8_t >( Common::ActorStatus::Idle ) ), true );
sendToInRangeSet( boost::make_shared< ActorControlPacket143 >( getId(), ActorControlType::Dismount, 1 ), true ); sendToInRangeSet( makeActorControl143( getId(), ActorControlType::Dismount, 1 ), true );
m_mount = 0; m_mount = 0;
} }
@ -1541,7 +1541,7 @@ void Core::Entity::Player::sendZonePackets()
if( isLogin() ) if( isLogin() )
{ {
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), SetCharaGearParamUI, m_equipDisplayFlags, 1 ) ); queuePacket( makeActorControl143( getId(), SetCharaGearParamUI, m_equipDisplayFlags, 1 ) );
} }
// set flags, will be reset automatically by zoning ( only on client side though ) // set flags, will be reset automatically by zoning ( only on client side though )
@ -1623,8 +1623,8 @@ void Core::Entity::Player::sendTitleList()
void Core::Entity::Player::sendZoneInPackets( uint32_t param1, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, bool shouldSetStatus = false ) 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 = boost::make_shared< ActorControlPacket143 >( getId(), ZoneIn, param1, param2, param3, param4 ); auto zoneInPacket = makeActorControl143( getId(), ZoneIn, param1, param2, param3, param4 );
auto SetStatusPacket = boost::make_shared< ActorControlPacket142 >( getId(), SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) ); auto SetStatusPacket = makeActorControl142( getId(), SetStatus, static_cast< uint8_t >( Common::ActorStatus::Idle ) );
if( !getGmInvis() ) if( !getGmInvis() )
sendToInRangeSet( zoneInPacket, true ); sendToInRangeSet( zoneInPacket, true );
@ -1654,11 +1654,11 @@ void Core::Entity::Player::finishZoning()
case ZoneingType::Return: case ZoneingType::Return:
case ZoneingType::ReturnDead: case ZoneingType::ReturnDead:
{ {
if( getStatus() == Entity::Chara::ActorStatus::Dead ) if( getStatus() == Common::ActorStatus::Dead )
{ {
resetHp(); resetHp();
resetMp(); resetMp();
setStatus( Entity::Chara::ActorStatus::Idle ); setStatus( Common::ActorStatus::Idle );
sendZoneInPackets( 0x01, 0x01, 0, 111, true ); sendZoneInPackets( 0x01, 0x01, 0, 111, true );
} }
else else
@ -1673,13 +1673,13 @@ void Core::Entity::Player::finishZoning()
void Core::Entity::Player::emote( uint32_t emoteId, uint64_t targetId, bool isSilent ) void Core::Entity::Player::emote( uint32_t emoteId, uint64_t targetId, bool isSilent )
{ {
sendToInRangeSet( boost::make_shared< ActorControlPacket144 >( getId(), ActorControlType::Emote, sendToInRangeSet( makeActorControl144( getId(), ActorControlType::Emote,
emoteId, 0, isSilent ? 1 : 0, 0, targetId ) ); emoteId, 0, isSilent ? 1 : 0, 0, targetId ) );
} }
void Core::Entity::Player::emoteInterrupt() void Core::Entity::Player::emoteInterrupt()
{ {
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorControlType::EmoteInterrupt ) ); sendToInRangeSet( makeActorControl142( getId(), ActorControlType::EmoteInterrupt ) );
} }
void Core::Entity::Player::teleportQuery( uint16_t aetheryteId ) void Core::Entity::Player::teleportQuery( uint16_t aetheryteId )
@ -1702,7 +1702,7 @@ void Core::Entity::Player::teleportQuery( uint16_t aetheryteId )
bool insufficientGil = getCurrency( Common::CurrencyType::Gil ) < cost; bool insufficientGil = getCurrency( Common::CurrencyType::Gil ) < cost;
// TODO: figure out what param1 really does // TODO: figure out what param1 really does
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), TeleportStart, insufficientGil ? 2 : 0, aetheryteId ) ); queuePacket( makeActorControl143( getId(), TeleportStart, insufficientGil ? 2 : 0, aetheryteId ) );
if( !insufficientGil ) if( !insufficientGil )
{ {

View file

@ -112,7 +112,7 @@ void Core::Entity::Player::initInventory()
void Core::Entity::Player::sendItemLevel() void Core::Entity::Player::sendItemLevel()
{ {
queuePacket( boost::make_shared< ActorControlPacket142 >( getId(), SetItemLevel, getItemLevel(), 0 ) ); queuePacket( makeActorControl142( getId(), SetItemLevel, getItemLevel(), 0 ) );
} }
void Core::Entity::Player::equipWeapon( ItemPtr pItem ) void Core::Entity::Player::equipWeapon( ItemPtr pItem )
@ -259,8 +259,7 @@ void Core::Entity::Player::addCrystal( Common::CrystalType type, uint32_t amount
Common::InventoryType::Crystal, Common::InventoryType::Crystal,
*currItem ); *currItem );
queuePacket( invUpdate ); queuePacket( invUpdate );
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ItemObtainIcon, queuePacket( makeActorControl143( getId(), ItemObtainIcon, static_cast< uint8_t >( type ) + 1, amount ) );
static_cast< uint8_t >( type ) + 1, amount ) );
} }
void Core::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t amount ) void Core::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t amount )
@ -520,7 +519,7 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
// return existing stack if we have no overflow - items fit into a preexisting stack // return existing stack if we have no overflow - items fit into a preexisting stack
if( quantity == 0 ) if( quantity == 0 )
{ {
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ItemObtainIcon, catalogId, originalQuantity ) ); queuePacket( makeActorControl143( getId(), ItemObtainIcon, catalogId, originalQuantity ) );
return item; return item;
} }
@ -551,7 +550,7 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), freeBagSlot.second, freeBagSlot.first, *item ); auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), freeBagSlot.second, freeBagSlot.first, *item );
queuePacket( invUpdate ); queuePacket( invUpdate );
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ItemObtainIcon, catalogId, originalQuantity ) ); queuePacket( makeActorControl143( getId(), ItemObtainIcon, catalogId, originalQuantity ) );
} }
return item; return item;

View file

@ -43,7 +43,7 @@ uint8_t Core::Event::Director::getSequence() const
void Core::Event::Director::sendDirectorClear( Core::Entity::Player& player ) const void Core::Event::Director::sendDirectorClear( Core::Entity::Player& player ) const
{ {
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorClear, m_directorId ) ); player.queuePacket( makeActorControl143( player.getId(), DirectorClear, m_directorId ) );
} }
void Core::Event::Director::sendDirectorVars( Core::Entity::Player& player ) const void Core::Event::Director::sendDirectorVars( Core::Entity::Player& player ) const
@ -58,8 +58,7 @@ void Core::Event::Director::sendDirectorVars( Core::Entity::Player& player ) con
void Core::Event::Director::sendDirectorInit( Core::Entity::Player& player ) const void Core::Event::Director::sendDirectorInit( Core::Entity::Player& player ) const
{ {
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorInit, player.queuePacket( makeActorControl143( player.getId(), DirectorInit, m_directorId, m_contentId ) );
m_directorId, m_contentId ) );
} }
Core::Event::Director::DirectorType Core::Event::Director::getType() const Core::Event::Director::DirectorType Core::Event::Director::getType() const

View file

@ -63,7 +63,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::FFXIVARR_PACKE
pExdData->get< Core::Data::Action >( action )->name + pExdData->get< Core::Data::Action >( action )->name +
" | " + std::to_string( targetId ) + " )" ); " | " + std::to_string( targetId ) + " )" );
player.queuePacket( boost::make_shared< ActorControlPacket142 >( player.getId(), ActorControlType::ActionStart, 0x01, action ) ); player.queuePacket( makeActorControl142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
if( action == 5 ) if( action == 5 )
{ {

View file

@ -10,9 +10,6 @@
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
#include "Network/PacketWrappers/ActorControlPacket144.h"
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h" #include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "Framework.h" #include "Framework.h"

View file

@ -69,14 +69,14 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
case ClientTriggerType::ToggleSheathe: // Toggle sheathe case ClientTriggerType::ToggleSheathe: // Toggle sheathe
{ {
if ( param11 == 1 ) if ( param11 == 1 )
player.setStance( Entity::Chara::Stance::Active ); player.setStance( Common::Stance::Active );
else else
{ {
player.setStance( Entity::Chara::Stance::Passive ); player.setStance( Common::Stance::Passive );
player.setAutoattack( false ); player.setAutoattack( false );
} }
player.sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), 0, param11, 1 ) ); player.sendToInRangeSet( makeActorControl142( player.getId(), 0, param11, 1 ) );
break; break;
} }
@ -85,12 +85,12 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
if ( param11 == 1 ) if ( param11 == 1 )
{ {
player.setAutoattack( true ); player.setAutoattack( true );
player.setStance( Entity::Chara::Stance::Active ); player.setStance( Common::Stance::Active );
} }
else else
player.setAutoattack( false ); player.setAutoattack( false );
player.sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), 1, param11, 1 ) ); player.sendToInRangeSet( makeActorControl142( player.getId(), 1, param11, 1 ) );
break; break;
} }
@ -156,19 +156,19 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
if( isPersistent ) if( isPersistent )
{ {
player.setStance( Entity::Chara::Stance::Passive ); player.setStance( Common::Stance::Passive );
player.setAutoattack( false ); player.setAutoattack( false );
player.setPersistentEmote( emoteData->emoteMode ); player.setPersistentEmote( emoteData->emoteMode );
player.setStatus( Entity::Chara::ActorStatus::EmoteMode ); player.setStatus( Common::ActorStatus::EmoteMode );
player.sendToInRangeSet( player.sendToInRangeSet( makeActorControl142( player.getId(), ActorControlType::SetStatus,
boost::make_shared< ActorControlPacket142 >( player.getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Common::ActorStatus::EmoteMode ),
static_cast< uint8_t >( Entity::Chara::ActorStatus::EmoteMode ), emoteData->hasCancelEmote ? 1 : 0 ), true ); emoteData->hasCancelEmote ? 1 : 0 ), true );
} }
if( emoteData->drawsWeapon ) if( emoteData->drawsWeapon )
{ {
player.setStance( Entity::Chara::Stance::Active ); player.setStance( Common::Stance::Active );
} }
break; break;
@ -182,10 +182,9 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
{ {
player.setPersistentEmote( 0 ); player.setPersistentEmote( 0 );
player.emoteInterrupt(); player.emoteInterrupt();
player.setStatus( Entity::Chara::ActorStatus::Idle ); player.setStatus( Common::ActorStatus::Idle );
auto pSetStatusPacket = boost::make_shared< ActorControlPacket142 >( player.getId(), auto pSetStatusPacket = makeActorControl142( player.getId(), SetStatus,
SetStatus, static_cast< uint8_t >( Common::ActorStatus::Idle ) );
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) );
player.sendToInRangeSet( pSetStatusPacket ); player.sendToInRangeSet( pSetStatusPacket );
break; break;
} }
@ -193,18 +192,14 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
case ClientTriggerType::PoseReapply: // reapply pose case ClientTriggerType::PoseReapply: // reapply pose
{ {
player.setPose( param12 ); player.setPose( param12 );
auto pSetStatusPacket = boost::make_shared< ActorControlPacket142 >( player.getId(), auto pSetStatusPacket = makeActorControl142( player.getId(), SetPose, param11, param12 );
SetPose,
param11, param12 );
player.sendToInRangeSet( pSetStatusPacket, true ); player.sendToInRangeSet( pSetStatusPacket, true );
break; break;
} }
case ClientTriggerType::PoseCancel: // cancel pose case ClientTriggerType::PoseCancel: // cancel pose
{ {
player.setPose( param12 ); player.setPose( param12 );
auto pSetStatusPacket = boost::make_shared< ActorControlPacket142 >( player.getId(), auto pSetStatusPacket = makeActorControl142( player.getId(), SetPose, param11, param12 );
SetPose,
param11, param12 );
player.sendToInRangeSet( pSetStatusPacket, true ); player.sendToInRangeSet( pSetStatusPacket, true );
break; break;
} }

View file

@ -11,9 +11,6 @@
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
#include "Network/PacketWrappers/ActorControlPacket144.h"
#include "Network/PacketWrappers/EventStartPacket.h" #include "Network/PacketWrappers/EventStartPacket.h"
#include "Network/PacketWrappers/EventFinishPacket.h" #include "Network/PacketWrappers/EventFinishPacket.h"
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h" #include "Network/PacketWrappers/PlayerStateFlagsPacket.h"

View file

@ -208,7 +208,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
} }
case GmCommand::Speed: case GmCommand::Speed:
{ {
targetPlayer->queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), Flee, param1 ) ); targetPlayer->queuePacket( makeActorControl143( player.getId(), Flee, param1 ) );
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;
} }
@ -245,7 +245,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
strcpy( searchInfoPacket->data().searchMessage, targetPlayer->getSearchMessage() ); strcpy( searchInfoPacket->data().searchMessage, targetPlayer->getSearchMessage() );
targetPlayer->queuePacket( searchInfoPacket ); targetPlayer->queuePacket( searchInfoPacket );
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), SetStatusIcon, targetPlayer->sendToInRangeSet( makeActorControl142( player.getId(), SetStatusIcon,
static_cast< uint8_t >( player.getOnlineStatus() ) ), static_cast< uint8_t >( player.getOnlineStatus() ) ),
true ); true );
player.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 ) );
@ -529,13 +529,14 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R
{ {
targetPlayer->resetHp(); targetPlayer->resetHp();
targetPlayer->resetMp(); targetPlayer->resetMp();
targetPlayer->setStatus( Entity::Chara::ActorStatus::Idle ); targetPlayer->setStatus( Common::ActorStatus::Idle );
targetPlayer->sendZoneInPackets( 0x01, 0x01, 0, 113, true ); targetPlayer->sendZoneInPackets( 0x01, 0x01, 0, 113, true );
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket143 >( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), SetStatus, targetPlayer->sendToInRangeSet( makeActorControl143( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) ), true ); targetPlayer->sendToInRangeSet( makeActorControl142( player.getId(), SetStatus,
player.sendNotice( "Raised " + targetPlayer->getName() ); static_cast< uint8_t >( Common::ActorStatus::Idle ) ), true );
player.sendNotice( "Raised " + targetPlayer->getName() );
break; break;
} }
case GmCommand::Jump: case GmCommand::Jump:
@ -545,7 +546,7 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R
player.setZone( targetPlayer->getZoneId() ); player.setZone( targetPlayer->getZoneId() );
} }
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.sendNotice( "Jumping to " + targetPlayer->getName() ); player.sendNotice( "Jumping to " + targetPlayer->getName() );
break; break;
} }

View file

@ -9,9 +9,6 @@
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
#include "Network/PacketWrappers/ActorControlPacket144.h"
#include "Zone/Zone.h" #include "Zone/Zone.h"
#include "Zone/ZonePosition.h" #include "Zone/ZonePosition.h"

View file

@ -91,8 +91,8 @@ void Core::Network::GameConnection::setSearchInfoHandler( const Packets::FFXIVAR
strcpy( searchInfoPacket->data().searchMessage, player.getSearchMessage() ); strcpy( searchInfoPacket->data().searchMessage, player.getSearchMessage() );
queueOutPacket( searchInfoPacket ); queueOutPacket( searchInfoPacket );
player.sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), SetStatusIcon, player.sendToInRangeSet( makeActorControl142( player.getId(), SetStatusIcon,
static_cast< uint8_t >( player.getOnlineStatus() ) ), true ); static_cast< uint8_t >( player.getOnlineStatus() ) ), true );
} }
void Core::Network::GameConnection::reqSearchInfoHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket, void Core::Network::GameConnection::reqSearchInfoHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,

View file

@ -41,6 +41,12 @@ private:
}; };
}; };
template< typename... Args >
boost::shared_ptr< ActorControlPacket142 > makeActorControl142( Args... args )
{
return boost::make_shared< ActorControlPacket142 >( args... );
}
} }
} }
} }

View file

@ -44,6 +44,12 @@ private:
}; };
}; };
template< typename... Args >
boost::shared_ptr< ActorControlPacket143 > makeActorControl143( Args... args )
{
return boost::make_shared< ActorControlPacket143 >( args... );
}
} }
} }
} }

View file

@ -42,6 +42,12 @@ private:
}; };
}; };
template< typename... Args >
boost::shared_ptr< ActorControlPacket144 > makeActorControl144( Args... args )
{
return boost::make_shared< ActorControlPacket144 >( args... );
}
} }
} }
} }

View file

@ -76,7 +76,7 @@ namespace Server {
//m_data.u23 = 0x04; //m_data.u23 = 0x04;
//m_data.u24 = 256; //m_data.u24 = 256;
m_data.state = static_cast< uint8_t >( player.getStatus() ); m_data.state = static_cast< uint8_t >( player.getStatus() );
m_data.modelType = player.getModelType(); m_data.modelType = player.getObjKind();
if( target.getId() == player.getId() ) if( target.getId() == player.getId() )
{ {
m_data.spawnIndex = 0x00; m_data.spawnIndex = 0x00;
@ -93,22 +93,22 @@ namespace Server {
if( player.getZoningType() != Common::ZoneingType::None || player.getGmInvis() == true ) if( player.getZoningType() != Common::ZoneingType::None || player.getGmInvis() == true )
{ {
m_data.displayFlags |= Entity::Chara::DisplayFlags::Invisible; m_data.displayFlags |= static_cast< uint8_t >( Common::DisplayFlags::Invisible );
} }
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead ) if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead )
{ {
m_data.displayFlags |= Entity::Chara::DisplayFlags::HideHead; m_data.displayFlags |= static_cast< uint8_t >( Common::DisplayFlags::HideHead );
} }
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon ) if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon )
{ {
m_data.displayFlags |= Entity::Chara::DisplayFlags::HideWeapon; m_data.displayFlags |= static_cast< uint8_t >( Common::DisplayFlags::HideWeapon );
} }
if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor ) if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor )
{ {
m_data.displayFlags |= Entity::Chara::DisplayFlags::Visor; m_data.displayFlags |= static_cast< uint8_t >( Common::DisplayFlags::Visor );
} }
if( !( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideLegacyMark ) ) if( !( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideLegacyMark ) )

View file

@ -134,9 +134,9 @@ void Core::InstanceContent::onUpdate( uint32_t currTime )
for( const auto& playerIt : m_playerMap ) for( const auto& playerIt : m_playerMap )
{ {
auto pPlayer = playerIt.second; auto pPlayer = playerIt.second;
pPlayer->queuePacket( pPlayer->queuePacket( makeActorControl143( pPlayer->getId(), DirectorUpdate,
boost::make_shared< ActorControlPacket143 >( pPlayer->getId(), DirectorUpdate, getDirectorId(), 0x40000001,
getDirectorId(), 0x40000001, m_instanceConfiguration->timeLimitmin * 60u ) ); m_instanceConfiguration->timeLimitmin * 60u ) );
} }
if( m_pEntranceEObj ) if( m_pEntranceEObj )
@ -177,7 +177,7 @@ void Core::InstanceContent::onInitDirector( Entity::Player& player )
void Core::InstanceContent::onDirectorSync( Entity::Player& player ) void Core::InstanceContent::onDirectorSync( Entity::Player& player )
{ {
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorUpdate, 0x00110001, 0x80000000, 1 ) ); player.queuePacket( makeActorControl143( player.getId(), DirectorUpdate, 0x00110001, 0x80000000, 1 ) );
} }
@ -283,7 +283,7 @@ void Core::InstanceContent::startQte()
for( const auto& playerIt : m_playerMap ) for( const auto& playerIt : m_playerMap )
{ {
auto player = playerIt.second; auto player = playerIt.second;
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x8000000A ) ); player->queuePacket( makeActorControl143( player->getId(), DirectorUpdate, getDirectorId(), 0x8000000A ) );
} }
} }
@ -293,7 +293,7 @@ void Core::InstanceContent::startEventCutscene()
for( const auto& playerIt : m_playerMap ) for( const auto& playerIt : m_playerMap )
{ {
auto player = playerIt.second; auto player = playerIt.second;
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x80000008 ) ); player->queuePacket( makeActorControl143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000008 ) );
} }
} }
@ -302,7 +302,7 @@ void Core::InstanceContent::endEventCutscene()
for( const auto& playerIt : m_playerMap ) for( const auto& playerIt : m_playerMap )
{ {
auto player = playerIt.second; auto player = playerIt.second;
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x80000009 ) ); player->queuePacket( makeActorControl143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000009 ) );
} }
} }
@ -411,13 +411,13 @@ void Core::InstanceContent::setCurrentBGM( uint16_t bgmIndex )
// note: retail do send a BGM_MUTE(1) first before any BGM transition, but YOLO in this case. // note: retail do send a BGM_MUTE(1) first before any BGM transition, but YOLO in this case.
// also do note that this code can't control the bgm granularly. (i.e. per player for WoD submap.) oops. // also do note that this code can't control the bgm granularly. (i.e. per player for WoD submap.) oops.
// player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, 1 ) ); // player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, 1 ) );
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmIndex ) ); player->queuePacket( makeActorControl143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmIndex ) );
} }
} }
void Core::InstanceContent::setPlayerBGM( Core::Entity::Player& player, uint16_t bgmId ) void Core::InstanceContent::setPlayerBGM( Core::Entity::Player& player, uint16_t bgmId )
{ {
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmId ) ); player.queuePacket( makeActorControl143( player.getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmId ) );
} }
uint16_t Core::InstanceContent::getCurrentBGM() const uint16_t Core::InstanceContent::getCurrentBGM() const

View file

@ -142,7 +142,7 @@ void Core::Zone::setCurrentFestival( uint16_t festivalId )
{ {
auto player = playerEntry.second; auto player = playerEntry.second;
auto enableFestival = boost::make_shared< ActorControlPacket143 >( player->getId(), SetFestival, m_currentFestivalId ); auto enableFestival = makeActorControl143( player->getId(), SetFestival, m_currentFestivalId );
playerEntry.second->queuePacket( enableFestival ); playerEntry.second->queuePacket( enableFestival );
} }
} }

View file

@ -299,7 +299,7 @@ int main()
//g_log.info( "|----> " + std::to_string( instance.bNPCBase ) + " " + std::to_string( instance.posX ) + ", " + std::to_string( instance.posY ) + ", " + std::to_string( instance.posZ ) ); //g_log.info( "|----> " + std::to_string( instance.bNPCBase ) + " " + std::to_string( instance.posX ) + ", " + std::to_string( instance.posY ) + ", " + std::to_string( instance.posZ ) );
g_log.info( "|----> " + std::to_string( instance.bNPCBase ) + /*g_log.info( "|----> " + std::to_string( instance.bNPCBase ) +
" " + std::to_string( instance.mainWeaponModel ) + " " + std::to_string( instance.mainWeaponModel ) +
", " + std::to_string( instance.secWeaponModel ) + ", " + std::to_string( instance.secWeaponModel ) +
", " + std::to_string( instance.aggressionMode ) + ", " + std::to_string( instance.aggressionMode ) +
@ -307,7 +307,30 @@ int main()
", " + std::to_string( instance.onlineStatus ) + ", " + std::to_string( instance.onlineStatus ) +
", " + std::to_string( instance.pose ) + ", " + std::to_string( instance.pose ) +
", " + std::to_string( instance.modelChara ) + ", " + std::to_string( instance.modelChara ) +
", " + std::to_string( instance.displayFlags ) + ", " + modelStr + ", " + cusStr + ", " + std::to_string( instance.gimmickId ) ); ", " + std::to_string( instance.displayFlags ) + ", " + modelStr + ", " + cusStr + ", " + std::to_string( instance.gimmickId ) );*/
g_log.info( "|----> " + std::to_string( instance.bNPCBase ) +
" " + std::to_string( instance.u2ab ) +
", " + std::to_string( instance.u2b ) +
", " + std::to_string( instance.u3b ) +
", " + std::to_string( instance.u3c ) +
", " + std::to_string( instance.u4 ) +
", " + std::to_string( instance.u6 ) +
", " + std::to_string( instance.u7 ) +
", " + std::to_string( instance.u14 ) +
", " + std::to_string( instance.u15 ) +
", " + std::to_string( instance.u18 ) +
", " + std::to_string( instance.u19 ) +
", " + std::to_string( instance.u25c) +
", " + std::to_string( instance.u26d ) +
", " + std::to_string( instance.u27a ) +
", " + std::to_string( instance.u29b ) +
", " + std::to_string( instance.u30b ) +
", " + std::to_string( instance.unk30 ) +
", " + std::to_string( instance.unk31 ) +
", " + std::to_string( instance.unk32 ) +
", " + std::to_string( instance.unk33 ) +
", " + std::to_string( instance.unk34 ));
} }
} }
nameToPacketList.clear(); nameToPacketList.clear();