mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-06 18:57:45 +00:00
Fixed popranges not being found
This commit is contained in:
parent
b17af41e67
commit
79764da844
7 changed files with 35 additions and 43 deletions
2
deps/datReader/DatCategories/bg/LgbTypes.h
vendored
2
deps/datReader/DatCategories/bg/LgbTypes.h
vendored
|
@ -108,7 +108,7 @@ struct RelativePositions
|
||||||
int32_t PosCount;
|
int32_t PosCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PopRangeData : InstanceObject
|
struct PopRangeData : public InstanceObject
|
||||||
{
|
{
|
||||||
PopType popType;
|
PopType popType;
|
||||||
RelativePositions relativePositions;
|
RelativePositions relativePositions;
|
||||||
|
|
35
deps/datReader/DatCategories/bg/lgb.h
vendored
35
deps/datReader/DatCategories/bg/lgb.h
vendored
|
@ -55,7 +55,7 @@ public:
|
||||||
class LGB_BGPARTS_ENTRY : public LgbEntry
|
class LGB_BGPARTS_ENTRY : public LgbEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BgPartsData header;
|
BgPartsData data;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string modelFileName;
|
std::string modelFileName;
|
||||||
std::string collisionFileName;
|
std::string collisionFileName;
|
||||||
|
@ -66,38 +66,38 @@ public:
|
||||||
|
|
||||||
LGB_BGPARTS_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
LGB_BGPARTS_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
||||||
{
|
{
|
||||||
header = *reinterpret_cast< BgPartsData* >( buf + offset );
|
data = *reinterpret_cast< BgPartsData* >( buf + offset );
|
||||||
name = std::string( buf + offset + header.nameOffset );
|
name = std::string( buf + offset + header.nameOffset );
|
||||||
modelFileName = std::string( buf + offset + header.modelFileOffset );
|
modelFileName = std::string( buf + offset + data.modelFileOffset );
|
||||||
collisionFileName = std::string( buf + offset + header.collisionFileOffset );
|
collisionFileName = std::string( buf + offset + data.collisionFileOffset );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class LGB_GIMMICK_ENTRY : public LgbEntry
|
class LGB_GIMMICK_ENTRY : public LgbEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GimmickData header;
|
GimmickData data;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string gimmickFileName;
|
std::string gimmickFileName;
|
||||||
|
|
||||||
LGB_GIMMICK_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
LGB_GIMMICK_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
||||||
{
|
{
|
||||||
header = *reinterpret_cast< GimmickData* >( buf + offset );
|
data = *reinterpret_cast< GimmickData* >( buf + offset );
|
||||||
name = std::string( buf + offset + header.nameOffset );
|
name = std::string( buf + offset + header.nameOffset );
|
||||||
gimmickFileName = std::string( buf + offset + header.gimmickFileOffset );
|
gimmickFileName = std::string( buf + offset + data.gimmickFileOffset );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class LGB_ENPC_ENTRY : public LgbEntry
|
class LGB_ENPC_ENTRY : public LgbEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ENpcData header;
|
ENpcData data;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
LGB_ENPC_ENTRY( char* buf, uint32_t offset ) :
|
LGB_ENPC_ENTRY( char* buf, uint32_t offset ) :
|
||||||
LgbEntry( buf, offset )
|
LgbEntry( buf, offset )
|
||||||
{
|
{
|
||||||
header = *reinterpret_cast< ENpcData* >( buf + offset );
|
data = *reinterpret_cast< ENpcData* >( buf + offset );
|
||||||
name = std::string( buf + offset + header.nameOffset );
|
name = std::string( buf + offset + header.nameOffset );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -105,12 +105,12 @@ public:
|
||||||
class LGB_EOBJ_ENTRY : public LgbEntry
|
class LGB_EOBJ_ENTRY : public LgbEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EObjData header;
|
EObjData data;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
LGB_EOBJ_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
LGB_EOBJ_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
||||||
{
|
{
|
||||||
header = *reinterpret_cast< EObjData* >( buf + offset );
|
data = *reinterpret_cast< EObjData* >( buf + offset );
|
||||||
name = std::string( buf + offset + header.nameOffset );
|
name = std::string( buf + offset + header.nameOffset );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -118,12 +118,12 @@ public:
|
||||||
struct LGB_MAP_RANGE_ENTRY : public LgbEntry
|
struct LGB_MAP_RANGE_ENTRY : public LgbEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapRangeData header;
|
MapRangeData data;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
LGB_MAP_RANGE_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
LGB_MAP_RANGE_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
||||||
{
|
{
|
||||||
header = *reinterpret_cast< MapRangeData* >( buf + offset );
|
data = *reinterpret_cast< MapRangeData* >( buf + offset );
|
||||||
name = std::string( buf + offset + header.nameOffset );
|
name = std::string( buf + offset + header.nameOffset );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -131,25 +131,24 @@ public:
|
||||||
struct LGB_EXIT_RANGE_ENTRY : public LgbEntry
|
struct LGB_EXIT_RANGE_ENTRY : public LgbEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ExitRangeData header;
|
ExitRangeData data;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
LGB_EXIT_RANGE_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
LGB_EXIT_RANGE_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
||||||
{
|
{
|
||||||
header = *reinterpret_cast< ExitRangeData* >( buf + offset );
|
data = *reinterpret_cast< ExitRangeData* >( buf + offset );
|
||||||
name = std::string( buf + offset + header.nameOffset );
|
name = std::string( buf + offset + header.nameOffset );
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LGB_POP_RANGE_ENTRY : public LgbEntry
|
struct LGB_POP_RANGE_ENTRY : public LgbEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PopRangeData header;
|
PopRangeData data;
|
||||||
|
|
||||||
LGB_POP_RANGE_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
LGB_POP_RANGE_ENTRY( char* buf, uint32_t offset ) : LgbEntry( buf, offset )
|
||||||
{
|
{
|
||||||
header = *reinterpret_cast< PopRangeData* >( buf + offset );
|
data = *reinterpret_cast< PopRangeData* >( buf + offset );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -222,12 +222,12 @@ void loadEobjNames()
|
||||||
void writeMapRangeEntry( std::ofstream& out, LgbEntry* pObj )
|
void writeMapRangeEntry( std::ofstream& out, LgbEntry* pObj )
|
||||||
{
|
{
|
||||||
auto pMapRange = reinterpret_cast< LGB_MAP_RANGE_ENTRY* >( pObj );
|
auto pMapRange = reinterpret_cast< LGB_MAP_RANGE_ENTRY* >( pObj );
|
||||||
if( !pMapRange->header.discoveryEnabled )
|
if( !pMapRange->data.discoveryEnabled )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto subArea = 0;
|
auto subArea = 0;
|
||||||
auto mapId = -1;
|
auto mapId = -1;
|
||||||
auto discoveryIndex = pMapRange->header.discoveryIndex;
|
auto discoveryIndex = pMapRange->data.discoveryIndex;
|
||||||
|
|
||||||
vec3 translation = pObj->header.transform.translation;
|
vec3 translation = pObj->header.transform.translation;
|
||||||
|
|
||||||
|
@ -236,8 +236,8 @@ void writeMapRangeEntry( std::ofstream& out, LgbEntry* pObj )
|
||||||
std::to_string( pMapRange->header.transform.translation.y ) + " " +
|
std::to_string( pMapRange->header.transform.translation.y ) + " " +
|
||||||
std::to_string( pMapRange->header.transform.translation.z ) + " " +
|
std::to_string( pMapRange->header.transform.translation.z ) + " " +
|
||||||
std::to_string( pMapRange->header.transform.rotation.y ) + " " +
|
std::to_string( pMapRange->header.transform.rotation.y ) + " " +
|
||||||
std::to_string( pMapRange->header.mapId ) + " " +
|
std::to_string( pMapRange->data.mapId ) + " " +
|
||||||
std::to_string( pMapRange->header.discoveryIndex ) + "\n"
|
std::to_string( pMapRange->data.discoveryIndex ) + "\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
out.write( outStr.c_str(), outStr.size() );
|
out.write( outStr.c_str(), outStr.size() );
|
||||||
|
|
|
@ -284,10 +284,10 @@ int main( int argc, char* argv[] )
|
||||||
uint32_t eobjlevelHierachyId = 0;
|
uint32_t eobjlevelHierachyId = 0;
|
||||||
|
|
||||||
auto pEobj = reinterpret_cast< LGB_EOBJ_ENTRY* >( pObj );
|
auto pEobj = reinterpret_cast< LGB_EOBJ_ENTRY* >( pObj );
|
||||||
id = pEobj->header.eobjId;
|
id = pEobj->data.eobjId;
|
||||||
unknown = pEobj->header.instanceId;
|
unknown = pEobj->header.instanceId;
|
||||||
|
|
||||||
eobjlevelHierachyId = pEobj->header.levelHierachyId;
|
eobjlevelHierachyId = pEobj->data.levelHierachyId;
|
||||||
|
|
||||||
std::string states = "";
|
std::string states = "";
|
||||||
std::string gimmickName = "";
|
std::string gimmickName = "";
|
||||||
|
@ -295,7 +295,7 @@ int main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
auto pGObj = pEntry1.get();
|
auto pGObj = pEntry1.get();
|
||||||
if( pGObj->getType() == LgbEntryType::Gimmick &&
|
if( pGObj->getType() == LgbEntryType::Gimmick &&
|
||||||
pGObj->header.instanceId == pEobj->header.levelHierachyId )
|
pGObj->header.instanceId == pEobj->data.levelHierachyId )
|
||||||
{
|
{
|
||||||
auto pGObjR = reinterpret_cast< LGB_GIMMICK_ENTRY* >( pGObj );
|
auto pGObjR = reinterpret_cast< LGB_GIMMICK_ENTRY* >( pGObj );
|
||||||
char* dataSection = nullptr;
|
char* dataSection = nullptr;
|
||||||
|
|
|
@ -370,7 +370,7 @@ void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendDebug( "Teleport: popRange not found!" );
|
sendDebug( "Teleport: popRange {0} not found in {1}!", data->level[ 0 ], data->territory );
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::FFXIVARR_POSITION3 pos;
|
Common::FFXIVARR_POSITION3 pos;
|
||||||
|
|
|
@ -293,15 +293,15 @@ void Sapphire::Network::GameConnection::zoneLineHandler( FrameworkPtr pFw,
|
||||||
if( pExitRange )
|
if( pExitRange )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Found ExitRange#{0}", zoneLineId );
|
player.sendDebug( "Found ExitRange#{0}", zoneLineId );
|
||||||
player.sendDebug( "destTerritoryType#{0}", pExitRange->header.destTerritoryType );
|
player.sendDebug( "destTerritoryType#{0}", pExitRange->data.destTerritoryType );
|
||||||
player.sendDebug( "destInstanceObjectId#{0}", pExitRange->header.destInstanceObjectId );
|
player.sendDebug( "destInstanceObjectId#{0}", pExitRange->data.destInstanceObjectId );
|
||||||
|
|
||||||
auto pPopRange = pInstanceObjectCache->getPopRange( pExitRange->header.destTerritoryType,
|
auto pPopRange = pInstanceObjectCache->getPopRange( pExitRange->data.destTerritoryType,
|
||||||
pExitRange->header.destInstanceObjectId );
|
pExitRange->data.destInstanceObjectId );
|
||||||
if( pPopRange )
|
if( pPopRange )
|
||||||
{
|
{
|
||||||
targetZone = pExitRange->header.destTerritoryType;
|
targetZone = pExitRange->data.destTerritoryType;
|
||||||
player.sendDebug( "\tFound PopRange#{0}", pExitRange->header.destInstanceObjectId );
|
player.sendDebug( "\tFound PopRange#{0}", pExitRange->data.destInstanceObjectId );
|
||||||
player.sendDebug( "\t{0}", pPopRange->header.transform.translation.x );
|
player.sendDebug( "\t{0}", pPopRange->header.transform.translation.x );
|
||||||
player.sendDebug( "\t{0}", pPopRange->header.transform.translation.y );
|
player.sendDebug( "\t{0}", pPopRange->header.transform.translation.y );
|
||||||
player.sendDebug( "\t{0}", pPopRange->header.transform.translation.z );
|
player.sendDebug( "\t{0}", pPopRange->header.transform.translation.z );
|
||||||
|
@ -312,7 +312,7 @@ void Sapphire::Network::GameConnection::zoneLineHandler( FrameworkPtr pFw,
|
||||||
player.sendDebug( "ZoneLine #{0} found.", zoneLineId );
|
player.sendDebug( "ZoneLine #{0} found.", zoneLineId );
|
||||||
|
|
||||||
auto preparePacket = makeZonePacket< FFXIVIpcPrepareZoning >( player.getId() );
|
auto preparePacket = makeZonePacket< FFXIVIpcPrepareZoning >( player.getId() );
|
||||||
preparePacket->data().targetZone = pExitRange->header.destTerritoryType;
|
preparePacket->data().targetZone = pExitRange->data.destTerritoryType;
|
||||||
|
|
||||||
//ActorControlSelfPacket controlPacket( pPlayer, ActorControlType::DespawnZoneScreenMsg,
|
//ActorControlSelfPacket controlPacket( pPlayer, ActorControlType::DespawnZoneScreenMsg,
|
||||||
// 0x03, player.getId(), 0x01, targetZone );
|
// 0x03, player.getId(), 0x01, targetZone );
|
||||||
|
@ -372,9 +372,9 @@ void Sapphire::Network::GameConnection::discoveryHandler( FrameworkPtr pFw,
|
||||||
{
|
{
|
||||||
auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() );
|
auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() );
|
||||||
discoveryPacket->data().mapId = tInfo->map;
|
discoveryPacket->data().mapId = tInfo->map;
|
||||||
discoveryPacket->data().mapPartId = pRefInfo->header.discoveryIndex;
|
discoveryPacket->data().mapPartId = pRefInfo->data.discoveryIndex;
|
||||||
player.queuePacket( discoveryPacket );
|
player.queuePacket( discoveryPacket );
|
||||||
player.discover( tInfo->map, pRefInfo->header.discoveryIndex );
|
player.discover( tInfo->map, pRefInfo->data.discoveryIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,6 @@ Sapphire::InstanceObjectCache::InstanceObjectCache( std::shared_ptr< Framework >
|
||||||
{
|
{
|
||||||
for( const auto& pEntry : group.entries )
|
for( const auto& pEntry : group.entries )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( pEntry->getType() == LgbEntryType::MapRange )
|
if( pEntry->getType() == LgbEntryType::MapRange )
|
||||||
{
|
{
|
||||||
auto pMapRange = reinterpret_cast< LGB_MAP_RANGE_ENTRY* >( pEntry.get() );
|
auto pMapRange = reinterpret_cast< LGB_MAP_RANGE_ENTRY* >( pEntry.get() );
|
||||||
|
@ -82,12 +81,6 @@ Sapphire::InstanceObjectCache::InstanceObjectCache( std::shared_ptr< Framework >
|
||||||
}
|
}
|
||||||
else if( pEntry->getType() == LgbEntryType::PopRange )
|
else if( pEntry->getType() == LgbEntryType::PopRange )
|
||||||
{
|
{
|
||||||
if( pEntry->header.instanceId == 1359242 )
|
|
||||||
{
|
|
||||||
std::cout << ">>>" << id << "__" << static_cast< uint32_t >( pEntry->getType() ) << ">>>\n";
|
|
||||||
//break;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pPopRange = reinterpret_cast< LGB_POP_RANGE_ENTRY* >( pEntry.get() );
|
auto pPopRange = reinterpret_cast< LGB_POP_RANGE_ENTRY* >( pEntry.get() );
|
||||||
m_popRangeCache.insert( id, *pPopRange );
|
m_popRangeCache.insert( id, *pPopRange );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue