Add character names to round end screen and localize more of the strings (#5088)

* Add character names and move more traitor round end strings to fluent

* Change coloring and wording

* Fix no objectives
This commit is contained in:
ShadowCommander
2021-11-03 06:40:32 -07:00
committed by GitHub
parent 954959ad49
commit bfc63e2912
3 changed files with 37 additions and 18 deletions

View File

@@ -174,29 +174,43 @@ namespace Content.Server.GameTicking.Presets
public override string GetRoundEndDescription() public override string GetRoundEndDescription()
{ {
var result = Loc.GetString( var result = Loc.GetString("traitor-round-end-result", ("traitorCount", _traitors.Count));
"traitor-round-end-result",
("traitorCount", _traitors.Count)
);
foreach (var traitor in _traitors) foreach (var traitor in _traitors)
{ {
if (traitor.Mind.TryGetSession(out var session)) var name = traitor.Mind.CharacterName;
{ traitor.Mind.TryGetSession(out var session);
result += "\n" + Loc.GetString("traitor-user-was-a-traitor", ("user", session.Name)); var username = session?.Name;
}
var objectives = traitor.Mind.AllObjectives.ToArray(); var objectives = traitor.Mind.AllObjectives.ToArray();
if (objectives.Length == 0) if (objectives.Length == 0)
{ {
result += ".\n"; if (username != null)
{
if (name == null)
result += "\n" + Loc.GetString("traitor-user-was-a-traitor", ("user", username));
else
result += "\n" + Loc.GetString("traitor-user-was-a-traitor-named", ("user", username), ("name", name));
}
else if (name != null)
result += "\n" + Loc.GetString("traitor-was-a-traitor-named", ("name", name));
continue; continue;
} }
result += Loc.GetString("traitor-objective-list-start"); if (username != null)
{
if (name == null)
result += "\n" + Loc.GetString("traitor-user-was-a-traitor-with-objectives", ("user", username));
else
result += "\n" + Loc.GetString("traitor-user-was-a-traitor-with-objectives-named", ("user", username), ("name", name));
}
else if (name != null)
result += "\n" + Loc.GetString("traitor-was-a-traitor-with-objectives-named", ("name", name));
foreach (var objectiveGroup in objectives.GroupBy(o => o.Prototype.Issuer)) foreach (var objectiveGroup in objectives.GroupBy(o => o.Prototype.Issuer))
{ {
result += $"\n[color=#87cefa]{objectiveGroup.Key}[/color]"; result += "\n" + Loc.GetString($"preset-traitor-objective-issuer-{objectiveGroup.Key}");
foreach (var objective in objectiveGroup) foreach (var objective in objectiveGroup)
{ {

View File

@@ -8,10 +8,15 @@ traitor-round-end-result = {$traitorCount ->
} }
# Shown at the end of a round of Traitor # Shown at the end of a round of Traitor
traitor-user-was-a-traitor = {$user} was a traitor. traitor-user-was-a-traitor = [color=gray]{$user}[/color] was a traitor.
traitor-user-was-a-traitor-named = [color=White]{$name}[/color] ([color=gray]{$user}[/color]) was a traitor.
traitor-was-a-traitor-named = [color=White]{$name}[/color] was a traitor.
# Shown at the end of a round of Traitor traitor-user-was-a-traitor-with-objectives = [color=gray]{$user}[/color] was a traitor who had the following objectives:
traitor-objective-list-start = and had the following objectives: traitor-user-was-a-traitor-with-objectives-named = [color=White]{$name}[/color] ([color=gray]{$user}[/color]) was a traitor who had the following objectives:
traitor-was-a-traitor-with-objectives-named = [color=White]{$name}[/color] was a traitor who had the following objectives:
preset-traitor-objective-issuer-syndicate = [color=#87cefa]The Syndicate[/color]
# Shown at the end of a round of Traitor # Shown at the end of a round of Traitor
traitor-objective-condition-success = {$condition} | [color={$markupColor}]Success![/color] traitor-objective-condition-success = {$condition} | [color={$markupColor}]Success![/color]

View File

@@ -1,6 +1,6 @@
- type: objective - type: objective
id: CaptainIDStealObjective id: CaptainIDStealObjective
issuer: The Syndicate issuer: syndicate
requirements: requirements:
- !type:TraitorRequirement {} - !type:TraitorRequirement {}
- !type:IncompatibleConditionsRequirement - !type:IncompatibleConditionsRequirement
@@ -12,7 +12,7 @@
- type: objective - type: objective
id: KillRandomObjective id: KillRandomObjective
issuer: The Syndicate issuer: syndicate
requirements: requirements:
- !type:TraitorRequirement {} - !type:TraitorRequirement {}
conditions: conditions:
@@ -21,7 +21,7 @@
- type: objective - type: objective
id: StayAliveObjective id: StayAliveObjective
issuer: The Syndicate issuer: syndicate
requirements: requirements:
- !type:TraitorRequirement {} - !type:TraitorRequirement {}
- !type:IncompatibleConditionsRequirement - !type:IncompatibleConditionsRequirement
@@ -32,7 +32,7 @@
- type: objective - type: objective
id: DieObjective id: DieObjective
issuer: The Syndicate issuer: syndicate
requirements: requirements:
- !type:TraitorRequirement {} - !type:TraitorRequirement {}
- !type:IncompatibleConditionsRequirement - !type:IncompatibleConditionsRequirement