mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-06-15 20:07:46 +00:00
Use proper exit position for house.
This commit is contained in:
parent
01b262edc1
commit
78b66b9c92
3 changed files with 43 additions and 3 deletions
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
Common::FFXIVARR_POSITION3 pos;
|
||||
|
||||
auto land = zone->getLand( eobj.getHousingLink() >> 8 );
|
||||
auto land = zone->getLand( eobj.getHousingLink() );
|
||||
if( !land )
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include <Exd/ExdData.h>
|
||||
#include <datReader/DatCategories/bg/LgbTypes.h>
|
||||
#include <datReader/DatCategories/bg/lgb.h>
|
||||
#include <Util/UtilMath.h>
|
||||
|
||||
#include "Territory/InstanceObjectCache.h"
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/Housing/HousingInteriorTerritory.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
class HousingWarpTaxiExitEstate : public Sapphire::ScriptAPI::EventScript
|
||||
|
@ -17,8 +26,35 @@ public:
|
|||
{
|
||||
if( result.getResult( 0 ) == 1 )
|
||||
{
|
||||
eventMgr().eventFinish( player, result.eventId, 1 );
|
||||
player.exitInstance();
|
||||
auto& terriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref();
|
||||
auto pHZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||
if( !pHZone )
|
||||
return;
|
||||
auto zone = std::dynamic_pointer_cast< World::Territory::Housing::HousingInteriorTerritory >( pHZone );
|
||||
if( !zone )
|
||||
return;
|
||||
|
||||
auto landIdent = zone->getLandIdent();
|
||||
|
||||
int housingIndex;
|
||||
if( landIdent.territoryTypeId == 339 )
|
||||
housingIndex = 0;
|
||||
else if( landIdent.territoryTypeId == 340 )
|
||||
housingIndex = 1;
|
||||
else if( landIdent.territoryTypeId == 341 )
|
||||
housingIndex = 2;
|
||||
|
||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||
auto info = exdData.getRow< Excel::HousingLandSet >( housingIndex );
|
||||
|
||||
auto landInfo = info->_data.Lands[ landIdent.landId ];
|
||||
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
||||
auto exitRange = instanceObjectCache.getPopRange( landInfo.ExitPopRange );
|
||||
|
||||
Common::FFXIVARR_POSITION3 pos{ exitRange->data.transform.translation.x, exitRange->data.transform.translation.y, exitRange->data.transform.translation.z };
|
||||
float rot = Common::Util::eulerToDirection( { exitRange->data.transform.rotation.x, exitRange->data.transform.rotation.y, exitRange->data.transform.rotation.z } );
|
||||
|
||||
warpMgr().requestMoveTerritory( player, Common::WarpType::WARP_TYPE_NORMAL, landIdent.territoryTypeId << 16 | landIdent.wardNum, pos, rot );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "TerritoryMgr.h"
|
||||
|
||||
#include <WorldServer.h>
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
#include "Task/MoveTerritoryTask.h"
|
||||
#include "Task/WarpTask.h"
|
||||
|
@ -30,7 +31,10 @@ void WarpMgr::requestMoveTerritory( Entity::Player& player, Common::WarpType war
|
|||
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( targetTerritoryId );
|
||||
if( !pTeri )
|
||||
{
|
||||
Logger::error( "Unable to find target territory instance {}", targetTerritoryId );
|
||||
return;
|
||||
}
|
||||
|
||||
m_entityIdToWarpInfoMap[ player.getId() ] = { targetTerritoryId, warpType, targetPos, targetRot };
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue