1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 16:57:47 +00:00

Fix quest completion for questId > 2047 (67583)

It's currently impossible to permanently store quest completion flags
for quests beyond questId 2047 (67583) due to the code using a type
that's too small. This manifests in the correct quest completion packet
being sent, but as soon as you move to another zone the quest disappears
from the journal (and is probably replaced by another quest you didn't
ask for).

This fixes the issue by using an appropriately-sized index variable, and
also increases the flag storage so that all currently-available quests
can be stored.
This commit is contained in:
Sophie Hamilton 2020-05-28 05:22:49 +01:00
parent a22e821845
commit 0902d31980
2 changed files with 3 additions and 3 deletions

View file

@ -1070,7 +1070,7 @@ namespace Sapphire::Entity
uint8_t m_homePoint; uint8_t m_homePoint;
uint8_t m_startTown; uint8_t m_startTown;
uint16_t m_townWarpFstFlags; uint16_t m_townWarpFstFlags;
uint8_t m_questCompleteFlags[476]; uint8_t m_questCompleteFlags[487];
uint8_t m_discovery[445]; uint8_t m_discovery[445];
uint32_t m_playTime; uint32_t m_playTime;

View file

@ -1015,7 +1015,7 @@ Sapphire::Entity::Player::sendQuestMessage( uint32_t questId, int8_t msgId, uint
void Sapphire::Entity::Player::updateQuestsCompleted( uint32_t questId ) void Sapphire::Entity::Player::updateQuestsCompleted( uint32_t questId )
{ {
uint8_t index = questId / 8; uint16_t index = questId / 8;
uint8_t bitIndex = ( questId ) % 8; uint8_t bitIndex = ( questId ) % 8;
uint8_t value = 0x80 >> bitIndex; uint8_t value = 0x80 >> bitIndex;
@ -1025,7 +1025,7 @@ void Sapphire::Entity::Player::updateQuestsCompleted( uint32_t questId )
void Sapphire::Entity::Player::removeQuestsCompleted( uint32_t questId ) void Sapphire::Entity::Player::removeQuestsCompleted( uint32_t questId )
{ {
uint8_t index = questId / 8; uint16_t index = questId / 8;
uint8_t bitIndex = ( questId ) % 8; uint8_t bitIndex = ( questId ) % 8;
uint8_t value = 0x80 >> bitIndex; uint8_t value = 0x80 >> bitIndex;