1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-20 11:47:47 +00:00

Add an enum for content flags instead of using magic numbers

This commit is contained in:
Rushi 2025-01-17 21:16:58 +01:00
parent a5919cbbd2
commit bb17030c68
2 changed files with 11 additions and 8 deletions

View file

@ -54,14 +54,10 @@ void World::ContentFinder::update()
{ {
uint32_t inProgress = 0; // 0x01 - in progress uint32_t inProgress = 0; // 0x01 - in progress
uint32_t dutyProgress = 0; uint32_t dutyProgress = 0;
uint32_t flags = 0; // 0x20 freerole, 0x40 ownrequest, 0x100 random // uint32_t flags = 0; // 0x20 freerole, 0x40 ownrequest, 0x100 random
// Undersized
if( content->m_flags & 0x01 )
flags |= 0x20;
auto finishContentMatchPacket = makeFinishContentMatchToClient( queuedPlayer->getEntityId(), contentInfo->data().TerritoryType, auto finishContentMatchPacket = makeFinishContentMatchToClient( queuedPlayer->getEntityId(), contentInfo->data().TerritoryType,
queuedPlayer->m_classJob, content->m_players.size(), dutyProgress, flags ); queuedPlayer->m_classJob, content->m_players.size(), dutyProgress, content->m_flags );
server.queueForPlayer( queuedPlayer->getCharacterId(), finishContentMatchPacket ); server.queueForPlayer( queuedPlayer->getCharacterId(), finishContentMatchPacket );
} }
@ -161,14 +157,14 @@ void World::ContentFinder::completeRegistration( const Entity::Player &player, u
if( flags & 0x01 ) if( flags & 0x01 )
{ {
auto updatePacket = makeUpdateFindContent( player.getId(), content->data().TerritoryType, auto updatePacket = makeUpdateFindContent( player.getId(), content->data().TerritoryType,
CompleteRegistration, 1, static_cast< uint32_t >( player.getClass() ), 0x20 ); CompleteRegistration, 1, static_cast< uint32_t >( player.getClass() ), FindContentFlag::Undersized );
server.queueForPlayer( player.getCharacterId(), updatePacket ); server.queueForPlayer( player.getCharacterId(), updatePacket );
auto statusPacket = makeNotifyFindContentStatus( player.getId(), content->data().TerritoryType, 2, queuedContent->m_attackerCount + queuedContent->m_rangeCount, auto statusPacket = makeNotifyFindContentStatus( player.getId(), content->data().TerritoryType, 2, queuedContent->m_attackerCount + queuedContent->m_rangeCount,
queuedContent->m_healerCount, queuedContent->m_tankCount, 0 ); queuedContent->m_healerCount, queuedContent->m_tankCount, 0 );
server.queueForPlayer( player.getCharacterId(), statusPacket ); server.queueForPlayer( player.getCharacterId(), statusPacket );
queuedContent->m_flags = flags; queuedContent->m_flags |= FindContentFlag::Undersized;
queuedContent->setState( MatchingComplete ); queuedContent->setState( MatchingComplete );
} }
else else

View file

@ -6,6 +6,13 @@
namespace Sapphire::World namespace Sapphire::World
{ {
enum FindContentFlag : uint32_t
{
Undersized = 0x20,
OwnRequest = 0x40,
Random = 0x100
};
enum UpdateFindContentKind : uint8_t enum UpdateFindContentKind : uint8_t
{ {
CompleteRegistration = 0, // value1 is used to call setResultFindSuccess if bit1 or bit2 is set, value2 is passed to setFindInfo CompleteRegistration = 0, // value1 is used to call setResultFindSuccess if bit1 or bit2 is set, value2 is passed to setFindInfo