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