1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-07 19:27:45 +00:00

rename zone to territory

This commit is contained in:
NotAdam 2019-07-21 22:33:33 +10:00
parent 5cf5418b17
commit 9c3fba263e
41 changed files with 198 additions and 201 deletions

View file

@ -1,6 +1,5 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
#include <Territory/Zone.h>
#include <Territory/HousingZone.h> #include <Territory/HousingZone.h>
#include <Manager/HousingMgr.h> #include <Manager/HousingMgr.h>
#include <Network/PacketWrappers/ActorControlPacket143.h> #include <Network/PacketWrappers/ActorControlPacket143.h>

View file

@ -11,7 +11,7 @@
#include "Actor/Player.h" #include "Actor/Player.h"
#include "Actor/BNpc.h" #include "Actor/BNpc.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include <Network/CommonActorControl.h> #include <Network/CommonActorControl.h>
#include "Network/PacketWrappers/ActorControlPacket142.h" #include "Network/PacketWrappers/ActorControlPacket142.h"

View file

@ -6,7 +6,7 @@
#include <Util/UtilMath.h> #include <Util/UtilMath.h>
#include <utility> #include <utility>
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
@ -330,14 +330,14 @@ std::set< Sapphire::Entity::ActorPtr > Sapphire::Entity::Actor::getInRangeActors
return tempInRange; return tempInRange;
} }
/*! \return ZonePtr to the current zone, nullptr if not set */ /*! \return TerritoryPtr to the current zone, nullptr if not set */
Sapphire::ZonePtr Sapphire::Entity::Actor::getCurrentZone() const Sapphire::TerritoryPtr Sapphire::Entity::Actor::getCurrentZone() const
{ {
return m_pCurrentZone; return m_pCurrentZone;
} }
/*! \param ZonePtr to the zone to be set as current */ /*! \param TerritoryPtr to the zone to be set as current */
void Sapphire::Entity::Actor::setCurrentZone( ZonePtr currZone ) void Sapphire::Entity::Actor::setCurrentZone( TerritoryPtr currZone )
{ {
m_pCurrentZone = currZone; m_pCurrentZone = currZone;
} }

View file

@ -32,7 +32,7 @@ namespace Sapphire::Entity
/*! Id of the zone the actor currently is in */ /*! Id of the zone the actor currently is in */
uint32_t m_territoryTypeId; uint32_t m_territoryTypeId;
/*! Ptr to the ZoneObj the actor belongs to */ /*! Ptr to the ZoneObj the actor belongs to */
ZonePtr m_pCurrentZone; TerritoryPtr m_pCurrentZone;
/*! list of various actors in range */ /*! list of various actors in range */
std::set< ActorPtr > m_inRangeActor; std::set< ActorPtr > m_inRangeActor;
@ -122,9 +122,9 @@ namespace Sapphire::Entity
BNpcPtr getAsBNpc(); BNpcPtr getAsBNpc();
ZonePtr getCurrentZone() const; TerritoryPtr getCurrentZone() const;
void setCurrentZone( ZonePtr currZone ); void setCurrentZone( TerritoryPtr currZone );
InstanceContentPtr getCurrentInstance() const; InstanceContentPtr getCurrentInstance() const;

View file

@ -11,7 +11,7 @@
#include "Forwards.h" #include "Forwards.h"
#include "Action/Action.h" #include "Action/Action.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ActorControlPacket142.h" #include "Network/PacketWrappers/ActorControlPacket142.h"
@ -53,7 +53,7 @@ Sapphire::Entity::BNpc::BNpc( FrameworkPtr pFw ) :
} }
Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot, Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
uint8_t level, uint32_t maxHp, ZonePtr pZone, FrameworkPtr pFw ) : uint8_t level, uint32_t maxHp, TerritoryPtr pZone, FrameworkPtr pFw ) :
Npc( ObjKind::BattleNpc, pFw ) Npc( ObjKind::BattleNpc, pFw )
{ {
m_id = id; m_id = id;

View file

@ -51,7 +51,7 @@ namespace Sapphire::Entity
public: public:
BNpc( FrameworkPtr pFw ); BNpc( FrameworkPtr pFw );
BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot, BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
uint8_t level, uint32_t maxHp, ZonePtr pZone,FrameworkPtr pFw ); uint8_t level, uint32_t maxHp, TerritoryPtr pZone,FrameworkPtr pFw );
virtual ~BNpc() override; virtual ~BNpc() override;

View file

@ -8,7 +8,7 @@
#include "Forwards.h" #include "Forwards.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ActorControlPacket142.h" #include "Network/PacketWrappers/ActorControlPacket142.h"

View file

@ -102,12 +102,12 @@ uint32_t Sapphire::Entity::EventObject::getHousingLink() const
return m_housingLink; return m_housingLink;
} }
void Sapphire::Entity::EventObject::setParentInstance( Sapphire::ZonePtr instance ) void Sapphire::Entity::EventObject::setParentInstance( Sapphire::TerritoryPtr instance )
{ {
m_parentInstance = instance; m_parentInstance = instance;
} }
Sapphire::ZonePtr Sapphire::Entity::EventObject::getParentInstance() const Sapphire::TerritoryPtr Sapphire::Entity::EventObject::getParentInstance() const
{ {
return m_parentInstance; return m_parentInstance;
} }

View file

@ -13,7 +13,7 @@ namespace Sapphire::Entity
Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" ); Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" );
using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr,
ZonePtr, uint64_t ) >; TerritoryPtr, uint64_t ) >;
uint32_t getGimmickId() const; uint32_t getGimmickId() const;
@ -35,9 +35,9 @@ namespace Sapphire::Entity
const std::string& getName() const; const std::string& getName() const;
ZonePtr getParentInstance() const; TerritoryPtr getParentInstance() const;
void setParentInstance( ZonePtr instance ); void setParentInstance( TerritoryPtr instance );
void spawn( PlayerPtr pTarget ) override; void spawn( PlayerPtr pTarget ) override;
@ -56,7 +56,7 @@ namespace Sapphire::Entity
uint8_t m_state; uint8_t m_state;
float m_scale; float m_scale;
std::string m_name; std::string m_name;
ZonePtr m_parentInstance; TerritoryPtr m_parentInstance;
OnTalkEventHandler m_onTalkEventHandler; OnTalkEventHandler m_onTalkEventHandler;

View file

@ -9,7 +9,7 @@
#include "Forwards.h" #include "Forwards.h"
#include "Action/Action.h" #include "Action/Action.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ActorControlPacket142.h" #include "Network/PacketWrappers/ActorControlPacket142.h"

View file

@ -16,7 +16,7 @@
#include "Manager/TerritoryMgr.h" #include "Manager/TerritoryMgr.h"
#include "Manager/RNGMgr.h" #include "Manager/RNGMgr.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/ZonePosition.h" #include "Territory/ZonePosition.h"
#include "Territory/InstanceContent.h" #include "Territory/InstanceContent.h"
#include "Territory/Land.h" #include "Territory/Land.h"
@ -437,7 +437,7 @@ bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
return setInstance( instance ); return setInstance( instance );
} }
bool Sapphire::Entity::Player::setInstance( ZonePtr instance ) bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance )
{ {
m_onEnterEventDone = false; m_onEnterEventDone = false;
if( !instance ) if( !instance )
@ -458,7 +458,7 @@ bool Sapphire::Entity::Player::setInstance( ZonePtr instance )
return pTeriMgr->movePlayer( instance, getAsPlayer() ); return pTeriMgr->movePlayer( instance, getAsPlayer() );
} }
bool Sapphire::Entity::Player::setInstance( ZonePtr instance, Common::FFXIVARR_POSITION3 pos ) bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance, Common::FFXIVARR_POSITION3 pos )
{ {
m_onEnterEventDone = false; m_onEnterEventDone = false;
if( !instance ) if( !instance )

View file

@ -480,10 +480,10 @@ namespace Sapphire::Entity
bool setInstance( uint32_t instanceContentId ); bool setInstance( uint32_t instanceContentId );
/*! sets the players instance & initiates zoning process */ /*! sets the players instance & initiates zoning process */
bool setInstance( ZonePtr instance ); bool setInstance( TerritoryPtr instance );
/*! sets the players instance & initiates zoning process */ /*! sets the players instance & initiates zoning process */
bool setInstance( Sapphire::ZonePtr instance, Sapphire::Common::FFXIVARR_POSITION3 pos ); bool setInstance( Sapphire::TerritoryPtr instance, Sapphire::Common::FFXIVARR_POSITION3 pos );
/*! 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();

View file

@ -11,7 +11,7 @@
#include "Network/PacketWrappers/EventFinishPacket.h" #include "Network/PacketWrappers/EventFinishPacket.h"
#include "Network/PacketWrappers/DirectorPlayScenePacket.h" #include "Network/PacketWrappers/DirectorPlayScenePacket.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "ServerMgr.h" #include "ServerMgr.h"
#include "Framework.h" #include "Framework.h"

View file

@ -3,7 +3,7 @@
#include <Network/CommonActorControl.h> #include <Network/CommonActorControl.h>
#include <algorithm> #include <algorithm>
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Network/PacketWrappers/ActorControlPacket142.h" #include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h" #include "Network/PacketWrappers/ActorControlPacket143.h"

View file

@ -13,7 +13,7 @@
#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Manager/TerritoryMgr.h" #include "Manager/TerritoryMgr.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Inventory/Item.h" #include "Inventory/Item.h"
#include "Inventory/ItemContainer.h" #include "Inventory/ItemContainer.h"
#include "Manager/ItemMgr.h" #include "Manager/ItemMgr.h"
@ -64,7 +64,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
m_prevPos.z = res->getFloat( "OPosZ" ); m_prevPos.z = res->getFloat( "OPosZ" );
m_prevRot = res->getFloat( "OPosR" ); m_prevRot = res->getFloat( "OPosR" );
ZonePtr pCurrZone = nullptr; TerritoryPtr pCurrZone = nullptr;
// if the zone is an instanceContent zone, we need to actually find the instance // if the zone is an instanceContent zone, we need to actually find the instance
if( pTeriMgr->isInstanceContentTerritory( zoneId ) ) if( pTeriMgr->isInstanceContentTerritory( zoneId ) )
@ -108,7 +108,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
// see if a valid zone could be found for the character // see if a valid zone could be found for the character
if( !pCurrZone ) if( !pCurrZone )
{ {
Logger::error( "[{0}] Zone #{1} not found!", char_id_str, zoneId ); Logger::error( "[{0}] Territory #{1} not found!", char_id_str, zoneId );
Logger::error( "[{0}] Setting default zone instead", char_id_str ); Logger::error( "[{0}] Setting default zone instead", char_id_str );
// default to new gridania // default to new gridania

View file

@ -19,7 +19,7 @@ typedef std::vector< x > x ## PtrList;
namespace Sapphire namespace Sapphire
{ {
TYPE_FORWARD( Cell ); TYPE_FORWARD( Cell );
TYPE_FORWARD( Zone ); TYPE_FORWARD( Territory );
TYPE_FORWARD( HousingZone ); TYPE_FORWARD( HousingZone );
TYPE_FORWARD( House ); TYPE_FORWARD( House );
TYPE_FORWARD( InstanceContent ); TYPE_FORWARD( InstanceContent );

View file

@ -27,7 +27,7 @@
#include "Actor/EventObject.h" #include "Actor/EventObject.h"
#include "Actor/BNpc.h" #include "Actor/BNpc.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/HousingZone.h" #include "Territory/HousingZone.h"
#include "Territory/InstanceContent.h" #include "Territory/InstanceContent.h"
#include "Territory/QuestBattle.h" #include "Territory/QuestBattle.h"
@ -1267,7 +1267,7 @@ void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Pla
// player.sendLandFlags(); // player.sendLandFlags();
// } // }
// else // else
// player.sendDebug( "You aren't in a housing Zone." ); // player.sendDebug( "You aren't in a housing Territory." );
// } // }
// } // }
// else // else

View file

@ -16,7 +16,7 @@
#include "Event/EventDefs.h" #include "Event/EventDefs.h"
#include "TerritoryMgr.h" #include "TerritoryMgr.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/HousingZone.h" #include "Territory/HousingZone.h"
#include "Territory/Housing/HousingInteriorTerritory.h" #include "Territory/Housing/HousingInteriorTerritory.h"
#include "HousingMgr.h" #include "HousingMgr.h"

View file

@ -5,7 +5,7 @@
#include <Manager/TerritoryMgr.h> #include <Manager/TerritoryMgr.h>
#include <Territory/ZonePosition.h> #include <Territory/ZonePosition.h>
#include <Territory/Zone.h> #include <Territory/Territory.h>
#include <Manager/HousingMgr.h> #include <Manager/HousingMgr.h>
@ -26,7 +26,7 @@ void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire:
if( !terriMgr ) if( !terriMgr )
return; return;
Sapphire::ZonePtr destinationZone; Sapphire::TerritoryPtr destinationZone;
auto terriPos = terriMgr->getTerritoryPosition( landId ); auto terriPos = terriMgr->getTerritoryPosition( landId );
if( terriPos ) if( terriPos )

View file

@ -8,7 +8,7 @@
#include "Actor/Player.h" #include "Actor/Player.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/ZonePosition.h" #include "Territory/ZonePosition.h"
#include "Territory/InstanceContent.h" #include "Territory/InstanceContent.h"
#include "Territory/QuestBattle.h" #include "Territory/QuestBattle.h"
@ -181,7 +181,7 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
uint32_t guid = getNextInstanceId(); uint32_t guid = getNextInstanceId();
auto pZone = make_Zone( territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() ); auto pZone = make_Territory( territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() );
pZone->init(); pZone->init();
std::string bgPath = territoryInfo->bg; std::string bgPath = territoryInfo->bg;
@ -197,9 +197,9 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
hasNaviMesh ? "NAVI" : "", hasNaviMesh ? "NAVI" : "",
pPlaceName->name ); pPlaceName->name );
InstanceIdToZonePtrMap instanceMap; InstanceIdToTerritoryPtrMap instanceMap;
instanceMap[ guid ] = pZone; instanceMap[ guid ] = pZone;
m_guIdToZonePtrMap[ guid ] = pZone; m_guIdToTerritoryPtrMap[ guid ] = pZone;
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ] = instanceMap; m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ] = instanceMap;
m_zoneSet.insert( { pZone } ); m_zoneSet.insert( { pZone } );
@ -243,11 +243,11 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
pPlaceName->name, framework() ); pPlaceName->name, framework() );
pHousingZone->init(); pHousingZone->init();
InstanceIdToZonePtrMap instanceMap; InstanceIdToTerritoryPtrMap instanceMap;
instanceMap[ guid ] = pHousingZone; instanceMap[ guid ] = pHousingZone;
m_guIdToZonePtrMap[ guid ] = pHousingZone; m_guIdToTerritoryPtrMap[ guid ] = pHousingZone;
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ][ guid ] = pHousingZone; m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ][ guid ] = pHousingZone;
m_landSetIdToZonePtrMap[ pHousingZone->getLandSetId() ] = pHousingZone; m_landSetIdToTerritoryPtrMap[ pHousingZone->getLandSetId() ] = pHousingZone;
m_zoneSet.insert( { pHousingZone } ); m_zoneSet.insert( { pHousingZone } );
} }
@ -256,7 +256,7 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
return true; return true;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstance( uint32_t territoryTypeId ) Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstance( uint32_t territoryTypeId )
{ {
if( !isValidTerritory( territoryTypeId ) ) if( !isValidTerritory( territoryTypeId ) )
return nullptr; return nullptr;
@ -274,17 +274,17 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc
Logger::debug( "Starting instance for territory: {0} ({1})", territoryTypeId, pPlaceName->name ); Logger::debug( "Starting instance for territory: {0} ({1})", territoryTypeId, pPlaceName->name );
auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, framework() ); auto pZone = make_Territory( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, framework() );
pZone->init(); pZone->init();
m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone; m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone;
m_territoryTypeIdToInstanceGuidMap[ pZone->getTerritoryTypeId() ][ pZone->getGuId() ] = pZone; m_territoryTypeIdToInstanceGuidMap[ pZone->getTerritoryTypeId() ][ pZone->getGuId() ] = pZone;
m_zoneSet.insert( { pZone } ); m_zoneSet.insert( { pZone } );
return pZone; return pZone;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uint32_t questBattleId ) Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uint32_t questBattleId )
{ {
auto it = m_questBattleToContentFinderMap.find( questBattleId ); auto it = m_questBattleToContentFinderMap.find( questBattleId );
@ -321,13 +321,13 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uin
pZone->init(); pZone->init();
m_questBattleIdToInstanceMap[ questBattleId ][ pZone->getGuId() ] = pZone; m_questBattleIdToInstanceMap[ questBattleId ][ pZone->getGuId() ] = pZone;
m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone; m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone;
m_instanceZoneSet.insert( pZone ); m_instanceZoneSet.insert( pZone );
return pZone; return pZone;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( uint32_t contentFinderConditionId ) Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( uint32_t contentFinderConditionId )
{ {
auto pExdData = framework()->get< Data::ExdDataGenerated >(); auto pExdData = framework()->get< Data::ExdDataGenerated >();
@ -355,19 +355,19 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent(
pZone->init(); pZone->init();
m_instanceContentIdToInstanceMap[ instanceContentId ][ pZone->getGuId() ] = pZone; m_instanceContentIdToInstanceMap[ instanceContentId ][ pZone->getGuId() ] = pZone;
m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone; m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone;
m_instanceZoneSet.insert( pZone ); m_instanceZoneSet.insert( pZone );
return pZone; return pZone;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInterior( const Common::LandIdent landIdent ) Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInterior( const Common::LandIdent landIdent )
{ {
// check if zone already spawned first // check if zone already spawned first
auto ident = *reinterpret_cast< const uint64_t* >( &landIdent ); auto ident = *reinterpret_cast< const uint64_t* >( &landIdent );
auto it = m_landIdentToZonePtrMap.find( ident ); auto it = m_landIdentToTerritoryPtrMap.find( ident );
if( it != m_landIdentToZonePtrMap.end() ) if( it != m_landIdentToTerritoryPtrMap.end() )
{ {
return it->second; return it->second;
} }
@ -427,8 +427,8 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt
zone->init(); zone->init();
m_landIdentToZonePtrMap[ ident ] = zone; m_landIdentToTerritoryPtrMap[ ident ] = zone;
m_guIdToZonePtrMap[ zone->getGuId() ] = zone; m_guIdToTerritoryPtrMap[ zone->getGuId() ] = zone;
m_zoneSet.insert( { zone } ); m_zoneSet.insert( { zone } );
return zone; return zone;
@ -436,11 +436,11 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt
bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t guId ) bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t guId )
{ {
ZonePtr pZone; TerritoryPtr pZone;
if( ( pZone = getTerritoryByGuId( guId ) ) == nullptr ) if( ( pZone = getTerritoryByGuId( guId ) ) == nullptr )
return false; return false;
m_guIdToZonePtrMap.erase( pZone->getGuId() ); m_guIdToTerritoryPtrMap.erase( pZone->getGuId() );
m_instanceZoneSet.erase( pZone ); m_instanceZoneSet.erase( pZone );
m_zoneSet.erase( pZone ); m_zoneSet.erase( pZone );
@ -456,10 +456,10 @@ bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t g
return true; return true;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getTerritoryByGuId( uint32_t guId ) const Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getTerritoryByGuId( uint32_t guId ) const
{ {
auto it = m_guIdToZonePtrMap.find( guId ); auto it = m_guIdToTerritoryPtrMap.find( guId );
if( it == m_guIdToZonePtrMap.end() ) if( it == m_guIdToTerritoryPtrMap.end() )
return nullptr; return nullptr;
return it->second; return it->second;
@ -495,7 +495,7 @@ Sapphire::ZonePositionPtr Sapphire::World::Manager::TerritoryMgr::getTerritoryPo
return nullptr; return nullptr;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const
{ {
auto zoneMap = m_territoryTypeIdToInstanceGuidMap.find( territoryTypeId ); auto zoneMap = m_territoryTypeIdToInstanceGuidMap.find( territoryTypeId );
if( zoneMap == m_territoryTypeIdToInstanceGuidMap.end() ) if( zoneMap == m_territoryTypeIdToInstanceGuidMap.end() )
@ -505,10 +505,10 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritoryType
return zoneMap->second.begin()->second; return zoneMap->second.begin()->second;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByLandSetId( uint32_t landSetId ) const Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getZoneByLandSetId( uint32_t landSetId ) const
{ {
auto zoneMap = m_landSetIdToZonePtrMap.find( landSetId ); auto zoneMap = m_landSetIdToTerritoryPtrMap.find( landSetId );
if( zoneMap == m_landSetIdToZonePtrMap.end() ) if( zoneMap == m_landSetIdToTerritoryPtrMap.end() )
return nullptr; return nullptr;
return zoneMap->second; return zoneMap->second;
@ -527,7 +527,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t
} }
// remove internal house zones with nobody in them // remove internal house zones with nobody in them
for( auto it = m_landIdentToZonePtrMap.begin(); it != m_landIdentToZonePtrMap.end(); ) for( auto it = m_landIdentToTerritoryPtrMap.begin(); it != m_landIdentToTerritoryPtrMap.end(); )
{ {
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( it->second ); auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( it->second );
assert( zone ); // wtf?? assert( zone ); // wtf??
@ -541,7 +541,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t
// remove zone from maps // remove zone from maps
m_zoneSet.erase( zone ); m_zoneSet.erase( zone );
it = m_landIdentToZonePtrMap.erase( it ); it = m_landIdentToTerritoryPtrMap.erase( it );
} }
else else
it++; it++;
@ -565,7 +565,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t
// remove zone from maps // remove zone from maps
m_instanceZoneSet.erase( zone ); m_instanceZoneSet.erase( zone );
m_guIdToZonePtrMap.erase( zone->getGuId() ); m_guIdToTerritoryPtrMap.erase( zone->getGuId() );
inIt = m_questBattleIdToInstanceMap[ zone->getQuestBattleId() ].erase( inIt ); inIt = m_questBattleIdToInstanceMap[ zone->getQuestBattleId() ].erase( inIt );
} }
else else
@ -598,11 +598,11 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( uint32_t territoryTypeI
return movePlayer( pZone, pPlayer ); return movePlayer( pZone, pPlayer );
} }
bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire::Entity::PlayerPtr pPlayer ) bool Sapphire::World::Manager::TerritoryMgr::movePlayer( TerritoryPtr pZone, Sapphire::Entity::PlayerPtr pPlayer )
{ {
if( !pZone ) if( !pZone )
{ {
Logger::error( "Zone not found on this server." ); Logger::error( "Territory not found on this server." );
return false; return false;
} }
@ -642,7 +642,7 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire
return true; return true;
} }
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getLinkedInstance( uint32_t playerId ) const Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getLinkedInstance( uint32_t playerId ) const
{ {
auto it = m_playerIdToInstanceMap.find( playerId ); auto it = m_playerIdToInstanceMap.find( playerId );
if( it != m_playerIdToInstanceMap.end() ) if( it != m_playerIdToInstanceMap.end() )

View file

@ -102,21 +102,21 @@ namespace Sapphire::World::Manager
bool isHousingTerritory( uint32_t territoryTypeId ) const; bool isHousingTerritory( uint32_t territoryTypeId ) const;
/*! creates a new instance for a given territoryTypeId */ /*! creates a new instance for a given territoryTypeId */
ZonePtr createTerritoryInstance( uint32_t territoryTypeId ); TerritoryPtr createTerritoryInstance( uint32_t territoryTypeId );
ZonePtr createInstanceContent( uint32_t contentFinderConditionId ); TerritoryPtr createInstanceContent( uint32_t contentFinderConditionId );
ZonePtr createQuestBattle( uint32_t contentFinderConditionId ); TerritoryPtr createQuestBattle( uint32_t contentFinderConditionId );
void createAndJoinQuestBattle( Entity::Player& player, uint16_t contentFinderConditionId ); void createAndJoinQuestBattle( Entity::Player& player, uint16_t contentFinderConditionId );
ZonePtr findOrCreateHousingInterior( const Common::LandIdent landIdent ); TerritoryPtr findOrCreateHousingInterior( const Common::LandIdent landIdent );
/*! removes instance by instanceId, return true if successful */ /*! removes instance by instanceId, return true if successful */
bool removeTerritoryInstance( uint32_t guId ); bool removeTerritoryInstance( uint32_t guId );
/*! returns a ZonePtr to the instance or nullptr if not found */ /*! returns a TerritoryPtr to the instance or nullptr if not found */
ZonePtr getTerritoryByGuId( uint32_t guId ) const; TerritoryPtr getTerritoryByGuId( uint32_t guId ) const;
/*! returns the cached detail of a territory, nullptr if not found */ /*! returns the cached detail of a territory, nullptr if not found */
Data::TerritoryTypePtr getTerritoryDetail( uint32_t territoryTypeId ) const; Data::TerritoryTypePtr getTerritoryDetail( uint32_t territoryTypeId ) const;
@ -129,17 +129,17 @@ namespace Sapphire::World::Manager
/*! returns a default Zone by territoryTypeId /*! returns a default Zone by territoryTypeId
TODO: Mind multiple instances?! */ TODO: Mind multiple instances?! */
ZonePtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const; TerritoryPtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const;
/*! returns a Zone by landSetId */ /*! returns a Zone by landSetId */
ZonePtr getZoneByLandSetId( uint32_t landSetId ) const; TerritoryPtr getZoneByLandSetId( uint32_t landSetId ) const;
bool movePlayer( uint32_t territoryTypeId, Entity::PlayerPtr pPlayer ); bool movePlayer( uint32_t territoryTypeId, Entity::PlayerPtr pPlayer );
bool movePlayer( ZonePtr, Entity::PlayerPtr pPlayer ); bool movePlayer( TerritoryPtr, Entity::PlayerPtr pPlayer );
/*! returns an instancePtr if the player is still bound to an isntance */ /*! returns an instancePtr if the player is still bound to an isntance */
ZonePtr getLinkedInstance( uint32_t playerId ) const; TerritoryPtr getLinkedInstance( uint32_t playerId ) const;
/*! /*!
* @brief Sets the current festival for every zone * @brief Sets the current festival for every zone
@ -163,16 +163,16 @@ namespace Sapphire::World::Manager
private: private:
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >; using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >; using InstanceIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >;
using LandSetIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >; using LandSetIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >;
using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >; using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >;
using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >; using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >;
using QuestBattleIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >; using QuestBattleIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >;
using QuestBattleIdToContentFinderCondMap = std::unordered_map< uint16_t, uint16_t >; using QuestBattleIdToContentFinderCondMap = std::unordered_map< uint16_t, uint16_t >;
using PlayerIdToInstanceIdMap = std::unordered_map< uint32_t, uint32_t >; using PlayerIdToInstanceIdMap = std::unordered_map< uint32_t, uint32_t >;
using PositionMap = std::unordered_map< int32_t, ZonePositionPtr >; using PositionMap = std::unordered_map< int32_t, ZonePositionPtr >;
using InstanceIdList = std::vector< uint32_t >; using InstanceIdList = std::vector< uint32_t >;
using LandIdentToZonePtrMap = std::unordered_map< uint64_t, ZonePtr >; using LandIdentToTerritoryPtrMap = std::unordered_map< uint64_t, TerritoryPtr >;
/*! map holding details for territory templates */ /*! map holding details for territory templates */
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap; TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
@ -181,7 +181,7 @@ namespace Sapphire::World::Manager
TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap; TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap;
/*! map holding actual instances of default territories */ /*! map holding actual instances of default territories */
LandSetIdToZonePtrMap m_landSetIdToZonePtrMap; LandSetIdToTerritoryPtrMap m_landSetIdToTerritoryPtrMap;
/*! map holding actual instances of InstanceContent */ /*! map holding actual instances of InstanceContent */
InstanceContentIdToInstanceMap m_instanceContentIdToInstanceMap; InstanceContentIdToInstanceMap m_instanceContentIdToInstanceMap;
@ -190,7 +190,7 @@ namespace Sapphire::World::Manager
QuestBattleIdToInstanceMap m_questBattleIdToInstanceMap; QuestBattleIdToInstanceMap m_questBattleIdToInstanceMap;
/*! flat map for easier lookup of instances by guid */ /*! flat map for easier lookup of instances by guid */
InstanceIdToZonePtrMap m_guIdToZonePtrMap; InstanceIdToTerritoryPtrMap m_guIdToTerritoryPtrMap;
/*! map holding positions for zonelines */ /*! map holding positions for zonelines */
PositionMap m_territoryPositionMap; PositionMap m_territoryPositionMap;
@ -199,16 +199,16 @@ namespace Sapphire::World::Manager
PlayerIdToInstanceIdMap m_playerIdToInstanceMap; PlayerIdToInstanceIdMap m_playerIdToInstanceMap;
/*! map for storing landident to zones, used for internal housing zones */ /*! map for storing landident to zones, used for internal housing zones */
LandIdentToZonePtrMap m_landIdentToZonePtrMap; LandIdentToTerritoryPtrMap m_landIdentToTerritoryPtrMap;
/*! internal counter for instanceIds */ /*! internal counter for instanceIds */
uint32_t m_lastInstanceId; uint32_t m_lastInstanceId;
/*! set of ZonePtrs for quick iteration*/ /*! set of TerritoryPtrs for quick iteration*/
std::set< ZonePtr > m_zoneSet; std::set< TerritoryPtr > m_zoneSet;
/*! set of ZonePtrs for quick iteration*/ /*! set of TerritoryPtrs for quick iteration*/
std::set< ZonePtr > m_instanceZoneSet; std::set< TerritoryPtr > m_instanceZoneSet;
/*! current festival(s) to set for public zones from festival.exd */ /*! current festival(s) to set for public zones from festival.exd */
std::pair< uint16_t, uint16_t > m_currentFestival; std::pair< uint16_t, uint16_t > m_currentFestival;

View file

@ -1,6 +1,6 @@
#include <Common.h> #include <Common.h>
#include <Framework.h> #include <Framework.h>
#include <Territory/Zone.h> #include <Territory/Territory.h>
#include <Logging/Logger.h> #include <Logging/Logger.h>
#include <ServerMgr.h> #include <ServerMgr.h>

View file

@ -8,7 +8,7 @@
#include <Network/PacketContainer.h> #include <Network/PacketContainer.h>
#include <Network/GamePacketParser.h> #include <Network/GamePacketParser.h>
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/PlayerSetupPacket.h"
@ -215,13 +215,13 @@ void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Pac
std::string name = itStr != m_zoneHandlerStrMap.end() ? itStr->second : "unknown"; std::string name = itStr != m_zoneHandlerStrMap.end() ? itStr->second : "unknown";
// dont display packet notification if it is a ping or pos update, don't want the spam // dont display packet notification if it is a ping or pos update, don't want the spam
if( opcode != PingHandler && opcode != UpdatePositionHandler ) if( opcode != PingHandler && opcode != UpdatePositionHandler )
Logger::debug( "[{0}] Handling Zone IPC : {1} ( {2:04X} )", m_pSession->getId(), name, opcode ); Logger::debug( "[{0}] Handling World IPC : {1} ( {2:04X} )", m_pSession->getId(), name, opcode );
( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() ); ( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() );
} }
else else
{ {
Logger::debug( "[{0}] Undefined Zone IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode ); Logger::debug( "[{0}] Undefined World IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode );
Logger::debug( "Dump:\n{0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ), Logger::debug( "Dump:\n{0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ),
pPacket.segHdr.size ) ); pPacket.segHdr.size ) );
@ -433,7 +433,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 ); auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
*( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId; *( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId;
sendSinglePacket( pe1 ); sendSinglePacket( pe1 );
Logger::info( "[{0}] Setting session for zone connection", id ); Logger::info( "[{0}] Setting session for world connection", id );
session->setZoneConnection( pCon ); session->setZoneConnection( pCon );
} }
// chat connection, assinging it to the session // chat connection, assinging it to the session

View file

@ -8,7 +8,7 @@
#include <Network/PacketDef/Zone/ClientZoneDef.h> #include <Network/PacketDef/Zone/ClientZoneDef.h>
#include <Util/Util.h> #include <Util/Util.h>
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/ZonePosition.h" #include "Territory/ZonePosition.h"
#include "Manager/HousingMgr.h" #include "Manager/HousingMgr.h"

View file

@ -14,7 +14,7 @@
#include "Session.h" #include "Session.h"
#include "Manager/TerritoryMgr.h" #include "Manager/TerritoryMgr.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/InstanceContent.h" #include "Territory/InstanceContent.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/PlayerSetupPacket.h"
@ -191,7 +191,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
case GmCommand::Weather: case GmCommand::Weather:
{ {
targetPlayer->getCurrentZone()->setWeatherOverride( static_cast< Common::Weather >( param1 ) ); targetPlayer->getCurrentZone()->setWeatherOverride( static_cast< Common::Weather >( param1 ) );
player.sendNotice( "Weather in Zone \"{0}\" of {1} set in range.", player.sendNotice( "Weather in Territory \"{0}\" of {1} set in range.",
targetPlayer->getCurrentZone()->getName(), targetPlayer->getName() ); targetPlayer->getCurrentZone()->getName(), targetPlayer->getName() );
break; break;
} }
@ -208,7 +208,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
{ {
player.sendNotice( "Name: {0}" player.sendNotice( "Name: {0}"
"\nGil: {1}" "\nGil: {1}"
"\nZone: {2}" "\nTerritory: {2}"
"({3})" "({3})"
"\nClass: {4}" "\nClass: {4}"
"\nLevel: {5}" "\nLevel: {5}"
@ -659,7 +659,7 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw,
} }
if( targetPlayer->getCurrentZone()->getGuId() != player.getCurrentZone()->getGuId() ) if( targetPlayer->getCurrentZone()->getGuId() != player.getCurrentZone()->getGuId() )
{ {
// Checks if the target player is in an InstanceContent to avoid binding to a Zone 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() )
{ {
auto pInstanceContent = targetPlayer->getCurrentInstance()->getAsInstanceContent(); auto pInstanceContent = targetPlayer->getCurrentInstance()->getAsInstanceContent();

View file

@ -8,7 +8,7 @@
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/ZonePosition.h" #include "Territory/ZonePosition.h"
#include "Manager/DebugCommandMgr.h" #include "Manager/DebugCommandMgr.h"

View file

@ -15,7 +15,7 @@
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/HousingZone.h" #include "Territory/HousingZone.h"
#include "Territory/Land.h" #include "Territory/Land.h"
#include "Territory/ZonePosition.h" #include "Territory/ZonePosition.h"

View file

@ -3,7 +3,7 @@
#include <watchdog/Watchdog.h> #include <watchdog/Watchdog.h>
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Territory/InstanceContent.h" #include "Territory/InstanceContent.h"
#include "Territory/QuestBattle.h" #include "Territory/QuestBattle.h"
#include "Actor/Player.h" #include "Actor/Player.h"
@ -412,7 +412,7 @@ bool Sapphire::Scripting::ScriptMgr::onStatusTimeOut( Entity::CharaPtr pChara, u
return false; return false;
} }
bool Sapphire::Scripting::ScriptMgr::onZoneInit( ZonePtr pZone ) bool Sapphire::Scripting::ScriptMgr::onZoneInit( TerritoryPtr pZone )
{ {
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::ZoneScript >( pZone->getTerritoryTypeId() ); auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::ZoneScript >( pZone->getTerritoryTypeId() );
if( script ) if( script )

View file

@ -84,7 +84,7 @@ namespace Sapphire::Scripting
bool onStatusTimeOut( Entity::CharaPtr pActor, uint32_t effectId ); bool onStatusTimeOut( Entity::CharaPtr pActor, uint32_t effectId );
bool onZoneInit( ZonePtr pZone ); bool onZoneInit( TerritoryPtr pZone );
bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1, bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1,
uint16_t param2, uint16_t param3 ); uint16_t param2, uint16_t param3 );

View file

@ -2,7 +2,7 @@
#include "Actor/Chara.h" #include "Actor/Chara.h"
#include "Forwards.h" #include "Forwards.h"
#include "Zone.h" #include "Territory.h"
#include <Logging/Logger.h> #include <Logging/Logger.h>
// TODO: the entire zone / areahandling is a bit outdated ( in parts i used this for the 1.0 iteration ) // TODO: the entire zone / areahandling is a bit outdated ( in parts i used this for the 1.0 iteration )
@ -22,7 +22,7 @@ Sapphire::Cell::~Cell()
removeActors(); removeActors();
} }
void Sapphire::Cell::init( uint32_t x, uint32_t y, ZonePtr pZone ) void Sapphire::Cell::init( uint32_t x, uint32_t y, TerritoryPtr pZone )
{ {
m_pZone = pZone; m_pZone = pZone;
m_posX = x; m_posX = x;

View file

@ -13,7 +13,7 @@ typedef std::set< Entity::ActorPtr > ActorSet;
class Cell class Cell
{ {
friend class Zone; friend class Territory;
private: private:
bool m_bForcedActive; bool m_bForcedActive;
@ -25,14 +25,14 @@ private:
bool m_bUnloadPending; bool m_bUnloadPending;
uint16_t m_playerCount; uint16_t m_playerCount;
ZonePtr m_pZone; TerritoryPtr m_pZone;
public: public:
Cell(); Cell();
~Cell(); ~Cell();
void init( uint32_t x, uint32_t y, ZonePtr pZone ); void init( uint32_t x, uint32_t y, TerritoryPtr pZone );
void addActor( Entity::ActorPtr pAct ); void addActor( Entity::ActorPtr pAct );

View file

@ -36,7 +36,7 @@ Sapphire::World::Territory::Housing::HousingInteriorTerritory::HousingInteriorTe
const std::string& internalName, const std::string& internalName,
const std::string& contentName, const std::string& contentName,
FrameworkPtr pFw ) : FrameworkPtr pFw ) :
Zone( territoryTypeId, guId, internalName, contentName, pFw ), Territory( territoryTypeId, guId, internalName, contentName, pFw ),
m_landIdent( ident ) m_landIdent( ident )
{ {
} }
@ -54,7 +54,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone
{ {
auto pHousingMgr = m_pFw->get< HousingMgr >(); auto pHousingMgr = m_pFw->get< HousingMgr >();
Logger::debug( "HousingInteriorTerritory::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", Logger::debug( "HousingInteriorTerritory::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
getGuId(), getTerritoryTypeId(), player.getId() ); getGuId(), getTerritoryTypeId(), player.getId() );
auto indoorInitPacket = makeZonePacket< Server::FFXIVIpcHousingIndoorInitialize >( player.getId() ); auto indoorInitPacket = makeZonePacket< Server::FFXIVIpcHousingIndoorInitialize >( player.getId() );

View file

@ -1,11 +1,11 @@
#include "ForwardsZone.h" #include "ForwardsZone.h"
#include "Territory/Zone.h" #include "Territory/Territory.h"
#include "Common.h" #include "Common.h"
#include <array> #include <array>
namespace Sapphire::World::Territory::Housing namespace Sapphire::World::Territory::Housing
{ {
class HousingInteriorTerritory : public Zone class HousingInteriorTerritory : public Territory
{ {
public: public:
HousingInteriorTerritory( Common::LandIdent ident, uint16_t territoryTypeId, HousingInteriorTerritory( Common::LandIdent ident, uint16_t territoryTypeId,

View file

@ -33,7 +33,7 @@ Sapphire::HousingZone::HousingZone( uint8_t wardNum,
const std::string& internalName, const std::string& internalName,
const std::string& contentName, const std::string& contentName,
FrameworkPtr pFw ) : FrameworkPtr pFw ) :
Zone( territoryTypeId, guId, internalName, contentName, pFw ), Territory( territoryTypeId, guId, internalName, contentName, pFw ),
m_wardNum( wardNum ), m_wardNum( wardNum ),
m_territoryTypeId( territoryTypeId ), m_territoryTypeId( territoryTypeId ),
m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum ), m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum ),
@ -155,7 +155,7 @@ bool Sapphire::HousingZone::init()
void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player ) void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
{ {
Logger::debug( "HousingZone::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", Logger::debug( "HousingZone::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
getGuId(), getTerritoryTypeId(), player.getId() ); getGuId(), getTerritoryTypeId(), player.getId() );
auto isInSubdivision = isPlayerSubInstance( player ) ? true : false; auto isInSubdivision = isPlayerSubInstance( player ) ? true : false;

View file

@ -1,7 +1,7 @@
#ifndef SAPPHIRE_HOUSINGZONE_H #ifndef SAPPHIRE_HOUSINGZONE_H
#define SAPPHIRE_HOUSINGZONE_H #define SAPPHIRE_HOUSINGZONE_H
#include "Zone.h" #include "Territory.h"
#include "Forwards.h" #include "Forwards.h"
#include <array> #include <array>
@ -24,7 +24,7 @@ namespace Sapphire
RELOCATE = 4, RELOCATE = 4,
}; };
class HousingZone : public Zone class HousingZone : public Territory
{ {
public: public:
HousingZone( uint8_t landSetId, HousingZone( uint8_t landSetId,

View file

@ -34,7 +34,7 @@ Sapphire::InstanceContent::InstanceContent( std::shared_ptr< Sapphire::Data::Ins
const std::string& contentName, const std::string& contentName,
uint32_t instanceContentId, uint32_t instanceContentId,
FrameworkPtr pFw ) : FrameworkPtr pFw ) :
Zone( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ), Territory( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ),
Director( Event::Director::InstanceContent, instanceContentId ), Director( Event::Director::InstanceContent, instanceContentId ),
m_instanceConfiguration( pInstanceConfiguration ), m_instanceConfiguration( pInstanceConfiguration ),
m_instanceContentId( instanceContentId ), m_instanceContentId( instanceContentId ),
@ -48,7 +48,7 @@ Sapphire::InstanceContent::InstanceContent( std::shared_ptr< Sapphire::Data::Ins
bool Sapphire::InstanceContent::init() bool Sapphire::InstanceContent::init()
{ {
if( !Zone::init() ) if( !Territory::init() )
return false; return false;
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
@ -75,7 +75,7 @@ Sapphire::Data::ExdDataGenerated::InstanceContentPtr Sapphire::InstanceContent::
void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player ) void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
{ {
Logger::debug( "InstanceContent::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", Logger::debug( "InstanceContent::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
getGuId(), getTerritoryTypeId(), player.getId() ); getGuId(), getTerritoryTypeId(), player.getId() );
// mark player as "bound by duty" // mark player as "bound by duty"
@ -90,7 +90,7 @@ void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
void Sapphire::InstanceContent::onLeaveTerritory( Entity::Player& player ) void Sapphire::InstanceContent::onLeaveTerritory( Entity::Player& player )
{ {
Logger::debug( "InstanceContent::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", Logger::debug( "InstanceContent::onLeaveTerritory: Territory#{0}|{1}, Entity#{2}",
getGuId(), getTerritoryTypeId(), player.getId() ); getGuId(), getTerritoryTypeId(), player.getId() );
clearDirector( player ); clearDirector( player );
@ -318,7 +318,7 @@ void Sapphire::InstanceContent::onRegisterEObj( Entity::EventObjectPtr object )
// todo: data should be renamed to eventId // todo: data should be renamed to eventId
m_eventIdToObjectMap[ objData->data ] = object; m_eventIdToObjectMap[ objData->data ] = object;
else else
Logger::error( "InstanceContent::onRegisterEObj Zone " + Logger::error( "InstanceContent::onRegisterEObj Territory " +
m_internalName + ": No EObj data found for EObj with ID: " + m_internalName + ": No EObj data found for EObj with ID: " +
std::to_string( object->getObjectId() ) ); std::to_string( object->getObjectId() ) );
} }

View file

@ -1,7 +1,7 @@
#ifndef SAPPHIRE_INSTANCECONTENT_H #ifndef SAPPHIRE_INSTANCECONTENT_H
#define SAPPHIRE_INSTANCECONTENT_H #define SAPPHIRE_INSTANCECONTENT_H
#include "Zone.h" #include "Territory.h"
#include "Event/Director.h" #include "Event/Director.h"
#include "Forwards.h" #include "Forwards.h"
@ -12,7 +12,7 @@ namespace Sapphire::Data
namespace Sapphire namespace Sapphire
{ {
class InstanceContent : public Event::Director, public Zone class InstanceContent : public Event::Director, public Territory
{ {
public: public:
enum InstanceContentState enum InstanceContentState

View file

@ -36,7 +36,7 @@ Sapphire::QuestBattle::QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle
const std::string& contentName, const std::string& contentName,
uint32_t questBattleId, uint32_t questBattleId,
FrameworkPtr pFw ) : FrameworkPtr pFw ) :
Zone( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ), Territory( static_cast< uint16_t >( territoryType ), guId, internalName, contentName, pFw ),
Director( Event::Director::QuestBattle, questBattleId ), Director( Event::Director::QuestBattle, questBattleId ),
m_pBattleDetails( pBattleDetails ), m_pBattleDetails( pBattleDetails ),
m_questBattleId( questBattleId ), m_questBattleId( questBattleId ),
@ -48,7 +48,7 @@ Sapphire::QuestBattle::QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle
bool Sapphire::QuestBattle::init() bool Sapphire::QuestBattle::init()
{ {
if( !Zone::init() ) if( !Territory::init() )
return false; return false;
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
@ -69,7 +69,7 @@ Sapphire::Data::ExdDataGenerated::QuestBattlePtr Sapphire::QuestBattle::getQuest
void Sapphire::QuestBattle::onPlayerZoneIn( Entity::Player& player ) void Sapphire::QuestBattle::onPlayerZoneIn( Entity::Player& player )
{ {
Logger::debug( "QuestBattle::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", Logger::debug( "QuestBattle::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}",
getGuId(), getTerritoryTypeId(), player.getId() ); getGuId(), getTerritoryTypeId(), player.getId() );
m_pPlayer = player.getAsPlayer(); m_pPlayer = player.getAsPlayer();
@ -83,7 +83,7 @@ void Sapphire::QuestBattle::onPlayerZoneIn( Entity::Player& player )
void Sapphire::QuestBattle::onLeaveTerritory( Entity::Player& player ) void Sapphire::QuestBattle::onLeaveTerritory( Entity::Player& player )
{ {
Logger::debug( "QuestBattle::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", Logger::debug( "QuestBattle::onLeaveTerritory: Territory#{0}|{1}, Entity#{2}",
getGuId(), getTerritoryTypeId(), player.getId() ); getGuId(), getTerritoryTypeId(), player.getId() );
clearDirector( player ); clearDirector( player );
@ -291,7 +291,7 @@ void Sapphire::QuestBattle::onRegisterEObj( Entity::EventObjectPtr object )
// todo: data should be renamed to eventId // todo: data should be renamed to eventId
m_eventIdToObjectMap[ objData->data ] = object; m_eventIdToObjectMap[ objData->data ] = object;
else else
Logger::error( "InstanceContent::onRegisterEObj Zone " + Logger::error( "InstanceContent::onRegisterEObj Territory " +
m_internalName + ": No EObj data found for EObj with ID: " + m_internalName + ": No EObj data found for EObj with ID: " +
std::to_string( object->getObjectId() ) ); std::to_string( object->getObjectId() ) );
} }

View file

@ -1,7 +1,7 @@
#ifndef SAPPHIRE_QUESTBATTLE_H #ifndef SAPPHIRE_QUESTBATTLE_H
#define SAPPHIRE_QUESTBATTLE_H #define SAPPHIRE_QUESTBATTLE_H
#include "Zone.h" #include "Territory.h"
#include "Event/Director.h" #include "Event/Director.h"
#include "Forwards.h" #include "Forwards.h"
@ -12,7 +12,7 @@ namespace Sapphire::Data
namespace Sapphire namespace Sapphire
{ {
class QuestBattle : public Event::Director, public Zone class QuestBattle : public Event::Director, public Territory
{ {
public: public:
QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle > pBattleDetails, QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle > pBattleDetails,

View file

@ -15,7 +15,7 @@
#include <Database/DatabaseDef.h> #include <Database/DatabaseDef.h>
#include <Network/PacketWrappers/ActorControlPacket143.h> #include <Network/PacketWrappers/ActorControlPacket143.h>
#include "Zone.h" #include "Territory.h"
#include "InstanceContent.h" #include "InstanceContent.h"
#include "QuestBattle.h" #include "QuestBattle.h"
#include "Manager/TerritoryMgr.h" #include "Manager/TerritoryMgr.h"
@ -39,7 +39,7 @@
#include "ForwardsZone.h" #include "ForwardsZone.h"
#include "ServerMgr.h" #include "ServerMgr.h"
#include "CellHandler.h" #include "CellHandler.h"
#include "Zone.h" #include "Territory.h"
#include "Framework.h" #include "Framework.h"
#include "Manager/RNGMgr.h" #include "Manager/RNGMgr.h"
@ -54,7 +54,7 @@ using namespace Sapphire::World::Manager;
/** /**
* \brief * \brief
*/ */
Sapphire::Zone::Zone() : Sapphire::Territory::Territory() :
m_territoryTypeId( 0 ), m_territoryTypeId( 0 ),
m_guId( 0 ), m_guId( 0 ),
m_currentWeather( Weather::FairSkies ), m_currentWeather( Weather::FairSkies ),
@ -65,7 +65,7 @@ Sapphire::Zone::Zone() :
{ {
} }
Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId, Sapphire::Territory::Territory( uint16_t territoryTypeId, uint32_t guId,
const std::string& internalName, const std::string& placeName, const std::string& internalName, const std::string& placeName,
FrameworkPtr pFw ) : FrameworkPtr pFw ) :
m_currentWeather( Weather::FairSkies ), m_currentWeather( Weather::FairSkies ),
@ -93,7 +93,7 @@ Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId,
m_currentWeather = getNextWeather(); m_currentWeather = getNextWeather();
} }
void Sapphire::Zone::loadWeatherRates() void Sapphire::Territory::loadWeatherRates()
{ {
if( !m_territoryTypeInfo ) if( !m_territoryTypeInfo )
return; return;
@ -118,11 +118,9 @@ void Sapphire::Zone::loadWeatherRates()
} }
} }
Sapphire::Zone::~Zone() Sapphire::Territory::~Territory() = default;
{
}
bool Sapphire::Zone::init() bool Sapphire::Territory::init()
{ {
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
@ -144,22 +142,22 @@ bool Sapphire::Zone::init()
return true; return true;
} }
void Sapphire::Zone::setWeatherOverride( Weather weather ) void Sapphire::Territory::setWeatherOverride( Weather weather )
{ {
m_weatherOverride = weather; m_weatherOverride = weather;
} }
Weather Sapphire::Zone::getCurrentWeather() const Weather Sapphire::Territory::getCurrentWeather() const
{ {
return m_currentWeather; return m_currentWeather;
} }
const Sapphire::FestivalPair& Sapphire::Zone::getCurrentFestival() const const Sapphire::FestivalPair& Sapphire::Territory::getCurrentFestival() const
{ {
return m_currentFestival; return m_currentFestival;
} }
void Sapphire::Zone::setCurrentFestival( uint16_t festivalId, uint16_t additionalFestivalId ) void Sapphire::Territory::setCurrentFestival( uint16_t festivalId, uint16_t additionalFestivalId )
{ {
m_currentFestival = { festivalId, additionalFestivalId }; m_currentFestival = { festivalId, additionalFestivalId };
@ -172,11 +170,11 @@ void Sapphire::Zone::setCurrentFestival( uint16_t festivalId, uint16_t additiona
} }
} }
void Sapphire::Zone::loadCellCache() void Sapphire::Territory::loadCellCache()
{ {
} }
Weather Sapphire::Zone::getNextWeather() Weather Sapphire::Territory::getNextWeather()
{ {
uint32_t unixTime = Util::getTimeSeconds(); uint32_t unixTime = Util::getTimeSeconds();
// Get Eorzea hour for weather start // Get Eorzea hour for weather start
@ -206,7 +204,7 @@ Weather Sapphire::Zone::getNextWeather()
return Weather::FairSkies; return Weather::FairSkies;
} }
void Sapphire::Zone::pushActor( Entity::ActorPtr pActor ) void Sapphire::Territory::pushActor( Entity::ActorPtr pActor )
{ {
float mx = pActor->getPos().x; float mx = pActor->getPos().x;
float my = pActor->getPos().z; float my = pActor->getPos().z;
@ -271,7 +269,7 @@ void Sapphire::Zone::pushActor( Entity::ActorPtr pActor )
} }
} }
void Sapphire::Zone::removeActor( Entity::ActorPtr pActor ) void Sapphire::Territory::removeActor( Entity::ActorPtr pActor )
{ {
float mx = pActor->getPos().x; float mx = pActor->getPos().x;
float my = pActor->getPos().z; float my = pActor->getPos().z;
@ -314,7 +312,7 @@ void Sapphire::Zone::removeActor( Entity::ActorPtr pActor )
} }
void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range, void Sapphire::Territory::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
Network::Packets::FFXIVPacketBasePtr pPacketEntry ) Network::Packets::FFXIVPacketBasePtr pPacketEntry )
{ {
auto pTeriMgr = m_pFw->get< TerritoryMgr >(); auto pTeriMgr = m_pFw->get< TerritoryMgr >();
@ -339,7 +337,7 @@ void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t
} }
} }
void Sapphire::Zone::queuePacketForZone( Entity::Player& sourcePlayer, void Sapphire::Territory::queuePacketForZone( Entity::Player& sourcePlayer,
Network::Packets::FFXIVPacketBasePtr pPacketEntry, Network::Packets::FFXIVPacketBasePtr pPacketEntry,
bool forSelf ) bool forSelf )
{ {
@ -361,37 +359,37 @@ void Sapphire::Zone::queuePacketForZone( Entity::Player& sourcePlayer,
} }
} }
uint32_t Sapphire::Zone::getTerritoryTypeId() const uint32_t Sapphire::Territory::getTerritoryTypeId() const
{ {
return m_territoryTypeId; return m_territoryTypeId;
} }
uint32_t Sapphire::Zone::getGuId() const uint32_t Sapphire::Territory::getGuId() const
{ {
return m_guId; return m_guId;
} }
const std::string& Sapphire::Zone::getName() const const std::string& Sapphire::Territory::getName() const
{ {
return m_placeName; return m_placeName;
} }
const std::string& Sapphire::Zone::getInternalName() const const std::string& Sapphire::Territory::getInternalName() const
{ {
return m_internalName; return m_internalName;
} }
const std::string& Sapphire::Zone::getBgPath() const const std::string& Sapphire::Territory::getBgPath() const
{ {
return m_bgPath; return m_bgPath;
} }
std::size_t Sapphire::Zone::getPopCount() const std::size_t Sapphire::Territory::getPopCount() const
{ {
return m_playerMap.size(); return m_playerMap.size();
} }
bool Sapphire::Zone::checkWeather() bool Sapphire::Territory::checkWeather()
{ {
if( m_weatherOverride != Weather::None ) if( m_weatherOverride != Weather::None )
{ {
@ -413,7 +411,7 @@ bool Sapphire::Zone::checkWeather()
return false; return false;
} }
void Sapphire::Zone::updateBNpcs( uint64_t tickCount ) void Sapphire::Territory::updateBNpcs( uint64_t tickCount )
{ {
if( ( tickCount - m_lastMobUpdate ) <= 250 ) if( ( tickCount - m_lastMobUpdate ) <= 250 )
return; return;
@ -468,12 +466,12 @@ void Sapphire::Zone::updateBNpcs( uint64_t tickCount )
} }
uint64_t Sapphire::Zone::getLastActivityTime() const uint64_t Sapphire::Territory::getLastActivityTime() const
{ {
return m_lastActivityTime; return m_lastActivityTime;
} }
bool Sapphire::Zone::update( uint64_t tickCount ) bool Sapphire::Territory::update( uint64_t tickCount )
{ {
//TODO: this should be moved to a updateWeather call and pulled out of updateSessions //TODO: this should be moved to a updateWeather call and pulled out of updateSessions
bool changedWeather = checkWeather(); bool changedWeather = checkWeather();
@ -496,7 +494,7 @@ bool Sapphire::Zone::update( uint64_t tickCount )
return true; return true;
} }
void Sapphire::Zone::updateSessions( uint64_t tickCount, bool changedWeather ) void Sapphire::Territory::updateSessions( uint64_t tickCount, bool changedWeather )
{ {
// update sessions in this zone // update sessions in this zone
for( auto it = m_playerMap.begin(); it != m_playerMap.end(); ++it ) for( auto it = m_playerMap.begin(); it != m_playerMap.end(); ++it )
@ -534,7 +532,7 @@ void Sapphire::Zone::updateSessions( uint64_t tickCount, bool changedWeather )
} }
} }
bool Sapphire::Zone::isCellActive( uint32_t x, uint32_t y ) bool Sapphire::Territory::isCellActive( uint32_t x, uint32_t y )
{ {
uint32_t endX = ( ( x + 1 ) <= _sizeX ) ? x + 1 : ( _sizeX - 1 ); uint32_t endX = ( ( x + 1 ) <= _sizeX ) ? x + 1 : ( _sizeX - 1 );
uint32_t endY = ( ( y + 1 ) <= _sizeY ) ? y + 1 : ( _sizeY - 1 ); uint32_t endY = ( ( y + 1 ) <= _sizeY ) ? y + 1 : ( _sizeY - 1 );
@ -559,7 +557,7 @@ bool Sapphire::Zone::isCellActive( uint32_t x, uint32_t y )
return false; return false;
} }
void Sapphire::Zone::updateCellActivity( uint32_t x, uint32_t y, int32_t radius ) void Sapphire::Territory::updateCellActivity( uint32_t x, uint32_t y, int32_t radius )
{ {
uint32_t endX = ( x + radius ) <= _sizeX ? x + radius : ( _sizeX - 1 ); uint32_t endX = ( x + radius ) <= _sizeX ? x + radius : ( _sizeX - 1 );
@ -608,7 +606,7 @@ void Sapphire::Zone::updateCellActivity( uint32_t x, uint32_t y, int32_t radius
} }
} }
void Sapphire::Zone::updateActorPosition( Entity::Actor& actor ) void Sapphire::Territory::updateActorPosition( Entity::Actor& actor )
{ {
if( actor.getCurrentZone() != shared_from_this() ) if( actor.getCurrentZone() != shared_from_this() )
@ -679,7 +677,7 @@ void Sapphire::Zone::updateActorPosition( Entity::Actor& actor )
} }
void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell ) void Sapphire::Territory::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
{ {
if( pCell == nullptr ) if( pCell == nullptr )
return; return;
@ -728,37 +726,37 @@ void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
} }
} }
void Sapphire::Zone::onPlayerZoneIn( Entity::Player& player ) void Sapphire::Territory::onPlayerZoneIn( Entity::Player& player )
{ {
Logger::debug( "Zone::onEnterTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() ); Logger::debug( "Territory::onEnterTerritory: Territory#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
} }
void Sapphire::Zone::onLeaveTerritory( Entity::Player& player ) void Sapphire::Territory::onLeaveTerritory( Entity::Player& player )
{ {
Logger::debug( "Zone::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() ); Logger::debug( "Territory::onLeaveTerritory: Territory#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
} }
void Sapphire::Zone::onUpdate( uint64_t tickCount ) void Sapphire::Territory::onUpdate( uint64_t tickCount )
{ {
updateBNpcs( tickCount ); updateBNpcs( tickCount );
} }
void Sapphire::Zone::onFinishLoading( Entity::Player& player ) void Sapphire::Territory::onFinishLoading( Entity::Player& player )
{ {
} }
void Sapphire::Zone::onInitDirector( Entity::Player& player ) void Sapphire::Territory::onInitDirector( Entity::Player& player )
{ {
} }
void Sapphire::Zone::onEnterTerritory( Sapphire::Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) void Sapphire::Territory::onEnterTerritory( Sapphire::Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 )
{ {
} }
void Sapphire::Zone::registerEObj( Entity::EventObjectPtr object ) void Sapphire::Territory::registerEObj( Entity::EventObjectPtr object )
{ {
if( !object ) if( !object )
return; return;
@ -772,7 +770,7 @@ void Sapphire::Zone::registerEObj( Entity::EventObjectPtr object )
//Logger::debug( "Registered instance eobj: " + std::to_string( object->getId() ) ); //Logger::debug( "Registered instance eobj: " + std::to_string( object->getId() ) );
} }
Sapphire::Entity::EventObjectPtr Sapphire::Zone::getEObj( uint32_t objId ) Sapphire::Entity::EventObjectPtr Sapphire::Territory::getEObj( uint32_t objId )
{ {
auto obj = m_eventObjects.find( objId ); auto obj = m_eventObjects.find( objId );
if( obj == m_eventObjects.end() ) if( obj == m_eventObjects.end() )
@ -781,28 +779,28 @@ Sapphire::Entity::EventObjectPtr Sapphire::Zone::getEObj( uint32_t objId )
return obj->second; return obj->second;
} }
Sapphire::InstanceContentPtr Sapphire::Zone::getAsInstanceContent() Sapphire::InstanceContentPtr Sapphire::Territory::getAsInstanceContent()
{ {
return std::dynamic_pointer_cast< InstanceContent, Zone >( shared_from_this() ); return std::dynamic_pointer_cast< InstanceContent, Territory >( shared_from_this() );
} }
Sapphire::QuestBattlePtr Sapphire::Zone::getAsQuestBattle() Sapphire::QuestBattlePtr Sapphire::Territory::getAsQuestBattle()
{ {
return std::dynamic_pointer_cast< QuestBattle, Zone >( shared_from_this() ); return std::dynamic_pointer_cast< QuestBattle, Territory >( shared_from_this() );
} }
uint32_t Sapphire::Zone::getNextEObjId() uint32_t Sapphire::Territory::getNextEObjId()
{ {
return ++m_nextEObjId; return ++m_nextEObjId;
} }
uint32_t Sapphire::Zone::getNextActorId() uint32_t Sapphire::Territory::getNextActorId()
{ {
return ++m_nextActorId; return ++m_nextActorId;
} }
Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink, Sapphire::Entity::EventObjectPtr Sapphire::Territory::registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
uint8_t state, FFXIVARR_POSITION3 pos, float scale, uint8_t state, FFXIVARR_POSITION3 pos, float scale,
float rotation ) float rotation )
{ {
@ -813,12 +811,12 @@ Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string
return eObj; return eObj;
} }
Sapphire::Data::TerritoryTypePtr Sapphire::Zone::getTerritoryTypeInfo() const Sapphire::Data::TerritoryTypePtr Sapphire::Territory::getTerritoryTypeInfo() const
{ {
return m_territoryTypeInfo; return m_territoryTypeInfo;
} }
bool Sapphire::Zone::loadSpawnGroups() bool Sapphire::Territory::loadSpawnGroups()
{ {
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >(); auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_SPAWNGROUPS ); auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_SPAWNGROUPS );
@ -863,7 +861,7 @@ bool Sapphire::Zone::loadSpawnGroups()
return false; return false;
} }
void Sapphire::Zone::updateSpawnPoints() void Sapphire::Territory::updateSpawnPoints()
{ {
auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >(); auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >();
auto rng = pRNGMgr->getRandGenerator< float >( 0.f, PI * 2 ); auto rng = pRNGMgr->getRandGenerator< float >( 0.f, PI * 2 );
@ -906,13 +904,13 @@ void Sapphire::Zone::updateSpawnPoints()
} }
uint32_t Sapphire::Zone::getNextEffectSequence() uint32_t Sapphire::Territory::getNextEffectSequence()
{ {
return m_effectCounter++; return m_effectCounter++;
} }
Sapphire::Entity::BNpcPtr Sapphire::Entity::BNpcPtr
Sapphire::Zone::createBNpcFromLevelEntry( uint32_t levelId, uint8_t level, uint8_t type, Sapphire::Territory::createBNpcFromLevelEntry( uint32_t levelId, uint8_t level, uint8_t type,
uint32_t hp, uint16_t nameId, uint32_t directorId, uint32_t hp, uint16_t nameId, uint32_t directorId,
uint8_t bnpcType ) uint8_t bnpcType )
{ {
@ -1006,7 +1004,7 @@ Sapphire::Entity::BNpcPtr
return bnpc; return bnpc;
} }
Sapphire::Entity::BNpcPtr Sapphire::Zone::getActiveBNpcByLevelId( uint32_t levelId ) Sapphire::Entity::BNpcPtr Sapphire::Territory::getActiveBNpcByLevelId( uint32_t levelId )
{ {
for( auto bnpcIt : m_bNpcMap ) for( auto bnpcIt : m_bNpcMap )
{ {
@ -1016,7 +1014,7 @@ Sapphire::Entity::BNpcPtr Sapphire::Zone::getActiveBNpcByLevelId( uint32_t level
return nullptr; return nullptr;
} }
std::shared_ptr< Sapphire::World::Navi::NaviProvider > Sapphire::Zone::getNaviProvider() std::shared_ptr< Sapphire::World::Navi::NaviProvider > Sapphire::Territory::getNaviProvider()
{ {
return m_pNaviProvider; return m_pNaviProvider;
} }

View file

@ -29,7 +29,7 @@ namespace Sapphire
struct TerritoryType; struct TerritoryType;
} }
class Zone : public CellHandler< Cell >, public std::enable_shared_from_this< Zone > class Territory : public CellHandler< Cell >, public std::enable_shared_from_this< Territory >
{ {
protected: protected:
uint32_t m_territoryTypeId; uint32_t m_territoryTypeId;
@ -66,12 +66,12 @@ namespace Sapphire
std::shared_ptr< World::Navi::NaviProvider > m_pNaviProvider; std::shared_ptr< World::Navi::NaviProvider > m_pNaviProvider;
public: public:
Zone(); Territory();
Zone( 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, FrameworkPtr pFw ); const std::string& placeName, FrameworkPtr pFw );
virtual ~Zone(); virtual ~Territory();
/*! overrides the zone's weather, set to 0 to unlock */ /*! overrides the zone's weather, set to 0 to unlock */
void setWeatherOverride( Common::Weather weather ); void setWeatherOverride( Common::Weather weather );