Fixed an issue where repeatable missions were not rewarding the items they should be rewarding (#357)

When applied this fixes issues with repeatable mission were not rewarding the correct items.
This commit is contained in:
David Markowitz 2022-01-14 05:00:09 -08:00 committed by GitHub
parent 24aaa04954
commit 70af1f9314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View File

@ -58,7 +58,7 @@ CDMissionsTable::CDMissionsTable(void) {
entry.reward_item2_repeatable = tableData.getIntField(32, -1); entry.reward_item2_repeatable = tableData.getIntField(32, -1);
entry.reward_item2_repeat_count = tableData.getIntField(33, -1); entry.reward_item2_repeat_count = tableData.getIntField(33, -1);
entry.reward_item3_repeatable = tableData.getIntField(34, -1); entry.reward_item3_repeatable = tableData.getIntField(34, -1);
entry.reward_item3_repeat_count = tableData.getIntField(34, -1); entry.reward_item3_repeat_count = tableData.getIntField(35, -1);
entry.reward_item4_repeatable = tableData.getIntField(36, -1); entry.reward_item4_repeatable = tableData.getIntField(36, -1);
entry.reward_item4_repeat_count = tableData.getIntField(37, -1); entry.reward_item4_repeat_count = tableData.getIntField(37, -1);
entry.time_limit = tableData.getIntField(38, -1); entry.time_limit = tableData.getIntField(38, -1);

View File

@ -438,10 +438,13 @@ void Mission::YieldRewards() {
items.emplace_back(info->reward_item4_repeatable, info->reward_item4_repeat_count); items.emplace_back(info->reward_item4_repeatable, info->reward_item4_repeat_count);
for (const auto& pair : items) { for (const auto& pair : items) {
if (pair.second <= 0 || (m_Reward > 0 && pair.first != m_Reward)) { // Some missions reward zero of an item and so they must be allowed through this clause,
// hence pair.second < 0 instead of pair.second <= 0.
if (pair.second < 0 || (m_Reward > 0 && pair.first != m_Reward)) {
continue; continue;
} }
// If a mission rewards zero of an item, make it reward 1.
auto count = pair.second > 0 ? pair.second : 1; auto count = pair.second > 0 ? pair.second : 1;
// Sanity check, 6 is the max any mission yields // Sanity check, 6 is the max any mission yields
@ -467,10 +470,13 @@ void Mission::YieldRewards() {
items.emplace_back(info->reward_item4, info->reward_item4_count); items.emplace_back(info->reward_item4, info->reward_item4_count);
for (const auto& pair : items) { for (const auto& pair : items) {
// Some missions reward zero of an item and so they must be allowed through this clause,
// hence pair.second < 0 instead of pair.second <= 0.
if (pair.second < 0 || (m_Reward > 0 && pair.first != m_Reward)) { if (pair.second < 0 || (m_Reward > 0 && pair.first != m_Reward)) {
continue; continue;
} }
// If a mission rewards zero of an item, make it reward 1.
auto count = pair.second > 0 ? pair.second : 1; auto count = pair.second > 0 ? pair.second : 1;
// Sanity check, 6 is the max any mission yields // Sanity check, 6 is the max any mission yields

View File

@ -14,15 +14,15 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
if (inventory == nullptr) if (inventory == nullptr)
return; return;
LOT maelstromCubeLot = 14592; LOT maelstromVacuumLot = 14592;
auto* maelstromCube = inventory->FindItemByLot(maelstromCubeLot); auto* maelstromVacuum = inventory->FindItemByLot(maelstromVacuumLot);
// For the daily we add the maelstrom cube if the player doesn't have it yet // For the daily we add the maelstrom vacuum if the player doesn't have it yet
if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
&& maelstromCube == nullptr) { && maelstromVacuum == nullptr) {
inventory->AddItem(maelstromCubeLot, 1); inventory->AddItem(maelstromVacuumLot, 1);
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { } else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
inventory->RemoveItem(maelstromCubeLot, 1); inventory->RemoveItem(maelstromVacuumLot, 1);
} }
// Next up hide or show the samples based on the mission state // Next up hide or show the samples based on the mission state