diff --git a/GameMode/HnSManager.cs b/GameMode/HnSManager.cs
index 17c568ce9..18812a7f9 100644
--- a/GameMode/HnSManager.cs
+++ b/GameMode/HnSManager.cs
@@ -5,7 +5,6 @@ using System.Reflection;
using AmongUs.GameOptions;
using EHR.GameMode.HideAndSeekRoles;
using HarmonyLib;
-using Il2CppSystem.Text;
using UnityEngine;
namespace EHR
diff --git a/GameMode/RoomRush.cs b/GameMode/RoomRush.cs
index 04d3067f7..0580a4d9e 100644
--- a/GameMode/RoomRush.cs
+++ b/GameMode/RoomRush.cs
@@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using HarmonyLib;
@@ -317,7 +316,7 @@ namespace EHR
bool dead = !seer.IsAlive();
bool done = dead || DonePlayers.Contains(seer.PlayerId);
Color color = done ? Color.green : Color.yellow;
-
+
if (DisplayRoomName.GetBool()) sb.AppendLine(Utils.ColorString(color, Translator.GetString(RoomGoal.ToString())));
if (DisplayArrowToRoom.GetBool()) sb.AppendLine(Utils.ColorString(color, LocateArrow.GetArrows(seer)));
diff --git a/Modules/AddSteamID.cs b/Modules/AddSteamID.cs
index bce1573db..ca77c7bb7 100644
--- a/Modules/AddSteamID.cs
+++ b/Modules/AddSteamID.cs
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using static EHR.Translator;
namespace EHR
diff --git a/Modules/AntiBlackout.cs b/Modules/AntiBlackout.cs
index db6a4bb8e..e857a8ef0 100644
--- a/Modules/AntiBlackout.cs
+++ b/Modules/AntiBlackout.cs
@@ -204,7 +204,8 @@ namespace EHR
seer.RpcResetAbilityCooldown();
seer.ResetKillCooldown();
- if (Main.AllPlayerKillCooldown.TryGetValue(seer.PlayerId, out float kcd) && kcd >= 2f) seer.SetKillCooldown(kcd - 2f);
+ if (Main.AllPlayerKillCooldown.TryGetValue(seer.PlayerId, out float kcd) && kcd >= 2f)
+ seer.SetKillCooldown(kcd - 2f);
}
else if (seer.HasGhostRole()) seer.RpcResetAbilityCooldown();
}
diff --git a/Modules/Camouflague.cs b/Modules/Camouflague.cs
index 456adecf0..fd562a6b8 100644
--- a/Modules/Camouflague.cs
+++ b/Modules/Camouflague.cs
@@ -68,10 +68,7 @@ namespace EHR
{
if (Options.UsePets.GetBool() && outfit.PetId == "")
{
- string[] pets = Options.PetToAssign;
- string pet = pets[Options.PetToAssignToEveryone.GetValue()];
- string petId = pet == "pet_RANDOM_FOR_EVERYONE" ? pets[IRandom.Instance.Next(0, pets.Length - 1)] : pet;
- outfit.PetId = petId;
+ outfit.PetId = PetsPatch.GetPetId();
}
}
diff --git a/Modules/CustomTeamManager.cs b/Modules/CustomTeamManager.cs
index c39e01b56..9f8e105c7 100644
--- a/Modules/CustomTeamManager.cs
+++ b/Modules/CustomTeamManager.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using UnityEngine;
diff --git a/Modules/GameState.cs b/Modules/GameState.cs
index e740a3486..c9182f109 100644
--- a/Modules/GameState.cs
+++ b/Modules/GameState.cs
@@ -123,7 +123,7 @@ namespace EHR
Role.Add(PlayerId);
- Logger.Info($"ID {PlayerId} ({Player?.GetRealName()}) => {role}, CountTypes => {countTypes}", "SetMainRole");
+ Logger.Info($"ID {PlayerId} ({Player.GetRealName()}) => {role}, CountTypes => {countTypes}", "SetMainRole");
if (!AmongUsClient.Instance.AmHost) return;
@@ -150,12 +150,14 @@ namespace EHR
LateTask.New(() => Player.CheckAndSetUnshiftState(), 1f, log: false);
- if (Options.CurrentGameMode == CustomGameMode.Standard && !GameStates.IsMeeting && !AntiBlackout.SkipTasks)
+ if (Options.CurrentGameMode == CustomGameMode.Standard && GameStates.IsInTask && !AntiBlackout.SkipTasks)
Player.Notify(string.Format(Translator.GetString("RoleChangedNotify"), role.ToColoredString()), 10f);
+
+ if (Options.UsePets.GetBool()) Player.RpcSetPetDesync(PetsPatch.GetPetId(), Player);
}
CheckMurderPatch.TimeSinceLastKill.Remove(PlayerId);
-
+
if (Main.HasJustStarted || PlayerControl.LocalPlayer.PlayerId != PlayerId) return;
RoleChangeTimes++;
diff --git a/Modules/OptionShower.cs b/Modules/OptionShower.cs
index 98c8b9c6a..79a2b0ef3 100644
--- a/Modules/OptionShower.cs
+++ b/Modules/OptionShower.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using HarmonyLib;
using UnityEngine;
using static EHR.Translator;
diff --git a/Modules/Statistics.cs b/Modules/Statistics.cs
index 938d032b1..16cc0f4ad 100644
--- a/Modules/Statistics.cs
+++ b/Modules/Statistics.cs
@@ -3,7 +3,6 @@ using System.Linq;
using EHR.AddOns.Common;
using EHR.Crewmate;
using EHR.Neutral;
-using MS.Internal.Xml.XPath;
namespace EHR.Modules
{
@@ -174,7 +173,7 @@ namespace EHR.Modules
try
{
if (Options.CurrentGameMode != CustomGameMode.Standard) return;
-
+
PlayerControl lp = PlayerControl.LocalPlayer;
bool amDictator = dictator && lp.Is(CustomRoles.Dictator);
@@ -257,7 +256,7 @@ namespace EHR.Modules
try
{
if (Options.CurrentGameMode != CustomGameMode.Standard || killer.PlayerId == target.PlayerId) return;
-
+
if (killer.IsLocalPlayer())
{
if (Main.AliveImpostorCount == 0 && killer.IsCrewmate() && target.IsImpostor() && !Main.AllAlivePlayerControls.Any(x => x.IsNeutralKiller()))
@@ -315,7 +314,7 @@ namespace EHR.Modules
try
{
if (Options.CurrentGameMode != CustomGameMode.Standard) return;
-
+
if (shapeshifter.IsLocalPlayer() && shapeshifting && animated)
{
Achievements.Type.ItsMorbinTime.Complete();
diff --git a/Modules/Utils.cs b/Modules/Utils.cs
index 1852147ee..189cee4f2 100644
--- a/Modules/Utils.cs
+++ b/Modules/Utils.cs
@@ -1118,7 +1118,7 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
Color TextColor = comms ? Color.gray : NormalColor;
string Completed = comms ? "?" : $"{taskState.CompletedTasksCount}";
- return ColorString(TextColor, $" {(moveAndStop ? "" : string.Empty)}{Completed}/{taskState.AllTasksCount}{(moveAndStop ? $" <#ffffff>({MoveAndStop.GetLivesRemaining(playerId)})" : string.Empty)}");
+ return ColorString(TextColor, $" {(moveAndStop ? "" : string.Empty)}{Completed}/{taskState.AllTasksCount}{(moveAndStop ? $" <#ffffff>({MoveAndStop.GetLivesRemaining(playerId)} \u2665)" : string.Empty)}");
}
catch
{
@@ -1131,16 +1131,14 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
SendMessage(GetString("CurrentActiveSettingsHelp") + ":", PlayerId);
if (Options.DisableDevices.GetBool()) SendMessage(GetString("DisableDevicesInfo"), PlayerId);
-
if (Options.SyncButtonMode.GetBool()) SendMessage(GetString("SyncButtonModeInfo"), PlayerId);
-
if (Options.SabotageTimeControl.GetBool()) SendMessage(GetString("SabotageTimeControlInfo"), PlayerId);
-
if (Options.RandomMapsMode.GetBool()) SendMessage(GetString("RandomMapsModeInfo"), PlayerId);
if (Main.GM.Value) SendMessage(GetRoleName(CustomRoles.GM) + GetString("GMInfoLong"), PlayerId);
- foreach (CustomRoles role in Enum.GetValues().Where(role => role.IsEnable() && !role.IsVanilla())) SendMessage(GetRoleName(role) + GetRoleMode(role) + GetString(Enum.GetName(typeof(CustomRoles), role) + "InfoLong"), PlayerId);
+ foreach (CustomRoles role in Enum.GetValues().Where(role => role.IsEnable() && !role.IsVanilla()))
+ SendMessage(GetRoleName(role) + GetRoleMode(role) + GetString($"{role}InfoLong"), PlayerId);
if (Options.NoGameEnd.GetBool()) SendMessage(GetString("NoGameEndInfo"), PlayerId);
}
@@ -1171,27 +1169,21 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
}
StringBuilder sb = new();
- sb.Append(" ★ " + GetString("TabGroup.SystemSettings"));
+ sb.Append($" \u2605 {GetString("TabGroup.SystemSettings")}");
+ Options.GroupedOptions[TabGroup.SystemSettings].Do(CheckAndAppendOptionString);
+ sb.Append($"\n\n \u2605 {GetString("TabGroup.GameSettings")}");
+ Options.GroupedOptions[TabGroup.GameSettings].Do(CheckAndAppendOptionString);
- foreach (OptionItem opt in OptionItem.AllOptions.Where(x => x.GetBool() && x.Parent == null && x.Tab is TabGroup.SystemSettings && !x.IsHiddenOn(Options.CurrentGameMode)))
+ SendMessage(sb.ToString().RemoveHtmlTags(), PlayerId);
+ return;
+
+ void CheckAndAppendOptionString(OptionItem item)
{
- sb.Append($"\n{opt.GetName(true)}: {opt.GetString()}");
- //ShowChildrenSettings(opt, ref sb);
- var text = sb.ToString();
- sb.Clear().Append(text.RemoveHtmlTags());
+ if (item.GetBool() && item.Parent == null && !item.IsHiddenOn(Options.CurrentGameMode))
+ {
+ sb.Append($"\n{item.GetName(true)}: {item.GetString()}");
+ }
}
-
- sb.Append("\n\n ★ " + GetString("TabGroup.GameSettings"));
-
- foreach (OptionItem opt in OptionItem.AllOptions.Where(x => x.GetBool() && x.Parent == null && x.Tab is TabGroup.GameSettings && !x.IsHiddenOn(Options.CurrentGameMode)))
- {
- sb.Append($"\n{opt.GetName(true)}: {opt.GetString()}");
- //ShowChildrenSettings(opt, ref sb);
- var text = sb.ToString();
- sb.Clear().Append(text.RemoveHtmlTags());
- }
-
- SendMessage(sb.ToString(), PlayerId);
}
public static void ShowAllActiveSettings(byte PlayerId = byte.MaxValue)
@@ -1233,8 +1225,6 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
sb.Append($"\n【{GetRoleName(role.Key)}:{mode} ×{role.Key.GetCount()}】\n");
ShowChildrenSettings(Options.CustomRoleSpawnChances[role.Key], ref sb);
- var text = sb.ToString();
- sb.Clear().Append(text.RemoveHtmlTags());
}
foreach (OptionItem opt in OptionItem.AllOptions)
@@ -1247,12 +1237,10 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
sb.Append($"\n【{opt.GetName(true)}】\n");
ShowChildrenSettings(opt, ref sb);
- var text = sb.ToString();
- sb.Clear().Append(text.RemoveHtmlTags());
}
}
- SendMessage(sb.ToString(), PlayerId);
+ SendMessage(sb.ToString().RemoveHtmlTags(), PlayerId);
}
public static void CopyCurrentSettings()
@@ -1288,8 +1276,6 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
sb.Append($"\n【{GetRoleName(role.Key)}:{mode} ×{role.Key.GetCount()}】\n");
ShowChildrenSettings(Options.CustomRoleSpawnChances[role.Key], ref sb);
- var text = sb.ToString();
- sb.Clear().Append(text.RemoveHtmlTags());
}
sb.Append($"━━━━━━━━━━━━【{GetString("Settings")}】━━━━━━━━━━━━");
@@ -1302,12 +1288,10 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
sb.Append($"\n【{opt.GetName(true)}】\n");
ShowChildrenSettings(opt, ref sb);
- var text = sb.ToString();
- sb.Clear().Append(text.RemoveHtmlTags());
}
sb.Append("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
- ClipboardHelper.PutClipboardString(sb.ToString());
+ ClipboardHelper.PutClipboardString(sb.ToString().RemoveHtmlTags());
}
public static void ShowActiveRoles(byte PlayerId = byte.MaxValue)
diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs
index d0bf5e42d..51d141ee9 100644
--- a/Patches/ChatCommandPatch.cs
+++ b/Patches/ChatCommandPatch.cs
@@ -1,9 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
-using System.Text;
using System.Text.RegularExpressions;
using AmongUs.GameOptions;
using Assets.CoreScripts;
diff --git a/Patches/ControlPatch.cs b/Patches/ControlPatch.cs
index 925282880..766315270 100644
--- a/Patches/ControlPatch.cs
+++ b/Patches/ControlPatch.cs
@@ -1,7 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using EHR.Modules;
using HarmonyLib;
using Rewired;
diff --git a/Patches/CredentialsPatch.cs b/Patches/CredentialsPatch.cs
index 6c04e6bcc..fc19d1fc5 100644
--- a/Patches/CredentialsPatch.cs
+++ b/Patches/CredentialsPatch.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using EHR.Modules;
using HarmonyLib;
using TMPro;
@@ -48,16 +47,10 @@ namespace EHR
};
Sb.Append(GameStates.InGame ? " - " : "\r\n");
- Sb.Append($"{GetString("PingText")}: {ping} ms");
+ Sb.Append($"{ping} {GetString("PingText")}");
Sb.Append(GameStates.InGame ? " - " : "\r\n");
Sb.Append(string.Format(GetString("Server"), Utils.GetRegionName()));
if (GameStates.InGame) Sb.Append("\r\n.");
-
- // if (Options.NoGameEnd.GetBool()) Sb.Append("\r\n").Append(Utils.ColorString(Color.red, GetString("NoGameEnd"))).Append("");
- // if (!GameStates.IsModHost) Sb.Append("\r\n").Append(Utils.ColorString(Color.red, GetString("Warning.NoModHost"))).Append("");
- // if (DebugModeManager.IsDebugMode) Sb.Append("\r\n").Append(Utils.ColorString(Color.green, GetString("DebugMode"))).Append("");
- //
- // if (Main.IsAprilFools || Options.AprilFoolsMode.GetBool()) Sb.Append("\r\n").Append(Utils.ColorString(Color.yellow, "CHEESE")).Append("");
}
}
@@ -72,37 +65,68 @@ namespace EHR
#pragma warning restore CS0162 // Unreachable code detected
Main.CredentialsText = $"Endless Host Roles v{Main.PluginDisplayVersion}{testBuildIndicator} by Gurge44";
- var menuText = $"Endless Host Roles v{Main.PluginDisplayVersion}{testBuildIndicator}\r\nBy Gurge44";
if (Main.IsAprilFools) Main.CredentialsText = "Endless Madness v11.45.14 by No one";
- TextMeshPro credentials = Object.Instantiate(__instance.text);
- credentials.text = menuText;
- credentials.alignment = TextAlignmentOptions.Right;
- credentials.transform.position = new(1f, 2.67f, -2f);
- credentials.fontSize = credentials.fontSizeMax = credentials.fontSizeMin = 2f;
-
ErrorText.Create(__instance.text);
- if (Main.HasArgumentException && ErrorText.Instance != null) ErrorText.Instance.AddError(ErrorCode.Main_DictionaryError);
+
+ if (Main.HasArgumentException && ErrorText.Instance != null)
+ ErrorText.Instance.AddError(ErrorCode.Main_DictionaryError);
VersionChecker.Check();
}
}
+ // From TONX/Patches/AccountManagerPatch.cs, by KARPED1EM
+ [HarmonyPatch(typeof(AccountTab), nameof(AccountTab.Awake))]
+ public static class UpdateFriendCodeUIPatch
+ {
+ private static GameObject VersionShower;
+
+ public static void Prefix()
+ {
+ string credentialsText = $"Gurge44 \u00a9 2024";
+ credentialsText += "\t\t\t";
+ credentialsText += $"{Main.ModName} - {Main.PluginVersion}";
+
+ var friendCode = GameObject.Find("FriendCode");
+
+ if (friendCode != null && VersionShower == null)
+ {
+ VersionShower = Object.Instantiate(friendCode, friendCode.transform.parent);
+ VersionShower.name = "EHR Version Shower";
+ VersionShower.transform.localPosition = friendCode.transform.localPosition + new Vector3(3.2f, 0f, 0f);
+ VersionShower.transform.localScale *= 1.7f;
+ var TMP = VersionShower.GetComponent();
+ TMP.alignment = TextAlignmentOptions.Right;
+ TMP.fontSize = 30f;
+ TMP.SetText(credentialsText);
+ }
+
+ var newRequest = GameObject.Find("NewRequest");
+
+ if (newRequest != null)
+ {
+ newRequest.transform.localPosition -= new Vector3(0f, 0f, 10f);
+ newRequest.transform.localScale = new(0.8f, 1f, 1f);
+ }
+ }
+ }
+
[HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))]
[HarmonyPriority(Priority.First)]
- internal class TitleLogoPatch
+ internal static class TitleLogoPatch
{
- public static GameObject ModStamp;
+ private static GameObject ModStamp;
- public static GameObject Ambience;
+ private static GameObject Ambience;
// public static GameObject LoadingHint;
- public static GameObject LeftPanel;
+ private static GameObject LeftPanel;
public static GameObject RightPanel;
- public static GameObject CloseRightButton;
- public static GameObject Tint;
- public static GameObject BottomButtonBounds;
+ private static GameObject CloseRightButton;
+ private static GameObject Tint;
+ private static GameObject BottomButtonBounds;
public static Vector3 RightPanelOp;
@@ -145,7 +169,8 @@ namespace EHR
{ [__instance.creditsButton, __instance.quitButton], (minorActiveSprite, new(0.526f, 1f, 0.792f, 0.8f), shade, Color.white, Color.white) }
};
- foreach (KeyValuePair, (Sprite, Color, Color, Color, Color)> kvp in mainButtons) kvp.Key.Do(button => FormatButtonColor(button, kvp.Value.Item2, kvp.Value.Item3, kvp.Value.Item4, kvp.Value.Item5));
+ foreach (KeyValuePair, (Sprite, Color, Color, Color, Color)> kvp in mainButtons)
+ kvp.Key.Do(button => FormatButtonColor(button, kvp.Value.Item2, kvp.Value.Item3, kvp.Value.Item4, kvp.Value.Item5));
try
{
@@ -218,7 +243,7 @@ namespace EHR
}
[HarmonyPatch(typeof(ModManager), nameof(ModManager.LateUpdate))]
- internal class ModManagerLateUpdatePatch
+ internal static class ModManagerLateUpdatePatch
{
public static bool Prefix(ModManager __instance)
{
@@ -233,7 +258,9 @@ namespace EHR
public static void Postfix(ModManager __instance)
{
- __instance.localCamera = !DestroyableSingleton.InstanceExists ? Camera.main : DestroyableSingleton.Instance.GetComponentInChildren();
+ __instance.localCamera = !DestroyableSingleton.InstanceExists
+ ? Camera.main
+ : DestroyableSingleton.Instance.GetComponentInChildren();
if (__instance.localCamera != null)
{
@@ -247,7 +274,7 @@ namespace EHR
}
[HarmonyPatch(typeof(OptionsMenuBehaviour), nameof(OptionsMenuBehaviour.Open))]
- internal class OptionsMenuBehaviourOpenPatch
+ internal static class OptionsMenuBehaviourOpenPatch
{
public static bool Prefix(OptionsMenuBehaviour __instance)
{
@@ -286,10 +313,5 @@ namespace EHR
return false;
}
-
- public static void Postfix()
- {
- if (GameStates.InGame && GameStates.IsMeeting) { }
- }
}
}
\ No newline at end of file
diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs
index a6bca26fa..101d8623e 100644
--- a/Patches/IntroPatch.cs
+++ b/Patches/IntroPatch.cs
@@ -1,6 +1,5 @@
using System;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using EHR.Neutral;
@@ -849,18 +848,13 @@ namespace EHR
{
Main.ProcessShapeshifts = false;
- string[] pets = Options.PetToAssign;
- string pet = pets[Options.PetToAssignToEveryone.GetValue()];
-
- var r = IRandom.Instance;
-
LateTask.New(() =>
{
foreach (PlayerControl pc in aapc)
{
if (pc.Is(CustomRoles.GM)) continue;
- string petId = pet == "pet_RANDOM_FOR_EVERYONE" ? pets[r.Next(0, pets.Length - 1)] : pet;
+ string petId = PetsPatch.GetPetId();
pc.RpcSetPetDesync(petId, pc);
Logger.Info($"{pc.GetNameWithRole()} => {GetString(petId)} Pet", "PetAssign");
}
diff --git a/Patches/PetsPatch.cs b/Patches/PetsPatch.cs
index 4620a10cb..9c8c186cb 100644
--- a/Patches/PetsPatch.cs
+++ b/Patches/PetsPatch.cs
@@ -24,5 +24,13 @@
sender.SendMessage();
}
+
+ public static string GetPetId()
+ {
+ string[] pets = Options.PetToAssign;
+ string pet = pets[Options.PetToAssignToEveryone.GetValue()];
+ string petId = pet == "pet_RANDOM_FOR_EVERYONE" ? pets[IRandom.Instance.Next(0, pets.Length - 1)] : pet;
+ return petId;
+ }
}
}
\ No newline at end of file
diff --git a/Roles/Crewmate/Alchemist.cs b/Roles/Crewmate/Alchemist.cs
index 11e1ff8f1..3affa27fe 100644
--- a/Roles/Crewmate/Alchemist.cs
+++ b/Roles/Crewmate/Alchemist.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using EHR.Neutral;
diff --git a/Roles/Crewmate/Druid.cs b/Roles/Crewmate/Druid.cs
index d19f9ec60..cbc073fc0 100644
--- a/Roles/Crewmate/Druid.cs
+++ b/Roles/Crewmate/Druid.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Crewmate/Grenadier.cs b/Roles/Crewmate/Grenadier.cs
index 134c3625b..a996843d9 100644
--- a/Roles/Crewmate/Grenadier.cs
+++ b/Roles/Crewmate/Grenadier.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using static EHR.Options;
diff --git a/Roles/Crewmate/Lighter.cs b/Roles/Crewmate/Lighter.cs
index 746970420..10d9546eb 100644
--- a/Roles/Crewmate/Lighter.cs
+++ b/Roles/Crewmate/Lighter.cs
@@ -1,5 +1,4 @@
-using System.Text;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using static EHR.Options;
namespace EHR.Crewmate
diff --git a/Roles/Crewmate/Lookout.cs b/Roles/Crewmate/Lookout.cs
index 63bf74df8..1eba4b516 100644
--- a/Roles/Crewmate/Lookout.cs
+++ b/Roles/Crewmate/Lookout.cs
@@ -1,5 +1,4 @@
-using System.Text;
-using UnityEngine;
+using UnityEngine;
namespace EHR.Crewmate
{
diff --git a/Roles/Crewmate/NiceHacker.cs b/Roles/Crewmate/NiceHacker.cs
index c1943facb..f7346de57 100644
--- a/Roles/Crewmate/NiceHacker.cs
+++ b/Roles/Crewmate/NiceHacker.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Crewmate/SecurityGuard.cs b/Roles/Crewmate/SecurityGuard.cs
index 7b0b6a424..904bc1108 100644
--- a/Roles/Crewmate/SecurityGuard.cs
+++ b/Roles/Crewmate/SecurityGuard.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using static EHR.Options;
diff --git a/Roles/Crewmate/TaskManager.cs b/Roles/Crewmate/TaskManager.cs
index 8b3e6070f..4e089717e 100644
--- a/Roles/Crewmate/TaskManager.cs
+++ b/Roles/Crewmate/TaskManager.cs
@@ -1,6 +1,4 @@
-using System.Text;
-
-namespace EHR.Crewmate
+namespace EHR.Crewmate
{
internal class TaskManager : RoleBase
{
diff --git a/Roles/Crewmate/Tether.cs b/Roles/Crewmate/Tether.cs
index c08a600e3..b58480ef0 100644
--- a/Roles/Crewmate/Tether.cs
+++ b/Roles/Crewmate/Tether.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Crewmate/TimeMaster.cs b/Roles/Crewmate/TimeMaster.cs
index 4d0130f45..7d7c065bc 100644
--- a/Roles/Crewmate/TimeMaster.cs
+++ b/Roles/Crewmate/TimeMaster.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using static EHR.Options;
diff --git a/Roles/Crewmate/Tunneler.cs b/Roles/Crewmate/Tunneler.cs
index 69a0b72f7..91548aed1 100644
--- a/Roles/Crewmate/Tunneler.cs
+++ b/Roles/Crewmate/Tunneler.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
namespace EHR.Crewmate
{
diff --git a/Roles/Crewmate/Veteran.cs b/Roles/Crewmate/Veteran.cs
index b51e8f793..68a3e371e 100644
--- a/Roles/Crewmate/Veteran.cs
+++ b/Roles/Crewmate/Veteran.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using static EHR.Options;
diff --git a/Roles/Impostor/BoobyTrap.cs b/Roles/Impostor/BoobyTrap.cs
index 2f6142708..086cb2b41 100644
--- a/Roles/Impostor/BoobyTrap.cs
+++ b/Roles/Impostor/BoobyTrap.cs
@@ -50,7 +50,8 @@ namespace EHR.Impostor
public override bool OnCheckMurderAsTarget(PlayerControl killer, PlayerControl target)
{
- if (TrapOnlyWorksOnTheBodyBoobyTrap.GetBool() && !GameStates.IsMeeting) BoobyTrapBody.Add(target.PlayerId);
+ if (TrapOnlyWorksOnTheBodyBoobyTrap.GetBool() && !GameStates.IsMeeting)
+ BoobyTrapBody.Add(target.PlayerId);
return true;
}
@@ -59,9 +60,10 @@ namespace EHR.Impostor
{
if (!TrapOnlyWorksOnTheBodyBoobyTrap.GetBool() && killer != target)
{
- if (!BoobyTrapBody.Contains(target.PlayerId)) BoobyTrapBody.Add(target.PlayerId);
+ if (!BoobyTrapBody.Contains(target.PlayerId))
+ BoobyTrapBody.Add(target.PlayerId);
- if (!KillerOfBoobyTrapBody.ContainsKey(target.PlayerId)) KillerOfBoobyTrapBody.Add(target.PlayerId, killer.PlayerId);
+ KillerOfBoobyTrapBody.TryAdd(target.PlayerId, killer.PlayerId);
killer.Suicide();
}
@@ -69,7 +71,7 @@ namespace EHR.Impostor
public static bool OnAnyoneCheckReportDeadBody(PlayerControl reporter, NetworkedPlayerInfo target)
{
- if (BoobyTrapBody.Contains(target.PlayerId) && reporter.IsAlive())
+ if (BoobyTrapBody.Contains(target.PlayerId) && reporter.IsAlive() && !target.Object.Is(CustomRoles.Unreportable))
{
if (!TrapOnlyWorksOnTheBodyBoobyTrap.GetBool())
{
@@ -78,7 +80,8 @@ namespace EHR.Impostor
reporter.Suicide(PlayerState.DeathReason.Trapped, Utils.GetPlayerById(killerID));
RPC.PlaySoundRPC(killerID, Sounds.KillSound);
- if (!BoobyTrapBody.Contains(reporter.PlayerId) && TrapConsecutiveBodies.GetBool()) BoobyTrapBody.Add(reporter.PlayerId);
+ if (!BoobyTrapBody.Contains(reporter.PlayerId) && TrapConsecutiveBodies.GetBool())
+ BoobyTrapBody.Add(reporter.PlayerId);
KillerOfBoobyTrapBody.TryAdd(reporter.PlayerId, killerID);
return false;
diff --git a/Roles/Impostor/EvilTracker.cs b/Roles/Impostor/EvilTracker.cs
index 34fad690d..6a1f319b9 100644
--- a/Roles/Impostor/EvilTracker.cs
+++ b/Roles/Impostor/EvilTracker.cs
@@ -5,7 +5,6 @@ using System.Linq;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
-using Il2CppSystem.Text;
using UnityEngine;
using static EHR.Options;
using static EHR.Translator;
diff --git a/Roles/Impostor/OverKiller.cs b/Roles/Impostor/OverKiller.cs
index a559510e5..00c164969 100644
--- a/Roles/Impostor/OverKiller.cs
+++ b/Roles/Impostor/OverKiller.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System.Collections;
+using System.Collections.Generic;
using Hazel;
using InnerNet;
@@ -45,13 +46,14 @@ namespace EHR.Impostor
{
if (!killer.RpcCheckAndMurder(target, true)) return false;
- if (killer.PlayerId != target.PlayerId)
+ if (killer.PlayerId != target.PlayerId && !target.Is(CustomRoles.Unreportable))
{
Main.PlayerStates[target.PlayerId].deathReason = PlayerState.DeathReason.Dismembered;
LateTask.New(() =>
{
- if (!OverDeadPlayerList.Contains(target.PlayerId)) OverDeadPlayerList.Add(target.PlayerId);
+ if (!OverDeadPlayerList.Contains(target.PlayerId))
+ OverDeadPlayerList.Add(target.PlayerId);
if (target.Is(CustomRoles.Avanger))
{
@@ -68,26 +70,35 @@ namespace EHR.Impostor
Vector2 originPos = killer.Pos();
var rd = IRandom.Instance;
- for (var i = 0; i < 20; i++)
+ Main.Instance.StartCoroutine(SpawnFakeDeadBodies());
+ return;
+
+ IEnumerator SpawnFakeDeadBodies()
{
- Vector2 location = new(ops.x + ((float)(rd.Next(0, 201) - 100) / 100), ops.y + ((float)(rd.Next(0, 201) - 100) / 100));
- location += new Vector2(0, 0.3636f);
+ for (var i = 0; i < 26; i++)
+ {
+ Vector2 location = new(ops.x + ((float)(rd.Next(0, 201) - 100) / 100), ops.y + ((float)(rd.Next(0, 201) - 100) / 100));
+ location += new Vector2(0, 0.3636f);
- MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(target.NetTransform.NetId, (byte)RpcCalls.SnapTo, SendOption.None);
- NetHelpers.WriteVector2(location, writer);
- writer.Write(target.NetTransform.lastSequenceId);
- AmongUsClient.Instance.FinishRpcImmediately(writer);
+ MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(target.NetTransform.NetId, (byte)RpcCalls.SnapTo, SendOption.None);
+ NetHelpers.WriteVector2(location, writer);
+ writer.Write(target.NetTransform.lastSequenceId);
+ AmongUsClient.Instance.FinishRpcImmediately(writer);
- target.NetTransform.SnapTo(location);
- killer.MurderPlayer(target, ExtendedPlayerControl.ResultFlags);
+ target.NetTransform.SnapTo(location);
+ killer.MurderPlayer(target, ExtendedPlayerControl.ResultFlags);
- MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(killer.NetId, (byte)RpcCalls.MurderPlayer, SendOption.None);
- messageWriter.WriteNetObject(target);
- messageWriter.Write((byte)ExtendedPlayerControl.ResultFlags);
- AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
+ MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(killer.NetId, (byte)RpcCalls.MurderPlayer, SendOption.None);
+ messageWriter.WriteNetObject(target);
+ messageWriter.Write((byte)ExtendedPlayerControl.ResultFlags);
+ AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
+
+ if (i % 3 == 0) yield return null;
+ }
+
+ yield return null;
+ killer.TP(originPos);
}
-
- killer.TP(originPos);
}, 0.05f, "OverKiller Murder");
}
diff --git a/Roles/Impostor/Sapper.cs b/Roles/Impostor/Sapper.cs
index 82f41e6d3..3160d2656 100644
--- a/Roles/Impostor/Sapper.cs
+++ b/Roles/Impostor/Sapper.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Neutral;
using static EHR.Options;
diff --git a/Roles/Impostor/Swooper.cs b/Roles/Impostor/Swooper.cs
index e7ae08a53..2d2dbd890 100644
--- a/Roles/Impostor/Swooper.cs
+++ b/Roles/Impostor/Swooper.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Crewmate;
using EHR.Modules;
diff --git a/Roles/Impostor/Warlock.cs b/Roles/Impostor/Warlock.cs
index 81035ebf9..a6c17dc18 100644
--- a/Roles/Impostor/Warlock.cs
+++ b/Roles/Impostor/Warlock.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Crewmate;
using EHR.Modules;
diff --git a/Roles/Impostor/Wildling.cs b/Roles/Impostor/Wildling.cs
index 13aa1d0ea..f2fc9b8c8 100644
--- a/Roles/Impostor/Wildling.cs
+++ b/Roles/Impostor/Wildling.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using EHR.Neutral;
diff --git a/Roles/Impostor/Witch.cs b/Roles/Impostor/Witch.cs
index aa9095f0c..76990723c 100644
--- a/Roles/Impostor/Witch.cs
+++ b/Roles/Impostor/Witch.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using EHR.Crewmate;
using EHR.Modules;
using EHR.Neutral;
diff --git a/Roles/Impostor/YinYanger.cs b/Roles/Impostor/YinYanger.cs
index 1ef85245b..7015c8969 100644
--- a/Roles/Impostor/YinYanger.cs
+++ b/Roles/Impostor/YinYanger.cs
@@ -142,7 +142,11 @@ namespace EHR.Impostor
{
if (seer.IsModClient() && !hud) return string.Empty;
- if (Main.PlayerStates[seer.PlayerId].Role is YinYanger { IsEnable: true } yy && seer.PlayerId == target.PlayerId) return yy.YinYangedPlayers.Count == 2 ? $"{Translator.GetString("Mode")}: {Translator.GetString("YinYangModeNormal")}" : $"{Translator.GetString("Mode")}: {Translator.GetString("YinYangMode")} ({yy.YinYangedPlayers.Count}/2)";
+ if (Main.PlayerStates[seer.PlayerId].Role is YinYanger { IsEnable: true } yy)
+ {
+ if (seer.PlayerId == target.PlayerId) return yy.YinYangedPlayers.Count == 2 ? $"{Translator.GetString("Mode")}: {Translator.GetString("YinYangModeNormal")}" : $"{Translator.GetString("Mode")}: {Translator.GetString("YinYangMode")} ({yy.YinYangedPlayers.Count}/2)";
+ else if (yy.YinYangedPlayers.Contains(target.PlayerId)) return "\u262f";
+ }
return string.Empty;
}
diff --git a/Roles/Neutral/Chemist.cs b/Roles/Neutral/Chemist.cs
index 6aca9287e..7f70a1a98 100644
--- a/Roles/Neutral/Chemist.cs
+++ b/Roles/Neutral/Chemist.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Neutral/Evolver.cs b/Roles/Neutral/Evolver.cs
index f41968b73..2125d07c2 100644
--- a/Roles/Neutral/Evolver.cs
+++ b/Roles/Neutral/Evolver.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Neutral/Gaslighter.cs b/Roles/Neutral/Gaslighter.cs
index e19dbc92f..b8d2c26b1 100644
--- a/Roles/Neutral/Gaslighter.cs
+++ b/Roles/Neutral/Gaslighter.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Crewmate;
using EHR.Patches;
diff --git a/Roles/Neutral/Glitch.cs b/Roles/Neutral/Glitch.cs
index fa2e76091..47fa16ca0 100644
--- a/Roles/Neutral/Glitch.cs
+++ b/Roles/Neutral/Glitch.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Neutral/Impartial.cs b/Roles/Neutral/Impartial.cs
index fb6a383f1..909df304c 100644
--- a/Roles/Neutral/Impartial.cs
+++ b/Roles/Neutral/Impartial.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Neutral/Magician.cs b/Roles/Neutral/Magician.cs
index 0ae716ffd..1236e2c2a 100644
--- a/Roles/Neutral/Magician.cs
+++ b/Roles/Neutral/Magician.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Crewmate;
using EHR.Modules;
diff --git a/Roles/Neutral/PlagueDoctor.cs b/Roles/Neutral/PlagueDoctor.cs
index 858e45a90..53dc7ae09 100644
--- a/Roles/Neutral/PlagueDoctor.cs
+++ b/Roles/Neutral/PlagueDoctor.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using Hazel;
diff --git a/Roles/Neutral/Postman.cs b/Roles/Neutral/Postman.cs
index c7a549594..d0f2b9541 100644
--- a/Roles/Neutral/Postman.cs
+++ b/Roles/Neutral/Postman.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Modules;
using static EHR.Options;
diff --git a/Roles/Neutral/QuizMaster.cs b/Roles/Neutral/QuizMaster.cs
index 778510f81..e9e1cbf5d 100644
--- a/Roles/Neutral/QuizMaster.cs
+++ b/Roles/Neutral/QuizMaster.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using AmongUs.GameOptions;
using EHR.Modules;
diff --git a/Roles/Neutral/Werewolf.cs b/Roles/Neutral/Werewolf.cs
index 73f7785d3..3f2c03562 100644
--- a/Roles/Neutral/Werewolf.cs
+++ b/Roles/Neutral/Werewolf.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Text;
using AmongUs.GameOptions;
using EHR.Crewmate;
using EHR.Modules;
diff --git a/Roles/RoleBase.cs b/Roles/RoleBase.cs
index 5c9ff3c6a..4816ea6cd 100644
--- a/Roles/RoleBase.cs
+++ b/Roles/RoleBase.cs
@@ -2,11 +2,9 @@
global using Vector2 = UnityEngine.Vector2;
global using File = System.IO.File;
global using StringBuilder = System.Text.StringBuilder;
-
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
-using System.Text;
using AmongUs.GameOptions;
using EHR.AddOns.Crewmate;
using EHR.AddOns.Impostor;