Files
crystall-punk-14/Content.Shared/_CP14/Trading/BuyServices/CP14BuyItemsService.cs
Red cde388f5dd Another Merchant gameplay attempt (#1308)
* setup UI

* setup debug data

* graph control setup

* reputation trade component

* unlocking logic

* smoe real reputation costing

* remove sponsors part, add trading specific UI nodes

* port to default pricing system

* buy cooldown

* fuck off trading cabinets

* real good cooldown UI

* Cool unlock sound

* reputation earning

* cool purchare sound

* coin & sprite work

* delete old guidebooks

* cool purcharing VFX

* better ui

* victoria gardens

* Update migration.yml

* Update migration.yml

* cooldown removed

* contracts

* Update migration.yml

* remove CP14Material

* materials appraise

* food appraise

* auto economy pricing system

* alchemy reagents appraise

* coins resprite

* alchemy appraise 2

* modular weapon appraise

* selling platform

* Update PricingSystem.cs

* Update CP14TradingPlatformSystem.cs

* merchants returns + map update

* Update CP14StationEconomySystem.Price.cs
2025-05-29 00:22:47 +03:00

47 lines
1.2 KiB
C#

using Content.Shared._CP14.Trading.Prototypes;
using Content.Shared.Stacks;
using Robust.Client.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared._CP14.Trading.BuyServices;
public sealed partial class CP14BuyItemsService : CP14StoreBuyService
{
[DataField(required: true)]
public EntProtoId Product;
[DataField]
public int Count = 1;
public override void Buy(EntityManager entManager,
IPrototypeManager prototype,
EntityUid platform)
{
for (var i = 0; i < Count; i++)
{
entManager.SpawnNextToOrDrop(Product, platform);
}
}
public override string GetName(IPrototypeManager protoMan)
{
if (!protoMan.TryIndex(Product, out var indexedProduct))
return ":3";
var count = Count;
if (indexedProduct.TryGetComponent<StackComponent>(out var stack))
count *= stack.Count;
return Count > 0 ? $"{indexedProduct.Name} x{count}" : indexedProduct.Name;
}
public override string GetDesc(IPrototypeManager protoMan)
{
if (!protoMan.TryIndex(Product, out var indexedProduct))
return string.Empty;
return indexedProduct.Description;
}
}