From 7219816376d5466d231048022d0891949c6b45b2 Mon Sep 17 00:00:00 2001 From: Morb0 <14136326+Morb0@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:56:15 +0300 Subject: [PATCH] Add corvax Secrets --- Content.Client/Content.Client.csproj | 2 + Content.Client/Humanoid/MarkingPicker.xaml.cs | 7 +++ .../Humanoid/SingleMarkingPicker.xaml.cs | 7 +++ .../Preferences/ClientPreferencesManager.cs | 8 +++- .../Preferences/UI/CharacterSetupGui.xaml | 6 +++ .../Preferences/UI/CharacterSetupGui.xaml.cs | 8 ++++ Content.Server/Chat/Managers/ChatManager.cs | 10 ++++ .../Connection/ConnectionManager.cs | 28 ++++++++++- Content.Server/Content.Server.csproj | 1 + .../GameTicking/GameTicker.Player.cs | 9 +++- .../GameTicking/GameTicker.StatusShell.cs | 9 +++- .../Managers/ServerPreferencesManager.cs | 46 +++++++++++++++---- Content.Shared/Content.Shared.csproj | 1 + .../Humanoid/HumanoidCharacterAppearance.cs | 21 ++++++++- .../Humanoid/Markings/MarkingPrototype.cs | 5 ++ .../Humanoid/Markings/MarkingsSet.cs | 37 +++++++++++++++ .../Preferences/HumanoidCharacterProfile.cs | 16 +++++-- .../Preferences/ICharacterProfile.cs | 4 +- .../Content.Corvax.Interfaces.Client.csproj | 13 ++++++ .../IClientDiscordAuthManager.cs | 8 ++++ .../IClientJoinQueueManager.cs | 6 +++ .../IClientSponsorsManager.cs | 8 ++++ .../ISponsorWindowCreator.cs | 6 +++ .../Content.Corvax.Interfaces.Server.csproj | 13 ++++++ .../IServerDiscordAuthManager.cs | 13 ++++++ .../IServerJoinQueueManager.cs | 10 ++++ .../IServerLoadoutManager.cs | 10 ++++ .../IServerSponsorsManager.cs | 14 ++++++ .../IServerVPNGuardManager.cs | 9 ++++ .../Content.Corvax.Interfaces.Shared.csproj | 10 ++++ .../ISharedDiscordAuthManager.cs | 6 +++ .../ISharedSponsorsManager.cs | 6 +++ Secrets | 1 + SpaceStation14.sln | 35 ++++++++++++++ 34 files changed, 371 insertions(+), 22 deletions(-) create mode 100644 Corvax/Content.Corvax.Interfaces.Client/Content.Corvax.Interfaces.Client.csproj create mode 100644 Corvax/Content.Corvax.Interfaces.Client/IClientDiscordAuthManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Client/IClientJoinQueueManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Client/IClientSponsorsManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Client/ISponsorWindowCreator.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Server/Content.Corvax.Interfaces.Server.csproj create mode 100644 Corvax/Content.Corvax.Interfaces.Server/IServerDiscordAuthManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Server/IServerJoinQueueManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Server/IServerLoadoutManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Server/IServerSponsorsManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Server/IServerVPNGuardManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Shared/Content.Corvax.Interfaces.Shared.csproj create mode 100644 Corvax/Content.Corvax.Interfaces.Shared/ISharedDiscordAuthManager.cs create mode 100644 Corvax/Content.Corvax.Interfaces.Shared/ISharedSponsorsManager.cs create mode 160000 Secrets diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index 956f2fd0351..125bbac00df 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -22,6 +22,8 @@ + + diff --git a/Content.Client/Humanoid/MarkingPicker.xaml.cs b/Content.Client/Humanoid/MarkingPicker.xaml.cs index 43333439f08..64fcde98657 100644 --- a/Content.Client/Humanoid/MarkingPicker.xaml.cs +++ b/Content.Client/Humanoid/MarkingPicker.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Corvax.Interfaces.Client; using Content.Shared.Humanoid; using Content.Shared.Humanoid.Markings; using Content.Shared.Humanoid.Prototypes; @@ -18,6 +19,7 @@ public sealed partial class MarkingPicker : Control { [Dependency] private readonly MarkingManager _markingManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + private IClientSponsorsManager? _sponsorsManager; // Corvax-Sponsors public Action? OnMarkingAdded; public Action? OnMarkingRemoved; @@ -123,6 +125,7 @@ public MarkingPicker() { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); + IoCManager.Instance!.TryResolveType(out _sponsorsManager); // Corvax-Sponsors SetupCategoryButtons(); CMarkingCategoryButton.OnItemSelected += OnCategoryChange; @@ -202,6 +205,10 @@ public void Populate(string filter) var item = CMarkingsUnused.AddItem($"{GetMarkingName(marking)}", marking.Sprites[0].Frame0()); item.Metadata = marking; + // Corvax-Sponsors-Start + if (marking.SponsorOnly && _sponsorsManager != null) + item.Disabled = !_sponsorsManager.Prototypes.Contains(marking.ID); + // Corvax-Sponsors-End } CMarkingPoints.Visible = _currentMarkings.PointsLeft(_selectedMarkingCategory) != -1; diff --git a/Content.Client/Humanoid/SingleMarkingPicker.xaml.cs b/Content.Client/Humanoid/SingleMarkingPicker.xaml.cs index be3130a58bd..9e072ea4e02 100644 --- a/Content.Client/Humanoid/SingleMarkingPicker.xaml.cs +++ b/Content.Client/Humanoid/SingleMarkingPicker.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Corvax.Interfaces.Client; using Content.Shared.Humanoid.Markings; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; @@ -11,6 +12,7 @@ namespace Content.Client.Humanoid; public sealed partial class SingleMarkingPicker : BoxContainer { [Dependency] private readonly MarkingManager _markingManager = default!; + private IClientSponsorsManager? _sponsorsManager; // Corvax-Sponsors /// /// What happens if a marking is selected. @@ -122,6 +124,7 @@ public SingleMarkingPicker() { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); + IoCManager.Instance!.TryResolveType(out _sponsorsManager); // Corvax-Sponsors MarkingList.OnItemSelected += SelectMarking; AddButton.OnPressed += _ => @@ -190,6 +193,10 @@ public void PopulateList(string filter) { var item = MarkingList.AddItem(Loc.GetString($"marking-{id}"), marking.Sprites[0].Frame0()); item.Metadata = marking.ID; + // Corvax-Sponsors-Start + if (marking.SponsorOnly && _sponsorsManager != null) + item.Disabled = !_sponsorsManager.Prototypes.Contains(marking.ID); + // Corvax-Sponsors-End if (_markings[Slot].MarkingId == id) { diff --git a/Content.Client/Preferences/ClientPreferencesManager.cs b/Content.Client/Preferences/ClientPreferencesManager.cs index b518493c9d4..18b855e3cb5 100644 --- a/Content.Client/Preferences/ClientPreferencesManager.cs +++ b/Content.Client/Preferences/ClientPreferencesManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Content.Corvax.Interfaces.Client; using Content.Shared.Preferences; using Robust.Client; using Robust.Shared.Configuration; @@ -22,6 +23,7 @@ public sealed class ClientPreferencesManager : IClientPreferencesManager [Dependency] private readonly IBaseClient _baseClient = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IPrototypeManager _prototypes = default!; + private IClientSponsorsManager? _sponsorsManager; // Corvax-Sponsors public event Action? OnServerDataLoaded; @@ -30,6 +32,7 @@ public sealed class ClientPreferencesManager : IClientPreferencesManager public void Initialize() { + IoCManager.Instance!.TryResolveType(out _sponsorsManager); // Corvax-Sponsors _netManager.RegisterNetMessage(HandlePreferencesAndSettings); _netManager.RegisterNetMessage(); _netManager.RegisterNetMessage(); @@ -64,7 +67,10 @@ public void SelectCharacter(int slot) public void UpdateCharacter(ICharacterProfile profile, int slot) { - profile.EnsureValid(_cfg, _prototypes); + // Corvax-Sponsors-Start + var sponsorPrototypes = _sponsorsManager?.Prototypes.ToArray() ?? []; + profile.EnsureValid(_cfg, _prototypes, sponsorPrototypes); + // Corvax-Sponsors-End var characters = new Dictionary(Preferences.Characters) {[slot] = profile}; Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor); var msg = new MsgUpdateCharacter diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.xaml b/Content.Client/Preferences/UI/CharacterSetupGui.xaml index 9a76029ce0b..40aa24cd15b 100644 --- a/Content.Client/Preferences/UI/CharacterSetupGui.xaml +++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml @@ -14,6 +14,12 @@ Text="{Loc 'character-setup-gui-character-setup-stats-button'}" StyleClasses="ButtonBig" HorizontalAlignment="Right" /> + +