Files
Delta-v/Content.Server/_DV/Cargo/Systems/PricingSystem.Modifier.cs
T
BarryNorfolk bf8cce52a1 Remove warnings in Content.Server for _DV content (#5114)
* Cleanup datafields with matching autogenerated tag [RA0027]

* Remove unused dependencies [CS0414]

* Swap to AddMarkupOrThrow over PushMarkup [CS0618]

* Fix namespacing [CA1050]

* Prefer the generic overload [CA2263]

* Fix exception throwing [CA2208]

* Mark RoundStartCaptain as static [CA1822]

* Don't use string literal [RA0033]

* Remove un-needed null check [CS8073]

* Explicitly set webhookData to null [CS0649]

* Use protoId over bare string

* Prefer HasComp over TryComp with no usage of the actual comp
2026-01-06 10:31:51 -06:00

42 lines
1.4 KiB
C#

using Content.Server._DV.Cargo.Components;
using Robust.Shared.Prototypes;
namespace Content.Server.Cargo.Systems;
public sealed partial class PricingSystem
{
/// <summary>
/// Applies any price modifiers defined in the entity prototype.
/// </summary>
/// <param name="prototype">The entity prototype.</param>
/// <param name="basePrice">The base price before modification.</param>
/// <returns>The modified price.</returns>
private double ApplyPrototypePriceModifier(EntityPrototype prototype, double basePrice)
{
if (prototype.Components.TryGetValue(Factory.GetComponentName<PriceModifierComponent>(),
out var modProto))
{
var priceModifier = (PriceModifierComponent)modProto.Component;
return basePrice * priceModifier.Modifier;
}
return basePrice;
}
/// <summary>
/// Applies any price modifiers to the calculated price.
/// </summary>
/// <param name="uid">The entity whose price is being modified.</param>
/// <param name="basePrice">The base price before modification.</param>
/// <returns>The modified price.</returns>
private double ApplyPriceModifier(EntityUid uid, double basePrice)
{
if (TryComp<PriceModifierComponent>(uid, out var modifier))
{
return basePrice * modifier.Modifier;
}
return basePrice;
}
}