From 0ab2440a118343979dcfdb8b4914464cf4f8709c Mon Sep 17 00:00:00 2001 From: SpicyDarkFox <128318785+SpicyDarkFox@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:23:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D1=81=D0=BF=D0=BE?= =?UTF-8?q?=D0=BD=D1=81=D0=BE=D1=80=D0=BA=D0=B8=20(#385)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Исправление Спонсорки + переводов --- .../Lobby/UI/HumanoidProfileEditor.xaml.cs | 36 ++++++++++-- .../Systems/CharacterRequirements.Job.cs | 43 ++++----------- .../Systems/CharacterRequirements.Profile.cs | 2 +- .../Systems/CharacterRequirementsSystem.cs | 8 ++- .../Locale/en-US/_LostParadise/update20.ftl | 55 ++++++++++--------- .../Locale/ru-RU/_LostParadise/update20.ftl | 2 +- 6 files changed, 79 insertions(+), 67 deletions(-) diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs index 54bd3c38e2..e94869cc77 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs @@ -28,6 +28,7 @@ using Robust.Client.UserInterface.XAML; using Robust.Client.Utility; using Robust.Client.Player; +using Robust.Shared.Player; using Robust.Shared.Configuration; using Robust.Shared.Enums; using Robust.Shared.Map; @@ -720,6 +721,14 @@ public void RefreshJobs() _jobPriorities.Clear(); var firstCategory = true; +#if LPP_Sponsors + var sys = IoCManager.Resolve(); + var sponsorTier = 0; + if (sys.TryGetInfo(out var sponsorInfo)) + sponsorTier = sponsorInfo.Tier; + var uuid = _playerManager.LocalUser != null ? _playerManager.LocalUser.ToString() ?? "" : ""; +#endif + var departments = _prototypeManager.EnumeratePrototypes().ToArray(); Array.Sort(departments, DepartmentUIComparer.Instance); @@ -800,7 +809,11 @@ public void RefreshJobs() _entManager, _prototypeManager, _cfgManager, - out var reasons)) + out var reasons +#if LPP_Sponsors + , 0, sponsorTier, uuid +#endif + )) selector.LockRequirements(_characterRequirementsSystem.GetRequirementsText(reasons)); else selector.UnlockRequirements(); @@ -2161,7 +2174,15 @@ out _ .ToList()); var categories = new Dictionary(); foreach (var (key, value) in cats) + { + if (key == "Sponsors" +#if LPP_Sponsors + && sponsorTier == 0 +#endif + ) // не добавлять категорию неспонсорам + continue; categories.Add(key, value); + } // Create the UI elements for the category tree CreateCategoryUI(categories, LoadoutsTabs); @@ -2190,10 +2211,17 @@ out _ AddSelector(selector); // Look for an existing category tab - var match = FindCategory(loadout.Category, LoadoutsTabs); + if (!(loadout.Category == "Sponsors" +#if LPP_Sponsors + && sponsorTier == 0 +#endif + )) //не добавлять спонсорские предметы никуда если нет уровня + { + var match = FindCategory(loadout.Category, LoadoutsTabs); - // If there is no category put it in Uncategorized (this shouldn't happen) - (match ?? uncategorized).Children.First().Children.First().AddChild(selector); + // If there is no category put it in Uncategorized (this shouldn't happen) + (match ?? uncategorized).Children.First().Children.First().AddChild(selector); + } } // Hide any empty tabs diff --git a/Content.Shared/Customization/Systems/CharacterRequirements.Job.cs b/Content.Shared/Customization/Systems/CharacterRequirements.Job.cs index b0d85b5a7d..2fa00fc6e4 100644 --- a/Content.Shared/Customization/Systems/CharacterRequirements.Job.cs +++ b/Content.Shared/Customization/Systems/CharacterRequirements.Job.cs @@ -152,18 +152,11 @@ public override bool IsValid(JobPrototype job, return !Inverted; } -#if LPP_Sponsors - if (job.Requirements != null && job.Requirements.OfType().Any()) - if (!whitelisted) - { - reason = null; - return false; - } - +#if LPP_Sponsors //поскольку проверка на ВЛ происходит до вызова этого блока, то доп проверка не нужна if (sponsorTier >= 5) { reason = null; - return true; + return !Inverted; } #endif @@ -244,17 +237,10 @@ public override bool IsValid(JobPrototype job, } #if LPP_Sponsors - if (job.Requirements != null && job.Requirements.OfType().Any()) - if (!whitelisted) - { - reason = null; - return false; - } - if (sponsorTier >= 5) { reason = null; - return true; + return !Inverted; } #endif @@ -324,6 +310,14 @@ public override bool IsValid(JobPrototype job, return !Inverted; } +#if LPP_Sponsors //игнорируем любые требования по времени (только времени) + if (sponsorTier >= 5) + { + reason = null; + return !Inverted; + } +#endif + // Get SharedJobSystem if (!entityManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem)) { @@ -349,21 +343,6 @@ public override bool IsValid(JobPrototype job, var time = playTimes.GetValueOrDefault(Tracker); reason = null; -#if LPP_Sponsors - if (job.Requirements != null && job.Requirements.OfType().Any()) - if (!whitelisted) - { - reason = null; - return false; - } - - if (sponsorTier >= 5) - { - reason = null; - return true; - } -#endif - if (time > Max) { // Show the reason if invalid diff --git a/Content.Shared/Customization/Systems/CharacterRequirements.Profile.cs b/Content.Shared/Customization/Systems/CharacterRequirements.Profile.cs index 25f3dece2b..6dd2a7cdec 100644 --- a/Content.Shared/Customization/Systems/CharacterRequirements.Profile.cs +++ b/Content.Shared/Customization/Systems/CharacterRequirements.Profile.cs @@ -483,7 +483,7 @@ public override bool IsValid( int sponsorTier = 0, string uuid = "") { - reason = Loc.GetString("character-uuid-requirement", ("uuid", Uuid)); + reason = Loc.GetString("character-uuid-requirement"); //не нужно сообщать uuid return uuid == Uuid; } } diff --git a/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs b/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs index 2d2f7d47bd..9a67d7b240 100644 --- a/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs +++ b/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs @@ -28,7 +28,11 @@ public bool CheckRequirementValid(CharacterRequirement requirement, JobPrototype return !requirement.IsValid(job, profile, playTimes, whitelisted, prototype, entityManager, prototypeManager, configManager, - out reason, depth) + out reason, depth +#if LPP_Sponsors + , sponsorTier, uuid +#endif + ) ? requirement.Inverted : !requirement.Inverted; } @@ -53,7 +57,7 @@ public bool CheckRequirementsValid(List requirements, JobP entityManager, prototypeManager, configManager, out var reason, depth #if LPP_Sponsors - , sponsorTier = 0, uuid = "" + , sponsorTier, uuid #endif )) { diff --git a/Resources/Locale/en-US/_LostParadise/update20.ftl b/Resources/Locale/en-US/_LostParadise/update20.ftl index 98cfb6f2b4..a0e3e368da 100644 --- a/Resources/Locale/en-US/_LostParadise/update20.ftl +++ b/Resources/Locale/en-US/_LostParadise/update20.ftl @@ -1,32 +1,33 @@ -lathe-category-hardsuit = Скафандры -trait-name-ElfLanguage = Эльфийский язык -trait-desc-ElfLanguage = - Эльфийский — это язык эльфов на котором говорят практически все кабали Эльфийской Паутины Систем. - Эльфийская речь со стороны может показаться текучей, плавной и красивой. -trait-name-DwarfLanguage = Дворфийский язык -trait-desc-DwarfLanguage = - Дварфийский это язык, на котором говорят дворфы. Со стороны, если не вслушиваться, похоже на бормотание пьяных русских. -changelog-tab-title-ChangelogLPP = Обновления Lost Paradise +lathe-category-hardsuit = Hardsuits +trait-name-ElfLanguage = Elvish language +trait-desc-ElfLanguage = + Elvish is the language of elves spoken by almost all the cabals of the Elven Web of Systems. + Elven speech may seem fluid, smooth, and beautiful to outsiders. +trait-name-DwarfLanguage = Dwarvish Language +trait-desc-DwarfLanguage = + Dwarvish is the language spoken by dwarves. To an outsider, if you don't listen closely, it sounds like the mumbling of drunk Russians. +changelog-tab-title-ChangelogLPP = Lost Paradise Updates announcer-NTH-name = N.T.H. announcer-AFONYA-name = C.A.S.S.I.E. -chatsan-awoo = воет -chatsan-hiss = шипит -chatsan-nyaaa = някает -store-currency-display-centcoin = ЦентКоин -department-CentralCommand-description = Вы самый лучший отдел! -department-CentralCommand = Центральное командование -reagent-name-red-bool = Ред Булеан -reagent-desc-red-bool = Окрыляет! -id-card-access-level-expeditor = Исследователь +chatsan-awoo = howls +chatsan-hiss = hisses +chatsan-nyaaa = meows +store-currency-display-centcoin = CentCoin +department-CentralCommand-description = You are the best department! +department-CentralCommand = Central Command +reagent-name-red-bool = Red Boolean +reagent-desc-red-bool = Gives you wings! +id-card-access-level-expeditor = Researcher chat-manager-send-ooc-admin-wrap-message = OOC: [bold][color={ $adminColor }]\[{ $adminTitle }\][/color]{ $playerName }:[/bold] { $message } chat-manager-send-ooc-admin-sponsor-wrap-message = OOC: [bold][color={ $adminColor }]\[{ $adminTitle }\][/color] [color={ $patronColor }]{ $playerName }:[/color][/bold] { $message } -ui-options-function-lpp-smart-equip-neck = Умная экипировка на шею -species-name-shark = Акулоид -reagent-effect-status-effect-Forceddead = Смерть -reagent-effect-status-effect-SlurredSpeech = Дизартрия +ui-options-function-lpp-smart-equip-neck = Smart Neck Equipment +species-name-shark = Sharkoid +reagent-effect-status-effect-Forceddead = Death +reagent-effect-status-effect-SlurredSpeech = Slurred Speech character-sponsor-requirement = - Вы должны { $inverted -> - [true] не быть - *[other] быть - } между [color=yellow]{ $min }[/color] и [color=yellow]{ $max }[/color] спонсорским уровнем -character-uuid-requirement = Вы должны быть [color=yellow]{ $uuid }[/color] + You must { $inverted -> + [true] not be + *[other] be + } between [color=yellow]{ $min }[/color] and [color=yellow]{ $max }[/color] sponsor levels + +character-uuid-requirement = This belongs to someone else. diff --git a/Resources/Locale/ru-RU/_LostParadise/update20.ftl b/Resources/Locale/ru-RU/_LostParadise/update20.ftl index e32a3021f4..21a4d36c56 100644 --- a/Resources/Locale/ru-RU/_LostParadise/update20.ftl +++ b/Resources/Locale/ru-RU/_LostParadise/update20.ftl @@ -22,4 +22,4 @@ character-sponsor-requirement = [true] не быть *[other] быть } между [color=yellow]{ $min }[/color] и [color=yellow]{ $max }[/color] спонсорским уровнем -character-uuid-requirement = Вы должны быть [color=yellow]{ $uuid }[/color] +character-uuid-requirement = Это принадлежит кому-то другому.