From 159aafadf63c5b7634297d54c3cf9c9e352af5b0 Mon Sep 17 00:00:00 2001 From: collett Date: Fri, 3 Jan 2020 01:10:42 +0900 Subject: [PATCH] Fix quest reward choice. Quest scripts need to call player.giveQuestRewards( getId(), result.param3 ) for it to work. --- src/world/Actor/PlayerQuest.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/world/Actor/PlayerQuest.cpp b/src/world/Actor/PlayerQuest.cpp index e503a273..0710244f 100644 --- a/src/world/Actor/PlayerQuest.cpp +++ b/src/world/Actor/PlayerQuest.cpp @@ -1067,7 +1067,7 @@ bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t opti if( rewardItemCount > 0 ) { - for( uint32_t i = 0; i < questInfo->itemReward0.size(); i++ ) + for( uint32_t i = 0; i < rewardItemCount; i++ ) { addItem( questInfo->itemReward0.at( i ), questInfo->itemCountReward0.at( i ) ); } @@ -1075,8 +1075,15 @@ bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t opti if( optionalItemCount > 0 ) { - auto itemId = questInfo->itemReward1.at( optionalChoice ); - addItem( itemId, questInfo->itemCountReward1.at( optionalChoice ) ); + for( uint32_t i = 0; i < optionalItemCount; i++ ) + { + auto itemId = questInfo->itemReward1.at( i ); + if( itemId == optionalChoice ) + { + addItem( itemId, questInfo->itemCountReward1.at( i ) ); + break; + } + } } if( gilReward > 0 )