mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37:45 +00:00
Removing references to getCurrentTerritory in preparation for further detangleing
This commit is contained in:
parent
2e66750748
commit
0c1bbfb8d0
26 changed files with 353 additions and 259 deletions
|
@ -234,7 +234,7 @@ namespace Sapphire::Common
|
||||||
Enemy = 4,
|
Enemy = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ACTOR_KIND : int32_t
|
enum ActorKind : int32_t
|
||||||
{
|
{
|
||||||
ACTOR_KIND_PC = 0x0,
|
ACTOR_KIND_PC = 0x0,
|
||||||
ACTOR_KIND_NPC = 0x1,
|
ACTOR_KIND_NPC = 0x1,
|
||||||
|
@ -247,7 +247,7 @@ namespace Sapphire::Common
|
||||||
ACTOR_KIND_MAX = 0x8,
|
ACTOR_KIND_MAX = 0x8,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum OBJECT_TYPE : int32_t
|
enum ObjectType : int32_t
|
||||||
{
|
{
|
||||||
OBJECT_TYPE_CAMERA = 0x0,
|
OBJECT_TYPE_CAMERA = 0x0,
|
||||||
OBJECT_TYPE_CAMERA_MAYA = 0x1,
|
OBJECT_TYPE_CAMERA_MAYA = 0x1,
|
||||||
|
@ -263,7 +263,7 @@ namespace Sapphire::Common
|
||||||
OBJECT_TYPE_COUNT_MAX = 0xB,
|
OBJECT_TYPE_COUNT_MAX = 0xB,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum WARP_TYPE : uint8_t
|
enum WarpType : uint8_t
|
||||||
{
|
{
|
||||||
WARP_TYPE_NON = 0x0,
|
WARP_TYPE_NON = 0x0,
|
||||||
WARP_TYPE_NORMAL = 0x1,
|
WARP_TYPE_NORMAL = 0x1,
|
||||||
|
|
|
@ -139,7 +139,7 @@ float Util::trunc( float value, uint8_t digitsToRemain )
|
||||||
if( digitsToRemain == 0 )
|
if( digitsToRemain == 0 )
|
||||||
return std::floor( value );
|
return std::floor( value );
|
||||||
|
|
||||||
float factor = std::pow( 10, digitsToRemain );
|
float factor = std::powf( 10, digitsToRemain );
|
||||||
|
|
||||||
return std::floor( value * factor ) / factor;
|
return std::floor( value * factor ) / factor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,8 @@ public:
|
||||||
{
|
{
|
||||||
auto& exdData = Common::Service< Sapphire::Data::ExdData >::ref();
|
auto& exdData = Common::Service< Sapphire::Data::ExdData >::ref();
|
||||||
|
|
||||||
auto housingZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto housingZoneId = player.getTerritoryTypeId();
|
||||||
if( !housingZone )
|
auto activeLand = player.getActiveLand();
|
||||||
return;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
// param2 is the index starting from 0 inside housingaethernet.exd, but the ID column starts at 0x001E0000........ wtf
|
// param2 is the index starting from 0 inside housingaethernet.exd, but the ID column starts at 0x001E0000........ wtf
|
||||||
|
@ -34,7 +33,7 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check we're teleporting to the same territorytype
|
// check we're teleporting to the same territorytype
|
||||||
if( player.getCurrentTerritory()->getTerritoryTypeId() != pHousingAethernet->territoryType )
|
if( player.getTerritoryTypeId() != pHousingAethernet->territoryType )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// todo: this needs to be done properly and used queued zoning + aethernet animation
|
// todo: this needs to be done properly and used queued zoning + aethernet animation
|
||||||
|
|
|
@ -31,7 +31,8 @@ public:
|
||||||
|
|
||||||
auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||||
|
|
||||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto pHZone = terriMgr.getZoneByTerritoryTypeId( player.getTerritoryTypeId() );
|
||||||
|
auto zone = std::dynamic_pointer_cast< HousingZone >( pHZone );
|
||||||
if( !zone )
|
if( !zone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <Service.h>
|
#include <Service.h>
|
||||||
#include <WorldServer.h>
|
#include <WorldServer.h>
|
||||||
#include "Manager/PlayerMgr.h"
|
#include "Manager/PlayerMgr.h"
|
||||||
|
#include "Manager/TerritoryMgr.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
@ -33,12 +34,12 @@ public:
|
||||||
auto activeLand = player.getActiveLand();
|
auto activeLand = player.getActiveLand();
|
||||||
auto territoryId = player.getTerritoryId();
|
auto territoryId = player.getTerritoryId();
|
||||||
|
|
||||||
auto pTerritory = player.getCurrentTerritory();
|
auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pTerritory = terriMgr.getZoneByTerritoryTypeId( player.getTerritoryTypeId() );
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
||||||
auto& pHouMgr = Common::Service< HousingMgr >::ref();
|
auto& pHouMgr = Common::Service< HousingMgr >::ref();
|
||||||
|
|
||||||
LandPurchaseResult res = pHouMgr.purchaseLand( player, activeLand.plot,
|
LandPurchaseResult res = pHouMgr.purchaseLand( player, *pHousing, activeLand.plot, static_cast< uint8_t >( result.getResult( 0 ) ) );
|
||||||
static_cast< uint8_t >( result.getResult( 0 ) ) );
|
|
||||||
|
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
switch( res )
|
switch( res )
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <Util/UtilMath.h>
|
#include <Util/UtilMath.h>
|
||||||
|
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
|
#include <Manager/TerritoryMgr.h>
|
||||||
|
#include <Service.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
using namespace Sapphire::World::Action;
|
using namespace Sapphire::World::Action;
|
||||||
|
@ -105,6 +107,11 @@ void EffectBuilder::buildAndSendPackets( const std::vector< Entity::CharaPtr >&
|
||||||
Logger::debug( "EffectBuilder result: " );
|
Logger::debug( "EffectBuilder result: " );
|
||||||
Logger::debug( "Targets afflicted: {}", targetList.size() );
|
Logger::debug( "Targets afflicted: {}", targetList.size() );
|
||||||
|
|
||||||
|
auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto zone = teriMgr.getZoneByTerritoryTypeId( m_sourceChara->getTerritoryTypeId() );
|
||||||
|
|
||||||
|
auto globalSequence = zone ? zone->getNextEffectSequence() : 0;
|
||||||
|
|
||||||
do // we want to send at least one packet even nothing is hit so other players can see
|
do // we want to send at least one packet even nothing is hit so other players can see
|
||||||
{
|
{
|
||||||
auto packet = buildNextEffectPacket( targetList );
|
auto packet = buildNextEffectPacket( targetList );
|
||||||
|
@ -118,6 +125,9 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( const s
|
||||||
auto remainingTargetCount = targetList.size();
|
auto remainingTargetCount = targetList.size();
|
||||||
auto globalSequence = m_sourceChara->getCurrentTerritory()->getNextEffectSequence();
|
auto globalSequence = m_sourceChara->getCurrentTerritory()->getNextEffectSequence();
|
||||||
|
|
||||||
|
auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto zone = teriMgr.getZoneByTerritoryTypeId( m_sourceChara->getTerritoryTypeId() );
|
||||||
|
|
||||||
if( remainingTargetCount > 1 ) // use AoeEffect packets
|
if( remainingTargetCount > 1 ) // use AoeEffect packets
|
||||||
{
|
{
|
||||||
auto effectPacket = std::make_shared< EffectPacket >( m_sourceChara->getId(), m_actionId );
|
auto effectPacket = std::make_shared< EffectPacket >( m_sourceChara->getId(), m_actionId );
|
||||||
|
@ -146,7 +156,8 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( const s
|
||||||
effectPacket->addTargetEffect( effect, result->getTarget()->getId() );
|
effectPacket->addTargetEffect( effect, result->getTarget()->getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sourceChara->getCurrentTerritory()->addEffectResult( std::move( result ) );
|
zone->addEffectResult( std::move( result ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actorResultList.clear();
|
actorResultList.clear();
|
||||||
|
@ -161,6 +172,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( const s
|
||||||
}
|
}
|
||||||
else if( remainingTargetCount == 1 ) // use Effect for single target
|
else if( remainingTargetCount == 1 ) // use Effect for single target
|
||||||
{
|
{
|
||||||
|
|
||||||
Logger::debug( " - id: {}", targetList[0]->getId() );
|
Logger::debug( " - id: {}", targetList[0]->getId() );
|
||||||
Logger::debug( "------------------------------------------" );
|
Logger::debug( "------------------------------------------" );
|
||||||
|
|
||||||
|
@ -188,7 +200,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( const s
|
||||||
effectPacket->addTargetEffect( effect );
|
effectPacket->addTargetEffect( effect );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sourceChara->getCurrentTerritory()->addEffectResult( std::move( result ) );
|
zone->addEffectResult( std::move( result ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
actorResultList.clear();
|
actorResultList.clear();
|
||||||
|
|
|
@ -102,7 +102,8 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance
|
||||||
|
|
||||||
m_class = ClassJob::Gladiator;
|
m_class = ClassJob::Gladiator;
|
||||||
|
|
||||||
m_pCurrentTerritory = std::move( pZone );
|
m_territoryTypeId = pZone->getTerritoryTypeId();
|
||||||
|
m_territoryId = pZone->getGuId();
|
||||||
|
|
||||||
m_spawnPos = m_pos;
|
m_spawnPos = m_pos;
|
||||||
|
|
||||||
|
@ -198,6 +199,9 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance
|
||||||
m_flags = 0;
|
m_flags = 0;
|
||||||
m_rank = pInfo->BNPCRankId;
|
m_rank = pInfo->BNPCRankId;
|
||||||
|
|
||||||
|
m_territoryTypeId = pZone->getTerritoryTypeId();
|
||||||
|
m_territoryId = pZone->getGuId();
|
||||||
|
|
||||||
if( pInfo->WanderingRange == 0 || pInfo->BoundInstanceID != 0 )
|
if( pInfo->WanderingRange == 0 || pInfo->BoundInstanceID != 0 )
|
||||||
setFlag( Immobile );
|
setFlag( Immobile );
|
||||||
|
|
||||||
|
@ -215,8 +219,6 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance
|
||||||
|
|
||||||
m_class = ClassJob::Gladiator;
|
m_class = ClassJob::Gladiator;
|
||||||
|
|
||||||
m_pCurrentTerritory = std::move( pZone );
|
|
||||||
|
|
||||||
m_spawnPos = m_pos;
|
m_spawnPos = m_pos;
|
||||||
|
|
||||||
m_timeOfDeath = 0;
|
m_timeOfDeath = 0;
|
||||||
|
@ -350,14 +352,14 @@ void Sapphire::Entity::BNpc::setState( BNpcState state )
|
||||||
|
|
||||||
bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||||
{
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
|
||||||
auto pNaviProvider = m_pCurrentTerritory->getNaviProvider();
|
auto pNaviProvider = pZone->getNaviProvider();
|
||||||
|
|
||||||
if( !pNaviProvider )
|
if( !pNaviProvider )
|
||||||
{
|
{
|
||||||
Logger::error( "No NaviProvider for zone#{0} - {1}",
|
Logger::error( "No NaviProvider for zone#{0} - {1}", pZone->getGuId(), pZone->getInternalName() );
|
||||||
m_pCurrentTerritory->getGuId(),
|
|
||||||
m_pCurrentTerritory->getInternalName() );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +376,7 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pCurrentTerritory->updateActorPosition( *this );
|
pZone->updateActorPosition( *this );
|
||||||
face( pos );
|
face( pos );
|
||||||
if( distance > 2.0f )
|
if( distance > 2.0f )
|
||||||
face( { ( pos.x - pos1.x ) + pos.x, 1.0f, ( pos.z - pos1.z ) + pos.z } );
|
face( { ( pos.x - pos1.x ) + pos.x, 1.0f, ( pos.z - pos1.z ) + pos.z } );
|
||||||
|
@ -388,11 +390,14 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||||
bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara )
|
bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto pNaviProvider = m_pCurrentTerritory->getNaviProvider();
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
|
||||||
|
auto pNaviProvider = pZone->getNaviProvider();
|
||||||
|
|
||||||
if( !pNaviProvider )
|
if( !pNaviProvider )
|
||||||
{
|
{
|
||||||
Logger::error( "No NaviProvider for zone#{0} - {1}", m_pCurrentTerritory->getGuId(), m_pCurrentTerritory->getInternalName() );
|
Logger::error( "No NaviProvider for zone#{0} - {1}", pZone->getGuId(), pZone->getInternalName() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +415,7 @@ bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pCurrentTerritory->updateActorPosition( *this );
|
pZone->updateActorPosition( *this );
|
||||||
if( distance > 2.0f )
|
if( distance > 2.0f )
|
||||||
face( { ( pos1.x - getPos().x ) + pos1.x, 1.0f, ( pos1.z - getPos().z ) + pos1.z } );
|
face( { ( pos1.x - getPos().x ) + pos1.x, 1.0f, ( pos1.z - getPos().z ) + pos1.z } );
|
||||||
else
|
else
|
||||||
|
@ -570,10 +575,13 @@ void Sapphire::Entity::BNpc::onTick()
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::update( uint64_t tickCount )
|
void Sapphire::Entity::BNpc::update( uint64_t tickCount )
|
||||||
{
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
|
||||||
const uint8_t maxDistanceToOrigin = 40;
|
const uint8_t maxDistanceToOrigin = 40;
|
||||||
const uint32_t roamTick = 20;
|
const uint32_t roamTick = 20;
|
||||||
|
|
||||||
auto pNaviProvider = m_pCurrentTerritory->getNaviProvider();
|
auto pNaviProvider = pZone->getNaviProvider();
|
||||||
|
|
||||||
if( !pNaviProvider )
|
if( !pNaviProvider )
|
||||||
return;
|
return;
|
||||||
|
@ -896,6 +904,8 @@ void Sapphire::Entity::BNpc::setFlag( uint32_t flag )
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
||||||
{
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
|
||||||
uint64_t tick = Util::getTimeMs();
|
uint64_t tick = Util::getTimeMs();
|
||||||
|
|
||||||
|
@ -918,7 +928,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
||||||
effectEntry.Arg0 = 3;
|
effectEntry.Arg0 = 3;
|
||||||
effectEntry.Arg1 = 7;
|
effectEntry.Arg1 = 7;
|
||||||
//effectEntry.Arg2 = 0x71;
|
//effectEntry.Arg2 = 0x71;
|
||||||
effectPacket->setSequence( getCurrentTerritory()->getNextEffectSequence() );
|
effectPacket->setSequence( pZone->getNextEffectSequence() );
|
||||||
effectPacket->addTargetEffect( effectEntry );
|
effectPacket->addTargetEffect( effectEntry );
|
||||||
|
|
||||||
sendToInRangeSet( effectPacket );
|
sendToInRangeSet( effectPacket );
|
||||||
|
|
|
@ -513,6 +513,9 @@ void Sapphire::Entity::Chara::autoAttack( CharaPtr pTarget )
|
||||||
/*! \param StatusEffectPtr to be applied to the actor */
|
/*! \param StatusEffectPtr to be applied to the actor */
|
||||||
void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEffect )
|
void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEffect )
|
||||||
{
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
|
||||||
int8_t nextSlot = getStatusEffectFreeSlot();
|
int8_t nextSlot = getStatusEffectFreeSlot();
|
||||||
// if there is no slot left, do not add the effect
|
// if there is no slot left, do not add the effect
|
||||||
if( nextSlot == -1 )
|
if( nextSlot == -1 )
|
||||||
|
@ -523,7 +526,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
||||||
|
|
||||||
auto statusEffectAdd = makeZonePacket< FFXIVIpcActionIntegrity >( getId() );
|
auto statusEffectAdd = makeZonePacket< FFXIVIpcActionIntegrity >( getId() );
|
||||||
|
|
||||||
statusEffectAdd->data().ResultId = getCurrentTerritory()->getNextEffectSequence();
|
statusEffectAdd->data().ResultId = pZone->getNextEffectSequence();
|
||||||
statusEffectAdd->data().Target = pEffect->getTargetActorId();
|
statusEffectAdd->data().Target = pEffect->getTargetActorId();
|
||||||
statusEffectAdd->data().Hp = getHp();
|
statusEffectAdd->data().Hp = getHp();
|
||||||
statusEffectAdd->data().Mp = static_cast< uint16_t >( getMp() );
|
statusEffectAdd->data().Mp = static_cast< uint16_t >( getMp() );
|
||||||
|
|
|
@ -67,7 +67,12 @@ void Sapphire::Entity::GameObject::setPos( float x, float y, float z, bool broad
|
||||||
m_pos.z = z;
|
m_pos.z = z;
|
||||||
|
|
||||||
if( broadcastUpdate )
|
if( broadcastUpdate )
|
||||||
m_pCurrentTerritory->updateActorPosition( *this );
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
pZone->updateActorPosition( *this );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::GameObject::setPos( const Sapphire::Common::FFXIVARR_POSITION3& pos, bool broadcastUpdate )
|
void Sapphire::Entity::GameObject::setPos( const Sapphire::Common::FFXIVARR_POSITION3& pos, bool broadcastUpdate )
|
||||||
|
@ -75,7 +80,11 @@ void Sapphire::Entity::GameObject::setPos( const Sapphire::Common::FFXIVARR_POSI
|
||||||
m_pos = pos;
|
m_pos = pos;
|
||||||
|
|
||||||
if( broadcastUpdate )
|
if( broadcastUpdate )
|
||||||
m_pCurrentTerritory->updateActorPosition( *this );
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
pZone->updateActorPosition( *this );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Sapphire::Entity::GameObject::getRot() const
|
float Sapphire::Entity::GameObject::getRot() const
|
||||||
|
@ -338,12 +347,32 @@ Sapphire::TerritoryPtr Sapphire::Entity::GameObject::getCurrentTerritory() const
|
||||||
return m_pCurrentTerritory;
|
return m_pCurrentTerritory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Sapphire::Entity::GameObject::getTerritoryTypeId() const
|
||||||
|
{
|
||||||
|
return m_territoryTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
/*! \param TerritoryPtr to the zone to be set as current */
|
/*! \param TerritoryPtr to the zone to be set as current */
|
||||||
void Sapphire::Entity::GameObject::setCurrentZone( TerritoryPtr currZone )
|
void Sapphire::Entity::GameObject::setCurrentZone( TerritoryPtr currZone )
|
||||||
{
|
{
|
||||||
m_pCurrentTerritory = currZone;
|
m_pCurrentTerritory = currZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::Entity::GameObject::setTerritoryTypeId( uint32_t territoryTypeId )
|
||||||
|
{
|
||||||
|
m_territoryTypeId = territoryTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Sapphire::Entity::GameObject::getTerritoryId() const
|
||||||
|
{
|
||||||
|
return m_territoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sapphire::Entity::GameObject::setTerritoryId( uint32_t territoryId )
|
||||||
|
{
|
||||||
|
m_territoryId = territoryId;
|
||||||
|
}
|
||||||
|
|
||||||
/*! \return InstanceContentPtr to the current instance, nullptr if not an instance or not set */
|
/*! \return InstanceContentPtr to the current instance, nullptr if not an instance or not set */
|
||||||
Sapphire::InstanceContentPtr Sapphire::Entity::GameObject::getCurrentInstance() const
|
Sapphire::InstanceContentPtr Sapphire::Entity::GameObject::getCurrentInstance() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,10 @@ namespace Sapphire::Entity
|
||||||
uint32_t m_id{};
|
uint32_t m_id{};
|
||||||
/*! Type of the actor */
|
/*! Type of the actor */
|
||||||
Common::ObjKind m_objKind;
|
Common::ObjKind m_objKind;
|
||||||
/*! Id of the zone the actor currently is in */
|
/*! Id of the territory type the actor currently is in */
|
||||||
uint32_t m_territoryTypeId{};
|
uint32_t m_territoryTypeId{};
|
||||||
|
/*! Specific GUId of the zone the actor currently is in */
|
||||||
|
uint32_t m_territoryId{};
|
||||||
/*! Ptr to the ZoneObj the actor belongs to */
|
/*! Ptr to the ZoneObj the actor belongs to */
|
||||||
TerritoryPtr m_pCurrentTerritory;
|
TerritoryPtr m_pCurrentTerritory;
|
||||||
|
|
||||||
|
@ -123,6 +125,12 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
TerritoryPtr getCurrentTerritory() const;
|
TerritoryPtr getCurrentTerritory() const;
|
||||||
|
|
||||||
|
uint32_t getTerritoryTypeId() const;
|
||||||
|
void setTerritoryTypeId( uint32_t territoryTypeId );
|
||||||
|
|
||||||
|
uint32_t getTerritoryId() const;
|
||||||
|
void setTerritoryId( uint32_t territoryTypeId );
|
||||||
|
|
||||||
void setCurrentZone( TerritoryPtr currZone );
|
void setCurrentZone( TerritoryPtr currZone );
|
||||||
|
|
||||||
InstanceContentPtr getCurrentInstance() const;
|
InstanceContentPtr getCurrentInstance() const;
|
||||||
|
|
|
@ -156,21 +156,11 @@ uint16_t Sapphire::Entity::Player::getZoneId() const
|
||||||
return m_territoryTypeId;
|
return m_territoryTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Sapphire::Entity::Player::getTerritoryId() const
|
|
||||||
{
|
|
||||||
return m_territoryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Sapphire::Entity::Player::getPrevTerritoryId() const
|
uint32_t Sapphire::Entity::Player::getPrevTerritoryId() const
|
||||||
{
|
{
|
||||||
return m_prevTerritoryId;
|
return m_prevTerritoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setTerritoryId( uint32_t territoryId )
|
|
||||||
{
|
|
||||||
m_territoryId = territoryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Sapphire::Entity::Player::getGmRank() const
|
uint8_t Sapphire::Entity::Player::getGmRank() const
|
||||||
{
|
{
|
||||||
return m_gmRank;
|
return m_gmRank;
|
||||||
|
@ -507,14 +497,17 @@ void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
||||||
{
|
{
|
||||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
m_onEnterEventDone = false;
|
m_onEnterEventDone = false;
|
||||||
if( !teriMgr.movePlayer( zoneId, *this ) )
|
|
||||||
|
auto pZone = teriMgr.getZoneByTerritoryTypeId( zoneId );
|
||||||
|
if( !teriMgr.movePlayer( pZone, *this ) )
|
||||||
{
|
{
|
||||||
// todo: this will require proper handling, for now just return the player to their previous area
|
// todo: this will require proper handling, for now just return the player to their previous area
|
||||||
m_pos = m_prevPos;
|
m_pos = m_prevPos;
|
||||||
m_rot = m_prevRot;
|
m_rot = m_prevRot;
|
||||||
m_territoryTypeId = m_prevTerritoryTypeId;
|
m_territoryTypeId = m_prevTerritoryTypeId;
|
||||||
|
|
||||||
if( !teriMgr.movePlayer( m_territoryTypeId, *this ) )
|
auto pZone1 = teriMgr.getZoneByTerritoryTypeId( m_territoryTypeId );
|
||||||
|
if( !teriMgr.movePlayer( pZone1, *this ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,15 +531,15 @@ bool Sapphire::Entity::Player::setInstance( const TerritoryPtr& instance )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
auto currentZone = getCurrentTerritory();
|
|
||||||
|
|
||||||
// zoning within the same zone won't cause the prev data to be overwritten
|
// zoning within the same zone won't cause the prev data to be overwritten
|
||||||
if( instance->getTerritoryTypeId() != m_territoryTypeId )
|
if( instance->getTerritoryTypeId() != m_territoryTypeId )
|
||||||
{
|
{
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
m_prevTerritoryTypeId = pZone->getTerritoryTypeId();
|
||||||
|
m_prevTerritoryId = getTerritoryId();
|
||||||
m_prevPos = m_pos;
|
m_prevPos = m_pos;
|
||||||
m_prevRot = m_rot;
|
m_prevRot = m_rot;
|
||||||
m_prevTerritoryTypeId = currentZone->getTerritoryTypeId();
|
|
||||||
m_prevTerritoryId = getTerritoryId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return teriMgr.movePlayer( instance, *this );
|
return teriMgr.movePlayer( instance, *this );
|
||||||
|
@ -559,15 +552,15 @@ bool Sapphire::Entity::Player::setInstance( const TerritoryPtr& instance, Common
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
auto currentZone = getCurrentTerritory();
|
|
||||||
|
|
||||||
// zoning within the same zone won't cause the prev data to be overwritten
|
// zoning within the same zone won't cause the prev data to be overwritten
|
||||||
if( instance->getTerritoryTypeId() != m_territoryTypeId )
|
if( instance->getTerritoryTypeId() != m_territoryTypeId )
|
||||||
{
|
{
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
m_prevTerritoryTypeId = pZone->getTerritoryTypeId();
|
||||||
|
m_prevTerritoryId = getTerritoryId();
|
||||||
m_prevPos = m_pos;
|
m_prevPos = m_pos;
|
||||||
m_prevRot = m_rot;
|
m_prevRot = m_rot;
|
||||||
m_prevTerritoryTypeId = currentZone->getTerritoryTypeId();
|
|
||||||
m_prevTerritoryId = getTerritoryId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( teriMgr.movePlayer( instance, *this ) )
|
if( teriMgr.movePlayer( instance, *this ) )
|
||||||
|
@ -582,8 +575,7 @@ bool Sapphire::Entity::Player::setInstance( const TerritoryPtr& instance, Common
|
||||||
bool Sapphire::Entity::Player::exitInstance()
|
bool Sapphire::Entity::Player::exitInstance()
|
||||||
{
|
{
|
||||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
auto pZone = getCurrentTerritory();
|
|
||||||
auto pInstance = pZone->getAsInstanceContent();
|
auto pInstance = pZone->getAsInstanceContent();
|
||||||
|
|
||||||
resetHp();
|
resetHp();
|
||||||
|
@ -597,7 +589,8 @@ bool Sapphire::Entity::Player::exitInstance()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !teriMgr.movePlayer( m_prevTerritoryTypeId, *this ) )
|
auto pPrevZone = teriMgr.getZoneByTerritoryTypeId( m_prevTerritoryTypeId );
|
||||||
|
if( !teriMgr.movePlayer( pPrevZone, *this ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,7 +1110,7 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
|
||||||
if( m_queuedZoneing && ( tickCount - m_queuedZoneing->m_queueTime ) > 800 )
|
if( m_queuedZoneing && ( tickCount - m_queuedZoneing->m_queueTime ) > 800 )
|
||||||
{
|
{
|
||||||
Common::FFXIVARR_POSITION3 targetPos = m_queuedZoneing->m_targetPosition;
|
Common::FFXIVARR_POSITION3 targetPos = m_queuedZoneing->m_targetPosition;
|
||||||
if( getCurrentTerritory()->getTerritoryTypeId() != m_queuedZoneing->m_targetZone )
|
if( getTerritoryTypeId() != m_queuedZoneing->m_targetZone )
|
||||||
{
|
{
|
||||||
performZoning( m_queuedZoneing->m_targetZone, targetPos, m_queuedZoneing->m_targetRotation );
|
performZoning( m_queuedZoneing->m_targetZone, targetPos, m_queuedZoneing->m_targetRotation );
|
||||||
}
|
}
|
||||||
|
@ -1490,6 +1483,9 @@ uint32_t Sapphire::Entity::Player::getPersistentEmote() const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
||||||
{
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
|
||||||
auto mainWeap = getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand );
|
auto mainWeap = getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand );
|
||||||
|
|
||||||
pTarget->onActionHostile( getAsChara() );
|
pTarget->onActionHostile( getAsChara() );
|
||||||
|
@ -1522,7 +1518,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
||||||
//entry.Arg2 = 0x73;
|
//entry.Arg2 = 0x73;
|
||||||
}
|
}
|
||||||
|
|
||||||
effectPacket->setSequence( getCurrentTerritory()->getNextEffectSequence() );
|
effectPacket->setSequence( pZone->getNextEffectSequence() );
|
||||||
|
|
||||||
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
||||||
effectPacket->addTargetEffect( entry );
|
effectPacket->addTargetEffect( entry );
|
||||||
|
@ -1591,16 +1587,6 @@ void Sapphire::Entity::Player::setEorzeaTimeOffset( uint64_t timestamp )
|
||||||
queuePacket( packet );
|
queuePacket( packet );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setTerritoryTypeId( uint32_t territoryTypeId )
|
|
||||||
{
|
|
||||||
m_territoryTypeId = territoryTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Sapphire::Entity::Player::getTerritoryTypeId() const
|
|
||||||
{
|
|
||||||
return m_territoryTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Sapphire::Entity::Player::getPrevTerritoryTypeId() const
|
uint32_t Sapphire::Entity::Player::getPrevTerritoryTypeId() const
|
||||||
{
|
{
|
||||||
return m_prevTerritoryTypeId;
|
return m_prevTerritoryTypeId;
|
||||||
|
@ -1608,6 +1594,9 @@ uint32_t Sapphire::Entity::Player::getPrevTerritoryTypeId() const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::sendZonePackets()
|
void Sapphire::Entity::Player::sendZonePackets()
|
||||||
{
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
|
||||||
|
|
||||||
auto initPacket = makeZonePacket< FFXIVIpcLogin >( getId() );
|
auto initPacket = makeZonePacket< FFXIVIpcLogin >( getId() );
|
||||||
initPacket->data().playerActorId = getId();
|
initPacket->data().playerActorId = getId();
|
||||||
queuePacket( initPacket );
|
queuePacket( initPacket );
|
||||||
|
@ -1664,9 +1653,9 @@ void Sapphire::Entity::Player::sendZonePackets()
|
||||||
|
|
||||||
sendLandFlags();
|
sendLandFlags();
|
||||||
|
|
||||||
queuePacket( makeInitZone( *this, *getCurrentTerritory() ) );
|
queuePacket( makeInitZone( *this, *pZone ) );
|
||||||
|
|
||||||
getCurrentTerritory()->onPlayerZoneIn( *this );
|
pZone->onPlayerZoneIn( *this );
|
||||||
|
|
||||||
if( isLogin() )
|
if( isLogin() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -317,11 +317,7 @@ namespace Sapphire::Entity
|
||||||
/*! returns the player to their position before zoning into an instance */
|
/*! returns the player to their position before zoning into an instance */
|
||||||
bool exitInstance();
|
bool exitInstance();
|
||||||
|
|
||||||
/*! sets the players territoryTypeId */
|
|
||||||
void setTerritoryTypeId( uint32_t territoryTypeId );
|
|
||||||
|
|
||||||
/*! gets the players territoryTypeId */
|
/*! gets the players territoryTypeId */
|
||||||
uint32_t getTerritoryTypeId() const;
|
|
||||||
uint32_t getPrevTerritoryTypeId() const;
|
uint32_t getPrevTerritoryTypeId() const;
|
||||||
|
|
||||||
void forceZoneing( uint32_t zoneId );
|
void forceZoneing( uint32_t zoneId );
|
||||||
|
@ -644,9 +640,6 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
uint16_t getZoneId() const;
|
uint16_t getZoneId() const;
|
||||||
|
|
||||||
uint32_t getTerritoryId() const;
|
|
||||||
void setTerritoryId( uint32_t territoryId );
|
|
||||||
|
|
||||||
uint32_t getPrevTerritoryId() const;
|
uint32_t getPrevTerritoryId() const;
|
||||||
|
|
||||||
uint8_t getGmRank() const;
|
uint8_t getGmRank() const;
|
||||||
|
@ -933,7 +926,6 @@ namespace Sapphire::Entity
|
||||||
bool m_bAutoattack;
|
bool m_bAutoattack;
|
||||||
|
|
||||||
Common::ZoneingType m_zoningType;
|
Common::ZoneingType m_zoningType;
|
||||||
uint32_t m_territoryId{};
|
|
||||||
|
|
||||||
bool m_bMarkedForZoning;
|
bool m_bMarkedForZoning;
|
||||||
bool m_bNewAdventurer{};
|
bool m_bNewAdventurer{};
|
||||||
|
|
|
@ -151,8 +151,9 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
|
||||||
{
|
{
|
||||||
auto& server = Sapphire::Common::Service< Sapphire::World::WorldServer >::ref();
|
auto& server = Sapphire::Common::Service< Sapphire::World::WorldServer >::ref();
|
||||||
auto pSession = server.getSession( player.getCharacterId() );
|
auto pSession = server.getSession( player.getCharacterId() );
|
||||||
|
|
||||||
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||||
std::string subCommand = "";
|
std::string subCommand = "";
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
@ -270,7 +271,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
|
||||||
|
|
||||||
sscanf( params.c_str(), "%d", &weatherId );
|
sscanf( params.c_str(), "%d", &weatherId );
|
||||||
|
|
||||||
player.getCurrentTerritory()->setWeatherOverride( static_cast< Common::Weather >( weatherId ) );
|
pCurrentZone->setWeatherOverride( static_cast< Common::Weather >( weatherId ) );
|
||||||
}
|
}
|
||||||
else if( subCommand == "festival" )
|
else if( subCommand == "festival" )
|
||||||
{
|
{
|
||||||
|
@ -387,6 +388,8 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
|
||||||
{
|
{
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
auto pSession = server.getSession( player.getCharacterId() );
|
auto pSession = server.getSession( player.getCharacterId() );
|
||||||
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
@ -503,7 +506,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
|
||||||
|
|
||||||
effectPacket->addTargetEffect( entry, static_cast< uint64_t >( player.getId() ) );
|
effectPacket->addTargetEffect( entry, static_cast< uint64_t >( player.getId() ) );
|
||||||
|
|
||||||
auto sequence = player.getCurrentTerritory()->getNextEffectSequence();
|
auto sequence = pCurrentZone->getNextEffectSequence();
|
||||||
effectPacket->setSequence( sequence );
|
effectPacket->setSequence( sequence );
|
||||||
|
|
||||||
// effectPacket->setAnimationId( param1 );
|
// effectPacket->setAnimationId( param1 );
|
||||||
|
@ -546,11 +549,11 @@ void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player&
|
||||||
if( ( subCommand == "pos" ) )
|
if( ( subCommand == "pos" ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
int16_t map_id = exdData.getRow< Component::Excel::TerritoryType >( player.getCurrentTerritory()->getTerritoryTypeId() )->data().Map;
|
int16_t map_id = exdData.getRow< Component::Excel::TerritoryType >( player.getTerritoryTypeId() )->data().Map;
|
||||||
|
|
||||||
PlayerMgr::sendServerNotice( player, "Pos:\n {0}\n {1}\n {2}\n {3}\n MapId: {4}\n ZoneId:{5}",
|
PlayerMgr::sendServerNotice( player, "Pos:\n {0}\n {1}\n {2}\n {3}\n MapId: {4}\n ZoneId:{5}",
|
||||||
player.getPos().x, player.getPos().y, player.getPos().z,
|
player.getPos().x, player.getPos().y, player.getPos().z,
|
||||||
player.getRot(), map_id, player.getCurrentTerritory()->getTerritoryTypeId());
|
player.getRot(), map_id, player.getTerritoryTypeId() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -784,6 +787,8 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
||||||
|
@ -890,7 +895,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
sscanf( params.c_str(), "%d", &mode );
|
sscanf( params.c_str(), "%d", &mode );
|
||||||
if( mode < 5 )
|
if( mode < 5 )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -899,7 +904,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
}
|
}
|
||||||
else if( subCommand == "todo" )
|
else if( subCommand == "todo" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -909,7 +914,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
}
|
}
|
||||||
else if( subCommand == "time" )
|
else if( subCommand == "time" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -922,7 +927,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
}
|
}
|
||||||
else if( subCommand == "fail" )
|
else if( subCommand == "fail" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -938,7 +943,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
sscanf( params.c_str(), "%d %d", &index, &value );
|
sscanf( params.c_str(), "%d %d", &index, &value );
|
||||||
|
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -951,7 +956,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
|
|
||||||
sscanf( params.c_str(), "%s %hhu", objName, &state );
|
sscanf( params.c_str(), "%s %hhu", objName, &state );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -969,7 +974,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
|
|
||||||
sscanf( params.c_str(), "%s %i %i", objName, &state1, &state2 );
|
sscanf( params.c_str(), "%s %i %i", objName, &state1, &state2 );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -988,7 +993,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
|
|
||||||
sscanf( params.c_str(), "%hhu", &seq );
|
sscanf( params.c_str(), "%hhu", &seq );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1000,7 +1005,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
|
|
||||||
sscanf( params.c_str(), "%hhu", &flags );
|
sscanf( params.c_str(), "%hhu", &flags );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1008,7 +1013,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
}
|
}
|
||||||
else if( subCommand == "qte_start" )
|
else if( subCommand == "qte_start" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1017,7 +1022,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
}
|
}
|
||||||
else if( subCommand == "event_start" )
|
else if( subCommand == "event_start" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1026,7 +1031,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
||||||
}
|
}
|
||||||
else if( subCommand == "event_end" )
|
else if( subCommand == "event_end" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< InstanceContent >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1051,6 +1056,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
||||||
|
@ -1083,7 +1089,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
else if( subCommand == "complete" )
|
else if( subCommand == "complete" )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1093,7 +1099,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
else if( subCommand == "fail" )
|
else if( subCommand == "fail" )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1133,7 +1139,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
sscanf( params.c_str(), "%d %d", &index, &value );
|
sscanf( params.c_str(), "%d %d", &index, &value );
|
||||||
|
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1146,7 +1152,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
|
|
||||||
sscanf( params.c_str(), "%s %hhu", objName, &state );
|
sscanf( params.c_str(), "%s %hhu", objName, &state );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1164,7 +1170,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
|
|
||||||
sscanf( params.c_str(), "%s %i %i", objName, &state1, &state2 );
|
sscanf( params.c_str(), "%s %i %i", objName, &state1, &state2 );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1183,7 +1189,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
|
|
||||||
sscanf( params.c_str(), "%hhu", &seq );
|
sscanf( params.c_str(), "%hhu", &seq );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1195,7 +1201,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
|
|
||||||
sscanf( params.c_str(), "%hhu", &flags );
|
sscanf( params.c_str(), "%hhu", &flags );
|
||||||
|
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1203,7 +1209,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
}
|
}
|
||||||
else if( subCommand == "qte_start" )
|
else if( subCommand == "qte_start" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1212,7 +1218,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
}
|
}
|
||||||
else if( subCommand == "event_start" )
|
else if( subCommand == "event_start" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1221,7 +1227,7 @@ void Sapphire::World::Manager::DebugCommandMgr::questBattle( char* data, Entity:
|
||||||
}
|
}
|
||||||
else if( subCommand == "event_end" )
|
else if( subCommand == "event_end" )
|
||||||
{
|
{
|
||||||
auto instance = std::dynamic_pointer_cast< QuestBattle >( player.getCurrentTerritory() );
|
auto instance = std::dynamic_pointer_cast< QuestBattle >( pCurrentZone );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Territory/Housing/HousingInteriorTerritory.h"
|
#include "Territory/Housing/HousingInteriorTerritory.h"
|
||||||
#include "HousingMgr.h"
|
#include "HousingMgr.h"
|
||||||
#include "EventMgr.h"
|
#include "EventMgr.h"
|
||||||
|
#include "TerritoryMgr.h"
|
||||||
#include "Territory/Land.h"
|
#include "Territory/Land.h"
|
||||||
#include "WorldServer.h"
|
#include "WorldServer.h"
|
||||||
#include "Territory/House.h"
|
#include "Territory/House.h"
|
||||||
|
@ -370,13 +371,12 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& pla
|
||||||
pSession->getZoneConnection()->queueOutPacket( plotPricePacket );
|
pSession->getZoneConnection()->queueOutPacket( plotPricePacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand( Entity::Player& player, uint8_t plot, uint8_t state )
|
Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand( Entity::Player& player, HousingZone& zone, uint8_t plot, uint8_t state )
|
||||||
{
|
{
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
|
||||||
|
|
||||||
auto plotPrice = pHousing->getLand( plot )->getCurrentPrice();
|
auto plotPrice = zone.getLand( plot )->getCurrentPrice();
|
||||||
auto gilAvailable = player.getCurrency( CurrencyType::Gil );
|
auto gilAvailable = player.getCurrency( CurrencyType::Gil );
|
||||||
auto pLand = pHousing->getLand( plot );
|
auto pLand = zone.getLand( plot );
|
||||||
|
|
||||||
if( !pLand )
|
if( !pLand )
|
||||||
return LandPurchaseResult::ERR_INTERNAL;
|
return LandPurchaseResult::ERR_INTERNAL;
|
||||||
|
@ -413,7 +413,7 @@ Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand(
|
||||||
//pLand->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) );
|
//pLand->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) );
|
||||||
pLand->updateLandDb();
|
pLand->updateLandDb();
|
||||||
|
|
||||||
pHousing->sendLandUpdate( plot );
|
zone.sendLandUpdate( plot );
|
||||||
return LandPurchaseResult::SUCCESS;
|
return LandPurchaseResult::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,16 +423,15 @@ Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& player, uint8_t plot )
|
bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& player, HousingZone& zone, uint8_t plot )
|
||||||
{
|
{
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
|
|
||||||
auto pSession = server.getSession( player.getCharacterId() );
|
auto pSession = server.getSession( player.getCharacterId() );
|
||||||
// TODO: Fix "permissions" being sent incorrectly
|
// TODO: Fix "permissions" being sent incorrectly
|
||||||
// TODO: Add checks for land state before relinquishing
|
// TODO: Add checks for land state before relinquishing
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
|
||||||
|
|
||||||
auto pLand = pHousing->getLand( plot );
|
auto pLand = zone.getLand( plot );
|
||||||
auto plotMaxPrice = pLand->getCurrentPrice();
|
auto plotMaxPrice = pLand->getCurrentPrice();
|
||||||
|
|
||||||
// can't relinquish when you are not the owner
|
// can't relinquish when you are not the owner
|
||||||
|
@ -468,7 +467,7 @@ bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& playe
|
||||||
auto screenMsgPkt2 = makeActorControlSelf( player.getId(), ActorControl::LogMsg, 3351, 0x1AA,
|
auto screenMsgPkt2 = makeActorControlSelf( player.getId(), ActorControl::LogMsg, 3351, 0x1AA,
|
||||||
pLand->getLandIdent().wardNum + 1, plot + 1 );
|
pLand->getLandIdent().wardNum + 1, plot + 1 );
|
||||||
pSession->getZoneConnection()->queueOutPacket( screenMsgPkt2 );
|
pSession->getZoneConnection()->queueOutPacket( screenMsgPkt2 );
|
||||||
pHousing->sendLandUpdate( plot );
|
zone.sendLandUpdate( plot );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -677,17 +676,12 @@ void Sapphire::World::Manager::HousingMgr::createHouse( Sapphire::HousePtr house
|
||||||
db.execute( stmt );
|
db.execute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetCatalogId )
|
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, HousingZone& zone, uint8_t plotNum, uint32_t presetCatalogId )
|
||||||
{
|
{
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
auto pSession = server.getSession( player.getCharacterId() );
|
auto pSession = server.getSession( player.getCharacterId() );
|
||||||
|
|
||||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto pLand = zone.getLand( plotNum );
|
||||||
|
|
||||||
if( !hZone )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto pLand = hZone->getLand( plotNum );
|
|
||||||
if( !pLand )
|
if( !pLand )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -714,7 +708,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
||||||
|
|
||||||
pLand->setStatus( HouseStatus::PrivateEstate );
|
pLand->setStatus( HouseStatus::PrivateEstate );
|
||||||
pLand->setLandType( LandType::Private );
|
pLand->setLandType( LandType::Private );
|
||||||
hZone->sendLandUpdate( plotNum );
|
zone.sendLandUpdate( plotNum );
|
||||||
|
|
||||||
auto pSuccessBuildingPacket = makeActorControl( player.getId(), ActorControl::BuildPresetResponse, plotNum );
|
auto pSuccessBuildingPacket = makeActorControl( player.getId(), ActorControl::BuildPresetResponse, plotNum );
|
||||||
|
|
||||||
|
@ -730,7 +724,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
||||||
player.setLandFlags( LandFlagsSlot::Private, HOUSING_LAND_STATUS::HOUSING_LAND_STATUS_BUILDHOUSE, ident );
|
player.setLandFlags( LandFlagsSlot::Private, HOUSING_LAND_STATUS::HOUSING_LAND_STATUS_BUILDHOUSE, ident );
|
||||||
player.sendLandFlagsSlot( LandFlagsSlot::Private );
|
player.sendLandFlagsSlot( LandFlagsSlot::Private );
|
||||||
|
|
||||||
hZone->registerEstateEntranceEObj( plotNum );
|
zone.registerEstateEntranceEObj( plotNum );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident )
|
void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident )
|
||||||
|
@ -855,17 +849,17 @@ Sapphire::Common::LandIdent Sapphire::World::Manager::HousingMgr::clientTriggerP
|
||||||
return ident;
|
return ident;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player& player, uint16_t inventoryType,
|
void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player& player, uint16_t inventoryType, uint8_t plotNum )
|
||||||
uint8_t plotNum )
|
|
||||||
{
|
{
|
||||||
Sapphire::LandPtr targetLand;
|
Sapphire::LandPtr targetLand;
|
||||||
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
// plotNum will be 255 in the event that it's an internal zone
|
// plotNum will be 255 in the event that it's an internal zone
|
||||||
// and we have to switch up our way of getting the LandPtr
|
// and we have to switch up our way of getting the LandPtr
|
||||||
if( plotNum == 255 )
|
if( plotNum == 255 )
|
||||||
{
|
{
|
||||||
auto internalZone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
auto internalZone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone );
|
||||||
player.getCurrentTerritory() );
|
|
||||||
if( !internalZone )
|
if( !internalZone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -881,7 +875,7 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||||
if( !zone )
|
if( !zone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -903,26 +897,22 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
|
||||||
invMgr.sendInventoryContainer( player, it->second );
|
invMgr.sendInventoryContainer( player, it->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
const Sapphire::World::Manager::HousingMgr::LandSetLandCacheMap&
|
const Sapphire::World::Manager::HousingMgr::LandSetLandCacheMap& Sapphire::World::Manager::HousingMgr::getLandCacheMap()
|
||||||
Sapphire::World::Manager::HousingMgr::getLandCacheMap()
|
|
||||||
{
|
{
|
||||||
return m_landCache;
|
return m_landCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::World::Manager::HousingMgr::LandIdentToInventoryContainerMap&
|
Sapphire::World::Manager::HousingMgr::LandIdentToInventoryContainerMap& Sapphire::World::Manager::HousingMgr::getEstateInventories()
|
||||||
Sapphire::World::Manager::HousingMgr::getEstateInventories()
|
|
||||||
{
|
{
|
||||||
return m_estateInventories;
|
return m_estateInventories;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::World::Manager::HousingMgr::ContainerIdToContainerMap&
|
Sapphire::World::Manager::HousingMgr::ContainerIdToContainerMap& Sapphire::World::Manager::HousingMgr::getEstateInventory( uint64_t ident )
|
||||||
Sapphire::World::Manager::HousingMgr::getEstateInventory( uint64_t ident )
|
|
||||||
{
|
{
|
||||||
return m_estateInventories[ ident ];
|
return m_estateInventories[ ident ];
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::World::Manager::HousingMgr::ContainerIdToContainerMap&
|
Sapphire::World::Manager::HousingMgr::ContainerIdToContainerMap& Sapphire::World::Manager::HousingMgr::getEstateInventory( Sapphire::Common::LandIdent ident )
|
||||||
Sapphire::World::Manager::HousingMgr::getEstateInventory( Sapphire::Common::LandIdent ident )
|
|
||||||
{
|
{
|
||||||
auto u64ident = *reinterpret_cast< uint64_t* >( &ident );
|
auto u64ident = *reinterpret_cast< uint64_t* >( &ident );
|
||||||
|
|
||||||
|
@ -962,8 +952,7 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
|
||||||
{
|
{
|
||||||
for( auto& item : intContainer->second->getItemMap() )
|
for( auto& item : intContainer->second->getItemMap() )
|
||||||
{
|
{
|
||||||
house->setInteriorModel( static_cast< Common::HouseInteriorSlot >( item.first ),
|
house->setInteriorModel( static_cast< Common::HouseInteriorSlot >( item.first ), getItemAdditionalData( item.second->getId() ) );
|
||||||
getItemAdditionalData( item.second->getId() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -997,6 +986,9 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
|
||||||
{
|
{
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
auto pSession = server.getSession( player.getCharacterId() );
|
auto pSession = server.getSession( player.getCharacterId() );
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
// retail process is:
|
// retail process is:
|
||||||
// - unlink item from current container
|
// - unlink item from current container
|
||||||
// - add it to destination container
|
// - add it to destination container
|
||||||
|
@ -1008,15 +1000,14 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
|
||||||
bool isOutside = false;
|
bool isOutside = false;
|
||||||
|
|
||||||
// inside housing territory
|
// inside housing territory
|
||||||
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
if( auto zone = std::dynamic_pointer_cast< HousingZone >( pZone ) )
|
||||||
{
|
{
|
||||||
land = zone->getLand( static_cast< uint8_t >( landId ) );
|
land = zone->getLand( static_cast< uint8_t >( landId ) );
|
||||||
|
|
||||||
isOutside = true;
|
isOutside = true;
|
||||||
}
|
}
|
||||||
// otherwise, inside a house. landId is 0 when inside a plot
|
// otherwise, inside a house. landId is 0 when inside a plot
|
||||||
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ) )
|
||||||
player.getCurrentTerritory() ) )
|
|
||||||
{
|
{
|
||||||
// todo: this whole process is retarded and needs to be fixed
|
// todo: this whole process is retarded and needs to be fixed
|
||||||
// perhaps maintain a list of estates by ident inside housingmgr?
|
// perhaps maintain a list of estates by ident inside housingmgr?
|
||||||
|
@ -1075,19 +1066,20 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
|
||||||
PlayerMgr::sendUrgent( player, "An internal error occurred when placing the item." );
|
PlayerMgr::sendUrgent( player, "An internal error occurred when placing the item." );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity::Player& player, uint16_t landId,
|
void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity::Player& player, uint16_t landId, uint16_t containerId, uint8_t slotId )
|
||||||
uint16_t containerId, uint8_t slotId )
|
|
||||||
{
|
{
|
||||||
LandPtr land;
|
LandPtr land;
|
||||||
bool isOutside = false;
|
bool isOutside = false;
|
||||||
|
|
||||||
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
|
if( auto zone = std::dynamic_pointer_cast< HousingZone >( pZone ) )
|
||||||
{
|
{
|
||||||
land = zone->getLand( static_cast< uint8_t >( landId ) );
|
land = zone->getLand( static_cast< uint8_t >( landId ) );
|
||||||
isOutside = true;
|
isOutside = true;
|
||||||
}
|
}
|
||||||
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ) )
|
||||||
player.getCurrentTerritory() ) )
|
|
||||||
{
|
{
|
||||||
// todo: this whole process is retarded and needs to be fixed
|
// todo: this whole process is retarded and needs to be fixed
|
||||||
// perhaps maintain a list of estates by ident inside housingmgr?
|
// perhaps maintain a list of estates by ident inside housingmgr?
|
||||||
|
@ -1146,9 +1138,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& player,
|
bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& player, Inventory::HousingItemPtr item, Common::LandIdent ident )
|
||||||
Inventory::HousingItemPtr item,
|
|
||||||
Common::LandIdent ident )
|
|
||||||
{
|
{
|
||||||
auto& invMgr = Service< InventoryMgr >::ref();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
|
||||||
|
@ -1171,8 +1161,11 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
|
||||||
invMgr.saveHousingContainer( ident, container );
|
invMgr.saveHousingContainer( ident, container );
|
||||||
invMgr.updateHousingItemPosition( item );
|
invMgr.updateHousingItemPosition( item );
|
||||||
|
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
// add to zone and spawn
|
// add to zone and spawn
|
||||||
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||||
assert( zone );
|
assert( zone );
|
||||||
|
|
||||||
zone->spawnYardObject( static_cast< uint8_t >( ident.landId ), static_cast< uint16_t >( freeSlot ), *item );
|
zone->spawnYardObject( static_cast< uint8_t >( ident.landId ), static_cast< uint16_t >( freeSlot ), *item );
|
||||||
|
@ -1184,8 +1177,10 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
||||||
Inventory::HousingItemPtr item )
|
Inventory::HousingItemPtr item )
|
||||||
{
|
{
|
||||||
auto& invMgr = Service< InventoryMgr >::ref();
|
auto& invMgr = Service< InventoryMgr >::ref();
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone );
|
||||||
assert( zone );
|
assert( zone );
|
||||||
|
|
||||||
auto ident = zone->getLandIdent();
|
auto ident = zone->getLandIdent();
|
||||||
|
@ -1216,7 +1211,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
||||||
invMgr.saveHousingContainer( ident, container );
|
invMgr.saveHousingContainer( ident, container );
|
||||||
invMgr.updateHousingItemPosition( item );
|
invMgr.updateHousingItemPosition( item );
|
||||||
|
|
||||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone );
|
||||||
assert( zone );
|
assert( zone );
|
||||||
|
|
||||||
zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item );
|
zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item );
|
||||||
|
@ -1240,10 +1235,12 @@ Sapphire::Common::Furniture Sapphire::World::Manager::HousingMgr::getYardObjectF
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sapphire::Entity::Player& player,
|
void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sapphire::Entity::Player& player, bool storeroom )
|
||||||
bool storeroom )
|
|
||||||
{
|
{
|
||||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
|
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone );
|
||||||
if( !zone )
|
if( !zone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1269,9 +1266,8 @@ void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& player,
|
void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& player, Common::LandIdent ident,
|
||||||
Common::LandIdent ident, uint8_t slot,
|
uint8_t slot, Common::FFXIVARR_POSITION3 pos, float rot )
|
||||||
Common::FFXIVARR_POSITION3 pos, float rot )
|
|
||||||
{
|
{
|
||||||
auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||||
auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
|
auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||||
|
@ -1282,14 +1278,16 @@ void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& p
|
||||||
if( !hasPermission( player, *land, 0 ) )
|
if( !hasPermission( player, *land, 0 ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
// todo: what happens when either of these fail? how does the server let the client know that the moment failed
|
// todo: what happens when either of these fail? how does the server let the client know that the moment failed
|
||||||
// as is, if it does fail, the client will be locked and unable to move any item until reentering the territory
|
// as is, if it does fail, the client will be locked and unable to move any item until reentering the territory
|
||||||
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ) )
|
||||||
player.getCurrentTerritory() ) )
|
|
||||||
{
|
{
|
||||||
moveInternalItem( player, ident, *terri, slot, pos, rot );
|
moveInternalItem( player, ident, *terri, slot, pos, rot );
|
||||||
}
|
}
|
||||||
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( pZone ) )
|
||||||
{
|
{
|
||||||
moveExternalItem( player, ident, slot, *terri, pos, rot );
|
moveExternalItem( player, ident, slot, *terri, pos, rot );
|
||||||
}
|
}
|
||||||
|
@ -1387,8 +1385,10 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
|
||||||
uint16_t containerId, uint8_t slot,
|
uint16_t containerId, uint8_t slot,
|
||||||
bool sendToStoreroom )
|
bool sendToStoreroom )
|
||||||
{
|
{
|
||||||
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
player.getCurrentTerritory() ) )
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
|
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ) )
|
||||||
{
|
{
|
||||||
auto ident = terri->getLandIdent();
|
auto ident = terri->getLandIdent();
|
||||||
auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||||
|
@ -1402,7 +1402,7 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
|
||||||
|
|
||||||
removeInternalItem( player, *terri, containerId, slot, sendToStoreroom );
|
removeInternalItem( player, *terri, containerId, slot, sendToStoreroom );
|
||||||
}
|
}
|
||||||
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
|
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( pZone ) )
|
||||||
{
|
{
|
||||||
auto land = terri->getLand( static_cast< uint8_t >( plot ) );
|
auto land = terri->getLand( static_cast< uint8_t >( plot ) );
|
||||||
if( !land )
|
if( !land )
|
||||||
|
@ -1594,7 +1594,10 @@ void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::E
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
auto pSession = server.getSession( player.getCharacterId() );
|
auto pSession = server.getSession( player.getCharacterId() );
|
||||||
|
|
||||||
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
|
auto terri = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||||
if( !terri )
|
if( !terri )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1621,10 +1624,13 @@ void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::E
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::Entity::Player& player )
|
void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::Entity::Player& player )
|
||||||
{
|
{
|
||||||
|
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
auto pSession = server.getSession( player.getCharacterId() );
|
auto pSession = server.getSession( player.getCharacterId() );
|
||||||
|
|
||||||
auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone );
|
||||||
if( !terri )
|
if( !terri )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Sapphire::World::Manager
|
||||||
|
|
||||||
void sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident );
|
void sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident );
|
||||||
void sendLandSignFree( Entity::Player& player, const Common::LandIdent ident );
|
void sendLandSignFree( Entity::Player& player, const Common::LandIdent ident );
|
||||||
LandPurchaseResult purchaseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
LandPurchaseResult purchaseLand( Entity::Player& player, HousingZone& zone, uint8_t plot, uint8_t state );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Converts param1 of a client trigger into a Common::LandIndent
|
* @brief Converts param1 of a client trigger into a Common::LandIndent
|
||||||
|
@ -86,9 +86,9 @@ namespace Sapphire::World::Manager
|
||||||
|
|
||||||
void sendWardLandInfo( Entity::Player& player, uint8_t wardId, uint16_t territoryTypeId );
|
void sendWardLandInfo( Entity::Player& player, uint8_t wardId, uint16_t territoryTypeId );
|
||||||
|
|
||||||
bool relinquishLand( Entity::Player& player, uint8_t plot );
|
bool relinquishLand( Entity::Player& player, HousingZone& zone, uint8_t plot );
|
||||||
|
|
||||||
void buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetCatalogId );
|
void buildPresetEstate( Entity::Player& player, HousingZone& zone, uint8_t plotNum, uint32_t presetCatalogId );
|
||||||
|
|
||||||
void requestEstateRename( Entity::Player& player, const Common::LandIdent ident );
|
void requestEstateRename( Entity::Player& player, const Common::LandIdent ident );
|
||||||
|
|
||||||
|
|
|
@ -644,15 +644,7 @@ Sapphire::World::Manager::TerritoryMgr::InstanceIdList
|
||||||
return idList;
|
return idList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( uint32_t territoryTypeId, Sapphire::Entity::Player& player )
|
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( const TerritoryPtr& pZone, Sapphire::Entity::Player& player )
|
||||||
{
|
|
||||||
auto pZone = getZoneByTerritoryTypeId( territoryTypeId );
|
|
||||||
if( !pZone )
|
|
||||||
return false;
|
|
||||||
return movePlayer( pZone, player );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( TerritoryPtr pZone, Sapphire::Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
if( !pZone )
|
if( !pZone )
|
||||||
{
|
{
|
||||||
|
@ -660,6 +652,8 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( TerritoryPtr pZone, Sap
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto pPrevZone = getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
player.setStateFlag( Common::PlayerStateFlag::BetweenAreas );
|
player.setStateFlag( Common::PlayerStateFlag::BetweenAreas );
|
||||||
|
|
||||||
player.initSpawnIdQueue();
|
player.initSpawnIdQueue();
|
||||||
|
@ -672,13 +666,9 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( TerritoryPtr pZone, Sap
|
||||||
if( pHousing )
|
if( pHousing )
|
||||||
player.setTerritoryId( pHousing->getLandSetId() );
|
player.setTerritoryId( pHousing->getLandSetId() );
|
||||||
}
|
}
|
||||||
else if( isInstanceContentTerritory( pZone->getTerritoryTypeId() ) )
|
|
||||||
{
|
|
||||||
player.setTerritoryId( pZone->getGuId() );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.setTerritoryId( 0 );
|
player.setTerritoryId( pZone->getGuId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool playerLoaded = player.isLoadingComplete();
|
bool playerLoaded = player.isLoadingComplete();
|
||||||
|
@ -686,8 +676,8 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( TerritoryPtr pZone, Sap
|
||||||
// mark character as zoning in progress
|
// mark character as zoning in progress
|
||||||
player.setLoadingComplete( false );
|
player.setLoadingComplete( false );
|
||||||
|
|
||||||
if( playerLoaded && player.getCurrentTerritory() )
|
if( playerLoaded && pPrevZone )
|
||||||
player.getCurrentTerritory()->removeActor( player.getAsPlayer() );
|
pPrevZone->removeActor( player.getAsPlayer() );
|
||||||
|
|
||||||
player.setCurrentZone( pZone );
|
player.setCurrentZone( pZone );
|
||||||
pZone->pushActor( player.getAsPlayer() );
|
pZone->pushActor( player.getAsPlayer() );
|
||||||
|
|
|
@ -136,9 +136,7 @@ namespace Sapphire::World::Manager
|
||||||
/*! returns a Zone by landSetId */
|
/*! returns a Zone by landSetId */
|
||||||
TerritoryPtr getZoneByLandSetId( uint32_t landSetId ) const;
|
TerritoryPtr getZoneByLandSetId( uint32_t landSetId ) const;
|
||||||
|
|
||||||
bool movePlayer( uint32_t territoryTypeId, Entity::Player& pPlayer );
|
bool movePlayer( const TerritoryPtr&, Entity::Player& player );
|
||||||
|
|
||||||
bool movePlayer( TerritoryPtr, Entity::Player& player );
|
|
||||||
|
|
||||||
/*! returns an instancePtr if the player is still bound to an isntance */
|
/*! returns an instancePtr if the player is still bound to an isntance */
|
||||||
TerritoryPtr getLinkedInstance( uint32_t playerId ) const;
|
TerritoryPtr getLinkedInstance( uint32_t playerId ) const;
|
||||||
|
|
47
src/world/Manager/WarpMgr.h
Normal file
47
src/world/Manager/WarpMgr.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include <ForwardsZone.h>
|
||||||
|
|
||||||
|
namespace Sapphire::World::Manager
|
||||||
|
{
|
||||||
|
struct QueuedWarp
|
||||||
|
{
|
||||||
|
Common::WarpType m_warpType;
|
||||||
|
uint64_t m_characterId;
|
||||||
|
uint16_t m_targetZoneId;
|
||||||
|
Common::FFXIVARR_POSITION3 m_targetPosition;
|
||||||
|
float m_targetRotation;
|
||||||
|
uint64_t m_delayTime;
|
||||||
|
|
||||||
|
QueuedWarp( uint64_t characterId, Common::WarpType warpType, uint16_t targetZoneId,
|
||||||
|
const Common::FFXIVARR_POSITION3& targetPosition, float targetRotation, uint64_t delayTime ) :
|
||||||
|
m_characterId( characterId ),
|
||||||
|
m_warpType( warpType ),
|
||||||
|
m_targetZoneId( targetZoneId ),
|
||||||
|
m_targetPosition( targetPosition ),
|
||||||
|
m_targetRotation( targetRotation ),
|
||||||
|
m_delayTime( delayTime ),
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class WarpMgr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WarpMgr() = default;
|
||||||
|
|
||||||
|
// queue a new warp process to be executed when the delaytime (ms) expired
|
||||||
|
void queueWarp( uint64_t characterId, Common::WarpType warpType, uint16_t targetZoneId,
|
||||||
|
const Common::FFXIVARR_POSITION3& targetPosition, float targetRotation, uint64_t delayTime );
|
||||||
|
|
||||||
|
void update( uint64_t tickCount );
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint64_t m_lastTick;
|
||||||
|
std::vector< std::shared_ptr< QueuedWarp > > m_warpQueue;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -101,13 +101,8 @@ void Sapphire::Network::GameConnection::getCommonlistHandler( const Packets::FFX
|
||||||
|
|
||||||
if( isConnected )
|
if( isConnected )
|
||||||
{
|
{
|
||||||
// todo: fix odd teri nullptr on login for friendlist etc
|
entry.TerritoryType = pPlayer->getTerritoryTypeId();
|
||||||
auto pTeri = pPlayer->getCurrentTerritory();
|
entry.TerritoryID = pPlayer->getTerritoryId();
|
||||||
if( pTeri )
|
|
||||||
{
|
|
||||||
entry.TerritoryType = pPlayer->getCurrentTerritory()->getTerritoryTypeId();
|
|
||||||
entry.TerritoryID = pPlayer->getCurrentTerritory()->getTerritoryTypeId();
|
|
||||||
}
|
|
||||||
|
|
||||||
entry.CurrentClassID = static_cast< uint8_t >( pPlayer->getClass() );
|
entry.CurrentClassID = static_cast< uint8_t >( pPlayer->getClass() );
|
||||||
entry.SelectClassID = static_cast< uint8_t >( pPlayer->getSearchSelectClass() );
|
entry.SelectClassID = static_cast< uint8_t >( pPlayer->getSearchSelectClass() );
|
||||||
|
|
|
@ -79,13 +79,13 @@ enum GmCommand
|
||||||
JumpNpc = 0x025F,
|
JumpNpc = 0x025F,
|
||||||
};
|
};
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||||
Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
if( player.getGmRank() <= 0 )
|
if( player.getGmRank() <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
|
auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
|
||||||
const auto packet = ZoneChannelPacket< FFXIVIpcGmCommand >( inPacket );
|
const auto packet = ZoneChannelPacket< FFXIVIpcGmCommand >( inPacket );
|
||||||
const auto commandId = packet.data().Id;
|
const auto commandId = packet.data().Id;
|
||||||
|
@ -96,12 +96,10 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
|
||||||
const auto target = packet.data().Target;
|
const auto target = packet.data().Target;
|
||||||
|
|
||||||
Logger::info( "{0} used GM1 commandId: {1}, params: {2}, {3}, {4}, {5}, target: {6}",
|
Logger::info( "{0} used GM1 commandId: {1}, params: {2}, {3}, {4}, {5}, target: {6}",
|
||||||
player.getName(), commandId,
|
player.getName(), commandId, param1, param2, param3, param4, target );
|
||||||
param1, param2, param3, param4, target );
|
|
||||||
|
|
||||||
Sapphire::Entity::GameObjectPtr targetActor;
|
Sapphire::Entity::GameObjectPtr targetActor;
|
||||||
|
|
||||||
|
|
||||||
if( player.getId() == target )
|
if( player.getId() == target )
|
||||||
{
|
{
|
||||||
targetActor = player.getAsPlayer();
|
targetActor = player.getAsPlayer();
|
||||||
|
@ -118,8 +116,11 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
|
||||||
|
|
||||||
if( !targetActor )
|
if( !targetActor )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto targetPlayer = targetActor->getAsPlayer();
|
auto targetPlayer = targetActor->getAsPlayer();
|
||||||
|
|
||||||
|
auto pTargetZone = teriMgr.getTerritoryByGuId( targetActor->getTerritoryId() );
|
||||||
|
|
||||||
switch( commandId )
|
switch( commandId )
|
||||||
{
|
{
|
||||||
case GmCommand::Lv:
|
case GmCommand::Lv:
|
||||||
|
@ -184,9 +185,9 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
|
||||||
}
|
}
|
||||||
case GmCommand::Weather:
|
case GmCommand::Weather:
|
||||||
{
|
{
|
||||||
targetPlayer->getCurrentTerritory()->setWeatherOverride( static_cast< Common::Weather >( param1 ) );
|
pTargetZone->setWeatherOverride( static_cast< Common::Weather >( param1 ) );
|
||||||
PlayerMgr::sendServerNotice( player, "Weather in Territory \"{0}\" of {1} set in range.",
|
PlayerMgr::sendServerNotice( player, "Weather in Territory \"{0}\" of {1} set in range.",
|
||||||
targetPlayer->getCurrentTerritory()->getName(), targetPlayer->getName());
|
pTargetZone->getName(), targetPlayer->getName() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GmCommand::Call:
|
case GmCommand::Call:
|
||||||
|
@ -211,7 +212,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
|
||||||
"\nPlayTime: {8}",
|
"\nPlayTime: {8}",
|
||||||
targetPlayer->getName(),
|
targetPlayer->getName(),
|
||||||
targetPlayer->getCurrency( CurrencyType::Gil ),
|
targetPlayer->getCurrency( CurrencyType::Gil ),
|
||||||
targetPlayer->getCurrentTerritory()->getName(),
|
pTargetZone->getName(),
|
||||||
targetPlayer->getZoneId(),
|
targetPlayer->getZoneId(),
|
||||||
static_cast< uint8_t >( targetPlayer->getClass() ),
|
static_cast< uint8_t >( targetPlayer->getClass() ),
|
||||||
targetPlayer->getLevel(),
|
targetPlayer->getLevel(),
|
||||||
|
@ -555,7 +556,6 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
|
||||||
}
|
}
|
||||||
case GmCommand::TeriInfo:
|
case GmCommand::TeriInfo:
|
||||||
{
|
{
|
||||||
auto pCurrentZone = player.getCurrentTerritory();
|
|
||||||
PlayerMgr::sendServerNotice( player, "ZoneId: {0}"
|
PlayerMgr::sendServerNotice( player, "ZoneId: {0}"
|
||||||
"\nName: {1}"
|
"\nName: {1}"
|
||||||
"\nInternalName: {2}"
|
"\nInternalName: {2}"
|
||||||
|
@ -564,12 +564,12 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
|
||||||
"\nCurrentWeather: {5}"
|
"\nCurrentWeather: {5}"
|
||||||
"\nNextWeather: {6}",
|
"\nNextWeather: {6}",
|
||||||
player.getZoneId(),
|
player.getZoneId(),
|
||||||
pCurrentZone->getName(),
|
pTargetZone->getName(),
|
||||||
pCurrentZone->getInternalName(),
|
pTargetZone->getInternalName(),
|
||||||
pCurrentZone->getGuId(),
|
pTargetZone->getGuId(),
|
||||||
pCurrentZone->getPopCount(),
|
pTargetZone->getPopCount(),
|
||||||
static_cast< uint8_t >( pCurrentZone->getCurrentWeather()),
|
static_cast< uint8_t >( pTargetZone->getCurrentWeather() ),
|
||||||
static_cast< uint8_t >( pCurrentZone->getNextWeather()));
|
static_cast< uint8_t >( pTargetZone->getNextWeather() ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GmCommand::Jump:
|
case GmCommand::Jump:
|
||||||
|
@ -591,8 +591,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||||
Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
if( player.getGmRank() <= 0 )
|
if( player.getGmRank() <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -660,7 +659,7 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX
|
||||||
{
|
{
|
||||||
player.exitInstance();
|
player.exitInstance();
|
||||||
}
|
}
|
||||||
if( targetPlayer->getCurrentTerritory()->getGuId() != player.getCurrentTerritory()->getGuId() )
|
if( targetPlayer->getTerritoryId() != player.getTerritoryId() )
|
||||||
{
|
{
|
||||||
// Checks if the target player is in an InstanceContent to avoid binding to a Territory or PublicContent
|
// Checks if the target player is in an InstanceContent to avoid binding to a Territory or PublicContent
|
||||||
if( targetPlayer->getCurrentInstance() )
|
if( targetPlayer->getCurrentInstance() )
|
||||||
|
@ -669,10 +668,9 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX
|
||||||
// Not sure if GMs actually get bound to an instance they jump to on retail. It's mostly here to avoid a crash for now
|
// Not sure if GMs actually get bound to an instance they jump to on retail. It's mostly here to avoid a crash for now
|
||||||
pInstanceContent->bindPlayer( player.getId() );
|
pInstanceContent->bindPlayer( player.getId() );
|
||||||
}
|
}
|
||||||
player.setInstance( targetPlayer->getCurrentTerritory()->getGuId() );
|
player.setInstance( targetPlayer->getTerritoryId() );
|
||||||
}
|
}
|
||||||
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.sendZoneInPackets( 0x00, 0x00, 0, 0, false );
|
player.sendZoneInPackets( 0x00, 0x00, 0, 0, false );
|
||||||
PlayerMgr::sendServerNotice( player, "Jumping to {0}", targetPlayer->getName() );
|
PlayerMgr::sendServerNotice( player, "Jumping to {0}", targetPlayer->getName() );
|
||||||
break;
|
break;
|
||||||
|
@ -690,9 +688,9 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX
|
||||||
{
|
{
|
||||||
targetPlayer->exitInstance();
|
targetPlayer->exitInstance();
|
||||||
}
|
}
|
||||||
if( targetPlayer->getCurrentTerritory()->getGuId() != player.getCurrentTerritory()->getGuId() )
|
if( targetPlayer->getTerritoryId() != player.getTerritoryId() )
|
||||||
{
|
{
|
||||||
targetPlayer->setInstance( player.getCurrentTerritory()->getGuId() );
|
targetPlayer->setInstance( player.getTerritoryId() );
|
||||||
}
|
}
|
||||||
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() );
|
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() );
|
||||||
targetPlayer->sendZoneInPackets( 0x00, 0x00, 0, 0, false );
|
targetPlayer->sendZoneInPackets( 0x00, 0x00, 0, 0, false );
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "WorldServer.h"
|
#include "WorldServer.h"
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
#include <Service.h>
|
#include <Service.h>
|
||||||
|
#include <Manager/TerritoryMgr.h>
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
@ -54,12 +55,13 @@ void examineHandler( Sapphire::Entity::Player& player, uint32_t targetId )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||||
Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
const auto packet = ZoneChannelPacket< FFXIVIpcClientTrigger >( inPacket );
|
const auto packet = ZoneChannelPacket< FFXIVIpcClientTrigger >( inPacket );
|
||||||
auto& server = Service< World::WorldServer >::ref();
|
auto& server = Service< World::WorldServer >::ref();
|
||||||
|
auto& teriMgr = Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
const auto commandId = packet.data().Id;
|
const auto commandId = packet.data().Id;
|
||||||
const auto param1 = *reinterpret_cast< const uint64_t* >( &packet.data().Arg0 );
|
const auto param1 = *reinterpret_cast< const uint64_t* >( &packet.data().Arg0 );
|
||||||
|
@ -271,12 +273,12 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
||||||
}*/
|
}*/
|
||||||
case PacketCommand::DIRECTOR_INIT_RETURN: // Director init finish
|
case PacketCommand::DIRECTOR_INIT_RETURN: // Director init finish
|
||||||
{
|
{
|
||||||
player.getCurrentTerritory()->onInitDirector( player );
|
pZone->onInitDirector( player );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PacketCommand::SYNC_DIRECTOR: // Director init finish
|
case PacketCommand::SYNC_DIRECTOR: // Director init finish
|
||||||
{
|
{
|
||||||
player.getCurrentTerritory()->onDirectorSync( player );
|
pZone->onDirectorSync( player );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* case PacketCommand::EnterTerritoryEventFinished:// this may still be something else. I think i have seen it elsewhere
|
/* case PacketCommand::EnterTerritoryEventFinished:// this may still be something else. I think i have seen it elsewhere
|
||||||
|
@ -286,7 +288,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
||||||
}*/
|
}*/
|
||||||
case PacketCommand::EVENT_HANDLER:
|
case PacketCommand::EVENT_HANDLER:
|
||||||
{
|
{
|
||||||
player.getCurrentTerritory()->onEventHandlerOrder( player, param11, param12, param2, param3, param4 );
|
pZone->onEventHandlerOrder( player, param11, param12, param2, param3, param4 );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -297,8 +299,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
||||||
}
|
}
|
||||||
case PacketCommand::HOUSING_LOCK_LAND_BY_BUILD:
|
case PacketCommand::HOUSING_LOCK_LAND_BY_BUILD:
|
||||||
{
|
{
|
||||||
auto zone = player.getCurrentTerritory();
|
auto hZone = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
|
||||||
if (!hZone)
|
if (!hZone)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -338,9 +339,12 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
||||||
case PacketCommand::HOUSING_RELEASE:
|
case PacketCommand::HOUSING_RELEASE:
|
||||||
{
|
{
|
||||||
auto& housingMgr = Service< HousingMgr >::ref();
|
auto& housingMgr = Service< HousingMgr >::ref();
|
||||||
|
auto hZone = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||||
|
if (!hZone)
|
||||||
|
return;
|
||||||
|
|
||||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||||
housingMgr.relinquishLand( player, plot );
|
housingMgr.relinquishLand( player, *hZone, plot );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,8 +301,7 @@ void Sapphire::Network::GameConnection::moveHandler( const Packets::FFXIVARR_PAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sapphire::Network::GameConnection::configHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
Sapphire::Network::GameConnection::configHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||||
Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcConfig >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcConfig >( inPacket );
|
||||||
|
|
||||||
|
@ -310,8 +309,7 @@ Sapphire::Network::GameConnection::configHandler( const Packets::FFXIVARR_PACKET
|
||||||
Service< World::Manager::PlayerMgr >::ref().onEquipDisplayFlagsChanged( player );
|
Service< World::Manager::PlayerMgr >::ref().onEquipDisplayFlagsChanged( player );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||||
Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcZoneJump >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcZoneJump >( inPacket );
|
||||||
auto& data = packet.data();
|
auto& data = packet.data();
|
||||||
|
@ -320,7 +318,9 @@ void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR
|
||||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
auto tInfo = player.getCurrentTerritory()->getTerritoryTypeInfo();
|
|
||||||
|
auto pTeri = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
auto tInfo = pTeri->getTerritoryTypeInfo();
|
||||||
|
|
||||||
auto pExitRange = instanceObjectCache.getExitRange( player.getTerritoryTypeId(), exitBoxId );
|
auto pExitRange = instanceObjectCache.getExitRange( player.getTerritoryTypeId(), exitBoxId );
|
||||||
|
|
||||||
|
@ -382,8 +382,10 @@ void Sapphire::Network::GameConnection::newDiscoveryHandler( const Packets::FFXI
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
auto& server = Common::Service< World::WorldServer >::ref();
|
auto& server = Common::Service< World::WorldServer >::ref();
|
||||||
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
||||||
auto tInfo = player.getCurrentTerritory()->getTerritoryTypeInfo();
|
auto pTeri = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
auto tInfo = pTeri->getTerritoryTypeInfo();
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcNewDiscovery >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcNewDiscovery >( inPacket );
|
||||||
const auto layoutId = packet.data().LayoutId;
|
const auto layoutId = packet.data().LayoutId;
|
||||||
|
|
||||||
|
@ -435,6 +437,9 @@ void Sapphire::Network::GameConnection::setLanguageHandler( const Packets::FFXIV
|
||||||
questMgr.sendQuestsInfo( player );
|
questMgr.sendQuestsInfo( player );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||||
|
auto pCurrentZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
auto& playerMgr = Common::Service< World::Manager::PlayerMgr >::ref();
|
auto& playerMgr = Common::Service< World::Manager::PlayerMgr >::ref();
|
||||||
|
|
||||||
/* // TODO: load and save this data instead of hardcoding
|
/* // TODO: load and save this data instead of hardcoding
|
||||||
|
@ -445,7 +450,7 @@ void Sapphire::Network::GameConnection::setLanguageHandler( const Packets::FFXIV
|
||||||
gcPacket->data().gcRank[ 2 ] = player.getGcRankArray()[ 2 ];
|
gcPacket->data().gcRank[ 2 ] = player.getGcRankArray()[ 2 ];
|
||||||
player.queuePacket( gcPacket );*/
|
player.queuePacket( gcPacket );*/
|
||||||
|
|
||||||
player.getCurrentTerritory()->onFinishLoading( player );
|
pCurrentZone->onFinishLoading( player );
|
||||||
|
|
||||||
// player is done zoning
|
// player is done zoning
|
||||||
player.setLoadingComplete( true );
|
player.setLoadingComplete( true );
|
||||||
|
@ -461,7 +466,7 @@ void Sapphire::Network::GameConnection::setLanguageHandler( const Packets::FFXIV
|
||||||
player.spawn( player.getAsPlayer() );
|
player.spawn( player.getAsPlayer() );
|
||||||
|
|
||||||
// notify the zone of a change in position to force an "inRangeActor" update
|
// notify the zone of a change in position to force an "inRangeActor" update
|
||||||
player.getCurrentTerritory()->updateActorPosition( player );
|
pCurrentZone->updateActorPosition( player );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::pcSearchHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Sapphire::Network::GameConnection::pcSearchHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
|
@ -504,14 +509,16 @@ void Sapphire::Network::GameConnection::pcSearchHandler( const Packets::FFXIVARR
|
||||||
queueOutPacket( pcSearchResultPacket );
|
queueOutPacket( pcSearchResultPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::chatHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Sapphire::Network::GameConnection::chatHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||||
Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
auto& debugCommandMgr = Common::Service< DebugCommandMgr >::ref();
|
auto& debugCommandMgr = Common::Service< DebugCommandMgr >::ref();
|
||||||
|
auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcChatHandler >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcChatHandler >( inPacket );
|
||||||
auto& data = packet.data();
|
auto& data = packet.data();
|
||||||
|
|
||||||
|
auto pCurrentZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
|
||||||
if( data.message[ 0 ] == '!' )
|
if( data.message[ 0 ] == '!' )
|
||||||
{
|
{
|
||||||
// execute game console command
|
// execute game console command
|
||||||
|
@ -531,7 +538,7 @@ void Sapphire::Network::GameConnection::chatHandler( const Packets::FFXIVARR_PAC
|
||||||
if( player.isActingAsGm() )
|
if( player.isActingAsGm() )
|
||||||
chatPacket->data().type = static_cast< uint16_t >( ChatType::GMSay );
|
chatPacket->data().type = static_cast< uint16_t >( ChatType::GMSay );
|
||||||
|
|
||||||
player.getCurrentTerritory()->queuePacketForRange( player, 50.f, chatPacket );
|
pCurrentZone->queuePacketForRange( player, 50.f, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatType::Yell:
|
case ChatType::Yell:
|
||||||
|
@ -539,7 +546,7 @@ void Sapphire::Network::GameConnection::chatHandler( const Packets::FFXIVARR_PAC
|
||||||
if( player.isActingAsGm() )
|
if( player.isActingAsGm() )
|
||||||
chatPacket->data().type = static_cast< uint16_t >( ChatType::GMYell );
|
chatPacket->data().type = static_cast< uint16_t >( ChatType::GMYell );
|
||||||
|
|
||||||
player.getCurrentTerritory()->queuePacketForRange( player, 6000.f, chatPacket );
|
pCurrentZone->queuePacketForRange( player, 6000.f, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatType::Shout:
|
case ChatType::Shout:
|
||||||
|
@ -547,12 +554,12 @@ void Sapphire::Network::GameConnection::chatHandler( const Packets::FFXIVARR_PAC
|
||||||
if( player.isActingAsGm() )
|
if( player.isActingAsGm() )
|
||||||
chatPacket->data().type = static_cast< uint16_t >( ChatType::GMShout );
|
chatPacket->data().type = static_cast< uint16_t >( ChatType::GMShout );
|
||||||
|
|
||||||
player.getCurrentTerritory()->queuePacketForRange( player, 6000.f, chatPacket );
|
pCurrentZone->queuePacketForRange( player, 6000.f, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
player.getCurrentTerritory()->queuePacketForRange( player, 50.f, chatPacket );
|
pCurrentZone->queuePacketForRange( player, 50.f, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,14 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
|
||||||
class WarpPacket : public ZoneChannelPacket< FFXIVIpcWarp >
|
class WarpPacket : public ZoneChannelPacket< FFXIVIpcWarp >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WarpPacket( Entity::Player& player, Common::WARP_TYPE warpType, Common::FFXIVARR_POSITION3& targetPos, float rotation ) :
|
WarpPacket( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3& targetPos, float rotation ) :
|
||||||
ZoneChannelPacket< FFXIVIpcWarp >( player.getId(), player.getId() )
|
ZoneChannelPacket< FFXIVIpcWarp >( player.getId(), player.getId() )
|
||||||
{
|
{
|
||||||
initialize( player, warpType, targetPos, rotation );
|
initialize( player, warpType, targetPos, rotation );
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize( Entity::Player& player, Common::WARP_TYPE warpType, Common::FFXIVARR_POSITION3& targetPos, float rotation )
|
void initialize( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3& targetPos, float rotation )
|
||||||
{
|
{
|
||||||
m_data.Dir = Sapphire::Common::Util::floatToUInt16Rot( rotation );
|
m_data.Dir = Sapphire::Common::Util::floatToUInt16Rot( rotation );
|
||||||
m_data.Type = warpType;
|
m_data.Type = warpType;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "Manager/EventMgr.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include "Manager/PlayerMgr.h"
|
#include "Manager/PlayerMgr.h"
|
||||||
|
#include "Manager/TerritoryMgr.h"
|
||||||
|
|
||||||
#include "StatusEffect/StatusEffect.h"
|
#include "StatusEffect/StatusEffect.h"
|
||||||
|
|
||||||
|
@ -204,8 +205,9 @@ bool Sapphire::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t ac
|
||||||
// all other types....
|
// all other types....
|
||||||
|
|
||||||
// check if the actor is an eobj and call its script if we have one
|
// check if the actor is an eobj and call its script if we have one
|
||||||
auto zone = player.getCurrentTerritory();
|
auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
if( auto eobj = zone->getEObj( actorId ) )
|
auto zone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||||
|
if( auto eobj = zone ? zone->getEObj( actorId ) : nullptr )
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventObjectScript >( eobj->getObjectId() );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventObjectScript >( eobj->getObjectId() );
|
||||||
if( script )
|
if( script )
|
||||||
|
|
|
@ -507,7 +507,7 @@ void Sapphire::Territory::updateSessions( uint64_t tickCount, bool changedWeathe
|
||||||
}
|
}
|
||||||
|
|
||||||
// this session is not linked to this area anymore, remove it from zone session list
|
// this session is not linked to this area anymore, remove it from zone session list
|
||||||
if( ( !pPlayer->getCurrentTerritory() ) || ( pPlayer->getCurrentTerritory() != shared_from_this() ) )
|
if( pPlayer->getTerritoryId() != m_guId )
|
||||||
{
|
{
|
||||||
Logger::debug( "[{}] removeActor( pPlayer );", pPlayer->getId() );
|
Logger::debug( "[{}] removeActor( pPlayer );", pPlayer->getId() );
|
||||||
removeActor( pPlayer );
|
removeActor( pPlayer );
|
||||||
|
@ -530,7 +530,7 @@ void Sapphire::Territory::updateSessions( uint64_t tickCount, bool changedWeathe
|
||||||
}
|
}
|
||||||
|
|
||||||
// this session is not linked to this area anymore, remove it from zone session list
|
// this session is not linked to this area anymore, remove it from zone session list
|
||||||
if( ( !pPlayer->getCurrentTerritory() ) || ( pPlayer->getCurrentTerritory() != shared_from_this() ) )
|
if( pPlayer->getTerritoryId() != getGuId() )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,7 @@ void Sapphire::Territory::updateCellActivity( uint32_t x, uint32_t y, int32_t ra
|
||||||
void Sapphire::Territory::updateActorPosition( Entity::GameObject& actor )
|
void Sapphire::Territory::updateActorPosition( Entity::GameObject& actor )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( actor.getCurrentTerritory() != shared_from_this() )
|
if( actor.getTerritoryTypeId() != getTerritoryTypeId() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//actor.checkInRangeActors();
|
//actor.checkInRangeActors();
|
||||||
|
@ -704,9 +704,7 @@ void Sapphire::Territory::updateInRangeSet( Entity::GameObjectPtr pActor, CellPt
|
||||||
|
|
||||||
float distance = Util::distance( pCurAct->getPos(), pActor->getPos() );
|
float distance = Util::distance( pCurAct->getPos(), pActor->getPos() );
|
||||||
|
|
||||||
bool isInRange = ( fRange == 0.0f || distance <= fRange ) &&
|
bool isInRange = ( fRange == 0.0f || distance <= fRange );
|
||||||
( pCurAct->getCurrentTerritory() && pActor->getCurrentTerritory() ) &&
|
|
||||||
( pCurAct->getCurrentTerritory()->getGuId() == pActor->getCurrentTerritory()->getGuId() );
|
|
||||||
|
|
||||||
bool isInRangeSet = pActor->isInRangeSet( pCurAct );
|
bool isInRangeSet = pActor->isInRangeSet( pCurAct );
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,7 @@ namespace Sapphire
|
||||||
public:
|
public:
|
||||||
Territory();
|
Territory();
|
||||||
|
|
||||||
Territory( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName,
|
Territory( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, const std::string& placeName );
|
||||||
const std::string& placeName );
|
|
||||||
|
|
||||||
virtual ~Territory();
|
virtual ~Territory();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue