Refactored if statement for coins

Refactored the if statement for coins so there is only one SetCoins call for the function.
This commit is contained in:
EmosewaMC 2021-12-23 18:49:01 -08:00
parent 6aad799f95
commit e84811bdce

View File

@ -453,7 +453,7 @@ void Mission::YieldRewards() {
} }
if (info->reward_currency_repeatable > 0) { if (info->reward_currency_repeatable > 0) {
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, COIN_SOURCE_MISSION); character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, LOOT_SOURCE_MISSION);
} }
return; return;
@ -481,10 +481,14 @@ void Mission::YieldRewards() {
inventoryComponent->AddItem(pair.first, count); inventoryComponent->AddItem(pair.first, count);
} }
if (info->reward_currency > 0 && info->isMission) { int32_t lootSource = LOOT_SOURCE_NONE;
character->SetCoins(character->GetCoins() + info->reward_currency, COIN_SOURCE_MISSION); if (info->reward_currency > 0) {
} else if (info->reward_currency && !info->isMission) { if(info->isMission) {
character->SetCoins(character->GetCoins() + info->reward_currency, COIN_SOURCE_ACHIEVEMENT); lootSource = LOOT_SOURCE_MISSION;
} else {
lootSource = LOOT_SOURCE_ACHIEVEMENT;
}
character->SetCoins(character->GetCoins() + info->reward_currency, lootSource);
} }
if (info->reward_maxinventory > 0) { if (info->reward_maxinventory > 0) {