Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueHNT committed Jul 9, 2024
1 parent 95ce665 commit 6f92472
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public bool IsAllowed(JobPrototype job, [NotNullWhen(false)] out FormattedMessag
return CheckRoleTime(job.Requirements, out reason);
}

public bool CheckRoleTime(HashSet<JobRequirement>? requirements, [NotNullWhen(false)] out FormattedMessage? reason, string? localePrefix = null)
public bool CheckRoleTime(HashSet<JobRequirement>? requirements, [NotNullWhen(false)] out FormattedMessage? reason, string? localePrefix = "role-timer-")
{
reason = null;

Expand Down
26 changes: 12 additions & 14 deletions Content.Shared/Roles/JobRequirements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public static bool TryRequirementMet(
if (deptDiff <= 0)
return true;

reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-department-insufficient",
reason = FormattedMessage.FromMarkup(Loc.GetString(
$"{localePrefix}department-insufficient",
("time", Math.Ceiling(deptDiff)),
("department", Loc.GetString(deptRequirement.Department)),
("departmentColor", department.Color.ToHex())));
Expand All @@ -144,8 +144,8 @@ public static bool TryRequirementMet(
{
if (deptDiff <= 0)
{
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-department-too-high",
reason = FormattedMessage.FromMarkup(Loc.GetString(
$"{localePrefix}department-too-high",
("time", -deptDiff),
("department", Loc.GetString(deptRequirement.Department)),
("departmentColor", department.Color.ToHex())));
Expand All @@ -164,18 +164,16 @@ public static bool TryRequirementMet(
if (overallDiff <= 0 || overallTime >= overallRequirement.Time)
return true;

reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-overall-insufficient",
("time", Math.Ceiling(overallDiff))));
reason = FormattedMessage.FromMarkup(Loc.GetString(
$"{localePrefix}overall-insufficient",
("time", Math.Ceiling(overallDiff))));
return false;
}
else
{
if (overallDiff <= 0 || overallTime >= overallRequirement.Time)
{
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-overall-too-high",
("time", -overallDiff)));
reason = FormattedMessage.FromMarkup(Loc.GetString($"{localePrefix}overall-too-high", ("time", -overallDiff)));
return false;
}

Expand All @@ -202,8 +200,8 @@ public static bool TryRequirementMet(
if (roleDiff <= 0)
return true;

reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-role-insufficient",
reason = FormattedMessage.FromMarkup(Loc.GetString(
$"{localePrefix}role-insufficient",
("time", Math.Ceiling(roleDiff)),
("job", Loc.GetString(proto)),
("departmentColor", departmentColor.ToHex())));
Expand All @@ -213,8 +211,8 @@ public static bool TryRequirementMet(
{
if (roleDiff <= 0)
{
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-role-too-high",
reason = FormattedMessage.FromMarkup(Loc.GetString(
$"{localePrefix}role-too-high",
("time", -roleDiff),
("job", Loc.GetString(proto)),
("departmentColor", departmentColor.ToHex())));
Expand Down

0 comments on commit 6f92472

Please sign in to comment.