Even more fixes

This commit is contained in:
Gurge44 committed 2024-05-05 21:37:46 +02:00
1 parent 2d13f4b57a
commit 1c79f49731
32 files changed
+185 -204

No files matched your search

+23 -11
View File
@@ -26,6 +26,8 @@ namespace EHR
public static Dictionary<byte, byte> ClosestImpostor = [];
public static Dictionary<byte, int> Danger = [];
public static List<CustomRoles> AllHnSRoles = [];
public static void SetupCustomOption()
{
const int id = 69_211_001;
@@ -53,21 +55,14 @@ namespace EHR
TimeLeft = MaxGameLength.GetInt() + 8;
LastUpdate = Utils.TimeStamp;
Type[] types = Assembly
.GetExecutingAssembly()
.GetTypes()
.Where(t => (typeof(IHideAndSeekRole)).IsAssignableFrom(t) && !t.IsInterface)
.ToArray();
Type[] types = GetAllHnsRoleTypes();
CustomRoles[] roleEnums = types
.Select(x => ((CustomRoles)Enum.Parse(typeof(CustomRoles), ignoreCase: true, value: x.Name)))
.Where(role => role is CustomRoles.Seeker or CustomRoles.Hider || role.GetMode() != 0)
.ToArray();
AllHnSRoles = GetAllHnsRoles(types);
HideAndSeekRoles = types
.Select(x => (IHideAndSeekRole)Activator.CreateInstance(x))
.Where(x => x != null)
.Join(roleEnums, x => x.GetType().Name.ToLower(), x => x.ToString().ToLower(), (Interface, Enum) => (Enum, Interface))
.Join(AllHnSRoles, x => x.GetType().Name.ToLower(), x => x.ToString().ToLower(), (Interface, Enum) => (Enum, Interface))
.Where(x => (!x.Enum.OnlySpawnsWithPets() || Options.UsePets.GetBool()) && (x.Enum != CustomRoles.Agent || Main.RealOptionsData.GetInt(Int32OptionNames.NumImpostors) >= 2) && x.Interface.Count > 0 && x.Interface.Chance > IRandom.Instance.Next(100))
.OrderBy(x => x.Enum is CustomRoles.Seeker or CustomRoles.Hider ? 100 : IRandom.Instance.Next(100))
.GroupBy(x => x.Interface.Team)
@@ -92,6 +87,23 @@ namespace EHR
AssignRoles();
}
public static List<CustomRoles> GetAllHnsRoles(IEnumerable<Type> types)
{
return types
.Select(x => ((CustomRoles)Enum.Parse(typeof(CustomRoles), ignoreCase: true, value: x.Name)))
.Where(role => role is CustomRoles.Seeker or CustomRoles.Hider || role.GetMode() != 0)
.ToList();
}
public static Type[] GetAllHnsRoleTypes()
{
return Assembly
.GetExecutingAssembly()
.GetTypes()
.Where(t => (typeof(IHideAndSeekRole)).IsAssignableFrom(t) && !t.IsInterface)
.ToArray();
}
private static void AssignRoles()
{
Dictionary<PlayerControl, CustomRoles> result = [];
@@ -120,7 +132,7 @@ namespace EHR
Logger.Warn($"Pre-Set Role Assigned: {pc.GetRealName()} => {item.Value}", "CustomRoleSelector");
}
var playerTeams = EnumHelper.GetAllValues<Team>()[1..]
var playerTeams = Enum.GetValues<Team>()[1..]
.SelectMany(x => Enumerable.Repeat(x, memberNum[x]))
.Shuffle(IRandom.Instance)
.Zip(allPlayers)
+5 -4
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using AmongUs.GameOptions;
using EHR.Roles.Impostor;
@@ -105,10 +106,10 @@ internal static class CustomRoleSelector
foreach (var id in Main.SetRoles.Keys.Where(id => Utils.GetPlayerById(id) == null).ToArray()) Main.SetRoles.Remove(id);
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
foreach (var role in Enum.GetValues<CustomRoles>())
{
int chance = role.GetMode();
if (role.IsVanilla() || chance == 0 || role.IsAdditionRole() || (role.OnlySpawnsWithPets() && !Options.UsePets.GetBool()) || (role != CustomRoles.Randomizer && role.IsCrewmate() && Options.AprilFoolsMode.GetBool()) || CustomHideAndSeekManager.HideAndSeekRoles.Any(x => x.Value.ContainsKey(role))) continue;
if (role.IsVanilla() || chance == 0 || role.IsAdditionRole() || (role.OnlySpawnsWithPets() && !Options.UsePets.GetBool()) || (role != CustomRoles.Randomizer && role.IsCrewmate() && Options.AprilFoolsMode.GetBool()) || CustomHideAndSeekManager.AllHnSRoles.Contains(role)) continue;
switch (role)
{
case CustomRoles.Commander when optImpNum <= 1 && Commander.CannotSpawnAsSoloImp.GetBool():
@@ -615,7 +616,7 @@ internal static class CustomRoleSelector
foreach (var id in Main.SetAddOns.Keys.Where(id => Utils.GetPlayerById(id) == null).ToArray()) Main.SetAddOns.Remove(id);
AddonRolesList = [];
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
foreach (var role in Enum.GetValues<CustomRoles>())
{
if (!role.IsAdditionRole() || role.IsGhostRole()) continue;
switch (role)
-19
View File
@@ -1,19 +0,0 @@
using System;
namespace EHR;
public static class EnumHelper
{
/// <summary>
/// Get all values of enum
/// </summary>
/// <typeparam name="T">Type of enum to be obtained</typeparam>
/// <returns>All values of T</returns>
public static T[] GetAllValues<T>() where T : Enum => Enum.GetValues(typeof(T)) as T[];
/// <summary>
/// Get all names of enum
/// </summary>
/// <typeparam name="T">Type of enum to be obtained</typeparam>
/// <returns>All values of T</returns>
public static string[] GetAllNames<T>() where T : Enum => Enum.GetNames(typeof(T));
}
+1 -1
View File
@@ -17,7 +17,7 @@ namespace EHR.Modules
public static void Initialize()
{
AssignedGhostRoles = [];
GhostRoles = EnumHelper.GetAllValues<CustomRoles>().Where(x => x != CustomRoles.EvilSpirit && x.IsGhostRole() && x.IsEnable()).ToList();
GhostRoles = Enum.GetValues<CustomRoles>().Where(x => x != CustomRoles.EvilSpirit && x.IsGhostRole() && x.IsEnable()).ToList();
Logger.Msg($"Ghost roles: {GhostRoles.Join()}", "GhostRoles");
Haunter.AllHauntedPlayers = [];
+1 -1
View File
@@ -959,7 +959,7 @@ public static class GuessManager
CreatePage(true, __instance, container);
}
var sortedRoles = EnumHelper.GetAllValues<CustomRoles>().OrderBy(x => GetString($"{x}")).ToArray();
var sortedRoles = Enum.GetValues<CustomRoles>().OrderBy(x => GetString($"{x}")).ToArray();
foreach (var role in sortedRoles)
{
if (role is CustomRoles.GM
+4 -2
View File
@@ -893,6 +893,8 @@ public static class Options
.GroupBy(x => x.Tab)
.OrderBy(x => (int)x.Key)
.ToDictionary(x => x.Key, x => x.ToArray());
CustomHideAndSeekManager.AllHnSRoles = CustomHideAndSeekManager.GetAllHnsRoles(CustomHideAndSeekManager.GetAllHnsRoleTypes());
}
public static VoteMode GetWhenSkipVote() => (VoteMode)WhenSkipVote.GetValue();
@@ -905,7 +907,7 @@ public static class Options
roleCounts = [];
roleSpawnChances = [];
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
foreach (var role in Enum.GetValues<CustomRoles>())
{
roleCounts.Add(role, 0);
roleSpawnChances.Add(role, 0);
@@ -1411,7 +1413,7 @@ public static class Options
.SetGameMode(CustomGameMode.Standard)
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
// Reset Doors Mode
DoorsResetMode = StringOptionItem.Create(22122, "DoorsResetMode", EnumHelper.GetAllNames<DoorsReset.ResetMode>(), 2, TabGroup.GameSettings)
DoorsResetMode = StringOptionItem.Create(22122, "DoorsResetMode", Enum.GetNames<DoorsReset.ResetMode>(), 2, TabGroup.GameSettings)
.SetColor(new Color32(19, 188, 233, byte.MaxValue))
.SetGameMode(CustomGameMode.Standard)
.SetParent(ResetDoorsEveryTurns);
+3 -3
View File
@@ -15,8 +15,8 @@ namespace EHR;
public static class Translator
{
public static Dictionary<string, Dictionary<int, string>> translateMaps;
public const string LANGUAGE_FOLDER_NAME = "Language";
public static Dictionary<string, Dictionary<int, string>> translateMaps;
public static void Init()
{
@@ -86,7 +86,7 @@ public static class Translator
// Creating a translation template
CreateTemplateFile();
foreach (var lang in EnumHelper.GetAllValues<SupportedLangs>())
foreach (var lang in Enum.GetValues<SupportedLangs>())
{
if (File.Exists(@$"./{LANGUAGE_FOLDER_NAME}/{lang}.dat"))
{
@@ -149,7 +149,7 @@ public static class Translator
if (!translateMaps.ContainsKey(str)) //translateMapsにない場合、StringNamesにあれば取得する
{
var stringNames = EnumHelper.GetAllValues<StringNames>().Where(x => x.ToString() == str).ToArray();
var stringNames = Enum.GetValues<StringNames>().Where(x => x.ToString() == str).ToArray();
if (stringNames.Length > 0)
res = GetString(stringNames.FirstOrDefault());
}
+20 -15
View File
@@ -469,16 +469,7 @@ public static class Utils
w.Write(b);
break;
case Vector2 v:
w.Write(v.x);
w.Write(v.y);
break;
case Vector3 v2:
w.Write(v2.x);
w.Write(v2.y);
w.Write(v2.z);
break;
case byte[] b:
w.WriteBytesAndSize(b);
NetHelpers.WriteVector2(v, w);
break;
}
}
@@ -1078,7 +1069,7 @@ public static class Utils
var crewsb = new StringBuilder();
var addonsb = new StringBuilder();
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
foreach (var role in Enum.GetValues<CustomRoles>().Except(CustomHideAndSeekManager.AllHnSRoles))
{
string mode;
try
@@ -1123,7 +1114,6 @@ public static class Utils
switch (opt.Value.Name)
{
case "Maximum":
case "DisableSkeldDevices" when Main.CurrentMap is not MapNames.Skeld and not MapNames.Dleks:
case "DisableMiraHQDevices" when Main.CurrentMap != MapNames.Mira:
case "DisablePolusDevices" when Main.CurrentMap != MapNames.Polus:
@@ -1629,13 +1619,28 @@ public static class Utils
if (title == "") title = "<color=#aaaaff>" + GetString("DefaultSystemMessageTitle") + "</color>";
text = text.Replace("color=", string.Empty);
if (text.Length > 1200 && !sendTo.IsPlayerModClient())
if (text.Length >= 1200)
{
text.Chunk(1200).Do(x => SendMessage(new(x), sendTo, title));
var lines = text.Split('\n');
var shortenedText = string.Empty;
foreach (string line in lines)
{
if (shortenedText.Length + line.Length < 1200)
{
shortenedText += line + "\n";
continue;
}
if (shortenedText.Length >= 1200) shortenedText.Chunk(1200).Do(x => SendMessage(new(x), sendTo, title));
else SendMessage(shortenedText, sendTo, title);
shortenedText = line + "\n";
}
if (shortenedText.Length > 0) SendMessage(shortenedText, sendTo, title);
return;
}
if (text.Length < 300) Logger.Info($" Message: {text} - To: {(sendTo == byte.MaxValue ? "Everyone" : $"{Utils.GetPlayerById(sendTo).GetRealName()}")} - Title: {title}", "SendMessage");
if (text.RemoveHtmlTags().Length < 300) Logger.Info($" Message: {text.RemoveHtmlTags()} - To: {(sendTo == byte.MaxValue ? "Everyone" : $"{GetPlayerById(sendTo).GetRealName()}")} - Title: {title}", "SendMessage");
Main.MessagesToSend.Add((text.RemoveHtmlTagsTemplate(), sendTo, title));
}
+2 -2
View File
@@ -902,7 +902,7 @@ internal class ChatCommands
}
else name = name.Trim().ToLower();
foreach (var rl in EnumHelper.GetAllValues<CustomRoles>())
foreach (var rl in Enum.GetValues<CustomRoles>())
{
if (rl.IsVanilla()) continue;
var roleName = GetString(rl.ToString()).ToLower().Trim().Replace(" ", string.Empty);
@@ -939,7 +939,7 @@ internal class ChatCommands
role = FixRoleNameInput(role).ToLower().Trim().Replace(" ", string.Empty);
foreach (var rl in EnumHelper.GetAllValues<CustomRoles>())
foreach (var rl in Enum.GetValues<CustomRoles>())
{
if (rl.IsVanilla()) continue;
var roleName = GetString(rl.ToString());
+2 -1
View File
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -379,7 +380,7 @@ class GameEndChecker
Dictionary<(CustomRoles? ROLE, CustomWinner WINNER), int> roleCounts = [];
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
foreach (var role in Enum.GetValues<CustomRoles>())
{
if ((!role.IsNK() && role != CustomRoles.Bloodlust) || role.IsMadmate() || role is CustomRoles.Sidekick) continue;
+1 -1
View File
@@ -551,7 +551,7 @@ class CheckForEndVotingPatch
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()}の道連れ先:{target.GetNameWithRole().RemoveHtmlTags()}", "RevengeOnExile");
}
private static PlayerControl PickRevengeTarget(PlayerControl exiledplayer /*, PlayerState.DeathReason deathReason*/) //道連れ先選定
private static PlayerControl PickRevengeTarget(PlayerControl exiledplayer /*, PlayerState.DeathReason deathReason*/)
{
List<PlayerControl> TargetList = [];
TargetList.AddRange(Main.AllAlivePlayerControls.Where(candidate => candidate != exiledplayer && !Main.AfterMeetingDeathPlayers.ContainsKey(candidate.PlayerId)));
+4 -2
View File
@@ -62,9 +62,11 @@ class EndGamePatch
var date = value.RealKiller.TIMESTAMP;
if (date == DateTime.MinValue) continue;
var killerId = value.GetRealKiller();
sb.Append($"\n{date:T} {Main.AllPlayerNames[key]} ({(Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato or CustomGameMode.HideAndSeek ? string.Empty : Utils.GetDisplayRoleName(key, true))}{(Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop ? string.Empty : Utils.GetSubRolesText(key, summary: true))}) [{Utils.GetVitalText(key)}]");
var gmIsFM = Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop;
var gmIsFMHH = gmIsFM || Options.CurrentGameMode is CustomGameMode.HotPotato or CustomGameMode.HideAndSeek;
sb.Append($"\n{date:T} {Main.AllPlayerNames[key]} ({(gmIsFMHH ? string.Empty : Utils.GetDisplayRoleName(key, true))}{(gmIsFM ? string.Empty : Utils.GetSubRolesText(key, summary: true))}) [{Utils.GetVitalText(key)}]");
if (killerId != byte.MaxValue && killerId != key)
sb.Append($"\n\t⇐ {Main.AllPlayerNames[killerId]} ({(Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop or CustomGameMode.HotPotato or CustomGameMode.HideAndSeek ? string.Empty : Utils.GetDisplayRoleName(killerId, true))}{(Options.CurrentGameMode is CustomGameMode.FFA or CustomGameMode.MoveAndStop ? string.Empty : Utils.GetSubRolesText(killerId, summary: true))})");
sb.Append($"\n\t⇐ {Main.AllPlayerNames[killerId]} ({(gmIsFMHH ? string.Empty : Utils.GetDisplayRoleName(killerId, true))}{(gmIsFM ? string.Empty : Utils.GetSubRolesText(killerId, summary: true))})");
}
KillLog = sb.ToString();
+1
View File
@@ -2653,6 +2653,7 @@
"Prefix.Dynamo": "Dynamo",
"Dynamo.IncreaseSpeedBy": "Increase Speed by",
"Dynamo.IncreaseSpeedFrequency": "Speed Increase Frequency",
"Dynamo.MaxSpeed": "Max Speed",
"Samurai": "Samurai",
"SamuraiInfo": "Kill Players in Unique Ways",
"SamuraiInfoLong": "(Neutrals):\\nAs the Samurai, you can do delayed kills and normal kills. What decides? Well, if you click your kill button on someone (the kill won't occur immediately) and you stay near them for a few seconds (like an arsonist douse), you get a lower kill cooldown and the kill will be delayed. If you fail to stay near them, you do a normal kill, lunge included.",
+7 -6
View File
@@ -8,17 +8,18 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
SetupAdtRoleOptions(222420, CustomRoles.Antidote, canSetNum: true);
ImpCanBeAntidote = BooleanOptionItem.Create(222426, "ImpCanBeAntidote", true, TabGroup.Addons)
const int id = 648500;
SetupAdtRoleOptions(id, CustomRoles.Antidote, canSetNum: true);
ImpCanBeAntidote = BooleanOptionItem.Create(id + 3, "ImpCanBeAntidote", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Antidote]);
CrewCanBeAntidote = BooleanOptionItem.Create(222427, "CrewCanBeAntidote", true, TabGroup.Addons)
CrewCanBeAntidote = BooleanOptionItem.Create(id + 4, "CrewCanBeAntidote", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Antidote]);
NeutralCanBeAntidote = BooleanOptionItem.Create(222423, "NeutralCanBeAntidote", true, TabGroup.Addons)
NeutralCanBeAntidote = BooleanOptionItem.Create(id + 5, "NeutralCanBeAntidote", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Antidote]);
AntidoteCDOpt = FloatOptionItem.Create(222424, "AntidoteCDOpt", new(0f, 180f, 1f), 5f, TabGroup.Addons)
AntidoteCDOpt = FloatOptionItem.Create(id + 6, "AntidoteCDOpt", new(0f, 180f, 1f), 5f, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Antidote])
.SetValueFormat(OptionFormat.Seconds);
AntidoteCDReset = BooleanOptionItem.Create(222425, "AntidoteCDReset", true, TabGroup.Addons)
AntidoteCDReset = BooleanOptionItem.Create(id + 7, "AntidoteCDReset", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Antidote]);
}
}
+7 -6
View File
@@ -8,18 +8,19 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
const int id = 648600;
SetupAdtRoleOptions(111420, CustomRoles.Diseased, canSetNum: true);
ImpCanBeDiseased = BooleanOptionItem.Create(111426, "ImpCanBeDiseased", true, TabGroup.Addons)
ImpCanBeDiseased = BooleanOptionItem.Create(id + 3, "ImpCanBeDiseased", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Diseased]);
CrewCanBeDiseased = BooleanOptionItem.Create(111427, "CrewCanBeDiseased", true, TabGroup.Addons)
CrewCanBeDiseased = BooleanOptionItem.Create(id + 4, "CrewCanBeDiseased", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Diseased]);
NeutralCanBeDiseased = BooleanOptionItem.Create(111423, "NeutralCanBeDiseased", true, TabGroup.Addons)
NeutralCanBeDiseased = BooleanOptionItem.Create(id + 5, "NeutralCanBeDiseased", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Diseased]);
DiseasedCDOpt = FloatOptionItem.Create(111424, "DiseasedCDOpt", new(0f, 180f, 1f), 25f, TabGroup.Addons)
DiseasedCDOpt = FloatOptionItem.Create(id + 6, "DiseasedCDOpt", new(0f, 180f, 1f), 25f, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Diseased])
.SetValueFormat(OptionFormat.Seconds);
DiseasedCDReset = BooleanOptionItem.Create(111425, "DiseasedCDReset", true, TabGroup.Addons)
DiseasedCDReset = BooleanOptionItem.Create(id + 7, "DiseasedCDReset", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Diseased]);
}
}
}
}
+6
View File
@@ -9,6 +9,7 @@ namespace EHR.Roles.AddOns.Common
{
private static OptionItem IncreaseSpeedBy;
private static OptionItem IncreaseSpeedFrequency;
private static OptionItem MaxSpeed;
private static readonly Dictionary<byte, Vector2> LastPosition = [];
private static readonly Dictionary<byte, float> StartingSpeed = [];
@@ -25,6 +26,9 @@ namespace EHR.Roles.AddOns.Common
IncreaseSpeedFrequency = FloatOptionItem.Create(id + 7, "Dynamo.IncreaseSpeedFrequency", new(0.5f, 30f, 0.5f), 5f, TabGroup.Addons)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Dynamo])
.SetValueFormat(OptionFormat.Seconds);
MaxSpeed = FloatOptionItem.Create(id + 8, "Dynamo.MaxSpeed", new(0.1f, 3f, 0.1f), 3f, TabGroup.Addons)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Dynamo])
.SetValueFormat(OptionFormat.Multiplier);
}
public static void Add()
@@ -64,6 +68,8 @@ namespace EHR.Roles.AddOns.Common
SpeedIncreaseTimer[pc.PlayerId] = 0f;
Main.AllPlayerSpeed[pc.PlayerId] += IncreaseSpeedBy.GetFloat();
float maxSpeed = MaxSpeed.GetFloat();
if (Main.AllPlayerSpeed[pc.PlayerId] > maxSpeed) Main.AllPlayerSpeed[pc.PlayerId] = maxSpeed;
pc.MarkDirtySettings();
}
}
+5 -4
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using EHR.Patches;
using UnityEngine;
@@ -74,7 +75,7 @@ namespace EHR.Roles.Crewmate
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Adventurer])
.SetValueFormat(OptionFormat.Seconds);
foreach (var weapon in EnumHelper.GetAllValues<Weapon>())
foreach (var weapon in Enum.GetValues<Weapon>())
{
WeaponEnabledSettings[weapon] = CreateWeaponEnabledSetting(11333 + (int)weapon, weapon);
}
@@ -97,7 +98,7 @@ namespace EHR.Roles.Crewmate
LastGroupingResourceTimeStamp = Utils.TimeStamp + 20;
ResourceLocations = [];
foreach (var resource in EnumHelper.GetAllValues<Resource>())
foreach (var resource in Enum.GetValues<Resource>())
{
ResourceCounts[resource] = 0;
}
@@ -329,7 +330,7 @@ namespace EHR.Roles.Crewmate
if (pc.PlayerId != tar.PlayerId) return string.Empty;
IEnumerable<string> resources =
from resource in EnumHelper.GetAllValues<Resource>()
from resource in Enum.GetValues<Resource>()
let displayData = ResourceDisplayData[resource]
select $"{Utils.ColorString(displayData.Color, $"{displayData.Icon}")}{av.ResourceCounts[resource]}";
+40 -36
View File
@@ -12,7 +12,7 @@ namespace EHR.Roles.Crewmate
public class Bloodhound : RoleBase
{
private const int Id = 6400;
private static List<byte> playerIdList = [];
private static List<byte> PlayerIdList = [];
public static List<byte> UnreportablePlayers = [];
@@ -22,9 +22,10 @@ namespace EHR.Roles.Crewmate
public static OptionItem NotifyKiller;
public static OptionItem BloodhoundAbilityUseGainWithEachTaskCompleted;
public static OptionItem AbilityChargesWhenFinishedTasks;
public List<byte> BloodhoundTargets = [];
public override bool IsEnable => playerIdList.Count > 0;
private List<byte> BloodhoundTargets = [];
public override bool IsEnable => PlayerIdList.Count > 0;
public static void SetupCustomOption()
{
@@ -44,50 +45,50 @@ namespace EHR.Roles.Crewmate
public override void Init()
{
playerIdList = [];
PlayerIdList = [];
UnreportablePlayers = [];
BloodhoundTargets = [];
}
public override void Add(byte playerId)
{
playerIdList.Add(playerId);
PlayerIdList.Add(playerId);
playerId.SetAbilityUseLimit(UseLimitOpt.GetInt());
BloodhoundTargets = [];
}
static void SendRPC(byte playerId, bool add, Vector3 loc = new())
{
if (!Utils.DoRPC) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBloodhoundArrow, SendOption.Reliable);
writer.Write(playerId);
writer.Write(add);
if (add)
{
writer.Write(loc.x);
writer.Write(loc.y);
writer.Write(loc.z);
}
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
public static void ReceiveRPC(MessageReader reader)
{
byte playerId = reader.ReadByte();
if (Main.PlayerStates[playerId].Role is not Bloodhound) return;
if (Main.PlayerStates[playerId].Role is not Bloodhound bh) return;
bool add = reader.ReadBoolean();
if (add) LocateArrow.Add(playerId, new(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()));
else LocateArrow.RemoveAllTarget(playerId);
switch (reader.ReadPackedInt32())
{
case 1:
TargetArrow.RemoveAllTarget(playerId);
LocateArrow.RemoveAllTarget(playerId);
bh.BloodhoundTargets.Clear();
break;
case 2:
LocateArrow.Add(playerId, NetHelpers.ReadVector2(reader));
break;
case 3:
LocateArrow.Remove(playerId, NetHelpers.ReadVector2(reader));
break;
case 4:
bh.BloodhoundTargets.Add(reader.ReadByte());
TargetArrow.Add(playerId, bh.BloodhoundTargets.Last());
break;
}
}
public override void OnReportDeadBody()
{
foreach (byte apc in playerIdList)
foreach (byte id in PlayerIdList)
{
LocateArrow.RemoveAllTarget(apc);
SendRPC(apc, false);
TargetArrow.RemoveAllTarget(id);
LocateArrow.RemoveAllTarget(id);
Utils.SendRPC(CustomRPC.SetBloodhoundArrow, id, 1);
}
BloodhoundTargets.Clear();
@@ -97,13 +98,14 @@ namespace EHR.Roles.Crewmate
{
if (!ArrowsPointingToDeadBody.GetBool()) return;
foreach (byte pc in playerIdList)
foreach (byte id in PlayerIdList)
{
var player = Utils.GetPlayerById(pc);
if (player == null || !player.IsAlive())
continue;
LocateArrow.Add(pc, target.transform.position);
SendRPC(pc, true, target.transform.position);
var player = Utils.GetPlayerById(id);
if (player == null || !player.IsAlive()) continue;
var pos = target.Pos();
LocateArrow.Add(id, pos);
Utils.SendRPC(CustomRPC.SetBloodhoundArrow, id, 2, pos);
}
}
@@ -116,13 +118,15 @@ namespace EHR.Roles.Crewmate
return false;
}
LocateArrow.Remove(pc.PlayerId, target.Object.transform.position);
SendRPC(pc.PlayerId, false);
var pos = target.Object.Pos();
LocateArrow.Remove(pc.PlayerId, pos);
Utils.SendRPC(CustomRPC.SetBloodhoundArrow, pc.PlayerId, 3, pos);
if (pc.GetAbilityUseLimit() >= 1)
{
BloodhoundTargets.Add(killer.PlayerId);
TargetArrow.Add(pc.PlayerId, killer.PlayerId);
Utils.SendRPC(CustomRPC.SetBloodhoundArrow, pc.PlayerId, 4, killer.PlayerId);
pc.Notify(GetString("BloodhoundTrackRecorded"));
pc.RpcRemoveAbilityUse();
+2 -1
View File
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using EHR.Modules;
@@ -55,7 +56,7 @@ public class Divinator : RoleBase
playerId.SetAbilityUseLimit(CheckLimitOpt.GetInt());
var r = IRandom.Instance;
CustomRoles[][] chunked = EnumHelper.GetAllValues<CustomRoles>()
CustomRoles[][] chunked = Enum.GetValues<CustomRoles>()
.Where(x => !x.IsVanilla() && !x.IsAdditionRole() && x is not CustomRoles.Killer and not CustomRoles.Tasker and not CustomRoles.KB_Normal and not CustomRoles.Potato and not CustomRoles.Hider and not CustomRoles.Seeker and not CustomRoles.Fox and not CustomRoles.Troll and not CustomRoles.Jumper and not CustomRoles.Detector and not CustomRoles.Jet and not CustomRoles.Dasher and not CustomRoles.Locator and not CustomRoles.Venter and not CustomRoles.Agent and not CustomRoles.Taskinator and not CustomRoles.GM and not CustomRoles.Convict)
.Shuffle(r)
.Chunk(RolesPerCategory)
+9 -9
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using AmongUs.GameOptions;
using EHR.Modules;
@@ -13,21 +14,23 @@ namespace EHR.Roles.Crewmate
{
public class Farseer : RoleBase
{
public static Dictionary<byte, (PlayerControl PLAYER, float TIMER)> FarseerTimer = [];
public static Dictionary<(byte, byte), bool> IsRevealed = [];
private const int Id = 9700;
private const string FontSize = "1.6";
public static Dictionary<byte, (PlayerControl PLAYER, float TIMER)> FarseerTimer = [];
public static Dictionary<(byte, byte), bool> IsRevealed = [];
public static OptionItem FarseerCooldown;
public static OptionItem FarseerRevealTime;
public static OptionItem Vision;
public static OptionItem UsePet;
private static CustomRoles[] RandomRolesForTrickster => EnumHelper.GetAllValues<CustomRoles>().Where(x => x.IsCrewmate()).ToArray();
public static readonly Dictionary<int, string> RandomRole = [];
public static Dictionary<int, string> RandomRole = [];
public static bool On;
private static CustomRoles[] RandomRolesForTrickster => Enum.GetValues<CustomRoles>().Where(x => x.IsCrewmate()).ToArray();
public override bool IsEnable => On;
public static void SetupCustomOption()
{
@@ -65,9 +68,6 @@ namespace EHR.Roles.Crewmate
Main.ResetCamPlayerList.Add(playerId);
}
public static bool On;
public override bool IsEnable => On;
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
opt.SetVision(false);
+7 -46
View File
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Text.RegularExpressions;
using EHR.Modules;
using HarmonyLib;
using Hazel;
@@ -60,7 +59,7 @@ public class NiceSwapper : RoleBase
if (!AmongUsClient.Instance.AmHost || !GameStates.IsInGame || pc == null || pc.GetCustomRole() != CustomRoles.NiceSwapper) return false;
Logger.Info($"{pc.GetNameWithRole()} : {msg} (UI: {isUI})", "NiceSwapper");
Logger.Info($"{pc.GetNameWithRole()} : {msg} (UI: {isUI})", "Swapper");
int operate;
msg = msg.ToLower().TrimStart().TrimEnd();
@@ -92,9 +91,9 @@ public class NiceSwapper : RoleBase
if (HideMsg.GetBool() && !isUI) ChatManager.SendPreviousMessagesToAll();
else if (pc.AmOwner && !isUI) Utils.SendMessage(originMsg, 255, pc.GetRealName());
if (!MsgToPlayerAndRole(msg, out byte targetId, out string error))
if (!byte.TryParse(msg.Replace(" ", string.Empty), out byte targetId))
{
Utils.SendMessage(error, pc.PlayerId);
Utils.SendMessage(GetString("SwapHelp"), pc.PlayerId);
return true;
}
@@ -105,21 +104,20 @@ public class NiceSwapper : RoleBase
bool Vote1Empty = (SwapTargets.Item1 == byte.MaxValue) && targetIsntSelected; // Whether the first swapping slot is suitable to swap this target
bool Vote2Available = (SwapTargets.Item1 != byte.MaxValue) && (SwapTargets.Item2 == byte.MaxValue) && targetIsntSelected; // Whether the second swapping slot is suitable to swap this target
bool selfCheck = CanSwapSelf.GetBool() || target.PlayerId != pc.PlayerId;
if (Vote1Empty && (CanSwapSelf.GetBool() || target.PlayerId != pc.PlayerId)) // Take first slot
if (Vote1Empty && selfCheck) // Take first slot
{
SwapTargets.Item1 = target.PlayerId;
if (HideMsg.GetBool() && !isUI) ChatManager.SendPreviousMessagesToAll();
if (!isUI) Utils.SendMessage(GetString("Swap1"), pc.PlayerId);
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} chose to swap {target.GetNameWithRole()} (first target)", "Swapper");
}
else if (Vote2Available && (CanSwapSelf.GetBool() || target.PlayerId != pc.PlayerId)) // Take second slot
else if (Vote2Available && selfCheck) // Take second slot
{
SwapTargets.Item2 = target.PlayerId;
if (HideMsg.GetBool() && !isUI) ChatManager.SendPreviousMessagesToAll();
if (!isUI) Utils.SendMessage(GetString("Swap2"), pc.PlayerId);
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} chose to swap {target.GetNameWithRole()} (second target)", "Swapper");
}
@@ -128,7 +126,6 @@ public class NiceSwapper : RoleBase
{
SwapTargets.Item1 = byte.MaxValue;
if (HideMsg.GetBool() && !isUI) ChatManager.SendPreviousMessagesToAll();
if (!isUI) Utils.SendMessage(GetString("CancelSwap1"), pc.PlayerId);
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} canceled swapping on {target.GetNameWithRole()} (first target)", "Swapper");
}
@@ -137,14 +134,12 @@ public class NiceSwapper : RoleBase
{
SwapTargets.Item2 = byte.MaxValue;
if (HideMsg.GetBool() && !isUI) ChatManager.SendPreviousMessagesToAll();
if (!isUI) Utils.SendMessage(GetString("CancelSwap2"), pc.PlayerId);
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} canceled swapping on {target.GetNameWithRole()} (second target)", "Swapper");
}
else if (pc.PlayerId == target.PlayerId && !CanSwapSelf.GetBool()) // When the Swapper tries to swap themselves, but they aren't allowed to
else if (!selfCheck) // When the Swapper tries to swap themselves, but they aren't allowed to
{
if (HideMsg.GetBool() && !isUI) ChatManager.SendPreviousMessagesToAll();
if (!isUI) Utils.SendMessage(GetString("CantSwapSelf"), pc.PlayerId);
else pc.ShowPopUp(GetString("CantSwapSelf"));
}
@@ -196,40 +191,6 @@ public class NiceSwapper : RoleBase
Utils.SendMessage(string.Format(GetString("SwapVote"), Target1.GetRealName(), Target2.GetRealName()), 255, Utils.ColorString(Utils.GetRoleColor(CustomRoles.NiceSwapper), GetString("SwapTitle")));
}
private static bool MsgToPlayerAndRole(string msg, out byte id, out string error)
{
if (msg.StartsWith("/")) msg = msg.Replace("/", string.Empty);
Regex r = new("\\d+");
MatchCollection mc = r.Matches(msg);
string result = string.Empty;
for (int i = 0; i < mc.Count; i++)
{
result += mc[i];
}
if (int.TryParse(result, out int num))
{
id = Convert.ToByte(num);
}
else
{
id = byte.MaxValue;
error = GetString("SwapHelp");
return false;
}
PlayerControl target = Utils.GetPlayerById(id);
if (target == null || target.Data.IsDead)
{
error = GetString("SwapNull");
return false;
}
error = string.Empty;
return true;
}
private static bool CheckCommand(ref string msg, string command, bool exact = true)
{
var comList = command.Split('|');
+2 -2
View File
@@ -247,7 +247,7 @@ namespace EHR.Roles.Crewmate
break;
case Effect.AddonAssign:
{
var addons = EnumHelper.GetAllValues<CustomRoles>().Where(x => x.IsAdditionRole() && x != CustomRoles.NotAssigned).ToArray();
var addons = Enum.GetValues<CustomRoles>().Where(x => x.IsAdditionRole() && x != CustomRoles.NotAssigned).ToArray();
var pc = PickRandomPlayer();
var addon = addons[IRandom.Instance.Next(0, addons.Length)];
if (Main.PlayerStates[pc.PlayerId].SubRoles.Contains(addon)) break;
@@ -539,7 +539,7 @@ namespace EHR.Roles.Crewmate
LastEffectPick[id] = now;
var allEffects = EnumHelper.GetAllValues<Effect>();
var allEffects = Enum.GetValues<Effect>();
var effect = allEffects[IRandom.Instance.Next(0, allEffects.Length)];
if (effect == Effect.GhostPlayer)
+1 -1
View File
@@ -42,7 +42,7 @@ namespace EHR.Roles.Impostor
public static List<CustomRoles> GetAvailableRoles(bool check = false)
{
CustomRoles[] allRoles = EnumHelper.GetAllValues<CustomRoles>();
CustomRoles[] allRoles = Enum.GetValues<CustomRoles>();
IEnumerable<CustomRoles> result = AvailableRoles.GetValue() switch
{
+10 -10
View File
@@ -7,14 +7,6 @@ namespace EHR.Roles.Impostor
{
internal static class GeneratorStatic
{
enum Action
{
Kill,
Shapeshift,
Vent,
Sabotage
}
private static int GetDefaultCost(this Action action) => action switch
{
Action.Kill => 5,
@@ -25,10 +17,17 @@ namespace EHR.Roles.Impostor
_ => 15
};
enum Action
{
Kill,
Shapeshift,
Vent,
Sabotage
}
internal class Generator : RoleBase
{
public static bool On;
public override bool IsEnable => On;
private static OptionItem ChargesGainedPerSecond;
private static OptionItem StartingCharges;
@@ -42,6 +41,7 @@ namespace EHR.Roles.Impostor
private int Charges;
private long LastUpdate;
public override bool IsEnable => On;
public static void SetupCustomOption()
{
@@ -56,7 +56,7 @@ namespace EHR.Roles.Impostor
MaxChargesStored = IntegerOptionItem.Create(id + 5, "Generator.MaxChargesStored", new(0, 200, 1), 100, TabGroup.ImpostorRoles)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Generator]);
foreach (var action in EnumHelper.GetAllValues<Action>())
foreach (var action in Enum.GetValues<Action>())
{
var option = IntegerOptionItem.Create(id + 6 + (int)action, $"Generator.{action}.Cost", new(0, 100, 1), action.GetDefaultCost(), TabGroup.ImpostorRoles)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Generator]);
+2 -2
View File
@@ -8,8 +8,8 @@
public static void SetupCustomOption()
{
Options.SetupRoleOptions(555420, TabGroup.ImpostorRoles, CustomRoles.Godfather);
Options.GodfatherCancelVote = Options.CreateVoteCancellingUseSetting(555422, CustomRoles.Godfather, TabGroup.ImpostorRoles);
Options.SetupRoleOptions(648400, TabGroup.ImpostorRoles, CustomRoles.Godfather);
Options.GodfatherCancelVote = Options.CreateVoteCancellingUseSetting(648402, CustomRoles.Godfather, TabGroup.ImpostorRoles);
}
public override void Add(byte playerId)
+4 -4
View File
@@ -98,7 +98,7 @@ namespace EHR.Roles.Neutral
StartingMoney = IntegerOptionItem.Create(++id, "Bargainer.StartingMoney", new(0, 100, 5), 0, tab)
.SetParent(CustomRoleSpawnChances[CustomRoles.Bargainer]);
foreach (var action in EnumHelper.GetAllValues<MoneyGainingAction>())
foreach (var action in Enum.GetValues<MoneyGainingAction>())
{
var boolOpt = BooleanOptionItem.Create(++id, $"Bargainer.{action}.Enabled", true, tab)
.SetParent(CustomRoleSpawnChances[CustomRoles.Bargainer]);
@@ -118,7 +118,7 @@ namespace EHR.Roles.Neutral
};
}
foreach (var item in EnumHelper.GetAllValues<Item>())
foreach (var item in Enum.GetValues<Item>())
{
if (item == Item.None) continue;
@@ -145,7 +145,7 @@ namespace EHR.Roles.Neutral
switch (item)
{
case Item.BandAid:
ShieldDuration = StringOptionItem.Create(++id, $"Bargainer.{item}.DurationSwitch", EnumHelper.GetAllNames<ShieldDurationOptions>(), 0, tab)
ShieldDuration = StringOptionItem.Create(++id, $"Bargainer.{item}.DurationSwitch", Enum.GetNames<ShieldDurationOptions>(), 0, tab)
.SetParent(boolOpt);
ShieldTime = IntegerOptionItem.Create(++id, $"Bargainer.{item}.Duration", new(0, 60, 1), 20, tab)
.SetParent(ShieldDuration)
@@ -157,7 +157,7 @@ namespace EHR.Roles.Neutral
.SetValueFormat(OptionFormat.Seconds);
break;
case Item.LensOfTruth:
AlignmentVisible = StringOptionItem.Create(++id, $"Bargainer.{item}.DurationSwitch", EnumHelper.GetAllNames<AlignmentVisibleOptions>(), (int)AlignmentVisibleOptions.UntilNextReveal, tab)
AlignmentVisible = StringOptionItem.Create(++id, $"Bargainer.{item}.DurationSwitch", Enum.GetNames<AlignmentVisibleOptions>(), (int)AlignmentVisibleOptions.UntilNextReveal, tab)
.SetParent(boolOpt);
AlignmentVisibleDuration = IntegerOptionItem.Create(++id, $"Bargainer.{item}.Duration", new(1, 30, 1), 10, tab)
.SetParent(AlignmentVisible)
+4 -4
View File
@@ -134,13 +134,13 @@ namespace EHR.Roles.Neutral
.SetParent(CustomRoleSpawnChances[CustomRoles.Chemist])
.SetValueFormat(OptionFormat.Times);
FinalProductUsageAmounts = EnumHelper.GetAllValues<Item>()
FinalProductUsageAmounts = Enum.GetValues<Item>()
.Where(x => GetItemType(x) == ItemType.FinalProduct)
.ToDictionary(x => x, x => IntegerOptionItem.Create(++id, $"Chemist.Item.{x}.Usage", new(1, 100, 1), GetDefaultValue(x), tab)
.SetParent(CustomRoleSpawnChances[CustomRoles.Chemist])
.SetValueFormat(OptionFormat.Times));
AcidPlayersDie = StringOptionItem.Create(++id, "Chemist.AcidPlayersDie", EnumHelper.GetAllNames<AcidPlayersDieOptions>(), 0, tab)
AcidPlayersDie = StringOptionItem.Create(++id, "Chemist.AcidPlayersDie", Enum.GetNames<AcidPlayersDieOptions>(), 0, tab)
.SetParent(CustomRoleSpawnChances[CustomRoles.Chemist]);
AcidPlayersDieAfterTime = IntegerOptionItem.Create(++id, "Chemist.AcidPlayersDieAfterTime", new(1, 60, 1), 15, tab)
.SetParent(AcidPlayersDie)
@@ -178,7 +178,7 @@ namespace EHR.Roles.Neutral
FactoryLocations = ShipStatus.Instance.AllRooms
.Select(x => Translator.GetString($"{x.RoomId}"))
.Distinct()
.Zip(EnumHelper.GetAllValues<Factory>()[1..])
.Zip(Enum.GetValues<Factory>()[1..])
.ToDictionary(x => x.First, x => x.Second);
}, 10f, log: false);
}
@@ -200,7 +200,7 @@ namespace EHR.Roles.Neutral
BombedBodies = [];
Grenades = [];
ItemCounts = EnumHelper.GetAllValues<Item>().ToDictionary(x => x, _ => 0);
ItemCounts = Enum.GetValues<Item>().ToDictionary(x => x, _ => 0);
if (!AmongUsClient.Instance.AmHost) return;
if (!Main.ResetCamPlayerList.Contains(playerId))
+1 -1
View File
@@ -10,7 +10,7 @@ namespace EHR.Roles.Neutral;
public class Doppelganger : RoleBase
{
private const int Id = 194200;
private const int Id = 648100;
public static List<byte> playerIdList = [];
private static OptionItem KillCooldown;
+1 -1
View File
@@ -7,7 +7,7 @@ namespace EHR.Roles.Neutral;
public class Eclipse : RoleBase
{
private const int Id = 128000;
private const int Id = 648200;
public static List<byte> playerIdList = [];
private static OptionItem KillCooldown;
+3 -2
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using AmongUs.GameOptions;
using HarmonyLib;
@@ -44,7 +45,7 @@ namespace EHR.Roles.Neutral
{
RolesToKill = [];
var allRoles = EnumHelper.GetAllValues<CustomRoles>().ToList();
var allRoles = Enum.GetValues<CustomRoles>().ToList();
allRoles.RemoveAll(x => x == CustomRoles.Predator || x >= CustomRoles.NotAssigned || !x.RoleExist(countDead: true));
var r = IRandom.Instance;
+1 -1
View File
@@ -6,7 +6,7 @@ namespace EHR.Roles.Neutral;
public class Pyromaniac : RoleBase
{
private const int Id = 128020;
private const int Id = 648000;
public static List<byte> playerIdList = [];
private static OptionItem KillCooldown;
+6 -6
View File
@@ -43,7 +43,7 @@ namespace EHR.Roles.Neutral
];
public static ((Color32 Color, string String, PlayerControl Player) LastReportedPlayer, string LastPlayerPressedButtonName, SystemTypes LastSabotage, string LastReporterName, int NumPlayersVotedLastMeeting, string FirstReportedBodyPlayerName, int NumEmergencyMeetings, int NumPlayersDeadThisRound, int NumPlayersDeadFirstRound, int NumSabotages, int NumMeetings) Data = ((new(), string.Empty, null), string.Empty, default, string.Empty, 0, string.Empty, 0, 0, 0, 0, 0);
private Question CurrentQuestion;
public byte QuizMasterId;
public byte Target;
@@ -212,7 +212,7 @@ namespace EHR.Roles.Neutral
List<int> indexes = abc ? allowedABCIndexes : allowedIndexes;
int index = indexes[random.Next(indexes.Count)];
var randomRole = EnumHelper.GetAllValues<CustomRoles>().Where(x => x.IsEnable()).Shuffle(random).First();
var randomRole = Enum.GetValues<CustomRoles>().Where(x => x.IsEnable()).Shuffle(random).First();
string title = index switch
{
@@ -224,7 +224,7 @@ namespace EHR.Roles.Neutral
(IEnumerable<string> WrongAnswers, string CorrectAnswer) answers = index switch
{
1 when abc => (EnumHelper.GetAllValues<Team>().Skip(1).Where(x => x != Data.LastReportedPlayer.Player.GetTeam()).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{Data.LastReportedPlayer.Player.GetTeam()}")),
1 when abc => (Enum.GetValues<Team>().Skip(1).Where(x => x != Data.LastReportedPlayer.Player.GetTeam()).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{Data.LastReportedPlayer.Player.GetTeam()}")),
1 => (AllColors.Shuffle(random).Take(2).Select(x => x.String), Data.LastReportedPlayer.String),
2 when abc => ((new[] { PlayerState.DeathReason.Suicide, PlayerState.DeathReason.Kill, PlayerState.DeathReason.etc }).Select(x => Translator.GetString($"DeathReason.{x}")), Translator.GetString($"DeathReason.{Main.PlayerStates[Data.LastReportedPlayer.Player!.PlayerId].deathReason}")),
2 => (GetTwoRandomNames(Data.LastPlayerPressedButtonName), Data.LastPlayerPressedButtonName),
@@ -232,9 +232,9 @@ namespace EHR.Roles.Neutral
3 => (AllSabotages[..1].Select(x => Translator.GetString($"{x}")), Translator.GetString($"{Data.LastSabotage}")),
4 when abc => (new[] { "tukasa0001", "0xDrMoe" }, "Gurge44"),
4 => (CustomRoleSelector.RoleResult.Values.Shuffle(random).Take(2).Select(x => x.ToColoredString()), Main.LastVotedPlayerInfo!.Object.GetCustomRole().ToColoredString()),
5 when abc => (EnumHelper.GetAllValues<Team>().Skip(1).Where(x => x != randomRole.GetTeam()).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{randomRole.GetTeam()}")),
5 when abc => (Enum.GetValues<Team>().Skip(1).Where(x => x != randomRole.GetTeam()).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{randomRole.GetTeam()}")),
5 => (GetTwoRandomNames(Data.LastReporterName), Data.LastReporterName),
6 when abc => (EnumHelper.GetAllValues<CustomRoleTypes>().Where(x => x != randomRole.GetCustomRoleTypes()).Shuffle(random).Take(2).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{randomRole.GetCustomRoleTypes()}")),
6 when abc => (Enum.GetValues<CustomRoleTypes>().Where(x => x != randomRole.GetCustomRoleTypes()).Shuffle(random).Take(2).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{randomRole.GetCustomRoleTypes()}")),
6 => (GetTwoRandomNumbers(Data.NumPlayersVotedLastMeeting, 0, 15), Data.NumPlayersVotedLastMeeting.ToString()),
7 => (GetTwoRandomNumbers(Data.NumMeetings, Math.Max(Data.NumMeetings - 3, 0), Data.NumMeetings + 3), Data.NumMeetings.ToString()),
8 => (GetTwoRandomNames(Data.FirstReportedBodyPlayerName), Data.FirstReportedBodyPlayerName),
@@ -243,7 +243,7 @@ namespace EHR.Roles.Neutral
11 => (GetTwoRandomNumbers(Data.NumPlayersDeadFirstRound, Math.Max(Data.NumPlayersDeadFirstRound - 3, 0), Data.NumPlayersDeadFirstRound + 3), Data.NumPlayersDeadFirstRound.ToString()),
12 => (GetTwoRandomNumbers(Data.NumSabotages, Math.Max(Data.NumSabotages - 3, 0), Data.NumSabotages + 3), Data.NumSabotages.ToString()),
13 => (GetTwoRandomNumbers(GameData.Instance.CompletedTasks, 0, GameData.Instance.TotalTasks), GameData.Instance.CompletedTasks.ToString()),
14 => (EnumHelper.GetAllValues<RoleTypes>().Where(x => x != randomRole.GetRoleTypes()).Shuffle(random).Take(2).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{randomRole.GetRoleTypes()}")),
14 => (Enum.GetValues<RoleTypes>().Where(x => x != randomRole.GetRoleTypes()).Shuffle(random).Take(2).Select(x => Translator.GetString($"{x}")), Translator.GetString($"{randomRole.GetRoleTypes()}")),
_ => ([], string.Empty)
};