Files
tbd-station-14/Content.Server/Mobs/Roles/Suspicion/SuspicionTraitorRole.cs
DrSmugleaf 74943a2770 Typo, redundant string interpolation, namespaces and imports cleanup (#2068)
* Readonly, typos and redundant string interpolations

* Namespaces

* Optimize imports

* Address reviews

* but actually

* Localize missing strings

* Remove redundant vars
2020-09-13 14:23:52 +02:00

46 lines
1.6 KiB
C#

using System.Collections.Generic;
using System.Linq;
using Content.Server.Interfaces.Chat;
using Content.Shared.Roles;
using Robust.Shared.Localization;
namespace Content.Server.Mobs.Roles.Suspicion
{
public sealed class SuspicionTraitorRole : SuspicionRole
{
public AntagPrototype Prototype { get; }
public SuspicionTraitorRole(Mind mind, AntagPrototype antagPrototype) : base(mind)
{
Prototype = antagPrototype;
Name = antagPrototype.Name;
Antagonist = antagPrototype.Antagonist;
}
public override string Name { get; }
public string Objective => Prototype.Objective;
public override bool Antagonist { get; }
public void GreetSuspicion(List<SuspicionTraitorRole> traitors, IChatManager chatMgr)
{
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("You're a {0}!", Name));
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("Objective: {0}", Objective));
if (traitors.Count == 1)
{
// Only traitor.
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("You're on your own. Good luck!"));
return;
}
var text = string.Join(", ", traitors.Where(p => p != this).Select(p => p.Mind.CharacterName));
var pluralText = Loc.GetPluralString("Your partner in crime is: {0}",
"Your partners in crime are: {0}",
traitors.Count-1, text);
chatMgr.DispatchServerMessage(Mind.Session, pluralText);
}
}
}