diff --git a/Content.Client/FlavorText/FlavorText.xaml.cs b/Content.Client/FlavorText/FlavorText.xaml.cs index f6afe3a142..a5b80dbdc4 100644 --- a/Content.Client/FlavorText/FlavorText.xaml.cs +++ b/Content.Client/FlavorText/FlavorText.xaml.cs @@ -11,9 +11,9 @@ namespace Content.Client.FlavorText { public Action? OnFlavorTextChanged; - private ISharedSponsorsManager? _sponsorsMgr; // Sunrise-Sponsors + private readonly ISharedSponsorsManager? _sponsorsMgr; // Sunrise-Sponsors - public FlavorText(ISharedSponsorsManager? sponsorsMgr, bool sponsorOnly) // Sunrise-Edit + public FlavorText(ISharedSponsorsManager? sponsorsMgr, bool sponsorOnly, int baseMaxDescLength) // Sunrise-Edit { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); @@ -23,17 +23,25 @@ namespace Content.Client.FlavorText var loc = IoCManager.Resolve(); CFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder")); CFlavorTextInput.OnTextChanged += _ => FlavorTextChanged(); - // Sunrise-Start - if (sponsorOnly) - { - SponsorOnlyNotify.Visible = true; - CFlavorTextInput.Visible = false; - LimitBox.Visible = false; - } + if (_sponsorsMgr != null && _sponsorsMgr.ClientAllowedFlavor()) { var maxDescLength = _sponsorsMgr.ClientGetSizeFlavor(); LimitLabel.Text = $"{maxDescLength}"; + } + else + { + LimitLabel.Text = $"{baseMaxDescLength}"; + } + // Sunrise-Start + if (!sponsorOnly || _sponsorsMgr == null) + { + SponsorOnlyNotify.Visible = false; + CFlavorTextInput.Visible = true; + LimitBox.Visible = true; + } + else if (_sponsorsMgr.ClientAllowedFlavor()) + { SponsorOnlyNotify.Visible = false; CFlavorTextInput.Visible = true; LimitBox.Visible = true; diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs index d3a320a29f..86e519f563 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs @@ -472,7 +472,8 @@ namespace Content.Client.Lobby.UI // Sunrise-Start var sponsorOnly = _cfgManager.GetCVar(SunriseCCVars.FlavorTextSponsorOnly); - _flavorText = new FlavorText.FlavorText(_sponsorsMgr, sponsorOnly); + var baseMaxDescLength = _cfgManager.GetCVar(SunriseCCVars.FlavorTextBaseLength); + _flavorText = new FlavorText.FlavorText(_sponsorsMgr, sponsorOnly, baseMaxDescLength); // Sunrise-End TabContainer.AddChild(_flavorText); TabContainer.SetTabTitle(TabContainer.ChildCount - 1, Loc.GetString("humanoid-profile-editor-flavortext-tab")); diff --git a/Content.Shared/Preferences/HumanoidCharacterProfile.cs b/Content.Shared/Preferences/HumanoidCharacterProfile.cs index 6e162c285d..99da5ce83b 100644 --- a/Content.Shared/Preferences/HumanoidCharacterProfile.cs +++ b/Content.Shared/Preferences/HumanoidCharacterProfile.cs @@ -32,7 +32,6 @@ namespace Content.Shared.Preferences private static readonly Regex ICNameCaseRegex = new(@"^(?\w)|\b(?\w)(?=\w*$)"); public const int MaxNameLength = 32; - public const int MaxDescLength = 512; /// /// Job preferences for initial spawn. @@ -573,7 +572,7 @@ namespace Content.Shared.Preferences // Sunrise-Start IoCManager.Instance!.TryResolveType(out var sponsors); - var maxDescLength = MaxDescLength; + var maxDescLength = configManager.GetCVar(SunriseCCVars.FlavorTextBaseLength); if (sponsors != null) { maxDescLength = sponsors.GetSizeFlavor(session.UserId); diff --git a/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs b/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs index ade139a40b..62afc20053 100644 --- a/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs +++ b/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs @@ -389,4 +389,7 @@ public sealed class SunriseCCVars /// public static readonly CVarDef FlavorTextSponsorOnly = CVarDef.Create("flavor_text.sponsor_only", true, CVar.SERVER | CVar.REPLICATED); + + public static readonly CVarDef FlavorTextBaseLength = + CVarDef.Create("flavor_text.length", 512, CVar.SERVER | CVar.REPLICATED); }