mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-22 15:41:19 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7f0be4eb8 | ||
|
|
3ff2df26dc | ||
|
|
b422d65b47 | ||
|
|
2b844e31a9 | ||
|
|
48eb09f448 | ||
|
|
6842f3d516 |
No files matched your search
+16
-2
@@ -19,6 +19,12 @@ public partial class Main : BasePlugin
|
||||
public static BepInEx.Logging.ManualLogSource Logger;
|
||||
public static BasePlugin Instance;
|
||||
|
||||
public static ConfigEntry<string> Preset1 { get; private set; }
|
||||
public static ConfigEntry<string> Preset2 { get; private set; }
|
||||
public static ConfigEntry<string> Preset3 { get; private set; }
|
||||
public static ConfigEntry<string> Preset4 { get; private set; }
|
||||
public static ConfigEntry<string> Preset5 { get; private set; }
|
||||
|
||||
public static ConfigEntry<bool> GM { get; private set; }
|
||||
public static ConfigEntry<bool> UnlockFps { get; private set; }
|
||||
public static ConfigEntry<bool> ShowFps { get; private set; }
|
||||
@@ -29,7 +35,7 @@ public partial class Main : BasePlugin
|
||||
public static NormalGameOptionsV10 NormalOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentNormalGameOptions : null;
|
||||
public static bool HasArgumentException;
|
||||
public static string CredentialsText;
|
||||
public const string ModVersion = "v1.2.1";
|
||||
public const string ModVersion = "v1.3.2";
|
||||
|
||||
public static float GameTimer;
|
||||
|
||||
@@ -62,6 +68,12 @@ public partial class Main : BasePlugin
|
||||
AmongUsRevamped.Logger.Enable();
|
||||
Instance = this;
|
||||
|
||||
Preset1 = Config.Bind("Preset Name Options", "Preset1", "Preset 1");
|
||||
Preset2 = Config.Bind("Preset Name Options", "Preset2", "Preset 2");
|
||||
Preset3 = Config.Bind("Preset Name Options", "Preset3", "Preset 3");
|
||||
Preset4 = Config.Bind("Preset Name Options", "Preset4", "Preset 4");
|
||||
Preset5 = Config.Bind("Preset Name Options", "Preset5", "Preset 5");
|
||||
|
||||
AutoStart = Config.Bind("Client Options", "Auto Start", false);
|
||||
GM = Config.Bind("Client Options", "Game Master", false);
|
||||
UnlockFps = Config.Bind("Client Options", "Unlock FPS", false);
|
||||
@@ -103,7 +115,9 @@ public partial class Main : BasePlugin
|
||||
Rose = 13,
|
||||
Banana = 14,
|
||||
Gray = 15,
|
||||
Tan = 16
|
||||
Tan = 16,
|
||||
Coral = 17,
|
||||
Fortegreen = 18
|
||||
}
|
||||
|
||||
// Innersloth now censors messages with more than 5 numbers. This is the best bypass I can give
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Reactor" Version="2.0.0" />
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" Private="false" ExcludeAssets="runtime;native" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2025.10.14" PrivateAssets="all" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2025.11.18" PrivateAssets="all" />
|
||||
|
||||
<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.0.1" PrivateAssets="all" ExcludeAssets="runtime" />
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" PrivateAssets="all" ExcludeAssets="runtime" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||
|
||||
@@ -21,11 +21,24 @@ namespace AmongUsRevamped
|
||||
taskOptionsLoad.Wait();
|
||||
}
|
||||
|
||||
public const int PresetId = 0;
|
||||
|
||||
private static readonly string[] presets =
|
||||
{
|
||||
Main.Preset1.Value, Main.Preset2.Value, Main.Preset3.Value,
|
||||
Main.Preset4.Value, Main.Preset5.Value
|
||||
};
|
||||
|
||||
public static readonly string[] gameModes =
|
||||
{
|
||||
"None", "0 Kill Cooldown", "Shift And Seek", "Speedrun"
|
||||
};
|
||||
|
||||
public static readonly string[] colorLevels =
|
||||
{
|
||||
"Moderators", "Everyone", "Nobody"
|
||||
};
|
||||
|
||||
//System
|
||||
public static OptionItem Gamemode;
|
||||
|
||||
@@ -50,6 +63,11 @@ namespace AmongUsRevamped
|
||||
public static OptionItem WaitAutoStart;
|
||||
public static OptionItem PlayerAutoStart;
|
||||
|
||||
public static OptionItem TabGroupMisc;
|
||||
|
||||
public static OptionItem StartCountdown;
|
||||
public static OptionItem ColorCommandLevel;
|
||||
public static OptionItem AllowFortegreen;
|
||||
public static OptionItem NoGameEnd;
|
||||
|
||||
//Mod
|
||||
@@ -190,6 +208,10 @@ namespace AmongUsRevamped
|
||||
{
|
||||
if (IsLoaded) return;
|
||||
|
||||
_ = PresetOptionItem.Create(0, TabGroup.SystemSettings)
|
||||
.SetColor(new Color32(204, 204, 0, 255))
|
||||
.SetHeader(true);
|
||||
|
||||
Gamemode = StringOptionItem.Create(1, "Gamemode", gameModes, 0, TabGroup.SystemSettings, false)
|
||||
.SetColor(Color.green)
|
||||
.SetHeader(true);
|
||||
@@ -222,9 +244,15 @@ namespace AmongUsRevamped
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
PlayerAutoStart = IntegerOptionItem.Create(64422, "Players Needed To Auto Start", new(1, 15, 1), 1, TabGroup.SystemSettings, false);
|
||||
|
||||
NoGameEnd = BooleanOptionItem.Create(60380, "No Game End", false, TabGroup.SystemSettings, false)
|
||||
.SetColor(Color.red)
|
||||
.SetHeader(true);
|
||||
TabGroupMisc = TextOptionItem.Create(60379, "Miscelleneous", TabGroup.SystemSettings)
|
||||
.SetColor(Color.green);
|
||||
|
||||
StartCountdown = IntegerOptionItem.Create(60380, "Default Starting Countdown", new(1, 600, 1), 5, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
ColorCommandLevel = StringOptionItem.Create(60381, "Who Can use Color Commands", colorLevels, 0, TabGroup.SystemSettings, false);
|
||||
AllowFortegreen = BooleanOptionItem.Create(60382, "Allow Fortegreen Color", false, TabGroup.SystemSettings, false);
|
||||
NoGameEnd = BooleanOptionItem.Create(60383, "No Game End", false, TabGroup.SystemSettings, false)
|
||||
.SetColor(Color.red);
|
||||
|
||||
// Gamemode Settings
|
||||
TabGroupHNS = TextOptionItem.Create(70000, "Hide and Seek", TabGroup.GamemodeSettings)
|
||||
|
||||
+90
-13
@@ -11,6 +11,11 @@ public static class FixedUpdate
|
||||
{
|
||||
public static void Postfix()
|
||||
{
|
||||
if (Utils.InGame && !Utils.IsMeeting && !ExileController.Instance)
|
||||
{
|
||||
Main.GameTimer += Time.fixedDeltaTime;
|
||||
}
|
||||
|
||||
GameObject n = GameObject.Find("NewRequestInactive");
|
||||
if (n != null)
|
||||
{
|
||||
@@ -22,39 +27,111 @@ public static class FixedUpdate
|
||||
{
|
||||
nr.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))]
|
||||
class FixedUpdateInGamePatch
|
||||
{
|
||||
public static readonly HashSet<byte> ProcessedModerators = new HashSet<byte>();
|
||||
|
||||
public static void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (__instance == null || __instance.PlayerId == 255 || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (Utils.IsPlayerModerator(__instance.Data.FriendCode) && !ProcessedModerators.Contains(__instance.PlayerId))
|
||||
{
|
||||
__instance.SetName($"★{__instance.Data.PlayerName}★");
|
||||
ProcessedModerators.Add(__instance.PlayerId);
|
||||
}
|
||||
|
||||
GameObject g = GameObject.Find("GameSettingsLabel");
|
||||
|
||||
// 0Kc
|
||||
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 0.01f;
|
||||
|
||||
if (Options.NoKcdSettingsOverride.GetBool() && g == null)
|
||||
{
|
||||
Main.NormalOptions.EmergencyCooldown = 0;
|
||||
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// SnS
|
||||
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 2.5f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 2.5f;
|
||||
|
||||
if (Options.SNSSettingsOverride.GetBool() && g == null)
|
||||
{
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Speedrun
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek && g == null)
|
||||
{
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
|
||||
if (__instance.AllTasksCompleted() && Utils.InGame && Utils.GamePastRoleSelection && !Utils.HandlingGameEnd)
|
||||
{
|
||||
if (__instance == PlayerControl.LocalPlayer && Main.GM.Value) return;
|
||||
|
||||
Utils.CustomWinnerEndGame(__instance, 1);
|
||||
NormalGameEndChecker.LastWinReason = $"★ {__instance.Data.PlayerName} Wins! (Completed tasks first)";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() == 0 && Main.NormalOptions.KillCooldown <= 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 25f;
|
||||
}
|
||||
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
if (__instance.Data.PlayerLevel != 0 && __instance.Data.PlayerLevel < Options.KickLowLevelPlayer.GetInt() && __instance.Data.ClientId != AmongUsClient.Instance.HostId)
|
||||
{
|
||||
if (!Options.TempBanLowLevelPlayer.GetBool())
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(__instance.Data.ClientId, false);
|
||||
Logger.Info($" {__instance.Data.PlayerName} was kicked for being under level {Options.KickLowLevelPlayer.GetInt()}", "KickLowLevelPlayer");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} was kicked for being under level {Options.KickLowLevelPlayer.GetInt()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(__instance.Data.ClientId, true);
|
||||
Logger.Info($" {__instance.Data.PlayerName} was banned for being under level {Options.KickLowLevelPlayer.GetInt()} ", "BanLowLevelPlayer");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} was banned for being under level {Options.KickLowLevelPlayer.GetInt()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Utils.InGame && !Utils.IsMeeting && !ExileController.Instance)
|
||||
{
|
||||
// 2 = Shift and Seek
|
||||
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && Options.CrewAutoWinsGameAfter.GetInt() != 0 && !Options.NoGameEnd.GetBool())
|
||||
{
|
||||
Main.GameTimer += Time.fixedDeltaTime;
|
||||
|
||||
{
|
||||
if (Main.GameTimer > Options.CrewAutoWinsGameAfter.GetInt())
|
||||
{
|
||||
Main.GameTimer = 0f;
|
||||
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write((byte)GameOverReason.ImpostorDisconnect);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
Utils.ContinueEndGame((byte)GameOverReason.CrewmatesByVote);
|
||||
Logger.Info($" Crewmates won because the game took longer than {Options.CrewAutoWinsGameAfter.GetInt()}s", "SNSManager");
|
||||
NormalGameEndChecker.LastWinReason = $"★ Crewmates win! (Timer)\n\nImpostors:\n" + string.Join("\n", NormalGameEndChecker.imps.Select(p => p.Data.PlayerName));
|
||||
}
|
||||
}
|
||||
// 3 = Speedrun
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek && Options.GameAutoEndsAfter.GetInt() != 0 && !Options.NoGameEnd.GetBool())
|
||||
{
|
||||
Main.GameTimer += Time.fixedDeltaTime;
|
||||
|
||||
{
|
||||
if (Main.GameTimer > Options.GameAutoEndsAfter.GetInt())
|
||||
{
|
||||
Main.GameTimer = 0f;
|
||||
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write((byte)GameOverReason.CrewmatesByVote);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
Utils.CustomWinnerEndGame(PlayerControl.LocalPlayer, 0);
|
||||
Logger.Info($" No one won because the game took longer than {Options.GameAutoEndsAfter.GetInt()}s", "SpeedrunManager");
|
||||
NormalGameEndChecker.LastWinReason = $"★ No one wins! (Timer)";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using AmongUs.Data;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))]
|
||||
internal class Hotkeys
|
||||
{
|
||||
public static void Postfix()
|
||||
{
|
||||
bool Shift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
|
||||
bool Enter = Input.GetKeyDown(KeyCode.Return);
|
||||
|
||||
if (Input.GetKey(KeyCode.L) && Shift && Enter)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write((byte)GameOverReason.ImpostorDisconnect);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.M) && Shift && Enter && Utils.InGame)
|
||||
{
|
||||
if (Utils.IsMeeting)
|
||||
{
|
||||
MeetingHud.Instance.RpcClose();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerControl.LocalPlayer.ReportDeadBody(PlayerControl.LocalPlayer.Data);
|
||||
}
|
||||
}
|
||||
|
||||
if (Shift && GameStartManager.InstanceExists && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
GameStartManager.Instance.countDownTimer = 0;
|
||||
}
|
||||
|
||||
if ((!AmongUsClient.Instance.IsGameStarted || !Utils.IsOnlineGame) && Utils.CanMove && PlayerControl.LocalPlayer.Collider != null)
|
||||
{
|
||||
PlayerControl.LocalPlayer.Collider.enabled = !Input.GetKey(KeyCode.LeftControl);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C) && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening && Utils.IsLobby)
|
||||
{
|
||||
Logger.Info("Resetted start countdown", "KeyCommand");
|
||||
GameStartManager.Instance.ResetStartState();
|
||||
Logger.SendInGame("Starting countdown canceled");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ namespace AmongUsRevamped
|
||||
|
||||
Children = new();
|
||||
|
||||
AllConfigEntries = new ConfigEntry<int>[10];
|
||||
AllConfigEntries = new ConfigEntry<int>[5];
|
||||
if (Id == 0)
|
||||
{
|
||||
singleEntry = Main.Instance.Config.Bind("Current Preset", id.ToString(), DefaultValue);
|
||||
@@ -80,7 +80,7 @@ namespace AmongUsRevamped
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 1; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
AllConfigEntries[i] = Main.Instance.Config.Bind($"Preset{i + 1}", id.ToString(), DefaultValue);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ namespace AmongUsRevamped
|
||||
|
||||
public static void SwitchPreset(int newPreset)
|
||||
{
|
||||
CurrentPreset = Math.Clamp(newPreset, 0, 1);
|
||||
CurrentPreset = Math.Clamp(newPreset, 0, 4);
|
||||
|
||||
foreach (var op in AllOptions)
|
||||
op.Refresh();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionItems/PresetOptionItem.cs
|
||||
|
||||
namespace AmongUsRevamped
|
||||
{
|
||||
public class PresetOptionItem : OptionItem
|
||||
{
|
||||
public IntegerValueRule Rule;
|
||||
|
||||
public PresetOptionItem(int defaultValue, TabGroup tab)
|
||||
: base(0, "Preset", defaultValue, tab, true)
|
||||
{
|
||||
Rule = (0, 4, 1);
|
||||
}
|
||||
public static PresetOptionItem Create(int defaultValue, TabGroup tab)
|
||||
{
|
||||
return new PresetOptionItem(defaultValue, tab);
|
||||
}
|
||||
|
||||
public override int GetInt() => Rule.GetValueByIndex(CurrentValue);
|
||||
public override float GetFloat() => Rule.GetValueByIndex(CurrentValue);
|
||||
public override string GetString()
|
||||
{
|
||||
return CurrentValue switch
|
||||
{
|
||||
0 => Main.Preset1.Value == (string)Main.Preset1.DefaultValue ? "Preset 1" : Main.Preset1.Value,
|
||||
1 => Main.Preset2.Value == (string)Main.Preset2.DefaultValue ? "Preset 2" : Main.Preset2.Value,
|
||||
2 => Main.Preset3.Value == (string)Main.Preset3.DefaultValue ? "Preset 3" : Main.Preset3.Value,
|
||||
3 => Main.Preset4.Value == (string)Main.Preset4.DefaultValue ? "Preset 4" : Main.Preset4.Value,
|
||||
4 => Main.Preset5.Value == (string)Main.Preset5.DefaultValue ? "Preset 5" : Main.Preset5.Value,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
public override int GetValue()
|
||||
=> Rule.RepeatIndex(base.GetValue());
|
||||
|
||||
public override void SetValue(int value)
|
||||
{
|
||||
base.SetValue(Rule.RepeatIndex(value));
|
||||
SwitchPreset(Rule.RepeatIndex(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
+67
-1
@@ -32,15 +32,17 @@ public static class Utils
|
||||
public static bool IsLobby => AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Joined;
|
||||
public static bool InGame => AmongUsClient.Instance && AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Started;
|
||||
public static bool isHideNSeek => GameOptionsManager.Instance.CurrentGameOptions.GameMode == GameModes.HideNSeek;
|
||||
public static bool IsOnlineGame => AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame;
|
||||
|
||||
public static bool IsShip => ShipStatus.Instance != null;
|
||||
public static bool IsCanMove => PlayerControl.LocalPlayer?.CanMove is true;
|
||||
public static bool CanMove => PlayerControl.LocalPlayer?.CanMove is true;
|
||||
public static bool IsDead => PlayerControl.LocalPlayer?.Data?.IsDead is true;
|
||||
|
||||
public static bool IsFreePlay => AmongUsClient.Instance.NetworkMode == NetworkModes.FreePlay;
|
||||
public static bool IsMeeting => InGame && (MeetingHud.Instance);
|
||||
public static bool GamePastRoleSelection => Main.GameTimer > 10f;
|
||||
public static bool HandlingGameEnd;
|
||||
public static byte CustomGameOverReason;
|
||||
|
||||
public static string ColorString(Color32 color, string str) => $"<#{color.r:x2}{color.g:x2}{color.b:x2}{color.a:x2}>{str}</color>";
|
||||
public static string ColorToHex(Color32 color) => $"#{color.r:x2}{color.g:x2}{color.b:x2}{color.a:x2}";
|
||||
@@ -339,4 +341,68 @@ public static class Utils
|
||||
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
// 0 = no winner. 1 = solo winner. 2 = add winner.
|
||||
public static void CustomWinnerEndGame(PlayerControl winner, int winnerType)
|
||||
{
|
||||
HandlingGameEnd = true;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
|
||||
if (winnerType == 0)
|
||||
{
|
||||
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
CustomGameOverReason = (byte)GameOverReason.ImpostorsByVote;
|
||||
pc.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (winnerType == 1)
|
||||
{
|
||||
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
CustomGameOverReason = (byte)GameOverReason.ImpostorsByVote;
|
||||
|
||||
if (pc != winner)
|
||||
{
|
||||
pc.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
pc.RpcSetRole(AmongUs.GameOptions.RoleTypes.ImpostorGhost, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
ContinueEndGame((byte)CustomGameOverReason);
|
||||
}, 1f, "CustomWinnerEndGame");
|
||||
}
|
||||
|
||||
public static void ContinueEndGame(byte gameOverReason)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write(gameOverReason);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
HandlingGameEnd = false;
|
||||
Logger.Info(" -------- GAME ENDED --------", "ManualEndGame");
|
||||
}
|
||||
|
||||
public static void DumpLog()
|
||||
{
|
||||
string f = $"{Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}/AUR-logs/";
|
||||
string t = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss");
|
||||
string filename = $"{f}AUR-{Main.ModVersion}-{t}.log";
|
||||
if (!Directory.Exists(f)) Directory.CreateDirectory(f);
|
||||
FileInfo file = new(@$"{Environment.CurrentDirectory}/BepInEx/LogOutput.log");
|
||||
file.CopyTo(@filename);
|
||||
|
||||
if (PlayerControl.LocalPlayer != null)
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"/Dump command activated\n\nFile: AUR-{Main.ModVersion}-{t}");
|
||||
ProcessStartInfo psi = new("Explorer.exe") { Arguments = "/e,/select," + @filename.Replace("/", "\\") };
|
||||
Process.Start(psi);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -17,8 +17,8 @@ public static class Zoom
|
||||
public static void Postfix()
|
||||
{
|
||||
bool canZoom =
|
||||
(Utils.IsShip && !Utils.IsMeeting && Utils.IsCanMove && PlayerControl.LocalPlayer.Data.IsDead)
|
||||
|| (Utils.IsLobby && Utils.IsCanMove);
|
||||
(Utils.IsShip && !Utils.IsMeeting && Utils.CanMove && PlayerControl.LocalPlayer.Data.IsDead)
|
||||
|| (Utils.IsLobby && Utils.CanMove);
|
||||
|
||||
if (!canZoom)
|
||||
{
|
||||
|
||||
+98
-4
@@ -2,6 +2,8 @@
|
||||
using InnerNet;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
// https://github.com/SuperNewRoles/SuperNewRoles/blob/master/SuperNewRoles/Patches/LobbyBehaviourPatch.cs
|
||||
namespace AmongUsRevamped;
|
||||
@@ -15,11 +17,38 @@ internal static class ChatControllerUpdatePatch
|
||||
if (Main.DarkTheme.Value)
|
||||
{
|
||||
__instance.freeChatField.background.color = new Color32(40, 40, 40, byte.MaxValue);
|
||||
__instance.freeChatField.textArea.compoText.Color(Color.white);
|
||||
__instance.freeChatField.textArea.outputText.color = Color.white;
|
||||
|
||||
__instance.quickChatField.background.color = new Color32(40, 40, 40, byte.MaxValue);
|
||||
__instance.quickChatField.text.color = Color.white;
|
||||
}
|
||||
else __instance.freeChatField.textArea.outputText.color = Color.black;
|
||||
else
|
||||
{
|
||||
__instance.freeChatField.background.color = Color.white;
|
||||
__instance.freeChatField.textArea.compoText.Color(Color.black);
|
||||
__instance.freeChatField.textArea.outputText.color = Color.black;
|
||||
|
||||
__instance.quickChatField.background.color = Color.white;
|
||||
__instance.quickChatField.text.color = Color.black;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ChatBubble), nameof(ChatBubble.SetName))]
|
||||
internal static class ChatBubbleSetNamePatch
|
||||
{
|
||||
public static void Postfix(ChatBubble __instance, [HarmonyArgument(2)] bool voted)
|
||||
{
|
||||
PlayerControl seer = PlayerControl.LocalPlayer;
|
||||
PlayerControl target = __instance.playerInfo.Object;
|
||||
|
||||
if (Main.DarkTheme.Value)
|
||||
{
|
||||
__instance.Background.color = new(0.1f, 0.1f, 0.1f, 1f);
|
||||
__instance.TextArea.color = Color.white;
|
||||
if (__instance.playerInfo.Object.Data.IsDead && Utils.InGame) __instance.Background.color = new(0.1f, 0.1f, 0.1f, 0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +68,15 @@ internal static class SendChatPatch
|
||||
{
|
||||
string text = __instance.freeChatField.textArea.text.Trim();
|
||||
|
||||
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat) return false;
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (text == "/dump")
|
||||
{
|
||||
Utils.DumpLog();
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
{
|
||||
@@ -49,6 +86,8 @@ internal static class SendChatPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat) return false;
|
||||
|
||||
if (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
|
||||
{
|
||||
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason) || Utils.InGame) return false;
|
||||
@@ -100,9 +139,28 @@ internal static class SendChatPatch
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
if (col1 || col2 || col3)
|
||||
{
|
||||
string argCol = text.Substring(col1 ? 5 : col2 ? 7 : col3 ? 8 : 0).Trim();
|
||||
|
||||
if (Utils.TryGetColorId(argCol, out byte colId) && (col1 || col2 || col3))
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetColor(colId);
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
bool isKick = text.StartsWith("/kick ");
|
||||
bool isBan = text.StartsWith("/ban ");
|
||||
|
||||
@@ -170,10 +228,9 @@ public static class RPCHandlerPatch
|
||||
string text = subReader.ReadString();
|
||||
Logger.Info($" {__instance.Data.PlayerName}: {text}", "SendChat");
|
||||
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
OnGameJoinedPatch.WaitingForChat = true;
|
||||
|
||||
new LateTask(() =>
|
||||
@@ -194,26 +251,31 @@ public static class RPCHandlerPatch
|
||||
|
||||
if (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason) || Utils.InGame) return;
|
||||
Utils.ModeratorChatCommand($"{NormalGameEndChecker.LastWinReason}", "", false);
|
||||
}
|
||||
|
||||
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.noKcdMode}", "", false);
|
||||
}
|
||||
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.SnSModeOne}", $"{SendChatPatch.SnSModeTwo}", true);
|
||||
}
|
||||
|
||||
if (text == "/sp" || text == "/sr" || text == "/speedrun")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.speedrunMode}", "", false);
|
||||
}
|
||||
|
||||
if (text == "/r" || text == "/roles" || text == "/gamemode" || text == "/gm")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
switch (Options.Gamemode.GetValue())
|
||||
{
|
||||
case 0:
|
||||
@@ -234,8 +296,27 @@ public static class RPCHandlerPatch
|
||||
}
|
||||
}
|
||||
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
if ((col1 || col2 || col3) && !Utils.InGame)
|
||||
{
|
||||
string argCol = text.Substring(col1 ? 5 : col2 ? 7 : col3 ? 8 : 0).Trim();
|
||||
|
||||
if (Utils.TryGetColorId(argCol, out byte colId))
|
||||
{
|
||||
if (Options.ColorCommandLevel.GetValue() == 0 && Utils.IsPlayerModerator(__instance.Data.FriendCode) || Options.ColorCommandLevel.GetValue() == 1)
|
||||
{
|
||||
if (colId > 17 && !Options.AllowFortegreen.GetBool()) return;
|
||||
__instance.RpcSetColor(colId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode)) return;
|
||||
// Banning works by name and color. Commands are seperated incase someone has a color as their name
|
||||
bool isKick = text.StartsWith("/kick ");
|
||||
bool isBan = text.StartsWith("/ban ");
|
||||
@@ -284,4 +365,17 @@ public static class RPCHandlerPatch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))]
|
||||
public static class HudManager_Update
|
||||
{
|
||||
public static void Postfix(HudManager __instance)
|
||||
{
|
||||
if (Main.GM.Value)
|
||||
{
|
||||
__instance.Chat.gameObject.SetActive(true);
|
||||
__instance.MapButton.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+65
-16
@@ -67,22 +67,6 @@ namespace AmongUsRevamped
|
||||
{
|
||||
ErrorText.Instance.AddError(ErrorCode.Main_DictionaryError);
|
||||
}
|
||||
|
||||
GameObject t = GameObject.Find("Tint");
|
||||
if (t != null)
|
||||
{
|
||||
t.SetActive(false);
|
||||
}
|
||||
GameObject b = GameObject.Find("BackgroundTexture");
|
||||
if (b != null)
|
||||
{
|
||||
b.SetActive(false);
|
||||
}
|
||||
GameObject w = GameObject.Find("WindowShine");
|
||||
if (w != null)
|
||||
{
|
||||
w.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,4 +166,69 @@ namespace AmongUsRevamped
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/3X3CODE/MainMenuEnhanced/blob/main/MainMenuEnhanced/VisualPatch.cs
|
||||
[HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))]
|
||||
public static class MainMenuManagerStartPatch
|
||||
{
|
||||
public static void Postfix(MainMenuManager __instance)
|
||||
{
|
||||
if (__instance == null) return;
|
||||
|
||||
var bg = GameObject.Find("BackgroundTexture");
|
||||
if (bg != null)
|
||||
{
|
||||
bg.SetActive(false);
|
||||
}
|
||||
|
||||
Transform tintTrans = __instance.transform.Find("MainUI/Tint");
|
||||
var tint = tintTrans.gameObject;
|
||||
if (tint != null)
|
||||
{
|
||||
tint.SetActive(false);
|
||||
}
|
||||
|
||||
DisableObject("WindowShine");
|
||||
DisableComponent("RightPanel");
|
||||
DisableComponent("MaskedBlackScreen");
|
||||
|
||||
Transform playTransform = __instance.transform.Find("MainUI/AspectScaler/LeftPanel/Main Buttons/PlayButton/FontPlacer/Text_TMP");
|
||||
if (playTransform != null)
|
||||
{
|
||||
var playbutton = playTransform.gameObject;
|
||||
if (playbutton != null)
|
||||
{
|
||||
if (playbutton.TryGetComponent<TextTranslatorTMP>(out var tmp))
|
||||
{
|
||||
tmp.enabled = false;
|
||||
}
|
||||
if (playbutton.TryGetComponent<TextMeshPro>(out var text))
|
||||
{
|
||||
text.text = "Start";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DisableObject(string name)
|
||||
{
|
||||
var obj = GameObject.Find(name);
|
||||
if (obj != null)
|
||||
{
|
||||
obj.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
static void DisableComponent(string name)
|
||||
{
|
||||
var obj = GameObject.Find(name);
|
||||
if (obj != null)
|
||||
{
|
||||
if (obj.TryGetComponent<SpriteRenderer>(out var renderer))
|
||||
{
|
||||
renderer.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,11 +50,12 @@ class NormalGameEndChecker
|
||||
{
|
||||
LastWinReason = $"★ Crewmates win! (Tasks)\n\nImpostors:\n" + string.Join("\n", imps.Select(p => p.Data.PlayerName));
|
||||
}
|
||||
else
|
||||
else if (Options.Gamemode.GetValue() < 2)
|
||||
{
|
||||
LastWinReason = $"★ Impostors win! (Sabotage)\n\nImpostors:\n★" + string.Join("\n★", imps.Select(p => p.Data.PlayerName));
|
||||
}
|
||||
|
||||
Logger.Info(" -------- GAME ENDED --------", "EndGame");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -67,28 +68,4 @@ class HNSGameEndChecker
|
||||
if (Options.NoGameEnd.GetBool()) return false;
|
||||
else return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))]
|
||||
internal class ControllerManagerUpdatePatch
|
||||
{
|
||||
public static void Postfix()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.L) && Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write((byte)GameOverReason.ImpostorDisconnect);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.M) && Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Return) && Utils.InGame)
|
||||
{
|
||||
if (Utils.IsMeeting)
|
||||
{
|
||||
MeetingHud.Instance.RpcClose();
|
||||
}
|
||||
else
|
||||
PlayerControl.LocalPlayer.ReportDeadBody(PlayerControl.LocalPlayer.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,6 +290,16 @@ namespace AmongUsRevamped
|
||||
Index = stringItem.GetInt(),
|
||||
};
|
||||
}
|
||||
else if (item is PresetOptionItem)
|
||||
{
|
||||
PresetOptionItem presetItem = item as PresetOptionItem;
|
||||
baseGameSetting = new StringGameSetting
|
||||
{
|
||||
Type = OptionTypes.String,
|
||||
Values = new StringNames[5],
|
||||
Index = presetItem.GetInt(),
|
||||
};
|
||||
}
|
||||
if (baseGameSetting != null)
|
||||
baseGameSetting.Title = StringNames.Accept;
|
||||
return baseGameSetting;
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Update))]
|
||||
public static class GameStartManagerUpdatePatch
|
||||
{
|
||||
public static bool CustomTimerApplied;
|
||||
public static bool Autostarting;
|
||||
|
||||
public static void Prefix(GameStartManager __instance)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || AmongUsClient.Instance == null) return;
|
||||
@@ -13,9 +18,84 @@ public static class GameStartManagerUpdatePatch
|
||||
|
||||
if (Main.AutoStart.Value && OnGameJoinedPatch.AutoStartCheck && GameStartManager.InstanceExists && GameStartManager.Instance.startState != GameStartManager.StartingStates.Countdown && GameData.Instance?.PlayerCount >= Options.PlayerAutoStart.GetInt())
|
||||
{
|
||||
GameStartManager.Instance.startState = GameStartManager.StartingStates.Countdown;
|
||||
GameStartManager.Instance.countDownTimer = Options.AutoStartTimer.GetFloat();
|
||||
GameStartManager.Instance?.StartButton.gameObject.SetActive(false);
|
||||
GameStartManager.Instance.startState = GameStartManager.StartingStates.Countdown;
|
||||
GameStartManager.Instance.countDownTimer = Options.AutoStartTimer.GetFloat();
|
||||
GameStartManager.Instance?.StartButton.gameObject.SetActive(false);
|
||||
Autostarting = true;
|
||||
}
|
||||
|
||||
if (__instance.startState == GameStartManager.StartingStates.Countdown && !CustomTimerApplied && !Autostarting)
|
||||
{
|
||||
__instance.countDownTimer = Options.StartCountdown.GetInt();
|
||||
CustomTimerApplied = true;
|
||||
|
||||
}
|
||||
|
||||
if (__instance.startState != GameStartManager.StartingStates.Countdown)
|
||||
{
|
||||
Autostarting = false;
|
||||
CustomTimerApplied = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void Postfix(GameStartManager __instance)
|
||||
{
|
||||
string warningMessage = "";
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (warningMessage == "")
|
||||
{
|
||||
GameStartManagerStartPatch.warningText.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameStartManagerStartPatch.warningText.text = warningMessage;
|
||||
GameStartManagerStartPatch.warningText.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
__instance.GameStartText.transform.localPosition = new Vector3(__instance.GameStartText.transform.localPosition.x, 2f, __instance.GameStartText.transform.localPosition.z);
|
||||
GameStartManagerStartPatch.cancelButton.gameObject.SetActive(__instance.startState == GameStartManager.StartingStates.Countdown);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Start))]
|
||||
public class GameStartManagerStartPatch
|
||||
{
|
||||
public static TextMeshPro warningText;
|
||||
private static Vector3 GameStartTextlocalPosition;
|
||||
public static PassiveButton cancelButton;
|
||||
|
||||
public static void Postfix(GameStartManager __instance)
|
||||
{
|
||||
warningText = UnityEngine.Object.Instantiate(__instance.GameStartText, __instance.transform.parent);
|
||||
warningText.name = "WarningText";
|
||||
warningText.transform.localPosition = new(0f, __instance.transform.localPosition.y + 3f, -1f);
|
||||
warningText.gameObject.SetActive(false);
|
||||
|
||||
cancelButton = UnityEngine.Object.Instantiate(__instance.StartButton, __instance.transform);
|
||||
cancelButton.name = "CancelButton";
|
||||
var cancelLabel = cancelButton.buttonText;
|
||||
cancelLabel.DestroyTranslator();
|
||||
cancelLabel.text = "Cancel";
|
||||
//cancelButton.transform.localScale = new(0.5f, 0.5f, 1f);
|
||||
var cancelButtonInactiveRenderer = cancelButton.inactiveSprites.GetComponent<SpriteRenderer>();
|
||||
cancelButtonInactiveRenderer.color = new(0.8f, 0f, 0f, 1f);
|
||||
var cancelButtonActiveRenderer = cancelButton.activeSprites.GetComponent<SpriteRenderer>();
|
||||
cancelButtonActiveRenderer.color = Color.red;
|
||||
var cancelButtonInactiveShine = cancelButton.inactiveSprites.transform.Find("Shine");
|
||||
if (cancelButtonInactiveShine)
|
||||
{
|
||||
cancelButtonInactiveShine.gameObject.SetActive(false);
|
||||
}
|
||||
cancelButton.activeTextColor = cancelButton.inactiveTextColor = Color.white;
|
||||
//cancelButton.transform.localPosition = new(2f, 0.13f, 0f);
|
||||
GameStartTextlocalPosition = __instance.GameStartText.transform.localPosition;
|
||||
cancelButton.OnClick = new();
|
||||
cancelButton.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
|
||||
{
|
||||
__instance.ResetStartState();
|
||||
}));
|
||||
cancelButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,22 @@ internal class ApplyCustomImpostorCount
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
Logger.Info(" -------- GAME STARTED --------", "StartGame");
|
||||
|
||||
NormalGameEndChecker.imps.Clear();
|
||||
NormalGameEndChecker.LastWinReason = "";
|
||||
|
||||
if (Main.GM.Value)
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
|
||||
if (Options.Gamemode.GetValue() == 3)
|
||||
{
|
||||
PlayerControl.LocalPlayer.CoSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
|
||||
}
|
||||
|
||||
PlayerControl.LocalPlayer.myTasks.Clear();
|
||||
}
|
||||
|
||||
@@ -24,17 +34,14 @@ internal class ApplyCustomImpostorCount
|
||||
{
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Crewmate, false);
|
||||
|
||||
new LateTask(() =>
|
||||
if (p != PlayerControl.LocalPlayer)
|
||||
{
|
||||
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Crewmate, false);
|
||||
}, 5f, "Speedrun Secondary RPCSetRole");
|
||||
|
||||
new LateTask(() =>
|
||||
}
|
||||
if (p == PlayerControl.LocalPlayer)
|
||||
{
|
||||
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Crewmate, false);
|
||||
}, 9f, "Speedrun Tertiary RPCSetRole");
|
||||
p.CoSetRole(AmongUs.GameOptions.RoleTypes.Crewmate, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,96 +6,6 @@ using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))]
|
||||
class FixedUpdateInGamePatch
|
||||
{
|
||||
public static readonly HashSet<byte> ProcessedModerators = new HashSet<byte>();
|
||||
|
||||
public static void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (__instance == null || __instance.PlayerId == 255) return;
|
||||
|
||||
if (Utils.IsPlayerModerator(__instance.Data.FriendCode) && !ProcessedModerators.Contains(__instance.PlayerId))
|
||||
{
|
||||
__instance.SetName($"★{__instance.Data.PlayerName}★");
|
||||
ProcessedModerators.Add(__instance.PlayerId);
|
||||
}
|
||||
|
||||
GameObject g = GameObject.Find("GameSettingsLabel");
|
||||
|
||||
// 0Kc
|
||||
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 0.01f;
|
||||
|
||||
if (Options.NoKcdSettingsOverride.GetBool() && g == null)
|
||||
{
|
||||
Main.NormalOptions.EmergencyCooldown = 0;
|
||||
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// SnS
|
||||
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 2.5f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 2.5f;
|
||||
|
||||
if (Options.SNSSettingsOverride.GetBool() && g == null)
|
||||
{
|
||||
Main.NormalOptions.NumEmergencyMeetings = 0;
|
||||
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Speedrun
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek && g == null)
|
||||
{
|
||||
Main.NormalOptions.NumEmergencyMeetings = 0;
|
||||
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
|
||||
if (__instance.AllTasksCompleted() && Utils.InGame && Utils.GamePastRoleSelection && !Utils.HandlingGameEnd)
|
||||
{
|
||||
Utils.HandlingGameEnd = true;
|
||||
__instance.RpcSetRole(AmongUs.GameOptions.RoleTypes.ImpostorGhost, false);
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
NormalGameEndChecker.LastWinReason = $"★ {__instance.Data.PlayerName} Wins! (Completed tasks first)";
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write((byte)GameOverReason.ImpostorsByVote);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
}, 1f, "SpeedrunSetWinner");
|
||||
}
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() == 0 && Main.NormalOptions.KillCooldown <= 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 25f;
|
||||
}
|
||||
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
if (__instance.Data.PlayerLevel != 0 && __instance.Data.PlayerLevel < Options.KickLowLevelPlayer.GetInt() && __instance.Data.ClientId != AmongUsClient.Instance.HostId)
|
||||
{
|
||||
if (!Options.TempBanLowLevelPlayer.GetBool())
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(__instance.Data.ClientId, false);
|
||||
Logger.Info($" {__instance.Data.PlayerName} was kicked for being under level {Options.KickLowLevelPlayer.GetInt()}", "KickLowLevelPlayer");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} was kicked for being under level {Options.KickLowLevelPlayer.GetInt()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(__instance.Data.ClientId, true);
|
||||
Logger.Info($" {__instance.Data.PlayerName} was banned for being under level {Options.KickLowLevelPlayer.GetInt()} ", "BanLowLevelPlayer");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} was banned for being under level {Options.KickLowLevelPlayer.GetInt()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.ReportDeadBody))]
|
||||
class ReportDeadBodyPatch
|
||||
@@ -104,7 +14,7 @@ class ReportDeadBodyPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (Options.DisableReport.GetBool() && target != null || Options.Gamemode.GetValue() == 2)
|
||||
if (Options.DisableReport.GetBool() && target != null || Options.Gamemode.GetValue() == 2 || Options.Gamemode.GetValue() == 3)
|
||||
{
|
||||
Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch");
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user