From 0902d31980ff70087138e25fad57e2fa7038f488 Mon Sep 17 00:00:00 2001 From: Sophie Hamilton Date: Thu, 28 May 2020 05:22:49 +0100 Subject: [PATCH] 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. --- src/world/Actor/Player.h | 2 +- src/world/Actor/PlayerQuest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 926c995c..32660358 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -1070,7 +1070,7 @@ namespace Sapphire::Entity uint8_t m_homePoint; uint8_t m_startTown; uint16_t m_townWarpFstFlags; - uint8_t m_questCompleteFlags[476]; + uint8_t m_questCompleteFlags[487]; uint8_t m_discovery[445]; uint32_t m_playTime; diff --git a/src/world/Actor/PlayerQuest.cpp b/src/world/Actor/PlayerQuest.cpp index f3b29c16..fc1ff9ac 100644 --- a/src/world/Actor/PlayerQuest.cpp +++ b/src/world/Actor/PlayerQuest.cpp @@ -1015,7 +1015,7 @@ Sapphire::Entity::Player::sendQuestMessage( uint32_t questId, int8_t msgId, uint 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 value = 0x80 >> bitIndex; @@ -1025,7 +1025,7 @@ void Sapphire::Entity::Player::updateQuestsCompleted( 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 value = 0x80 >> bitIndex;