Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-station-14 into smuggling-buff
  • Loading branch information
whatston3 committed Sep 21, 2024
2 parents 6eb6974 + 0dd59b7 commit bcca650
Show file tree
Hide file tree
Showing 41 changed files with 813 additions and 579 deletions.
5 changes: 4 additions & 1 deletion Content.Client/Administration/AdminNameOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Numerics;
using Content.Client.Administration.Systems;
using Content.Shared._NF.Bank;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Enums;
Expand Down Expand Up @@ -61,12 +62,14 @@ 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 = playerInfo.Balance == int.MinValue ? "NO BALANCE" : BankSystemExtensions.ToCurrencyString(playerInfo.Balance); // Frontier
if (playerInfo.Antag)
{
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", Color.OrangeRed);
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 3), "ANTAG", Color.OrangeRed); // Frontier: 2<3
}
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 + lineoffset * 2, $"Balance: {balance}", playerInfo.Connected ? Color.Aquamarine : Color.White); // Frontier
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public PlayerTab()
SearchList.ItemKeyBindDown += (args, data) => OnEntryKeyBindDown?.Invoke(args, data);

RefreshPlayerList(_adminSystem.PlayerList);

}

#region Antag Overlay
Expand Down Expand Up @@ -198,6 +197,7 @@ 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
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
SizeFlagsStretchRatio="1"
HorizontalExpand="True"
ClipText="True"/>
<Label Name="BalanceLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
</BoxContainer>
</PanelContainer>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Administration;
using Content.Shared._NF.Bank;
using Content.Shared.Administration;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
Expand Down Expand Up @@ -26,5 +27,6 @@ public PlayerTabEntry(PlayerInfo player, StyleBoxFlat styleBoxFlat)
BackgroundColorPanel.PanelOverride = styleBoxFlat;
OverallPlaytimeLabel.Text = player.PlaytimeString;
PlayerEntity = player.NetEntity;
BalanceLabel.Text = BankSystemExtensions.ToCurrencyString(player.Balance); // 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 @@ -37,7 +37,13 @@
HorizontalExpand="True"
ClipText="True"
Text="{Loc player-tab-playtime}"
MouseFilter="Pass"
ToolTip="{Loc player-tab-entry-tooltip}"/>
MouseFilter="Pass"/>
<cc:VSeparator/>
<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,6 +20,7 @@ public PlayerTabHeader()
JobLabel.OnKeyBindDown += JobClicked;
AntagonistLabel.OnKeyBindDown += AntagonistClicked;
PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
BalanceLabel.OnKeyBindDown += BalanceClicked; // Frontier
}

public Label GetHeader(Header header)
Expand All @@ -31,6 +32,7 @@ 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 @@ -42,6 +44,7 @@ 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 @@ -80,6 +83,11 @@ 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 @@ -91,6 +99,7 @@ protected override void Dispose(bool disposing)
JobLabel.OnKeyBindDown -= JobClicked;
AntagonistLabel.OnKeyBindDown -= AntagonistClicked;
PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
BalanceLabel.OnKeyBindDown -= BalanceClicked; // Frontier
}
}

Expand All @@ -100,6 +109,7 @@ public enum Header
Character,
Job,
Antagonist,
Playtime
Playtime,
Balance // Frontier
}
}
20 changes: 19 additions & 1 deletion Content.Server/Administration/Systems/AdminSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Content.Shared._NF.Bank.Events; // Frontier
using Content.Server.Bank; // Frontier

namespace Content.Server.Administration.Systems;

Expand All @@ -51,6 +53,7 @@ public sealed class AdminSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly BankSystem _bank = default!; // Frontier

private readonly Dictionary<NetUserId, PlayerInfo> _playerList = new();

Expand Down Expand Up @@ -96,6 +99,8 @@ 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 @@ -195,6 +200,13 @@ private void OnPlayerAttached(PlayerAttachedEvent ev)
UpdatePlayerList(ev.Player);
}

// Frontier: add balance
private void OnBalanceChanged(BalanceChangedEvent ev)
{
UpdatePlayerList(ev.Session);
}
// End Frontier

public override void Shutdown()
{
base.Shutdown();
Expand Down Expand Up @@ -223,11 +235,17 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
var name = data.UserName;
var entityName = string.Empty;
var identityName = string.Empty;
int balance = int.MinValue; // Frontier

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

// Frontier
if (!_bank.TryGetBalance(session.AttachedEntity.Value, out balance))
balance = int.MinValue; // Reset value to "no balance" flag value.
// Frontier
}

var antag = false;
Expand All @@ -248,7 +266,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);
connected, _roundActivePlayers.Contains(data.UserId), overallPlaytime, balance); // Frontier: added balance
}

private void OnPanicBunkerChanged(bool enabled)
Expand Down
5 changes: 5 additions & 0 deletions Content.Server/_NF/Bank/BankSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Preferences;
using Robust.Shared.Player;
using System.Diagnostics.CodeAnalysis;
using Content.Shared._NF.Bank.Events;

namespace Content.Server.Bank;

Expand Down Expand Up @@ -167,6 +168,8 @@ public bool TryBankWithdraw(ICommonSession session, PlayerPreferences prefs, Hum
}
_prefsManager.SetProfile(session.UserId, index, newProfile);
newBalance = balance;
// Update any active admin UI with new balance
RaiseLocalEvent(new BalanceChangedEvent(session, newBalance.Value));
return true;
}

Expand Down Expand Up @@ -199,6 +202,8 @@ public bool TryBankDeposit(ICommonSession session, PlayerPreferences prefs, Huma
return false;
}
_prefsManager.SetProfile(session.UserId, index, newProfile);
// Update any active admin UI with new balance
RaiseLocalEvent(new BalanceChangedEvent(session, newBalance.Value));
return true;
}

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

Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/_NF/Bank/Events/BalanceChangedMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using Robust.Shared.Player;

namespace Content.Shared._NF.Bank.Events;
public sealed record BalanceChangedEvent(ICommonSession Session, int Amount);
20 changes: 20 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7163,3 +7163,23 @@ Entries:
and reagents.
id: 5294
time: '2024-09-20T21:52:42.0000000+00:00'
- author: whatston3
changes:
- type: Fix
message: x-ray cannon and laser cannons now spawn in a correctly sized case.
id: 5295
time: '2024-09-21T20:46:23.0000000+00:00'
- author: whatston3
changes:
- type: Fix
message: >-
Dock and bus signs should be correct now instead of appearing as "EVAC"
signs.
id: 5296
time: '2024-09-21T21:34:14.0000000+00:00'
- author: Tych0theSynth
changes:
- type: Tweak
message: Updated the NT Fishbowl CentCom shuttle.
id: 5297
time: '2024-09-21T21:36:20.0000000+00:00'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
player-tab-balance = Balance
24 changes: 13 additions & 11 deletions Resources/Maps/_NF/Outpost/frontier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31815,7 +31815,19 @@ entities:
- type: Transform
pos: 38.5,21.5
parent: 2173
- proto: SignShipDock
- proto: NFSignBus
entities:
- uid: 2096
components:
- type: Transform
pos: -16.5,17.5
parent: 2173
- uid: 2100
components:
- type: Transform
pos: -8.5,17.5
parent: 2173
- proto: NFSignDock
entities:
- uid: 472
components:
Expand Down Expand Up @@ -31859,16 +31871,6 @@ entities:
rot: 3.141592653589793 rad
pos: -0.5,30.5
parent: 2173
- uid: 2096
components:
- type: Transform
pos: -16.5,17.5
parent: 2173
- uid: 2100
components:
- type: Transform
pos: -8.5,17.5
parent: 2173
- uid: 2579
components:
- type: Transform
Expand Down
2 changes: 1 addition & 1 deletion Resources/Maps/_NF/POI/anomalousgeode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4163,7 +4163,7 @@ entities:
- type: Transform
pos: -2.5,-7.5
parent: 1
- proto: SignShipDock
- proto: NFSignDock
entities:
- uid: 771
components:
Expand Down
2 changes: 1 addition & 1 deletion Resources/Maps/_NF/POI/arena.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18013,7 +18013,7 @@ entities:
- type: Transform
pos: -12.5,-1.5
parent: 2
- proto: SignShipDock
- proto: NFSignDock
entities:
- uid: 2976
components:
Expand Down
2 changes: 1 addition & 1 deletion Resources/Maps/_NF/POI/lodge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15716,7 +15716,7 @@ entities:
- type: Transform
pos: -1.5,24.5
parent: 1
- proto: SignShipDock
- proto: NFSignDock
entities:
- uid: 360
components:
Expand Down
20 changes: 11 additions & 9 deletions Resources/Maps/_NF/POI/trade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26973,27 +26973,29 @@ entities:
- type: Transform
pos: 50.5,-1.5
parent: 1
- proto: SignShipDock
- proto: NFSignBus
entities:
- uid: 6377
- uid: 6379
components:
- type: Transform
pos: -16.5,25.5
pos: -4.5,-15.5
parent: 1
- uid: 6378
- uid: 6380
components:
- type: Transform
pos: -12.5,25.5
pos: -1.5,-15.5
parent: 1
- uid: 6379
- proto: NFSignDock
entities:
- uid: 6377
components:
- type: Transform
pos: -4.5,-15.5
pos: -16.5,25.5
parent: 1
- uid: 6380
- uid: 6378
components:
- type: Transform
pos: -1.5,-15.5
pos: -12.5,25.5
parent: 1
- uid: 6383
components:
Expand Down
Loading

0 comments on commit bcca650

Please sign in to comment.