Skip to content

Commit

Permalink
Revert "BankLable Corvax (new-frontiers-14#1379)" (new-frontiers-14#1390
Browse files Browse the repository at this point in the history
)

This reverts commit d23d0dc.
  • Loading branch information
Cheackraze authored May 19, 2024
1 parent f6e2486 commit 6c4aece
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 69 deletions.
2 changes: 0 additions & 2 deletions Content.Client/Administration/AdminNameOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,12 @@ protected override void Draw(in OverlayDrawArgs args)
var screenCoordinates = _eyeManager.WorldToScreen(aabb.Center +
new Angle(-_eyeManager.CurrentEye.Rotation).RotateVec(
aabb.TopRight - aabb.Center)) + new Vector2(1f, 7f);
var balance_str = playerInfo.Balance == int.MinValue ? "NO BALANCE" : playerInfo.Balance.ToString(); // Frontier
if (playerInfo.Antag)
{
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", Color.OrangeRed);
}
args.ScreenHandle.DrawString(_font, screenCoordinates+lineoffset, playerInfo.Username, playerInfo.Connected ? Color.Yellow : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, playerInfo.Connected ? Color.Aquamarine : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates + 3 * lineoffset, $"balance: {balance_str}", playerInfo.Connected ? Color.Aquamarine : Color.White);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
player.Antag ? "YES" : "NO",
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
player.Connected,
player.PlaytimeString, // Frontier
player.Balance == int.MinValue ? "NO BALANCE" : player.Balance.ToString()); // Frontier
player.PlaytimeString);
entry.PlayerEntity = player.NetEntity;
entry.OnKeyBindDown += args => OnEntryKeyBindDown?.Invoke(entry, args);
entry.ToolTip = Loc.GetString("player-tab-entry-tooltip");
Expand Down Expand Up @@ -152,9 +151,8 @@ private int Compare(PlayerInfo x, PlayerInfo y)
Header.Job => Compare(x.StartingJob, y.StartingJob),
Header.Antagonist => x.Antag.CompareTo(y.Antag),
Header.Playtime => TimeSpan.Compare(x.OverallPlaytime ?? default, y.OverallPlaytime ?? default),
Header.Balance => x.Balance.CompareTo(y.Balance), // Frontier
_ => 1
}; ;
};
}

private int Compare(string x, string y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,5 @@
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<Label Name="BalanceLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
</BoxContainer>
</ContainerButton>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Client.AutoGenerated;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
Expand All @@ -10,7 +10,7 @@ public sealed partial class PlayerTabEntry : ContainerButton
{
public NetEntity? PlayerEntity;

public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected, string overallPlaytime, string balance) // Frontier - Add int balance
public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected, string overallPlaytime)
{
RobustXamlLoader.Load(this);

Expand All @@ -24,6 +24,5 @@ public PlayerTabEntry(string username, string character, string identity, string
AntagonistLabel.Text = antagonist;
BackgroundColorPanel.PanelOverride = styleBox;
OverallPlaytimeLabel.Text = overallPlaytime;
BalanceLabel.Text = balance.ToString(); // Frontier
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Control xmlns="https://spacestation14.io"
<Control xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls">
<PanelContainer Name="BackgroundColorPanel" Access="Public"/>
<BoxContainer Orientation="Horizontal"
Expand Down Expand Up @@ -31,18 +31,11 @@
ClipText="True"
Text="{Loc player-tab-antagonist}"
MouseFilter="Pass"/>
<cc:VSeparator/>
<Label Name="PlaytimeLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"
Text="{Loc player-tab-playtime}"
MouseFilter="Pass"/>
<Label Name="BalanceLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"
Text="{Loc player-tab-balance}"
MouseFilter="Pass"/>
</BoxContainer>
</Control>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Client.AutoGenerated;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
Expand All @@ -20,7 +20,6 @@ public PlayerTabHeader()
JobLabel.OnKeyBindDown += JobClicked;
AntagonistLabel.OnKeyBindDown += AntagonistClicked;
PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
BalanceLabel.OnKeyBindDown += BalanceClicked; // Frontier
}

public Label GetHeader(Header header)
Expand All @@ -32,7 +31,6 @@ public Label GetHeader(Header header)
Header.Job => JobLabel,
Header.Antagonist => AntagonistLabel,
Header.Playtime => PlaytimeLabel,
Header.Balance => BalanceLabel, // Frontier
_ => throw new ArgumentOutOfRangeException(nameof(header), header, null)
};
}
Expand All @@ -44,7 +42,6 @@ public void ResetHeaderText()
JobLabel.Text = Loc.GetString("player-tab-job");
AntagonistLabel.Text = Loc.GetString("player-tab-antagonist");
PlaytimeLabel.Text = Loc.GetString("player-tab-playtime");
BalanceLabel.Text = Loc.GetString("player-tab-balance"); // Frontier
}

private void HeaderClicked(GUIBoundKeyEventArgs args, Header header)
Expand Down Expand Up @@ -83,11 +80,6 @@ private void PlaytimeClicked(GUIBoundKeyEventArgs args)
HeaderClicked(args, Header.Playtime);
}

private void BalanceClicked(GUIBoundKeyEventArgs args) // Frontier
{
HeaderClicked(args, Header.Balance);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Expand All @@ -99,7 +91,6 @@ protected override void Dispose(bool disposing)
JobLabel.OnKeyBindDown -= JobClicked;
AntagonistLabel.OnKeyBindDown -= AntagonistClicked;
PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
BalanceLabel.OnKeyBindDown -= BalanceClicked; // Frontier
}
}

Expand All @@ -109,7 +100,6 @@ public enum Header
Character,
Job,
Antagonist,
Playtime,
Balance // Frontier
Playtime
}
}
25 changes: 1 addition & 24 deletions Content.Server/Administration/Systems/AdminSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Content.Shared._NF.Bank.Events; // Frontier
using Content.Shared.Bank.Components; // Frontier
using Content.Shared.Bank.Events; // Frontier

namespace Content.Server.Administration.Systems
{
Expand Down Expand Up @@ -87,8 +84,6 @@ public override void Initialize()
SubscribeLocalEvent<RoleAddedEvent>(OnRoleEvent);
SubscribeLocalEvent<RoleRemovedEvent>(OnRoleEvent);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestartCleanup);

SubscribeLocalEvent<BalanceChangedEvent>(OnBalanceChanged); // Frontier
}

private void OnRoundRestartCleanup(RoundRestartCleanupEvent ev)
Expand Down Expand Up @@ -188,12 +183,6 @@ private void OnPlayerAttached(PlayerAttachedEvent ev)
UpdatePlayerList(ev.Player);
}

private void OnBalanceChanged(BalanceChangedEvent ev) // Frontier
{
if (ev.Amount == 0)
return;
UpdatePlayerList(ev.Session);
}
public override void Shutdown()
{
base.Shutdown();
Expand Down Expand Up @@ -221,23 +210,11 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
var name = data.UserName;
var entityName = string.Empty;
var identityName = string.Empty;
int balance = 0; // Frontier

if (session?.AttachedEntity != null)
{
entityName = EntityManager.GetComponent<MetaDataComponent>(session.AttachedEntity.Value).EntityName;
identityName = Identity.Name(session.AttachedEntity.Value, EntityManager);

// Frontier
if (EntityManager.TryGetComponent<BankAccountComponent>(session.AttachedEntity.Value, out var comp))
{
balance = comp.Balance;
}
else
{
balance = int.MinValue; // Ok
}
// Frontier
}

var antag = false;
Expand All @@ -258,7 +235,7 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
}

return new PlayerInfo(name, entityName, identityName, startingRole, antag, GetNetEntity(session?.AttachedEntity), data.UserId,
connected, _roundActivePlayers.Contains(data.UserId), overallPlaytime, balance); // Frontier - Added balance
connected, _roundActivePlayers.Contains(data.UserId), overallPlaytime);
}

private void OnPanicBunkerChanged(bool enabled)
Expand Down
5 changes: 0 additions & 5 deletions Content.Server/_NF/Bank/BankSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
using Robust.Shared.Network;
using Content.Server.Cargo.Components;
using Content.Shared.Preferences.Loadouts;
using Content.Shared._NF.Bank.Events;
using Robust.Server.Player;

namespace Content.Server.Bank;

public sealed partial class BankSystem : EntitySystem
{
[Dependency] private readonly IServerPreferencesManager _prefsManager = default!;
[Dependency] private readonly IServerDbManager _dbManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

private ISawmill _log = default!;

Expand Down Expand Up @@ -75,8 +72,6 @@ private void OnBankAccountChanged(EntityUid mobUid, BankAccountComponent bank, r

_dbManager.SaveCharacterSlotAsync((NetUserId) user, newProfile, index);
_log.Info($"Character {profile.Name} saved");
var session = _playerManager.GetSessionById((NetUserId) user);
RaiseLocalEvent(new BalanceChangedEvent(session, bank.Balance));
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions Content.Shared/Administration/PlayerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public sealed record PlayerInfo(
NetUserId SessionId,
bool Connected,
bool ActiveThisRound,
TimeSpan? OverallPlaytime,
int Balance) // Frontier
TimeSpan? OverallPlaytime)
{
private string? _playtimeString;

Expand Down
4 changes: 0 additions & 4 deletions Content.Shared/_NF/Bank/Events/BalanceChangedMessage.cs

This file was deleted.

This file was deleted.

0 comments on commit 6c4aece

Please sign in to comment.