mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
Map previously unmapped eobj and enpc
This commit is contained in:
parent
453f441ad3
commit
4cef7cdab9
15 changed files with 70 additions and 45 deletions
4
deps/datReader/DatCategories/bg/lgb.h
vendored
4
deps/datReader/DatCategories/bg/lgb.h
vendored
|
@ -86,7 +86,7 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
class LGB_ENPC_ENTRY : public LgbEntry
|
||||
struct LGB_ENPC_ENTRY : public LgbEntry
|
||||
{
|
||||
public:
|
||||
ENpcData data;
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
class LGB_EOBJ_ENTRY : public LgbEntry
|
||||
struct LGB_EOBJ_ENTRY : public LgbEntry
|
||||
{
|
||||
public:
|
||||
EObjData data;
|
||||
|
|
2
deps/datReaderPs3/DatCategories/bg/lgb.h
vendored
2
deps/datReaderPs3/DatCategories/bg/lgb.h
vendored
|
@ -196,7 +196,7 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
class LGB_EOBJ_ENTRY : public LgbEntry
|
||||
struct LGB_EOBJ_ENTRY : public LgbEntry
|
||||
{
|
||||
public:
|
||||
EObjData data;
|
||||
|
|
|
@ -126,40 +126,38 @@ public:
|
|||
|
||||
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId ) override
|
||||
{
|
||||
auto actor = eventMgr().mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
switch( actor )
|
||||
switch( actorId )
|
||||
{
|
||||
case Eobject0:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00001( quest, player );
|
||||
break;
|
||||
case Eobject1:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00002( quest, player );
|
||||
break;
|
||||
case Eobject2:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00003( quest, player );
|
||||
break;
|
||||
case Eobject3:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00004( quest, player );
|
||||
break;
|
||||
case Eobject4:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00005( quest, player );
|
||||
break;
|
||||
case Eobject5:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00006( quest, player );
|
||||
break;
|
||||
case Eobject6:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00007( quest, player );
|
||||
break;
|
||||
case Eobject7:
|
||||
eventMgr().eventStart( player, actor, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, getId(), Event::EventHandler::Nest, 0, 0 );
|
||||
Scene00008( quest, player );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -112,9 +112,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId ) override
|
||||
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actor, uint32_t actionId ) override
|
||||
{
|
||||
auto actor = eventMgr().mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
switch( actor )
|
||||
{
|
||||
|
|
|
@ -140,9 +140,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId ) override
|
||||
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actor, uint32_t actionId ) override
|
||||
{
|
||||
auto actor = eventMgr().mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
switch( actor )
|
||||
{
|
||||
|
|
|
@ -216,9 +216,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void onEventItem( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
|
||||
void onEventItem( World::Quest& quest, Entity::Player& player, uint64_t actor ) override
|
||||
{
|
||||
auto actor = eventMgr().mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Eobject0 )
|
||||
{
|
||||
|
@ -238,9 +237,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId ) override
|
||||
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actor, uint32_t actionId ) override
|
||||
{
|
||||
auto actor = eventMgr().mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor3 && actionId == Action0 )
|
||||
{
|
||||
|
|
|
@ -202,7 +202,7 @@ struct EObjData :
|
|||
uint8_t unknown1[0xC];
|
||||
};
|
||||
|
||||
class LGB_EOBJ_ENTRY :
|
||||
struct LGB_EOBJ_ENTRY :
|
||||
public LgbEntry
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -178,7 +178,7 @@ struct ENpcData :
|
|||
uint8_t unknown1[0x24];
|
||||
};
|
||||
|
||||
class LGB_ENPC_ENTRY :
|
||||
struct LGB_ENPC_ENTRY :
|
||||
public LgbEntry
|
||||
{
|
||||
public:
|
||||
|
@ -202,7 +202,7 @@ struct EObjData :
|
|||
uint8_t unknown1[0xC];
|
||||
};
|
||||
|
||||
class LGB_EOBJ_ENTRY :
|
||||
struct LGB_EOBJ_ENTRY :
|
||||
public LgbEntry
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -69,7 +69,6 @@ Sapphire::Entity::Player::Player() :
|
|||
m_lastActionTick( 0 ),
|
||||
m_bInCombat( false ),
|
||||
m_bLoadingComplete( false ),
|
||||
m_bMarkedForZoning( false ),
|
||||
m_zoningType( Common::ZoneingType::None ),
|
||||
m_bAutoattack( false ),
|
||||
m_markedForRemoval( false ),
|
||||
|
@ -476,7 +475,6 @@ void Sapphire::Entity::Player::forceZoneing( uint32_t zoneId )
|
|||
void Sapphire::Entity::Player::performZoning( uint16_t territoryTypeId, uint32_t territoryId, const Common::FFXIVARR_POSITION3& pos, float rotation )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_bMarkedForZoning = true;
|
||||
setRot( rotation );
|
||||
|
||||
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
|
@ -1228,11 +1226,6 @@ void Sapphire::Entity::Player::setLoadingComplete( bool bComplete )
|
|||
m_bLoadingComplete = bComplete;
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::isMarkedForZoning() const
|
||||
{
|
||||
return m_bMarkedForZoning;
|
||||
}
|
||||
|
||||
ZoneingType Sapphire::Entity::Player::getZoningType() const
|
||||
{
|
||||
return m_zoningType;
|
||||
|
@ -1632,7 +1625,6 @@ void Sapphire::Entity::Player::sendZonePackets()
|
|||
partyMgr.onMoveZone( *this );
|
||||
}
|
||||
|
||||
m_bMarkedForZoning = false;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::setDirectorInitialized( bool isInitialized )
|
||||
|
|
|
@ -585,9 +585,6 @@ namespace Sapphire::Entity
|
|||
/*! mark this player for zoning, notify worldserver */
|
||||
void performZoning( uint16_t territoryTypeId, uint32_t territoryId, const Common::FFXIVARR_POSITION3& pos, float rotation );
|
||||
|
||||
/*! return true if the player is marked for zoning */
|
||||
bool isMarkedForZoning() const;
|
||||
|
||||
void sendZoneInPackets( uint32_t param1, bool pSetStatus );
|
||||
|
||||
void finishZoning();
|
||||
|
@ -928,7 +925,6 @@ namespace Sapphire::Entity
|
|||
|
||||
Common::ZoneingType m_zoningType;
|
||||
|
||||
bool m_bMarkedForZoning;
|
||||
bool m_bNewAdventurer{};
|
||||
uint64_t m_onlineStatus;
|
||||
uint64_t m_onlineStatusCustom;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <Common.h>
|
||||
#include <Exd/ExdData.h>
|
||||
#include <Util/Util.h>
|
||||
#include <Service.h>
|
||||
|
||||
|
@ -10,6 +9,10 @@
|
|||
#include "Event/Director.h"
|
||||
#include "Event/EventDefs.h"
|
||||
|
||||
#include <Exd/ExdData.h>
|
||||
#include <datReader/DatCategories/bg/LgbTypes.h>
|
||||
#include <datReader/DatCategories/bg/lgb.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket.h"
|
||||
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
||||
|
@ -19,6 +22,8 @@
|
|||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
#include "Network/PacketWrappers/Notice2Packet.h"
|
||||
|
||||
#include "Territory/InstanceObjectCache.h"
|
||||
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/InstanceContent.h"
|
||||
#include "Territory/QuestBattle.h"
|
||||
|
@ -217,10 +222,16 @@ std::string Sapphire::World::Manager::EventMgr::getErrorCodeName( uint8_t errorC
|
|||
|
||||
uint32_t Sapphire::World::Manager::EventMgr::mapEventActorToRealActor( uint32_t eventActorId )
|
||||
{
|
||||
|
||||
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();
|
||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||
auto levelInfo = exdData.getRow< Component::Excel::Level >( eventActorId );
|
||||
if( levelInfo )
|
||||
return levelInfo->data().BaseId;
|
||||
else if( auto pObj = instanceObjectCache.getEObj( eventActorId ) )
|
||||
return pObj->data.eobjId;
|
||||
else if( auto pNpc = instanceObjectCache.getENpc( eventActorId ) )
|
||||
return pNpc->data.enpcId;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -197,10 +197,6 @@ void Sapphire::Network::GameConnection::joinChatChannelHandler( const Packets::F
|
|||
|
||||
void Sapphire::Network::GameConnection::moveHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||
{
|
||||
// if the player is marked for zoning we no longer want to update his pos
|
||||
if( player.isMarkedForZoning() )
|
||||
return;
|
||||
|
||||
const auto updatePositionPacket = ZoneChannelPacket< Client::FFXIVIpcUpdatePosition >( inPacket );
|
||||
auto& data = updatePositionPacket.data();
|
||||
|
||||
|
|
|
@ -382,6 +382,9 @@ bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32
|
|||
std::string objName = eventMgr.getEventName( eventId );
|
||||
PlayerMgr::sendDebug( player, "Calling: {0}.{1} - {2}", objName, eventName, eventId );
|
||||
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( targetId ) );
|
||||
|
||||
auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||
if( eventType == Event::EventHandler::EventHandlerType::Quest )
|
||||
|
@ -396,7 +399,7 @@ bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32
|
|||
auto questIdx = player.getQuestIndex( questId );
|
||||
auto& quest = player.getQuestByIndex( questIdx );
|
||||
preQ = quest;
|
||||
script->onEventItem( quest, player, targetId );
|
||||
script->onEventItem( quest, player, actor );
|
||||
if( quest != preQ )
|
||||
player.updateQuest( quest );
|
||||
return true;
|
||||
|
@ -443,6 +446,9 @@ bool Sapphire::Scripting::ScriptMgr::onEObjHit( Sapphire::Entity::Player& player
|
|||
auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
bool didCallScript = false;
|
||||
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
for( size_t i = 0; i < 30; i++ )
|
||||
{
|
||||
auto quest = player.getQuestByIndex( static_cast< uint16_t >( i ));
|
||||
|
@ -457,10 +463,10 @@ bool Sapphire::Scripting::ScriptMgr::onEObjHit( Sapphire::Entity::Player& player
|
|||
didCallScript = true;
|
||||
std::string objName = eventMgr.getEventName( questId );
|
||||
|
||||
PlayerMgr::sendDebug( player, "Calling: {0}.onEObjHit actorId#{1}, questId#{2}", objName, actorId, quest.getId() );
|
||||
PlayerMgr::sendDebug( player, "Calling: {0}.onEObjHit actorId#{1}, questId#{2}", objName, actor, quest.getId() );
|
||||
|
||||
World::Quest preQ = quest;
|
||||
script->onEObjHit( quest, player, actorId, actionId );
|
||||
script->onEObjHit( quest, player, actor, actionId );
|
||||
if( quest != preQ )
|
||||
player.updateQuest( quest );
|
||||
}
|
||||
|
|
|
@ -102,6 +102,16 @@ Sapphire::InstanceObjectCache::InstanceObjectCache()
|
|||
{
|
||||
|
||||
}
|
||||
else if( pEntry->getType() == LgbEntryType::EventObject )
|
||||
{
|
||||
auto pEObj = std::reinterpret_pointer_cast< LGB_EOBJ_ENTRY >( pEntry );
|
||||
m_eobjCache.insert( 0, pEObj );
|
||||
}
|
||||
else if( pEntry->getType() == LgbEntryType::EventNpc )
|
||||
{
|
||||
auto pENpc = std::reinterpret_pointer_cast< LGB_ENPC_ENTRY >( pEntry );
|
||||
m_enpcCache.insert( 0, pENpc );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,4 +141,16 @@ Sapphire::InstanceObjectCache::PopRangePtr
|
|||
Sapphire::InstanceObjectCache::getPopRange( uint16_t zoneId, uint32_t popRangeId )
|
||||
{
|
||||
return m_popRangeCache.get( zoneId, popRangeId );
|
||||
}
|
||||
|
||||
Sapphire::InstanceObjectCache::EObjPtr
|
||||
Sapphire::InstanceObjectCache::getEObj( uint32_t eObjId )
|
||||
{
|
||||
return m_eobjCache.get( 0, eObjId );
|
||||
}
|
||||
|
||||
Sapphire::InstanceObjectCache::ENpcPtr
|
||||
Sapphire::InstanceObjectCache::getENpc( uint32_t eNpcId )
|
||||
{
|
||||
return m_enpcCache.get( 0, eNpcId );
|
||||
}
|
|
@ -7,6 +7,8 @@
|
|||
struct LGB_MAP_RANGE_ENTRY;
|
||||
struct LGB_EXIT_RANGE_ENTRY;
|
||||
struct LGB_POP_RANGE_ENTRY;
|
||||
struct LGB_EOBJ_ENTRY;
|
||||
struct LGB_ENPC_ENTRY;
|
||||
|
||||
|
||||
namespace Sapphire
|
||||
|
@ -65,6 +67,8 @@ namespace Sapphire
|
|||
using MapRangePtr = std::shared_ptr< LGB_MAP_RANGE_ENTRY >;
|
||||
using ExitRangePtr = std::shared_ptr< LGB_EXIT_RANGE_ENTRY >;
|
||||
using PopRangePtr = std::shared_ptr< LGB_POP_RANGE_ENTRY >;
|
||||
using EObjPtr = std::shared_ptr< LGB_EOBJ_ENTRY >;
|
||||
using ENpcPtr = std::shared_ptr< LGB_ENPC_ENTRY >;
|
||||
|
||||
InstanceObjectCache();
|
||||
~InstanceObjectCache() = default;
|
||||
|
@ -72,11 +76,15 @@ namespace Sapphire
|
|||
MapRangePtr getMapRange( uint16_t zoneId, uint32_t mapRangeId );
|
||||
ExitRangePtr getExitRange( uint16_t zoneId, uint32_t exitRangeId );
|
||||
PopRangePtr getPopRange( uint16_t zoneId, uint32_t popRangeId );
|
||||
EObjPtr getEObj( uint32_t eObjId );
|
||||
ENpcPtr getENpc( uint32_t eNpcId );
|
||||
|
||||
private:
|
||||
ObjectCache< LGB_MAP_RANGE_ENTRY > m_mapRangeCache;
|
||||
ObjectCache< LGB_EXIT_RANGE_ENTRY > m_exitRangeCache;
|
||||
ObjectCache< LGB_POP_RANGE_ENTRY > m_popRangeCache;
|
||||
ObjectCache< LGB_EOBJ_ENTRY > m_eobjCache;
|
||||
ObjectCache< LGB_ENPC_ENTRY > m_enpcCache;
|
||||
std::shared_ptr< Framework > m_pFramework;
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue