mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-22 07:36:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48eb09f448 | ||
|
|
6842f3d516 | ||
|
|
30c436f80b | ||
|
|
7c0be8b4bb |
No files matched your search
+42
-2
@@ -19,6 +19,17 @@ 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<string> Preset6 { get; private set; }
|
||||
public static ConfigEntry<string> Preset7 { get; private set; }
|
||||
public static ConfigEntry<string> Preset8 { get; private set; }
|
||||
public static ConfigEntry<string> Preset9 { get; private set; }
|
||||
public static ConfigEntry<string> Preset10 { 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 +40,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.0";
|
||||
public const string ModVersion = "v1.3.0";
|
||||
|
||||
public static float GameTimer;
|
||||
|
||||
@@ -62,6 +73,17 @@ 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");
|
||||
Preset6 = Config.Bind("Preset Name Options", "Preset6", "Preset 6");
|
||||
Preset7 = Config.Bind("Preset Name Options", "Preset7", "Preset 7");
|
||||
Preset8 = Config.Bind("Preset Name Options", "Preset8", "Preset 8");
|
||||
Preset9 = Config.Bind("Preset Name Options", "Preset9", "Preset 9");
|
||||
Preset10 = Config.Bind("Preset Name Options", "Preset10", "Preset 10");
|
||||
|
||||
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,6 +125,24 @@ 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
|
||||
public enum BasicNumberToLetter
|
||||
{
|
||||
Zero = 0,
|
||||
One = 1,
|
||||
Two = 2,
|
||||
Three = 3,
|
||||
Four = 4,
|
||||
Five = 5,
|
||||
Six = 6,
|
||||
Seven = 7,
|
||||
Eight = 8,
|
||||
Nine = 9,
|
||||
Ten = 10
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,26 @@ 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, Main.Preset6.Value,
|
||||
Main.Preset7.Value, Main.Preset8.Value, Main.Preset9.Value,
|
||||
Main.Preset10.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;
|
||||
|
||||
@@ -40,6 +55,7 @@ namespace AmongUsRevamped
|
||||
public static OptionItem ApplyBanList;
|
||||
public static OptionItem ApplyDenyNameList;
|
||||
public static OptionItem ApplyModeratorList;
|
||||
public static OptionItem ModeratorCanUseCommand;
|
||||
|
||||
public static OptionItem TabGroupAutomation;
|
||||
|
||||
@@ -49,6 +65,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
|
||||
@@ -189,6 +210,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);
|
||||
@@ -208,6 +233,7 @@ namespace AmongUsRevamped
|
||||
ApplyBanList = BooleanOptionItem.Create(60110, "Apply BanList", true, TabGroup.SystemSettings, true);
|
||||
ApplyDenyNameList = BooleanOptionItem.Create(60120, "Apply DenyName List", true, TabGroup.SystemSettings, false);
|
||||
ApplyModeratorList = BooleanOptionItem.Create(60121, "Apply Moderator List", true, TabGroup.SystemSettings, false);
|
||||
ModeratorCanUseCommand = BooleanOptionItem.Create(60122, "Moderators can use commands", true, TabGroup.SystemSettings, false);
|
||||
|
||||
TabGroupAutomation = TextOptionItem.Create(60149, "Automation", TabGroup.SystemSettings)
|
||||
.SetColor(Color.yellow);
|
||||
@@ -220,9 +246,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)
|
||||
@@ -240,7 +272,7 @@ namespace AmongUsRevamped
|
||||
SNSSettingsOverride = BooleanOptionItem.Create(70051, "Auto Update Settings", true, TabGroup.GamemodeSettings, false);
|
||||
CantKillTime = IntegerOptionItem.Create(70053, "After Misfiring, Can't kill for", new(0, 60, 5), 20, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
MisfiresToSuicide = IntegerOptionItem.Create(70052, "Suicide After Amount Of Misfires", new(1, 15, 1), 2, TabGroup.GamemodeSettings, false);
|
||||
MisfiresToSuicide = IntegerOptionItem.Create(70052, "Suicide After Amount Of Misfires", new(1, 10, 1), 2, TabGroup.GamemodeSettings, false);
|
||||
CrewAutoWinsGameAfter = IntegerOptionItem.Create(70054, "Crewmates Automatically Win After", new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
|
||||
+85
-7
@@ -22,8 +22,90 @@ 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.NumEmergencyMeetings = 0;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -36,9 +118,7 @@ public static class FixedUpdate
|
||||
{
|
||||
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));
|
||||
}
|
||||
@@ -52,9 +132,7 @@ public static class FixedUpdate
|
||||
{
|
||||
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,45 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ namespace AmongUsRevamped
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 1; i++)
|
||||
for (int i = 0; i < 10; 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, 9);
|
||||
|
||||
foreach (var op in AllOptions)
|
||||
op.Refresh();
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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, 9, 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,
|
||||
5 => Main.Preset6.Value == (string)Main.Preset6.DefaultValue ? "Preset 6" : Main.Preset6.Value,
|
||||
6 => Main.Preset7.Value == (string)Main.Preset7.DefaultValue ? "Preset 7" : Main.Preset7.Value,
|
||||
7 => Main.Preset8.Value == (string)Main.Preset8.DefaultValue ? "Preset 8" : Main.Preset8.Value,
|
||||
8 => Main.Preset9.Value == (string)Main.Preset9.DefaultValue ? "Preset 9" : Main.Preset9.Value,
|
||||
9 => Main.Preset10.Value == (string)Main.Preset10.DefaultValue ? "Preset 10" : Main.Preset10.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
+133
-2
@@ -27,20 +27,22 @@ public static class Utils
|
||||
|
||||
public static int allAlivePlayersCount => AllAlivePlayerControls.Count();
|
||||
public static int AliveCrewmates => AllAlivePlayerControls.Count(pc => !pc.Data.Role.IsImpostor);
|
||||
public static int AliveImpostors => AllAlivePlayerControls.Count(pc => pc.Data.Role.IsImpostor);
|
||||
public static int AliveImpostors => AllAlivePlayerControls.Count(pc => pc.Data.Role.IsImpostor || pc.isNew);
|
||||
|
||||
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}";
|
||||
@@ -256,4 +258,133 @@ public static class Utils
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void SendPrivateMessage(PlayerControl target, string message)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || PlayerControl.LocalPlayer == null || target == null || target.Data.ClientId == 255) return;
|
||||
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, 13, SendOption.Reliable, target.Data.ClientId);
|
||||
|
||||
writer.Write(message);
|
||||
writer.Write(PlayerControl.LocalPlayer.PlayerId);
|
||||
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
|
||||
}
|
||||
|
||||
public static void ChatCommand(ChatController __instance, string msg, string msg2, bool multi)
|
||||
{
|
||||
OnGameJoinedPatch.WaitingForChat = true;
|
||||
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{msg}");
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
if (multi && msg2 != "")
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{msg2}");
|
||||
}
|
||||
|
||||
if (!multi)
|
||||
{
|
||||
OnGameJoinedPatch.WaitingForChat = false;
|
||||
}
|
||||
}, 2.2f, "ChatCommand1");
|
||||
|
||||
if (!multi || msg2 == "") return;
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
OnGameJoinedPatch.WaitingForChat = false;
|
||||
}, 4.4f, "ChatCommand2");
|
||||
}
|
||||
|
||||
public static void ModeratorChatCommand(string msg, string msg2, bool multi)
|
||||
{
|
||||
OnGameJoinedPatch.WaitingForChat = true;
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{msg}");
|
||||
}, 2.2f, "ModeratorChatCommand1");
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
if (multi && msg2 != "")
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{msg2}");
|
||||
}
|
||||
|
||||
if (!multi)
|
||||
{
|
||||
OnGameJoinedPatch.WaitingForChat = false;
|
||||
}
|
||||
}, 4.4f, "ModeratorChatCommand2");
|
||||
|
||||
if (!multi || msg2 == "") return;
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
OnGameJoinedPatch.WaitingForChat = false;
|
||||
}, 6.6f, "ModeratorChatCommand3");
|
||||
}
|
||||
|
||||
public static string BasicIntToWord(int value)
|
||||
{
|
||||
if (Enum.IsDefined(typeof(Main.BasicNumberToLetter), value))
|
||||
{
|
||||
return ((Main.BasicNumberToLetter)value).ToString();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
+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)
|
||||
{
|
||||
|
||||
+176
-84
@@ -26,62 +26,53 @@ internal static class ChatControllerUpdatePatch
|
||||
[HarmonyPatch(typeof(ChatController), nameof(ChatController.SendChat))]
|
||||
internal static class SendChatPatch
|
||||
{
|
||||
public static string noKcdMode = "0 Kill Cooldown:\n\nImpostors have no kill cooldown, Crewmates have low tasks\nThink fast and pay attention!";
|
||||
public static string SnSModeOne = "Shift and Seek:\n\nImpostors can only kill someone while shapeshifted as them\nSabotages & Meetings = Off";
|
||||
public static string SnSModeTwo = $"Crew wins by tasks/surviving {Options.CrewAutoWinsGameAfter.GetInt()}s\nImp wins by killing\nOne wrong kill = Can't kill for {Options.CantKillTime.GetInt()}s\n{Utils.BasicIntToWord(Options.MisfiresToSuicide.GetInt())} wrong kills = suicide";
|
||||
public static string speedrunMode = $"Speedrun:\n\nEveryone is a crewmate The 1st player to finish tasks wins the game Game auto ends after {Options.GameAutoEndsAfter.GetInt()}s";
|
||||
|
||||
public static string allCommandsFull = "Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info\n/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color";
|
||||
public static string allCommandsOne = "Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info";
|
||||
public static string allCommandsTwo = "/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color";
|
||||
|
||||
public static bool Prefix(ChatController __instance)
|
||||
{
|
||||
string text = __instance.freeChatField.textArea.text.Trim();
|
||||
string noKcdMode = "0 Kill Cooldown Mode:\n\nImpostors have no kill cooldown, Crewmates have low tasks.\nThink fast and pay attention.";
|
||||
string SnSModeOne = "Shift and Seek Mode:\n\nImps can only kill someone while shapeshifted as them.\nSabotages & Meetings = Off.";
|
||||
string SnSModeTwo = $"Crew wins by tasks/surviving {Options.CrewAutoWinsGameAfter.GetInt()}s.\nImp wins by killing Crew.\n1 Wrong kill = Can't kill for {Options.CantKillTime.GetInt()}s.\n{Options.MisfiresToSuicide.GetInt()} Wrong kills = suicide.";
|
||||
string speedrunMode = $"Speedrun Mode:\n\nEveryone is a crewmate. The 1st player to finish tasks wins the game. Game auto ends after {Options.GameAutoEndsAfter.GetInt()}s";
|
||||
|
||||
if (text == "/h" || text == "/help")
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
{
|
||||
// PlayerControl.LocalPlayer.SendChat("All AUR commands:\n/0kc - Sends the 0 Kill Cooldown gamemode description to everyone");
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{allCommandsFull}");
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat) return false;
|
||||
|
||||
if (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
|
||||
{
|
||||
Utils.ShowLastResult();
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason) || Utils.InGame) return false;
|
||||
Utils.ChatCommand(__instance, $"{NormalGameEndChecker.LastWinReason}", "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{noKcdMode}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
Utils.ChatCommand(__instance, $"{noKcdMode}", "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{SnSModeOne}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
if (!Utils.IsLobby) return;
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{SnSModeTwo}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
}, 2.2f, "SNSTutorial2");
|
||||
Utils.ChatCommand(__instance, $"{SnSModeOne}", $"{SnSModeTwo}", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/sp" || text == "/sr" || text == "/speedrun")
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{speedrunMode}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
Utils.ChatCommand(__instance, $"{speedrunMode}", "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -90,37 +81,22 @@ internal static class SendChatPatch
|
||||
switch (Options.Gamemode.GetValue())
|
||||
{
|
||||
case 0:
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"Custom roles:\nThere are no custom roles.");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"Custom roles:\nThere are no custom roles.");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{noKcdMode}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
Utils.ChatCommand(__instance, $"{noKcdMode}", "", false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{SnSModeOne}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{SnSModeTwo}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
}, 2.2f, "SNSTutorial2");
|
||||
Utils.ChatCommand(__instance, $"{SnSModeOne}", $"{SnSModeTwo}", true);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{speedrunMode}");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
Utils.ChatCommand(__instance, $"{speedrunMode}", "", false);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -129,6 +105,20 @@ internal static class SendChatPatch
|
||||
|
||||
else
|
||||
{
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
string argCol = text.Substring(col1 ? 5 : col2 ? 7 : col3 ? 8 : 0).Trim();
|
||||
|
||||
if (Utils.TryGetColorId(argCol, out byte colId))
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetColor(colId);
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
}
|
||||
|
||||
bool isKick = text.StartsWith("/kick ");
|
||||
bool isBan = text.StartsWith("/ban ");
|
||||
|
||||
@@ -193,54 +183,156 @@ public static class RPCHandlerPatch
|
||||
{
|
||||
case RpcCalls.SendChat:
|
||||
{
|
||||
string chatText = subReader.ReadString();
|
||||
Logger.Info($" {__instance.Data.PlayerName}: {chatText}", "SendChat");
|
||||
string text = subReader.ReadString();
|
||||
Logger.Info($" {__instance.Data.PlayerName}: {text}", "SendChat");
|
||||
|
||||
// Banning works by name and color. Commands are seperated incase someone has a color as their name
|
||||
bool isKick = chatText.StartsWith("/kick ");
|
||||
bool isBan = chatText.StartsWith("/ban ");
|
||||
|
||||
bool isColorKick = chatText.StartsWith("/ckick ");
|
||||
bool isColorBan = chatText.StartsWith("/cban ");
|
||||
|
||||
bool banLog = isBan || isColorBan;
|
||||
|
||||
if (!isKick && !isBan && !isColorKick && !isColorBan) return;
|
||||
|
||||
if (Utils.IsPlayerModerator(__instance.Data.FriendCode))
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
{
|
||||
string arg = chatText.Substring(isKick ? 6 : isBan ? 5 : isColorKick ? 7 : isColorBan ? 6 : 0).Trim();
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
OnGameJoinedPatch.WaitingForChat = true;
|
||||
|
||||
PlayerControl target = null;
|
||||
|
||||
foreach (PlayerControl p in PlayerControl.AllPlayerControls)
|
||||
new LateTask(() =>
|
||||
{
|
||||
if (p.Data == null || p == PlayerControl.LocalPlayer || Utils.IsPlayerModerator(p.Data.FriendCode)) continue;
|
||||
Utils.SendPrivateMessage(__instance, $"{SendChatPatch.allCommandsOne}");
|
||||
}, 2.2f, "MHP1");
|
||||
|
||||
if ((isKick || isBan) && p.Data.PlayerName.Equals(arg, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
new LateTask(() =>
|
||||
{
|
||||
Utils.SendPrivateMessage(__instance, $"{SendChatPatch.allCommandsTwo}");
|
||||
}, 4.4f, "MHP2");
|
||||
|
||||
if ((isColorKick || isColorBan) && Utils.TryGetColorId(arg, out byte colorId))
|
||||
new LateTask(() =>
|
||||
{
|
||||
OnGameJoinedPatch.WaitingForChat = false;
|
||||
}, 6.6f, "MHP3");
|
||||
}
|
||||
|
||||
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:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.noKcdMode}", "", false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.SnSModeOne}", $"{SendChatPatch.SnSModeTwo}", true);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.speedrunMode}", "", false);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
|
||||
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 (p.Data.DefaultOutfit.ColorId == colorId)
|
||||
if (colId > 17 && !Options.AllowFortegreen.GetBool()) return;
|
||||
__instance.RpcSetColor(colId);
|
||||
}
|
||||
}
|
||||
|
||||
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 ");
|
||||
|
||||
bool isColorKick = text.StartsWith("/ckick ");
|
||||
bool isColorBan = text.StartsWith("/cban ");
|
||||
|
||||
bool banLog = isBan || isColorBan;
|
||||
|
||||
if (!isKick && !isBan && !isColorKick && !isColorBan) return;
|
||||
|
||||
if (Utils.IsPlayerModerator(__instance.Data.FriendCode))
|
||||
{
|
||||
string arg = text.Substring(isKick ? 6 : isBan ? 5 : isColorKick ? 7 : isColorBan ? 6 : 0).Trim();
|
||||
|
||||
PlayerControl target = null;
|
||||
|
||||
foreach (PlayerControl p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data == null || p == PlayerControl.LocalPlayer || Utils.IsPlayerModerator(p.Data.FriendCode)) continue;
|
||||
|
||||
if ((isKick || isBan) && p.Data.PlayerName.Equals(arg, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(target.Data.ClientId, isBan || isColorBan);
|
||||
Logger.Info($" {__instance.Data.PlayerName} {(banLog ? "banned" : "kicked")} {target.Data.PlayerName}", "Kick&BanCommand");
|
||||
if ((isColorKick || isColorBan) && Utils.TryGetColorId(arg, out byte colorId))
|
||||
{
|
||||
if (p.Data.DefaultOutfit.ColorId == colorId)
|
||||
{
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(target.Data.ClientId, isBan || isColorBan);
|
||||
Logger.Info($" {__instance.Data.PlayerName} {(banLog ? "banned" : "kicked")} {target.Data.PlayerName}", "Kick&BanCommand");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class NormalGameEndChecker
|
||||
public static bool Prefix()
|
||||
{
|
||||
|
||||
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3 || Options.Gamemode.GetValue() == 2 && Main.NormalOptions.NumImpostors*2 < Utils.allAlivePlayersCount) return false;
|
||||
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3) return false;
|
||||
|
||||
var allPlayers = PlayerControl.AllPlayerControls.ToArray();
|
||||
|
||||
@@ -67,28 +67,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[10],
|
||||
Index = presetItem.GetInt(),
|
||||
};
|
||||
}
|
||||
if (baseGameSetting != null)
|
||||
baseGameSetting.Title = StringNames.Accept;
|
||||
return baseGameSetting;
|
||||
|
||||
@@ -5,6 +5,9 @@ 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 +16,23 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,17 +14,10 @@ internal class ApplyCustomImpostorCount
|
||||
NormalGameEndChecker.imps.Clear();
|
||||
NormalGameEndChecker.LastWinReason = "";
|
||||
|
||||
// Normal game = Impostor to prevent blocking task win. HNS = Crewmate to prevent Seeker detection range bugging.
|
||||
if (Main.GM.Value)
|
||||
{
|
||||
if (!Utils.isHideNSeek)
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.ImpostorGhost, false);
|
||||
}
|
||||
if (Utils.isHideNSeek)
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
|
||||
}
|
||||
PlayerControl.LocalPlayer.myTasks.Clear();
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek)
|
||||
|
||||
@@ -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
|
||||
@@ -141,16 +51,19 @@ internal static class MurderPlayerPatch
|
||||
|
||||
misfireCount[playerId]++;
|
||||
|
||||
__instance.RpcSetRole(RoleTypes.Crewmate);
|
||||
__instance.isNew = true;
|
||||
Logger.Info($" {__instance.Data.PlayerName} killed {target.Data.PlayerName} incorrectly and can't kill for {Options.CantKillTime.GetInt()}s", "SNSKillManager");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} killed {target.Data.PlayerName}, incorrectly and can't kill for {Options.CantKillTime.GetInt()}s");
|
||||
|
||||
new LateTask(() =>
|
||||
if (misfireCount[__instance.Data.PlayerId] < Options.MisfiresToSuicide.GetFloat())
|
||||
{
|
||||
__instance.isNew = false;
|
||||
if (!__instance.Data.IsDead) {__instance.RpcSetRole(RoleTypes.Shapeshifter, false);}
|
||||
}, Options.CantKillTime.GetInt(), "SNSResetRole");
|
||||
__instance.RpcSetRole(RoleTypes.Crewmate);
|
||||
__instance.isNew = true;
|
||||
Logger.Info($" {__instance.Data.PlayerName} killed {target.Data.PlayerName} incorrectly and can't kill for {Options.CantKillTime.GetInt()}s", "SNSKillManager");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} killed {target.Data.PlayerName} incorrectly and can't kill for {Options.CantKillTime.GetInt()}s");
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
__instance.isNew = false;
|
||||
if (!__instance.Data.IsDead) {__instance.RpcSetRole(RoleTypes.Shapeshifter, false);}
|
||||
}, Options.CantKillTime.GetInt(), "SNSResetRole");
|
||||
}
|
||||
|
||||
if (misfireCount[__instance.Data.PlayerId] >= Options.MisfiresToSuicide.GetFloat())
|
||||
{
|
||||
|
||||
@@ -128,6 +128,12 @@ internal static class RpcSetTasksPatch
|
||||
PlayerControl pc = __instance.Object;
|
||||
if (pc == null) return;
|
||||
|
||||
if (Main.GM.Value && pc == PlayerControl.LocalPlayer)
|
||||
{
|
||||
taskTypeIds = new Il2CppStructArray<byte>(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Options.AllPlayersSameTasks.GetBool())
|
||||
{
|
||||
RerollTasks(ref taskTypeIds);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</p>
|
||||
|
||||
# 💡 How To Install:
|
||||
- <b>If you have BepInEx, download AmongUsRevamped.dll in releases and move it into Among Us → BepinEx → Plugins</b>
|
||||
- <b>If you have BepInEx, download AUR.dll in releases and move it into Among Us → BepinEx → Plugins</b>
|
||||
- <b> If you don't have BepInEx:</b>
|
||||
- Download the latest .zip file in the releases tab
|
||||
- Extract the contents of the zip into your Among Us folder
|
||||
@@ -29,7 +29,7 @@
|
||||
<img src="https://github.com/astra1dev/AUnlocker/assets/90265231/14226f03-a003-4efc-b27b-6df53fb394d6" width=410 height=240>****
|
||||
|
||||
|
||||
# 🎮 Features (v1.1.1):
|
||||
# 🎮 Features (v1.2.1):
|
||||
- <b>🔶 Client Side settings:</b>
|
||||
- Game Master
|
||||
- Unlock FPS
|
||||
@@ -39,14 +39,16 @@
|
||||
- <b>🔷 Technical settings:</b>
|
||||
- Kick/Ban players under a certain level
|
||||
- Kick/Ban invalid FriendCodes
|
||||
- Kick/Ban command using names instead of ID's
|
||||
- Kick/Ban command using names
|
||||
- Ckick/Cban command using colors
|
||||
- DenyName system
|
||||
- Moderator system
|
||||
- Banlist system
|
||||
- Enable No Game End
|
||||
- Banlist
|
||||
- <b>🔶 Automatic settings:</b>
|
||||
- Auto start game + conditions for it
|
||||
- <b>🔶 Automation settings:</b>
|
||||
- Auto start game and conditions for it
|
||||
- Auto rejoin lobby
|
||||
- Auto send winner info
|
||||
- <b>🔷 Gameplay Settings:</b>
|
||||
- Disable critical sabotages
|
||||
- Disable door sabotages
|
||||
@@ -61,10 +63,11 @@
|
||||
- <b>🔷 Extra features:</b>
|
||||
- Shift + L + Enter - Force End Game
|
||||
- Shift + M + Enter - Force Call/Close Meeting
|
||||
- Gamemode info commands -> /0kc /0killcooldown | /sns /shiftandseek |/sp /speedrun
|
||||
- /help command
|
||||
- Specific gamemode info commands -> /0kc, /sns, /sp
|
||||
- Current gamemode info command -> /r
|
||||
- Zoom out in lobby or when dead
|
||||
- Kick players while in game
|
||||
- Unlimited Option ranges
|
||||
- Unlimited default Option ranges
|
||||
- Logging for useful information
|
||||
- <b>🎉 And this all without Modded Protocol!</b>
|
||||
|
||||
|
||||
Reference in new issue
Block a user