1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-06 18:57:45 +00:00

WIP fixing contentfinder, id usage reworked.

This commit is contained in:
Mordred 2023-01-22 16:53:21 +01:00
parent 5b040405ce
commit 9872acf4a8
3 changed files with 19 additions and 44 deletions

View file

@ -1938,23 +1938,6 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
uint8_t penalties[2]; uint8_t penalties[2];
}; };
struct FFXIVIpcCFMemberStatus : FFXIVIpcBasePacket< CFMemberStatus >
{
uint16_t contentId;
uint16_t unknown1;
uint8_t status;
uint8_t currentTank;
uint8_t currentDps;
uint8_t currentHealer;
uint8_t estimatedTime;
uint8_t unknown2[3];
uint32_t unknown3;
};
/** /**
* Structural representation of the packet sent by the server * Structural representation of the packet sent by the server
* to set the gear show/hide status of a character * to set the gear show/hide status of a character

View file

@ -46,7 +46,7 @@ void Sapphire::World::ContentFinder::update()
break; break;
case MatchingComplete: case MatchingComplete:
{ {
auto contentInfo = exdData.getRow< Excel::InstanceContent >( content->getContentFinderId() ); auto contentInfo = exdData.getRow< Excel::InstanceContent >( content->getInstanceId() );
for( auto& queuedPlayer : content->m_players ) for( auto& queuedPlayer : content->m_players )
{ {
uint32_t inProgress = 0; // 0x01 - in progress uint32_t inProgress = 0; // 0x01 - in progress
@ -72,8 +72,8 @@ void Sapphire::World::ContentFinder::update()
{ {
auto& terriMgr = Service< TerritoryMgr >::ref(); auto& terriMgr = Service< TerritoryMgr >::ref();
auto& warpMgr = Common::Service< WarpMgr >::ref(); auto& warpMgr = Common::Service< WarpMgr >::ref();
auto contentFinderInfo = exdData.getRow< Excel::ContentFinderCondition >( content->getContentFinderId() ); auto contentFinderInfo = exdData.getRow< Excel::ContentFinderCondition >( content->getInstanceId() );
if( auto instance = terriMgr.createInstanceContent( content->getContentFinderId() ) ) if( auto instance = terriMgr.createInstanceContent( content->getInstanceId() ) )
{ {
auto pInstanceContent = instance->getAsInstanceContent(); auto pInstanceContent = instance->getAsInstanceContent();
@ -138,7 +138,7 @@ void Sapphire::World::ContentFinder::registerRandomContentRequest( Sapphire::Ent
if( instanceContent->data().RandomContentType == randomContentTypeId ) if( instanceContent->data().RandomContentType == randomContentTypeId )
{ {
if( instanceContent->data().LevelMin <= player.getLevel() ) if( instanceContent->data().LevelMin <= player.getLevel() )
idList.push_back( id ); idList.push_back( instanceContent->data().InstanceContentId );
} }
} }
@ -153,11 +153,8 @@ void Sapphire::World::ContentFinder::completeRegistration( const Sapphire::Entit
auto queuedContent = m_queuedContent[ m_queuedPlayer[ player.getId() ]->getActiveRegisterId() ]; auto queuedContent = m_queuedContent[ m_queuedPlayer[ player.getId() ]->getActiveRegisterId() ];
auto& exdData = Service< Data::ExdData >::ref(); auto& exdData = Service< Data::ExdData >::ref();
auto contentFinderCondition = exdData.getRow< Excel::ContentFinderCondition >( queuedContent->getContentFinderId() );
if( !contentFinderCondition )
return;
auto content = exdData.getRow< Excel::InstanceContent >( contentFinderCondition->data().InstanceContentId ); auto content = exdData.getRow< Excel::InstanceContent >( queuedContent->getInstanceId() );
// Undersized // Undersized
if( flags & 0x01 ) if( flags & 0x01 )
@ -296,7 +293,7 @@ Sapphire::World::ContentFinder::QueuedContentPtrList Sapphire::World::ContentFin
for( auto& it : m_queuedContent ) for( auto& it : m_queuedContent )
{ {
auto& foundContent = it.second; auto& foundContent = it.second;
uint32_t leftContentId = foundContent->getContentFinderId(); uint32_t leftContentId = foundContent->getInstanceId();
if( leftContentId != contentFinderId ) if( leftContentId != contentFinderId )
continue; continue;
@ -372,11 +369,7 @@ void Sapphire::World::ContentFinder::accept( Entity::Player& player )
auto queuedPlayer = m_queuedPlayer[ player.getId() ]; auto queuedPlayer = m_queuedPlayer[ player.getId() ];
auto queuedContent = m_queuedContent[ queuedPlayer->getActiveRegisterId() ]; auto queuedContent = m_queuedContent[ queuedPlayer->getActiveRegisterId() ];
auto contentFinderCondition = exdData.getRow< Excel::ContentFinderCondition >( queuedContent->getContentFinderId() ); auto content = exdData.getRow< Excel::InstanceContent >( queuedContent->getInstanceId() );
if( !contentFinderCondition )
return;
auto content = exdData.getRow< Excel::InstanceContent >( contentFinderCondition->data().InstanceContentId );
// Something has gone quite wrong.. // Something has gone quite wrong..
if( queuedContent->getState() != WaitingForAccept ) if( queuedContent->getState() != WaitingForAccept )
@ -398,7 +391,7 @@ void Sapphire::World::ContentFinder::accept( Entity::Player& player )
} }
Logger::info( "[{2}][ContentFinder] Content accepted, contentId#{0} registerId#{1}", Logger::info( "[{2}][ContentFinder] Content accepted, contentId#{0} registerId#{1}",
queuedContent->getContentFinderId(), queuedContent->getRegisterId(), player.getId() ); queuedContent->getInstanceId(), queuedContent->getRegisterId(), player.getId() );
auto statusPacket = makeNotifyFindContentStatus( player.getId(), content->data().TerritoryType, 4, queuedContent->m_dpsAccepted, auto statusPacket = makeNotifyFindContentStatus( player.getId(), content->data().TerritoryType, 4, queuedContent->m_dpsAccepted,
queuedContent->m_healerAccepted, queuedContent->m_tankAccepted, 0x01 ); queuedContent->m_healerAccepted, queuedContent->m_tankAccepted, 0x01 );
@ -422,11 +415,14 @@ void Sapphire::World::ContentFinder::withdraw( Entity::Player& player )
auto queuedPlayer = m_queuedPlayer[ player.getId() ]; auto queuedPlayer = m_queuedPlayer[ player.getId() ];
auto contentFinderCondition = exdData.getRow< Excel::ContentFinderCondition >( m_queuedContent[ queuedPlayer->getActiveRegisterId() ]->getContentFinderId() ); auto contentInfo = exdData.getRow< Excel::InstanceContent >( m_queuedContent[ queuedPlayer->getActiveRegisterId() ]->getInstanceId() );
if( !contentFinderCondition ) if( !contentInfo )
{
Logger::error( "[{2}] Content withdraw failed, contentId#{0} registerId#{1}",
m_queuedContent[ queuedPlayer->getActiveRegisterId() ]->getInstanceId(),
m_queuedContent[ queuedPlayer->getActiveRegisterId() ]->getRegisterId(), player.getId() );
return; return;
}
auto contentInfo = exdData.getRow< Excel::InstanceContent >( contentFinderCondition->data().InstanceContentId );
// remove the player from the global CF list // remove the player from the global CF list
m_queuedPlayer.erase( player.getId() ); m_queuedPlayer.erase( player.getId() );
@ -442,7 +438,7 @@ void Sapphire::World::ContentFinder::withdraw( Entity::Player& player )
if( content.second->withdrawPlayer( queuedPlayer ) ) if( content.second->withdrawPlayer( queuedPlayer ) )
{ {
Logger::info( "[{2}] Content withdrawn, contentId#{0} registerId#{1}", Logger::info( "[{2}] Content withdrawn, contentId#{0} registerId#{1}",
content.second->getContentFinderId(), content.second->getRegisterId(), player.getId() ); content.second->getInstanceId(), content.second->getRegisterId(), player.getId() );
updateRegisterIdSet.insert( content.second->getRegisterId() ); updateRegisterIdSet.insert( content.second->getRegisterId() );
} }
} }
@ -455,11 +451,7 @@ void Sapphire::World::ContentFinder::withdraw( Entity::Player& player )
if( updateRegisterIdSet.count( regId ) == 0 ) if( updateRegisterIdSet.count( regId ) == 0 )
continue; continue;
auto contentFinderCondition = exdData.getRow< Excel::ContentFinderCondition >( content.second->getContentFinderId() ); auto queuedContentInfo = exdData.getRow< Excel::InstanceContent >( content.second->getInstanceId() );
if( !contentFinderCondition )
return;
auto queuedContentInfo = exdData.getRow< Excel::InstanceContent >( contentFinderCondition->data().InstanceContentId );
auto& playerList = content.second->m_players; auto& playerList = content.second->m_players;
for( const auto& pPlayer : playerList ) for( const auto& pPlayer : playerList )
@ -498,7 +490,7 @@ bool Sapphire::World::ContentFinder::removeContentByRegisterId( uint32_t registe
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
uint32_t Sapphire::World::QueuedContent::getContentFinderId() const uint32_t Sapphire::World::QueuedContent::getInstanceId() const
{ {
return m_contentFinderId; return m_contentFinderId;
} }

View file

@ -67,7 +67,7 @@ namespace Sapphire::World
QueuedContent( uint32_t registerId, uint32_t contentId ); QueuedContent( uint32_t registerId, uint32_t contentId );
~QueuedContent() = default; ~QueuedContent() = default;
uint32_t getRegisterId() const; uint32_t getRegisterId() const;
uint32_t getContentFinderId() const; uint32_t getInstanceId() const;
uint8_t getRoleCount( Sapphire::Common::Role role ) const; uint8_t getRoleCount( Sapphire::Common::Role role ) const;
void queuePlayer( const std::shared_ptr< QueuedPlayer >& pQPlayer ); void queuePlayer( const std::shared_ptr< QueuedPlayer >& pQPlayer );
bool withdrawPlayer( const std::shared_ptr< QueuedPlayer >& pQPlayer ); bool withdrawPlayer( const std::shared_ptr< QueuedPlayer >& pQPlayer );