Skip to content

Commit

Permalink
Фикс спонсорки (#385)
Browse files Browse the repository at this point in the history
* Исправление Спонсорки + переводов
  • Loading branch information
SpicyDarkFox authored Jan 16, 2025
1 parent 60e236e commit 0ab2440
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 67 deletions.
36 changes: 32 additions & 4 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -720,6 +721,14 @@ public void RefreshJobs()
_jobPriorities.Clear();
var firstCategory = true;

#if LPP_Sponsors
var sys = IoCManager.Resolve<SponsorsManager>();
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<DepartmentPrototype>().ToArray();
Array.Sort(departments, DepartmentUIComparer.Instance);

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2161,7 +2174,15 @@ out _
.ToList());
var categories = new Dictionary<string, object>();
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);
Expand Down Expand Up @@ -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
Expand Down
43 changes: 11 additions & 32 deletions Content.Shared/Customization/Systems/CharacterRequirements.Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,11 @@ public override bool IsValid(JobPrototype job,
return !Inverted;
}

#if LPP_Sponsors
if (job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any())
if (!whitelisted)
{
reason = null;
return false;
}

#if LPP_Sponsors //поскольку проверка на ВЛ происходит до вызова этого блока, то доп проверка не нужна
if (sponsorTier >= 5)
{
reason = null;
return true;
return !Inverted;
}
#endif

Expand Down Expand Up @@ -244,17 +237,10 @@ public override bool IsValid(JobPrototype job,
}

#if LPP_Sponsors
if (job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any())
if (!whitelisted)
{
reason = null;
return false;
}

if (sponsorTier >= 5)
{
reason = null;
return true;
return !Inverted;
}
#endif

Expand Down Expand Up @@ -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))
{
Expand All @@ -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<CharacterWhitelistRequirement>().Any())
if (!whitelisted)
{
reason = null;
return false;
}

if (sponsorTier >= 5)
{
reason = null;
return true;
}
#endif

if (time > Max)
{
// Show the reason if invalid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -53,7 +57,7 @@ public bool CheckRequirementsValid(List<CharacterRequirement> requirements, JobP
entityManager, prototypeManager, configManager,
out var reason, depth
#if LPP_Sponsors
, sponsorTier = 0, uuid = ""
, sponsorTier, uuid
#endif
))
{
Expand Down
55 changes: 28 additions & 27 deletions Resources/Locale/en-US/_LostParadise/update20.ftl
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion Resources/Locale/ru-RU/_LostParadise/update20.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = Это принадлежит кому-то другому.

0 comments on commit 0ab2440

Please sign in to comment.