From 2ccd3691cd13cfbdacaeef310f5deb8490f17f6f Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 9 Nov 2023 02:21:28 +0200 Subject: [PATCH 1/5] Fix Channel for STC --- .../Systems/ShipyardSystem.Consoles.cs | 55 +++++++++++++++++-- .../SharedShipyardConsoleComponent.cs | 6 ++ .../shipyard/shipyard-console-component.ftl | 2 + 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs index a9700567ece..bb6c0532613 100644 --- a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs +++ b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs @@ -27,6 +27,7 @@ using Content.Server.Mind; using Content.Server.StationRecords.Systems; using Content.Shared.Database; +using System.Xml.Linq; namespace Content.Server.Shipyard.Systems; @@ -167,13 +168,16 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component } var newDeed = EnsureComp(targetId); - var channel = _prototypeManager.Index(component.ShipyardChannel); newDeed.ShuttleUid = shuttle.Owner; newDeed.ShuttleName = name; newDeed.ShuttleOwner = player; + var channel = component.ShipyardChannel; + if (ShipyardConsoleUiKey.Security != (ShipyardConsoleUiKey) args.UiKey) _idSystem.TryChangeJobTitle(targetId, $"Captain", idCard, player); + else + channel = component.SecurityShipyardChannel; if (TryComp(targetId, out var keyStorage) && shuttleStation !=null @@ -197,10 +201,12 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component { var tax = (int) (sellValue * 0.30f); sellValue -= tax; + channel = component.BlackMarketShipyardChannel; + + SendSellMessage(uid, deed.ShuttleOwner!, deed.ShuttleName!, component.SecurityShipyardChannel, player, true); } - _radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-docking", ("owner", player), ("vessel", name)), channel, uid); - _chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-docking", ("owner", player), ("vessel", name)), InGameICChatType.Speak, true); + SendPurchaseMessage(uid, player, name, channel, false); PlayConfirmSound(uid, component); _adminLogger.Add(LogType.ShipYardUsage, LogImpact.Low, $"{ToPrettyString(player):actor} purchased shuttle {ToPrettyString(shuttle.Owner)} for {vessel.Price} credits via {ToPrettyString(component.Owner)}"); @@ -263,7 +269,7 @@ public void OnSellMessage(EntityUid uid, ShipyardConsoleComponent component, Shi var shuttleName = ToPrettyString(shuttleUid); // Grab the name before it gets 1984'd - var channel = _prototypeManager.Index(component.ShipyardChannel); + var channel = component.ShipyardChannel; if (!TrySellShuttle(stationUid, shuttleUid, out var bill)) { @@ -274,6 +280,9 @@ public void OnSellMessage(EntityUid uid, ShipyardConsoleComponent component, Shi RemComp(targetId); + if (ShipyardConsoleUiKey.Security == (ShipyardConsoleUiKey) args.UiKey) + channel = component.SecurityShipyardChannel; + if (ShipyardConsoleUiKey.BlackMarket == (ShipyardConsoleUiKey) args.UiKey) { var tax = (int) (bill * 0.30f); @@ -285,13 +294,15 @@ public void OnSellMessage(EntityUid uid, ShipyardConsoleComponent component, Shi } bill -= tax; + channel = component.BlackMarketShipyardChannel; + + SendSellMessage(uid, deed.ShuttleOwner!, deed.ShuttleName!, component.SecurityShipyardChannel, player, true); } _bank.TryBankDeposit(player, bill); PlayConfirmSound(uid, component); - _radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-leaving", ("owner", deed.ShuttleOwner!), ("vessel", deed.ShuttleName!), ("player", player)), channel, uid); - _chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-leaving", ("owner", deed.ShuttleOwner!), ("vessel", deed.ShuttleName!), ("player", player)), InGameICChatType.Speak, true); + SendSellMessage(uid, deed.ShuttleOwner!, deed.ShuttleName!, channel, player, false); _adminLogger.Add(LogType.ShipYardUsage, LogImpact.Low, $"{ToPrettyString(player):actor} sold {shuttleName} for {bill} credits via {ToPrettyString(component.Owner)}"); RefreshState(uid, bank.Balance, true, null, 0, true, (ShipyardConsoleUiKey) args.UiKey); @@ -332,6 +343,38 @@ private void ConsolePopup(ICommonSession session, string text) _popup.PopupEntity(text, player); } + private void SendPurchaseMessage(EntityUid uid, EntityUid player, string name, string shipyardChannel, bool secret) + { + var channel = _prototypeManager.Index(shipyardChannel); + + if (secret) + { + _radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-docking-secret", ("vessel", name)), channel, uid); + _chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-docking-secret", ("vessel", name)), InGameICChatType.Speak, true); + } + else + { + _radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-docking", ("owner", player), ("vessel", name)), channel, uid); + _chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-docking", ("owner", player!), ("vessel", name)), InGameICChatType.Speak, true); + } + } + + private void SendSellMessage(EntityUid uid, EntityUid? player, string name, string shipyardChannel, EntityUid seller, bool secret) + { + var channel = _prototypeManager.Index(shipyardChannel); + + if (secret) + { + _radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-leaving-secret", ("vessel", name!)), channel, uid); + _chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-leaving-secret", ("vessel", name!)), InGameICChatType.Speak, true); + } + else + { + _radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-leaving", ("owner", player!), ("vessel", name!), ("player", seller)), channel, uid); + _chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-leaving", ("owner", player!), ("vessel", name!), ("player", seller)), InGameICChatType.Speak, true); + } + } + private void PlayDenySound(EntityUid uid, ShipyardConsoleComponent component) { _audio.PlayPvs(_audio.GetSound(component.ErrorSound), uid); diff --git a/Content.Shared/Shipyard/Components/SharedShipyardConsoleComponent.cs b/Content.Shared/Shipyard/Components/SharedShipyardConsoleComponent.cs index fc6eace465b..6231b2ca2ca 100644 --- a/Content.Shared/Shipyard/Components/SharedShipyardConsoleComponent.cs +++ b/Content.Shared/Shipyard/Components/SharedShipyardConsoleComponent.cs @@ -23,4 +23,10 @@ public sealed partial class ShipyardConsoleComponent : Component [DataField("shipyardChannel")] public string ShipyardChannel = "Traffic"; + + [DataField("securityShipyardChannel")] + public string SecurityShipyardChannel = "Security"; + + [DataField("blackMarketShipyardChannel")] + public string BlackMarketShipyardChannel = "Syndicate"; } diff --git a/Resources/Locale/en-US/shipyard/shipyard-console-component.ftl b/Resources/Locale/en-US/shipyard/shipyard-console-component.ftl index fac707cc9fe..64851e49073 100644 --- a/Resources/Locale/en-US/shipyard/shipyard-console-component.ftl +++ b/Resources/Locale/en-US/shipyard/shipyard-console-component.ftl @@ -3,6 +3,8 @@ shipyard-console-invalid-vessel = Cannot purchase vessel: shipyard-console-menu-title = Shipyard Menu shipyard-console-docking = Captain {$owner} shuttle {$vessel} en route, eta 10 seconds. shipyard-console-leaving = Captain {$owner} shuttle {$vessel} sold by {$player}. +shipyard-console-docking-secret = shuttle {$vessel} en route, eta 10 seconds. +shipyard-console-leaving-secret = shuttle {$vessel} sold. shipyard-commands-purchase-desc = Spawns and FTL docks a specified shuttle from a grid file. shipyard-console-no-idcard = No ID card present shipyard-console-already-deeded = ID card already has a Deed From 68c8afa9b32cd286ed36e3edad418b4b6c01973b Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 9 Nov 2023 02:23:25 +0200 Subject: [PATCH 2/5] Update ShipyardSystem.Consoles.cs --- Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs index bb6c0532613..2f58b08afe8 100644 --- a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs +++ b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs @@ -203,7 +203,7 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component sellValue -= tax; channel = component.BlackMarketShipyardChannel; - SendSellMessage(uid, deed.ShuttleOwner!, deed.ShuttleName!, component.SecurityShipyardChannel, player, true); + SendPurchaseMessage(uid, deed.ShuttleOwner!, deed.ShuttleName!, component.SecurityShipyardChannel, player, true); } SendPurchaseMessage(uid, player, name, channel, false); From 73c41f29039ef1a8d9c3988f117daa3dc8d9b618 Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 9 Nov 2023 02:54:26 +0200 Subject: [PATCH 3/5] Update ShipyardSystem.Consoles.cs --- Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs index 2f58b08afe8..c6a584bca27 100644 --- a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs +++ b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs @@ -203,7 +203,7 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component sellValue -= tax; channel = component.BlackMarketShipyardChannel; - SendPurchaseMessage(uid, deed.ShuttleOwner!, deed.ShuttleName!, component.SecurityShipyardChannel, player, true); + SendPurchaseMessage(uid, uid, player, name, component.SecurityShipyardChannel, player, true); } SendPurchaseMessage(uid, player, name, channel, false); From d430ec9df8a03f64283db9cacaf90f49bb5291bf Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 9 Nov 2023 02:55:38 +0200 Subject: [PATCH 4/5] Update ShipyardSystem.Consoles.cs --- Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs index c6a584bca27..dee7e1491de 100644 --- a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs +++ b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs @@ -203,7 +203,7 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component sellValue -= tax; channel = component.BlackMarketShipyardChannel; - SendPurchaseMessage(uid, uid, player, name, component.SecurityShipyardChannel, player, true); + SendPurchaseMessage(uid, uid, player, name, component.SecurityShipyardChannel, true); } SendPurchaseMessage(uid, player, name, channel, false); From 09e9c5bf41cfec9b0e1cc68784bd2318c380b06b Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 9 Nov 2023 02:56:14 +0200 Subject: [PATCH 5/5] Fix --- Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs index dee7e1491de..9208fa2990e 100644 --- a/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs +++ b/Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs @@ -203,7 +203,7 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component sellValue -= tax; channel = component.BlackMarketShipyardChannel; - SendPurchaseMessage(uid, uid, player, name, component.SecurityShipyardChannel, true); + SendPurchaseMessage(uid, player, name, component.SecurityShipyardChannel, true); } SendPurchaseMessage(uid, player, name, channel, false);