diff --git a/Content.Client/Traitor/Uplink/UplinkBoundUserInterface.cs b/Content.Client/Traitor/Uplink/UplinkBoundUserInterface.cs index 339ba85cee..c7051756f7 100644 --- a/Content.Client/Traitor/Uplink/UplinkBoundUserInterface.cs +++ b/Content.Client/Traitor/Uplink/UplinkBoundUserInterface.cs @@ -1,7 +1,6 @@ using Content.Shared.Traitor.Uplink; using JetBrains.Annotations; using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; namespace Content.Client.Traitor.Uplink { @@ -12,6 +11,7 @@ namespace Content.Client.Traitor.Uplink public UplinkBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { + } protected override void Open() @@ -29,7 +29,6 @@ namespace Content.Client.Traitor.Uplink { _menu.CurrentFilterCategory = category; SendMessage(new UplinkRequestUpdateInterfaceMessage()); - }; _menu.OnWithdrawAttempt += (tc) => diff --git a/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs b/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs index 509d727fc8..d3ad87dd25 100644 --- a/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs +++ b/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs @@ -1,10 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; -using Content.Server.Traitor.Uplink.Components; using Content.Shared.Stacks; using Content.Shared.Traitor.Uplink; using Robust.Shared.Map; -using Robust.Shared.Prototypes; namespace Content.Server.Traitor.Uplink.Account { @@ -70,28 +68,18 @@ namespace Content.Server.Traitor.Uplink.Account } - public bool TryPurchaseItem(UplinkComponent component, string itemId, EntityCoordinates spawnCoords, [NotNullWhen(true)] out EntityUid? purchasedItem) + public bool TryPurchaseItem(UplinkAccount acc, string itemId, EntityCoordinates spawnCoords, [NotNullWhen(true)] out EntityUid? purchasedItem) { - var acc = component.UplinkAccount; purchasedItem = null; - if (acc == null) return false; - if (acc.AccountHolder == null) return false; - if (!_listingSystem.TryGetListing(itemId, out var listing)) - { return false; - } if (acc.Balance < listing.Price) - { return false; - } if (!RemoveFromBalance(acc, listing.Price)) - { return false; - } purchasedItem = EntityManager.SpawnEntity(listing.ItemId, spawnCoords); return true; diff --git a/Content.Server/Traitor/Uplink/UplinkSystem.cs b/Content.Server/Traitor/Uplink/UplinkSystem.cs index 3482002eb6..6f8da4f627 100644 --- a/Content.Server/Traitor/Uplink/UplinkSystem.cs +++ b/Content.Server/Traitor/Uplink/UplinkSystem.cs @@ -111,7 +111,7 @@ namespace Content.Server.Traitor.Uplink if (message.Session.AttachedEntity is not { Valid: true } player) return; if (uplink.UplinkAccount == null) return; - if (!_accounts.TryPurchaseItem(uplink, message.ItemId, + if (!_accounts.TryPurchaseItem(uplink.UplinkAccount, message.ItemId, EntityManager.GetComponent(player).Coordinates, out var entity)) { SoundSystem.Play(uplink.InsufficientFundsSound.GetSound(), @@ -190,14 +190,14 @@ namespace Content.Server.Traitor.Uplink } // filter out items not on the whitelist - if (component.JobWhitelist != null) + for (var i = 0; i < listings.Count; i++) { - for (var i = 0; i < listings.Count; i++) + var entry = listings[i]; + if (entry.JobWhitelist != null) { - var entry = listings[i]; - if (entry.JobWhitelist != null) + var found = false; + if (component.JobWhitelist != null) { - var found = false; foreach (var job in component.JobWhitelist) { if (entry.JobWhitelist.Contains(job)) @@ -206,8 +206,11 @@ namespace Content.Server.Traitor.Uplink break; } } - if (!found) - listings.Remove(entry); + } + if (!found) + { + listings.Remove(entry); + i--; } } }