mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-04 09:47:46 +00:00
Add method for quest completion
This commit is contained in:
parent
e7fb339eef
commit
50102e0ff0
2 changed files with 12 additions and 0 deletions
|
@ -107,6 +107,8 @@ namespace Sapphire::Entity
|
|||
/*! remove a given quest */
|
||||
void removeQuest( uint16_t questId );
|
||||
|
||||
bool isQuestCompleted( uint32_t questId );
|
||||
|
||||
/*! add a quest to the completed quests mask */
|
||||
void updateQuestsCompleted( uint32_t questId );
|
||||
|
||||
|
|
|
@ -152,6 +152,16 @@ void Sapphire::Entity::Player::updateQuestsCompleted( uint32_t questId )
|
|||
m_questCompleteFlags[ index ] |= value;
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::isQuestCompleted( uint32_t questId )
|
||||
{
|
||||
uint8_t index = questId / 8;
|
||||
uint8_t bitIndex = ( questId ) % 8;
|
||||
|
||||
uint8_t value = 0x80 >> bitIndex;
|
||||
|
||||
return m_questCompleteFlags[ index ] & value;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::removeQuestsCompleted( uint32_t questId )
|
||||
{
|
||||
uint8_t index = questId / 8;
|
||||
|
|
Loading…
Add table
Reference in a new issue