1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 22:17:45 +00:00

Merge pull request #648 from Sophira/discover-exp

Additional EXP bonus on full map completion
This commit is contained in:
Adam 2020-03-03 20:15:19 +11:00 committed by GitHub
commit ab1d4f3373
2 changed files with 31 additions and 5 deletions

View file

@ -221,7 +221,7 @@ namespace Sapphire::Network::Packets
WeatherChange = 0x02FB, // updated 5.11
PlayerTitleList = 0x037D, // updated 5.1
Discovery = 0x02E7, // updated 5.18
Discovery = 0x0091, // updated 5.2
EorzeaTimeOffset = 0x03B8, // updated 5.1
@ -334,7 +334,7 @@ namespace Sapphire::Network::Packets
ZoneLineHandler = 0x00B9, // updated 5.2
ClientTrigger = 0x017C, // updated 5.2
DiscoveryHandler = 0x017B, // updated 5.18
DiscoveryHandler = 0x019A, // updated 5.2
PlaceFieldMarker = 0x013C, // updated 5.0
SkillHandler = 0x0225, // updated 5.2

View file

@ -603,8 +603,13 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
int32_t offset = 4;
auto info = exdData.get< Sapphire::Data::Map >(
exdData.get< Sapphire::Data::TerritoryType >( getCurrentTerritory()->getTerritoryTypeId() )->map );
auto info = exdData.get< Sapphire::Data::Map >( map_id );
if ( !info )
{
sendDebug( "discover(): Could not obtain map data for map_id == {0}", map_id );
return;
}
if( info->discoveryArrayByte )
offset = 5 + 2 * info->discoveryIndex;
else
@ -623,7 +628,28 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
gainExp( exp );
// gain 10x additional EXP if entire map is completed
uint32_t mask = info->discoveryFlag;
uint32_t discoveredAreas;
if( info->discoveryArrayByte )
{
discoveredAreas = ( m_discovery[ offset + 1 ] << 8 ) |
m_discovery[ offset ];
}
else
{
discoveredAreas = ( m_discovery[ offset + 3 ] << 24 ) |
( m_discovery[ offset + 2 ] << 16 ) |
( m_discovery[ offset + 1 ] << 8 ) |
m_discovery[ offset ];
}
bool allDiscovered = ( ( discoveredAreas & mask ) == mask );
if( allDiscovered )
{
gainExp( exp * 10 );
}
}
bool Sapphire::Entity::Player::isNewAdventurer() const
@ -2179,4 +2205,4 @@ bool Sapphire::Entity::Player::checkAction()
}
return true;
}
}