diff --git a/src/scripts/quest/ManFst001.cpp b/src/scripts/quest/ManFst001.cpp index 1dc24311..3aac8d95 100644 --- a/src/scripts/quest/ManFst001.cpp +++ b/src/scripts/quest/ManFst001.cpp @@ -91,8 +91,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/ManFst002.cpp b/src/scripts/quest/ManFst002.cpp index 27c243d0..4f366771 100644 --- a/src/scripts/quest/ManFst002.cpp +++ b/src/scripts/quest/ManFst002.cpp @@ -143,8 +143,7 @@ private: { if( result.getResult( 0 ) == 1 ) // finish quest { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/ManFst003.cpp b/src/scripts/quest/ManFst003.cpp index 254de820..9b060f9d 100644 --- a/src/scripts/quest/ManFst003.cpp +++ b/src/scripts/quest/ManFst003.cpp @@ -211,10 +211,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/ManFst004.cpp b/src/scripts/quest/ManFst004.cpp index 3613bd7d..42219ac6 100644 --- a/src/scripts/quest/ManFst004.cpp +++ b/src/scripts/quest/ManFst004.cpp @@ -210,10 +210,7 @@ private: { if( result.getResult( 0 ) == 1 ) // finish quest { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/ManFst005.cpp b/src/scripts/quest/ManFst005.cpp index 34e235c1..6e0114de 100644 --- a/src/scripts/quest/ManFst005.cpp +++ b/src/scripts/quest/ManFst005.cpp @@ -238,10 +238,7 @@ private: void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result ) { if( result.getResult( 0 ) == 1 ) - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } ////////////////////////////////////////////////////////////////////// diff --git a/src/scripts/quest/ManSea001.cpp b/src/scripts/quest/ManSea001.cpp index b0c113d4..571cf385 100644 --- a/src/scripts/quest/ManSea001.cpp +++ b/src/scripts/quest/ManSea001.cpp @@ -129,8 +129,7 @@ private: { if( result.getResult( 0 ) == 1 ) // finish quest { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } ); } diff --git a/src/scripts/quest/ManSea002.cpp b/src/scripts/quest/ManSea002.cpp index 239a204f..a8adc8a8 100644 --- a/src/scripts/quest/ManSea002.cpp +++ b/src/scripts/quest/ManSea002.cpp @@ -203,10 +203,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } } ); } diff --git a/src/scripts/quest/ManSea003.cpp b/src/scripts/quest/ManSea003.cpp index 137ace69..259e2c3c 100644 --- a/src/scripts/quest/ManSea003.cpp +++ b/src/scripts/quest/ManSea003.cpp @@ -220,10 +220,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } } ); } diff --git a/src/scripts/quest/ManWil001.cpp b/src/scripts/quest/ManWil001.cpp index 47e2b4af..d24cd500 100644 --- a/src/scripts/quest/ManWil001.cpp +++ b/src/scripts/quest/ManWil001.cpp @@ -141,8 +141,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/ManWil002.cpp b/src/scripts/quest/ManWil002.cpp index 9f07d245..052cf18a 100644 --- a/src/scripts/quest/ManWil002.cpp +++ b/src/scripts/quest/ManWil002.cpp @@ -213,10 +213,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/ManWil003.cpp b/src/scripts/quest/ManWil003.cpp index 56d8e548..a63d1a9c 100644 --- a/src/scripts/quest/ManWil003.cpp +++ b/src/scripts/quest/ManWil003.cpp @@ -226,10 +226,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } } ); } diff --git a/src/scripts/quest/ManWil004.cpp b/src/scripts/quest/ManWil004.cpp index 35942dbd..57118898 100644 --- a/src/scripts/quest/ManWil004.cpp +++ b/src/scripts/quest/ManWil004.cpp @@ -229,10 +229,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - player.finishQuest( getId() ); - } + player.finishQuest( getId(), result.getResult( 1 ) ); } } ); } diff --git a/src/scripts/quest/classquest/ARC/ClsArc004.cpp b/src/scripts/quest/classquest/ARC/ClsArc004.cpp index 9dffe406..be24bdca 100644 --- a/src/scripts/quest/classquest/ARC/ClsArc004.cpp +++ b/src/scripts/quest/classquest/ARC/ClsArc004.cpp @@ -466,8 +466,7 @@ class ClsArc004 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), result.getResult(1)) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/classquest/ARC/ClsArc005.cpp b/src/scripts/quest/classquest/ARC/ClsArc005.cpp index 6b7df180..f284f8df 100644 --- a/src/scripts/quest/classquest/ARC/ClsArc005.cpp +++ b/src/scripts/quest/classquest/ARC/ClsArc005.cpp @@ -269,8 +269,7 @@ class ClsArc005 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), result.getResult(1)) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/classquest/ARC/ClsArc006.cpp b/src/scripts/quest/classquest/ARC/ClsArc006.cpp index 5212cbff..14c6fddf 100644 --- a/src/scripts/quest/classquest/ARC/ClsArc006.cpp +++ b/src/scripts/quest/classquest/ARC/ClsArc006.cpp @@ -341,8 +341,7 @@ class ClsArc006 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), result.getResult(1)) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst001.cpp b/src/scripts/quest/subquest/gridania/SubFst001.cpp index cb100f68..72154e87 100644 --- a/src/scripts/quest/subquest/gridania/SubFst001.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst001.cpp @@ -133,8 +133,7 @@ private: if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst003.cpp b/src/scripts/quest/subquest/gridania/SubFst003.cpp index ef3a5f39..56c3794e 100644 --- a/src/scripts/quest/subquest/gridania/SubFst003.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst003.cpp @@ -125,9 +125,7 @@ private: if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - quest.setUI8BH( 0 ); - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst004.cpp b/src/scripts/quest/subquest/gridania/SubFst004.cpp index 569a6d4b..998664f5 100644 --- a/src/scripts/quest/subquest/gridania/SubFst004.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst004.cpp @@ -145,8 +145,7 @@ class SubFst004 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst005.cpp b/src/scripts/quest/subquest/gridania/SubFst005.cpp index cec9406f..41652b8a 100644 --- a/src/scripts/quest/subquest/gridania/SubFst005.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst005.cpp @@ -84,8 +84,7 @@ private: { if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst008.cpp b/src/scripts/quest/subquest/gridania/SubFst008.cpp index 32e492ec..7ea004f2 100644 --- a/src/scripts/quest/subquest/gridania/SubFst008.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst008.cpp @@ -147,8 +147,7 @@ private: if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), result.getResult( 1 ) ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst009.cpp b/src/scripts/quest/subquest/gridania/SubFst009.cpp index 4a7fed58..7abdb4ca 100644 --- a/src/scripts/quest/subquest/gridania/SubFst009.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst009.cpp @@ -123,8 +123,7 @@ class SubFst009 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst010.cpp b/src/scripts/quest/subquest/gridania/SubFst010.cpp index 718dcfce..5c53aa23 100644 --- a/src/scripts/quest/subquest/gridania/SubFst010.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst010.cpp @@ -86,8 +86,7 @@ class SubFst010 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst013.cpp b/src/scripts/quest/subquest/gridania/SubFst013.cpp index 4d8025fd..9df6d2e3 100644 --- a/src/scripts/quest/subquest/gridania/SubFst013.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst013.cpp @@ -191,8 +191,7 @@ class SubFst013 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst014.cpp b/src/scripts/quest/subquest/gridania/SubFst014.cpp index 5d17da3d..ccde1b2f 100644 --- a/src/scripts/quest/subquest/gridania/SubFst014.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst014.cpp @@ -270,8 +270,7 @@ class SubFst014 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst015.cpp b/src/scripts/quest/subquest/gridania/SubFst015.cpp index 3edec7a8..ac26d033 100644 --- a/src/scripts/quest/subquest/gridania/SubFst015.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst015.cpp @@ -246,8 +246,7 @@ class SubFst015 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst019.cpp b/src/scripts/quest/subquest/gridania/SubFst019.cpp index 2db7eaba..3ca663c7 100644 --- a/src/scripts/quest/subquest/gridania/SubFst019.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst019.cpp @@ -91,8 +91,7 @@ class SubFst019 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst029.cpp b/src/scripts/quest/subquest/gridania/SubFst029.cpp index b13dfdef..1216e1a2 100644 --- a/src/scripts/quest/subquest/gridania/SubFst029.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst029.cpp @@ -119,8 +119,7 @@ class SubFst029 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst030.cpp b/src/scripts/quest/subquest/gridania/SubFst030.cpp index 4839937c..56f3a6ad 100644 --- a/src/scripts/quest/subquest/gridania/SubFst030.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst030.cpp @@ -167,8 +167,7 @@ class SubFst030 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst043.cpp b/src/scripts/quest/subquest/gridania/SubFst043.cpp index 6aba80cb..51882dec 100644 --- a/src/scripts/quest/subquest/gridania/SubFst043.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst043.cpp @@ -164,12 +164,7 @@ class SubFst043 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - { - quest.setUI8BH(0); - player.finishQuest(getId()); - } - + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst045.cpp b/src/scripts/quest/subquest/gridania/SubFst045.cpp index 48619ff2..67fdd993 100644 --- a/src/scripts/quest/subquest/gridania/SubFst045.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst045.cpp @@ -88,8 +88,7 @@ class SubFst045 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst046.cpp b/src/scripts/quest/subquest/gridania/SubFst046.cpp index d49420ef..71368e1b 100644 --- a/src/scripts/quest/subquest/gridania/SubFst046.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst046.cpp @@ -169,8 +169,7 @@ class SubFst046 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/gridania/SubFst048.cpp b/src/scripts/quest/subquest/gridania/SubFst048.cpp index 5765753d..324c9c67 100644 --- a/src/scripts/quest/subquest/gridania/SubFst048.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst048.cpp @@ -167,8 +167,7 @@ class SubFst048 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), result.getResult(1)) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/limsa/SubSea001.cpp b/src/scripts/quest/subquest/limsa/SubSea001.cpp index b25b9140..bcd16ecf 100644 --- a/src/scripts/quest/subquest/limsa/SubSea001.cpp +++ b/src/scripts/quest/subquest/limsa/SubSea001.cpp @@ -411,8 +411,7 @@ class SubSea001 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil000.cpp b/src/scripts/quest/subquest/uldah/SubWil000.cpp index 2fc8829a..deb1c266 100644 --- a/src/scripts/quest/subquest/uldah/SubWil000.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil000.cpp @@ -123,8 +123,7 @@ class SubWil000 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil001.cpp b/src/scripts/quest/subquest/uldah/SubWil001.cpp index b3df60d1..b6285f0f 100644 --- a/src/scripts/quest/subquest/uldah/SubWil001.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil001.cpp @@ -93,8 +93,7 @@ class SubWil001 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil002.cpp b/src/scripts/quest/subquest/uldah/SubWil002.cpp index 15c39bef..84bc4e40 100644 --- a/src/scripts/quest/subquest/uldah/SubWil002.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil002.cpp @@ -127,8 +127,7 @@ class SubWil002 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil004.cpp b/src/scripts/quest/subquest/uldah/SubWil004.cpp index 8d9e5b99..1ba9af6f 100644 --- a/src/scripts/quest/subquest/uldah/SubWil004.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil004.cpp @@ -250,8 +250,7 @@ class SubWil004 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil006.cpp b/src/scripts/quest/subquest/uldah/SubWil006.cpp index d28e10cf..4dcf2bd8 100644 --- a/src/scripts/quest/subquest/uldah/SubWil006.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil006.cpp @@ -140,8 +140,7 @@ class SubWil006 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil007.cpp b/src/scripts/quest/subquest/uldah/SubWil007.cpp index c5c87d42..8ea7bab7 100644 --- a/src/scripts/quest/subquest/uldah/SubWil007.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil007.cpp @@ -404,8 +404,7 @@ class SubWil007 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil018.cpp b/src/scripts/quest/subquest/uldah/SubWil018.cpp index 188c146e..6a25dfcb 100644 --- a/src/scripts/quest/subquest/uldah/SubWil018.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil018.cpp @@ -341,8 +341,7 @@ class SubWil018 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil019.cpp b/src/scripts/quest/subquest/uldah/SubWil019.cpp index ab8b6da4..e00aae68 100644 --- a/src/scripts/quest/subquest/uldah/SubWil019.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil019.cpp @@ -89,8 +89,7 @@ class SubWil019 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil020.cpp b/src/scripts/quest/subquest/uldah/SubWil020.cpp index d48e9792..69e63937 100644 --- a/src/scripts/quest/subquest/uldah/SubWil020.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil020.cpp @@ -416,8 +416,7 @@ class SubWil020 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil021.cpp b/src/scripts/quest/subquest/uldah/SubWil021.cpp index 7a8bb6e5..33391177 100644 --- a/src/scripts/quest/subquest/uldah/SubWil021.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil021.cpp @@ -123,8 +123,7 @@ class SubWil021 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil022.cpp b/src/scripts/quest/subquest/uldah/SubWil022.cpp index b13bada3..b62eb095 100644 --- a/src/scripts/quest/subquest/uldah/SubWil022.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil022.cpp @@ -123,8 +123,7 @@ class SubWil022 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil027.cpp b/src/scripts/quest/subquest/uldah/SubWil027.cpp index 5c3e2fe8..b76cf299 100644 --- a/src/scripts/quest/subquest/uldah/SubWil027.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil027.cpp @@ -89,8 +89,7 @@ class SubWil027 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil028.cpp b/src/scripts/quest/subquest/uldah/SubWil028.cpp index 674a4951..feaa0068 100644 --- a/src/scripts/quest/subquest/uldah/SubWil028.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil028.cpp @@ -107,8 +107,7 @@ class SubWil028 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/scripts/quest/subquest/uldah/SubWil029.cpp b/src/scripts/quest/subquest/uldah/SubWil029.cpp index 999b25c5..13e8267e 100644 --- a/src/scripts/quest/subquest/uldah/SubWil029.cpp +++ b/src/scripts/quest/subquest/uldah/SubWil029.cpp @@ -128,8 +128,7 @@ class SubWil029 : public Sapphire::ScriptAPI::QuestScript if( result.getResult( 0 ) == 1 ) { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); + player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index e33ea974..f7f8aa21 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -114,7 +114,7 @@ namespace Sapphire::Entity int16_t getQuestTracking( uint8_t index ) const; /*! finish a given quest */ - void finishQuest( uint16_t questId, uint8_t optionalChoice = 0 ); + void finishQuest( uint16_t questId, uint32_t optionalChoice = 0 ); /*! finish a given quest */ void unfinishQuest( uint16_t questId ); @@ -134,8 +134,6 @@ namespace Sapphire::Entity /*! set te current opening sequence */ void setOpeningSequence( uint8_t seq ); - bool giveQuestRewards( uint32_t questId, uint32_t optionalChoice ); - std::array< World::Quest, 30 >& getQuestArrayRef(); QuestComplete& getQuestCompleteFlags(); diff --git a/src/world/Actor/PlayerQuest.cpp b/src/world/Actor/PlayerQuest.cpp index 2936bf41..cbc68d57 100644 --- a/src/world/Actor/PlayerQuest.cpp +++ b/src/world/Actor/PlayerQuest.cpp @@ -17,12 +17,14 @@ using namespace Sapphire::Common; using namespace Sapphire::Network::Packets; using namespace Sapphire::Network::Packets::WorldPackets::Server; -void Sapphire::Entity::Player::finishQuest( uint16_t questId, uint8_t optionalChoice ) +void Sapphire::Entity::Player::finishQuest( uint16_t questId, uint32_t optionalChoice ) { removeQuest( questId ); auto& questMgr = Common::Service< World::Manager::QuestMgr >::ref(); - questMgr.onCompleteQuest( *this, questId ); + + //@todo should probably be changed to a bool function in case reward can not be obtained as quests will not complete in that case + questMgr.onCompleteQuest( *this, questId, optionalChoice ); updateQuestsCompleted( questId ); } @@ -167,56 +169,6 @@ void Sapphire::Entity::Player::removeQuestsCompleted( uint32_t questId ) } -bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optionalChoice ) -{ - auto& exdData = Common::Service< Data::ExdData >::ref(); - uint32_t playerLevel = getLevel(); - auto questInfo = exdData.getRow< Component::Excel::Quest >( questId ); - - - if( !questInfo ) - return false; - - auto paramGrowth = exdData.getRow< Component::Excel::ParamGrow >( questInfo->data().ClassLevel ); - - uint32_t exp = - ( questInfo->data().Reward.ExpBonus * paramGrowth->data().BaseExp * paramGrowth->data().EventExpRate ) / 100; - - //exp = questInfo->data().Reward.ExpBonus; - - //auto rewardItemCount = questInfo->data().Reward.itemReward0.size(); - //uint16_t optionalItemCount = static_cast< uint16_t >( questInfo->itemReward1.size() ); - - uint32_t gilReward = questInfo->data().Reward.Gil; - - // TODO: check if there is room in inventory, else return false; - if( exp > 0 ) - gainExp( exp ); - - - for( uint32_t i = 0; i < 6; i++ ) - { - if( questInfo->data().Reward.Item[ i ] != 0 ) - addItem( questInfo->data().Reward.Item[ i ], questInfo->data().Reward.ItemNum[ i ] ); - } - - for( uint32_t i = 0; i < 5; i++ ) - { - auto itemId = questInfo->data().Reward.OptionalItem[ i ]; - if( itemId == optionalChoice ) - { - addItem( itemId, questInfo->data().Reward.OptionalItemNum[ i ] ); - break; - } - } - - - if( gilReward > 0 ) - addCurrency( CurrencyType::Gil, gilReward ); - - return true; -} - Sapphire::World::Quest& Sapphire::Entity::Player::getQuestByIndex( uint16_t index ) { return m_quests[ index ]; diff --git a/src/world/Manager/QuestMgr.cpp b/src/world/Manager/QuestMgr.cpp index c27b6b3e..98f9263e 100644 --- a/src/world/Manager/QuestMgr.cpp +++ b/src/world/Manager/QuestMgr.cpp @@ -32,7 +32,7 @@ void Sapphire::World::Manager::QuestMgr::onUpdateQuest( Entity::Player& player, sendQuestTracker( player ); } -void Sapphire::World::Manager::QuestMgr::onCompleteQuest( Entity::Player& player, uint16_t questId ) +void Sapphire::World::Manager::QuestMgr::onCompleteQuest( Entity::Player& player, uint16_t questId, uint32_t optionalChoice ) { auto& server = Common::Service< World::WorldServer >::ref(); auto questFinishPacket = makeZonePacket< FFXIVIpcQuestFinish >( player.getId() ); @@ -40,9 +40,11 @@ void Sapphire::World::Manager::QuestMgr::onCompleteQuest( Entity::Player& player questFinishPacket->data().flag1 = 1; questFinishPacket->data().flag2 = 1; server.queueForPlayer( player.getCharacterId(), questFinishPacket ); + + giveQuestRewards( player, questId, optionalChoice ); } -void Sapphire::World::Manager::QuestMgr::onRemoveQuest( Sapphire::Entity::Player &player, uint8_t questIndex ) +void Sapphire::World::Manager::QuestMgr::onRemoveQuest( Entity::Player &player, uint8_t questIndex ) { auto& server = Common::Service< World::WorldServer >::ref(); auto questUpdatePacket = makeZonePacket< FFXIVIpcQuest >( player.getId() ); @@ -54,6 +56,44 @@ void Sapphire::World::Manager::QuestMgr::onRemoveQuest( Sapphire::Entity::Player sendQuestTracker( player ); } +bool Sapphire::World::Manager::QuestMgr::giveQuestRewards( Entity::Player& player, uint16_t questId, uint32_t optionalChoice ) +{ + auto& exdData = Common::Service< Data::ExdData >::ref(); + uint32_t playerLevel = player.getLevel(); + auto questInfo = exdData.getRow< Component::Excel::Quest >( static_cast< uint32_t >( Event::EventHandler::EventHandlerType::Quest ) << 16 | questId ); + + if( !questInfo ) + return false; + auto paramGrowth = exdData.getRow< Component::Excel::ParamGrow >( questInfo->data().ClassLevel ); + uint32_t exp = ( questInfo->data().Reward.ExpBonus * paramGrowth->data().BaseExp * paramGrowth->data().EventExpRate ) / 100; + uint32_t gilReward = questInfo->data().Reward.Gil; + + // TODO: check if there is room in inventory, else return false; + if( exp > 0 ) + player.gainExp( exp ); + + for( uint32_t i = 0; i < 6; i++ ) + { + if( questInfo->data().Reward.Item[ i ] != 0 ) + player.addItem( questInfo->data().Reward.Item[ i ], questInfo->data().Reward.ItemNum[ i ] ); + } + + for( uint32_t i = 0; i < 5; i++ ) + { + auto itemId = questInfo->data().Reward.OptionalItem[ i ]; + if( itemId == optionalChoice ) + { + player.addItem( itemId, questInfo->data().Reward.OptionalItemNum[ i ] ); + break; + } + } + + if( gilReward > 0 ) + player.addCurrency( CurrencyType::Gil, gilReward ); + + return true; +} + /////////////////////////////////////////////////////////////////////////////////////////////////////////// void Sapphire::World::Manager::QuestMgr::sendQuestTracker( Entity::Player& player ) diff --git a/src/world/Manager/QuestMgr.h b/src/world/Manager/QuestMgr.h index cbd20357..eafb6233 100644 --- a/src/world/Manager/QuestMgr.h +++ b/src/world/Manager/QuestMgr.h @@ -15,7 +15,7 @@ namespace Sapphire::World::Manager /// Perform required actions for events void onUpdateQuest( Entity::Player& player, uint8_t questIndex ); void onRemoveQuest( Entity::Player& player, uint8_t questIndex ); - void onCompleteQuest( Entity::Player& player, uint16_t questId ); + void onCompleteQuest( Entity::Player& player, uint16_t questId, uint32_t optionalChoice = 0 ); //////////////////// @@ -24,6 +24,8 @@ namespace Sapphire::World::Manager void sendQuestsInfo( Entity::Player& player ); + bool giveQuestRewards( Entity::Player& player, uint16_t questId, uint32_t optionalChoice ); + }; }