From 138fffda2ce51559621b3e5d48fdb0884cdb8f05 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 6 Jul 2022 08:54:41 -0700 Subject: [PATCH] Fix item collection missions (#617) * Implement Precompiled Headers * fix cmake * Fix modular builds not returning parts Modular builds would not search inventory A for their corresponding item and by default would only look in the models bag. This PR forces the item to be looked for in the inventory its coming from (inventoryA) as a second resort before doing the final search in the default inventory of the item. Tested modular building a car and a rocket and when replacing parts the part that was already placed was returned to the inventory correctly. * Push equipped items upon entering build mode Fixes an issue where leaving build mode anywhere would not re-equip your items. This also implements the feature to set your stats back to full, as was done in the live game. Tested exiting build mode on a property with full venture gear and all gear was re-equipped and stats were set to the expected values. * Fix item collection missions Item collection missions are only supposed to take items should they be in the items inventory or the hidden inventory and no others. This change removes the global inventory find of items and only removes it from the two inventories that items get taken from in live, ITEMS and HIDDEN Tested completing mission 470 and 477 as well as 622 and the correct items were taken or not taken, based on the inventory the target item was in. --- dGame/dMission/Mission.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index 31987505..aeb26838 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -421,7 +421,9 @@ void Mission::YieldRewards() { if (param.empty() || (param[0] & 1) == 0) // Should items be removed? { for (const auto target : task->GetAllTargets()) { - inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue); + // This is how live did it. ONLY remove item collection items from the items and hidden inventories and none of the others. + inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::ITEMS); + inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::HIDDEN); missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, target, LWOOBJID_EMPTY, "", -task->GetClientInfo().targetValue); }