From 1af0b33807aef7cac65eae85effb615446546336 Mon Sep 17 00:00:00 2001 From: Mordred Date: Thu, 26 Jan 2023 22:04:23 +0100 Subject: [PATCH] WiP fixed code redundancy --- src/scripts/common/eobj/HousingEstateEntrance.cpp | 6 ++++-- src/world/Script/NativeScriptApi.h | 5 +++++ src/world/Territory/HousingZone.cpp | 5 ++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/scripts/common/eobj/HousingEstateEntrance.cpp b/src/scripts/common/eobj/HousingEstateEntrance.cpp index d058e124..09e84a7e 100644 --- a/src/scripts/common/eobj/HousingEstateEntrance.cpp +++ b/src/scripts/common/eobj/HousingEstateEntrance.cpp @@ -6,6 +6,7 @@ #include "Territory/HousingZone.h" #include "Manager/TerritoryMgr.h" #include "Manager/PlayerMgr.h" +#include #include "Territory/Land.h" @@ -37,7 +38,7 @@ public: return; Common::LandIdent ident; - ident.landId = eobj.getHousingLink() >> 8; + ident.landId = eobj.getHousingLink(); ident.territoryTypeId = zone->getTerritoryTypeId(); ident.wardNum = zone->getWardNum(); ident.worldId = 67; @@ -82,7 +83,8 @@ public: return; } - //player.setInstance( internalZone->getGuId(), pos ); + warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, internalZone->getGuId(), pos, 0.f ); + } ); } }; diff --git a/src/world/Script/NativeScriptApi.h b/src/world/Script/NativeScriptApi.h index d08e8e4d..24cf3d2f 100644 --- a/src/world/Script/NativeScriptApi.h +++ b/src/world/Script/NativeScriptApi.h @@ -301,6 +301,11 @@ namespace Sapphire::ScriptAPI { return Common::Service< World::Manager::PlayerMgr >::ref(); } + + World::Manager::WarpMgr& warpMgr() + { + return Common::Service< World::Manager::WarpMgr >::ref(); + } }; /*! diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index d573fa3d..3f60b6ff 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -298,9 +298,8 @@ Sapphire::Entity::EventObjectPtr Sapphire::HousingZone::registerEstateEntranceEO auto land = getLand( landId ); assert( land ); - auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 0, 4, FFXIVARR_POSITION3{ 0, 10, 0 }, 0.f, "entrance", 0 ); - eObj->setHousingLink( static_cast< uint32_t >( landId ) << 8 ); - eObj->setGimmickId( static_cast< uint32_t >( landId ) << 8 ); + auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 0, 0, FFXIVARR_POSITION3{ 0, 10, 0 }, 0.f, "entrance", 0 ); + eObj->setHousingLink( static_cast< uint32_t >( landId ) ); eObj->setScale( 1.f ); addEObj( eObj );