Compare commits

...
4 Commits
Author SHA1 Message Date
Ape 30c436f80b Small fix for SnS 2026-01-17 11:04:54 +01:00
Ape 7c0be8b4bb Code cleanup, string improvements, fixes, mod command setting
L Innersloth ez bypassed
2026-01-16 23:25:49 +01:00
Ape 42889b5613 /r command and small gamemodes improvement 2026-01-16 00:03:28 +01:00
Ape 2e337ce6b8 MASSIVE database change, fix million things, add million things
Please don't break the whole mod
2026-01-15 23:18:45 +01:00
14 changed files with 568 additions and 109 deletions

No files matched your search

+38 -1
View File
@@ -29,7 +29,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.1.1";
public const string ModVersion = "v1.2.1";
public static float GameTimer;
@@ -84,4 +84,41 @@ public partial class Main : BasePlugin
LateTask.Update(Time.deltaTime);
}
}
public enum ColorToString
{
Red = 0,
Blue = 1,
Green = 2,
Pink = 3,
Orange = 4,
Yellow = 5,
Black = 6,
White = 7,
Purple = 8,
Brown = 9,
Cyan = 10,
Lime = 11,
Maroon = 12,
Rose = 13,
Banana = 14,
Gray = 15,
Tan = 16
}
// 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
}
}
+16 -8
View File
@@ -40,7 +40,11 @@ namespace AmongUsRevamped
public static OptionItem ApplyBanList;
public static OptionItem ApplyDenyNameList;
public static OptionItem ApplyModeratorList;
public static OptionItem ModeratorCanUseCommand;
public static OptionItem TabGroupAutomation;
public static OptionItem AutoSendGameInfo;
public static OptionItem AutoRejoinLobby;
public static OptionItem AutoStartTimer;
public static OptionItem WaitAutoStart;
@@ -190,8 +194,8 @@ namespace AmongUsRevamped
.SetColor(Color.green)
.SetHeader(true);
TabGroupMain = TextOptionItem.Create(60000, "Main", TabGroup.SystemSettings)
.SetColor(Color.yellow);
TabGroupMain = TextOptionItem.Create(60000, "Moderation", TabGroup.SystemSettings)
.SetColor(Color.blue);
KickLowLevelPlayer = IntegerOptionItem.Create(60050, "Kick Players Under Level", new(0, 100, 1), 0, TabGroup.SystemSettings, false)
.SetValueFormat(OptionFormat.Level);
@@ -205,19 +209,23 @@ 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);
AutoSendGameInfo = BooleanOptionItem.Create(60150, "Automatically send winner info", true, TabGroup.SystemSettings, false);
AutoRejoinLobby = BooleanOptionItem.Create(60210, "Auto Rejoin Lobby", false, TabGroup.SystemSettings, false);
AutoStartTimer = IntegerOptionItem.Create(44420, "Countdown For Auto Start", new(1, 600, 1), 5, TabGroup.SystemSettings, false)
AutoStartTimer = IntegerOptionItem.Create(64420, "Countdown For Auto Start", new(1, 600, 1), 5, TabGroup.SystemSettings, false)
.SetValueFormat(OptionFormat.Seconds);
WaitAutoStart = IntegerOptionItem.Create(44421, "Auto Start After", new(10, 600, 10), 300, TabGroup.SystemSettings, false)
WaitAutoStart = IntegerOptionItem.Create(64421, "Auto Start After", new(10, 600, 10), 300, TabGroup.SystemSettings, false)
.SetValueFormat(OptionFormat.Seconds);
PlayerAutoStart = IntegerOptionItem.Create(44422, "Players Needed To Auto Start", new(1, 15, 1), 1, TabGroup.SystemSettings, false);
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);
// Gamemode Settings
TabGroupHNS = TextOptionItem.Create(70000, "Hide and Seek", TabGroup.GamemodeSettings)
.SetColor(Color.green);
@@ -234,7 +242,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);
@@ -264,7 +272,7 @@ namespace AmongUsRevamped
.SetColor(new Color32(255, 255, 153, byte.MaxValue))
.SetParent(OverrideTaskSettings);
DisableMiraTasks = BooleanOptionItem.Create(23000, "Disable Mira Tasks", false, TabGroup.ModSettings, false)
DisableMiraTasks = BooleanOptionItem.Create(23000, "Disable Mira HQ Tasks", false, TabGroup.ModSettings, false)
.SetColor(new Color32(173, 216, 230, byte.MaxValue))
.SetParent(OverrideTaskSettings);
+2
View File
@@ -40,6 +40,7 @@ public static class FixedUpdate
writer.Write((byte)GameOverReason.ImpostorDisconnect);
AmongUsClient.Instance.FinishEndGame(writer);
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
@@ -55,6 +56,7 @@ public static class FixedUpdate
writer.Write((byte)GameOverReason.CrewmatesByVote);
AmongUsClient.Instance.FinishEndGame(writer);
Logger.Info($" No one won because the game took longer than {Options.GameAutoEndsAfter.GetInt()}s", "SpeedrunManager");
NormalGameEndChecker.LastWinReason = $"★ No one wins! (Timer)";
}
}
}
+118 -1
View File
@@ -26,6 +26,8 @@ public static class Utils
public static long TimeStamp => EpochStartSeconds + (long)Stopwatch.Elapsed.TotalSeconds;
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 || pc.isNew);
public static bool IsLobby => AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Joined;
public static bool InGame => AmongUsClient.Instance && AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Started;
@@ -198,7 +200,9 @@ public static class Utils
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
LateTask.Tasks.Clear();
FixedUpdateInGamePatch.ProcessedModerators.Clear();
NormalGameEndChecker.ImpCheckComplete = false;
}
public static PlayerControl[] AllAlivePlayerControls
@@ -222,4 +226,117 @@ public static class Utils
return result;
}
}
public static void ShowLastResult(byte playerId = byte.MaxValue)
{
if (InGame)
{
Logger.SendInGame($"Hi, you're currently in-game. Let's use this command afterwards");
return;
}
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason))
{
Logger.SendInGame($"Your command was canceled due to not having the required info");
return;
}
PlayerControl.LocalPlayer.RpcSendChat($"{NormalGameEndChecker.LastWinReason}");
}
public static bool TryGetColorId(string input, out byte colorId)
{
colorId = 0;
if (Enum.TryParse<Main.ColorToString>(input, true, out var color))
{
colorId = (byte)color;
return true;
}
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();
}
}
+221 -50
View File
@@ -26,91 +26,262 @@ 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();
if (text == "/h" || text == "/help")
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat) return false;
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 (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
{
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason) || Utils.InGame) return false;
Utils.ChatCommand(__instance, $"{NormalGameEndChecker.LastWinReason}", "", false);
return false;
}
if (__instance.timeSinceLastMessage < 3f) return false;
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
{
PlayerControl.LocalPlayer.RpcSendChat("0 Kill Cooldown Mode:\n\nImpostors have no kill cooldown, Crewmates have low tasks.\nThink fast and pay attention.");
__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("Shift and Seek Mode:\n\nImps can only kill someone while shapeshifted as them.\nSabotages & Meetings = Off.");
__instance.timeSinceLastMessage = 0.8f;
__instance.freeChatField.textArea.Clear();
__instance.freeChatField.textArea.SetText(string.Empty);
new LateTask(() =>
{
PlayerControl.LocalPlayer.RpcSendChat($"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.");
__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($"Speedrun Mode:\n\nEveryone is a crewmate. The 1st player to finish tasks wins the game. Game auto ends after {Options.GameAutoEndsAfter.GetInt()}s");
__instance.timeSinceLastMessage = 0.8f;
__instance.freeChatField.textArea.Clear();
__instance.freeChatField.textArea.SetText(string.Empty);
Utils.ChatCommand(__instance, $"{speedrunMode}", "", false);
return false;
}
else return true;
}
}
[HarmonyPatch(typeof(PlayerControl), "RpcSendChat")]
public static class PC_RpcSendChat
{
// Banning works by Name and not Id
public static void Prefix(PlayerControl __instance, ref string chatText)
{
if (!AmongUsClient.Instance.AmHost)
return;
bool isKick = chatText.StartsWith("/kick ");
bool isBan = chatText.StartsWith("/ban ");
if (!isKick && !isBan)
return;
if (__instance == PlayerControl.LocalPlayer || Utils.IsPlayerModerator(__instance.Data.FriendCode))
if (text == "/r" || text == "/roles" || text == "/gamemode" || text == "/gm")
{
string kickedPlayerName = chatText.Substring(isBan ? 5 : 6).Trim();
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);
break;
case 1:
Utils.ChatCommand(__instance, $"{noKcdMode}", "", false);
break;
case 2:
Utils.ChatCommand(__instance, $"{SnSModeOne}", $"{SnSModeTwo}", true);
break;
case 3:
Utils.ChatCommand(__instance, $"{speedrunMode}", "", false);
break;
}
return false;
}
else
{
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)
{
Logger.Info($" {PlayerControl.LocalPlayer.Data.PlayerName}: {text}", "SendChat");
return true;
}
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 && !Utils.IsPlayerModerator(p.Data.FriendCode) && p != PlayerControl.LocalPlayer && p.Data.PlayerName.Equals(kickedPlayerName, StringComparison.OrdinalIgnoreCase))
if (p.Data == null || p == PlayerControl.LocalPlayer) continue;
if ((isKick || isBan) && p.Data.PlayerName.Equals(arg, StringComparison.OrdinalIgnoreCase))
{
target = p;
break;
}
}
if ((isColorKick || isColorBan) && Utils.TryGetColorId(arg, out byte colorId))
{
if (p.Data.DefaultOutfit.ColorId == colorId)
{
target = p;
break;
}
}
}
if (target == null)
return;
if (target != null)
{
AmongUsClient.Instance.KickPlayer(target.Data.ClientId, isBan || isColorBan);
Logger.Info($" {(banLog ? "banned" : "kicked")} {target.Data.PlayerName}", "Kick&BanCommand");
__instance.freeChatField.textArea.Clear();
__instance.freeChatField.textArea.SetText(string.Empty);
}
return false;
}
}
}
AmongUsClient.Instance.KickPlayer(target.Data.ClientId, isBan);
Logger.Info($" {__instance.Data.PlayerName} {(isBan ? "banned" : "kicked")} {target.Data.PlayerName}", "Kick&BanCommand");
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.HandleRpc))]
public static class RPCHandlerPatch
{
public static void Prefix(PlayerControl __instance, byte callId, MessageReader reader)
{
if (!AmongUsClient.Instance.AmHost) return;
var rpcType = (RpcCalls)callId;
MessageReader subReader = MessageReader.Get(reader);
switch (rpcType)
{
case RpcCalls.SendChat:
{
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")
{
OnGameJoinedPatch.WaitingForChat = true;
new LateTask(() =>
{
Utils.SendPrivateMessage(__instance, $"{SendChatPatch.allCommandsOne}");
}, 2.2f, "MHP1");
new LateTask(() =>
{
Utils.SendPrivateMessage(__instance, $"{SendChatPatch.allCommandsTwo}");
}, 4.4f, "MHP2");
new LateTask(() =>
{
OnGameJoinedPatch.WaitingForChat = false;
}, 6.6f, "MHP3");
}
if (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
{
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason) || Utils.InGame) return;
Utils.ModeratorChatCommand($"{NormalGameEndChecker.LastWinReason}", "", false);
}
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
{
Utils.ModeratorChatCommand($"{SendChatPatch.noKcdMode}", "", false);
}
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
{
Utils.ModeratorChatCommand($"{SendChatPatch.SnSModeOne}", $"{SendChatPatch.SnSModeTwo}", true);
}
if (text == "/sp" || text == "/sr" || text == "/speedrun")
{
Utils.ModeratorChatCommand($"{SendChatPatch.speedrunMode}", "", false);
}
if (text == "/r" || text == "/roles" || text == "/gamemode" || text == "/gm")
{
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
{
// 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 ((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;
}
}
}
}
+1
View File
@@ -52,6 +52,7 @@ namespace AmongUsRevamped
private static void Postfix(VersionShower __instance)
{
Utils.ClearLeftoverData();
NormalGameEndChecker.LastWinReason = "";
Main.CredentialsText = $"<color=#FFD700>Among Us Revamped</color><color=#ffffff> {Main.ModVersion}</color>";
+50
View File
@@ -0,0 +1,50 @@
using System;
using AmongUs.Data;
using Discord;
using HarmonyLib;
namespace AmongUsRevamped;
// Originally from "Town of Us Rewritten", by Det
[HarmonyPatch(typeof(ActivityManager), nameof(ActivityManager.UpdateActivity))]
public class DiscordRPC
{
private static string Lobbycode = "";
private static string Region = "";
public static void Prefix([HarmonyArgument(0)] Activity activity)
{
if (activity == null) return;
var details = $"AmongUsRevamped {Main.ModVersion}";
activity.Details = details;
try
{
if (activity.State != "In Menus")
{
if (!DataManager.Settings.Gameplay.StreamerMode)
{
if (Utils.IsLobby)
{
Lobbycode = GameStartManager.Instance.GameRoomNameCode.text;
Region = Utils.GetRegionName();
}
if (Lobbycode != "" && Region != "") details = $"AmongUsRevamped - {Lobbycode} ({Region})";
}
else
details = $"AmongUsRevamped {Main.ModVersion}";
activity.Details = details;
}
}
catch (Exception ex)
{
Logger.Error("Error in updating discord rpc", "DiscordPatch");
Logger.Exception(ex, "DiscordPatch");
details = $"AmongUsRevamped v{Main.ModVersion}";
activity.Details = details;
}
}
}
+35 -2
View File
@@ -21,12 +21,44 @@ public static class EndGameManagerPatch
[HarmonyPatch(typeof(LogicGameFlowNormal), nameof(LogicGameFlowNormal.CheckEndCriteria))]
class NormalGameEndChecker
{
public static bool ImpCheckComplete;
public static string LastWinReason = "";
public static List<PlayerControl> imps = new List<PlayerControl>();
public static bool Prefix()
{
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3 || Options.Gamemode.GetValue() == 2 && Main.NormalOptions.NumImpostors*2 < Utils.allAlivePlayersCount ) return false;
else return true;
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3) return false;
var allPlayers = PlayerControl.AllPlayerControls.ToArray();
if (!ImpCheckComplete)
{
imps.AddRange(allPlayers.Where(pc => pc.Data.Role.IsImpostor));
ImpCheckComplete = true;
}
if (Utils.AliveImpostors == 0)
{
LastWinReason = $"★ Crewmates win!\n\nImpostors:\n" + string.Join("\n", imps.Select(p => p.Data.PlayerName));
}
else if (Utils.AliveImpostors >= Utils.AliveCrewmates)
{
LastWinReason = $"★ Impostors win!\n\nImpostors:\n★" + string.Join("\n★", imps.Select(p => p.Data.PlayerName));
}
else if (GameData.Instance != null && GameData.Instance.TotalTasks > 0 && GameData.Instance.CompletedTasks >= GameData.Instance.TotalTasks)
{
LastWinReason = $"★ Crewmates win! (Tasks)\n\nImpostors:\n" + string.Join("\n", imps.Select(p => p.Data.PlayerName));
}
else
{
LastWinReason = $"★ Impostors win! (Sabotage)\n\nImpostors:\n★" + string.Join("\n★", imps.Select(p => p.Data.PlayerName));
}
return true;
}
}
[HarmonyPatch(typeof(LogicGameFlowHnS), nameof(LogicGameFlowHnS.CheckEndCriteria))]
class HNSGameEndChecker
{
@@ -36,6 +68,7 @@ class HNSGameEndChecker
else return true;
}
}
[HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))]
internal class ControllerManagerUpdatePatch
{
+38 -6
View File
@@ -10,17 +10,39 @@ namespace AmongUsRevamped;
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnGameJoined))]
internal static class OnGameJoinedPatch
{
public static bool WaitingForChat;
public static bool AutoStartCheck;
public static void Postfix(AmongUsClient __instance)
public static void Postfix()
{
if (!AmongUsClient.Instance.AmHost || !Main.AutoStart.Value) return;
if (!AmongUsClient.Instance.AmHost) return;
LateTask.Tasks.Clear();
WaitingForChat = false;
AutoStartCheck = false;
new LateTask(() =>
if (Main.AutoStart.Value)
{
AutoStartCheck = true;
}, Options.WaitAutoStart.GetFloat(), "AutoStartTimer");
LateTask.Tasks.Clear();
new LateTask(() =>
{
AutoStartCheck = true;
}, Options.WaitAutoStart.GetFloat(), "AutoStartTimer");
}
if (Options.AutoSendGameInfo.GetBool() && !string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason))
{
WaitingForChat = true;
new LateTask(() =>
{
Utils.ShowLastResult();
}, 3f, "AutoSendGameInfo");
new LateTask(() =>
{
WaitingForChat = false;
}, 5.2f, "AutoSendGameInfo2");
}
}
}
@@ -80,4 +102,14 @@ class OnPlayerJoinedPatch
}
}
}
}
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnPlayerLeft))]
class OnPlayerLeftPatch
{
static void Prefix([HarmonyArgument(0)] ClientData client)
{
if (client?.Character == null) return;
FixedUpdateInGamePatch.ProcessedModerators.Remove(client.Character.PlayerId);
}
}
+4 -8
View File
@@ -11,17 +11,13 @@ internal class ApplyCustomImpostorCount
{
if (!AmongUsClient.Instance.AmHost) return;
// Normal game = Impostor to prevent blocking task win. HNS = Crewmate to prevent Seeker detection range bugging.
NormalGameEndChecker.imps.Clear();
NormalGameEndChecker.LastWinReason = "";
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)
+25 -22
View File
@@ -9,9 +9,17 @@ 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");
@@ -23,13 +31,8 @@ class FixedUpdateInGamePatch
if (Options.NoKcdSettingsOverride.GetBool() && g == null)
{
Main.NormalOptions.EmergencyCooldown = 0;
Main.NormalOptions.DiscussionTime = 0;
Main.NormalOptions.VotingTime = 30;
Main.NormalOptions.TaskBarMode = 0;
Main.NormalOptions.NumCommonTasks = 0;
Main.NormalOptions.NumShortTasks = 1;
Main.NormalOptions.NumLongTasks = 0;
}
}
@@ -43,10 +46,6 @@ class FixedUpdateInGamePatch
Main.NormalOptions.NumEmergencyMeetings = 0;
Main.NormalOptions.TaskBarMode = 0;
Options.DisableSabotage.SetValue(1);
Options.DisableCloseDoor.SetValue(1);
Options.DisableReport.SetValue(1);
}
}
@@ -64,9 +63,10 @@ class FixedUpdateInGamePatch
new LateTask(() =>
{
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
writer.Write((byte)GameOverReason.ImpostorsByVote);
AmongUsClient.Instance.FinishEndGame(writer);
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");
}
}
@@ -104,7 +104,7 @@ class ReportDeadBodyPatch
{
if (!AmongUsClient.Instance.AmHost) return true;
if (Options.DisableReport.GetBool() && target != null)
if (Options.DisableReport.GetBool() && target != null || Options.Gamemode.GetValue() == 2)
{
Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch");
return false;
@@ -141,16 +141,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())
{
+2 -2
View File
@@ -20,7 +20,7 @@ public static class SabotageSystemTypeRepairDamagePatch
var Sabo = (SystemTypes)amount;
Logger.Info($" {player.Data.PlayerName} is trying to sabotage: {Sabo}", "SabotageCheck");
if (Options.DisableSabotage.GetBool())
if (Options.DisableSabotage.GetBool() || Options.Gamemode.GetValue() == 2)
{
Logger.Info($" Sabotage {Sabo} by: {player.Data.PlayerName} was blocked", "SabotageCheck");
return false;
@@ -38,7 +38,7 @@ class ShipStatusCloseDoorsPatch
Logger.Info($" Trying to close the door in: {room}", "DoorCheck");
if (Options.DisableCloseDoor.GetBool())
if (Options.DisableCloseDoor.GetBool() || Options.Gamemode.GetValue() == 2)
{
Logger.Info($" Door sabotage in: {room} was blocked", "DoorCheck");
return false;
+6
View File
@@ -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);
+12 -9
View File
@@ -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>
‎