Compare commits

..
22 Commits
Author SHA1 Message Date
Ape 79425e5fb8 Update GameStartManagerPatch.cs 2026-01-22 10:27:23 +01:00
Ape 294b5df4d9 Send intercontinental missile to hackers & some other stuff 2026-01-21 22:17:29 +01:00
Ape f7f0be4eb8 Update AmongUsRevamped.csproj 2026-01-20 23:02:09 +01:00
Ape 3ff2df26dc Small adjustments 2026-01-20 22:58:08 +01:00
Ape b422d65b47 Dump command, fixes, reset start countdown 2026-01-19 21:56:50 +01:00
Ape 2b844e31a9 Dumb problems require dumb fixes 2026-01-18 22:09:49 +01:00
Ape 48eb09f448 Presets, Technical improvements, Small fixes 2026-01-18 16:04:23 +01:00
Ape 6842f3d516 Fixes, features, changes, the usual stuff 2026-01-17 23:37:24 +01:00
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
Ape 59384ec415 I promise this is the last one 2026-01-13 16:35:37 +01:00
Ape 43c3826aeb Another readme change 2026-01-13 16:32:26 +01:00
Ape 6869dc80b4 Merge branch 'main' of https://github.com/ApeMV/AmongUsRevamped 2026-01-13 16:26:47 +01:00
Ape 016ad4ba06 DenyName, Many SnS fixes, Gamemode behavior change 2026-01-13 16:26:43 +01:00
Ape 0ee0937254 Update readme from mobile - hope this works 2026-01-12 19:19:58 +01:00
Ape 4c5d53bc01 v1.1.0 v2 2026-01-12 00:34:08 +01:00
Ape 19ed93e308 1.1.0
Updated version number from v1.0.1 to v1.1.0 and added new features.
2026-01-12 00:33:35 +01:00
Ape ef8febf979 v1.1.0 - Fixes, Speedrun GM, Moderators, Commands,
Yeah it's a lot
2026-01-12 00:29:40 +01:00
Ape 1e18868bf5 Merge branch 'main' of https://github.com/ApeMV/AmongUsRevamped 2026-01-08 21:57:14 +01:00
Ape 7944956053 Random bullshit go! (Did Innersloth break this?) 2026-01-08 21:57:11 +01:00
26 changed files with 1653 additions and 224 deletions

No files matched your search

+52 -1
View File
@@ -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.0.0";
public const string ModVersion = "v1.3.3";
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);
@@ -84,4 +96,43 @@ 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,
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
}
}
+2 -3
View File
@@ -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)' != ''">
+6
View File
@@ -12,6 +12,7 @@ namespace AmongUsRevamped;
public static class BanManager
{
public static string RemoveHtmlTags(this string str) => Regex.Replace(str, "<[^>]*?>", "");
private static readonly string DenyNameListPath = "./AUR-DATA/DenyNameList.txt";
private static string BanListPath = "./AUR-DATA/BanList.txt";
private static string ModeratorListPath = "./AUR-DATA/ModeratorList.txt";
public static List<string> TempBanWhiteList = [];
@@ -21,6 +22,11 @@ public static class BanManager
{
Directory.CreateDirectory("AUR-DATA");
if (!File.Exists(DenyNameListPath))
{
Logger.Warn("Creating a new DenyNameList.txt file", "BanManager");
File.Create(DenyNameListPath).Close();
}
if (!File.Exists(BanListPath))
{
Logger.Warn("Creating a new BanList.txt file", "BanManager");
+119 -23
View File
@@ -21,9 +21,44 @@ namespace AmongUsRevamped
taskOptionsLoad.Wait();
}
public static class CL
{
public static Color32 Hex(string hex)
{
if (hex.StartsWith("#"))
hex = hex.Substring(1);
if (hex.Length == 3)
{
hex = $"{hex[0]}{hex[0]}{hex[1]}{hex[1]}{hex[2]}{hex[2]}";
}
if (hex.Length != 6)
throw new System.ArgumentException("Hex color must be 6 or 3 characters long.");
byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
return new Color32(r, g, b, 255);
}
}
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"
"None", "0 Kill Cooldown", "Shift And Seek", "Speedrun"
};
public static readonly string[] colorLevels =
{
"Moderators", "Everyone", "Nobody"
};
//System
@@ -38,21 +73,33 @@ namespace AmongUsRevamped
public static OptionItem TempBanInvalidFriendCodes;
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;
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
//Gameplay
public static OptionItem TabGroupGameplayGeneral;
public static OptionItem DisableSabotage;
public static OptionItem DisableCloseDoor;
public static OptionItem DisableReport;
public static OptionItem TabGroupTasks;
public static OptionItem OverrideTaskSettings;
public static OptionItem AllPlayersSameTasks;
@@ -174,6 +221,17 @@ namespace AmongUsRevamped
public static OptionItem CantKillTime;
public static OptionItem MisfiresToSuicide;
public static OptionItem TabGroupSpeedrun;
public static OptionItem SpeedrunSettingsOverride;
public static OptionItem GameAutoEndsAfter;
// Roles
public static OptionItem TabGroupCrewmate;
public static OptionItem TabGroupNeutral;
public static OptionItem JesterPerc;
public static OptionItem TabGroupImpostor;
public static bool IsLoaded = false;
@@ -181,12 +239,16 @@ 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);
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);
@@ -198,18 +260,47 @@ namespace AmongUsRevamped
.SetParent(KickInvalidFriendCodes);
ApplyBanList = BooleanOptionItem.Create(60110, "Apply BanList", true, TabGroup.SystemSettings, true);
ApplyModeratorList = BooleanOptionItem.Create(60120, "Apply ModeratorList", true, TabGroup.SystemSettings, false);
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);
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);
// Custom role settings
TabGroupCrewmate = TextOptionItem.Create(100000, "Crewmate Roles", TabGroup.CustomRoleSettings)
.SetColor(CL.Hex("#8cffff"));
TabGroupNeutral = TextOptionItem.Create(101000, "Neutral Roles", TabGroup.CustomRoleSettings)
.SetColor(CL.Hex("#FFFF99"));
JesterPerc = IntegerOptionItem.Create(101001, "PLACEHOLDER", new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
.SetValueFormat(OptionFormat.Percent)
.SetColor(CL.Hex("#ec62a5"));
TabGroupImpostor = TextOptionItem.Create(102000, "Impostor Roles", TabGroup.CustomRoleSettings)
.SetColor(CL.Hex("#ff1919"));
NoGameEnd = BooleanOptionItem.Create(60380, "No Game End", false, TabGroup.SystemSettings, false)
.SetColor(Color.red)
.SetHeader(true);
// Gamemode Settings
@@ -228,31 +319,36 @@ 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);
TabGroupSpeedrun = TextOptionItem.Create(70075, "Speedrun", TabGroup.GamemodeSettings)
.SetColor(Color.blue);
SpeedrunSettingsOverride = BooleanOptionItem.Create(70076, "Auto Update Settings", true, TabGroup.GamemodeSettings, false);
GameAutoEndsAfter = IntegerOptionItem.Create(70077, "Game automatically ends after", new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
.SetValueFormat(OptionFormat.Seconds);
// Gameplay Settings
TabGroupGameplayGeneral = TextOptionItem.Create(60564, "General", TabGroup.ModSettings)
.SetColor(Color.blue);
DisableSabotage = BooleanOptionItem.Create(60565, "Disable Critical Sabotages", false, TabGroup.ModSettings, false)
.SetColor(new Color32(255, 153, 153, byte.MaxValue))
.SetHeader(true);
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableCloseDoor = BooleanOptionItem.Create(60566, "Disable Door Sabotages", false, TabGroup.ModSettings, false)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableReport = BooleanOptionItem.Create(60520, "Disable Body Reports", false, TabGroup.ModSettings, false)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
TabGroupTasks = TextOptionItem.Create(22997, "Tasks", TabGroup.ModSettings)
.SetColor(Color.yellow);
AllPlayersSameTasks = BooleanOptionItem.Create(22998, "Everyone has same tasks", false, TabGroup.ModSettings, false)
.SetColor(new Color32(255, 255, 153, byte.MaxValue));
OverrideTaskSettings = BooleanOptionItem.Create(22999, "<#ffd>Di<#ffb>sa<#ff9>bl<#ffb>e T<#ffd>as<#ffb>ks", false, TabGroup.ModSettings, false)
.SetColor(new Color32(239, 89, 175, byte.MaxValue));
OverrideTaskSettings = BooleanOptionItem.Create(22998, "<#ffd>Ove<#ffb>rri<#ff9>de T<#ffb>ask <#ffd>Set<#ffb>tin<#ff9>gs", false, TabGroup.ModSettings, false)
.SetColor(new Color32(239, 89, 175, byte.MaxValue))
.SetHeader(true);
AllPlayersSameTasks = BooleanOptionItem.Create(22999, "Everyone has same tasks", false, TabGroup.ModSettings, false)
.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);
+204
View File
@@ -0,0 +1,204 @@
using Hazel;
using System;
using UnityEngine;
namespace AmongUsRevamped;
internal class EACR
{
public static bool PlayerControlReceiveRpc(PlayerControl pc, byte callId, MessageReader reader)
{
if (!AmongUsClient.Instance.AmHost) return false;
if (pc == null || reader == null) return false;
try
{
MessageReader sr = MessageReader.Get(reader);
var rpc = (RpcCalls)callId;
switch (rpc)
{
case RpcCalls.StartMeeting:
{
AmongUsClient.Instance.KickPlayer(pc.Data.ClientId, true);
Logger.SendInGame($"{pc.Data.PlayerName} was banned for being calling an invalid meeting (cheating)");
Logger.Info($" {pc.Data.PlayerName} was banned for being calling an invalid meeting (cheating)", "EACR");
return true;
}
}
switch (callId)
{
case 101: // Aum Chat
try
{
var firstString = sr.ReadString();
var secondString = sr.ReadString();
sr.ReadInt32();
var flag = string.IsNullOrEmpty(firstString) && string.IsNullOrEmpty(secondString);
if (!flag)
{
AmongUsClient.Instance.KickPlayer(pc.Data.ClientId, true);
Logger.SendInGame($"{pc.Data.PlayerName} was banned for AUM chat CallId (cheating)");
Logger.Info($" {pc.Data.PlayerName} was banned for AUM chat CallId (cheating)", "EACR");
return true;
}
}
catch
{
}
break;
case unchecked((byte)42069): // 85 AUM
try
{
var aumid = sr.ReadByte();
if (aumid == pc.PlayerId)
{
AmongUsClient.Instance.KickPlayer(pc.Data.ClientId, true);
Logger.SendInGame($"{pc.Data.PlayerName} was banned for AUM CallId (cheating)");
Logger.Info($" {pc.Data.PlayerName} was banned for AUM CallId (cheating)", "EACR");
return true;
}
}
catch
{
}
break;
case 119: // KN Chat
try
{
var firstString = sr.ReadString();
var secondString = sr.ReadString();
sr.ReadInt32();
var flag = string.IsNullOrEmpty(firstString) && string.IsNullOrEmpty(secondString);
if (!flag)
{
AmongUsClient.Instance.KickPlayer(pc.Data.ClientId, true);
Logger.SendInGame($"{pc.Data.PlayerName} was banned for KN chat CallId (cheating)");
Logger.Info($" {pc.Data.PlayerName} was banned for KN chat CallId (cheating)", "EACR");
return true;
}
}
catch
{
}
break;
case 250: // KN
if (sr.BytesRemaining == 0)
{
AmongUsClient.Instance.KickPlayer(pc.Data.ClientId, true);
Logger.SendInGame($"{pc.Data.PlayerName} was banned for KN CallId (cheating)");
Logger.Info($" {pc.Data.PlayerName} was banned for KN CallId (cheating)", "EACR");
return true;
}
break;
case unchecked((byte)420): // 164 Sicko
if (sr.BytesRemaining == 0)
{
AmongUsClient.Instance.KickPlayer(pc.Data.ClientId, true);
Logger.SendInGame($"{pc.Data.PlayerName} was banned for Sickomenu RPC (cheating)");
Logger.Info($" {pc.Data.PlayerName} was banned for Sickomenu RPC (cheating)", "EACR");
return true;
}
break;
}
}
catch (Exception e)
{
Logger.Exception(e, "EACR");
}
return false;
}
public static bool RpcUpdateSystemCheck(PlayerControl player, SystemTypes systemType, byte amount)
{
var Mapid = Utils.GetActiveMapId();
if (!AmongUsClient.Instance.AmHost)
{
return false;
}
if (player == null)
{
Logger.Warn("PlayerControl is null", "EACR-RpcUpdateSystemCheck");
return true;
}
if (systemType == SystemTypes.Sabotage)
{
if (!player.Data.Role.IsImpostor && !player.isNew)
{
AmongUsClient.Instance.KickPlayer(player.Data.ClientId, true);
Logger.SendInGame($"{player.Data.PlayerName} was banned for invalid sabotage (cheating)");
Logger.Info($" {player.Data.PlayerName} was banned for invalid sabotage", "EACR");
}
}
else if (systemType == SystemTypes.LifeSupp)
{
if (Mapid != 0 && Mapid != 1 && Mapid != 3) goto YesCheat;
else if (amount != 64 && amount != 65) goto YesCheat;
}
else if (systemType == SystemTypes.Comms)
{
if (amount == 0)
{
if (Mapid == 1 || Mapid == 5) goto YesCheat;
}
else if (amount == 64 || amount == 65 || amount == 32 || amount == 33 || amount == 16 || amount == 17)
{
if (!(Mapid == 1 || Mapid == 5)) goto YesCheat;
}
else goto YesCheat;
}
else if (systemType == SystemTypes.Electrical)
{
if (Mapid == 5) goto YesCheat;
if (amount >= 5)
{
goto YesCheat;
}
}
else if (systemType == SystemTypes.Laboratory)
{
if (Mapid != 2) goto YesCheat;
else if (!(amount == 64 || amount == 65 || amount == 32 || amount == 33)) goto YesCheat;
}
else if (systemType == SystemTypes.Reactor)
{
if (Mapid == 2 || Mapid == 4) goto YesCheat;
else if (!(amount == 64 || amount == 65 || amount == 32 || amount == 33)) goto YesCheat;
}
else if (systemType == SystemTypes.HeliSabotage)
{
if (Mapid != 4) goto YesCheat;
else if (!(amount == 64 || amount == 65 || amount == 16 || amount == 17 || amount == 32 || amount == 33)) goto YesCheat;
}
else if (systemType == SystemTypes.MushroomMixupSabotage)
{
goto YesCheat;
}
if (Utils.IsMeeting && MeetingHud.Instance.state != MeetingHud.VoteStates.Animating)
{
Logger.SendInGame($"{player.Data.PlayerName} might have called an invalid sabotage (cheating)");
Logger.Info($" {player.Data.PlayerName} might have called an invalid sabotage (cheating)", "EACR");
return true;
}
return false;
YesCheat:
{
AmongUsClient.Instance.KickPlayer(player.Data.ClientId, true);
Logger.SendInGame($"{player.Data.PlayerName} was banned for an invalid sabotage (cheating)");
Logger.Info($" {player.Data.PlayerName} was banned for an invalid sabotage", "EACR");
return true;
}
}
}
+102 -8
View File
@@ -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,24 +27,113 @@ 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.CrewmatesByVote);
AmongUsClient.Instance.FinishEndGame(writer);
Logger.Info($" Crewmates win because the game took longer than {Options.CrewAutoWinsGameAfter.GetInt()}s", "SNSManager");
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())
{
if (Main.GameTimer > Options.GameAutoEndsAfter.GetInt())
{
Main.GameTimer = 0f;
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)";
}
}
}
+54
View File
@@ -0,0 +1,54 @@
using AmongUs.Data;
using Hazel;
using InnerNet;
using UnityEngine;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))]
internal class Hotkeys
{
public static void Postfix()
{
// I don't know which psychopath would use right keys, but I know someday, someone will complain
bool Shift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
bool Ctrl = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
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 = !Ctrl;
}
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");
}
}
}
+4 -3
View File
@@ -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();
@@ -214,6 +214,7 @@ namespace AmongUsRevamped
public enum TabGroup
{
SystemSettings,
CustomRoleSettings,
ModSettings,
GamemodeSettings,
+42
View File
@@ -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));
}
}
}
+247 -3
View File
@@ -25,35 +25,63 @@ 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;
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}";
public static byte GetActiveMapId() => GameOptionsManager.Instance.CurrentGameOptions.MapId;
public static bool IsPlayerModerator(string friendCode)
{
if (friendCode == "") return false;
var friendCodesFilePath = @"./AUR-DATA/Moderators.txt";
var friendCodesFilePath = @"./AUR-DATA/ModeratorList.txt";
var friendCodes = File.ReadAllLines(friendCodesFilePath);
return friendCodes.Any(code => code.Contains(friendCode));
}
public static bool IsPlayerInDenyName(ClientData client, string name)
{
if (name == "" || !AmongUsClient.Instance.AmHost || !Options.ApplyDenyNameList.GetBool()) return false;
var denyNameFilePath = @"./AUR-DATA/DenyNameList.txt";
var deniedNames = File.ReadAllLines(denyNameFilePath);
if (deniedNames.Where(code => !string.IsNullOrWhiteSpace(code)).Any(code => name.Contains(code, StringComparison.OrdinalIgnoreCase)))
{
AmongUsClient.Instance.KickPlayer(client.Id, false);
Logger.Info($" {name} was kicked because their name was in DenyNameList.txt", "Kick");
Logger.SendInGame($" {name} was kicked because their name was in DenyNameList.txt");
return true;
}
else return false;
}
public static string GetTabName(TabGroup tab)
{
switch (tab)
{
case TabGroup.SystemSettings:
return "System Settings";
case TabGroup.CustomRoleSettings:
return "Custom Roles";
case TabGroup.ModSettings:
return "Gameplay Settings";
case TabGroup.GamemodeSettings:
@@ -63,6 +91,11 @@ public static class Utils
}
}
public static bool IsCustomOption(NumberOption option)
{
return option.GetComponent<OptionItem>() != null;
}
public static void DestroyTranslator(this GameObject obj)
{
var translator = obj.GetComponent<TextTranslatorTMP>();
@@ -164,4 +197,215 @@ public static class Utils
try { return AmongUsClient.Instance.allClients.ToArray().FirstOrDefault(cd => cd.Id == id); }
catch { return null; }
}
}
public static void ClearLeftoverData()
{
RpcSetTasksPatch.GlobalTaskIds = null;
HandlingGameEnd = false;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
FixedUpdateInGamePatch.ProcessedModerators.Clear();
NormalGameEndChecker.ImpCheckComplete = false;
}
public static PlayerControl[] AllAlivePlayerControls
{
get
{
int count = PlayerControl.AllPlayerControls.Count;
var result = new PlayerControl[count];
var i = 0;
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
{
if (pc == null || pc.Data == null || pc.PlayerId >= 254 || pc.Data.IsDead || (pc.Data.Disconnected)) continue;
result[i++] = pc;
}
if (i == 0) return [];
Array.Resize(ref result, i);
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();
}
// 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
View File
@@ -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)
{
+381
View File
@@ -0,0 +1,381 @@
using Hazel;
using InnerNet;
using System;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
// https://github.com/SuperNewRoles/SuperNewRoles/blob/master/SuperNewRoles/Patches/LobbyBehaviourPatch.cs
namespace AmongUsRevamped;
[HarmonyPatch(typeof(ChatController), nameof(ChatController.Update))]
internal static class ChatControllerUpdatePatch
{
public static void Postfix(ChatController __instance)
{
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.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);
}
}
}
[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 (!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")
{
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")
{
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason) || Utils.InGame) return false;
Utils.ChatCommand(__instance, $"{NormalGameEndChecker.LastWinReason}", "", false);
return false;
}
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
{
Utils.ChatCommand(__instance, $"{noKcdMode}", "", false);
return false;
}
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
{
Utils.ChatCommand(__instance, $"{SnSModeOne}", $"{SnSModeTwo}", true);
return false;
}
if (text == "/sp" || text == "/sr" || text == "/speedrun")
{
Utils.ChatCommand(__instance, $"{speedrunMode}", "", false);
return false;
}
if (text == "/r" || text == "/roles" || text == "/gamemode" || text == "/gm")
{
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;
}
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 ");
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 || 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)
{
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;
}
}
}
[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 (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
{
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
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 (!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;
}
}
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 ");
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;
}
}
}
}
[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);
}
}
}
+80 -21
View File
@@ -51,11 +51,8 @@ namespace AmongUsRevamped
{
private static void Postfix(VersionShower __instance)
{
RpcSetTasksPatch.GlobalTaskIds = null;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
Utils.ClearLeftoverData();
NormalGameEndChecker.LastWinReason = "";
Main.CredentialsText = $"<color=#FFD700>Among Us Revamped</color><color=#ffffff> {Main.ModVersion}</color>";
@@ -70,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);
}
}
}
@@ -185,4 +166,82 @@ 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);
}
var leftPanel = GameObject.Find("LeftPanel");
if (leftPanel != null)
{
leftPanel.gameObject.GetComponent<SpriteRenderer>().enabled = false;
}
var div = GameObject.Find("MainUI/AspectScaler/LeftPanel/Main Buttons/Divider");
if (div != null)
{
div.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
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 -30
View File
@@ -10,11 +10,8 @@ public static class EndGameManagerPatch
{
public static void Postfix(EndGameManager __instance)
{
RpcSetTasksPatch.GlobalTaskIds = null;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
Logger.Info(" -------- GAME ENDED --------", "EndGame");
Utils.ClearLeftoverData();
EndGameNavigation navigation = __instance.Navigation;
if (!AmongUsClient.Instance.AmHost || __instance == null || navigation == null || !Options.AutoRejoinLobby.GetBool()) return;
@@ -25,12 +22,43 @@ 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()) 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 if (Options.Gamemode.GetValue() < 2)
{
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
{
@@ -39,27 +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);
}
}
}
+10
View File
@@ -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;
+6 -3
View File
@@ -114,13 +114,16 @@ namespace AmongUsRevamped
switch ((TabGroup)(tabNum - 3))
{
case TabGroup.SystemSettings:
__instance.MenuDescriptionText.text = "Quality settings to improve comfort and testing";
__instance.MenuDescriptionText.text = "Quality settings to improve comfort and testing.";
break;
case TabGroup.CustomRoleSettings:
__instance.MenuDescriptionText.text = "Custom Role enabling and settings.";
break;
case TabGroup.ModSettings:
__instance.MenuDescriptionText.text = "Gameplay Settings to improve the in-game experience";
__instance.MenuDescriptionText.text = "Gameplay Settings to improve the in-game experience.";
break;
case TabGroup.GamemodeSettings:
__instance.MenuDescriptionText.text = "Situational settings to apply for specific gamemodes";
__instance.MenuDescriptionText.text = "Situational settings to apply for specific gamemodes.";
break;
}
}
+104 -6
View File
@@ -1,21 +1,119 @@
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;
if (!GameStartManager.InstanceExists || AmongUsClient.Instance == null || !AmongUsClient.Instance.AmHost) return;
var data = GameData.Instance;
__instance.MinPlayers = 1;
if (Main.AutoStart.Value && OnGameJoinedPatch.AutoStartCheck && GameStartManager.InstanceExists && GameStartManager.Instance.startState != GameStartManager.StartingStates.Countdown && GameData.Instance?.PlayerCount >= Options.PlayerAutoStart.GetInt())
if (Main.AutoStart.Value && OnGameJoinedPatch.AutoStartCheck && GameStartManager.InstanceExists && GameStartManager.Instance.startState != GameStartManager.StartingStates.Countdown && data != null && data.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();
var sb = GameStartManager.Instance?.StartButton;
if (sb != null)
{
sb.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 (GameStartManagerStartPatch.warningText != null)
{
if (warningMessage == "")
{
GameStartManagerStartPatch.warningText.gameObject.SetActive(false);
}
else
{
GameStartManagerStartPatch.warningText.text = warningMessage;
GameStartManagerStartPatch.warningText.gameObject.SetActive(true);
}
}
if (__instance.GameStartText != null)
{
__instance.GameStartText.transform.localPosition = new Vector3(__instance.GameStartText.transform.localPosition.x, 2f, __instance.GameStartText.transform.localPosition.z);
}
if (GameStartManagerStartPatch.cancelButton != null)
{
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);
}
}
+44 -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");
}
}
}
@@ -56,6 +78,12 @@ class OnPlayerJoinedPatch
{
BanManager.CheckBanPlayer(Client);
Utils.IsPlayerInDenyName(Client, Client.PlayerName);
if (Utils.IsPlayerModerator(Client.FriendCode) && Options.ApplyModeratorList.GetBool())
{
Logger.Info($" {Client.PlayerName} is moderator", "ModeratorCheck");
}
if (HasInvalidFriendCode(Client.FriendCode) && Options.KickInvalidFriendCodes.GetBool())
{
@@ -74,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);
}
}
+2
View File
@@ -47,6 +47,8 @@ public static class NumberOption_Initialize
{
public static void Postfix(NumberOption __instance)
{
if (ModGameOptionsMenu.TabIndex >= 3) return;
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
{
__instance.ValidRange = new FloatRange(-900f, 900f);
+31 -6
View File
@@ -11,19 +11,39 @@ internal class ApplyCustomImpostorCount
{
if (!AmongUsClient.Instance.AmHost) return;
// Normal game = Impostor to prevent blocking task win. HNS = Crewmate to prevent Seeker detection range bugging.
Logger.Info(" -------- GAME STARTED --------", "StartGame");
NormalGameEndChecker.imps.Clear();
NormalGameEndChecker.LastWinReason = "";
if (Main.GM.Value)
{
if (!Utils.isHideNSeek)
if (Options.Gamemode.GetValue() == 3)
{
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.ImpostorGhost, false);
PlayerControl.LocalPlayer.CoSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
}
if (Utils.isHideNSeek)
else
{
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
PlayerControl.LocalPlayer.RpcSetRole(AmongUs.GameOptions.RoleTypes.CrewmateGhost, false);
}
PlayerControl.LocalPlayer.myTasks.Clear();
}
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek)
{
foreach (var p in PlayerControl.AllPlayerControls)
{
if (p != PlayerControl.LocalPlayer)
{
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Crewmate, false);
}
if (p == PlayerControl.LocalPlayer)
{
p.CoSetRole(AmongUs.GameOptions.RoleTypes.Crewmate, false);
}
}
}
if (Utils.isHideNSeek)
{
@@ -61,7 +81,12 @@ internal class ApplyCustomImpostorCount
new LateTask(() =>
{
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false);
}, 9f, "Secondary RPCSetRole");
}, 5f, "HNS Secondary RPCSetRole");
new LateTask(() =>
{
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false);
}, 9f, "HNS Tertiary RPCSetRole");
}
}
}
+15 -78
View File
@@ -3,75 +3,9 @@ using AmongUs.GameOptions;
using Hazel;
using InnerNet;
using System;
using UnityEngine;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))]
class FixedUpdateInGamePatch
{
public static void Postfix(PlayerControl __instance)
{
if (__instance == null || __instance.PlayerId == 255) return;
// 0Kc
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 0.01f)
{
Main.NormalOptions.KillCooldown = 0.01f;
if (Options.NoKcdSettingsOverride.GetBool())
{
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;
}
}
// SnS
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 2.5f)
{
Main.NormalOptions.KillCooldown = 2.5f;
if (Options.SNSSettingsOverride.GetBool())
{
Main.NormalOptions.NumEmergencyMeetings = 0;
Main.NormalOptions.TaskBarMode = 0;
Options.DisableSabotage.SetValue(1);
Options.DisableCloseDoor.SetValue(1);
Options.DisableReport.SetValue(1);
}
}
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
@@ -80,7 +14,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 || Options.Gamemode.GetValue() == 3)
{
Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch");
return false;
@@ -117,18 +51,21 @@ 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");
if (misfireCount[__instance.Data.PlayerId] >= Options.MisfiresToSuicide.GetValue())
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())
{
__instance.RpcSetRole(RoleTypes.ImpostorGhost);
Logger.Info($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} times and suicided", "SNSKillManager");
+26 -3
View File
@@ -4,7 +4,7 @@ using UnityEngine;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(SabotageSystemType), nameof(SabotageSystemType.UpdateSystem))] // SetInitialSabotageCooldown - set sabotage cooldown in start game
[HarmonyPatch(typeof(SabotageSystemType), nameof(SabotageSystemType.UpdateSystem))]
public static class SabotageSystemTypeRepairDamagePatch
{
private static bool Prefix([HarmonyArgument(0)] PlayerControl player, [HarmonyArgument(1)] MessageReader msgReader)
@@ -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,11 +38,34 @@ 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;
}
else return true;
}
}
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.UpdateSystem), typeof(SystemTypes), typeof(PlayerControl), typeof(MessageReader))]
public static class MessageReaderUpdateSystemPatch
{
public static bool Prefix(ShipStatus __instance, [HarmonyArgument(0)] SystemTypes systemType, [HarmonyArgument(1)] PlayerControl player, [HarmonyArgument(2)] MessageReader reader)
{
if (systemType is
SystemTypes.Ventilation
or SystemTypes.Security
or SystemTypes.Decontamination
or SystemTypes.Decontamination2
or SystemTypes.Decontamination3
or SystemTypes.MedBay) return true;
var amount = MessageReader.Get(reader).ReadByte();
if (EACR.RpcUpdateSystemCheck(player, systemType, amount))
{
Logger.Info("EACR patched Sabotage RPC", "MessageReaderUpdateSystemPatch");
return false;
}
else return true;
}
}
+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);
@@ -3,26 +3,8 @@ using InnerNet;
using System;
using UnityEngine;
// https://github.com/SuperNewRoles/SuperNewRoles/blob/master/SuperNewRoles/Patches/LobbyBehaviourPatch.cs
namespace AmongUsRevamped;
[HarmonyPatch(typeof(ChatController), nameof(ChatController.Update))]
internal static class ChatControllerUpdatePatch
{
public static void Postfix(ChatController __instance)
{
if (Main.DarkTheme.Value)
{
__instance.freeChatField.background.color = new Color32(40, 40, 40, byte.MaxValue);
__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;
}
}
[HarmonyPatch(typeof(VoteBanSystem), nameof(VoteBanSystem.AddVote))]
internal static class AddVotePatch
{
+29 -10
View File
@@ -1,9 +1,20 @@
# 📎 AmongUsRevamped
- AmongUsRevamped is a Host-Only mod with one goal: Creating the best Among Us experience possible without Modded Protocol. This includes new settings, utilities and even custom Gamemodes! Enjoy the countless features and feel free to contact me for anything regarding this mod. Happy gaming!
‎
# Welcome to AmongUsRevamped!
<br>
</p>
<p align="center">
<center>
<a href="https://discord.gg/83Zhzhyhya" target="_blank"><img src="https://img.shields.io/badge/Discord%20-%231DA1F2.svg?&style=for-the-badge&logo=discord&logoColor=white&color=5662f6"/></a>
<a href="https://github.com/apemv/AmongUsRevamped/releases/latest" target="_blank"><img src="https://img.shields.io/badge/Latest Version%20-%231DA1F2.svg?&style=for-the-badge&logo=github&logoColor=white&color=181717"/></a>
</center>
</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
@@ -18,7 +29,7 @@
<img src="https://github.com/astra1dev/AUnlocker/assets/90265231/14226f03-a003-4efc-b27b-6df53fb394d6" width=410 height=240>****
‎
# 🎮 Features (v1.0.1):
# 🎮 Features (v1.2.1):
- <b>🔶 Client Side settings:</b>
- Game Master
- Unlock FPS
@@ -28,11 +39,16 @@
- <b>🔷 Technical settings:</b>
- Kick/Ban players under a certain level
- Kick/Ban invalid FriendCodes
- 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
@@ -43,12 +59,15 @@
- <b>🔶 Custom Gamemodes:</b>
- 0 Kill Cooldown
- Shift and Seek
- Speedrun
- <b>🔷 Extra features:</b>
- Shift + L + Enter - Force End Game
- Shift + M + Enter - Force Call/Close Meeting
- /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>
‎