purchase: simplify wallet update

This commit is contained in:
Spirtix 2024-07-15 11:21:58 +02:00
parent b9b17b9f27
commit d4294130d9

View File

@ -2271,19 +2271,12 @@ public class ContentController : Controller {
}
// deduct the cost of the purchase
achievementService.AddAchievementPoints(viking, AchievementPointTypes.GameCurrency, -totalCoinCost);
achievementService.AddAchievementPoints(viking, AchievementPointTypes.CashCurrency, -totalGemCost);
achievementService.AddAchievementPoints(viking, AchievementPointTypes.GameCurrency, -totalCoinCost + gemsToAdd);
achievementService.AddAchievementPoints(viking, AchievementPointTypes.CashCurrency, -totalGemCost + coinsToAdd);
// add items to the inventory (database)
var addedItems = inventoryService.AddItemsToInventoryBulk(viking, inventoryItemsToAdd);
// add gems and coins that were purchased
if (gemsToAdd != 0)
achievementService.AddAchievementPoints(viking, AchievementPointTypes.CashCurrency, gemsToAdd);
if (coinsToAdd != 0)
achievementService.AddAchievementPoints(viking, AchievementPointTypes.GameCurrency, coinsToAdd);
// build response
List<CommonInventoryResponseItem> items = new List<CommonInventoryResponseItem>();
foreach (var i in itemsToSendBack) {