From f8236147a66a9887cc352ea1bbb36b5cf0e2d922 Mon Sep 17 00:00:00 2001 From: Sophie Hamilton Date: Mon, 2 Mar 2020 08:52:28 +0000 Subject: [PATCH] Additional EXP bonus on full map completion When the map is fully completed, gain an additional EXP bonus equal to 10 times the regular amount. --- src/world/Actor/Player.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index cd8d6c79..89ead563 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -622,7 +622,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