Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Panic bunker print strings (new-frontiers-14#2300)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatston3 authored Oct 21, 2024
1 parent 1ccc3ab commit 33aaf31
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Content.Server/Connection/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,21 @@ session.Status is SessionStatus.Connected or SessionStatus.InGame

if (showReason && !haveMinOverallTime && !bypassAllowed)
{
// Frontier: panic bunker message, print minutes/hours depending on how much time left.
double minutesNeeded = minOverallMinutes - (overallTime?.TimeSpent.TotalMinutes ?? 0.0);
string reason;
if (minutesNeeded > 60)
{
reason = Loc.GetString("panic-bunker-account-reason-nf-overall-hours", ("hours", $"{minOverallMinutes / 60.0:F1}"), ("timeLeft", $"{minutesNeeded / 60.0:F1}"));
}
else
{
reason = Loc.GetString("panic-bunker-account-reason-nf-overall-minutes", ("hours", $"{minOverallMinutes / 60.0:F1}"), ("timeLeft", $"{minutesNeeded:F0}"));
}
return (ConnectionDenyReason.Panic,
Loc.GetString("panic-bunker-account-denied-reason",
("reason", Loc.GetString("panic-bunker-account-reason-overall", ("minutes", minOverallMinutes)))), null);
Loc.GetString("panic-bunker-account-denied-reason-nf",
("reason", reason)), null);
// End Frontier
}

if (!validAccountAge || !haveMinOverallTime && !bypassAllowed)
Expand Down
10 changes: 10 additions & 0 deletions Resources/Locale/en-US/_NF/connection-messages.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
panic-bunker-account-denied-reason-nf =
This server is in panic bunker mode, often enabled as a precaution against raids.
New connections by accounts not meeting certain requirements are temporarily not accepted. Try again later.
Reason: "{$reason}"
panic-bunker-account-reason-nf-overall-hours =
Your overall playtime on the server must be greater than {$hours} hours.
You need {$timeLeft} more hours to meet this requirement.
panic-bunker-account-reason-nf-overall-minutes =
Your overall playtime on the server must be greater than {$hours} hours.
You need {$timeLeft} more minutes to meet this requirement.

0 comments on commit 33aaf31

Please sign in to comment.