From 63477587734cac48e773a014aea5bc6d12523f8b Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Thu, 6 Jun 2024 03:16:47 +0300 Subject: [PATCH] PDA Bank Data (#1432) * Bank data * Data * Update Content.Client/PDA/PdaMenu.xaml.cs Co-authored-by: whatston3 <166147148+whatston3@users.noreply.github.com> --------- Co-authored-by: Checkraze <71046427+Cheackraze@users.noreply.github.com> Co-authored-by: whatston3 <166147148+whatston3@users.noreply.github.com> --- Content.Client/PDA/PdaMenu.xaml | 3 +++ Content.Client/PDA/PdaMenu.xaml.cs | 12 ++++++++++-- Content.Server/PDA/PdaSystem.cs | 9 +++++++-- Content.Shared/PDA/PdaUpdateState.cs | 3 +++ Resources/Locale/en-US/_NF/pda/pda-component.ftl | 1 + 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 Resources/Locale/en-US/_NF/pda/pda-component.ftl diff --git a/Content.Client/PDA/PdaMenu.xaml b/Content.Client/PDA/PdaMenu.xaml index cc4a384343a..8f9a297afc2 100644 --- a/Content.Client/PDA/PdaMenu.xaml +++ b/Content.Client/PDA/PdaMenu.xaml @@ -47,6 +47,9 @@ + + + // Frontier + { + _clipboard.SetText(_balance); + }; + StationTimeButton.OnPressed += _ => { var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); @@ -161,7 +167,9 @@ public void UpdateState(PdaUpdateState state) _stationName = state.StationName ?? Loc.GetString("comp-pda-ui-unknown"); StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station", ("station", _stationName))); - + + _balance = state.Balance.ToString(); // Frontier + BalanceLabel.SetMarkup(Loc.GetString("comp-pda-ui-balance", ("balance", _balance))); // Frontier var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); diff --git a/Content.Server/PDA/PdaSystem.cs b/Content.Server/PDA/PdaSystem.cs index b91f2522b20..4919d2a5f9d 100644 --- a/Content.Server/PDA/PdaSystem.cs +++ b/Content.Server/PDA/PdaSystem.cs @@ -20,6 +20,7 @@ using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Utility; +using Content.Shared.Bank.Components; // Frontier namespace Content.Server.PDA { @@ -142,7 +143,7 @@ private void OnNotification(Entity ent, ref CartridgeLoaderNotific /// /// Send new UI state to clients, call if you modify something like uplink. /// - public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null) + public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null, EntityUid? actor_uid = null) // Frontier { if (!Resolve(uid, ref pda, false)) return; @@ -165,6 +166,9 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null) var programs = _cartridgeLoader.GetAvailablePrograms(uid, loader); var id = CompOrNull(pda.ContainedId); + var balance = 0; // frontier + if (actor_uid != null && TryComp(actor_uid, out var account)) // frontier + balance = account.Balance; // frontier var state = new PdaUpdateState( programs, GetNetEntity(loader.ActiveProgram), @@ -180,6 +184,7 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null) StationAlertLevel = pda.StationAlertLevel, StationAlertColor = pda.StationAlertColor }, + balance, // Frontier pda.StationName, showUplink, hasInstrument, @@ -193,7 +198,7 @@ private void OnPdaOpen(Entity ent, ref BoundUIOpenedEvent args) if (!PdaUiKey.Key.Equals(args.UiKey)) return; - UpdatePdaUi(ent.Owner, ent.Comp); + UpdatePdaUi(ent.Owner, ent.Comp, args.Actor); // Frontier } private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaRequestUpdateInterfaceMessage msg) diff --git a/Content.Shared/PDA/PdaUpdateState.cs b/Content.Shared/PDA/PdaUpdateState.cs index 4b0c8ccba5b..e98f0f0f64f 100644 --- a/Content.Shared/PDA/PdaUpdateState.cs +++ b/Content.Shared/PDA/PdaUpdateState.cs @@ -17,6 +17,7 @@ public sealed class PdaUpdateState : CartridgeLoaderUiState // WTF is this. what public bool HasUplink; public bool CanPlayMusic; public string? Address; + public int Balance; // Frontier public PdaUpdateState( List programs, @@ -26,6 +27,7 @@ public PdaUpdateState( bool hasPai, bool hasBook, PdaIdInfoText pdaOwnerInfo, + int balance, // Frontier string? stationName, bool hasUplink = false, bool canPlayMusic = false, @@ -41,6 +43,7 @@ public PdaUpdateState( CanPlayMusic = canPlayMusic; StationName = stationName; Address = address; + Balance = balance; // Frontier } } diff --git a/Resources/Locale/en-US/_NF/pda/pda-component.ftl b/Resources/Locale/en-US/_NF/pda/pda-component.ftl new file mode 100644 index 00000000000..2199713dbf8 --- /dev/null +++ b/Resources/Locale/en-US/_NF/pda/pda-component.ftl @@ -0,0 +1 @@ +comp-pda-ui-balance = Balance: [color=white]{ $balance }[/color]