Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions source/Patches/CrewmateRoles/DetectiveMod/DeadBody.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using TownOfUs.Patches.Localization;
using TownOfUs.Roles;

namespace TownOfUs.CrewmateRoles.DetectiveMod
Expand All @@ -14,29 +15,29 @@ public static string ParseBodyReport(BodyReport br)
{
if (br.KillAge > CustomGameOptions.DetectiveFactionDuration * 1000)
return
$"Body Report: The corpse is too old to gain information from. (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportTooOld"), Math.Round(br.KillAge / 1000))}";

if (br.Killer.PlayerId == br.Body.PlayerId)
return
$"Body Report: The kill appears to have been a suicide! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportSuicide"), Math.Round(br.KillAge / 1000))}";

var role = Role.GetRole(br.Killer);

if (br.KillAge < CustomGameOptions.DetectiveRoleDuration * 1000)
return
$"Body Report: The killer appears to be a {role.Name}! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportRole"), role.Name, Math.Round(br.KillAge / 1000))}";

if (br.Killer.Is(Faction.Crewmates))
return
$"Body Report: The killer appears to be a Crewmate! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportCrewmate"), Math.Round(br.KillAge / 1000))}";

else if (br.Killer.Is(Faction.NeutralKilling) || br.Killer.Is(Faction.NeutralBenign))
return
$"Body Report: The killer appears to be a Neutral Role! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportNeutralRole"), Math.Round(br.KillAge / 1000))}";

else
return
$"Body Report: The killer appears to be an Impostor! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportImpostor"), Math.Round(br.KillAge / 1000))}";
}
}
}
9 changes: 5 additions & 4 deletions source/Patches/CrewmateRoles/MedicMod/DeadBody.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using TownOfUs.Extensions;
using TownOfUs.Patches.Localization;

namespace TownOfUs.CrewmateRoles.MedicMod
{
Expand All @@ -24,15 +25,15 @@ public static string ParseBodyReport(BodyReport br)
//System.Console.WriteLine(br.KillAge);
if (br.KillAge > CustomGameOptions.MedicReportColorDuration * 1000)
return
$"Body Report: The corpse is too old to gain information from. (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportTooOld"), Math.Round(br.KillAge / 1000))}";

if (br.Killer.PlayerId == br.Body.PlayerId)
return
$"Body Report: The kill appears to have been a suicide! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportSuicide"), Math.Round(br.KillAge / 1000))}";

if (br.KillAge < CustomGameOptions.MedicReportNameDuration * 1000)
return
$"Body Report: The killer appears to be {br.Killer.Data.PlayerName}! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportKillerAppearance"), br.Killer.Data.PlayerName, Math.Round(br.KillAge / 1000))}";

var colors = new Dictionary<int, string>
{
Expand Down Expand Up @@ -74,7 +75,7 @@ public static string ParseBodyReport(BodyReport br)
};
var typeOfColor = colors[br.Killer.GetDefaultOutfit().ColorId];
return
$"Body Report: The killer appears to be a {typeOfColor} color. (Killed {Math.Round(br.KillAge / 1000)}s ago)";
$"{string.Format(LocalizationManager.Instance.GetString("BodyReportKillerAppearance"), typeOfColor, Math.Round(br.KillAge / 1000))}";
}
}
}
7 changes: 4 additions & 3 deletions source/Patches/CrewmateRoles/OracleMod/HighlightConfessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HarmonyLib;
using TownOfUs.Patches.Localization;
using TownOfUs.Roles;

namespace TownOfUs.CrewmateRoles.OracleMod
Expand All @@ -15,9 +16,9 @@ public static void UpdateMeeting(Oracle role, MeetingHud __instance)
if (player.PlayerId != state.TargetPlayerId) continue;
if (player == role.Confessor)
{
if (role.RevealedFaction == Faction.Crewmates) state.NameText.text = "<color=#00FFFFFF>(Crew) </color>" + state.NameText.text;
else if (role.RevealedFaction == Faction.Impostors) state.NameText.text = "<color=#FF0000FF>(Imp) </color>" + state.NameText.text;
else state.NameText.text = "<color=#808080FF>(Neut) </color>" + state.NameText.text;
if (role.RevealedFaction == Faction.Crewmates) state.NameText.text = $"<color=#00FFFFFF>({LocalizationManager.Instance.GetString("Crew")})</color>" + state.NameText.text;
else if (role.RevealedFaction == Faction.Impostors) state.NameText.text = $"<color=#FF0000FF>({LocalizationManager.Instance.GetString("Imp")}) </color>" + state.NameText.text;
else state.NameText.text = $"<color=#808080FF>({LocalizationManager.Instance.GetString("Neut")}) </color>" + state.NameText.text;
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions source/Patches/CrewmateRoles/OracleMod/MeetingStart.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using HarmonyLib;
using System.Linq;
using TownOfUs.Extensions;
using TownOfUs.Patches.Localization;
using TownOfUs.Roles;

namespace TownOfUs.CrewmateRoles.OracleMod
Expand All @@ -23,13 +24,13 @@ public static void Postfix(MeetingHud __instance)

public static string PlayerReportFeedback(PlayerControl player)
{
if (player.Data.IsDead || player.Data.Disconnected) return "Your confessor failed to survive so you received no confession";
if (player.Data.IsDead || player.Data.Disconnected) return LocalizationManager.Instance.GetString("YourConfessorFailedToSurviveNoConfession");
var allPlayers = PlayerControl.AllPlayerControls.ToArray().Where(x => !x.Data.IsDead && !x.Data.Disconnected && x != PlayerControl.LocalPlayer && x != player).ToList();
if (allPlayers.Count < 2) return "Too few people alive to receive a confessional";
if (allPlayers.Count < 2) return LocalizationManager.Instance.GetString("TooFewPeopleAliveToReceiveConfessional");
var evilPlayers = PlayerControl.AllPlayerControls.ToArray().Where(x => !x.Data.IsDead && !x.Data.Disconnected &&
(x.Is(Faction.Impostors) || (x.Is(Faction.NeutralKilling) && CustomGameOptions.NeutralKillingShowsEvil) ||
(x.Is(Faction.NeutralEvil) && CustomGameOptions.NeutralEvilShowsEvil) || (x.Is(Faction.NeutralBenign) && CustomGameOptions.NeutralBenignShowsEvil))).ToList();
if (evilPlayers.Count == 0) return $"{player.GetDefaultOutfit().PlayerName} confesses to knowing that there are no more evil players!";
if (evilPlayers.Count == 0) return $"{string.Format(LocalizationManager.Instance.GetString("PlayerConfessesToKnowingNoMoreEvilPlayers"), player.GetDefaultOutfit().PlayerName)}";
allPlayers.Shuffle();
evilPlayers.Shuffle();
var secondPlayer = allPlayers[0];
Expand All @@ -41,12 +42,12 @@ public static string PlayerReportFeedback(PlayerControl player)
if (firstTwoEvil)
{
var thirdPlayer = allPlayers[1];
return $"{player.GetDefaultOutfit().PlayerName} confesses to knowing that they, {secondPlayer.GetDefaultOutfit().PlayerName} and/or {thirdPlayer.GetDefaultOutfit().PlayerName} is evil!";
return $"{string.Format(LocalizationManager.Instance.GetString("PlayerConfessesToKnowingNoMoreEvilPlayers"), player.GetDefaultOutfit().PlayerName, secondPlayer.GetDefaultOutfit().PlayerName, thirdPlayer.GetDefaultOutfit().PlayerName)}";
}
else
{
var thirdPlayer = evilPlayers[0];
return $"{player.GetDefaultOutfit().PlayerName} confesses to knowing that they, {secondPlayer.GetDefaultOutfit().PlayerName} and/or {thirdPlayer.GetDefaultOutfit().PlayerName} is evil!";
return $"{string.Format(LocalizationManager.Instance.GetString("PlayerConfessesToKnowingNoMoreEvilPlayers"), player.GetDefaultOutfit().PlayerName, secondPlayer.GetDefaultOutfit().PlayerName, thirdPlayer.GetDefaultOutfit().PlayerName)}";
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion source/Patches/CrewmateRoles/ProsecutorMod/AddProsecute.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HarmonyLib;
using TMPro;
using TownOfUs.Patches.Localization;
using TownOfUs.Roles;
using UnityEngine;

Expand All @@ -13,7 +14,7 @@ public static void UpdateButton(Prosecutor role, MeetingHud __instance)
role.Prosecute.gameObject.SetActive(skip.gameObject.active && !role.Prosecuted);
role.Prosecute.voteComplete = skip.voteComplete;
role.Prosecute.GetComponent<SpriteRenderer>().enabled = skip.GetComponent<SpriteRenderer>().enabled;
role.Prosecute.GetComponentsInChildren<TextMeshPro>()[0].text = "Prosecute";
role.Prosecute.GetComponentsInChildren<TextMeshPro>()[0].text = LocalizationManager.Instance.GetString("Prosecute");
}


Expand Down
7 changes: 4 additions & 3 deletions source/Patches/CrewmateRoles/TrapperMod/MeetingStart.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using HarmonyLib;
using System;
using System.Linq;
using TownOfUs.Patches.Localization;
using TownOfUs.Roles;

namespace TownOfUs.CrewmateRoles.TrapperMod
Expand All @@ -15,15 +16,15 @@ public static void Postfix(MeetingHud __instance)
var trapperRole = Role.GetRole<Trapper>(PlayerControl.LocalPlayer);
if (trapperRole.trappedPlayers.Count == 0)
{
DestroyableSingleton<HudManager>.Instance.Chat.AddChat(PlayerControl.LocalPlayer, "No players entered any of your traps");
DestroyableSingleton<HudManager>.Instance.Chat.AddChat(PlayerControl.LocalPlayer, LocalizationManager.Instance.GetString("NoPlayersEnteredTraps"));
}
else if (trapperRole.trappedPlayers.Count < CustomGameOptions.MinAmountOfPlayersInTrap)
{
DestroyableSingleton<HudManager>.Instance.Chat.AddChat(PlayerControl.LocalPlayer, "Not enough players triggered your traps");
DestroyableSingleton<HudManager>.Instance.Chat.AddChat(PlayerControl.LocalPlayer, LocalizationManager.Instance.GetString("NotEnoughPlayersTriggeredTraps"));
}
else
{
string message = "Roles caught in your trap:\n";
string message = $"{LocalizationManager.Instance.GetString("RolesCaughtInYourTrap")}:\n";
foreach (RoleEnum role in trapperRole.trappedPlayers.OrderBy(x => Guid.NewGuid()))
{
message += $" {role},";
Expand Down
3 changes: 2 additions & 1 deletion source/Patches/CrewmateRoles/VigilanteMod/AddButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ void Listener()
}

var newGuess = role.Guesses[voteArea.TargetPlayerId] = role.PossibleGuesses[guessIndex];

// @todo
// To test Not sure what's inside the variable to translate it
nameText.text = newGuess == "None"
? "Guess"
: $"<color=#{role.SortedColorMapping[newGuess].ToHtmlStringRGBA()}>{newGuess}</color>";
Expand Down
17 changes: 9 additions & 8 deletions source/Patches/CustomOption/Export.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using UnityEngine;
using Object = UnityEngine.Object;
using TownOfUs.Patches.Localization;

namespace TownOfUs.CustomOption
{
Expand All @@ -19,7 +20,7 @@ public class Export : CustomButtonOption

public List<CustomButtonOption> SlotButtons = new List<CustomButtonOption>();

protected internal Export(int id) : base(id, MultiMenu.main, "Save Custom Settings")
protected internal Export(int id) : base(id, MultiMenu.main, LocalizationManager.Instance.GetString("SaveCustomSettings"))
{
Do = ToDo;
}
Expand Down Expand Up @@ -63,7 +64,7 @@ protected internal IEnumerator CancelCoro(Func<IEnumerator> flashCoro)

Loading = SlotButtons[0];
Loading.Do = () => { };
Loading.Setting.Cast<ToggleOption>().TitleText.text = "Loading...";
Loading.Setting.Cast<ToggleOption>().TitleText.text = LocalizationManager.Instance.GetString("Loading")+"...";

__instance.Children = new[] {Loading.Setting};

Expand All @@ -84,12 +85,12 @@ protected internal IEnumerator CancelCoro(Func<IEnumerator> flashCoro)
protected internal void ToDo()
{
SlotButtons.Clear();
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, "Slot 1", delegate { ExportSlot(1); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, "Slot 2", delegate { ExportSlot(2); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, "Slot 3", delegate { ExportSlot(3); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, "Slot 4", delegate { ExportSlot(4); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, "Slot 5", delegate { ExportSlot(5); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, "Cancel", delegate { Cancel(FlashWhite); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, LocalizationManager.Instance.GetString("Slot") + " 1", delegate { ExportSlot(1); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, LocalizationManager.Instance.GetString("Slot") + " 2", delegate { ExportSlot(2); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, LocalizationManager.Instance.GetString("Slot") + " 3", delegate { ExportSlot(3); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, LocalizationManager.Instance.GetString("Slot") + " 4", delegate { ExportSlot(4); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, LocalizationManager.Instance.GetString("Slot") + " 5", delegate { ExportSlot(5); }));
SlotButtons.Add(new CustomButtonOption(1, MultiMenu.external, LocalizationManager.Instance.GetString("Cancel"), delegate { Cancel(FlashWhite); }));

var options = CreateOptions();

Expand Down
Loading