From 257909fd97c05bfde837a76afe5c5c612afc9f28 Mon Sep 17 00:00:00 2001 From: keronshb <54602815+keronshb@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:48:51 -0500 Subject: [PATCH] Adds a refund button & action upgrades for stores (#24518) * adds refunds to stores * Adds method to check for starting map * comments, datafields, some requested changes * turns event into ref event * Adds datafields * Switches to entity terminating event * Changes store entity to be nullable and checks if store is terminating to remove reference. * Tryadd instead of containskey * Adds a refund disable method, disables refund on bought ent container changes if not an action * Removes datafield specification * Readds missing using statement * Removes unused using statements * What the heck is listing data --------- Co-authored-by: metalgearsloth --- .../Store/Ui/StoreBoundUserInterface.cs | 6 + Content.Client/Store/Ui/StoreMenu.xaml | 5 + Content.Client/Store/Ui/StoreMenu.xaml.cs | 13 ++ .../Store/Components/StoreComponent.cs | 39 +++++ Content.Server/Store/StoreRefundComponent.cs | 13 ++ .../Store/Systems/StoreSystem.Refund.cs | 56 +++++++ .../Store/Systems/StoreSystem.Ui.cs | 158 +++++++++++++++++- Content.Server/Store/Systems/StoreSystem.cs | 2 + Content.Shared/Store/ListingPrototype.cs | 18 ++ Content.Shared/Store/StoreUi.cs | 14 +- 10 files changed, 318 insertions(+), 6 deletions(-) create mode 100644 Content.Server/Store/StoreRefundComponent.cs create mode 100644 Content.Server/Store/Systems/StoreSystem.Refund.cs diff --git a/Content.Client/Store/Ui/StoreBoundUserInterface.cs b/Content.Client/Store/Ui/StoreBoundUserInterface.cs index 6774ef35a0..b549918d7c 100644 --- a/Content.Client/Store/Ui/StoreBoundUserInterface.cs +++ b/Content.Client/Store/Ui/StoreBoundUserInterface.cs @@ -48,6 +48,11 @@ public sealed class StoreBoundUserInterface : BoundUserInterface { SendMessage(new StoreRequestUpdateInterfaceMessage()); }; + + _menu.OnRefundAttempt += (_) => + { + SendMessage(new StoreRequestRefundMessage()); + }; } protected override void UpdateState(BoundUserInterfaceState state) { @@ -64,6 +69,7 @@ public sealed class StoreBoundUserInterface : BoundUserInterface _menu.UpdateListing(msg.Listings.ToList()); _menu.SetFooterVisibility(msg.ShowFooter); + _menu.UpdateRefund(msg.AllowRefund); break; case StoreInitializeState msg: _windowName = msg.Name; diff --git a/Content.Client/Store/Ui/StoreMenu.xaml b/Content.Client/Store/Ui/StoreMenu.xaml index a454e3e2b7..4b38352a44 100644 --- a/Content.Client/Store/Ui/StoreMenu.xaml +++ b/Content.Client/Store/Ui/StoreMenu.xaml @@ -22,6 +22,11 @@ MinWidth="64" HorizontalAlignment="Right" Text="{Loc 'store-ui-default-withdraw-text'}" /> +