From d34d93a7ddc94a25bcc5fd2bc24304c7ccf24292 Mon Sep 17 00:00:00 2001 From: Mordred Date: Sat, 18 Feb 2023 17:59:24 +0100 Subject: [PATCH] Fixed an issue with scripts no longer having a function to warp to a different territory type. --- .../common/eobj/HousingEstateEntrance.cpp | 2 +- .../common/housing/CmnDefHousingSignboard.cpp | 2 +- .../common/warptaxi/WarpInnGridania.cpp | 2 +- src/scripts/common/warptaxi/WarpTaxi.cpp | 2 +- src/scripts/quest/ManFst002.cpp | 2 +- src/scripts/quest/ManFst003.cpp | 2 +- src/scripts/quest/ManFst004.cpp | 2 +- src/scripts/quest/ManFst200.cpp | 4 ++-- src/scripts/quest/ManFst209.cpp | 4 ++-- src/scripts/quest/ManFst404.cpp | 2 +- src/scripts/quest/ManFst407.cpp | 2 +- src/scripts/quest/ManFst408.cpp | 2 +- src/scripts/quest/ManSea001.cpp | 4 ++-- src/scripts/quest/ManWil002.cpp | 2 +- src/scripts/quest/ManWil003.cpp | 2 +- src/scripts/quest/ManWil004.cpp | 2 +- .../quest/subquest/goldsaucer/SubGsc001.cpp | 2 +- .../quest/subquest/gridania/GaiUsc608.cpp | 2 +- .../quest/subquest/gridania/GaiUsc609.cpp | 2 +- .../quest/subquest/lanoscea_west/GaiUsc203.cpp | 2 +- src/scripts/quest/subquest/limsa/SubSea001.cpp | 2 +- .../quest/subquest/mordhona/GaiUsc604.cpp | 2 +- .../quest/subquest/mordhona/GaiUsc605.cpp | 2 +- .../quest/subquest/thanalan_west/GaiUsc607.cpp | 2 +- src/world/Action/EffectBuilder.cpp | 2 +- src/world/Manager/DebugCommandMgr.cpp | 18 +++++++++--------- src/world/Manager/TerritoryMgr.cpp | 6 +++--- src/world/Manager/TerritoryMgr.h | 2 +- src/world/Manager/WarpMgr.cpp | 16 +++++++++++++++- src/world/Manager/WarpMgr.h | 12 ++++++++++-- .../Network/Handlers/GMCommandHandlers.cpp | 4 ++-- src/world/Network/Handlers/PacketHandlers.cpp | 2 +- src/world/Task/MoveTerritoryTask.cpp | 2 +- 33 files changed, 70 insertions(+), 48 deletions(-) diff --git a/src/scripts/common/eobj/HousingEstateEntrance.cpp b/src/scripts/common/eobj/HousingEstateEntrance.cpp index 0267323e..aab038c7 100644 --- a/src/scripts/common/eobj/HousingEstateEntrance.cpp +++ b/src/scripts/common/eobj/HousingEstateEntrance.cpp @@ -31,7 +31,7 @@ public: auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - auto pHZone = terriMgr.getZoneByTerritoryTypeId( player.getTerritoryTypeId() ); + auto pHZone = terriMgr.getTerritoryByTypeId( player.getTerritoryTypeId() ); auto zone = std::dynamic_pointer_cast< HousingZone >( pHZone ); if( !zone ) return; diff --git a/src/scripts/common/housing/CmnDefHousingSignboard.cpp b/src/scripts/common/housing/CmnDefHousingSignboard.cpp index 3ccc9a1a..459dc2ec 100644 --- a/src/scripts/common/housing/CmnDefHousingSignboard.cpp +++ b/src/scripts/common/housing/CmnDefHousingSignboard.cpp @@ -35,7 +35,7 @@ public: auto territoryId = player.getTerritoryId(); auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - auto pTerritory = terriMgr.getZoneByTerritoryTypeId( player.getTerritoryTypeId() ); + auto pTerritory = terriMgr.getTerritoryByTypeId( player.getTerritoryTypeId() ); auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory ); auto& pHouMgr = Common::Service< HousingMgr >::ref(); diff --git a/src/scripts/common/warptaxi/WarpInnGridania.cpp b/src/scripts/common/warptaxi/WarpInnGridania.cpp index a5f634ff..288e6e2a 100644 --- a/src/scripts/common/warptaxi/WarpInnGridania.cpp +++ b/src/scripts/common/warptaxi/WarpInnGridania.cpp @@ -41,7 +41,7 @@ public: auto popRangeInfo = instanceObjectCache().getPopRangeInfo( warp->data().PopRange ); if( popRangeInfo ) { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Sapphire::Common::WARP_TYPE_TOWN_TRANSLATE, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } diff --git a/src/scripts/common/warptaxi/WarpTaxi.cpp b/src/scripts/common/warptaxi/WarpTaxi.cpp index abe69479..e268e389 100644 --- a/src/scripts/common/warptaxi/WarpTaxi.cpp +++ b/src/scripts/common/warptaxi/WarpTaxi.cpp @@ -40,7 +40,7 @@ public: auto popRangeInfo = instanceObjectCache().getPopRangeInfo( warp->data().PopRange ); if( popRangeInfo ) { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Sapphire::Common::WARP_TYPE_TOWN_TRANSLATE, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } diff --git a/src/scripts/quest/ManFst002.cpp b/src/scripts/quest/ManFst002.cpp index 2ddd435e..fdc036c6 100644 --- a/src/scripts/quest/ManFst002.cpp +++ b/src/scripts/quest/ManFst002.cpp @@ -159,7 +159,7 @@ private: quest.setUI8CH( 1 ); // receive key item // teleport to real gridania - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, TERRITORYTYPE0 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, TERRITORYTYPE0 ); } void Scene00051( World::Quest& quest, Entity::Player& player ) diff --git a/src/scripts/quest/ManFst003.cpp b/src/scripts/quest/ManFst003.cpp index 5963da42..68a1738d 100644 --- a/src/scripts/quest/ManFst003.cpp +++ b/src/scripts/quest/ManFst003.cpp @@ -229,7 +229,7 @@ private: { quest.setSeq( Seq1 ); quest.setUI8CH( 1 ); - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, 132 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, 132 ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/ManFst004.cpp b/src/scripts/quest/ManFst004.cpp index c245e6fa..d8278e08 100644 --- a/src/scripts/quest/ManFst004.cpp +++ b/src/scripts/quest/ManFst004.cpp @@ -230,7 +230,7 @@ private: quest.setSeq( Seq1 ); quest.setUI8CH( 1 ); // receive key item // event is done, need to teleport to real zone. - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0 ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/ManFst200.cpp b/src/scripts/quest/ManFst200.cpp index 50dd3f25..97874d45 100644 --- a/src/scripts/quest/ManFst200.cpp +++ b/src/scripts/quest/ManFst200.cpp @@ -355,7 +355,7 @@ private: void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - auto dest = teriMgr().getZoneByTerritoryTypeId( Territorytype2 ); + auto dest = teriMgr().getTerritoryByTypeId( Territorytype2 ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, dest->getGuId(), { -11.86f, 92.f, 17.f }, -1.95f ); quest.setSeq( Seq4 ); eventMgr().sendEventNotice( player, getId(), 2, 0 ); @@ -629,7 +629,7 @@ private: void Scene00030Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { - auto dest = teriMgr().getZoneByTerritoryTypeId( Territorytype3 ); + auto dest = teriMgr().getTerritoryByTypeId( Territorytype3 ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, dest->getGuId(), { -44.14f, 84.f, -0.47f }, 1.3f ); quest.setSeq( Seq8 ); eventMgr().sendEventNotice( player, getId(), 2, 0 ); diff --git a/src/scripts/quest/ManFst209.cpp b/src/scripts/quest/ManFst209.cpp index a4048b94..377ce292 100644 --- a/src/scripts/quest/ManFst209.cpp +++ b/src/scripts/quest/ManFst209.cpp @@ -587,7 +587,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - auto dest = teriMgr().getZoneByTerritoryTypeId( Territorytype1 ); + auto dest = teriMgr().getTerritoryByTypeId( Territorytype1 ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, dest->getGuId(), { -53.4502f, -24.0946f, -567.494f }, -0.550531f );//Manual Pos } } @@ -735,7 +735,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - auto dest = teriMgr().getZoneByTerritoryTypeId( Territorytype1 ); + auto dest = teriMgr().getTerritoryByTypeId( Territorytype1 ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, dest->getGuId(), { -53.4502f, -24.0946f, -567.494f }, -0.550531f );//Manual Pos } } diff --git a/src/scripts/quest/ManFst404.cpp b/src/scripts/quest/ManFst404.cpp index 98d1a721..a8a338d1 100644 --- a/src/scripts/quest/ManFst404.cpp +++ b/src/scripts/quest/ManFst404.cpp @@ -133,7 +133,7 @@ private: if( popRangeInfo ) { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/ManFst407.cpp b/src/scripts/quest/ManFst407.cpp index 3ee6af0d..0eb4c376 100644 --- a/src/scripts/quest/ManFst407.cpp +++ b/src/scripts/quest/ManFst407.cpp @@ -304,7 +304,7 @@ private: } else { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/ManFst408.cpp b/src/scripts/quest/ManFst408.cpp index 96e8e1f8..3d835652 100644 --- a/src/scripts/quest/ManFst408.cpp +++ b/src/scripts/quest/ManFst408.cpp @@ -100,7 +100,7 @@ private: } else { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/ManSea001.cpp b/src/scripts/quest/ManSea001.cpp index 6586fa84..40215c11 100644 --- a/src/scripts/quest/ManSea001.cpp +++ b/src/scripts/quest/ManSea001.cpp @@ -198,7 +198,7 @@ private: quest.setBitFlag8( 1, true ); checkProgressSeq1( quest, player ); eventMgr().eventFinish( player, result.eventId, 1 ); - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, teriMgr().getZoneByTerritoryTypeId( 181 )->getGuId(), { 9.0f, 40.0f, 14.0f }, 0.0f ); + warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, teriMgr().getTerritoryByTypeId( 181 )->getGuId(), { 9.0f, 40.0f, 14.0f }, 0.0f ); } }; eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, callback ); @@ -246,7 +246,7 @@ private: if( result.errorCode == 0 || ( result.numOfResults > 0 && result.getResult( 0 ) == 1 ) ) { eventMgr().eventFinish( player, result.eventId, 1 ); - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, teriMgr().getZoneByTerritoryTypeId( 181 )->getGuId(), { 9.0f, 40.0f, 14.0f }, 0.0f ); + warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, teriMgr().getTerritoryByTypeId( 181 )->getGuId(), { 9.0f, 40.0f, 14.0f }, 0.0f ); } }; eventMgr().playQuestScene( player, getId(), 13, HIDE_HOTBAR, callback ); diff --git a/src/scripts/quest/ManWil002.cpp b/src/scripts/quest/ManWil002.cpp index 2ef4534a..b09c5466 100644 --- a/src/scripts/quest/ManWil002.cpp +++ b/src/scripts/quest/ManWil002.cpp @@ -229,7 +229,7 @@ private: quest.setUI8CH( 1 ); // Receive key item // Teleport to real ul'dah - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, 130 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, 130 ); } }; diff --git a/src/scripts/quest/ManWil003.cpp b/src/scripts/quest/ManWil003.cpp index 39257a65..44787a93 100644 --- a/src/scripts/quest/ManWil003.cpp +++ b/src/scripts/quest/ManWil003.cpp @@ -244,7 +244,7 @@ private: pQuest->setUI8CH( 1 ); // receive key item // teleport to real ul'dah - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, 130 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, 130 ); } ); } }; diff --git a/src/scripts/quest/ManWil004.cpp b/src/scripts/quest/ManWil004.cpp index a93af89c..dca16eb8 100644 --- a/src/scripts/quest/ManWil004.cpp +++ b/src/scripts/quest/ManWil004.cpp @@ -233,7 +233,7 @@ private: quest.setUI8CH( 1 );// receive key item // teleport to real Uldah - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0 ); } }; diff --git a/src/scripts/quest/subquest/goldsaucer/SubGsc001.cpp b/src/scripts/quest/subquest/goldsaucer/SubGsc001.cpp index 47a31eb4..7644b82d 100644 --- a/src/scripts/quest/subquest/goldsaucer/SubGsc001.cpp +++ b/src/scripts/quest/subquest/goldsaucer/SubGsc001.cpp @@ -194,7 +194,7 @@ private: { player.finishQuest( getId(), result.getResult( 1 ) ); eventMgr().eventFinish( player, result.eventId, 1 ); - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, teriMgr().getZoneByTerritoryTypeId( 144 )->getGuId(), { -34.5, 0.64, 100 }, -1.58 ); + warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, teriMgr().getTerritoryByTypeId( 144 )->getGuId(), { -34.5, 0.64, 100 }, -1.58 ); } }; eventMgr().playQuestScene( player, getId(), 5, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, callback ); diff --git a/src/scripts/quest/subquest/gridania/GaiUsc608.cpp b/src/scripts/quest/subquest/gridania/GaiUsc608.cpp index 03e2fc93..a3489136 100644 --- a/src/scripts/quest/subquest/gridania/GaiUsc608.cpp +++ b/src/scripts/quest/subquest/gridania/GaiUsc608.cpp @@ -141,7 +141,7 @@ private: } else { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/subquest/gridania/GaiUsc609.cpp b/src/scripts/quest/subquest/gridania/GaiUsc609.cpp index e913b089..7b1b1047 100644 --- a/src/scripts/quest/subquest/gridania/GaiUsc609.cpp +++ b/src/scripts/quest/subquest/gridania/GaiUsc609.cpp @@ -205,7 +205,7 @@ private: } else { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/subquest/lanoscea_west/GaiUsc203.cpp b/src/scripts/quest/subquest/lanoscea_west/GaiUsc203.cpp index 43e43340..8bf61d32 100644 --- a/src/scripts/quest/subquest/lanoscea_west/GaiUsc203.cpp +++ b/src/scripts/quest/subquest/lanoscea_west/GaiUsc203.cpp @@ -102,7 +102,7 @@ private: if( popRangeInfo ) { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/subquest/limsa/SubSea001.cpp b/src/scripts/quest/subquest/limsa/SubSea001.cpp index 1077b2be..e17dc0a9 100644 --- a/src/scripts/quest/subquest/limsa/SubSea001.cpp +++ b/src/scripts/quest/subquest/limsa/SubSea001.cpp @@ -218,7 +218,7 @@ private: { quest.setSeq( Seq2 ); player.changePosition( 10, 21, 13, -2 ); - warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0 ); } } else diff --git a/src/scripts/quest/subquest/mordhona/GaiUsc604.cpp b/src/scripts/quest/subquest/mordhona/GaiUsc604.cpp index 9fd6241d..d14efe29 100644 --- a/src/scripts/quest/subquest/mordhona/GaiUsc604.cpp +++ b/src/scripts/quest/subquest/mordhona/GaiUsc604.cpp @@ -442,7 +442,7 @@ private: if( popRangeInfo ) { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/subquest/mordhona/GaiUsc605.cpp b/src/scripts/quest/subquest/mordhona/GaiUsc605.cpp index 8bd58dbf..63253786 100644 --- a/src/scripts/quest/subquest/mordhona/GaiUsc605.cpp +++ b/src/scripts/quest/subquest/mordhona/GaiUsc605.cpp @@ -258,7 +258,7 @@ private: } else { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp b/src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp index 1fd23823..2f001abd 100644 --- a/src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp +++ b/src/scripts/quest/subquest/thanalan_west/GaiUsc607.cpp @@ -88,7 +88,7 @@ private: } else { - auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId ); + auto pTeri = teriMgr().getTerritoryByTypeId( popRangeInfo->m_territoryTypeId ); warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation ); } } diff --git a/src/world/Action/EffectBuilder.cpp b/src/world/Action/EffectBuilder.cpp index c5beb7a0..fb70309d 100644 --- a/src/world/Action/EffectBuilder.cpp +++ b/src/world/Action/EffectBuilder.cpp @@ -113,7 +113,7 @@ void EffectBuilder::buildAndSendPackets( const std::vector< Entity::CharaPtr >& Logger::debug( "Targets afflicted: {}", targetList.size() ); auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - auto zone = teriMgr.getZoneByTerritoryTypeId( m_sourceChara->getTerritoryTypeId() ); + auto zone = teriMgr.getTerritoryByTypeId( m_sourceChara->getTerritoryTypeId() ); auto globalSequence = zone ? zone->getNextEffectResultId() : 0; diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 313d2c1e..b7ba56f0 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -1428,23 +1428,23 @@ void DebugCommandMgr::easyWarp( char* data, Sapphire::Entity::Player& player, st auto& warpMgr = Common::Service< WarpMgr >::ref(); if( ( subCommand == "waking_sands" ) ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 140 )->getGuId(), { -483.257f, 17.0748f, -386.731f }, 1.61298f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 140 )->getGuId(), { -483.257f, 17.0748f, -386.731f }, 1.61298f ); else if( subCommand == "rising_stones" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 156 )->getGuId(), { 22.2674f, 21.2527f, -634.261f }, -0.369245f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 156 )->getGuId(), { 22.2674f, 21.2527f, -634.261f }, -0.369245f ); else if( subCommand == "little_solace" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 152 )->getGuId(), { 24.557f, -3.78776f, 212.615f }, 2.59117f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 152 )->getGuId(), { 24.557f, -3.78776f, 212.615f }, 2.59117f ); else if( subCommand == "adders_nest" || subCommand == "gridania_gc" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 132 )->getGuId(), { -64.7448f, -0.503434f, 2.21786f }, -2.64096f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 132 )->getGuId(), { -64.7448f, -0.503434f, 2.21786f }, -2.64096f ); else if( subCommand == "hall_of_flames" || subCommand == "uldah_gc" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 130 )->getGuId(), { -129.24f, 4.1f, -93.5221f }, -2.30172f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 130 )->getGuId(), { -129.24f, 4.1f, -93.5221f }, -2.30172f ); else if( subCommand == "maelsrom_command" || subCommand == "limsa_gc" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 128 )->getGuId(), { 76.3952f, 40.0955f, 71.6461f }, 1.62673f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 128 )->getGuId(), { 76.3952f, 40.0955f, 71.6461f }, 1.62673f ); else if( subCommand == "carline_canopy" || subCommand == "gridania_adventurer" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 132 )->getGuId(), { 43.729f, -7.96559f, 103.965f }, -1.59436f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 132 )->getGuId(), { 43.729f, -7.96559f, 103.965f }, -1.59436f ); else if( subCommand == "observatorium" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 155 )->getGuId(), { 224.965f, 221.958f, 301.33f }, -0.0316129f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 155 )->getGuId(), { 224.965f, 221.958f, 301.33f }, -0.0316129f ); else if( subCommand == "rising_stones" ) - warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getZoneByTerritoryTypeId( 156 )->getGuId(), { 22.7204f, 21.2639f, -635.704f }, -0.360031f ); + warpMgr.requestMoveTerritory( player, Common::WarpType::WARP_TYPE_GM, terriMgr.getTerritoryByTypeId( 156 )->getGuId(), { 22.7204f, 21.2639f, -635.704f }, -0.360031f ); else PlayerMgr::sendUrgent( player, "{0} is not a valid easyWarp location.", subCommand ); } diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 268021fc..29538b15 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -477,7 +477,7 @@ TerritoryPtr TerritoryMgr::getTerritoryByGuId( uint32_t guId ) const return it->second; } -TerritoryPtr TerritoryMgr::getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const +TerritoryPtr TerritoryMgr::getTerritoryByTypeId( uint32_t territoryTypeId ) const { auto zoneMap = m_territoryTypeIdToInstanceGuidMap.find( territoryTypeId ); if( zoneMap == m_territoryTypeIdToInstanceGuidMap.end() ) @@ -677,7 +677,7 @@ bool TerritoryMgr::joinWorld( Entity::Player& player ) auto prevPos = player.getPrevPos(); player.setPos( prevPos, false ); player.setRot( player.getPrevRot() ); - pCurrZone = getZoneByTerritoryTypeId( territoryTypeId ); + pCurrZone = getTerritoryByTypeId( territoryTypeId ); } } else if( isInternalEstateTerritory( territoryTypeId ) ) @@ -696,7 +696,7 @@ bool TerritoryMgr::joinWorld( Entity::Player& player ) } else { - pCurrZone = getZoneByTerritoryTypeId( territoryTypeId ); + pCurrZone = getTerritoryByTypeId( territoryTypeId ); } player.setTerritoryTypeId( territoryTypeId ); diff --git a/src/world/Manager/TerritoryMgr.h b/src/world/Manager/TerritoryMgr.h index 6d9c8c21..ff6afa2b 100644 --- a/src/world/Manager/TerritoryMgr.h +++ b/src/world/Manager/TerritoryMgr.h @@ -135,7 +135,7 @@ namespace Sapphire::World::Manager /*! returns a default Zone by territoryTypeId TODO: Mind multiple instances?! */ - TerritoryPtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const; + TerritoryPtr getTerritoryByTypeId( uint32_t territoryTypeId ) const; bool movePlayer( Sapphire::Territory& teri, Entity::Player& player ); diff --git a/src/world/Manager/WarpMgr.cpp b/src/world/Manager/WarpMgr.cpp index acb2f8ea..0c892b69 100644 --- a/src/world/Manager/WarpMgr.cpp +++ b/src/world/Manager/WarpMgr.cpp @@ -57,6 +57,20 @@ void WarpMgr::requestMoveTerritory( Entity::Player& player, Common::WarpType war requestMoveTerritory( player, warpType, targetTerritoryId, player.getPos(), player.getRot() ); } +void WarpMgr::requestMoveTerritoryType( Entity::Player& player, Common::WarpType warpType, uint32_t targetTerritoryTypeId ) +{ + auto& teriMgr = Common::Service< TerritoryMgr >::ref(); + + auto pTeri = teriMgr.getTerritoryByTypeId( targetTerritoryTypeId ); + if( !pTeri ) + { + Logger::error( "Unable to find target territory instance for type {}", targetTerritoryTypeId ); + return; + } + + requestMoveTerritory( player, warpType, pTeri->getGuId() ); +} + void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3 targetPos, float targetRot ) { m_entityIdToWarpInfoMap[ player.getId() ] = { 0, warpType, targetPos, targetRot }; @@ -176,7 +190,7 @@ void WarpMgr::requestPlayerTeleport( Entity::Player& player, uint16_t aetheryteI requestWarp( player, warpType, pos, rot ); else { - auto pTeri = teriMgr.getZoneByTerritoryTypeId( data.TerritoryType ); + auto pTeri = teriMgr.getTerritoryByTypeId( data.TerritoryType ); if( !pTeri ) return; diff --git a/src/world/Manager/WarpMgr.h b/src/world/Manager/WarpMgr.h index 07b5b1a2..0805e9c8 100644 --- a/src/world/Manager/WarpMgr.h +++ b/src/world/Manager/WarpMgr.h @@ -23,7 +23,7 @@ namespace Sapphire::World::Manager WarpMgr() = default; /// - /// request to move a player to specified territorytype and position, with given WarpType + /// request to move a player to specified territory guid and position, with given WarpType /// /// /// @@ -34,13 +34,21 @@ namespace Sapphire::World::Manager /// - /// request to move a player to specified territorytype with given WarpType, position will be the same as before + /// request to move a player to specified territory guid with given WarpType, position will be the same as before /// /// /// /// void requestMoveTerritory( Entity::Player& player, Common::WarpType warpType, uint32_t targetTerritoryId ); + /// + /// request to move a player to specified territory type with given WarpType, position will be the same as before + /// + /// + /// + /// + void requestMoveTerritoryType( Entity::Player& player, Common::WarpType warpType, uint32_t targetTerritoryTypeId ); + /// /// handle player state pre-warp and tells client to warp player /// diff --git a/src/world/Network/Handlers/GMCommandHandlers.cpp b/src/world/Network/Handlers/GMCommandHandlers.cpp index 5ab3603a..2b496db8 100644 --- a/src/world/Network/Handlers/GMCommandHandlers.cpp +++ b/src/world/Network/Handlers/GMCommandHandlers.cpp @@ -503,7 +503,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR } else { - auto pZone = teriMgr.getZoneByTerritoryTypeId( param1 ); + auto pZone = teriMgr.getTerritoryByTypeId( param1 ); if( !pZone ) { PlayerMgr::sendUrgent( player, "No zone instance found for {0}", param1 ); @@ -542,7 +542,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR else { auto& warpMgr = Common::Service< WarpMgr >::ref(); - warpMgr.requestMoveTerritory( *targetPlayer, WarpType::WARP_TYPE_GM, teriMgr.getZoneByTerritoryTypeId( param1 )->getGuId(), targetPlayer->getPos(), 0 ); + warpMgr.requestMoveTerritory( *targetPlayer, WarpType::WARP_TYPE_GM, teriMgr.getTerritoryByTypeId( param1 )->getGuId(), targetPlayer->getPos(), 0 ); } PlayerMgr::sendServerNotice( player, "{0} was warped to zone {1}", targetPlayer->getName(), param1, pZone->getName() ); diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 3803bd6b..a1993c08 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -308,7 +308,7 @@ void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR } PlayerMgr::sendDebug( player, "Walking ZoneLine#{0}", exitBoxId ); - auto pTargetTeri = teriMgr.getZoneByTerritoryTypeId( targetZone ); + auto pTargetTeri = teriMgr.getTerritoryByTypeId( targetZone ); if( !pTargetTeri ) return; diff --git a/src/world/Task/MoveTerritoryTask.cpp b/src/world/Task/MoveTerritoryTask.cpp index 7b4c899b..c2be8e7e 100644 --- a/src/world/Task/MoveTerritoryTask.cpp +++ b/src/world/Task/MoveTerritoryTask.cpp @@ -82,7 +82,7 @@ void MoveTerritoryTask::execute() // todo: this will require proper handling, for now just return the player to their previous area pPlayer->setPos( pPlayer->getPrevPos(), false ); - auto pZone1 = teriMgr.getZoneByTerritoryTypeId( pPlayer->getPrevTerritoryTypeId() ); + auto pZone1 = teriMgr.getTerritoryByTypeId( pPlayer->getPrevTerritoryTypeId() ); if( !teriMgr.movePlayer( *pZone1, *pPlayer ) ) return; }