Added logic to Convert UScore to Coins for Level 45 Characters (#348)

This commit is contained in:
David Markowitz
2022-02-02 22:50:02 -08:00
committed by GitHub
parent dac8ec621c
commit 13980c4133
8 changed files with 54 additions and 16 deletions

View File

@@ -14,6 +14,7 @@
#include "dLocale.h"
#include "dLogger.h"
#include "dServer.h"
#include "dZoneManager.h"
Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) {
m_MissionComponent = missionComponent;
@@ -421,11 +422,15 @@ void Mission::YieldRewards() {
}
}
int32_t coinsToSend = 0;
if (info->LegoScore > 0) {
characterComponent->SetUScore(characterComponent->GetUScore() + info->LegoScore);
if (info->isMission) {
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), info->LegoScore, 2);
eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT;
if(characterComponent->GetLevel() >= dZoneManager::Instance()->GetMaxLevel()) {
// Since the character is at the level cap we reward them with coins instead of UScore.
coinsToSend += info->LegoScore * dZoneManager::Instance()->GetLevelCapCurrencyConversion();
} else {
characterComponent->SetUScore(characterComponent->GetUScore() + info->LegoScore);
GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), info->LegoScore, lootSource);
}
}
@@ -455,8 +460,9 @@ void Mission::YieldRewards() {
inventoryComponent->AddItem(pair.first, count);
}
if (info->reward_currency_repeatable > 0) {
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, LOOT_SOURCE_MISSION);
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT;
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource);
}
return;
@@ -487,9 +493,9 @@ void Mission::YieldRewards() {
inventoryComponent->AddItem(pair.first, count);
}
if (info->reward_currency > 0) {
if (info->reward_currency > 0 || coinsToSend > 0) {
eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT;
character->SetCoins(character->GetCoins() + info->reward_currency, lootSource);
character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource);
}
if (info->reward_maxinventory > 0) {