From 24d890d77c884eb51ca8043d92499029bbd6c031 Mon Sep 17 00:00:00 2001 From: xTray Date: Sat, 31 Aug 2024 14:18:56 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=D1=8B=20=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=BD=D1=81=D0=BE=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Administration/AdminNameOverlay.cs | 12 ++++++++ .../UI/Tabs/PlayerTab/PlayerTab.xaml.cs | 16 ++++++++++ .../UI/Tabs/PlayerTab/PlayerTabEntry.xaml | 5 ++++ .../UI/Tabs/PlayerTab/PlayerTabEntry.xaml.cs | 1 + .../UI/Tabs/PlayerTab/PlayerTabHeader.xaml | 7 +++++ .../UI/Tabs/PlayerTab/PlayerTabHeader.xaml.cs | 10 +++++++ .../Postgres/20231226154937_AdminLogPk.cs | 30 +++++++++---------- Content.Server.Database/Model.cs | 2 -- .../Administration/Systems/AdminSystem.cs | 10 ++++++- .../Corvax/Sponsors/CheckSponsorSystem.cs | 2 +- .../Corvax/Sponsors/SponsorsManager.cs | 24 ++------------- Content.Server/Database/ServerDbBase.cs | 17 ----------- Content.Server/Database/ServerDbManager.cs | 21 ------------- Content.Shared/Administration/PlayerInfo.cs | 2 ++ Resources/ConfigPresets/Build/debug.toml | 3 ++ .../administration/ui/tabs/player-tab.ftl | 3 ++ .../administration/ui/tabs/player-tab.ftl | 3 ++ RobustToolbox | 2 +- 18 files changed, 90 insertions(+), 80 deletions(-) diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index 27b2a5dedb0..c48a477a3c4 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -65,6 +65,18 @@ protected override void Draw(in OverlayDrawArgs args) { args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", Color.OrangeRed); } + + if (playerInfo.Sponsor != null) + { + var sponsorOffset = playerInfo.Antag ? lineoffset * 3 : lineoffset * 2; + var sponsorString = $"Sponsor ({playerInfo.Sponsor.Tier})"; + if (playerInfo.Sponsor.AllowJob) + sponsorString += " (allJobs)"; + + sponsorString += $" до {playerInfo.Sponsor.ExpireDate.ToString("dd.MM.yyyy")}"; + + args.ScreenHandle.DrawString(_font, screenCoordinates + sponsorOffset, sponsorString, Color.GreenYellow); + } 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); } diff --git a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs index 2187c40ce98..22936f028a0 100644 --- a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs @@ -197,11 +197,27 @@ private int Compare(PlayerInfo x, PlayerInfo y) Header.Character => Compare(x.CharacterName, y.CharacterName), Header.Job => Compare(x.StartingJob, y.StartingJob), Header.Antagonist => x.Antag.CompareTo(y.Antag), + Header.Sponsor => Compare(x.Sponsor?.Tier, y.Sponsor?.Tier), Header.Playtime => TimeSpan.Compare(x.OverallPlaytime ?? default, y.OverallPlaytime ?? default), _ => 1 }; } + private int Compare(int? x, int? y) + { + if (!x.HasValue) + return -1; + if (!y.HasValue) + return 1; + + if (x == y) + return 0; + else if (x > y) + return 1; + else + return -1; + } + private int Compare(string x, string y) { return string.Compare(x, y, StringComparison.OrdinalIgnoreCase); diff --git a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml index e1371ec6f73..19d71ace3fa 100644 --- a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml +++ b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml @@ -24,6 +24,11 @@ HorizontalExpand="True" ClipText="True"/> +