mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-11-19 13:16:56 +00:00
some improvements & optimize using directives
This commit is contained in:
1 parent
36101a132f
commit
010b85128d
47 files changed
+137
-151
No files matched your search
@@ -5,7 +5,6 @@ using System.Reflection;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.GameMode.HideAndSeekRoles;
|
||||
using HarmonyLib;
|
||||
using Il2CppSystem.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR
|
||||
|
||||
@@ -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)));
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using static EHR.Translator;
|
||||
|
||||
namespace EHR
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using static EHR.Translator;
|
||||
|
||||
@@ -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();
|
||||
|
||||
+17
-33
@@ -1118,7 +1118,7 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
|
||||
|
||||
Color TextColor = comms ? Color.gray : NormalColor;
|
||||
string Completed = comms ? "?" : $"{taskState.CompletedTasksCount}";
|
||||
return ColorString(TextColor, $" {(moveAndStop ? "<size=2>" : string.Empty)}{Completed}/{taskState.AllTasksCount}{(moveAndStop ? $" <#ffffff>({MoveAndStop.GetLivesRemaining(playerId)})</color></size>" : string.Empty)}");
|
||||
return ColorString(TextColor, $" {(moveAndStop ? "<size=2>" : string.Empty)}{Completed}/{taskState.AllTasksCount}{(moveAndStop ? $" <#ffffff>({MoveAndStop.GetLivesRemaining(playerId)} \u2665)</color></size>" : 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<CustomRoles>().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<CustomRoles>().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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EHR.Modules;
|
||||
using HarmonyLib;
|
||||
using Rewired;
|
||||
|
||||
+54
-32
@@ -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($"<color={color}>{GetString("PingText")}: {ping} ms</color>");
|
||||
Sb.Append($"<color={color}>{ping} {GetString("PingText")}</color>");
|
||||
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<size=1.2>").Append(Utils.ColorString(Color.red, GetString("NoGameEnd"))).Append("</size>");
|
||||
// if (!GameStates.IsModHost) Sb.Append("\r\n<size=1.2>").Append(Utils.ColorString(Color.red, GetString("Warning.NoModHost"))).Append("</size>");
|
||||
// if (DebugModeManager.IsDebugMode) Sb.Append("\r\n<size=1.2>").Append(Utils.ColorString(Color.green, GetString("DebugMode"))).Append("</size>");
|
||||
//
|
||||
// if (Main.IsAprilFools || Options.AprilFoolsMode.GetBool()) Sb.Append("\r\n<size=1.2>").Append(Utils.ColorString(Color.yellow, "CHEESE")).Append("</size>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,37 +65,68 @@ namespace EHR
|
||||
#pragma warning restore CS0162 // Unreachable code detected
|
||||
|
||||
Main.CredentialsText = $"<size=1.5><color={Main.ModColor}>Endless Host Roles</color> v{Main.PluginDisplayVersion}{testBuildIndicator} <color=#a54aff>by</color> <color=#ffff00>Gurge44</color>";
|
||||
var menuText = $"<color={Main.ModColor}>Endless Host Roles</color> v{Main.PluginDisplayVersion}{testBuildIndicator}\r\n<color=#a54aff>By</color> <color=#ffff00>Gurge44</color>";
|
||||
|
||||
if (Main.IsAprilFools) Main.CredentialsText = "<color=#00bfff>Endless Madness</color> v11.45.14 <color=#a54aff>by</color> <color=#ffff00>No one</color>";
|
||||
|
||||
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 = $"<color={Main.ModColor}>Gurge44</color> \u00a9 2024";
|
||||
credentialsText += "\t\t\t";
|
||||
credentialsText += $"<color={Main.ModColor}>{Main.ModName}</color> - {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<TextMeshPro>();
|
||||
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<List<PassiveButton>, (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<List<PassiveButton>, (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<HudManager>.InstanceExists ? Camera.main : DestroyableSingleton<HudManager>.Instance.GetComponentInChildren<Camera>();
|
||||
__instance.localCamera = !DestroyableSingleton<HudManager>.InstanceExists
|
||||
? Camera.main
|
||||
: DestroyableSingleton<HudManager>.Instance.GetComponentInChildren<Camera>();
|
||||
|
||||
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) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using EHR.Neutral;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using static EHR.Options;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using AmongUs.GameOptions;
|
||||
using static EHR.Options;
|
||||
|
||||
namespace EHR.Crewmate
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR.Crewmate
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using static EHR.Options;
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Text;
|
||||
|
||||
namespace EHR.Crewmate
|
||||
namespace EHR.Crewmate
|
||||
{
|
||||
internal class TaskManager : RoleBase
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using static EHR.Options;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace EHR.Crewmate
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using static EHR.Options;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Neutral;
|
||||
using static EHR.Options;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Crewmate;
|
||||
using EHR.Modules;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using EHR.Neutral;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using EHR.Crewmate;
|
||||
using EHR.Modules;
|
||||
using EHR.Neutral;
|
||||
|
||||
@@ -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 ? $"<color=#00ffa5>{Translator.GetString("Mode")}:</color> {Translator.GetString("YinYangModeNormal")}" : $"<color=#00ffa5>{Translator.GetString("Mode")}:</color> {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 ? $"<color=#00ffa5>{Translator.GetString("Mode")}:</color> {Translator.GetString("YinYangModeNormal")}" : $"<color=#00ffa5>{Translator.GetString("Mode")}:</color> {Translator.GetString("YinYangMode")} ({yy.YinYangedPlayers.Count}/2)";
|
||||
else if (yy.YinYangedPlayers.Contains(target.PlayerId)) return "\u262f";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Crewmate;
|
||||
using EHR.Patches;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Crewmate;
|
||||
using EHR.Modules;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using static EHR.Options;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Crewmate;
|
||||
using EHR.Modules;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user