2018-01-28 13:49:51 +01:00
|
|
|
#include "InstanceContent.h"
|
2018-01-29 13:05:33 +11:00
|
|
|
|
2018-02-06 00:01:23 +01:00
|
|
|
#include <common/Common.h>
|
2018-02-04 23:35:16 +01:00
|
|
|
#include <common/Logging/Logger.h>
|
|
|
|
#include <common/Util/Util.h>
|
|
|
|
#include <common/Util/UtilMath.h>
|
2018-02-06 00:01:23 +01:00
|
|
|
#include <servers/sapphire_zone/Event/Director.h>
|
2018-02-04 23:35:16 +01:00
|
|
|
|
|
|
|
#include "Actor/Player.h"
|
|
|
|
|
2018-02-06 00:01:23 +01:00
|
|
|
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
|
|
|
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
|
|
|
|
2018-02-04 23:35:16 +01:00
|
|
|
extern Core::Logger g_log;
|
|
|
|
|
2018-02-06 00:01:23 +01:00
|
|
|
using namespace Core::Common;
|
|
|
|
using namespace Core::Network::Packets;
|
|
|
|
using namespace Core::Network::Packets::Server;
|
|
|
|
|
2018-01-29 19:40:27 +11:00
|
|
|
Core::InstanceContent::InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > pInstanceContent,
|
|
|
|
uint32_t guId,
|
|
|
|
const std::string& internalName,
|
2018-01-29 19:41:41 +01:00
|
|
|
const std::string& contentName,
|
|
|
|
uint32_t instanceContentId )
|
2018-02-06 00:01:23 +01:00
|
|
|
: Zone( static_cast< uint16_t >( pInstanceContent->territoryType ), guId, internalName, contentName ),
|
|
|
|
Director( Event::Director::InstanceContent, instanceContentId ),
|
2018-01-29 19:41:41 +01:00
|
|
|
m_instanceContentInfo( pInstanceContent ),
|
|
|
|
m_instanceContentId( instanceContentId ),
|
|
|
|
m_state( Created )
|
2018-01-29 13:05:33 +11:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Core::InstanceContent::~InstanceContent()
|
|
|
|
{
|
|
|
|
|
2018-01-29 19:41:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Core::InstanceContent::getInstanceContentId() const
|
|
|
|
{
|
|
|
|
return m_instanceContentId;
|
|
|
|
}
|
|
|
|
|
2018-02-04 23:35:16 +01:00
|
|
|
Core::Data::ExdDataGenerated::InstanceContentPtr Core::InstanceContent::getInstanceContentInfo() const
|
2018-01-29 19:41:41 +01:00
|
|
|
{
|
|
|
|
return m_instanceContentInfo;
|
|
|
|
}
|
2018-02-04 23:35:16 +01:00
|
|
|
|
|
|
|
void Core::InstanceContent::onEnterTerritory( Entity::PlayerPtr pPlayer )
|
|
|
|
{
|
|
|
|
g_log.debug( "InstanceContent::onEnterTerritory: Zone#" + std::to_string( getGuId() ) + "|"
|
|
|
|
+ std::to_string( getInstanceContentId() ) +
|
|
|
|
+ ", Entity#" + std::to_string( pPlayer->getId() ) );
|
2018-02-06 00:01:23 +01:00
|
|
|
|
2018-02-06 00:03:08 +01:00
|
|
|
pPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), DirectorInit, getDirectorId(),
|
2018-02-06 00:01:23 +01:00
|
|
|
getInstanceContentId() ) );
|
|
|
|
pPlayer->setStateFlag( PlayerStateFlag::BoundByDuty );
|
2018-02-04 23:35:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Core::InstanceContent::onLeaveTerritory( Entity::PlayerPtr pPlayer )
|
|
|
|
{
|
|
|
|
g_log.debug( "InstanceContent::onLeaveTerritory: Zone#" + std::to_string( getGuId() ) + "|"
|
|
|
|
+ std::to_string( getInstanceContentId() ) +
|
|
|
|
+ ", Entity#" + std::to_string( pPlayer->getId() ) );
|
2018-02-06 00:03:08 +01:00
|
|
|
pPlayer->queuePacket( ActorControlPacket143( pPlayer->getId(), DirectorClear, getDirectorId() ) );
|
2018-02-06 00:01:23 +01:00
|
|
|
pPlayer->unsetStateFlag( PlayerStateFlag::BoundByDuty );
|
2018-02-04 23:35:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Core::InstanceContent::onUpdate( uint32_t currTime )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2018-02-06 00:01:23 +01:00
|
|
|
|
|
|
|
void Core::InstanceContent::onFinishLoading( Entity::PlayerPtr pPlayer )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Core::InstanceContent::onInitDirector( Entity::PlayerPtr pPlayer )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|