v0.12.0.2

This commit is contained in:
Joonas Rikkonen
2021-02-10 17:08:21 +02:00
parent 5c80a59bdd
commit 694cdfee7b
353 changed files with 12897 additions and 5028 deletions
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
namespace Barotrauma
{
@@ -6,9 +7,12 @@ namespace Barotrauma
{
public void SellBackPurchasedItems(List<PurchasedItem> itemsToSell)
{
// Check all the prices before starting the transaction
// to make sure the modifiers stay the same for the whole transaction
Dictionary<ItemPrefab, int> buyValues = GetBuyValuesAtCurrentLocation(itemsToSell.Select(i => i.ItemPrefab));
foreach (PurchasedItem item in itemsToSell)
{
var itemValue = GetBuyValueAtCurrentLocation(item);
var itemValue = item.Quantity * buyValues[item.ItemPrefab];
Location.StoreCurrentBalance -= itemValue;
campaign.Money += itemValue;
PurchasedItems.Remove(item);
@@ -17,9 +21,12 @@ namespace Barotrauma
public void BuyBackSoldItems(List<SoldItem> itemsToBuy)
{
// Check all the prices before starting the transaction
// to make sure the modifiers stay the same for the whole transaction
Dictionary<ItemPrefab, int> sellValues = GetSellValuesAtCurrentLocation(itemsToBuy.Select(i => i.ItemPrefab));
foreach (SoldItem item in itemsToBuy)
{
var itemValue = GetSellValueAtCurrentLocation(item.ItemPrefab);
var itemValue = sellValues[item.ItemPrefab];
if (Location.StoreCurrentBalance < itemValue || item.Removed) { continue; }
Location.StoreCurrentBalance += itemValue;
campaign.Money -= itemValue;
@@ -29,10 +36,13 @@ namespace Barotrauma
public void SellItems(List<SoldItem> itemsToSell)
{
// Check all the prices before starting the transaction
// to make sure the modifiers stay the same for the whole transaction
Dictionary<ItemPrefab, int> sellValues = GetSellValuesAtCurrentLocation(itemsToSell.Select(i => i.ItemPrefab));
var canAddToRemoveQueue = (GameMain.NetworkMember == null || GameMain.NetworkMember.IsServer) && Entity.Spawner != null;
foreach (SoldItem item in itemsToSell)
{
var itemValue = GetSellValueAtCurrentLocation(item.ItemPrefab);
var itemValue = sellValues[item.ItemPrefab];
// check if the store can afford the item and if the item hasn't been removed already
if (Location.StoreCurrentBalance < itemValue || item.Removed) { continue; }