mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
Fallback to entranceRect if no entrance circle is found in instance
This commit is contained in:
parent
a84d0f4154
commit
a56eec5d32
6 changed files with 117 additions and 5 deletions
7
deps/datReader/DatCategories/bg/LgbTypes.h
vendored
7
deps/datReader/DatCategories/bg/LgbTypes.h
vendored
|
@ -137,7 +137,7 @@ struct EObjData : public InstanceObject
|
||||||
uint8_t unknown1[0xC];
|
uint8_t unknown1[0xC];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TriggerBoxShape : uint32_t
|
enum TriggerBoxShape : int32_t
|
||||||
{
|
{
|
||||||
TriggerBoxShapeBox = 0x1,
|
TriggerBoxShapeBox = 0x1,
|
||||||
TriggerBoxShapeSphere = 0x2,
|
TriggerBoxShapeSphere = 0x2,
|
||||||
|
@ -156,6 +156,11 @@ struct TriggerBoxInstanceObject
|
||||||
uint32_t reserved;
|
uint32_t reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct EventRangeData : public InstanceObject
|
||||||
|
{
|
||||||
|
TriggerBoxInstanceObject triggerBox;
|
||||||
|
};
|
||||||
|
|
||||||
struct ExitRangeData : public InstanceObject
|
struct ExitRangeData : public InstanceObject
|
||||||
{
|
{
|
||||||
TriggerBoxInstanceObject triggerBoxType;
|
TriggerBoxInstanceObject triggerBoxType;
|
||||||
|
|
11
deps/datReader/DatCategories/bg/lgb.h
vendored
11
deps/datReader/DatCategories/bg/lgb.h
vendored
|
@ -150,6 +150,17 @@ public:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LGB_EVENT_RANGE_ENTRY : public LgbEntry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EventRangeData data;
|
||||||
|
|
||||||
|
LGB_EVENT_RANGE_ENTRY( char* buf, size_t offset ) : LgbEntry( buf, offset )
|
||||||
|
{
|
||||||
|
data = *reinterpret_cast< EventRangeData* >( buf + offset );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
struct LGB_GROUP_HEADER
|
struct LGB_GROUP_HEADER
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
|
@ -6,10 +6,15 @@
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
#include <Service.h>
|
#include <Service.h>
|
||||||
|
#include <datReader/DatCategories/bg/pcb.h>
|
||||||
|
#include <datReader/DatCategories/bg/lgb.h>
|
||||||
|
#include <datReader/DatCategories/bg/sgb.h>
|
||||||
#include "Event/Director.h"
|
#include "Event/Director.h"
|
||||||
#include "Event/EventDefs.h"
|
#include "Event/EventDefs.h"
|
||||||
#include "Script/ScriptMgr.h"
|
#include "Script/ScriptMgr.h"
|
||||||
|
#include "Manager/PlayerMgr.h"
|
||||||
|
#include "Manager/TerritoryMgr.h"
|
||||||
|
#include "Manager/EventMgr.h"
|
||||||
|
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
#include "Actor/EventObject.h"
|
#include "Actor/EventObject.h"
|
||||||
|
@ -21,6 +26,8 @@
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
|
|
||||||
#include "InstanceContent.h"
|
#include "InstanceContent.h"
|
||||||
|
#include "InstanceObjectCache.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
@ -339,11 +346,22 @@ void Sapphire::InstanceContent::onBeforePlayerZoneIn( Sapphire::Entity::Player&
|
||||||
// if a player has already spawned once inside this instance, don't move them if they happen to zone in again
|
// if a player has already spawned once inside this instance, don't move them if they happen to zone in again
|
||||||
if( !hasPlayerPreviouslySpawned( player ) )
|
if( !hasPlayerPreviouslySpawned( player ) )
|
||||||
{
|
{
|
||||||
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
|
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
||||||
|
auto contentInfo = exdData.get< Data::InstanceContent >( m_instanceContentId );
|
||||||
|
|
||||||
|
auto rect = instanceObjectCache.getEventRange( contentInfo->lGBEventRange );
|
||||||
|
|
||||||
if( m_pEntranceEObj != nullptr )
|
if( m_pEntranceEObj != nullptr )
|
||||||
{
|
{
|
||||||
player.setRot( PI );
|
player.setRot( PI );
|
||||||
player.setPos( m_pEntranceEObj->getPos() );
|
player.setPos( m_pEntranceEObj->getPos() );
|
||||||
}
|
}
|
||||||
|
else if( rect )
|
||||||
|
{
|
||||||
|
player.setRot( PI );
|
||||||
|
player.setPos( { rect->header.transform.translation.x, rect->header.transform.translation.y, rect->header.transform.translation.z } );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.setRot( PI );
|
player.setRot( PI );
|
||||||
|
|
|
@ -23,6 +23,65 @@ namespace Sapphire
|
||||||
DutyFinished
|
DutyFinished
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*0x40000001 - INSTANCE_CONTENT_ORDER_SYSTEM_START
|
||||||
|
0x40000002 - INSTANCE_CONTENT_ORDER_SYSTEM_CLEAR_NORMAL
|
||||||
|
0x40000003 - INSTANCE_CONTENT_ORDER_SYSTEM_RESET_???? ( not really sure about that, seems like reset, arg1 must be 1 )
|
||||||
|
0x40000004 - INSTANCE_CONTENT_ORDER_PVP_READY ( unsure )
|
||||||
|
0x40000005 - INSTANCE_CONTENT_ORDER_SYSTEM_RESET
|
||||||
|
0x40000006 - INSTANCE_CONTENT_ORDER_SYSTEM_RESTART
|
||||||
|
0x40000007 - INSTANCE_CONTENT_ORDER_SYSTEM_VOTE_ENABLE
|
||||||
|
0x40000008 - INSTANCE_CONTENT_ORDER_SYSTEM_VOTE_START
|
||||||
|
0x40000009 - INSTANCE_CONTENT_ORDER_SYSTEM_VOTE_RESULT
|
||||||
|
0x4000000A - INSTANCE_CONTENT_ORDER_SYSTEM_VOTE_CANCEL
|
||||||
|
0x4000000B - INSTANCE_CONTENT_ORDER_SYSTEM_UPDATE_CLEAR_MEMBER
|
||||||
|
0x4000000C - INSTANCE_CONTENT_ORDER_SYSTEM_PLAY_SHARED_GROUP
|
||||||
|
0x4000000D - INSTANCE_CONTENT_ORDER_SYSTEM_SyncTime?
|
||||||
|
0x4000000E - INSTANCE_CONTENT_ORDER_SYSTEM_Unknown - no args - some timer set */
|
||||||
|
enum DirectorEventId : uint32_t
|
||||||
|
{
|
||||||
|
DEBUG_TimeSync = 0xC0000001,
|
||||||
|
DutyCommence = 0x40000001,
|
||||||
|
BattleGroundMusic = 0x40000002,
|
||||||
|
SetStringendoMode = 0x40000003,
|
||||||
|
DutyComplete = 0x40000004,
|
||||||
|
InvalidateTodoList = 0x40000005,
|
||||||
|
LoadingScreen = 0x40000007,
|
||||||
|
Forward = 0x40000008,
|
||||||
|
VoteState = 0x40000009,
|
||||||
|
VoteStart = 0x4000000A,
|
||||||
|
VoteResult = 0x4000000B,
|
||||||
|
VoteFinish = 0x4000000C,
|
||||||
|
TreasureVoteRefresh = 0x4000000D,
|
||||||
|
SetSharedGroupId = 0x4000000E,
|
||||||
|
FirstTimeNotify = 0x4000000F
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EventHandlerOrderId : uint32_t
|
||||||
|
{
|
||||||
|
SheetDataReady = 0x80000000,
|
||||||
|
AbortContent = 0x40000001, //forceFlag
|
||||||
|
LuaOnStartCutscene = 0x40000002, //returnCode
|
||||||
|
VoteRequest = 0x40000003, //voteType
|
||||||
|
VoteReplay = 0x40000004 //voteType, accept
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DirectorSceneId
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
SetupEventArgsOnStart = 1,
|
||||||
|
SetupEventArgsInProgress = 2,
|
||||||
|
|
||||||
|
DutyFailed = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TerminateReason : uint8_t
|
||||||
|
{
|
||||||
|
TimeExpired,
|
||||||
|
TimeLimitReached,
|
||||||
|
Abandoned,
|
||||||
|
Ended
|
||||||
|
};
|
||||||
|
|
||||||
InstanceContent( std::shared_ptr< Sapphire::Data::InstanceContent > pInstanceConfiguration,
|
InstanceContent( std::shared_ptr< Sapphire::Data::InstanceContent > pInstanceConfiguration,
|
||||||
uint16_t territoryType,
|
uint16_t territoryType,
|
||||||
uint32_t guId,
|
uint32_t guId,
|
||||||
|
|
|
@ -100,6 +100,7 @@ Sapphire::InstanceObjectCache::InstanceObjectCache()
|
||||||
{
|
{
|
||||||
for( const auto& pEntry : group.entries )
|
for( const auto& pEntry : group.entries )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( pEntry->getType() == LgbEntryType::MapRange )
|
if( pEntry->getType() == LgbEntryType::MapRange )
|
||||||
{
|
{
|
||||||
auto pMapRange = std::reinterpret_pointer_cast< LGB_MAP_RANGE_ENTRY >( pEntry );
|
auto pMapRange = std::reinterpret_pointer_cast< LGB_MAP_RANGE_ENTRY >( pEntry );
|
||||||
|
@ -129,6 +130,11 @@ Sapphire::InstanceObjectCache::InstanceObjectCache()
|
||||||
auto pENpc = std::reinterpret_pointer_cast< LGB_ENPC_ENTRY >( pEntry );
|
auto pENpc = std::reinterpret_pointer_cast< LGB_ENPC_ENTRY >( pEntry );
|
||||||
m_enpcCache.insert( 0, pENpc );
|
m_enpcCache.insert( 0, pENpc );
|
||||||
}
|
}
|
||||||
|
else if( pEntry->getType() == LgbEntryType::EventRange )
|
||||||
|
{
|
||||||
|
auto pEventRange = std::reinterpret_pointer_cast< LGB_EVENT_RANGE_ENTRY >( pEntry );
|
||||||
|
m_eventRangeCache.insert( 0, pEventRange );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,8 +142,8 @@ Sapphire::InstanceObjectCache::InstanceObjectCache()
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
|
|
||||||
Logger::debug(
|
Logger::debug(
|
||||||
"InstanceObjectCache Cached: MapRange: {} ExitRange: {} PopRange: {}",
|
"InstanceObjectCache Cached: MapRange: {} ExitRange: {} PopRange: {} EventNpc: {} EventRange: {}",
|
||||||
m_mapRangeCache.size(), m_exitRangeCache.size(), m_popRangeCache.size()
|
m_mapRangeCache.size(), m_exitRangeCache.size(), m_popRangeCache.size(), m_enpcCache.size(), m_eventRangeCache.size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +178,11 @@ Sapphire::InstanceObjectCache::getENpc( uint32_t eNpcId )
|
||||||
return m_enpcCache.get( 0, eNpcId );
|
return m_enpcCache.get( 0, eNpcId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sapphire::InstanceObjectCache::EventRangePtr Sapphire::InstanceObjectCache::getEventRange( uint32_t eventRangeId )
|
||||||
|
{
|
||||||
|
return m_eventRangeCache.get( 0, eventRangeId );
|
||||||
|
}
|
||||||
|
|
||||||
Sapphire::InstanceObjectCache::EventNpcMapPtr
|
Sapphire::InstanceObjectCache::EventNpcMapPtr
|
||||||
Sapphire::InstanceObjectCache::getAllEventNpc( uint16_t zoneId )
|
Sapphire::InstanceObjectCache::getAllEventNpc( uint16_t zoneId )
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@ struct LGB_EXIT_RANGE_ENTRY;
|
||||||
struct LGB_POP_RANGE_ENTRY;
|
struct LGB_POP_RANGE_ENTRY;
|
||||||
struct LGB_EOBJ_ENTRY;
|
struct LGB_EOBJ_ENTRY;
|
||||||
struct LGB_ENPC_ENTRY;
|
struct LGB_ENPC_ENTRY;
|
||||||
|
struct LGB_EVENT_RANGE_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire
|
||||||
|
@ -67,7 +68,11 @@ namespace Sapphire
|
||||||
|
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return m_objectCache.size();
|
size_t size = 0;
|
||||||
|
for( auto& it = m_objectCache.begin(); it != m_objectCache.end(); ++it )
|
||||||
|
size += it->second.size();
|
||||||
|
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,6 +84,7 @@ namespace Sapphire
|
||||||
using PopRangePtr = std::shared_ptr< LGB_POP_RANGE_ENTRY >;
|
using PopRangePtr = std::shared_ptr< LGB_POP_RANGE_ENTRY >;
|
||||||
using EObjPtr = std::shared_ptr< LGB_EOBJ_ENTRY >;
|
using EObjPtr = std::shared_ptr< LGB_EOBJ_ENTRY >;
|
||||||
using ENpcPtr = std::shared_ptr< LGB_ENPC_ENTRY >;
|
using ENpcPtr = std::shared_ptr< LGB_ENPC_ENTRY >;
|
||||||
|
using EventRangePtr = std::shared_ptr< LGB_EVENT_RANGE_ENTRY >;
|
||||||
|
|
||||||
using EventNpcMapPtr = std::unordered_map< uint32_t, ENpcPtr >*;
|
using EventNpcMapPtr = std::unordered_map< uint32_t, ENpcPtr >*;
|
||||||
using EventObjMapPtr = std::unordered_map< uint32_t, EObjPtr >*;
|
using EventObjMapPtr = std::unordered_map< uint32_t, EObjPtr >*;
|
||||||
|
@ -91,6 +97,7 @@ namespace Sapphire
|
||||||
PopRangePtr getPopRange( uint16_t zoneId, uint32_t popRangeId );
|
PopRangePtr getPopRange( uint16_t zoneId, uint32_t popRangeId );
|
||||||
EObjPtr getEObj( uint32_t eObjId );
|
EObjPtr getEObj( uint32_t eObjId );
|
||||||
ENpcPtr getENpc( uint32_t eNpcId );
|
ENpcPtr getENpc( uint32_t eNpcId );
|
||||||
|
EventRangePtr getEventRange( uint32_t eventRangeId );
|
||||||
|
|
||||||
EventNpcMapPtr getAllEventNpc( uint16_t zoneId );
|
EventNpcMapPtr getAllEventNpc( uint16_t zoneId );
|
||||||
EventObjMapPtr getAllEventObj( uint16_t zoneId );
|
EventObjMapPtr getAllEventObj( uint16_t zoneId );
|
||||||
|
@ -101,6 +108,7 @@ namespace Sapphire
|
||||||
ObjectCache< LGB_POP_RANGE_ENTRY > m_popRangeCache;
|
ObjectCache< LGB_POP_RANGE_ENTRY > m_popRangeCache;
|
||||||
ObjectCache< LGB_EOBJ_ENTRY > m_eobjCache;
|
ObjectCache< LGB_EOBJ_ENTRY > m_eobjCache;
|
||||||
ObjectCache< LGB_ENPC_ENTRY > m_enpcCache;
|
ObjectCache< LGB_ENPC_ENTRY > m_enpcCache;
|
||||||
|
ObjectCache< LGB_EVENT_RANGE_ENTRY > m_eventRangeCache;
|
||||||
std::shared_ptr< Framework > m_pFramework;
|
std::shared_ptr< Framework > m_pFramework;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue