2018-01-09 23:50:54 +01:00
|
|
|
#include "Director.h"
|
2018-02-06 00:01:23 +01:00
|
|
|
|
2018-03-06 22:22:19 +01:00
|
|
|
#include <Network/PacketDef/Ipcs.h>
|
|
|
|
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
2018-06-23 21:38:04 +02:00
|
|
|
#include <Network/CommonActorControl.h>
|
2018-02-07 00:00:48 +01:00
|
|
|
|
|
|
|
#include "Actor/Player.h"
|
|
|
|
|
2019-10-09 18:14:53 +02:00
|
|
|
#include "Network/PacketWrappers/ActorControlPacket.h"
|
|
|
|
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
|
2019-03-31 23:45:03 +02:00
|
|
|
#include <Logging/Logger.h>
|
2018-02-07 00:00:48 +01:00
|
|
|
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire::Common;
|
|
|
|
using namespace Sapphire::Network::Packets;
|
|
|
|
using namespace Sapphire::Network::Packets::Server;
|
|
|
|
using namespace Sapphire::Network::ActorControl;
|
2018-02-07 00:00:48 +01:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
Sapphire::Event::Director::Director( Sapphire::Event::Director::DirectorType type, uint16_t contentId ) :
|
2018-08-29 21:40:59 +02:00
|
|
|
m_contentId( contentId ),
|
|
|
|
m_type( type ),
|
|
|
|
m_directorId( ( static_cast< uint32_t >( type ) << 16 ) | contentId ),
|
|
|
|
m_sequence( 1 ),
|
|
|
|
m_branch( 0 ),
|
|
|
|
m_elapsedTime( 0 )
|
2018-02-06 00:01:23 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
memset( m_unionData.arrData, 0, sizeof( m_unionData ) );
|
2018-02-06 00:01:23 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
uint32_t Sapphire::Event::Director::getDirectorId() const
|
2018-02-06 00:01:23 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
return m_directorId;
|
2018-02-06 00:01:23 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
uint16_t Sapphire::Event::Director::getContentId() const
|
2018-02-06 00:01:23 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
return m_contentId;
|
2018-02-06 00:01:23 +01:00
|
|
|
}
|
2018-02-07 00:00:48 +01:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
uint8_t Sapphire::Event::Director::getSequence() const
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
return m_sequence;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::sendDirectorClear( Sapphire::Entity::Player& player ) const
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2019-10-09 18:42:25 +02:00
|
|
|
player.queuePacket( makeActorControlSelf( player.getId(), DirectorClear, m_directorId ) );
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::sendDirectorVars( Sapphire::Entity::Player& player ) const
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
auto varPacket = makeZonePacket< FFXIVIpcDirectorVars >( player.getId() );
|
|
|
|
varPacket->data().m_directorId = getDirectorId();
|
|
|
|
varPacket->data().m_sequence = getSequence();
|
|
|
|
varPacket->data().m_branch = 0;
|
|
|
|
memcpy( varPacket->data().m_unionData, m_unionData.arrData, sizeof( varPacket->data().m_unionData ) );
|
|
|
|
player.queuePacket( varPacket );
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::sendDirectorInit( Sapphire::Entity::Player& player ) const
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2019-03-31 23:45:03 +02:00
|
|
|
Logger::debug( "DirectorID#{}, QuestBattleID#{}", m_directorId, m_contentId );
|
2019-10-09 18:42:25 +02:00
|
|
|
player.queuePacket( makeActorControlSelf( player.getId(), DirectorInit, m_directorId, m_contentId ) );
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
Sapphire::Event::Director::DirectorType Sapphire::Event::Director::getType() const
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
return m_type;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
uint8_t Sapphire::Event::Director::getBranch() const
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
return m_branch;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8AL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8AL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8AH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8AH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8BL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8BL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8BH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8BH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8CL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8CL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8CH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8CH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8DL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8DL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8DH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8DH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8EL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8EL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8EH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8EH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8FL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8FL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8FH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8FH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8GL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8GL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8GH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8GH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8HL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8HL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8HH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8HH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8IL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8IL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8IH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8IH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8JL( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8JL = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorUI8JH( uint8_t value )
|
2018-02-07 00:00:48 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_unionData.ui8lh.UI8JH = value;
|
2018-02-07 00:00:48 +01:00
|
|
|
}
|
2018-02-28 22:25:11 +11:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorBranch( uint8_t value )
|
2018-02-28 22:25:11 +11:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_branch = value;
|
2018-02-28 22:25:11 +11:00
|
|
|
}
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
void Sapphire::Event::Director::setDirectorSequence( uint8_t value )
|
2018-02-28 22:25:11 +11:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
m_sequence = value;
|
2018-02-28 22:25:11 +11:00
|
|
|
}
|
2019-04-17 00:10:32 +02:00
|
|
|
|
|
|
|
void Sapphire::Event::Director::setCustomVar( uint32_t varId, uint32_t value )
|
|
|
|
{
|
|
|
|
m_customVarMap[ varId ] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Sapphire::Event::Director::getCustomVar( uint32_t varId )
|
|
|
|
{
|
|
|
|
auto it = m_customVarMap.find( varId );
|
|
|
|
if( it != m_customVarMap.end() )
|
|
|
|
return it->second;
|
|
|
|
return 0;
|
|
|
|
}
|