Release 1.10.5.0 - Autumn Update 2025
This commit is contained in:
@@ -304,12 +304,17 @@ namespace Barotrauma
|
||||
// Check all the prices before starting the transaction to make sure the modifiers stay the same for the whole transaction
|
||||
var buyValues = GetBuyValuesAtCurrentLocation(storeIdentifier, itemsToPurchase.Select(i => i.ItemPrefab));
|
||||
var itemsInStoreCrate = GetBuyCrateItems(storeIdentifier, create: true);
|
||||
foreach (PurchasedItem item in itemsToPurchase)
|
||||
//handle checking which items can be purchased and deducting money first
|
||||
foreach (PurchasedItem item in itemsToPurchase.ToList())
|
||||
{
|
||||
if (item.Quantity <= 0) { continue; }
|
||||
// Exchange money
|
||||
int itemValue = item.Quantity * buyValues[item.ItemPrefab];
|
||||
if (!campaign.TryPurchase(client, itemValue)) { continue; }
|
||||
if (!campaign.TryPurchase(client, itemValue))
|
||||
{
|
||||
itemsToPurchase.Remove(item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add to the purchased items
|
||||
var purchasedItem = itemsPurchasedFromStore.Find(pi => pi.ItemPrefab == item.ItemPrefab && pi.DeliverImmediately == item.DeliverImmediately);
|
||||
@@ -329,6 +334,7 @@ namespace Barotrauma
|
||||
}
|
||||
store.Balance += itemValue;
|
||||
}
|
||||
//actually spawn the items at this point
|
||||
if (GameMain.NetworkMember is not { IsClient: true })
|
||||
{
|
||||
Character targetCharacter;
|
||||
|
||||
@@ -1724,7 +1724,10 @@ namespace Barotrauma
|
||||
GameMain.GameSession.EventManager.Load(subElement);
|
||||
break;
|
||||
case "unlockedrecipe":
|
||||
GameMain.GameSession.UnlockRecipe(subElement.GetAttributeIdentifier("identifier", Identifier.Empty), showNotifications: false);
|
||||
GameMain.GameSession.UnlockRecipe(
|
||||
subElement.GetAttributeEnum("team", CharacterTeamType.Team1),
|
||||
subElement.GetAttributeIdentifier("identifier", Identifier.Empty),
|
||||
showNotifications: false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,8 +170,8 @@ namespace Barotrauma
|
||||
|
||||
public Submarine? Submarine { get; set; }
|
||||
|
||||
private readonly HashSet<Identifier> unlockedRecipes = new HashSet<Identifier>();
|
||||
public IEnumerable<Identifier> UnlockedRecipes => unlockedRecipes;
|
||||
private readonly HashSet<(CharacterTeamType team, Identifier identifier)> unlockedRecipes = new HashSet<(CharacterTeamType, Identifier)>();
|
||||
public IEnumerable<(CharacterTeamType, Identifier)> UnlockedRecipes => unlockedRecipes;
|
||||
|
||||
public CampaignDataPath DataPath { get; set; }
|
||||
|
||||
@@ -1499,25 +1499,32 @@ namespace Barotrauma
|
||||
#endif
|
||||
}
|
||||
|
||||
public void UnlockRecipe(Identifier identifier, bool showNotifications)
|
||||
public void UnlockRecipe(CharacterTeamType team, Identifier identifier, bool showNotifications)
|
||||
{
|
||||
if (unlockedRecipes.Add(identifier))
|
||||
if (unlockedRecipes.Add((team, identifier)))
|
||||
{
|
||||
#if CLIENT
|
||||
if (showNotifications)
|
||||
{
|
||||
foreach (var character in GetSessionCrewCharacters(CharacterType.Both))
|
||||
{
|
||||
if (character.TeamID != team) { continue; }
|
||||
LocalizedString recipeName = TextManager.Get($"entityname.{identifier}").Fallback(identifier.Value);
|
||||
character.AddMessage(TextManager.GetWithVariable("recipeunlockednotification", "[name]", recipeName).Value, GUIStyle.Yellow, playSound: true);
|
||||
}
|
||||
}
|
||||
#else
|
||||
GameMain.Server.UnlockRecipe(identifier);
|
||||
GameMain.Server.UnlockRecipe(team, identifier);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasUnlockedRecipe(Character character, Identifier itemIdentifier)
|
||||
{
|
||||
if (character == null) { return false; }
|
||||
return unlockedRecipes.Contains((character.TeamID, itemIdentifier));
|
||||
}
|
||||
|
||||
public static bool IsCompatibleWithEnabledContentPackages(IList<string> contentPackageNames, out LocalizedString errorMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
|
||||
Reference in New Issue
Block a user