* Add platform markup to trading platform prices
Introduces a PlatformMarkupProcent field to CP14TradingPlatformComponent and applies it to price calculations in both client and server logic. Adds a new public trading platform entity with a higher markup and updates related sprites and metadata.
* Add platform markup percent to selling platforms
Introduces a PlatformMarkupProcent field to CP14SellingPlatformComponent, allowing selling platforms to apply a markup or markdown to item prices. Updates server logic to use this value when calculating payouts and UI state. Adds a new public selling platform entity with a lower markup in the trade_platform.yml prototype.
* Add Brad Potions trading requests prototype
Introduces a new YAML prototype defining multiple cp14TradingRequest entries for the BradPotions faction, each specifying requirements for various potion effects with minimum purity and amount.
* Apply platform markup to selling prices and payouts
Updated the selling request control and platform window to factor in the platform's markup percentage when displaying prices. Adjusted the server-side payout logic to multiply the payout by the platform markup percentage, ensuring consistency between client display and server rewards.
* replace mapping to public platforms
* bug + remove eepy potions request
* Clarify purity requirement in workbench reagent text
Updated the reagent requirement string in both English and Russian locale files to indicate that the required purity is '{$purity}%+' instead of just '{$purity}%'. This clarifies that the purity must be at least the specified percentage.
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using Content.Client._CP14.UserInterface;
|
|
using Content.Client._CP14.Workbench;
|
|
using Content.Shared._CP14.Trading.Prototypes;
|
|
using Content.Shared._CP14.Trading.Systems;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client._CP14.Trading;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class CP14SellingRequestControl : Control
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
|
|
public event Action? OnSellAttempt;
|
|
|
|
public CP14SellingRequestControl(ProtoId<CP14TradingRequestPrototype> request, float markupProcent, bool active)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
if (!_proto.TryIndex(request, out var indexedRequest))
|
|
return;
|
|
|
|
//Requirements
|
|
ItemRequirements.RemoveAllChildren();
|
|
foreach (var requirement in indexedRequest.Requirements)
|
|
{
|
|
ItemRequirements.AddChild(new CP14WorkbenchRequirementControl(requirement));
|
|
}
|
|
|
|
//Coin reward
|
|
PriceHolder.RemoveAllChildren();
|
|
var economySystem = _entityManager.System<CP14SharedStationEconomySystem>();
|
|
|
|
var originalPrice = economySystem.GetPrice(indexedRequest);
|
|
var price = (int?)(originalPrice * markupProcent);
|
|
PriceHolder.AddChild(new CP14PriceControl(price ?? 10000));
|
|
|
|
//Rep reward
|
|
Reputation.Text = ((price ?? 0) * indexedRequest.ReputationCashback).ToString("0.00");
|
|
|
|
RequestButton.OnPressed += _ => OnSellAttempt?.Invoke();
|
|
RequestButton.Disabled = !active;
|
|
}
|
|
}
|