diff --git a/BetterAmongUs.csproj b/BetterAmongUs.csproj
index cb3c118..1d0bb6b 100644
--- a/BetterAmongUs.csproj
+++ b/BetterAmongUs.csproj
@@ -10,7 +10,7 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs
index 29dbdf0..b5bc703 100644
--- a/Modules/AntiCheat.cs
+++ b/Modules/AntiCheat.cs
@@ -25,15 +25,15 @@ class AntiCheat
if (SickoData.ContainsKey(hashPuid))
{
- player.Kick(true, $"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: Known Sicko Menu User");
+ player.Kick(true, $"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: Known Sicko Menu User");
}
else if (AUMData.ContainsKey(hashPuid))
{
- player.Kick(true, $"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: Known AUM User");
+ player.Kick(true, $"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: Known AUM User");
}
else if (PlayerData.ContainsKey(hashPuid))
{
- player.Kick(true, $"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: Known Cheater");
+ player.Kick(true, $"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: Known Cheater");
}
}
}
@@ -72,7 +72,7 @@ class AntiCheat
{
player.ReportPlayer(ReportReasons.Cheating_Hacking);
BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat");
- Logger.LogCheat($"{player.Data.PlayerName} Platform Spoofer: {__instance.XboxPlatformId} is not 10 to 16 characters");
+ Logger.LogCheat($"{player.Data.PlayerName} Platform Spoofer: {__instance.XboxPlatformId}");
}
}
@@ -82,7 +82,7 @@ class AntiCheat
{
player.ReportPlayer(ReportReasons.Cheating_Hacking);
BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat");
- Logger.LogCheat($"{player.Data.PlayerName} Platform Spoofer: {__instance.PsnPlatformId} is not 14 to 19 characters");
+ Logger.LogCheat($"{player.Data.PlayerName} Platform Spoofer: {__instance.PsnPlatformId}");
}
}
}
diff --git a/Modules/BetterNotificationManager.cs b/Modules/BetterNotificationManager.cs
index dca2cc3..47b01e1 100644
--- a/Modules/BetterNotificationManager.cs
+++ b/Modules/BetterNotificationManager.cs
@@ -6,13 +6,15 @@ namespace BetterAmongUs;
class BetterNotificationManager
{
public static GameObject BAUNotificationManagerObj;
- private static Dictionary NotifyQueue = [];
- private static float showTime = 0f;
+ public static Dictionary NotifyQueue = [];
+ public static float showTime = 0f;
private static Camera localCamera;
- private static bool Notifying = false;
+ public static bool Notifying = false;
public static void Notify(string text, float Time = 5f)
{
+ if (!Main.BetterNotifications.Value) return;
+
if (BAUNotificationManagerObj != null)
{
if (Notifying)
@@ -46,8 +48,7 @@ class BetterNotificationManager
if (GameStates.IsHost && kickPlayer)
{
- player.RpcSetName($"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: {reason}");
- AmongUsClient.Instance.KickPlayer(player.GetClientId(), true);
+ player.Kick(true, $"{player.Data.PlayerName} Has been banned by Anti-Cheat, Reason: {reason}");
}
Logger.LogCheat(Utils.GetRawText(text));
diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs
index 46d7b6a..8964638 100644
--- a/Modules/ExtendedPlayerControl.cs
+++ b/Modules/ExtendedPlayerControl.cs
@@ -103,14 +103,16 @@ static class ExtendedPlayerControl
// Kick player
public static void Kick(this PlayerControl player, bool ban = false, string setReasonInfo = "")
{
- if (!GameStates.IsHost || !player.DataIsCollected() || player.IsHost())
+ if (!GameStates.IsHost || !player.DataIsCollected() || player.IsHost() || player.BetterData().BannedByAntiCheat)
{
return;
}
+ player.BetterData().BannedByAntiCheat = true;
+
if (setReasonInfo != "")
{
- player.RpcSetName(setReasonInfo);
+ player.RpcSetName(setReasonInfo + "");
}
AmongUsClient.Instance.KickPlayer(player.GetClientId(), ban);
diff --git a/Modules/ExtendedPlayerInfo.cs b/Modules/ExtendedPlayerInfo.cs
index 88f0e52..c25dd0c 100644
--- a/Modules/ExtendedPlayerInfo.cs
+++ b/Modules/ExtendedPlayerInfo.cs
@@ -6,6 +6,7 @@ public class ExtendedPlayerInfo
public bool IsBetterUser { get; set; } = false;
public bool IsBetterHost { get; set; } = false;
public bool IsTOHEHost { get; set; } = false;
+ public bool BannedByAntiCheat { get; set; } = false;
public bool HasNoisemakerNotify { get; set; } = false;
public int TimesCalledMeeting { get; set; } = 0;
diff --git a/Modules/Utils.cs b/Modules/Utils.cs
index 273f645..0fc6afd 100644
--- a/Modules/Utils.cs
+++ b/Modules/Utils.cs
@@ -96,21 +96,29 @@ public static class Utils
public static string GetRoleName(RoleTypes role) => Main.GetRoleName[(int)role];
public static string Color32ToHex(Color32 color) => $"#{color.r:X2}{color.g:X2}{color.b:X2}{255:X2}";
// Disconnect client
- public static void DisconnectSelf(string reason)
+ public static void DisconnectSelf(string reason, bool showReason = true)
{
AmongUsClient.Instance.ExitGame(0);
_ = new LateTask(() =>
{
SceneChanger.ChangeScene("MainMenu");
- _ = new LateTask(() =>
+ if (showReason)
{
- var lines = "----------------------------------------------------------------------------------------------";
- DisconnectPopup.Instance.gameObject.SetActive(true);
- DisconnectPopup.Instance._textArea.enableWordWrapping = false;
- DisconnectPopup.Instance._textArea.text = $"{lines}\n\n\n{reason}\n\n\n{lines}";
- }, 0.1f, "DisconnectSelf 2");
+ _ = new LateTask(() =>
+ {
+ var lines = "----------------------------------------------------------------------------------------------";
+ ShowPopUp($"{lines}\n\n\n{reason}\n\n\n{lines}");
+ }, 0.1f, "DisconnectSelf 2");
+ }
}, 0.2f, "DisconnectSelf 1");
}
+ // Show dc pop up with text
+ public static void ShowPopUp(string text, bool enableWordWrapping = false)
+ {
+ DisconnectPopup.Instance.gameObject.SetActive(true);
+ DisconnectPopup.Instance._textArea.enableWordWrapping = enableWordWrapping;
+ DisconnectPopup.Instance._textArea.text = text;
+ }
public static Dictionary CachedSprites = [];
diff --git a/Patches/ClientOptionsPatch.cs b/Patches/ClientOptionsPatch.cs
index 5efd895..4ee396e 100644
--- a/Patches/ClientOptionsPatch.cs
+++ b/Patches/ClientOptionsPatch.cs
@@ -12,6 +12,7 @@ public static class OptionsMenuBehaviourPatch
private static ClientOptionItem AntiCheat;
private static ClientOptionItem BetterHost;
private static ClientOptionItem BetterRoleAlgorithma;
+ private static ClientOptionItem BetterNotifications;
private static ClientOptionItem LobbyPlayerInfo;
private static ClientOptionItem DisableLobbyTheme;
private static ClientOptionItem UnlockFPS;
@@ -65,6 +66,18 @@ public static class OptionsMenuBehaviourPatch
if (BetterRoleAlgorithma == null || BetterRoleAlgorithma.ToggleButton == null)
{
BetterRoleAlgorithma = ClientOptionItem.Create("Better Role Algorithma", Main.BetterRoleAlgorithma, __instance, toggleCheck: () => !toggleCheckInGamePlay("Better Role Algorithma"));
+ }
+
+ if (BetterNotifications == null || BetterNotifications.ToggleButton == null)
+ {
+ BetterNotifications = ClientOptionItem.Create("Better Notifications", Main.BetterNotifications, __instance, BetterNotificationsToggle);
+
+ static void BetterNotificationsToggle()
+ {
+ BetterNotificationManager.NotifyQueue.Clear();
+ BetterNotificationManager.showTime = 0f;
+ BetterNotificationManager.Notifying = false;
+ }
}
if (LobbyPlayerInfo == null || LobbyPlayerInfo.ToggleButton == null)
diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs
index ede102a..24ae031 100644
--- a/Patches/ClientPatch.cs
+++ b/Patches/ClientPatch.cs
@@ -6,6 +6,45 @@ namespace BetterAmongUs.Patches;
public class ClientPatch
{
+ // Show warning message for newer and older versions of among us
+ [HarmonyPatch(typeof(EOSManager))]
+ public class EOSManagerPatch
+ {
+ [HarmonyPatch(nameof(EOSManager.EndFinalPartsOfLoginFlow))]
+ [HarmonyPostfix]
+ public static void EndFinalPartsOfLoginFlow_Postfix()
+ {
+ var varSupportedVersions = Main.SupportedAmongUsVersions;
+ Version currentVersion = new Version(Main.AmongUsVersion);
+ Version firstSupportedVersion = new Version(varSupportedVersions.First());
+ Version lastSupportedVersion = new Version(varSupportedVersions.Last());
+
+ if (currentVersion > firstSupportedVersion)
+ {
+ var verText = $"{varSupportedVersions.First()}";
+ if (firstSupportedVersion != lastSupportedVersion)
+ {
+ verText = $"{varSupportedVersions.Last()} - {varSupportedVersions.First()}";
+ }
+ Utils.ShowPopUp($"-= Warning =-\n\n" +
+ $"Better Among Us {Main.GetVersionText()}\nsupports Among Us {verText},\n" +
+ $"Among Us {Main.AmongUsVersion} is above the supported versions!\n" +
+ $"You may encounter minor to game breaking bugs.");
+ }
+ else if (currentVersion < lastSupportedVersion)
+ {
+ var verText = $"{varSupportedVersions.First()}";
+ if (firstSupportedVersion != lastSupportedVersion)
+ {
+ verText = $"{varSupportedVersions.Last()} - {varSupportedVersions.First()}";
+ }
+ Utils.ShowPopUp($"-= Warning =-\n\n" +
+ $"Better Among Us {Main.GetVersionText()}\nsupports Among Us {verText},\n" +
+ $"Among Us {Main.AmongUsVersion} is below the supported versions!\n" +
+ $"You may encounter minor to game breaking bugs.");
+ }
+ }
+ }
// Log game exit
[HarmonyPatch(typeof(AmongUsClient))]
public class AmongUsClientPatch
diff --git a/Patches/CommandsPatch.cs b/Patches/CommandsPatch.cs
index 817e907..7a8dad5 100644
--- a/Patches/CommandsPatch.cs
+++ b/Patches/CommandsPatch.cs
@@ -21,7 +21,7 @@ class CommandsPatch
{
"help---Get help with commands",
"commands---Get a list of all available commands",
- "dump---Dump at the entire log to the user's desktop",
+ "dump---Dump the entire log to the user's desktop",
"player {id}---Get a Players information---{player id}",
"players---Get all Player information",
"whisper {id} {msg}---Privately send an message to a player---{player id}",
@@ -32,10 +32,11 @@ class CommandsPatch
"ban {id}---Ban a player from the game - Host Only---{player id}",
"endgame {reason}---Force end the game - Host Only---{player id}",
"removeplayer {identifier}---Remove player from local Anti-Cheat data---{FriendCode, HashPuid}",
+ "removeall---Remove all players from local Anti-Cheat data",
};
public static string[] DebugCommandListHelper =
{
- "getposition---Get current player position",
+ "getposition---Get current player position - DeBug",
"role {role}---Set your role for the next game - Host Only - DeBug",
"setrole {id} {role}---Set another players role for the next game - Host Only - DeBug",
"syncallnames---Sync all players names for better host - Host Only - DeBug",
@@ -272,6 +273,10 @@ class CommandsPatch
}
}
break;
+ case "removeall":
+ BetterDataManager.ClearCheatData();
+ Utils.AddChatPrivate($"All data successfully removed from local Anti-Cheat!");
+ break;
default:
if (GameStates.IsDev && Main.ReleaseBuildType == ReleaseTypes.Dev)
{
diff --git a/Patches/MainMenuPatch.cs b/Patches/MainMenuPatch.cs
index df66784..d9d1e11 100644
--- a/Patches/MainMenuPatch.cs
+++ b/Patches/MainMenuPatch.cs
@@ -28,9 +28,7 @@ internal class MainMenuPatch
var icon = "♻";
var warning = "⚠";
FileChecker.HasShownPopUp = true;
- DisconnectPopup.Instance.gameObject.SetActive(true);
- DisconnectPopup.Instance._textArea.enableWordWrapping = false;
- DisconnectPopup.Instance._textArea.text = $"{lines}\n{icon}Better Among Us{icon}\n{warning}{FileChecker.UnauthorizedReason}{warning}\n\n\n{OnlineMsg}\n{lines}";
+ Utils.ShowPopUp($"{lines}\n{icon}Better Among Us{icon}\n{warning}{FileChecker.UnauthorizedReason}{warning}\n\n\n{OnlineMsg}\n{lines}");
}
}
}
diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs
index 4914fb4..26f39f5 100644
--- a/Patches/PlayerControlPatch.cs
+++ b/Patches/PlayerControlPatch.cs
@@ -106,7 +106,10 @@ class PlayerControlPatch
string pattern = @"^[a-zA-Z0-9#]+$";
string hashtagPattern = @"^#[0-9]{4}$";
string friendCode = player.Data.FriendCode;
- string friendCodeColor = (Regex.Replace(friendCode, hashtagPattern, string.Empty).Length is > 10 or < 5 || !Regex.IsMatch(friendCode, pattern) || !Regex.IsMatch(friendCode, hashtagPattern)) ? "#00f7ff" : "#ff0000";
+ string friendCodeColor = (Regex.Replace(friendCode, hashtagPattern, string.Empty).Length is > 10 or < 5
+ || !Regex.IsMatch(friendCode, pattern)
+ || !Regex.IsMatch(friendCode, hashtagPattern)
+ || friendCode.Contains(' ')) ? "#00f7ff" : "#ff0000";
if (string.IsNullOrEmpty(friendCode) || friendCode == "")
{
friendCode = "???";
diff --git a/Patches/PlayerJoinAndLeftPatch.cs b/Patches/PlayerJoinAndLeftPatch.cs
index dc8a3f7..4b55074 100644
--- a/Patches/PlayerJoinAndLeftPatch.cs
+++ b/Patches/PlayerJoinAndLeftPatch.cs
@@ -78,10 +78,10 @@ class OnPlayerLeftPatch
if ((GameStates.IsInGame || GameStates.IsFreePlay) && !GameStates.IsLobby && !GameStates.IsHideNSeek && HudManager.Instance.CrewmatesKilled.isActiveAndEnabled)
HudManager.Instance?.NotifyOfDisconnect(data.Character);
}
-}
+}
[HarmonyPatch(typeof(GameData), nameof(GameData.ShowNotification))]
-class GameDataPatch
+class GameDataShowNotificationPatch
{
public static bool Prefix(AmongUsClient __instance, ref string playerName, ref DisconnectReasons reason)
{
diff --git a/Patches/RoleManagerPatch.cs b/Patches/RoleManagerPatch.cs
index 7bfcb8d..743edcf 100644
--- a/Patches/RoleManagerPatch.cs
+++ b/Patches/RoleManagerPatch.cs
@@ -2,7 +2,7 @@
using HarmonyLib;
using Hazel;
-namespace BetterAmongUs;
+namespace BetterAmongUs.Patches;
[HarmonyPatch(typeof(RoleManager))]
public class RoleManagerPatch
diff --git a/main.cs b/main.cs
index b6183f0..faa8569 100644
--- a/main.cs
+++ b/main.cs
@@ -5,6 +5,8 @@ using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Innersloth.IO;
+using System.Security.Cryptography;
+using System.Text;
using UnityEngine;
namespace BetterAmongUs;
@@ -22,14 +24,43 @@ public class Main : BasePlugin
{
public const ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
public const string CanaryNum = "0";
- public const string HotfixNum = "3";
- public const bool IsHotFix = true;
+ public const string HotfixNum = "0";
+ public const bool IsHotFix = false;
public const string PluginGuid = "com.d1gq.betteramongus";
- public const string PluginVersion = "1.0.0";
- public const string ReleaseDate = "08.11.2024"; // mm/dd/yyyy
+ public const string PluginVersion = "1.0.1";
+ public const string ReleaseDate = "08.13.2024"; // mm/dd/yyyy
public const string Github = "https://github.com/D1GQ/BetterAmongUs-Public";
public const string Discord = "https://discord.gg/vjYrXpzNAn";
+ public static string modSignature
+ {
+ get
+ {
+ string GetHash(string puid)
+ {
+ using SHA256 sha256 = SHA256.Create();
+ byte[] sha256Bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(puid));
+ string sha256Hash = BitConverter.ToString(sha256Bytes).Replace("-", "").ToLower();
+ return sha256Hash.Substring(0, 16) + sha256Hash.Substring(sha256Hash.Length - 8);
+ }
+
+ var versionData = new StringBuilder()
+ .Append(Enum.GetName(typeof(ReleaseTypes), ReleaseBuildType))
+ .Append(CanaryNum)
+ .Append(HotfixNum)
+ .Append(PluginGuid)
+ .Append(GetVersionText().Replace(" ", "."))
+ .Append(ReleaseDate)
+ .Append(Github)
+ .Append(Discord)
+ .Append(string.Join(",", Enum.GetNames(typeof(CustomRPC))))
+ .Append(string.Join(",", GetRoleName.Values))
+ .ToString();
+
+ return GetHash(versionData);
+ }
+ }
+
public static string GetVersionText(bool newLine = false)
{
string text = string.Empty;
@@ -55,6 +86,7 @@ public class Main : BasePlugin
public static List SupportedAmongUsVersions =
[
+ "2024.8.13",
"2024.6.18",
];
@@ -128,6 +160,7 @@ public class Main : BasePlugin
public static ConfigEntry AntiCheat { get; private set; }
public static ConfigEntry BetterHost { get; private set; }
public static ConfigEntry BetterRoleAlgorithma { get; private set; }
+ public static ConfigEntry BetterNotifications { get; private set; }
public static ConfigEntry LobbyPlayerInfo { get; private set; }
public static ConfigEntry DisableLobbyTheme { get; private set; }
public static ConfigEntry UnlockFPS { get; private set; }
@@ -138,6 +171,7 @@ public class Main : BasePlugin
AntiCheat = Config.Bind("Better Options", "AntiCheat", true);
BetterHost = Config.Bind("Better Options", "BetterHost", false);
BetterRoleAlgorithma = Config.Bind("Better Options", "BetterRoleAlgorithma", true);
+ BetterNotifications = Config.Bind("Better Options", "BetterNotifications", true);
LobbyPlayerInfo = Config.Bind("Better Options", "LobbyPlayerInfo", true);
DisableLobbyTheme = Config.Bind("Better Options", "DisableLobbyTheme", true);
UnlockFPS = Config.Bind("Better Options", "UnlockFPS", false);