quickfix nukie uplinks (#9765)
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
using Content.Shared.Traitor.Uplink;
|
using Content.Shared.Traitor.Uplink;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Traitor.Uplink
|
namespace Content.Client.Traitor.Uplink
|
||||||
{
|
{
|
||||||
@@ -12,6 +11,7 @@ namespace Content.Client.Traitor.Uplink
|
|||||||
|
|
||||||
public UplinkBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
public UplinkBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
@@ -29,7 +29,6 @@ namespace Content.Client.Traitor.Uplink
|
|||||||
{
|
{
|
||||||
_menu.CurrentFilterCategory = category;
|
_menu.CurrentFilterCategory = category;
|
||||||
SendMessage(new UplinkRequestUpdateInterfaceMessage());
|
SendMessage(new UplinkRequestUpdateInterfaceMessage());
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_menu.OnWithdrawAttempt += (tc) =>
|
_menu.OnWithdrawAttempt += (tc) =>
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Traitor.Uplink.Components;
|
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
using Content.Shared.Traitor.Uplink;
|
using Content.Shared.Traitor.Uplink;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
|
|
||||||
namespace Content.Server.Traitor.Uplink.Account
|
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;
|
purchasedItem = null;
|
||||||
|
|
||||||
if (acc == null) return false;
|
|
||||||
if (acc.AccountHolder == null) return false;
|
|
||||||
|
|
||||||
if (!_listingSystem.TryGetListing(itemId, out var listing))
|
if (!_listingSystem.TryGetListing(itemId, out var listing))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (acc.Balance < listing.Price)
|
if (acc.Balance < listing.Price)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (!RemoveFromBalance(acc, listing.Price))
|
if (!RemoveFromBalance(acc, listing.Price))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
purchasedItem = EntityManager.SpawnEntity(listing.ItemId, spawnCoords);
|
purchasedItem = EntityManager.SpawnEntity(listing.ItemId, spawnCoords);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace Content.Server.Traitor.Uplink
|
|||||||
if (message.Session.AttachedEntity is not { Valid: true } player) return;
|
if (message.Session.AttachedEntity is not { Valid: true } player) return;
|
||||||
if (uplink.UplinkAccount == null) return;
|
if (uplink.UplinkAccount == null) return;
|
||||||
|
|
||||||
if (!_accounts.TryPurchaseItem(uplink, message.ItemId,
|
if (!_accounts.TryPurchaseItem(uplink.UplinkAccount, message.ItemId,
|
||||||
EntityManager.GetComponent<TransformComponent>(player).Coordinates, out var entity))
|
EntityManager.GetComponent<TransformComponent>(player).Coordinates, out var entity))
|
||||||
{
|
{
|
||||||
SoundSystem.Play(uplink.InsufficientFundsSound.GetSound(),
|
SoundSystem.Play(uplink.InsufficientFundsSound.GetSound(),
|
||||||
@@ -190,14 +190,14 @@ namespace Content.Server.Traitor.Uplink
|
|||||||
}
|
}
|
||||||
|
|
||||||
// filter out items not on the whitelist
|
// 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];
|
var found = false;
|
||||||
if (entry.JobWhitelist != null)
|
if (component.JobWhitelist != null)
|
||||||
{
|
{
|
||||||
var found = false;
|
|
||||||
foreach (var job in component.JobWhitelist)
|
foreach (var job in component.JobWhitelist)
|
||||||
{
|
{
|
||||||
if (entry.JobWhitelist.Contains(job))
|
if (entry.JobWhitelist.Contains(job))
|
||||||
@@ -206,8 +206,11 @@ namespace Content.Server.Traitor.Uplink
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
}
|
||||||
listings.Remove(entry);
|
if (!found)
|
||||||
|
{
|
||||||
|
listings.Remove(entry);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user