Skip to content

Commit

Permalink
Merge pull request #140 from SpicyDarkFox/dbg
Browse files Browse the repository at this point in the history
Фиксики 1
  • Loading branch information
SpicyDarkFox authored Sep 14, 2024
2 parents fbd78d9 + 4e3f1ae commit ac62257
Show file tree
Hide file tree
Showing 14 changed files with 462 additions and 49 deletions.
17 changes: 16 additions & 1 deletion Content.Client/LateJoin/LateJoinGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
using Robust.Shared.Player;
#if LPP_Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.LateJoin
{
Expand Down Expand Up @@ -86,6 +90,13 @@ private void RebuildUI()
_jobButtons.Clear();
_jobCategories.Clear();

#if LPP_Sponsors
var sys = IoCManager.Resolve<IEntitySystemManager>();
var checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
checkSponsorSystem.GoCheckSponsor();
var sponsorTier = checkSponsorSystem.GetSponsorStatus().Item2;
#endif

if (!_gameTicker.DisallowedLateJoin && _gameTicker.StationNames.Count == 0)
Logger.Warning("No stations exist, nothing to display in late-join GUI");

Expand Down Expand Up @@ -273,7 +284,11 @@ private void RebuildUI()
_entityManager,
_prototypeManager,
_configManager,
out var reasons))
out var reasons
#if LPP_Sponsors
, 0, sponsorTier
#endif
))
{
jobButton.Disabled = true;

Expand Down
16 changes: 15 additions & 1 deletion Content.Client/Preferences/UI/AntagPreferenceSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using Content.Shared.Roles;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
#if LPP_Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.Preferences.UI;

Expand Down Expand Up @@ -40,6 +43,13 @@ public AntagPreferenceSelector(AntagPrototype proto, JobPrototype highJob) : bas
var protoMan = IoCManager.Resolve<IPrototypeManager>();
var configMan = IoCManager.Resolve<IConfigurationManager>();

#if LPP_Sponsors
var sys = IoCManager.Resolve<IEntitySystemManager>();
var checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
checkSponsorSystem.GoCheckSponsor();
var sponsorTier = checkSponsorSystem.GetSponsorStatus().Item2;
#endif

if (proto.Requirements != null
&& !characterReqs.CheckRequirementsValid(
proto.Requirements,
Expand All @@ -51,7 +61,11 @@ public AntagPreferenceSelector(AntagPrototype proto, JobPrototype highJob) : bas
entMan,
protoMan,
configMan,
out var reasons))
out var reasons
#if LPP_Sponsors
, 0, sponsorTier
#endif
))
LockRequirements(characterReqs.GetRequirementsText(reasons));
}
}
15 changes: 9 additions & 6 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:humanoid="clr-namespace:Content.Client.Humanoid"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:donate="clr-namespace:Content.Client._LostParadise.Donate"
HorizontalExpand="True">
<!-- Left side -->
<BoxContainer Orientation="Vertical" Margin="10 10 10 10" HorizontalExpand="True">
Expand Down Expand Up @@ -219,18 +220,20 @@
<ui:NeoTabContainer Name="CLoadoutsTabs" VerticalExpand="True" SeparatorMargin="0" />
</BoxContainer>
<!-- Lost Paradise Donate Preferences Begin -->
<BoxContainer Orientation="Vertical" Margin="10" Name="LPPDonate">
<BoxContainer Orientation="Vertical" Margin="10" Name="LPPDonateTab">
<!-- Donate -->
<ScrollContainer VerticalExpand="True">
<BoxContainer Name="DonateList" Orientation="Vertical" />
<ScrollContainer HorizontalExpand="True" HScrollEnabled="True" VerticalExpand="True" VScrollEnabled="True">
<BoxContainer Name="DonateList" Orientation="Vertical">
<CheckBox></CheckBox>
</BoxContainer>
</ScrollContainer>

<ui:NeoTabContainer Name="LPPDonates" VerticalExpand="True" SeparatorMargin="0" />
</BoxContainer>
<!-- Lost Paradise Donate Preferences End -->
<BoxContainer Name="CMarkingsTab" HorizontalExpand="True" Orientation="Vertical" Margin="10">
<!-- Markings -->
<humanoid:MarkingPicker Name="CMarkings" IgnoreCategories="Hair,FacialHair" />
<ScrollContainer VerticalExpand="True">
<humanoid:MarkingPicker Name="CMarkings" IgnoreCategories="Hair,FacialHair" />
</ScrollContainer>
</BoxContainer>
</ui:NeoTabContainer>
</BoxContainer>
Expand Down
75 changes: 66 additions & 9 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
using Robust.Shared.Utility;
using static Content.Client.Stylesheets.StyleBase;
using Direction = Robust.Shared.Maths.Direction;
#if LPP_Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.Preferences.UI
{
Expand Down Expand Up @@ -90,7 +93,7 @@ public sealed partial class HumanoidProfileEditor : BoxContainer
private Button _loadoutsRemoveUnusableButton => LoadoutsRemoveUnusableButton;
private NeoTabContainer _loadoutsTabs => CLoadoutsTabs;

private BoxContainer _donateList => DonateList; // Lost Paradise Donate Preferences
private BoxContainer _donateList => LPPDonateTab; // Lost Paradise Donate Preferences
#if LPP_Sponsors
private List<_LostParadise.Donate.DonatePreferenceSelector> _donatePreferences; // Lost Paradise Donate Preferences
#endif
Expand Down Expand Up @@ -609,25 +612,26 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt

#if LPP_Sponsors // Lost Paradise Donate Preferences
#region Donate
LPPDonates.Orphan();
LPPDonateTab.Orphan();
_tabContainer.AddTab(LPPDonateTab, Loc.GetString("lost-donate-editor"));
var donate = prototypeManager.EnumeratePrototypes<Shared._LostParadise.Donate.DonatePrototype>().OrderBy(t => Loc.GetString(t.Name)).ToList();
_donatePreferences = new List<_LostParadise.Donate.DonatePreferenceSelector>();
_tabContainer.AddTab(LPPDonates, Loc.GetString("lost-donate-editor"));
var granted = false;
_donateList.DisposeAllChildren();
if (donate.Count > 0)
{
foreach (var donatet in donate)
{
var selector = new _LostParadise.Donate.DonatePreferenceSelector(donatet);
_donateList.AddChild(selector);
_donatePreferences.Add(selector);

selector.PreferenceChanged += preference =>
{
Profile = Profile?.WithDonatePreference(donatet.ID, preference);
};
if (selector.Gave)
granted = true;

_donateList.AddChild(selector);
_donatePreferences.Add(selector);
}
}
if (!granted)
Expand All @@ -642,7 +646,7 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt
#endregion

#else
LPPDonate.Dispose();
LPPDonateTab.Dispose();
#endif
#endregion Left

Expand All @@ -658,6 +662,19 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt
IsDirty = false;
}

#if LPP_Sponsors // Lost Paradise Donate Preferences
private void RefreshDonatePreferences()
{
_donatePreferences = new List<_LostParadise.Donate.DonatePreferenceSelector>();
foreach (var preferenceSelector in _donatePreferences)
{
var donateId = preferenceSelector.Donate.ID;
var preference = Profile?.DonatePreferences.Contains(donateId) ?? false;

preferenceSelector.Preference = preference;
}
}
#endif

private void LoadoutsChanged(bool enabled)
{
Expand Down Expand Up @@ -737,6 +754,13 @@ private void UpdateRoleRequirements()
_jobCategories.Clear();
var firstCategory = true;

#if LPP_Sponsors
var sys = IoCManager.Resolve<IEntitySystemManager>();
var checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
checkSponsorSystem.GoCheckSponsor();
var sponsorTier = checkSponsorSystem.GetSponsorStatus().Item2;
#endif

var departments = _prototypeManager.EnumeratePrototypes<DepartmentPrototype>().ToArray();
Array.Sort(departments, DepartmentUIComparer.Instance);

Expand Down Expand Up @@ -803,7 +827,11 @@ private void UpdateRoleRequirements()
_entityManager,
_prototypeManager,
_configurationManager,
out var reasons))
out var reasons
#if LPP_Sponsors
, 0, sponsorTier
#endif
))
selector.LockRequirements(_characterRequirementsSystem.GetRequirementsText(reasons));

category.AddChild(selector);
Expand Down Expand Up @@ -846,6 +874,12 @@ private void UpdateRoleRequirements()
/// </summary>
private void EnsureJobRequirementsValid()
{
#if LPP_Sponsors
var sys = IoCManager.Resolve<IEntitySystemManager>();
var checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
checkSponsorSystem.GoCheckSponsor();
var sponsorTier = checkSponsorSystem.GetSponsorStatus().Item2;
#endif
foreach (var selector in _jobPriorities)
{
if (selector.Priority == JobPriority.Never
Expand All @@ -859,7 +893,11 @@ private void EnsureJobRequirementsValid()
_entityManager,
_prototypeManager,
_configurationManager,
out _))
out _
#if LPP_Sponsors
, 0, sponsorTier
#endif
))
continue;

selector.Priority = JobPriority.Never;
Expand Down Expand Up @@ -1506,6 +1544,13 @@ private void UpdateTraits(bool showUnusable)
// Get the highest priority job to use for trait filtering
var highJob = _controller.GetPreferredJob(Profile ?? HumanoidCharacterProfile.DefaultWithSpecies());

#if LPP_Sponsors
var sys = IoCManager.Resolve<IEntitySystemManager>();
var checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
checkSponsorSystem.GoCheckSponsor();
var sponsorTier = checkSponsorSystem.GetSponsorStatus().Item2;
#endif

_traits.Clear();
foreach (var trait in _prototypeManager.EnumeratePrototypes<TraitPrototype>())
{
Expand All @@ -1520,6 +1565,9 @@ private void UpdateTraits(bool showUnusable)
_prototypeManager,
_configurationManager,
out _
#if LPP_Sponsors
, 0, sponsorTier
#endif
);
_traits.Add(trait, usable);

Expand Down Expand Up @@ -1812,6 +1860,12 @@ private void UpdateLoadouts(bool showUnusable)
_loadoutPointsBar.MaxValue = points;
_loadoutPointsBar.Value = points;

#if LPP_Sponsors
var sys = IoCManager.Resolve<IEntitySystemManager>();
var checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
checkSponsorSystem.GoCheckSponsor();
var sponsorTier = checkSponsorSystem.GetSponsorStatus().Item2;
#endif

// Get the highest priority job to use for loadout filtering
var highJob = _controller.GetPreferredJob(Profile ?? HumanoidCharacterProfile.DefaultWithSpecies());
Expand All @@ -1830,6 +1884,9 @@ private void UpdateLoadouts(bool showUnusable)
_prototypeManager,
_configurationManager,
out _
#if LPP_Sponsors
, 0, sponsorTier
#endif
);
_loadouts.Add(loadout, usable);

Expand Down
16 changes: 14 additions & 2 deletions Content.Client/Preferences/UI/LoadoutPreferenceSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
#if LPP_Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.Preferences.UI;


public sealed class LoadoutPreferenceSelector : Control
{
public LoadoutPrototype Loadout { get; }
Expand Down Expand Up @@ -145,13 +147,23 @@ public LoadoutPreferenceSelector(LoadoutPrototype loadout, JobPrototype highJob,
if (!string.IsNullOrEmpty(desc))
tooltip.Append($"{Loc.GetString(desc)}");

#if LPP_Sponsors
var sys = IoCManager.Resolve<IEntitySystemManager>();
var checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
checkSponsorSystem.GoCheckSponsor();
var sponsorTier = checkSponsorSystem.GetSponsorStatus().Item2;
#endif

// Get requirement reasons
characterRequirementsSystem.CheckRequirementsValid(
loadout.Requirements, highJob, profile, new Dictionary<string, TimeSpan>(),
jobRequirementsManager.IsWhitelisted(), loadout,
entityManager, prototypeManager, configManager,
out var reasons);
out var reasons
#if LPP_Sponsors
, 0, sponsorTier
#endif
);

// Add requirement reasons to the tooltip
foreach (var reason in reasons)
Expand Down
17 changes: 15 additions & 2 deletions Content.Client/Preferences/UI/TraitPreferenceSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
#if LPP_Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.Preferences.UI;


public sealed class TraitPreferenceSelector : Control
{
public TraitPrototype Trait { get; }
Expand Down Expand Up @@ -82,13 +84,24 @@ public TraitPreferenceSelector(TraitPrototype trait, JobPrototype highJob, Human
if (!string.IsNullOrEmpty(desc) && desc != $"trait-description-{trait.ID}")
tooltip.Append(desc);

#if LPP_Sponsors
//Logger.Error("SPONSOR: go check sponsor - Trait");
var sys = IoCManager.Resolve<IEntitySystemManager>();
var _checkSponsorSystem = sys.GetEntitySystem<CheckSponsorClientSystem>();
_checkSponsorSystem.GoCheckSponsor();
var sponsorTier = _checkSponsorSystem.GetSponsorStatus().Item2;
#endif

// Get requirement reasons
characterRequirementsSystem.CheckRequirementsValid(
trait.Requirements, highJob, profile, new Dictionary<string, TimeSpan>(),
jobRequirementsManager.IsWhitelisted(), trait,
entityManager, prototypeManager, configManager,
out var reasons);
out var reasons
#if LPP_Sponsors
, 0, sponsorTier
#endif
);

// Add requirement reasons to the tooltip
foreach (var reason in reasons)
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Corvax/TTS/TTSSystem.Sanitize.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text;
using System.Text;
using System.Text.RegularExpressions;
using Content.Server.Chat.Systems;

Expand All @@ -10,7 +10,7 @@ public sealed partial class TTSSystem
private void OnTransformSpeech(TransformSpeechEvent args)
{
if (!_isEnabled) return;
args.Message = args.Message.Replace("+", "");
args.Message = args.Message.Replace("+", " ");
}

private string Sanitize(string text)
Expand Down
Loading

0 comments on commit ac62257

Please sign in to comment.