From 9c3fba263e6f99746016a4d0da52cf81b2dc6c62 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sun, 21 Jul 2019 22:33:33 +1000 Subject: [PATCH] rename zone to territory --- .../common/housing/CmnDefHousingSignboard.cpp | 1 - src/world/Action/Action.cpp | 2 +- src/world/Actor/Actor.cpp | 10 +- src/world/Actor/Actor.h | 6 +- src/world/Actor/BNpc.cpp | 4 +- src/world/Actor/BNpc.h | 2 +- src/world/Actor/Chara.cpp | 2 +- src/world/Actor/EventObject.cpp | 4 +- src/world/Actor/EventObject.h | 8 +- src/world/Actor/Npc.cpp | 2 +- src/world/Actor/Player.cpp | 6 +- src/world/Actor/Player.h | 4 +- src/world/Actor/PlayerEvent.cpp | 2 +- src/world/Actor/PlayerInventory.cpp | 2 +- src/world/Actor/PlayerSql.cpp | 6 +- src/world/ForwardsZone.h | 2 +- src/world/Manager/DebugCommandMgr.cpp | 4 +- src/world/Manager/HousingMgr.cpp | 2 +- src/world/Manager/PlayerMgr.cpp | 4 +- src/world/Manager/TerritoryMgr.cpp | 68 +++++----- src/world/Manager/TerritoryMgr.h | 46 +++---- src/world/Navi/NaviProvider.cpp | 2 +- src/world/Network/GameConnection.cpp | 8 +- .../Network/Handlers/ClientTriggerHandler.cpp | 2 +- .../Network/Handlers/GMCommandHandlers.cpp | 8 +- .../Network/Handlers/InventoryHandler.cpp | 2 +- src/world/Network/Handlers/PacketHandlers.cpp | 2 +- src/world/Script/ScriptMgr.cpp | 4 +- src/world/Script/ScriptMgr.h | 2 +- src/world/Territory/Cell.cpp | 4 +- src/world/Territory/Cell.h | 6 +- .../Housing/HousingInteriorTerritory.cpp | 4 +- .../Housing/HousingInteriorTerritory.h | 4 +- src/world/Territory/HousingZone.cpp | 4 +- src/world/Territory/HousingZone.h | 4 +- src/world/Territory/InstanceContent.cpp | 10 +- src/world/Territory/InstanceContent.h | 4 +- src/world/Territory/QuestBattle.cpp | 10 +- src/world/Territory/QuestBattle.h | 4 +- .../Territory/{Zone.cpp => Territory.cpp} | 118 +++++++++--------- src/world/Territory/{Zone.h => Territory.h} | 10 +- 41 files changed, 198 insertions(+), 201 deletions(-) rename src/world/Territory/{Zone.cpp => Territory.cpp} (86%) rename src/world/Territory/{Zone.h => Territory.h} (93%) diff --git a/src/scripts/common/housing/CmnDefHousingSignboard.cpp b/src/scripts/common/housing/CmnDefHousingSignboard.cpp index 941ebec7..3ef74e78 100644 --- a/src/scripts/common/housing/CmnDefHousingSignboard.cpp +++ b/src/scripts/common/housing/CmnDefHousingSignboard.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index ba1665d0..8dd472f7 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -11,7 +11,7 @@ #include "Actor/Player.h" #include "Actor/BNpc.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include #include "Network/PacketWrappers/ActorControlPacket142.h" diff --git a/src/world/Actor/Actor.cpp b/src/world/Actor/Actor.cpp index 5d6dbd7c..4bbf9a08 100644 --- a/src/world/Actor/Actor.cpp +++ b/src/world/Actor/Actor.cpp @@ -6,7 +6,7 @@ #include #include -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Network/GameConnection.h" @@ -330,14 +330,14 @@ std::set< Sapphire::Entity::ActorPtr > Sapphire::Entity::Actor::getInRangeActors return tempInRange; } -/*! \return ZonePtr to the current zone, nullptr if not set */ -Sapphire::ZonePtr Sapphire::Entity::Actor::getCurrentZone() const +/*! \return TerritoryPtr to the current zone, nullptr if not set */ +Sapphire::TerritoryPtr Sapphire::Entity::Actor::getCurrentZone() const { return m_pCurrentZone; } -/*! \param ZonePtr to the zone to be set as current */ -void Sapphire::Entity::Actor::setCurrentZone( ZonePtr currZone ) +/*! \param TerritoryPtr to the zone to be set as current */ +void Sapphire::Entity::Actor::setCurrentZone( TerritoryPtr currZone ) { m_pCurrentZone = currZone; } diff --git a/src/world/Actor/Actor.h b/src/world/Actor/Actor.h index f251cbae..0df1d32c 100644 --- a/src/world/Actor/Actor.h +++ b/src/world/Actor/Actor.h @@ -32,7 +32,7 @@ namespace Sapphire::Entity /*! Id of the zone the actor currently is in */ uint32_t m_territoryTypeId; /*! Ptr to the ZoneObj the actor belongs to */ - ZonePtr m_pCurrentZone; + TerritoryPtr m_pCurrentZone; /*! list of various actors in range */ std::set< ActorPtr > m_inRangeActor; @@ -122,9 +122,9 @@ namespace Sapphire::Entity BNpcPtr getAsBNpc(); - ZonePtr getCurrentZone() const; + TerritoryPtr getCurrentZone() const; - void setCurrentZone( ZonePtr currZone ); + void setCurrentZone( TerritoryPtr currZone ); InstanceContentPtr getCurrentInstance() const; diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index 548db5d8..6ccb3d47 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -11,7 +11,7 @@ #include "Forwards.h" #include "Action/Action.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Network/GameConnection.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, - uint8_t level, uint32_t maxHp, ZonePtr pZone, FrameworkPtr pFw ) : + uint8_t level, uint32_t maxHp, TerritoryPtr pZone, FrameworkPtr pFw ) : Npc( ObjKind::BattleNpc, pFw ) { m_id = id; diff --git a/src/world/Actor/BNpc.h b/src/world/Actor/BNpc.h index 8f14e024..c76f8e99 100644 --- a/src/world/Actor/BNpc.h +++ b/src/world/Actor/BNpc.h @@ -51,7 +51,7 @@ namespace Sapphire::Entity public: BNpc( FrameworkPtr pFw ); 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; diff --git a/src/world/Actor/Chara.cpp b/src/world/Actor/Chara.cpp index 15e75ae2..7991c0bd 100644 --- a/src/world/Actor/Chara.cpp +++ b/src/world/Actor/Chara.cpp @@ -8,7 +8,7 @@ #include "Forwards.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Network/GameConnection.h" #include "Network/PacketWrappers/ActorControlPacket142.h" diff --git a/src/world/Actor/EventObject.cpp b/src/world/Actor/EventObject.cpp index b8829d30..cc34720e 100644 --- a/src/world/Actor/EventObject.cpp +++ b/src/world/Actor/EventObject.cpp @@ -102,12 +102,12 @@ uint32_t Sapphire::Entity::EventObject::getHousingLink() const return m_housingLink; } -void Sapphire::Entity::EventObject::setParentInstance( Sapphire::ZonePtr instance ) +void Sapphire::Entity::EventObject::setParentInstance( Sapphire::TerritoryPtr instance ) { m_parentInstance = instance; } -Sapphire::ZonePtr Sapphire::Entity::EventObject::getParentInstance() const +Sapphire::TerritoryPtr Sapphire::Entity::EventObject::getParentInstance() const { return m_parentInstance; } diff --git a/src/world/Actor/EventObject.h b/src/world/Actor/EventObject.h index 5e99256d..7b38f64d 100644 --- a/src/world/Actor/EventObject.h +++ b/src/world/Actor/EventObject.h @@ -13,7 +13,7 @@ namespace Sapphire::Entity Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" ); using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, - ZonePtr, uint64_t ) >; + TerritoryPtr, uint64_t ) >; uint32_t getGimmickId() const; @@ -35,9 +35,9 @@ namespace Sapphire::Entity const std::string& getName() const; - ZonePtr getParentInstance() const; + TerritoryPtr getParentInstance() const; - void setParentInstance( ZonePtr instance ); + void setParentInstance( TerritoryPtr instance ); void spawn( PlayerPtr pTarget ) override; @@ -56,7 +56,7 @@ namespace Sapphire::Entity uint8_t m_state; float m_scale; std::string m_name; - ZonePtr m_parentInstance; + TerritoryPtr m_parentInstance; OnTalkEventHandler m_onTalkEventHandler; diff --git a/src/world/Actor/Npc.cpp b/src/world/Actor/Npc.cpp index b0c86a90..6dcf112f 100644 --- a/src/world/Actor/Npc.cpp +++ b/src/world/Actor/Npc.cpp @@ -9,7 +9,7 @@ #include "Forwards.h" #include "Action/Action.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Network/GameConnection.h" #include "Network/PacketWrappers/ActorControlPacket142.h" diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index b008b987..ed003ed3 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -16,7 +16,7 @@ #include "Manager/TerritoryMgr.h" #include "Manager/RNGMgr.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/ZonePosition.h" #include "Territory/InstanceContent.h" #include "Territory/Land.h" @@ -437,7 +437,7 @@ bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId ) return setInstance( instance ); } -bool Sapphire::Entity::Player::setInstance( ZonePtr instance ) +bool Sapphire::Entity::Player::setInstance( TerritoryPtr instance ) { m_onEnterEventDone = false; if( !instance ) @@ -458,7 +458,7 @@ bool Sapphire::Entity::Player::setInstance( ZonePtr instance ) 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; if( !instance ) diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 08caf559..efaf1f7d 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -480,10 +480,10 @@ namespace Sapphire::Entity bool setInstance( uint32_t instanceContentId ); /*! sets the players instance & initiates zoning process */ - bool setInstance( ZonePtr instance ); + bool setInstance( TerritoryPtr instance ); /*! 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 */ bool exitInstance(); diff --git a/src/world/Actor/PlayerEvent.cpp b/src/world/Actor/PlayerEvent.cpp index 507973c8..7db09d0b 100644 --- a/src/world/Actor/PlayerEvent.cpp +++ b/src/world/Actor/PlayerEvent.cpp @@ -11,7 +11,7 @@ #include "Network/PacketWrappers/EventFinishPacket.h" #include "Network/PacketWrappers/DirectorPlayScenePacket.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "ServerMgr.h" #include "Framework.h" diff --git a/src/world/Actor/PlayerInventory.cpp b/src/world/Actor/PlayerInventory.cpp index 77677c64..720f2f2e 100644 --- a/src/world/Actor/PlayerInventory.cpp +++ b/src/world/Actor/PlayerInventory.cpp @@ -3,7 +3,7 @@ #include #include -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Network/PacketWrappers/ActorControlPacket142.h" #include "Network/PacketWrappers/ActorControlPacket143.h" diff --git a/src/world/Actor/PlayerSql.cpp b/src/world/Actor/PlayerSql.cpp index 91d032a3..61bac0a7 100644 --- a/src/world/Actor/PlayerSql.cpp +++ b/src/world/Actor/PlayerSql.cpp @@ -13,7 +13,7 @@ #include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Manager/TerritoryMgr.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Inventory/Item.h" #include "Inventory/ItemContainer.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_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( 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 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 ); // default to new gridania diff --git a/src/world/ForwardsZone.h b/src/world/ForwardsZone.h index fb584c7b..95ac658f 100644 --- a/src/world/ForwardsZone.h +++ b/src/world/ForwardsZone.h @@ -19,7 +19,7 @@ typedef std::vector< x > x ## PtrList; namespace Sapphire { TYPE_FORWARD( Cell ); -TYPE_FORWARD( Zone ); +TYPE_FORWARD( Territory ); TYPE_FORWARD( HousingZone ); TYPE_FORWARD( House ); TYPE_FORWARD( InstanceContent ); diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 76c89a7f..ac4c73a0 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -27,7 +27,7 @@ #include "Actor/EventObject.h" #include "Actor/BNpc.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/HousingZone.h" #include "Territory/InstanceContent.h" #include "Territory/QuestBattle.h" @@ -1267,7 +1267,7 @@ void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Pla // player.sendLandFlags(); // } // else -// player.sendDebug( "You aren't in a housing Zone." ); +// player.sendDebug( "You aren't in a housing Territory." ); // } // } // else diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index 623c6073..beacd0f7 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -16,7 +16,7 @@ #include "Event/EventDefs.h" #include "TerritoryMgr.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/HousingZone.h" #include "Territory/Housing/HousingInteriorTerritory.h" #include "HousingMgr.h" diff --git a/src/world/Manager/PlayerMgr.cpp b/src/world/Manager/PlayerMgr.cpp index 557f9c7f..1f0f60a1 100644 --- a/src/world/Manager/PlayerMgr.cpp +++ b/src/world/Manager/PlayerMgr.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include @@ -26,7 +26,7 @@ void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire: if( !terriMgr ) return; - Sapphire::ZonePtr destinationZone; + Sapphire::TerritoryPtr destinationZone; auto terriPos = terriMgr->getTerritoryPosition( landId ); if( terriPos ) diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index fb5fd0ca..3e707511 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -8,7 +8,7 @@ #include "Actor/Player.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/ZonePosition.h" #include "Territory/InstanceContent.h" #include "Territory/QuestBattle.h" @@ -181,7 +181,7 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories() 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(); std::string bgPath = territoryInfo->bg; @@ -197,9 +197,9 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories() hasNaviMesh ? "NAVI" : "", pPlaceName->name ); - InstanceIdToZonePtrMap instanceMap; + InstanceIdToTerritoryPtrMap instanceMap; instanceMap[ guid ] = pZone; - m_guIdToZonePtrMap[ guid ] = pZone; + m_guIdToTerritoryPtrMap[ guid ] = pZone; m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ] = instanceMap; m_zoneSet.insert( { pZone } ); @@ -243,11 +243,11 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories() pPlaceName->name, framework() ); pHousingZone->init(); - InstanceIdToZonePtrMap instanceMap; + InstanceIdToTerritoryPtrMap instanceMap; instanceMap[ guid ] = pHousingZone; - m_guIdToZonePtrMap[ guid ] = pHousingZone; + m_guIdToTerritoryPtrMap[ guid ] = pHousingZone; m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ][ guid ] = pHousingZone; - m_landSetIdToZonePtrMap[ pHousingZone->getLandSetId() ] = pHousingZone; + m_landSetIdToTerritoryPtrMap[ pHousingZone->getLandSetId() ] = pHousingZone; m_zoneSet.insert( { pHousingZone } ); } @@ -256,7 +256,7 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories() 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 ) ) return nullptr; @@ -274,17 +274,17 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc 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(); - m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone; + m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone; m_territoryTypeIdToInstanceGuidMap[ pZone->getTerritoryTypeId() ][ pZone->getGuId() ] = pZone; m_zoneSet.insert( { 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 ); @@ -321,13 +321,13 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uin pZone->init(); m_questBattleIdToInstanceMap[ questBattleId ][ pZone->getGuId() ] = pZone; - m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone; + m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone; m_instanceZoneSet.insert( 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 >(); @@ -355,19 +355,19 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( pZone->init(); m_instanceContentIdToInstanceMap[ instanceContentId ][ pZone->getGuId() ] = pZone; - m_guIdToZonePtrMap[ pZone->getGuId() ] = pZone; + m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone; m_instanceZoneSet.insert( 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 auto ident = *reinterpret_cast< const uint64_t* >( &landIdent ); - auto it = m_landIdentToZonePtrMap.find( ident ); - if( it != m_landIdentToZonePtrMap.end() ) + auto it = m_landIdentToTerritoryPtrMap.find( ident ); + if( it != m_landIdentToTerritoryPtrMap.end() ) { return it->second; } @@ -427,8 +427,8 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt zone->init(); - m_landIdentToZonePtrMap[ ident ] = zone; - m_guIdToZonePtrMap[ zone->getGuId() ] = zone; + m_landIdentToTerritoryPtrMap[ ident ] = zone; + m_guIdToTerritoryPtrMap[ zone->getGuId() ] = zone; m_zoneSet.insert( { zone } ); return zone; @@ -436,11 +436,11 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t guId ) { - ZonePtr pZone; + TerritoryPtr pZone; if( ( pZone = getTerritoryByGuId( guId ) ) == nullptr ) return false; - m_guIdToZonePtrMap.erase( pZone->getGuId() ); + m_guIdToTerritoryPtrMap.erase( pZone->getGuId() ); m_instanceZoneSet.erase( pZone ); m_zoneSet.erase( pZone ); @@ -456,10 +456,10 @@ bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t g 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 ); - if( it == m_guIdToZonePtrMap.end() ) + auto it = m_guIdToTerritoryPtrMap.find( guId ); + if( it == m_guIdToTerritoryPtrMap.end() ) return nullptr; return it->second; @@ -495,7 +495,7 @@ Sapphire::ZonePositionPtr Sapphire::World::Manager::TerritoryMgr::getTerritoryPo 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 ); if( zoneMap == m_territoryTypeIdToInstanceGuidMap.end() ) @@ -505,10 +505,10 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritoryType 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 ); - if( zoneMap == m_landSetIdToZonePtrMap.end() ) + auto zoneMap = m_landSetIdToTerritoryPtrMap.find( landSetId ); + if( zoneMap == m_landSetIdToTerritoryPtrMap.end() ) return nullptr; return zoneMap->second; @@ -527,7 +527,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t } // 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 ); assert( zone ); // wtf?? @@ -541,7 +541,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t // remove zone from maps m_zoneSet.erase( zone ); - it = m_landIdentToZonePtrMap.erase( it ); + it = m_landIdentToTerritoryPtrMap.erase( it ); } else it++; @@ -565,7 +565,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t // remove zone from maps m_instanceZoneSet.erase( zone ); - m_guIdToZonePtrMap.erase( zone->getGuId() ); + m_guIdToTerritoryPtrMap.erase( zone->getGuId() ); inIt = m_questBattleIdToInstanceMap[ zone->getQuestBattleId() ].erase( inIt ); } else @@ -598,11 +598,11 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( uint32_t territoryTypeI 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 ) { - Logger::error( "Zone not found on this server." ); + Logger::error( "Territory not found on this server." ); return false; } @@ -642,7 +642,7 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire 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 ); if( it != m_playerIdToInstanceMap.end() ) diff --git a/src/world/Manager/TerritoryMgr.h b/src/world/Manager/TerritoryMgr.h index 67b0229b..d3060656 100644 --- a/src/world/Manager/TerritoryMgr.h +++ b/src/world/Manager/TerritoryMgr.h @@ -102,21 +102,21 @@ namespace Sapphire::World::Manager bool isHousingTerritory( uint32_t territoryTypeId ) const; /*! 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 ); - ZonePtr findOrCreateHousingInterior( const Common::LandIdent landIdent ); + TerritoryPtr findOrCreateHousingInterior( const Common::LandIdent landIdent ); /*! removes instance by instanceId, return true if successful */ bool removeTerritoryInstance( uint32_t guId ); - /*! returns a ZonePtr to the instance or nullptr if not found */ - ZonePtr getTerritoryByGuId( uint32_t guId ) const; + /*! returns a TerritoryPtr to the instance or nullptr if not found */ + TerritoryPtr getTerritoryByGuId( uint32_t guId ) const; /*! returns the cached detail of a territory, nullptr if not found */ Data::TerritoryTypePtr getTerritoryDetail( uint32_t territoryTypeId ) const; @@ -129,17 +129,17 @@ namespace Sapphire::World::Manager /*! returns a default Zone by territoryTypeId TODO: Mind multiple instances?! */ - ZonePtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const; + TerritoryPtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const; /*! 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( ZonePtr, Entity::PlayerPtr pPlayer ); + bool movePlayer( TerritoryPtr, Entity::PlayerPtr pPlayer ); /*! 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 @@ -163,16 +163,16 @@ namespace Sapphire::World::Manager private: using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >; - using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >; - using LandSetIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >; - using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >; - using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >; - using QuestBattleIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >; + using InstanceIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >; + using LandSetIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >; + using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >; + using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >; + using QuestBattleIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >; using QuestBattleIdToContentFinderCondMap = std::unordered_map< uint16_t, uint16_t >; using PlayerIdToInstanceIdMap = std::unordered_map< uint32_t, uint32_t >; using PositionMap = std::unordered_map< int32_t, ZonePositionPtr >; 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 */ TerritoryTypeDetailCache m_territoryTypeDetailCacheMap; @@ -181,7 +181,7 @@ namespace Sapphire::World::Manager TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap; /*! map holding actual instances of default territories */ - LandSetIdToZonePtrMap m_landSetIdToZonePtrMap; + LandSetIdToTerritoryPtrMap m_landSetIdToTerritoryPtrMap; /*! map holding actual instances of InstanceContent */ InstanceContentIdToInstanceMap m_instanceContentIdToInstanceMap; @@ -190,7 +190,7 @@ namespace Sapphire::World::Manager QuestBattleIdToInstanceMap m_questBattleIdToInstanceMap; /*! flat map for easier lookup of instances by guid */ - InstanceIdToZonePtrMap m_guIdToZonePtrMap; + InstanceIdToTerritoryPtrMap m_guIdToTerritoryPtrMap; /*! map holding positions for zonelines */ PositionMap m_territoryPositionMap; @@ -199,16 +199,16 @@ namespace Sapphire::World::Manager PlayerIdToInstanceIdMap m_playerIdToInstanceMap; /*! map for storing landident to zones, used for internal housing zones */ - LandIdentToZonePtrMap m_landIdentToZonePtrMap; + LandIdentToTerritoryPtrMap m_landIdentToTerritoryPtrMap; /*! internal counter for instanceIds */ uint32_t m_lastInstanceId; - /*! set of ZonePtrs for quick iteration*/ - std::set< ZonePtr > m_zoneSet; + /*! set of TerritoryPtrs for quick iteration*/ + std::set< TerritoryPtr > m_zoneSet; - /*! set of ZonePtrs for quick iteration*/ - std::set< ZonePtr > m_instanceZoneSet; + /*! set of TerritoryPtrs for quick iteration*/ + std::set< TerritoryPtr > m_instanceZoneSet; /*! current festival(s) to set for public zones from festival.exd */ std::pair< uint16_t, uint16_t > m_currentFestival; diff --git a/src/world/Navi/NaviProvider.cpp b/src/world/Navi/NaviProvider.cpp index 89534d0c..433a2408 100644 --- a/src/world/Navi/NaviProvider.cpp +++ b/src/world/Navi/NaviProvider.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/src/world/Network/GameConnection.cpp b/src/world/Network/GameConnection.cpp index e9c9f5f2..12489297 100644 --- a/src/world/Network/GameConnection.cpp +++ b/src/world/Network/GameConnection.cpp @@ -8,7 +8,7 @@ #include #include -#include "Territory/Zone.h" +#include "Territory/Territory.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"; // dont display packet notification if it is a ping or pos update, don't want the spam 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() ); } 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 ] ), 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 ); *( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId; sendSinglePacket( pe1 ); - Logger::info( "[{0}] Setting session for zone connection", id ); + Logger::info( "[{0}] Setting session for world connection", id ); session->setZoneConnection( pCon ); } // chat connection, assinging it to the session diff --git a/src/world/Network/Handlers/ClientTriggerHandler.cpp b/src/world/Network/Handlers/ClientTriggerHandler.cpp index c309cc41..81515fd9 100644 --- a/src/world/Network/Handlers/ClientTriggerHandler.cpp +++ b/src/world/Network/Handlers/ClientTriggerHandler.cpp @@ -8,7 +8,7 @@ #include #include -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/ZonePosition.h" #include "Manager/HousingMgr.h" diff --git a/src/world/Network/Handlers/GMCommandHandlers.cpp b/src/world/Network/Handlers/GMCommandHandlers.cpp index 658b3b73..5e30611c 100644 --- a/src/world/Network/Handlers/GMCommandHandlers.cpp +++ b/src/world/Network/Handlers/GMCommandHandlers.cpp @@ -14,7 +14,7 @@ #include "Session.h" #include "Manager/TerritoryMgr.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/InstanceContent.h" #include "Network/PacketWrappers/PlayerSetupPacket.h" @@ -191,7 +191,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw, case GmCommand::Weather: { 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() ); break; } @@ -208,7 +208,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw, { player.sendNotice( "Name: {0}" "\nGil: {1}" - "\nZone: {2}" + "\nTerritory: {2}" "({3})" "\nClass: {4}" "\nLevel: {5}" @@ -659,7 +659,7 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw, } 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() ) { auto pInstanceContent = targetPlayer->getCurrentInstance()->getAsInstanceContent(); diff --git a/src/world/Network/Handlers/InventoryHandler.cpp b/src/world/Network/Handlers/InventoryHandler.cpp index cf429b02..8fc94bdd 100644 --- a/src/world/Network/Handlers/InventoryHandler.cpp +++ b/src/world/Network/Handlers/InventoryHandler.cpp @@ -8,7 +8,7 @@ #include "Network/GameConnection.h" #include "Network/PacketWrappers/ServerNoticePacket.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/ZonePosition.h" #include "Manager/DebugCommandMgr.h" diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 709b65d1..c3b9a178 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -15,7 +15,7 @@ #include "Network/GameConnection.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/HousingZone.h" #include "Territory/Land.h" #include "Territory/ZonePosition.h" diff --git a/src/world/Script/ScriptMgr.cpp b/src/world/Script/ScriptMgr.cpp index 4b7bd27c..47f3704b 100644 --- a/src/world/Script/ScriptMgr.cpp +++ b/src/world/Script/ScriptMgr.cpp @@ -3,7 +3,7 @@ #include -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Territory/InstanceContent.h" #include "Territory/QuestBattle.h" #include "Actor/Player.h" @@ -412,7 +412,7 @@ bool Sapphire::Scripting::ScriptMgr::onStatusTimeOut( Entity::CharaPtr pChara, u 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() ); if( script ) diff --git a/src/world/Script/ScriptMgr.h b/src/world/Script/ScriptMgr.h index 94bc8067..c68a0482 100644 --- a/src/world/Script/ScriptMgr.h +++ b/src/world/Script/ScriptMgr.h @@ -84,7 +84,7 @@ namespace Sapphire::Scripting 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, uint16_t param2, uint16_t param3 ); diff --git a/src/world/Territory/Cell.cpp b/src/world/Territory/Cell.cpp index d4ea8bf0..ff495c90 100644 --- a/src/world/Territory/Cell.cpp +++ b/src/world/Territory/Cell.cpp @@ -2,7 +2,7 @@ #include "Actor/Chara.h" #include "Forwards.h" -#include "Zone.h" +#include "Territory.h" #include // 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(); } -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_posX = x; diff --git a/src/world/Territory/Cell.h b/src/world/Territory/Cell.h index c1cf413d..23351b34 100644 --- a/src/world/Territory/Cell.h +++ b/src/world/Territory/Cell.h @@ -13,7 +13,7 @@ typedef std::set< Entity::ActorPtr > ActorSet; class Cell { - friend class Zone; + friend class Territory; private: bool m_bForcedActive; @@ -25,14 +25,14 @@ private: bool m_bUnloadPending; uint16_t m_playerCount; - ZonePtr m_pZone; + TerritoryPtr m_pZone; public: 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 ); diff --git a/src/world/Territory/Housing/HousingInteriorTerritory.cpp b/src/world/Territory/Housing/HousingInteriorTerritory.cpp index 7ffa045c..0b8985d4 100644 --- a/src/world/Territory/Housing/HousingInteriorTerritory.cpp +++ b/src/world/Territory/Housing/HousingInteriorTerritory.cpp @@ -36,7 +36,7 @@ Sapphire::World::Territory::Housing::HousingInteriorTerritory::HousingInteriorTe const std::string& internalName, const std::string& contentName, FrameworkPtr pFw ) : - Zone( territoryTypeId, guId, internalName, contentName, pFw ), + Territory( territoryTypeId, guId, internalName, contentName, pFw ), m_landIdent( ident ) { } @@ -54,7 +54,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone { 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() ); auto indoorInitPacket = makeZonePacket< Server::FFXIVIpcHousingIndoorInitialize >( player.getId() ); diff --git a/src/world/Territory/Housing/HousingInteriorTerritory.h b/src/world/Territory/Housing/HousingInteriorTerritory.h index 3993ba39..efc4860b 100644 --- a/src/world/Territory/Housing/HousingInteriorTerritory.h +++ b/src/world/Territory/Housing/HousingInteriorTerritory.h @@ -1,11 +1,11 @@ #include "ForwardsZone.h" -#include "Territory/Zone.h" +#include "Territory/Territory.h" #include "Common.h" #include namespace Sapphire::World::Territory::Housing { - class HousingInteriorTerritory : public Zone + class HousingInteriorTerritory : public Territory { public: HousingInteriorTerritory( Common::LandIdent ident, uint16_t territoryTypeId, diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index e138b38e..c252b909 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -33,7 +33,7 @@ Sapphire::HousingZone::HousingZone( uint8_t wardNum, const std::string& internalName, const std::string& contentName, FrameworkPtr pFw ) : - Zone( territoryTypeId, guId, internalName, contentName, pFw ), + Territory( territoryTypeId, guId, internalName, contentName, pFw ), m_wardNum( wardNum ), m_territoryTypeId( territoryTypeId ), m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum ), @@ -155,7 +155,7 @@ bool Sapphire::HousingZone::init() 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() ); auto isInSubdivision = isPlayerSubInstance( player ) ? true : false; diff --git a/src/world/Territory/HousingZone.h b/src/world/Territory/HousingZone.h index 001f5a58..804624ed 100644 --- a/src/world/Territory/HousingZone.h +++ b/src/world/Territory/HousingZone.h @@ -1,7 +1,7 @@ #ifndef SAPPHIRE_HOUSINGZONE_H #define SAPPHIRE_HOUSINGZONE_H -#include "Zone.h" +#include "Territory.h" #include "Forwards.h" #include @@ -24,7 +24,7 @@ namespace Sapphire RELOCATE = 4, }; - class HousingZone : public Zone + class HousingZone : public Territory { public: HousingZone( uint8_t landSetId, diff --git a/src/world/Territory/InstanceContent.cpp b/src/world/Territory/InstanceContent.cpp index 79d6be6c..267da084 100644 --- a/src/world/Territory/InstanceContent.cpp +++ b/src/world/Territory/InstanceContent.cpp @@ -34,7 +34,7 @@ Sapphire::InstanceContent::InstanceContent( std::shared_ptr< Sapphire::Data::Ins const std::string& contentName, uint32_t instanceContentId, 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 ), m_instanceConfiguration( pInstanceConfiguration ), m_instanceContentId( instanceContentId ), @@ -48,7 +48,7 @@ Sapphire::InstanceContent::InstanceContent( std::shared_ptr< Sapphire::Data::Ins bool Sapphire::InstanceContent::init() { - if( !Zone::init() ) + if( !Territory::init() ) return false; auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); @@ -75,7 +75,7 @@ Sapphire::Data::ExdDataGenerated::InstanceContentPtr Sapphire::InstanceContent:: 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() ); // mark player as "bound by duty" @@ -90,7 +90,7 @@ void Sapphire::InstanceContent::onPlayerZoneIn( 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() ); clearDirector( player ); @@ -318,7 +318,7 @@ void Sapphire::InstanceContent::onRegisterEObj( Entity::EventObjectPtr object ) // todo: data should be renamed to eventId m_eventIdToObjectMap[ objData->data ] = object; else - Logger::error( "InstanceContent::onRegisterEObj Zone " + + Logger::error( "InstanceContent::onRegisterEObj Territory " + m_internalName + ": No EObj data found for EObj with ID: " + std::to_string( object->getObjectId() ) ); } diff --git a/src/world/Territory/InstanceContent.h b/src/world/Territory/InstanceContent.h index 2acae2b2..a34ac2fb 100644 --- a/src/world/Territory/InstanceContent.h +++ b/src/world/Territory/InstanceContent.h @@ -1,7 +1,7 @@ #ifndef SAPPHIRE_INSTANCECONTENT_H #define SAPPHIRE_INSTANCECONTENT_H -#include "Zone.h" +#include "Territory.h" #include "Event/Director.h" #include "Forwards.h" @@ -12,7 +12,7 @@ namespace Sapphire::Data namespace Sapphire { - class InstanceContent : public Event::Director, public Zone + class InstanceContent : public Event::Director, public Territory { public: enum InstanceContentState diff --git a/src/world/Territory/QuestBattle.cpp b/src/world/Territory/QuestBattle.cpp index 0227bbcd..63e60b9b 100644 --- a/src/world/Territory/QuestBattle.cpp +++ b/src/world/Territory/QuestBattle.cpp @@ -36,7 +36,7 @@ Sapphire::QuestBattle::QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle const std::string& contentName, uint32_t questBattleId, 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 ), m_pBattleDetails( pBattleDetails ), m_questBattleId( questBattleId ), @@ -48,7 +48,7 @@ Sapphire::QuestBattle::QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle bool Sapphire::QuestBattle::init() { - if( !Zone::init() ) + if( !Territory::init() ) return false; 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 ) { - Logger::debug( "QuestBattle::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", + Logger::debug( "QuestBattle::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() ); m_pPlayer = player.getAsPlayer(); @@ -83,7 +83,7 @@ void Sapphire::QuestBattle::onPlayerZoneIn( 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() ); clearDirector( player ); @@ -291,7 +291,7 @@ void Sapphire::QuestBattle::onRegisterEObj( Entity::EventObjectPtr object ) // todo: data should be renamed to eventId m_eventIdToObjectMap[ objData->data ] = object; else - Logger::error( "InstanceContent::onRegisterEObj Zone " + + Logger::error( "InstanceContent::onRegisterEObj Territory " + m_internalName + ": No EObj data found for EObj with ID: " + std::to_string( object->getObjectId() ) ); } diff --git a/src/world/Territory/QuestBattle.h b/src/world/Territory/QuestBattle.h index f4a40b61..4553fe06 100644 --- a/src/world/Territory/QuestBattle.h +++ b/src/world/Territory/QuestBattle.h @@ -1,7 +1,7 @@ #ifndef SAPPHIRE_QUESTBATTLE_H #define SAPPHIRE_QUESTBATTLE_H -#include "Zone.h" +#include "Territory.h" #include "Event/Director.h" #include "Forwards.h" @@ -12,7 +12,7 @@ namespace Sapphire::Data namespace Sapphire { - class QuestBattle : public Event::Director, public Zone + class QuestBattle : public Event::Director, public Territory { public: QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle > pBattleDetails, diff --git a/src/world/Territory/Zone.cpp b/src/world/Territory/Territory.cpp similarity index 86% rename from src/world/Territory/Zone.cpp rename to src/world/Territory/Territory.cpp index e0a159c4..ea1ce4d7 100644 --- a/src/world/Territory/Zone.cpp +++ b/src/world/Territory/Territory.cpp @@ -15,7 +15,7 @@ #include #include -#include "Zone.h" +#include "Territory.h" #include "InstanceContent.h" #include "QuestBattle.h" #include "Manager/TerritoryMgr.h" @@ -39,7 +39,7 @@ #include "ForwardsZone.h" #include "ServerMgr.h" #include "CellHandler.h" -#include "Zone.h" +#include "Territory.h" #include "Framework.h" #include "Manager/RNGMgr.h" @@ -54,7 +54,7 @@ using namespace Sapphire::World::Manager; /** * \brief */ -Sapphire::Zone::Zone() : +Sapphire::Territory::Territory() : m_territoryTypeId( 0 ), m_guId( 0 ), m_currentWeather( Weather::FairSkies ), @@ -65,9 +65,9 @@ Sapphire::Zone::Zone() : { } -Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId, - const std::string& internalName, const std::string& placeName, - FrameworkPtr pFw ) : +Sapphire::Territory::Territory( uint16_t territoryTypeId, uint32_t guId, + const std::string& internalName, const std::string& placeName, + FrameworkPtr pFw ) : m_currentWeather( Weather::FairSkies ), m_nextEObjId( 0x400D0000 ), m_nextActorId( 0x500D0000 ), @@ -93,7 +93,7 @@ Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId, m_currentWeather = getNextWeather(); } -void Sapphire::Zone::loadWeatherRates() +void Sapphire::Territory::loadWeatherRates() { if( !m_territoryTypeInfo ) 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 >(); @@ -144,22 +142,22 @@ bool Sapphire::Zone::init() return true; } -void Sapphire::Zone::setWeatherOverride( Weather weather ) +void Sapphire::Territory::setWeatherOverride( Weather weather ) { m_weatherOverride = weather; } -Weather Sapphire::Zone::getCurrentWeather() const +Weather Sapphire::Territory::getCurrentWeather() const { return m_currentWeather; } -const Sapphire::FestivalPair& Sapphire::Zone::getCurrentFestival() const +const Sapphire::FestivalPair& Sapphire::Territory::getCurrentFestival() const { 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 }; @@ -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(); // Get Eorzea hour for weather start @@ -206,7 +204,7 @@ Weather Sapphire::Zone::getNextWeather() return Weather::FairSkies; } -void Sapphire::Zone::pushActor( Entity::ActorPtr pActor ) +void Sapphire::Territory::pushActor( Entity::ActorPtr pActor ) { float mx = pActor->getPos().x; 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 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 ) { 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, 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; } -uint32_t Sapphire::Zone::getGuId() const +uint32_t Sapphire::Territory::getGuId() const { return m_guId; } -const std::string& Sapphire::Zone::getName() const +const std::string& Sapphire::Territory::getName() const { return m_placeName; } -const std::string& Sapphire::Zone::getInternalName() const +const std::string& Sapphire::Territory::getInternalName() const { return m_internalName; } -const std::string& Sapphire::Zone::getBgPath() const +const std::string& Sapphire::Territory::getBgPath() const { return m_bgPath; } -std::size_t Sapphire::Zone::getPopCount() const +std::size_t Sapphire::Territory::getPopCount() const { return m_playerMap.size(); } -bool Sapphire::Zone::checkWeather() +bool Sapphire::Territory::checkWeather() { if( m_weatherOverride != Weather::None ) { @@ -413,7 +411,7 @@ bool Sapphire::Zone::checkWeather() return false; } -void Sapphire::Zone::updateBNpcs( uint64_t tickCount ) +void Sapphire::Territory::updateBNpcs( uint64_t tickCount ) { if( ( tickCount - m_lastMobUpdate ) <= 250 ) 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; } -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 bool changedWeather = checkWeather(); @@ -496,7 +494,7 @@ bool Sapphire::Zone::update( uint64_t tickCount ) 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 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 endY = ( ( y + 1 ) <= _sizeY ) ? y + 1 : ( _sizeY - 1 ); @@ -559,7 +557,7 @@ bool Sapphire::Zone::isCellActive( uint32_t x, uint32_t y ) 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 ); @@ -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() ) @@ -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 ) 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 ); } -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 ) return; @@ -772,7 +770,7 @@ void Sapphire::Zone::registerEObj( Entity::EventObjectPtr object ) //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 ); if( obj == m_eventObjects.end() ) @@ -781,28 +779,28 @@ Sapphire::Entity::EventObjectPtr Sapphire::Zone::getEObj( uint32_t objId ) 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; } -uint32_t Sapphire::Zone::getNextActorId() +uint32_t Sapphire::Territory::getNextActorId() { 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, float rotation ) { @@ -813,12 +811,12 @@ Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string return eObj; } -Sapphire::Data::TerritoryTypePtr Sapphire::Zone::getTerritoryTypeInfo() const +Sapphire::Data::TerritoryTypePtr Sapphire::Territory::getTerritoryTypeInfo() const { return m_territoryTypeInfo; } -bool Sapphire::Zone::loadSpawnGroups() +bool Sapphire::Territory::loadSpawnGroups() { auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >(); auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_SPAWNGROUPS ); @@ -863,7 +861,7 @@ bool Sapphire::Zone::loadSpawnGroups() return false; } -void Sapphire::Zone::updateSpawnPoints() +void Sapphire::Territory::updateSpawnPoints() { auto pRNGMgr = m_pFw->get< World::Manager::RNGMgr >(); 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++; } 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, uint8_t bnpcType ) { @@ -1006,7 +1004,7 @@ Sapphire::Entity::BNpcPtr 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 ) { @@ -1016,7 +1014,7 @@ Sapphire::Entity::BNpcPtr Sapphire::Zone::getActiveBNpcByLevelId( uint32_t level 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; } diff --git a/src/world/Territory/Zone.h b/src/world/Territory/Territory.h similarity index 93% rename from src/world/Territory/Zone.h rename to src/world/Territory/Territory.h index 217f0230..a73e5e53 100644 --- a/src/world/Territory/Zone.h +++ b/src/world/Territory/Territory.h @@ -29,7 +29,7 @@ namespace Sapphire 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: uint32_t m_territoryTypeId; @@ -66,12 +66,12 @@ namespace Sapphire std::shared_ptr< World::Navi::NaviProvider > m_pNaviProvider; public: - Zone(); + Territory(); - Zone( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, - const std::string& placeName, FrameworkPtr pFw ); + Territory( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, + const std::string& placeName, FrameworkPtr pFw ); - virtual ~Zone(); + virtual ~Territory(); /*! overrides the zone's weather, set to 0 to unlock */ void setWeatherOverride( Common::Weather weather );