Unstable 1.2.1.0
This commit is contained in:
@@ -18,12 +18,8 @@ namespace Barotrauma
|
||||
|
||||
public readonly int IncreaseHigh;
|
||||
|
||||
public readonly UpgradePrefab Prefab;
|
||||
|
||||
public UpgradePrice(UpgradePrefab prefab, ContentXElement element)
|
||||
{
|
||||
Prefab = prefab;
|
||||
|
||||
IncreaseLow = UpgradePrefab.ParsePercentage(element.GetAttributeString("increaselow", string.Empty)!,
|
||||
"IncreaseLow".ToIdentifier(), element, suppressWarnings: prefab.SuppressWarnings);
|
||||
|
||||
@@ -34,20 +30,21 @@ namespace Barotrauma
|
||||
|
||||
if (BasePrice == -1)
|
||||
{
|
||||
if (prefab.SuppressWarnings)
|
||||
if (!prefab.SuppressWarnings)
|
||||
{
|
||||
DebugConsole.AddWarning($"Price attribute \"baseprice\" is not defined for {prefab?.Identifier}.\n " +
|
||||
"The value has been assumed to be '1000'.");
|
||||
"The value has been assumed to be '1000'.",
|
||||
prefab!.ContentPackage);
|
||||
BasePrice = 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetBuyPrice(int level, Location? location = null, ImmutableHashSet<Character>? characterList = null)
|
||||
public int GetBuyPrice(UpgradePrefab prefab, int level, Location? location = null, ImmutableHashSet<Character>? characterList = null)
|
||||
{
|
||||
float price = BasePrice;
|
||||
|
||||
int maxLevel = Prefab.MaxLevel;
|
||||
int maxLevel = prefab.MaxLevel;
|
||||
|
||||
float lerpAmount = maxLevel is 0
|
||||
? level // avoid division by 0
|
||||
@@ -342,7 +339,8 @@ namespace Barotrauma
|
||||
{
|
||||
DebugConsole.AddWarning($"Upgrade \"{prefab.Identifier}\" is affecting a property that is also being affected by \"{matchingPrefab.Identifier}\".\n" +
|
||||
"This is unsupported and might yield unexpected results if both upgrades are applied at the same time to the same item.\n" +
|
||||
"Add the attribute suppresswarnings=\"true\" to your XML element to disable this warning if you know what you're doing.");
|
||||
"Add the attribute suppresswarnings=\"true\" to your XML element to disable this warning if you know what you're doing.",
|
||||
prefab.ContentPackage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -398,11 +396,11 @@ namespace Barotrauma
|
||||
|
||||
public UpgradePrefab(ContentXElement element, UpgradeModulesFile file) : base(element, file)
|
||||
{
|
||||
Name = element.GetAttributeString("name", string.Empty)!;
|
||||
Description = element.GetAttributeString("description", string.Empty)!;
|
||||
MaxLevel = element.GetAttributeInt("maxlevel", 1);
|
||||
SuppressWarnings = element.GetAttributeBool("supresswarnings", false);
|
||||
HideInMenus = element.GetAttributeBool("hideinmenus", false);
|
||||
Name = element.GetAttributeString(nameof(Name), string.Empty)!;
|
||||
Description = element.GetAttributeString(nameof(Description), string.Empty)!;
|
||||
MaxLevel = element.GetAttributeInt(nameof(MaxLevel), 1);
|
||||
SuppressWarnings = element.GetAttributeBool(nameof(SuppressWarnings), false);
|
||||
HideInMenus = element.GetAttributeBool(nameof(HideInMenus), false);
|
||||
SourceElement = element;
|
||||
|
||||
var targetProperties = new Dictionary<string, string[]>();
|
||||
|
||||
Reference in New Issue
Block a user