Unstable v0.1300.0.0 (February 19th 2021)
This commit is contained in:
@@ -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; }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Barotrauma.Networking;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -13,10 +12,11 @@ namespace Barotrauma
|
||||
|
||||
public override void ShowStartMessage()
|
||||
{
|
||||
if (Mission == null) return;
|
||||
|
||||
GameServer.Log(TextManager.Get("Mission") + ": " + Mission.Name, Networking.ServerLog.MessageType.ServerMessage);
|
||||
GameServer.Log(Mission.Description, Networking.ServerLog.MessageType.ServerMessage);
|
||||
foreach (Mission mission in Missions)
|
||||
{
|
||||
GameServer.Log(TextManager.Get("Mission") + ": " + mission.Name, ServerLog.MessageType.ServerMessage);
|
||||
GameServer.Log(mission.Description, ServerLog.MessageType.ServerMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
{
|
||||
public override void ShowStartMessage()
|
||||
{
|
||||
if (mission == null) return;
|
||||
|
||||
Networking.GameServer.Log(TextManager.Get("Mission") + ": " + mission.Name, Networking.ServerLog.MessageType.ServerMessage);
|
||||
Networking.GameServer.Log(mission.Description, Networking.ServerLog.MessageType.ServerMessage);
|
||||
foreach (Mission mission in missions)
|
||||
{
|
||||
Networking.GameServer.Log(TextManager.Get("Mission") + ": " + mission.Name, Networking.ServerLog.MessageType.ServerMessage);
|
||||
Networking.GameServer.Log(mission.Description, Networking.ServerLog.MessageType.ServerMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-4
@@ -225,7 +225,7 @@ namespace Barotrauma
|
||||
if (c.Inventory == null) { continue; }
|
||||
if (Level.Loaded.Type == LevelData.LevelType.Outpost && c.Submarine != Level.Loaded.StartOutpost)
|
||||
{
|
||||
Map.CurrentLocation.RegisterTakenItems(c.Inventory.Items.Where(it => it != null && it.SpawnedInOutpost && it.OriginalModuleIndex > 0).Distinct());
|
||||
Map.CurrentLocation.RegisterTakenItems(c.Inventory.AllItems.Where(it => it.SpawnedInOutpost && it.OriginalModuleIndex > 0));
|
||||
}
|
||||
|
||||
if (c.Info != null && c.IsBot)
|
||||
@@ -367,6 +367,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (CoroutineManager.IsCoroutineRunning("LevelTransition")) { return; }
|
||||
|
||||
Map?.Radiation.UpdateRadiation(deltaTime);
|
||||
|
||||
base.Update(deltaTime);
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
@@ -441,9 +443,16 @@ namespace Barotrauma
|
||||
foreach (Mission mission in map.CurrentLocation.AvailableMissions)
|
||||
{
|
||||
msg.Write(mission.Prefab.Identifier);
|
||||
Location missionDestination = mission.Locations[0] == map.CurrentLocation ? mission.Locations[1] : mission.Locations[0];
|
||||
LocationConnection connection = map.CurrentLocation.Connections.Find(c => c.OtherLocation(map.CurrentLocation) == missionDestination);
|
||||
msg.Write((byte)map.CurrentLocation.Connections.IndexOf(connection));
|
||||
if (mission.Locations[0] == mission.Locations[1])
|
||||
{
|
||||
msg.Write((byte)255);
|
||||
}
|
||||
else
|
||||
{
|
||||
Location missionDestination = mission.Locations[0] == map.CurrentLocation ? mission.Locations[1] : mission.Locations[0];
|
||||
LocationConnection connection = map.CurrentLocation.Connections.Find(c => c.OtherLocation(map.CurrentLocation) == missionDestination);
|
||||
msg.Write((byte)map.CurrentLocation.Connections.IndexOf(connection));
|
||||
}
|
||||
}
|
||||
|
||||
// Store balance
|
||||
@@ -773,6 +782,9 @@ namespace Barotrauma
|
||||
element.Add(new XAttribute("campaignid", CampaignID));
|
||||
XElement modeElement = new XElement("MultiPlayerCampaign",
|
||||
new XAttribute("money", Money),
|
||||
new XAttribute("purchasedlostshuttles", PurchasedLostShuttles),
|
||||
new XAttribute("purchasedhullrepairs", PurchasedHullRepairs),
|
||||
new XAttribute("purchaseditemrepairs", PurchasedItemRepairs),
|
||||
new XAttribute("cheatsenabled", CheatsEnabled));
|
||||
CampaignMetadata?.Save(modeElement);
|
||||
Map.Save(modeElement);
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace Barotrauma
|
||||
|
||||
partial void EndReadyCheck()
|
||||
{
|
||||
if (IsFinished) { return; }
|
||||
IsFinished = true;
|
||||
foreach (Client client in ActivePlayers)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user