diff --git a/Content.Client/Research/UI/DiskConsoleBoundUserInterface.cs b/Content.Client/Research/UI/DiskConsoleBoundUserInterface.cs index da008ca04c9..562fd54b0b9 100644 --- a/Content.Client/Research/UI/DiskConsoleBoundUserInterface.cs +++ b/Content.Client/Research/UI/DiskConsoleBoundUserInterface.cs @@ -30,6 +30,10 @@ protected override void Open() { SendMessage(new DiskConsolePrintDiskMessage()); }; + _menu.OnPrintRareButtonPressed += () => + { + SendMessage(new DiskConsolePrintRareDiskMessage()); + }; } protected override void Dispose(bool disposing) diff --git a/Content.Client/Research/UI/DiskConsoleMenu.xaml b/Content.Client/Research/UI/DiskConsoleMenu.xaml index 2a208534efa..378188f1e77 100644 --- a/Content.Client/Research/UI/DiskConsoleMenu.xaml +++ b/Content.Client/Research/UI/DiskConsoleMenu.xaml @@ -1,4 +1,4 @@ - - + diff --git a/Content.Client/Research/UI/DiskConsoleMenu.xaml.cs b/Content.Client/Research/UI/DiskConsoleMenu.xaml.cs index 7ddc0eccf01..860374062d1 100644 --- a/Content.Client/Research/UI/DiskConsoleMenu.xaml.cs +++ b/Content.Client/Research/UI/DiskConsoleMenu.xaml.cs @@ -10,6 +10,7 @@ public sealed partial class DiskConsoleMenu : FancyWindow { public event Action? OnServerButtonPressed; public event Action? OnPrintButtonPressed; + public event Action? OnPrintRareButtonPressed; // Frontier - Added for mass point use public DiskConsoleMenu() { @@ -17,13 +18,17 @@ public DiskConsoleMenu() ServerButton.OnPressed += _ => OnServerButtonPressed?.Invoke(); PrintButton.OnPressed += _ => OnPrintButtonPressed?.Invoke(); + PrintRareButton.OnPressed += _ => OnPrintRareButtonPressed?.Invoke(); // Frontier - Added for mass point use } public void Update(DiskConsoleBoundUserInterfaceState state) { PrintButton.Disabled = !state.CanPrint; + PrintRareButton.Disabled = !state.CanPrintRare; // Frontier - Added for mass point use TotalLabel.Text = Loc.GetString("tech-disk-ui-total-label", ("amount", state.ServerPoints)); - CostLabel.Text = Loc.GetString("tech-disk-ui-cost-label", ("amount", state.PointCost)); + //CostLabel.Text = Loc.GetString("tech-disk-ui-cost-label", ("amount", state.PointCost)); + PrintButton.Text = Loc.GetString("tech-disk-ui-print-button", ("amount", state.PointCost)); // Frontier + PrintRareButton.Text = Loc.GetString("tech-disk-ui-print-rare-button", ("amount", state.PointCostRare)); // Frontier } } diff --git a/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs b/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs index 93d5bb43b69..d9930ad972c 100644 --- a/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs +++ b/Content.Server/Research/TechnologyDisk/Components/DiskConsoleComponent.cs @@ -1,4 +1,4 @@ -using Robust.Shared.Audio; +using Robust.Shared.Audio; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; @@ -11,7 +11,13 @@ public sealed partial class DiskConsoleComponent : Component /// How much it costs to print a disk /// [DataField("pricePerDisk"), ViewVariables(VVAccess.ReadWrite)] - public int PricePerDisk = 1000; + public int PricePerDisk = 10000; + + /// + /// How much it costs to print a rare disk + /// + [DataField("pricePerRareDisk"), ViewVariables(VVAccess.ReadWrite)] + public int PricePerRareDisk = 13000; /// /// The prototype of what's being printed @@ -19,6 +25,12 @@ public sealed partial class DiskConsoleComponent : Component [DataField("diskPrototype", customTypeSerializer: typeof(PrototypeIdSerializer)), ViewVariables(VVAccess.ReadWrite)] public string DiskPrototype = "TechnologyDisk"; + [DataField("diskPrototypeRare", customTypeSerializer: typeof(PrototypeIdSerializer)), ViewVariables(VVAccess.ReadWrite)] + public string DiskPrototypeRare = "TechnologyDiskRare"; + + [DataField("diskRare"), ViewVariables(VVAccess.ReadWrite)] + public bool DiskRare = false; + /// /// How long it takes to print /// diff --git a/Content.Server/Research/TechnologyDisk/Components/TechnologyDiskComponent.cs b/Content.Server/Research/TechnologyDisk/Components/TechnologyDiskComponent.cs index eb5a0623a08..e0473d87624 100644 --- a/Content.Server/Research/TechnologyDisk/Components/TechnologyDiskComponent.cs +++ b/Content.Server/Research/TechnologyDisk/Components/TechnologyDiskComponent.cs @@ -1,4 +1,4 @@ -using Content.Shared.Random; +using Content.Shared.Random; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.Research.TechnologyDisk.Components; @@ -12,9 +12,21 @@ public sealed partial class TechnologyDiskComponent : Component [DataField("recipes")] public List? Recipes; + /// + /// The recipe that will be added. If null, one will be randomly generated + /// + [DataField("recipesRare")] + public List? RecipesRare; + /// /// A weighted random prototype for how rare each tier should be. /// [DataField("tierWeightPrototype", customTypeSerializer: typeof(PrototypeIdSerializer))] public string TierWeightPrototype = "TechDiskTierWeights"; + + /// + /// A weighted random prototype for how rare each tier should be. + /// + [DataField("tierWeightPrototypeRare", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string TierWeightPrototypeRare = "RareTechDiskTierWeights"; } diff --git a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs index 0d60f0af4fe..658e3d092ef 100644 --- a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs +++ b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs @@ -1,4 +1,4 @@ -using Content.Server.Research.Systems; +using Content.Server.Research.Systems; using Content.Server.Research.TechnologyDisk.Components; using Content.Server.UserInterface; using Content.Shared.Research; @@ -19,6 +19,7 @@ public sealed class DiskConsoleSystem : EntitySystem public override void Initialize() { SubscribeLocalEvent(OnPrintDisk); + SubscribeLocalEvent(OnPrintRareDisk); // Frontier SubscribeLocalEvent(OnPointsChanged); SubscribeLocalEvent(OnRegistrationChanged); SubscribeLocalEvent(OnBeforeUiOpen); @@ -37,7 +38,10 @@ public override void Update(float frameTime) continue; RemComp(uid, printing); - Spawn(console.DiskPrototype, xform.Coordinates); + if (!console.DiskRare) + Spawn(console.DiskPrototype, xform.Coordinates); + else + Spawn(console.DiskPrototypeRare, xform.Coordinates); } } @@ -57,6 +61,27 @@ private void OnPrintDisk(EntityUid uid, DiskConsoleComponent component, DiskCons var printing = EnsureComp(uid); printing.FinishTime = _timing.CurTime + component.PrintDuration; + component.DiskRare = false; + UpdateUserInterface(uid, component); + } + + private void OnPrintRareDisk(EntityUid uid, DiskConsoleComponent component, DiskConsolePrintRareDiskMessage args) // Frontier + { + if (HasComp(uid)) + return; + + if (!_research.TryGetClientServer(uid, out var server, out var serverComp)) + return; + + if (serverComp.Points < component.PricePerRareDisk) + return; + + _research.ModifyServerPoints(server.Value, -component.PricePerRareDisk, serverComp); + _audio.PlayPvs(component.PrintSound, uid); + + var printing = EnsureComp(uid); + printing.FinishTime = _timing.CurTime + component.PrintDuration; + component.DiskRare = true; UpdateUserInterface(uid, component); } @@ -89,7 +114,10 @@ public void UpdateUserInterface(EntityUid uid, DiskConsoleComponent? component = var canPrint = !(TryComp(uid, out var printing) && printing.FinishTime >= _timing.CurTime) && totalPoints >= component.PricePerDisk; - var state = new DiskConsoleBoundUserInterfaceState(totalPoints, component.PricePerDisk, canPrint); + var canPrintRare = !(TryComp(uid, out var printingRare) && printingRare.FinishTime >= _timing.CurTime) && + totalPoints >= component.PricePerRareDisk; + + var state = new DiskConsoleBoundUserInterfaceState(totalPoints, component.PricePerDisk, component.PricePerRareDisk, canPrint, canPrintRare); _ui.TrySetUiState(uid, DiskConsoleUiKey.Key, state); } diff --git a/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs b/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs index 176b2b68bc9..69e118f4b7b 100644 --- a/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs +++ b/Content.Server/Research/TechnologyDisk/Systems/TechnologyDiskSystem.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Content.Server.Popups; using Content.Server.Research.Systems; using Content.Server.Research.TechnologyDisk.Components; @@ -88,5 +88,28 @@ private void OnMapInit(EntityUid uid, TechnologyDiskComponent component, MapInit //pick one component.Recipes = new(); component.Recipes.Add(_random.Pick(techs)); + + if (component.RecipesRare != null) + return; + + var weightedRandomRare = _prototype.Index(component.TierWeightPrototypeRare); + var tierRare = int.Parse(weightedRandomRare.Pick(_random)); + + var techsRare = new List>(); + foreach (var techRare in _prototype.EnumeratePrototypes()) + { + if (techRare.Tier != tierRare) + continue; + + techsRare.AddRange(techRare.RecipeUnlocks); + } + techsRare = techsRare.Distinct().ToList(); + + if (!techsRare.Any()) + return; + + //pick one + component.RecipesRare = new(); + component.RecipesRare.Add(_random.Pick(techsRare)); } } diff --git a/Content.Shared/Research/SharedDiskConsole.cs b/Content.Shared/Research/SharedDiskConsole.cs index 2b44799f994..caf8dec753c 100644 --- a/Content.Shared/Research/SharedDiskConsole.cs +++ b/Content.Shared/Research/SharedDiskConsole.cs @@ -1,4 +1,4 @@ -using Robust.Shared.Serialization; +using Robust.Shared.Serialization; namespace Content.Shared.Research; @@ -12,13 +12,17 @@ public enum DiskConsoleUiKey : byte public sealed class DiskConsoleBoundUserInterfaceState : BoundUserInterfaceState { public bool CanPrint; + public bool CanPrintRare; public int PointCost; + public int PointCostRare; public int ServerPoints; - public DiskConsoleBoundUserInterfaceState(int serverPoints, int pointCost, bool canPrint) + public DiskConsoleBoundUserInterfaceState(int serverPoints, int pointCost, int pointCostRare, bool canPrint, bool canPrintRare) { CanPrint = canPrint; + CanPrintRare = canPrintRare; PointCost = pointCost; + PointCostRare = pointCostRare; ServerPoints = serverPoints; } } @@ -28,3 +32,9 @@ public sealed class DiskConsolePrintDiskMessage : BoundUserInterfaceMessage { } + +[Serializable, NetSerializable] +public sealed class DiskConsolePrintRareDiskMessage : BoundUserInterfaceMessage +{ + +} diff --git a/Resources/Locale/en-US/research/components/technology-disk.ftl b/Resources/Locale/en-US/research/components/technology-disk.ftl index 4f72532010e..d09340a3432 100644 --- a/Resources/Locale/en-US/research/components/technology-disk.ftl +++ b/Resources/Locale/en-US/research/components/technology-disk.ftl @@ -6,4 +6,5 @@ tech-disk-examine-more = There are more images printed, but they're too small to tech-disk-ui-name = technology disk terminal tech-disk-ui-total-label = There are {$amount} points on the selected server tech-disk-ui-cost-label = Each disk costs {$amount} points to print -tech-disk-ui-print-button = Print Disk \ No newline at end of file +tech-disk-ui-print-button = Print Disk ({$amount}) +tech-disk-ui-print-rare-button = Print Rare Disk ({$amount}) \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml b/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml index 69bcfaa4ec0..dba2e1bbdb8 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml @@ -21,7 +21,7 @@ - type: ResearchDisk points: 5000 - type: StaticPrice - price: 200 # Why was this worth nothing, NT want to buy this! + price: 1500 # Frontier - To be fair, its worth half a tech disk, but we still require tech to print it so its lower. - type: entity parent: ResearchDisk @@ -32,7 +32,7 @@ - type: ResearchDisk points: 10000 - type: StaticPrice - price: 400 # Why was this worth nothing, NT want to buy this! + price: 3000 # Frontier - To be fair, its worth a tech disk, but we still require tech to print it so its lower. - type: entity parent: ResearchDisk @@ -61,8 +61,9 @@ - enum.DamageStateVisualLayers.Base: datadisk_base: Sixteen - type: TechnologyDisk + tierWeightPrototype: TechDiskTierWeights # Frontier - type: StaticPrice - price: 550 # It's still need to be worth it, but as it was stranding (1000) it was too much + price: 5000 # Frontier - Rebalance - type: entity parent: TechnologyDisk @@ -70,5 +71,4 @@ suffix: rare. components: - type: TechnologyDisk - tierWeightPrototype: RareTechDiskTierWeights - price: 750 # It's still need to be worth it, but as it was stranding (1000) it was too much + tierWeightPrototype: RareTechDiskTierWeights # Frontier