From e7dea7e8fc1fea49857332315d35e6f58113229d Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sat, 3 Aug 2024 23:04:06 -0500 Subject: [PATCH 01/29] update discord link --- main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cs b/main.cs index 23242da..861e578 100644 --- a/main.cs +++ b/main.cs @@ -29,7 +29,7 @@ public class Main : BasePlugin public const string PluginVersion = "1.0.0"; public const string ReleaseDate = "08.01.2024"; // mm/dd/yyyy public const string Github = "https://github.com/D1GQ/BetterAmongUs"; - public const string Discord = "https://discord.gg/a3eVJHp9p5"; + public const string Discord = "https://discord.gg/vjYrXpzNAn"; public static string GetVersionText(bool newLine = false) { From 022d1626d6a9d1a764b0519dd8d3870038241c37 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 4 Aug 2024 03:32:48 -0500 Subject: [PATCH 02/29] fix button pos --- Patches/MainMenuPatch.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Patches/MainMenuPatch.cs b/Patches/MainMenuPatch.cs index 0f9ed01..7c43d6e 100644 --- a/Patches/MainMenuPatch.cs +++ b/Patches/MainMenuPatch.cs @@ -99,8 +99,8 @@ internal class MainMenuPatch UnityEngine.Object.Destroy(button.GetComponent()); for (int i = 0; i < buttons.ToList().Count; i++) { - float baseY = -2.7182f; - float newY = baseY + (0.35f * i); + float baseY = -2.7882f; + float newY = baseY + (0.38f * i); button.transform.localPosition = new(-0.8118f, newY, -5f); button.transform.localScale = new(0.78f, 0.78f, 0.78f); } From 65d2f75d0c1e80f738aeebccaf4d27b20af36a38 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 4 Aug 2024 03:49:02 -0500 Subject: [PATCH 03/29] better anti platform spoof --- BetterAmongUs.csproj | 4 ++++ Modules/AntiCheat.cs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BetterAmongUs.csproj b/BetterAmongUs.csproj index 28c3d0e..036d25f 100644 --- a/BetterAmongUs.csproj +++ b/BetterAmongUs.csproj @@ -30,4 +30,8 @@ + + + + diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index d520d55..6f446a6 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -96,7 +96,7 @@ class AntiCheat { if (__instance.Platform is Platforms.StandaloneWin10 or Platforms.Xbox) { - if (__instance.XboxPlatformId == 0) + if (__instance.XboxPlatformId.ToString().Length < 16) { BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); } @@ -104,7 +104,7 @@ class AntiCheat if (__instance.Platform is Platforms.Playstation) { - if (__instance.PsnPlatformId == 0) + if (__instance.PsnPlatformId.ToString().Length < 19) { BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); } From fa0e4aebda7065be3e97ff6544230da92185159d Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 4 Aug 2024 03:50:19 -0500 Subject: [PATCH 04/29] oops --- BetterAmongUs.csproj | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/BetterAmongUs.csproj b/BetterAmongUs.csproj index 036d25f..061642b 100644 --- a/BetterAmongUs.csproj +++ b/BetterAmongUs.csproj @@ -29,9 +29,5 @@ - - - - - + From 75e550fcca4582200df63b679ccd063368ce93b0 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 4 Aug 2024 03:53:55 -0500 Subject: [PATCH 05/29] fix --- Modules/AntiCheat.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 6f446a6..74548c2 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -96,7 +96,7 @@ class AntiCheat { if (__instance.Platform is Platforms.StandaloneWin10 or Platforms.Xbox) { - if (__instance.XboxPlatformId.ToString().Length < 16) + if (__instance.XboxPlatformId.ToString().Length is < 16 or > 17) { BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); } @@ -104,7 +104,7 @@ class AntiCheat if (__instance.Platform is Platforms.Playstation) { - if (__instance.PsnPlatformId.ToString().Length < 19) + if (__instance.PsnPlatformId.ToString().Length is < 19 or > 20) { BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); } From 4c3b5b99e3d00306efc66bc4167174e37157a34d Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 4 Aug 2024 06:49:48 -0500 Subject: [PATCH 06/29] report player --- Modules/AntiCheat.cs | 17 +++++++++-------- Modules/ExtendedPlayerControl.cs | 11 +++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 74548c2..7ec4666 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -96,17 +96,19 @@ class AntiCheat { if (__instance.Platform is Platforms.StandaloneWin10 or Platforms.Xbox) { - if (__instance.XboxPlatformId.ToString().Length is < 16 or > 17) + if (__instance.XboxPlatformId.ToString().Length != 16) { - BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); + player.ReportPlayer(ReportReasons.Cheating_Hacking); + BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); } } if (__instance.Platform is Platforms.Playstation) { - if (__instance.PsnPlatformId.ToString().Length is < 19 or > 20) + if (__instance.PsnPlatformId.ToString().Length != 19) { - BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); + player.ReportPlayer(ReportReasons.Cheating_Hacking); + BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); } } } @@ -114,7 +116,6 @@ class AntiCheat } } - // Handle RPC before anti cheat detection public static void HandleRPCBeforeCheck(PlayerControl player, byte callId, MessageReader Oldreader) { @@ -130,7 +131,7 @@ class AntiCheat if (reader.BytesRemaining == 0 && !flag) { - AmongUsClient.Instance.ReportPlayer(player.GetClientId(), ReportReasons.Cheating_Hacking); + player.ReportPlayer(ReportReasons.Cheating_Hacking); SickoData[Utils.GetHashPuid(player)] = player.FriendCode; BetterDataManager.SaveCheatData(Utils.GetHashPuid(player), player.Data.FriendCode, player.Data.PlayerName, "sickoData", "Sicko Menu RPC"); BetterNotificationManager.NotifyCheat(player, $"Sicko Menu", newText: "Has been detected with a cheat client"); @@ -152,7 +153,7 @@ class AntiCheat if (!flag) { - AmongUsClient.Instance.ReportPlayer(player.GetClientId(), ReportReasons.Cheating_Hacking); + player.ReportPlayer(ReportReasons.Cheating_Hacking); AUMData[Utils.GetHashPuid(player)] = player.FriendCode; BetterDataManager.SaveCheatData(Utils.GetHashPuid(player), player.Data.FriendCode, player.Data.PlayerName, "aumData", "AUM RPC"); BetterNotificationManager.NotifyCheat(player, $"AUM", newText: "Has been detected with a cheat client"); @@ -183,7 +184,7 @@ class AntiCheat if (!flag && !flag2) { - AmongUsClient.Instance.ReportPlayer(player.GetClientId(), ReportReasons.Cheating_Hacking); + player.ReportPlayer(ReportReasons.Cheating_Hacking); AUMData[Utils.GetHashPuid(AUMPlayer)] = AUMPlayer.FriendCode; BetterDataManager.SaveCheatData(Utils.GetHashPuid(player), player.Data.FriendCode, player.Data.PlayerName, "aumData", "AUM Chat RPC"); BetterNotificationManager.NotifyCheat(AUMPlayer, $"AUM", newText: "Has been detected with a cheat client"); diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 079bc41..493e249 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -170,4 +170,15 @@ static class ExtendedPlayerControl // Check if player is the host public static bool IsHost(this PlayerControl player) => player?.Data != null && GameData.Instance?.GetHost()?.Puid == player.Data.Puid; + // Report player + public static void ReportPlayer(this PlayerControl player, ReportReasons reason = ReportReasons.None) + { + if (player != null) + { + if (!player.GetClient().HasBeenReported) + { + AmongUsClient.Instance.ReportPlayer(player.GetClientId(), reason); + } + } + } } From 564daf522b431c8cc20dbc4388466d4e3a1401d3 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 4 Aug 2024 07:11:05 -0500 Subject: [PATCH 07/29] fixes --- Patches/ChatPatch.cs | 1 + Patches/PlayerControlPatch.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/Patches/ChatPatch.cs b/Patches/ChatPatch.cs index 154774d..c6b92f4 100644 --- a/Patches/ChatPatch.cs +++ b/Patches/ChatPatch.cs @@ -123,6 +123,7 @@ class ChatPatch ChatBubble pooledBubble = __instance.GetPooledBubble(); try { + chatText = chatText.Replace("\n", ""); pooledBubble.transform.SetParent(__instance.scroller.Inner); pooledBubble.transform.localScale = Vector3.one; bool flag = sourcePlayer == PlayerControl.LocalPlayer; diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 2c32b49..374d5de 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -1,5 +1,6 @@ using AmongUs.Data; using HarmonyLib; +using Hazel; using Il2CppSystem.Linq; using LibCpp2IL; using System.Text; @@ -218,6 +219,19 @@ class PlayerControlPatch } } + [HarmonyPatch(nameof(PlayerControl.SetColor))] + [HarmonyPostfix] + public static void SetColor_Postfix() + { + if (Main.BetterHost.Value && GameStates.IsLobby) + { + _ = new LateTask(() => + { + RPC.SyncAllNames(force: true); + }, 0.25f, shoudLog: false); + } + } + [HarmonyPatch(nameof(PlayerControl.MurderPlayer))] [HarmonyPostfix] public static void MurderPlayer_Postfix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target) From b0c5251341d105bbb662564bfb044e781844efda Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sun, 4 Aug 2024 23:57:39 -0500 Subject: [PATCH 08/29] remove EOSPatch --- Patches/EOSManagerPatch.cs | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 Patches/EOSManagerPatch.cs diff --git a/Patches/EOSManagerPatch.cs b/Patches/EOSManagerPatch.cs deleted file mode 100644 index c2a58a6..0000000 --- a/Patches/EOSManagerPatch.cs +++ /dev/null @@ -1,15 +0,0 @@ -using HarmonyLib; - -namespace BetterAmongUs.Patches; - -[HarmonyPatch(typeof(EOSManager))] -public class EOSManagerPatch -{ - [HarmonyPatch(nameof(EOSManager.Update))] - [HarmonyPostfix] - public static void Postfix(EOSManager __instance) - { - __instance.ageOfConsent = 21; - __instance.isKWSMinor = false; - } -} From f09e3c57d23335ba22f790032f91169a5c77b5dc Mon Sep 17 00:00:00 2001 From: D1GQ Date: Mon, 5 Aug 2024 21:01:53 -0500 Subject: [PATCH 09/29] AntiCheat log more info --- Modules/AntiCheat.cs | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 7ec4666..53d049d 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -3,6 +3,8 @@ using HarmonyLib; using Hazel; using InnerNet; using UnityEngine; +using static Logger; +using static UnityEngine.GraphicsBuffer; namespace BetterAmongUs; @@ -212,7 +214,10 @@ class AntiCheat if (callId is (byte)RpcCalls.SendChat or (byte)RpcCalls.SendQuickChat) { if (player.IsAlive() && GameStates.IsInGamePlay && !GameStates.IsMeeting && !GameStates.IsExilling) + { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.IsAlive()} - {GameStates.IsInGamePlay} - {!GameStates.IsMeeting} - {!GameStates.IsExilling}"); + } return; } @@ -220,7 +225,10 @@ class AntiCheat if (callId is (byte)RpcCalls.EnterVent or (byte)RpcCalls.ExitVent) { if ((!player.IsImpostorTeam() && Role != RoleTypes.Engineer) || player.Data.IsDead) + { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.IsImpostorTeam()} - {Role != RoleTypes.Engineer} - {player.Data.IsDead}"); + } return; } @@ -228,7 +236,10 @@ class AntiCheat if (callId is (byte)RpcCalls.ProtectPlayer) { if (Role is not RoleTypes.GuardianAngel) + { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {Role is not RoleTypes.GuardianAngel}"); + } return; } @@ -254,6 +265,8 @@ class AntiCheat if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || !target.IsAlive() || target.IsImpostorTeam() || condition) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} - {!player.IsAlive()} - {player.IsInVanish()}" + + $" - {!target.IsAlive()} - {target.IsImpostorTeam()} - {condition}"); } } } @@ -269,9 +282,9 @@ class AntiCheat if (level >= 200) { BetterNotificationManager.NotifyCheat(player, $"Invalid Level: {level}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {level >= 200}"); } } - return; } @@ -283,6 +296,7 @@ class AntiCheat { byte Type = reader.ReadByte(); BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)} - {Enum.GetName((SystemTypes)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()}"); return; } @@ -297,6 +311,7 @@ class AntiCheat or (byte)SystemTypes.HeliSabotage) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)} - {Enum.GetName((SystemTypes)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()}"); } return; @@ -309,6 +324,7 @@ class AntiCheat if (callId is (byte)RpcCalls.CompleteTask or (byte)RpcCalls.BootFromVent) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.IsImpostorTeam()}"); return; } @@ -319,6 +335,7 @@ class AntiCheat if (player?.CurrentOutfit?.PetId == "pet_EmptyPet") { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player?.CurrentOutfit?.PetId == "pet_EmptyPet"}"); } return; @@ -355,6 +372,9 @@ class AntiCheat || player.inMovingPlat || player.onLadder || player.MyPhysics.Animations.IsPlayingAnyLadderAnimation()) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsMeeting} - {GameStates.IsHideNSeek} - {!player.IsAlive()} - {player.IsInVent()} - {player.shapeshifting}" + + $" - {player.inMovingPlat} - {player.onLadder} - {player.MyPhysics.Animations.IsPlayingAnyLadderAnimation()}"); + if (GameStates.IsHost) { return false; @@ -373,6 +393,7 @@ class AntiCheat if (!UnityEngine.Object.FindAnyObjectByType() || !deadPlayerInfo.IsDead || deadPlayerInfo == player.Data) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!UnityEngine.Object.FindAnyObjectByType()} - {!deadPlayerInfo.IsDead} - {deadPlayerInfo == player.Data}"); if (GameStates.IsHost) { return false; @@ -388,6 +409,8 @@ class AntiCheat if (ExtendedPlayerInfo.TimesCalledMeeting.TryGetValue(player, out var value) && value >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {ExtendedPlayerInfo.TimesCalledMeeting[player]} -> {GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}" + + $" - {ExtendedPlayerInfo.TimesCalledMeeting[player] >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}"); if (GameStates.IsHost) { return false; @@ -402,17 +425,20 @@ class AntiCheat if (callId is (byte)RpcCalls.Shapeshift) { + var target = reader.ReadNetObject(); var flag = reader.ReadBoolean(); if (Role is not RoleTypes.Shapeshifter || !player.IsAlive()) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {Role is not RoleTypes.Shapeshifter} - {!player.IsAlive()}"); return false; } - if (!flag && !player.IsInVent()) + if (!flag && (!player.IsInVent() || target == player)) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!flag} - {!player.IsInVent()} - {target == player}"); return false; } } @@ -422,8 +448,18 @@ class AntiCheat if (Role is not RoleTypes.Phantom || player.Data.IsDead) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 1: {Role is not RoleTypes.Phantom} - {player.Data.IsDead}"); return false; } + + if (callId is (byte)RpcCalls.StartVanish) + { + if (player.IsInVent()) + { + BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 2: {player.IsInVent()}"); + } + } } if (!player.IsHost()) @@ -433,6 +469,7 @@ class AntiCheat or (byte)RpcCalls.CloseMeeting) { BetterNotificationManager.NotifyCheat(player, $"Invalid Host RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsHost()}"); return false; } } @@ -442,6 +479,7 @@ class AntiCheat if (callId is (byte)RpcCalls.SetName or (byte)RpcCalls.CheckName or (byte)RpcCalls.SetLevel) { BetterNotificationManager.NotifyCheat(player, $"Invalid Set RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.DataIsCollected() == true}"); return false; } } @@ -456,6 +494,7 @@ class AntiCheat or (byte)RpcCalls.SetNamePlate) { BetterNotificationManager.NotifyCheat(player, $"Invalid Set RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsInGamePlay}"); return false; } } @@ -490,6 +529,7 @@ class AntiCheat or (byte)RpcCalls.CheckVanish) { BetterNotificationManager.NotifyCheat(player, $"Invalid Lobby RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsInGame} - {GameStates.IsLobby}"); return false; } } From 61ddc9fb0fe5702b8dae031020c50edf9f1acdd6 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 6 Aug 2024 00:29:55 -0500 Subject: [PATCH 10/29] Better player data management --- Modules/AntiCheat.cs | 52 ++++++--------------------------- Modules/BetterHostManager.cs | 11 +++---- Modules/ExtendedPlayerInfo.cs | 54 ++++++++++++++--------------------- Modules/GameState.cs | 2 +- Modules/RPC.cs | 6 ++-- Patches/ChatPatch.cs | 4 +-- Patches/PlayerControlPatch.cs | 20 +++++++++++-- Patches/RolePatch.cs | 5 ++-- 8 files changed, 59 insertions(+), 95 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 53d049d..46e0e2e 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -3,8 +3,6 @@ using HarmonyLib; using Hazel; using InnerNet; using UnityEngine; -using static Logger; -using static UnityEngine.GraphicsBuffer; namespace BetterAmongUs; @@ -17,31 +15,6 @@ class AntiCheat public static void Update() { - if (GameStates.IsInGamePlay) - { - foreach (var kvp in ExtendedPlayerInfo.TimeSinceKill) - { - ExtendedPlayerInfo.TimeSinceKill[kvp.Key] += Time.deltaTime; - } - } - else - { - if (ExtendedPlayerInfo.TimeSinceKill.Any()) - { - ExtendedPlayerInfo.TimeSinceKill.Clear(); - } - - if (ExtendedPlayerInfo.TimesCalledMeeting.Any()) - { - ExtendedPlayerInfo.TimesCalledMeeting.Clear(); - } - - if (ExtendedPlayerInfo.HasNoisemakerNotify.Any()) - { - ExtendedPlayerInfo.HasNoisemakerNotify.Clear(); - } - } - if (GameStates.IsHost && GameStates.IsInGame) { RPC.SyncAllNames(isBetterHost: false); @@ -205,7 +178,7 @@ class AntiCheat { MessageReader reader = MessageReader.Get(Oldreader); - if (PlayerControl.LocalPlayer == null || player == null || player == PlayerControl.LocalPlayer || player.GetIsBetterHost() || reader == null || !IsEnabled || !Main.AntiCheat.Value) return; + if (PlayerControl.LocalPlayer == null || player == null || player == PlayerControl.LocalPlayer || player.BetterData().IsBetterHost || reader == null || !IsEnabled || !Main.AntiCheat.Value) return; RoleTypes? Role = player?.Data?.RoleType; Role ??= RoleTypes.Crewmate; @@ -246,27 +219,18 @@ class AntiCheat if (callId is (byte)RpcCalls.MurderPlayer) { - bool condition = false; - - if (ExtendedPlayerInfo.TimeSinceKill.TryGetValue(player, out var value)) - { - if (value < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown) - { - condition = true; - } - } - if (reader.BytesRemaining > 0) { PlayerControl target = reader.ReadNetObject(); if (target != null) { - if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || !target.IsAlive() || target.IsImpostorTeam() || condition) + if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || !target.IsAlive() || target.IsImpostorTeam() + || player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} - {!player.IsAlive()} - {player.IsInVanish()}" + - $" - {!target.IsAlive()} - {target.IsImpostorTeam()} - {condition}"); + $" - {!target.IsAlive()} - {target.IsImpostorTeam()} - {player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown}"); } } } @@ -354,7 +318,7 @@ class AntiCheat { MessageReader reader = MessageReader.Get(Oldreader); - if (PlayerControl.LocalPlayer == null || player == null || player == PlayerControl.LocalPlayer || player.GetIsBetterHost() || reader == null || !IsEnabled || !Main.AntiCheat.Value) return true; + if (PlayerControl.LocalPlayer == null || player == null || player == PlayerControl.LocalPlayer || player.BetterData().IsBetterHost || reader == null || !IsEnabled || !Main.AntiCheat.Value) return true; RoleTypes Role = player.Data.RoleType; bool IsImpostor = player.IsImpostorTeam(); @@ -406,11 +370,11 @@ class AntiCheat } else { - if (ExtendedPlayerInfo.TimesCalledMeeting.TryGetValue(player, out var value) && value >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings) + if (player.BetterData().TimesCalledMeeting >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); - Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {ExtendedPlayerInfo.TimesCalledMeeting[player]} -> {GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}" + - $" - {ExtendedPlayerInfo.TimesCalledMeeting[player] >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.BetterData().TimesCalledMeeting} -> {GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}" + + $" - {player.BetterData().TimesCalledMeeting >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}"); if (GameStates.IsHost) { return false; diff --git a/Modules/BetterHostManager.cs b/Modules/BetterHostManager.cs index 07cbbaf..832dd79 100644 --- a/Modules/BetterHostManager.cs +++ b/Modules/BetterHostManager.cs @@ -99,12 +99,9 @@ class BetterHostManager bool condition = false; - if (ExtendedPlayerInfo.TimeSinceKill.TryGetValue(player, out var value)) + if (player.BetterData().TimeSinceKill >= GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown) { - if (value >= GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown) - { - condition = true; - } + condition = true; } if (target != null) @@ -246,7 +243,7 @@ class BetterHostManager foreach (PlayerControl target in Main.AllPlayerControls) { - if (target == null || target == PlayerControl.LocalPlayer || target.GetIsBetterUser()) continue; + if (target == null || target == PlayerControl.LocalPlayer || target.BetterData().IsBetterUser) continue; string NewName = player.CurrentOutfit.PlayerName; @@ -265,7 +262,7 @@ class BetterHostManager if (player == PlayerControl.LocalPlayer) sbTopTag.Append($"Better Host+++"); - else if (player.GetIsBetterUser()) + else if (player.BetterData().IsBetterUser) sbTopTag.Append("Better User+++"); } else if (GameStates.IsInGamePlay) diff --git a/Modules/ExtendedPlayerInfo.cs b/Modules/ExtendedPlayerInfo.cs index 857cb68..8f58cd6 100644 --- a/Modules/ExtendedPlayerInfo.cs +++ b/Modules/ExtendedPlayerInfo.cs @@ -1,38 +1,26 @@ - -namespace BetterAmongUs; +namespace BetterAmongUs; -static class ExtendedPlayerInfo +public class ExtendedPlayerInfo { - public static List HasNoisemakerNotify = []; - public static Dictionary TimeSinceKill = []; - public static Dictionary TimesCalledMeeting = []; - private static Dictionary IsBetterUser = new Dictionary(); - private static Dictionary IsBetterHost = new Dictionary(); + public bool IsBetterUser { get; set; } = false; + public bool IsBetterHost { get; set; } = false; + public bool HasNoisemakerNotify { get; set; } = false; + public float TimeSinceKill { get; set; } = 0; + public int TimesCalledMeeting { get; set; } = 0; - public static bool GetIsBetterUser(this PlayerControl player) - { - if (IsBetterUser.ContainsKey(player)) - return IsBetterUser[player]; - else - return false; - } - - public static bool GetIsBetterHost(this PlayerControl player) - { - if (player.IsHost() && IsBetterHost.ContainsKey(player)) - return IsBetterHost[player]; - else - return false; - } - - public static void SetIsBetterUser(this PlayerControl player, bool value) - { - IsBetterUser[player] = value; - } - - public static void SetIsBetterHost(this PlayerControl player, bool value) - { - IsBetterHost[player] = value; - } } +public static class PlayerControlExtensions +{ + private static readonly Dictionary playerInfo = []; + + public static ExtendedPlayerInfo BetterData(this PlayerControl player) + { + if (!playerInfo.ContainsKey(player)) + { + playerInfo[player] = new ExtendedPlayerInfo(); + } + + return playerInfo[player]; + } +} diff --git a/Modules/GameState.cs b/Modules/GameState.cs index a5a8340..066a98f 100644 --- a/Modules/GameState.cs +++ b/Modules/GameState.cs @@ -45,7 +45,7 @@ public static class GameStates public static bool IsCountDown => GameStartManager.InstanceExists && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown; public static bool IsShip => ShipStatus.Instance != null; public static bool IsHost => AmongUsClient.Instance != null && AmongUsClient.Instance.AmHost; - public static bool IsBetterHostLobby => (PlayerControl.LocalPlayer.IsHost() && Main.BetterHost.Value) || Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.GetIsBetterHost()); + public static bool IsBetterHostLobby => (PlayerControl.LocalPlayer.IsHost() && Main.BetterHost.Value) || Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.BetterData().IsBetterHost); public static bool IsCanMove => PlayerControl.LocalPlayer?.CanMove is true; public static bool IsDead => PlayerControl.LocalPlayer?.Data?.IsDead is true; } diff --git a/Modules/RPC.cs b/Modules/RPC.cs index 3c73313..5adf068 100644 --- a/Modules/RPC.cs +++ b/Modules/RPC.cs @@ -86,7 +86,7 @@ internal static class RPC { if (!GameStates.IsHost) return; - if (player.GetIsBetterUser()) + if (player.BetterData().IsBetterUser) { if (sendToBetterUser) { @@ -148,8 +148,8 @@ internal static class RPC break; } - player.SetIsBetterUser(true); - player.SetIsBetterHost(IsBetterHost); + player.BetterData().IsBetterUser = true; + player.BetterData().IsBetterHost = IsBetterHost; } break; case (byte)CustomRPC.AddChat: diff --git a/Patches/ChatPatch.cs b/Patches/ChatPatch.cs index c6b92f4..10d4e5d 100644 --- a/Patches/ChatPatch.cs +++ b/Patches/ChatPatch.cs @@ -171,9 +171,9 @@ class ChatPatch if (sourcePlayer.IsDev()) sbTag.Append("Dev+++"); - if (((sourcePlayer == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || sourcePlayer.GetIsBetterHost() == true) && !GameStates.IsInGamePlay) + if (((sourcePlayer == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || sourcePlayer.BetterData().IsBetterHost) && !GameStates.IsInGamePlay) sbTag.Append("Better Host+++"); - else if ((sourcePlayer == PlayerControl.LocalPlayer || sourcePlayer.GetIsBetterUser() == true) && !GameStates.IsInGamePlay) + else if ((sourcePlayer == PlayerControl.LocalPlayer || sourcePlayer.BetterData().IsBetterUser) && !GameStates.IsInGamePlay) sbTag.Append("Better User+++"); if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.SickoData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.SickoData.ContainsValue(friendCode)) diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 374d5de..dbf2ad1 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -67,6 +67,20 @@ class PlayerControlPatch { BetterHostManager.Update(__instance); } + + if (GameStates.IsInGamePlay) + { + if (__instance.IsImpostorTeam()) + { + __instance.BetterData().TimeSinceKill += Time.deltaTime; + } + } + else + { + __instance.BetterData().TimeSinceKill = 0f; + __instance.BetterData().TimesCalledMeeting = 0; + __instance.BetterData().HasNoisemakerNotify = false; + } } public static void SetPlayerInfo(PlayerControl player) @@ -112,9 +126,9 @@ class PlayerControlPatch if (player.IsDev() && !GameStates.IsInGamePlay) sbTag.Append("(Dev)+++"); - if (((player == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || player.GetIsBetterHost() == true) && !GameStates.IsInGamePlay) + if (((player == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || player.BetterData().IsBetterHost) && !GameStates.IsInGamePlay) sbTag.Append("Better Host+++"); - else if ((player == PlayerControl.LocalPlayer || player.GetIsBetterUser() == true) && !GameStates.IsInGamePlay) + else if ((player == PlayerControl.LocalPlayer || player.BetterData().IsBetterUser) && !GameStates.IsInGamePlay) sbTag.Append("Better User+++"); if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.SickoData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.SickoData.ContainsValue(friendCode)) @@ -241,7 +255,7 @@ class PlayerControlPatch if (PlayerControl.LocalPlayer.IsImpostorTeam() && GameStates.IsInGamePlay && !GameStates.IsHideNSeek && HudManager.Instance.CrewmatesKilled.isActiveAndEnabled) HudManager.Instance?.NotifyOfDeath(); - ExtendedPlayerInfo.TimeSinceKill[__instance] = 0f; + __instance.BetterData().TimeSinceKill = 0f; Logger.LogPrivate($"{__instance.Data.PlayerName} Has killed {target.Data.PlayerName} as {Utils.GetRoleName(__instance.Data.RoleType)}", "EventLog"); } diff --git a/Patches/RolePatch.cs b/Patches/RolePatch.cs index 34cc7d5..ecfd18e 100644 --- a/Patches/RolePatch.cs +++ b/Patches/RolePatch.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using Rewired; namespace BetterAmongUs.Patches; @@ -11,12 +12,12 @@ class RolePatch [HarmonyPrefix] public static bool NotifyOfDeath_Prefix(NoisemakerRole __instance) { - if (ExtendedPlayerInfo.HasNoisemakerNotify.Contains(__instance.Player)) + if (__instance.Player.BetterData().HasNoisemakerNotify) { return false; } - ExtendedPlayerInfo.HasNoisemakerNotify.Add(__instance.Player); + __instance.Player.BetterData().HasNoisemakerNotify = true; return true; } From 584152b8a4cf265a122c6ccc30160b8f1df52f3e Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 6 Aug 2024 01:14:11 -0500 Subject: [PATCH 11/29] Anti cheat improvements --- Modules/AntiCheat.cs | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 46e0e2e..08b854c 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -71,23 +71,25 @@ class AntiCheat { if (__instance.Platform is Platforms.StandaloneWin10 or Platforms.Xbox) { - if (__instance.XboxPlatformId.ToString().Length != 16) + if (__instance.XboxPlatformId.ToString().Length is < 10 or > 16) { 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"); + } } if (__instance.Platform is Platforms.Playstation) { - if (__instance.PsnPlatformId.ToString().Length != 19) + if (__instance.PsnPlatformId.ToString().Length is < 14 or > 20) { 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"); } } } - }, 1.5f, shoudLog: false); + }, 3.5f, shoudLog: false); } } @@ -225,12 +227,12 @@ class AntiCheat if (target != null) { - if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || !target.IsAlive() || target.IsImpostorTeam() + if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || target.IsImpostorTeam() || player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); - Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} - {!player.IsAlive()} - {player.IsInVanish()}" + - $" - {!target.IsAlive()} - {target.IsImpostorTeam()} - {player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} - {player.IsInVanish()}" + + $" - {!target.IsAlive()} - {target.IsImpostorTeam()} - {player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown - 2.5f}"); } } } @@ -391,18 +393,26 @@ class AntiCheat { var target = reader.ReadNetObject(); var flag = reader.ReadBoolean(); + bool ShapeshiftAsTarget = target != player; if (Role is not RoleTypes.Shapeshifter || !player.IsAlive()) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); - Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {Role is not RoleTypes.Shapeshifter} - {!player.IsAlive()}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 1: {Role is not RoleTypes.Shapeshifter} - {!player.IsAlive()}"); return false; } - if (!flag && (!player.IsInVent() || target == player)) + else if (ShapeshiftAsTarget && (GameStates.IsMeeting || GameStates.IsExilling) || !flag) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); - Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!flag} - {!player.IsInVent()} - {target == player}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 2: {GameStates.IsMeeting} - {GameStates.IsExilling} - {!flag}"); + return false; + } + + else if (!flag && !GameStates.IsMeeting && !GameStates.IsExilling && !player.IsInVent()) + { + BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 3: {!flag} - {!GameStates.IsMeeting} - {!GameStates.IsExilling} - {!player.IsInVent()}"); return false; } } From cde12ea993e698fe70870d4f707e23e0f189e8ac Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 6 Aug 2024 02:46:45 -0500 Subject: [PATCH 12/29] add NM --- Patches/CommandsPatch.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Patches/CommandsPatch.cs b/Patches/CommandsPatch.cs index e0a02db..fdb3602 100644 --- a/Patches/CommandsPatch.cs +++ b/Patches/CommandsPatch.cs @@ -313,6 +313,9 @@ class CommandsPatch case "tracker" or "7": role = RoleTypes.Tracker; break; + case "noisemaker" or "8": + role = RoleTypes.Noisemaker; + break; default: Utils.AddChatPrivate($"{error}\nInvalid RoleType!"); return; @@ -360,6 +363,9 @@ class CommandsPatch case "tracker" or "7": role = RoleTypes.Tracker; break; + case "noisemaker" or "8": + role = RoleTypes.Noisemaker; + break; default: Utils.AddChatPrivate($"{error}\nInvalid RoleType!"); return; From 5361406f09a1ccb49df9924e029e1e80f65b2553 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 6 Aug 2024 02:55:22 -0500 Subject: [PATCH 13/29] TOHE later support --- Modules/ExtendedPlayerInfo.cs | 3 ++- Modules/GameState.cs | 3 ++- Modules/RPC.cs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/ExtendedPlayerInfo.cs b/Modules/ExtendedPlayerInfo.cs index 8f58cd6..5671b75 100644 --- a/Modules/ExtendedPlayerInfo.cs +++ b/Modules/ExtendedPlayerInfo.cs @@ -4,8 +4,9 @@ public class ExtendedPlayerInfo { public bool IsBetterUser { get; set; } = false; public bool IsBetterHost { get; set; } = false; + public bool IsTOHEHost { get; set; } = false; public bool HasNoisemakerNotify { get; set; } = false; - public float TimeSinceKill { get; set; } = 0; + public float TimeSinceKill { get; set; } = 0f; public int TimesCalledMeeting { get; set; } = 0; } diff --git a/Modules/GameState.cs b/Modules/GameState.cs index 066a98f..e2532e9 100644 --- a/Modules/GameState.cs +++ b/Modules/GameState.cs @@ -45,7 +45,8 @@ public static class GameStates public static bool IsCountDown => GameStartManager.InstanceExists && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown; public static bool IsShip => ShipStatus.Instance != null; public static bool IsHost => AmongUsClient.Instance != null && AmongUsClient.Instance.AmHost; - public static bool IsBetterHostLobby => (PlayerControl.LocalPlayer.IsHost() && Main.BetterHost.Value) || Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.BetterData().IsBetterHost); + public static bool IsBetterHostLobby => (PlayerControl.LocalPlayer.IsHost() && Main.BetterHost.Value) || Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.BetterData().IsBetterHost); + public static bool IsTOHEHostLobby => Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.BetterData().IsTOHEHost); public static bool IsCanMove => PlayerControl.LocalPlayer?.CanMove is true; public static bool IsDead => PlayerControl.LocalPlayer?.Data?.IsDead is true; } diff --git a/Modules/RPC.cs b/Modules/RPC.cs index 5adf068..6f07b33 100644 --- a/Modules/RPC.cs +++ b/Modules/RPC.cs @@ -158,6 +158,7 @@ internal static class RPC case (byte)CustomRPC.VersionCheck or (byte)CustomRPC.RequestRetryVersionCheck: if (player.IsHost()) { + player.BetterData().IsTOHEHost = true; var BAU = "♻BetterAmongUs♻"; Utils.DisconnectSelf($"{BAU} does not support TOHE"); } From e74218a26134d63ffd88fb56c46ecec9c222061d Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 6 Aug 2024 23:32:29 -0500 Subject: [PATCH 14/29] Code optimizing --- Modules/AntiCheat.cs | 1 + Modules/ExtendedPlayerControl.cs | 5 + Patches/PlayerControlPatch.cs | 159 +++++++++++++------------------ 3 files changed, 73 insertions(+), 92 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 08b854c..42478b2 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -233,6 +233,7 @@ class AntiCheat BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} - {player.IsInVanish()}" + $" - {!target.IsAlive()} - {target.IsImpostorTeam()} - {player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown - 2.5f}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.BetterData().TimeSinceKill} < {GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown} or {GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown -2.5} -2.5"); } } } diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 493e249..c6af01e 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -70,6 +70,11 @@ static class ExtendedPlayerControl { if (player == null) return false; + if (player.isDummy) + { + return true; + } + if (player.gameObject.transform.Find("Names/NameText_TMP").GetComponent().text is "???" or "Player" or "Loading" or null || player.Data == null diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index dbf2ad1..61f5182 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -7,6 +7,7 @@ using System.Text; using System.Text.RegularExpressions; using TMPro; using UnityEngine; +using static UnityEngine.GraphicsBuffer; namespace BetterAmongUs.Patches; @@ -60,7 +61,7 @@ class PlayerControlPatch if (infotime <= 0) { SetPlayerInfo(__instance); - infotime = 0.6f; + infotime = 0.4f; } if (GameStates.IsInGame && GameStates.IsHost) @@ -87,14 +88,15 @@ class PlayerControlPatch { if (player == null || player.Data == null) return; - // Set player text info - if (player.DataIsCollected() != true) - { - if (player.gameObject.transform.Find("Names/NameText_TMP").GetComponent().text is "???" or "Player") - { - player.gameObject.transform.Find("Names/NameText_TMP").GetComponent().text = "Loading"; - } + var nameText = player.gameObject.transform.Find("Names/NameText_TMP").GetComponent(); + // Set player text info + if (!player.DataIsCollected()) + { + if (nameText.text is "???" or "Player") + { + nameText.text = "Loading"; + } return; } @@ -103,34 +105,24 @@ class PlayerControlPatch string NewName = player.Data.PlayerName; string hashPuid = Utils.GetHashPuid(player); - string friendCode = player.Data.FriendCode; - int playerId = player.PlayerId; - string Lv = " - Lv: " + player.Data.PlayerLevel.ToString() + ""; 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"; - if (string.IsNullOrEmpty(friendCode) || friendCode == "") friendCode = "???"; - if (DataManager.Settings.Gameplay.StreamerMode == true) friendCode = string.Concat('*').Repeat(friendCode.Length); - StringBuilder sbTag = new StringBuilder(); - StringBuilder sbInfo = new StringBuilder(); + var sbTag = new StringBuilder(); + var sbInfo = new StringBuilder(); + var sbTagTop = new StringBuilder(); + var sbInfoTop = new StringBuilder(); + var sbTagBottom = new StringBuilder(); + var sbInfoBottom = new StringBuilder(); // Put +++ at the end of each tag - - if (player.IsDev() && !GameStates.IsInGamePlay) - sbTag.Append("(Dev)+++"); - - if (((player == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || player.BetterData().IsBetterHost) && !GameStates.IsInGamePlay) - sbTag.Append("Better Host+++"); - else if ((player == PlayerControl.LocalPlayer || player.BetterData().IsBetterUser) && !GameStates.IsInGamePlay) - sbTag.Append("Better User+++"); - if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.SickoData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.SickoData.ContainsValue(friendCode)) sbTag.Append("Sicko User+++"); else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.AUMData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.AUMData.ContainsValue(friendCode)) @@ -138,101 +130,84 @@ class PlayerControlPatch else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.PlayerData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.PlayerData.ContainsValue(friendCode)) sbTag.Append("Known Cheater+++"); - if (GameStates.IsLobby && !GameStates.IsFreePlay) - sbTag.Append($"ID: {playerId}+++"); - - for (int i = 0; i < sbTag.ToString().Split("+++").Length; i++) + if (GameStates.IsInGame && GameStates.IsLobby && !GameStates.IsFreePlay) { - if (!string.IsNullOrEmpty(sbTag.ToString().Split("+++")[i])) + if (player.IsHost()) { - if (i < sbTag.ToString().Split("+++").Length) + if (Main.LobbyPlayerInfo.Value == true) { - sbInfo.Append(sbTag.ToString().Split("+++")[i]); - } - if (i != sbTag.ToString().Split("+++").Length - 2) - { - sbInfo.Append(" - "); + NewName = player.GetPlayerNameAndColor(); } } + + if (player.IsDev() && !GameStates.IsInGamePlay) + sbTag.Append("(Dev)+++"); + if (((player == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || player.BetterData().IsBetterHost) && !GameStates.IsInGamePlay) + sbTag.Append("Better Host+++"); + else if ((player == PlayerControl.LocalPlayer || player.BetterData().IsBetterUser) && !GameStates.IsInGamePlay) + sbTag.Append("Better User+++"); + sbTag.Append($"ID: {player.PlayerId}+++"); + + sbTagTop.Append($"{Utils.GetPlatformName(player, useTag: true)}+++"); + sbTagTop.Append($"Lv: {player.Data.PlayerLevel.ToString()}+++"); + + sbTagBottom.Append($"{friendCode}+++"); + } + else if (GameStates.IsInGame || GameStates.IsFreePlay) + { + if (player.IsImpostorTeammate() || player == PlayerControl.LocalPlayer || !PlayerControl.LocalPlayer.IsAlive() || DebugMenu.RevealRoles) + { + string Role = $"{player.GetRoleName()}"; + sbTagTop.Append($"{Role}+++"); + } } - PlayerControl Host = AmongUsClient.Instance.GetHost().Character; - if (player.IsHost() && GameStates.InGame && GameStates.IsLobby && !GameStates.IsFreePlay) - { - if (Main.LobbyPlayerInfo.Value == true) - { - NewName = player.GetPlayerNameAndColor(); - } - } if (player.IsImpostorTeammate() && player != PlayerControl.LocalPlayer) { NewName = $"{player.Data.PlayerName}"; } if (!player.IsInShapeshift()) - player.RawSetName(NewName); - - if (!GameStates.IsVanillaServer) { - friendCode = string.Empty; - Lv = string.Empty; + player.RawSetName(NewName); } - StringBuilder sbTag2 = new StringBuilder(); - StringBuilder sbInfo2 = new StringBuilder(); + if (!Main.LobbyPlayerInfo.Value && GameStates.IsLobby) + { + player.ResetAllPlayerTextInfo(); + return; + } // Put +++ at the end of each tag - - sbTag2.Append($"{Utils.GetPlatformName(player, useTag: true)}"); // Don't put +++ here - sbTag2.Append($"{Lv}+++"); - - for (int i = 0; i < sbTag2.ToString().Split("+++").Length; i++) + void AppendTagInfo(StringBuilder source, StringBuilder destination) { - if (!string.IsNullOrEmpty(sbTag2.ToString().Split("+++")[i])) + if (source.Length > 0) { - if (i < sbTag2.ToString().Split("+++").Length) + string[] parts = source.ToString().Split("+++"); + for (int i = 0; i < parts.Length; i++) { - sbInfo2.Append(sbTag2.ToString().Split("+++")[i]); - } - if (i != sbTag2.ToString().Split("+++").Length - 2) - { - sbInfo2.Append(" - "); - } - } - } - - if (GameStates.IsLobby && !GameStates.IsFreePlay) - { - if (Main.LobbyPlayerInfo.Value == true) - { - player.SetPlayerTextInfo($"{sbInfo}", isInfo: true); - player.SetPlayerTextInfo($"{sbInfo2}"); - player.SetPlayerTextInfo($"{friendCode}", isBottom: true); - } - else - { - player.ResetAllPlayerTextInfo(); - } - } - else - { - string Role = $"{player.GetRoleName()}"; - if (!player.IsImpostorTeammate()) - { - if (PlayerControl.LocalPlayer != null && PlayerControl.LocalPlayer.IsAlive() && player != PlayerControl.LocalPlayer) - { - if (!DebugMenu.RevealRoles) + if (!string.IsNullOrEmpty(parts[i])) { - Role = ""; + destination.Append(parts[i]); + if (i != parts.Length - 2) + { + destination.Append(" - "); + } } } } - player.SetPlayerTextInfo($"{sbInfo}", isInfo: true); - player.SetPlayerTextInfo($"{Role}"); - player.SetPlayerTextInfo("", isBottom: true); } + + AppendTagInfo(sbTag, sbInfo); + AppendTagInfo(sbTagTop, sbInfoTop); + AppendTagInfo(sbTagBottom, sbInfoBottom); + + player.SetPlayerTextInfo(sbInfo.ToString(), isInfo: true); + player.SetPlayerTextInfo(sbInfoTop.ToString()); + player.SetPlayerTextInfo(sbInfoBottom.ToString(), isBottom: true); } + [HarmonyPatch(nameof(PlayerControl.SetColor))] [HarmonyPostfix] public static void SetColor_Postfix() From ec31576b841882213d241fcd3f2b739acfae758b Mon Sep 17 00:00:00 2001 From: D1GQ Date: Tue, 6 Aug 2024 23:42:59 -0500 Subject: [PATCH 15/29] more optimizations --- Modules/ExtendedPlayerControl.cs | 24 +++++++-------- Patches/PlayerControlPatch.cs | 50 +++++++++++++++----------------- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index c6af01e..3c62609 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -34,29 +34,29 @@ static class ExtendedPlayerControl public static void SetPlayerTextInfo(this PlayerControl player, string text, bool isBottom = false, bool isInfo = false) { if (player == null) return; - GameObject playerbase = player.gameObject; - string InfoType = isBottom ? "InfoText_B_TMP" : "InfoText_T_TMP"; + + string infoType = isBottom ? "InfoText_B_TMP" : "InfoText_T_TMP"; if (isInfo) { - InfoType = "InfoText_Info_TMP"; - GameObject TopText = GameObject.Find($"{playerbase.transform.name}/Names/NameText_TMP/InfoText_T_TMP"); - if (TopText != null) + infoType = "InfoText_Info_TMP"; + var topText = player.gameObject.transform.Find("Names/NameText_TMP/InfoText_T_TMP")?.GetComponent(); + + if (topText != null && string.IsNullOrEmpty(Utils.GetRawText(topText.text))) { - if (TopText.GetComponent()?.text.Replace("", string.Empty).Replace("", string.Empty).Length < 1) - { - text = "" + text + ""; - } + text = "" + text + ""; } } text = "" + text + ""; - GameObject TextObj = GameObject.Find($"{player?.gameObject.transform.name}/Names/NameText_TMP/{InfoType}"); - if (TextObj != null) + var textObj = player.gameObject.transform.Find($"Names/NameText_TMP/{infoType}")?.GetComponent(); + + if (textObj != null) { - TextObj.GetComponent().text = text; + textObj.text = text; } } + // Reset players over head text public static void ResetAllPlayerTextInfo(this PlayerControl player) { diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 61f5182..c73c796 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -20,30 +20,29 @@ class PlayerControlPatch public static void FixedUpdate_Prefix(PlayerControl __instance) { // Set up player text info - var NameText = GameObject.Find($"{__instance.gameObject.transform.name}/Names/NameText_TMP"); - var InfoText = GameObject.Find($"{__instance.gameObject.transform.name}/Names/NameText_TMP/InfoText_T_TMP"); - if (NameText != null && InfoText == null) + var nameTextTransform = __instance.gameObject.transform.Find("Names/NameText_TMP"); + var nameText = nameTextTransform?.gameObject; + var infoText = nameTextTransform?.Find("InfoText_T_TMP"); + + if (nameText != null && infoText == null) { - GameObject playerInfoDisplayInfo = UnityEngine.Object.Instantiate(NameText, NameText.transform); - playerInfoDisplayInfo.name = "InfoText_Info_TMP"; - playerInfoDisplayInfo.transform.DestroyChildren(); - playerInfoDisplayInfo.transform.position += new Vector3(0f, 0.25f); - playerInfoDisplayInfo.GetComponent().text = string.Empty; - playerInfoDisplayInfo.SetActive(true); + void InstantiatePlayerInfoText(string name, Vector3 positionOffset) + { + var newTextObject = UnityEngine.Object.Instantiate(nameText, nameTextTransform); + newTextObject.name = name; + newTextObject.transform.DestroyChildren(); + newTextObject.transform.position += positionOffset; + var textMesh = newTextObject.GetComponent(); + if (textMesh != null) + { + textMesh.text = string.Empty; + } + newTextObject.SetActive(true); + } - GameObject playerInfoDisplayTop = UnityEngine.Object.Instantiate(NameText, NameText.transform); - playerInfoDisplayTop.name = "InfoText_T_TMP"; - playerInfoDisplayTop.transform.DestroyChildren(); - playerInfoDisplayTop.transform.position += new Vector3(0f, 0.15f); - playerInfoDisplayTop.GetComponent().text = string.Empty; - playerInfoDisplayTop.SetActive(true); - - GameObject playerInfoDisplayBottom = UnityEngine.Object.Instantiate(NameText, NameText.transform); - playerInfoDisplayBottom.name = "InfoText_B_TMP"; - playerInfoDisplayBottom.transform.DestroyChildren(); - playerInfoDisplayBottom.transform.position += new Vector3(0f, -0.15f); - playerInfoDisplayBottom.GetComponent().text = string.Empty; - playerInfoDisplayBottom.SetActive(true); + InstantiatePlayerInfoText("InfoText_Info_TMP", new Vector3(0f, 0.25f)); + InstantiatePlayerInfoText("InfoText_T_TMP", new Vector3(0f, 0.15f)); + InstantiatePlayerInfoText("InfoText_B_TMP", new Vector3(0f, -0.15f)); } // Set color blind text on player @@ -93,10 +92,7 @@ class PlayerControlPatch // Set player text info if (!player.DataIsCollected()) { - if (nameText.text is "???" or "Player") - { - nameText.text = "Loading"; - } + nameText.text = "Loading"; return; } @@ -202,9 +198,9 @@ class PlayerControlPatch AppendTagInfo(sbTagTop, sbInfoTop); AppendTagInfo(sbTagBottom, sbInfoBottom); - player.SetPlayerTextInfo(sbInfo.ToString(), isInfo: true); player.SetPlayerTextInfo(sbInfoTop.ToString()); player.SetPlayerTextInfo(sbInfoBottom.ToString(), isBottom: true); + player.SetPlayerTextInfo(sbInfo.ToString(), isInfo: true); } From 6d8efbc67c92e3ca39bafaaf3631c8504f183191 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 00:26:40 -0500 Subject: [PATCH 16/29] more fixes --- Modules/AntiCheat.cs | 2 +- Modules/BetterHostManager.cs | 18 +++++------------- Modules/ExtendedPlayerControl.cs | 2 +- Modules/ExtendedPlayerInfo.cs | 1 + Modules/Utils.cs | 2 ++ Patches/ChatPatch.cs | 8 ++++---- Patches/PlayerControlPatch.cs | 9 +++++++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 42478b2..2955830 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -449,7 +449,7 @@ class AntiCheat } } - if (player.DataIsCollected() == true) + if (player.DataIsCollected() == true && !GameStates.IsLocalGame && GameStates.IsVanillaServer) { if (callId is (byte)RpcCalls.SetName or (byte)RpcCalls.CheckName or (byte)RpcCalls.SetLevel) { diff --git a/Modules/BetterHostManager.cs b/Modules/BetterHostManager.cs index 832dd79..fc485ee 100644 --- a/Modules/BetterHostManager.cs +++ b/Modules/BetterHostManager.cs @@ -8,7 +8,6 @@ namespace BetterAmongUs; class BetterHostManager { - private static Dictionary> LastPlayerName = []; // Targetid, Playerid, Name private static List VentStuck = []; public static void Update(PlayerControl player) @@ -295,27 +294,20 @@ class BetterHostManager } if (sbTopInfo.Length > 0) - NewName = $"{sbTopInfo}\n{NewName}"; + NewName = $"{sbTopInfo}\n{NewName}"; else NewName = $"{NewName}"; // Don't send rpc if name is the same! - if (LastPlayerName.TryGetValue(target.Data.PlayerId, out var playerNameDict)) + if (player.BetterData().LastNameSetFor.TryGetValue(target.PlayerId, out var lastName) && lastName == NewName) { - if (playerNameDict.TryGetValue(player.Data.PlayerId, out var currentName) && currentName == NewName) + if (!force) { - if (!force) - { - return; - } + return; } } - else - { - LastPlayerName[target.Data.PlayerId] = new Dictionary(); - } - LastPlayerName[target.Data.PlayerId][player.Data.PlayerId] = NewName; + player.BetterData().LastNameSetFor[target.PlayerId] = NewName; player.RpcSetNamePrivate(NewName, target); Logger.Log($"Set {player.Data.PlayerName} name to {NewName.Replace("\n", "-")} for {target.Data.PlayerName}", "RPC"); diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 3c62609..c3c0c88 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -70,7 +70,7 @@ static class ExtendedPlayerControl { if (player == null) return false; - if (player.isDummy) + if (player.isDummy || GameStates.IsLocalGame || !GameStates.IsVanillaServer) { return true; } diff --git a/Modules/ExtendedPlayerInfo.cs b/Modules/ExtendedPlayerInfo.cs index 5671b75..364fa73 100644 --- a/Modules/ExtendedPlayerInfo.cs +++ b/Modules/ExtendedPlayerInfo.cs @@ -2,6 +2,7 @@ public class ExtendedPlayerInfo { + public Dictionary LastNameSetFor { get; set; } = []; public bool IsBetterUser { get; set; } = false; public bool IsBetterHost { get; set; } = false; public bool IsTOHEHost { get; set; } = false; diff --git a/Modules/Utils.cs b/Modules/Utils.cs index bd25790..c13afa4 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -219,6 +219,8 @@ public static class Utils case Platforms.Unknown: PlatformName = "None"; break; + default: + return string.Empty; } if (useTag == false) diff --git a/Patches/ChatPatch.cs b/Patches/ChatPatch.cs index 10d4e5d..b471ea4 100644 --- a/Patches/ChatPatch.cs +++ b/Patches/ChatPatch.cs @@ -243,15 +243,15 @@ class ChatPatch __instance.textArea.AllowSymbols = true; __instance.textArea.AllowPaste = true; __instance.textArea.AllowEmail = true; - __instance.textArea.characterLimit = 120; - __instance.charCountText.text = "0/120"; + __instance.textArea.characterLimit = 118; + __instance.charCountText.text = "0/118"; } [HarmonyPatch(nameof(FreeChatInputField.UpdateCharCount))] [HarmonyPostfix] public static void UpdateCharCount_Postfix(FreeChatInputField __instance) { int length = __instance.textArea.text.Length; - __instance.charCountText.text = string.Format("{0}/120", length); + __instance.charCountText.text = string.Format("{0}/118", length); __instance.charCountText.color = GetCharColor(length, UnityEngine.Color.white); } } @@ -261,7 +261,7 @@ class ChatPatch switch (length) { - case int n when n > 119: + case int n when n > 117: if (ColorUtility.TryParseHtmlString("#ff0000", out UnityEngine.Color newColor1)) color = newColor1; break; diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index c73c796..aa8c77f 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -107,7 +107,10 @@ class PlayerControlPatch 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"; if (string.IsNullOrEmpty(friendCode) || friendCode == "") + { friendCode = "???"; + friendCodeColor = "#ff0000"; + } if (DataManager.Settings.Gameplay.StreamerMode == true) friendCode = string.Concat('*').Repeat(friendCode.Length); @@ -145,6 +148,7 @@ class PlayerControlPatch sbTag.Append($"ID: {player.PlayerId}+++"); sbTagTop.Append($"{Utils.GetPlatformName(player, useTag: true)}+++"); + sbTagTop.Append($"Lv: {player.Data.PlayerLevel.ToString()}+++"); sbTagBottom.Append($"{friendCode}+++"); @@ -179,10 +183,11 @@ class PlayerControlPatch { if (source.Length > 0) { - string[] parts = source.ToString().Split("+++"); + string text = source.ToString(); + string[] parts = text.Split("+++"); for (int i = 0; i < parts.Length; i++) { - if (!string.IsNullOrEmpty(parts[i])) + if (!string.IsNullOrEmpty(Utils.GetRawText(parts[i]))) { destination.Append(parts[i]); if (i != parts.Length - 2) From 6017c3afa47498eaec0870c2ca39e1cdf09f50d6 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 00:27:45 -0500 Subject: [PATCH 17/29] Canary 6 --- main.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.cs b/main.cs index 861e578..09db866 100644 --- a/main.cs +++ b/main.cs @@ -22,12 +22,12 @@ public enum ReleaseTypes : int public class Main : BasePlugin { public const ReleaseTypes ReleaseBuildType = ReleaseTypes.Canary; - public const string CanaryNum = "5"; - public const string HotfixNum = "3"; - public const bool IsHotFix = true; + public const string CanaryNum = "6"; + 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.01.2024"; // mm/dd/yyyy + public const string ReleaseDate = "08.07.2024"; // mm/dd/yyyy public const string Github = "https://github.com/D1GQ/BetterAmongUs"; public const string Discord = "https://discord.gg/vjYrXpzNAn"; From 56bf4645e7e28a7ba43865e581d3266c14384802 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 01:19:51 -0500 Subject: [PATCH 18/29] Better ghost role algorithm --- Patches/RoleManagerPatch.cs | 47 +++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/Patches/RoleManagerPatch.cs b/Patches/RoleManagerPatch.cs index f5ca9f3..05dbe48 100644 --- a/Patches/RoleManagerPatch.cs +++ b/Patches/RoleManagerPatch.cs @@ -132,7 +132,7 @@ public class RoleManagerPatch var impRoles = Shuffle(ImpostorRoles); foreach (var kvp in impRoles) { - if (RNG() < GameOptionsManager.Instance.CurrentGameOptions.RoleOptions.GetChancePerGame(kvp.Key) && kvp.Value > 0) + if (RNG() <= GameOptionsManager.Instance.CurrentGameOptions.RoleOptions.GetChancePerGame(kvp.Key) && kvp.Value > 0) { ImpostorMultiplier[Utils.GetHashPuid(pc)] += 15; ImpostorRoles[kvp.Key]--; @@ -158,7 +158,7 @@ public class RoleManagerPatch var crewRoles = Shuffle(CrewmateRoles); foreach (var kvp in crewRoles) { - if (RNG() < GameOptionsManager.Instance.CurrentGameOptions.RoleOptions.GetChancePerGame(kvp.Key) && kvp.Value > 0) + if (RNG() <= GameOptionsManager.Instance.CurrentGameOptions.RoleOptions.GetChancePerGame(kvp.Key) && kvp.Value > 0) { ImpostorMultiplier[Utils.GetHashPuid(pc)] = 0; CrewmateRoles[kvp.Key]--; @@ -193,6 +193,49 @@ public class RoleManagerPatch return false; } + [HarmonyPatch(nameof(RoleManager.AssignRoleOnDeath))] + [HarmonyPrefix] + public static bool AssignRoleOnDeath_Prefix(/*RoleManager __instance*/ [HarmonyArgument(0)] PlayerControl player) + { + if (!Main.BetterRoleAlgorithma.Value) return true; + + Dictionary GhostRoles = new() // Role, Amount + { + { RoleTypes.GuardianAngel, 0 }, + }; + + List Roles = [.. GhostRoles.Keys]; + + foreach (RoleTypes role in Roles) + { + GhostRoles[role] = GameOptionsManager.Instance.CurrentGameOptions.RoleOptions.GetNumPerGame(role); + } + + foreach (var allDeadPlayers in Main.AllPlayerControls.Where(pc => !pc.IsAlive())) + { + for (int i = 0; i < Roles.Count; i++) + { + if (allDeadPlayers.Is(Roles[i])) + { + GhostRoles[Roles[i]]--; + } + } + } + + var ghostRoles = Shuffle(GhostRoles); + + foreach (var kvp in ghostRoles) + { + if (kvp.Value > 0 && RNG() <= GameOptionsManager.Instance.CurrentGameOptions.RoleOptions.GetChancePerGame(kvp.Key)) + { + player.RpcSetRole(kvp.Key); + break; + } + } + + return false; + } + private static bool IsImpostorRole(RoleTypes role) => role is RoleTypes.Impostor or RoleTypes.Shapeshifter or RoleTypes.Phantom; private static Dictionary Shuffle(Dictionary dictionary) From d6e31887bcdfb556da5939916350dd76b78f0011 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 17:43:54 -0500 Subject: [PATCH 19/29] clean up --- Modules/BetterHostManager.cs | 43 ++--------------------------------- Patches/MainMenuPatch.cs | 22 +++++++++++------- Patches/PlayerControlPatch.cs | 22 +++++++++--------- 3 files changed, 27 insertions(+), 60 deletions(-) diff --git a/Modules/BetterHostManager.cs b/Modules/BetterHostManager.cs index fc485ee..b6c4440 100644 --- a/Modules/BetterHostManager.cs +++ b/Modules/BetterHostManager.cs @@ -8,12 +8,10 @@ namespace BetterAmongUs; class BetterHostManager { - private static List VentStuck = []; + private static readonly List VentStuck = []; - public static void Update(PlayerControl player) + public static void PlayerUpdate(PlayerControl player) { - if (!Main.BetterHost.Value) return; - // Lock up player vent button if it's invalid vent if (!VentStuck.Contains(player) && player.inVent && !player.Is(RoleTypes.Engineer) && !player.IsImpostorTeam()) { @@ -23,43 +21,6 @@ class BetterHostManager } } - public static bool IsSpeedExceeding(float currentSpeed) - { - float leniency = 1.8f; - float thresholdSpeed = GetAverageSpeed() + leniency; - bool isExceeding = currentSpeed > thresholdSpeed; - return isExceeding; - } - - public static float GetAverageSpeed() - { - float speedMod = GameStates.IsHideNSeek - ? GameOptionsManager.Instance.currentHideNSeekGameOptions.PlayerSpeedMod - : GameOptionsManager.Instance.currentNormalGameOptions.PlayerSpeedMod; - - // Data points - float[] mods = { 0.5f, 1.5f, 2.0f }; // Add more as needed - float[] avgSpeeds = { 1.3f, 3.75f, 5.0f }; // Add corresponding speeds - - int n = mods.Length; - float sumMod = 0, sumAvgSpeed = 0, sumModAvgSpeed = 0, sumModSquared = 0; - - for (int i = 0; i < n; i++) - { - sumMod += mods[i]; - sumAvgSpeed += avgSpeeds[i]; - sumModAvgSpeed += mods[i] * avgSpeeds[i]; - sumModSquared += mods[i] * mods[i]; - } - - float m = (n * sumModAvgSpeed - sumMod * sumAvgSpeed) / (n * sumModSquared - sumMod * sumMod); - float c = (sumAvgSpeed - m * sumMod) / n; - - float estimatedAverageSpeed = m * speedMod + c; - - return estimatedAverageSpeed; - } - public static bool CheckRange(Vector2 pos1, Vector2 pos2, float range) => Vector2.Distance(pos1, pos2) <= range; public static bool CheckRPCAsHost(PlayerControl player, byte callId, MessageReader reader, ref bool canceled) diff --git a/Patches/MainMenuPatch.cs b/Patches/MainMenuPatch.cs index 7c43d6e..c463ad3 100644 --- a/Patches/MainMenuPatch.cs +++ b/Patches/MainMenuPatch.cs @@ -97,27 +97,31 @@ internal class MainMenuPatch buttons.Add(button); button.name = name; UnityEngine.Object.Destroy(button.GetComponent()); - for (int i = 0; i < buttons.ToList().Count; i++) - { - float baseY = -2.7882f; - float newY = baseY + (0.38f * i); - button.transform.localPosition = new(-0.8118f, newY, -5f); - button.transform.localScale = new(0.78f, 0.78f, 0.78f); - } + // Set button position and scale + float baseY = -2.7882f; + float newY = baseY + (0.38f * (buttons.Count - 1)); + button.transform.localPosition = new Vector3(-0.8118f, newY, -5f); + button.transform.localScale = new Vector3(0.78f, 0.78f, 0.78f); + + // Set button action button.OnClick = new(); button.OnClick.AddListener(action); + // Set button text var buttonText = button.transform.Find("FontPlacer/Text_TMP").GetComponent(); buttonText.DestroyTranslator(); buttonText.fontSize = buttonText.fontSizeMax = buttonText.fontSizeMin = 3.5f; buttonText.enableWordWrapping = false; buttonText.text = label; + + // Set button colors var normalSprite = button.inactiveSprites.GetComponent(); var hoverSprite = button.activeSprites.GetComponent(); normalSprite.color = normalColor; hoverSprite.color = hoverColor; + // Align text var container = buttonText.transform.parent; UnityEngine.Object.Destroy(container.GetComponent()); UnityEngine.Object.Destroy(buttonText.GetComponent()); @@ -125,15 +129,17 @@ internal class MainMenuPatch buttonText.transform.SetLocalX(0f); buttonText.horizontalAlignment = HorizontalAlignmentOptions.Center; + // Set button collider var buttonCollider = button.GetComponent(); if (scale.HasValue) { normalSprite.size = hoverSprite.size = buttonCollider.size = scale.Value; } - buttonCollider.offset = new(0f, 0f); + buttonCollider.offset = new Vector2(0f, 0f); return button; } + } } diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index aa8c77f..0c31f68 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -55,6 +55,11 @@ class PlayerControlPatch __instance.cosmetics.colorBlindText.text = string.Empty; } + if (GameStates.IsInGame && GameStates.IsHost && Main.BetterHost.Value) + { + BetterHostManager.PlayerUpdate(__instance); + } + infotime -= Time.deltaTime; if (infotime <= 0) @@ -63,11 +68,6 @@ class PlayerControlPatch infotime = 0.4f; } - if (GameStates.IsInGame && GameStates.IsHost) - { - BetterHostManager.Update(__instance); - } - if (GameStates.IsInGamePlay) { if (__instance.IsImpostorTeam()) @@ -96,6 +96,12 @@ class PlayerControlPatch return; } + if (!Main.LobbyPlayerInfo.Value && GameStates.IsLobby) + { + player.ResetAllPlayerTextInfo(); + return; + } + if (Main.AllPlayerControls.Any(pc => player.Data.PlayerId == pc.shapeshiftTargetPlayerId)) return; @@ -172,12 +178,6 @@ class PlayerControlPatch player.RawSetName(NewName); } - if (!Main.LobbyPlayerInfo.Value && GameStates.IsLobby) - { - player.ResetAllPlayerTextInfo(); - return; - } - // Put +++ at the end of each tag void AppendTagInfo(StringBuilder source, StringBuilder destination) { From 1662a1889ca36b2fe0d5e2286507410e4e19524d Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 18:21:22 -0500 Subject: [PATCH 20/29] Shapeshift anti-cheat fixs --- Modules/AntiCheat.cs | 9 +-------- Modules/BetterHostManager.cs | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 2955830..fad1b73 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -403,17 +403,10 @@ class AntiCheat return false; } - else if (ShapeshiftAsTarget && (GameStates.IsMeeting || GameStates.IsExilling) || !flag) - { - BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); - Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 2: {GameStates.IsMeeting} - {GameStates.IsExilling} - {!flag}"); - return false; - } - else if (!flag && !GameStates.IsMeeting && !GameStates.IsExilling && !player.IsInVent()) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); - Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 3: {!flag} - {!GameStates.IsMeeting} - {!GameStates.IsExilling} - {!player.IsInVent()}"); + Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 2: {!flag} - {!GameStates.IsMeeting} - {!GameStates.IsExilling} - {!player.IsInVent()}"); return false; } } diff --git a/Modules/BetterHostManager.cs b/Modules/BetterHostManager.cs index b6c4440..94afee7 100644 --- a/Modules/BetterHostManager.cs +++ b/Modules/BetterHostManager.cs @@ -109,12 +109,12 @@ class BetterHostManager && !player.onLadder && !player.MyPhysics.Animations.IsPlayingAnyLadderAnimation()) { - if (!target.IsInVent() && flag == false) + if (!target.IsInVent() && !GameStates.IsMeeting && !GameStates.IsExilling && flag == false) { break; } - player.RpcShapeshift(target, !target.IsInVent()); + player.RpcShapeshift(target, !target.IsInVent() && !GameStates.IsMeeting && !GameStates.IsExilling); break; } } From ed38f84a1f04b3aacd62295673364800859060d3 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 18:21:45 -0500 Subject: [PATCH 21/29] don't allow lower imps --- Patches/RoleManagerPatch.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Patches/RoleManagerPatch.cs b/Patches/RoleManagerPatch.cs index 05dbe48..d6f761d 100644 --- a/Patches/RoleManagerPatch.cs +++ b/Patches/RoleManagerPatch.cs @@ -26,6 +26,24 @@ public class RoleManagerPatch int NumImpostors = GameOptionsManager.Instance.CurrentGameOptions.NumImpostors; + int NumPlayers = Main.AllPlayerControls.Length; + + var impostorLimits = new Dictionary + { + { 3, 1 }, + { 5, 2 }, + { 6, 3 } + }; + + foreach (var limit in impostorLimits) + { + if (NumPlayers <= limit.Key) + { + NumImpostors = Math.Min(NumImpostors, limit.Value); + break; + } + } + List Impostors = []; List Crewmates = []; From 688ce902a4a027af005e7a954dba1fb584e442a7 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 18:22:03 -0500 Subject: [PATCH 22/29] EndMeeting fixes --- Patches/MeetingHudPatch.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index 913c648..8af7299 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -1,9 +1,11 @@ using HarmonyLib; +using Hazel; using System.Text; using TMPro; using UnityEngine; -namespace BetterAmongUs; +namespace BetterAmongUs; + [HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))] class MeetingHudStartPatch { @@ -165,4 +167,14 @@ class MeetingHudUpdatePatch TextObj.GetComponent().text = text; } } +} + +[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.OnDestroy))] +class MeetingHud_OnDestroyPatch +{ + public static void Postfix() + { + Logger.LogHeader("Meeting Has Endded"); + RPC.SyncAllNames(force: true); + } } \ No newline at end of file From df74a9904fb85128bce002880fb9377896f5f880 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 18:53:54 -0500 Subject: [PATCH 23/29] fixes --- Modules/AntiCheat.cs | 10 ++++------ Modules/BetterHostManager.cs | 8 -------- Modules/ExtendedPlayerInfo.cs | 1 - Patches/MeetingHudPatch.cs | 5 +++++ Patches/PlayerControlPatch.cs | 12 +----------- 5 files changed, 10 insertions(+), 26 deletions(-) diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index fad1b73..88cc1f2 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -44,7 +44,7 @@ class AntiCheat public static void PauseAntiCheat() { - float time = 2f; + float time = 4f; if (IsEnabled) { IsEnabled = false; @@ -227,13 +227,11 @@ class AntiCheat if (target != null) { - if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || target.IsImpostorTeam() - || player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown) + if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || target.IsImpostorTeam()) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} - {player.IsInVanish()}" + - $" - {!target.IsAlive()} - {target.IsImpostorTeam()} - {player.BetterData().TimeSinceKill < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown - 2.5f}"); - Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.BetterData().TimeSinceKill} < {GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown} or {GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown -2.5} -2.5"); + $" - {!target.IsAlive()} - {target.IsImpostorTeam()}"); } } } @@ -335,7 +333,7 @@ class AntiCheat if (callId is (byte)RpcCalls.StartMeeting) { - if (GameStates.IsMeeting || GameStates.IsHideNSeek || !player.IsAlive() || player.IsInVent() || player.shapeshifting + if (GameStates.IsMeeting && MeetingHudUpdatePatch.timeOpen > 0.5f || GameStates.IsHideNSeek || !player.IsAlive() || player.IsInVent() || player.shapeshifting || player.inMovingPlat || player.onLadder || player.MyPhysics.Animations.IsPlayingAnyLadderAnimation()) { BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}"); diff --git a/Modules/BetterHostManager.cs b/Modules/BetterHostManager.cs index 94afee7..6d78d84 100644 --- a/Modules/BetterHostManager.cs +++ b/Modules/BetterHostManager.cs @@ -57,13 +57,6 @@ class BetterHostManager { PlayerControl target = reader.ReadNetObject(); - bool condition = false; - - if (player.BetterData().TimeSinceKill >= GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown) - { - condition = true; - } - if (target != null) { if (player.IsAlive() @@ -74,7 +67,6 @@ class BetterHostManager && !player.shapeshifting && !player.onLadder && !player.MyPhysics.Animations.IsPlayingAnyLadderAnimation() - && condition && CheckRange(player.GetCustomPosition(), target.GetCustomPosition(), 3f)) { if (target.IsAlive() diff --git a/Modules/ExtendedPlayerInfo.cs b/Modules/ExtendedPlayerInfo.cs index 364fa73..88f0e52 100644 --- a/Modules/ExtendedPlayerInfo.cs +++ b/Modules/ExtendedPlayerInfo.cs @@ -7,7 +7,6 @@ public class ExtendedPlayerInfo public bool IsBetterHost { get; set; } = false; public bool IsTOHEHost { get; set; } = false; public bool HasNoisemakerNotify { get; set; } = false; - public float TimeSinceKill { get; set; } = 0f; public int TimesCalledMeeting { get; set; } = 0; } diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index 8af7299..1822659 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -52,9 +52,13 @@ class MeetingHudStartPatch [HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Update))] class MeetingHudUpdatePatch { + public static float timeOpen = 0f; + // Set player meeting info public static void Postfix(MeetingHud __instance) { + timeOpen += Time.deltaTime; + foreach (var pva in __instance.playerStates) { if (pva == null) return; @@ -174,6 +178,7 @@ class MeetingHud_OnDestroyPatch { public static void Postfix() { + MeetingHudUpdatePatch.timeOpen = 0f; Logger.LogHeader("Meeting Has Endded"); RPC.SyncAllNames(force: true); } diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 0c31f68..6a22443 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -68,16 +68,8 @@ class PlayerControlPatch infotime = 0.4f; } - if (GameStates.IsInGamePlay) + if (!GameStates.IsInGamePlay) { - if (__instance.IsImpostorTeam()) - { - __instance.BetterData().TimeSinceKill += Time.deltaTime; - } - } - else - { - __instance.BetterData().TimeSinceKill = 0f; __instance.BetterData().TimesCalledMeeting = 0; __instance.BetterData().HasNoisemakerNotify = false; } @@ -231,8 +223,6 @@ class PlayerControlPatch if (PlayerControl.LocalPlayer.IsImpostorTeam() && GameStates.IsInGamePlay && !GameStates.IsHideNSeek && HudManager.Instance.CrewmatesKilled.isActiveAndEnabled) HudManager.Instance?.NotifyOfDeath(); - __instance.BetterData().TimeSinceKill = 0f; - Logger.LogPrivate($"{__instance.Data.PlayerName} Has killed {target.Data.PlayerName} as {Utils.GetRoleName(__instance.Data.RoleType)}", "EventLog"); } [HarmonyPatch(nameof(PlayerControl.Shapeshift))] From 88ccb6d0d724b4c062442134b5db76f2a57cd41b Mon Sep 17 00:00:00 2001 From: D1GQ <83262852+D1GQ@users.noreply.github.com> Date: Wed, 7 Aug 2024 22:20:58 -0500 Subject: [PATCH 24/29] Update LICENSE.txt --- LICENSE.txt | 690 ++-------------------------------------------------- 1 file changed, 25 insertions(+), 665 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index f288702..3d162a6 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,674 +1,34 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 +BetterAmongUs License Agreement + 8/7/2024 - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +1. Grant of License +This license permits the Licensee to use the compiled binary form of the mod (the "Mod") for personal, non-commercial purposes only. - Preamble +2. Restrictions +The Licensee is not permitted to: +- Modify, adapt, translate, or create derivative works based on the Mod. +- Decompile, reverse engineer, disassemble, or otherwise attempt to derive the source code of the Mod. +- Redistribute, sublicense, lease, rent, or sell the Mod or any portion thereof. +- Use the Mod in any manner that could harm, abuse, disrupt, or otherwise negatively impact the Mod, its functionality, or its intended use. +- Use the Mod for any commercial purposes without obtaining a separate commercial license from the Licensor. - The GNU General Public License is a free, copyleft license for -software and other kinds of works. +3. Termination +This license will automatically terminate if the Licensee fails to comply with any of the terms and conditions outlined herein. Upon termination, the Licensee must cease all use of the Mod and destroy any copies of the Mod in their possession. - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. +4. Disclaimer of Warranty +The Mod is provided "as is," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. The entire risk as to the quality and performance of the Mod is borne by the Licensee. Should the Mod prove defective, the Licensee assumes the cost of all necessary servicing, repair, or correction. - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. +5. Limitation of Liability +In no event shall the Licensor be liable for any special, incidental, indirect, or consequential damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use the Mod, even if the Licensor has been advised of the possibility of such damages. - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. +6. Governing Law +This license shall be governed by and construed in accordance with the laws of [Your Country/State], without regard to its conflict of laws principles. - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. +7. Entire Agreement +This license constitutes the entire agreement between the Licensee and the Licensor concerning the Mod and supersedes all prior or contemporaneous understandings regarding such subject matter. No amendment to or modification of this license will be binding unless in writing and signed by the Licensor. - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. +8. Severability +If any provision of this license is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable, and the other provisions shall remain in full force and effect. - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. +9. Disclaimer of Affiliation +This Mod is not affiliated with, endorsed by, or in any way associated with Innersloth, the creators of Among Us. All intellectual property rights in the game Among Us are owned by Innersloth. From 3d85b700047637758ad778eecbb5a2b951866d19 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 22:23:27 -0500 Subject: [PATCH 25/29] Revert "Update LICENSE.txt" This reverts commit 88ccb6d0d724b4c062442134b5db76f2a57cd41b. --- LICENSE.txt | 690 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 665 insertions(+), 25 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 3d162a6..f288702 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,34 +1,674 @@ -BetterAmongUs License Agreement - 8/7/2024 + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 -1. Grant of License -This license permits the Licensee to use the compiled binary form of the mod (the "Mod") for personal, non-commercial purposes only. + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. -2. Restrictions -The Licensee is not permitted to: -- Modify, adapt, translate, or create derivative works based on the Mod. -- Decompile, reverse engineer, disassemble, or otherwise attempt to derive the source code of the Mod. -- Redistribute, sublicense, lease, rent, or sell the Mod or any portion thereof. -- Use the Mod in any manner that could harm, abuse, disrupt, or otherwise negatively impact the Mod, its functionality, or its intended use. -- Use the Mod for any commercial purposes without obtaining a separate commercial license from the Licensor. + Preamble -3. Termination -This license will automatically terminate if the Licensee fails to comply with any of the terms and conditions outlined herein. Upon termination, the Licensee must cease all use of the Mod and destroy any copies of the Mod in their possession. + The GNU General Public License is a free, copyleft license for +software and other kinds of works. -4. Disclaimer of Warranty -The Mod is provided "as is," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. The entire risk as to the quality and performance of the Mod is borne by the Licensee. Should the Mod prove defective, the Licensee assumes the cost of all necessary servicing, repair, or correction. + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. -5. Limitation of Liability -In no event shall the Licensor be liable for any special, incidental, indirect, or consequential damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use the Mod, even if the Licensor has been advised of the possibility of such damages. + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. -6. Governing Law -This license shall be governed by and construed in accordance with the laws of [Your Country/State], without regard to its conflict of laws principles. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. -7. Entire Agreement -This license constitutes the entire agreement between the Licensee and the Licensor concerning the Mod and supersedes all prior or contemporaneous understandings regarding such subject matter. No amendment to or modification of this license will be binding unless in writing and signed by the Licensor. + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. -8. Severability -If any provision of this license is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable, and the other provisions shall remain in full force and effect. + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. -9. Disclaimer of Affiliation -This Mod is not affiliated with, endorsed by, or in any way associated with Innersloth, the creators of Among Us. All intellectual property rights in the game Among Us are owned by Innersloth. + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 1996110ed5e325f4acd3217e550f8328beed373b Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 22:45:54 -0500 Subject: [PATCH 26/29] Changes for mod policies --- Patches/ButtonsPatch.cs | 46 ----------------- Patches/MiniMapBehaviourPatch.cs | 88 ++------------------------------ Patches/ModManagerPatch.cs | 2 +- 3 files changed, 5 insertions(+), 131 deletions(-) delete mode 100644 Patches/ButtonsPatch.cs diff --git a/Patches/ButtonsPatch.cs b/Patches/ButtonsPatch.cs deleted file mode 100644 index 78df211..0000000 --- a/Patches/ButtonsPatch.cs +++ /dev/null @@ -1,46 +0,0 @@ -using HarmonyLib; - -namespace BetterAmongUs.Patches; - -internal class ButtonsPatch -{ - // Handle EFC - [HarmonyPatch(typeof(SabotageButton))] - internal class SabotageButtonPatch - { - [HarmonyPatch(nameof(SabotageButton.DoClick))] - [HarmonyPrefix] - public static bool DoClick_Prefix(SabotageButton __instance) - { - if (PlayerControl.LocalPlayer.Data.Role.IsImpostor && GameManager.Instance.SabotagesEnabled()) - { - DestroyableSingleton.Instance.ToggleMapVisible(new MapOptions - { - Mode = MapOptions.Modes.Sabotage - }); - } - - return false; - } - [HarmonyPatch(nameof(SabotageButton.Refresh))] - [HarmonyPrefix] - public static bool Refresh_Prefix(SabotageButton __instance) - { - if (GameManager.Instance == null || PlayerControl.LocalPlayer == null) - { - __instance.ToggleVisible(false); - __instance.SetDisabled(); - return false; - } - if (!GameManager.Instance.SabotagesEnabled() || PlayerControl.LocalPlayer.petting) - { - __instance.ToggleVisible(PlayerControl.LocalPlayer.Data.Role.IsImpostor && GameManager.Instance.SabotagesEnabled()); - __instance.SetDisabled(); - return false; - } - __instance.SetEnabled(); - - return false; - } - } -} diff --git a/Patches/MiniMapBehaviourPatch.cs b/Patches/MiniMapBehaviourPatch.cs index 16d189f..d99c715 100644 --- a/Patches/MiniMapBehaviourPatch.cs +++ b/Patches/MiniMapBehaviourPatch.cs @@ -9,92 +9,12 @@ public class MiniMapBehaviourPatch [HarmonyPatch(typeof(MapBehaviour))] class MapBehaviourPatch { - [HarmonyPatch(nameof(MapBehaviour.Awake))] - [HarmonyPostfix] - public static void Awake_Postfix(MapBehaviour __instance) - { - PoolablePlayer NewDisplay = __instance.HerePoint.gameObject.AddComponent(); - if (NewDisplay != null) - { - NewDisplay.SetBodyCosmeticsVisible(true); - } - } - [HarmonyPatch(nameof(MapBehaviour.Show))] - [HarmonyPrefix] - public static bool Show_Prefix(MapBehaviour __instance, ref MapOptions opts) - { - if (__instance.IsOpen) - { - __instance.Close(); - return false; - } - if (!PlayerControl.LocalPlayer.CanMove && !PlayerControl.LocalPlayer.IsInVent() && !PlayerControl.LocalPlayer.onLadder && !PlayerControl.LocalPlayer.inMovingPlat && !GameStates.IsMeeting) - { - return false; - } - switch (opts.Mode) - { - case MapOptions.Modes.Normal: - __instance.ShowNormalMap(); - break; - case MapOptions.Modes.CountOverlay: - __instance.ShowCountOverlay(opts.AllowMovementWhileMapOpen, opts.ShowLivePlayerPosition, opts.IncludeDeadBodies); - break; - case MapOptions.Modes.Sabotage: - __instance.ShowSabotageMap(); - break; - } - - return false; - } [HarmonyPatch(nameof(MapBehaviour.ShowNormalMap))] - [HarmonyPrefix] - public static bool ShowNormalMap_Prefix(MapBehaviour __instance) - { - if (__instance.IsOpen) - { - __instance.Close(); - return false; - } - if (!PlayerControl.LocalPlayer.CanMove && !PlayerControl.LocalPlayer.IsInVent() && !PlayerControl.LocalPlayer.onLadder && !PlayerControl.LocalPlayer.inMovingPlat && !GameStates.IsMeeting) - { - return false; - } - PlayerControl.LocalPlayer.SetPlayerMaterialColors(__instance.HerePoint); - if (PlayerControl.LocalPlayer.isTrackingPlayer) - { - if (PlayerControl.LocalPlayer.trackedPlayer.Data.Disconnected) - { - __instance.TrackedHerePoint.gameObject.SetActive(false); - } - else - { - __instance.SetTrackedHerePointColor(PlayerControl.LocalPlayer.trackedPlayerColorID); - __instance.TrackedHerePoint.gameObject.SetActive(true); - __instance.UpdateTrackedPosition(); - } - } - __instance.GenericShow(); - __instance.taskOverlay.Show(); - __instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f)); - DestroyableSingleton.Instance.SetHudActive(false); - return false; - } + [HarmonyPostfix] + public static void ShowNormalMap_Postfix(MapBehaviour __instance) => __instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f)); [HarmonyPatch(nameof(MapBehaviour.ShowSabotageMap))] - [HarmonyPrefix] - public static bool ShowSabotageMap_Prefix(MapBehaviour __instance) - { - if (!PlayerControl.LocalPlayer.CanMove && !PlayerControl.LocalPlayer.IsInVent() && !PlayerControl.LocalPlayer.onLadder && !PlayerControl.LocalPlayer.inMovingPlat) - { - return false; - } - PlayerControl.LocalPlayer.SetPlayerMaterialColors(__instance.HerePoint); - __instance.GenericShow(); - __instance.infectedOverlay.gameObject.SetActive(true); - __instance.taskOverlay.Show(); - __instance.ColorControl.SetColor(new Color(1f, 0.3f, 0f, 1f)); - return false; - } + [HarmonyPostfix] + public static void ShowSabotageMap_Postfix(MapBehaviour __instance) => __instance.ColorControl.SetColor(new Color(1f, 0.3f, 0f, 1f)); [HarmonyPatch(nameof(MapBehaviour.ShowCountOverlay))] [HarmonyPostfix] public static void ShowCountOverlay_Postfix(MapBehaviour __instance) => __instance.ColorControl.SetColor(new Color(0.2f, 0.5f, 0f, 1f)); diff --git a/Patches/ModManagerPatch.cs b/Patches/ModManagerPatch.cs index 73dee0b..868d020 100644 --- a/Patches/ModManagerPatch.cs +++ b/Patches/ModManagerPatch.cs @@ -10,7 +10,7 @@ public class ModManagerPatch [HarmonyPostfix] public static void LateUpdate_Postfix(ModManager __instance) { - // __instance.ShowModStamp(); + __instance.ShowModStamp(); if (__instance.ModStamp.gameObject.active == true) __instance.ModStamp.GetComponent().sprite = Utils.LoadSprite("BetterAmongUs.Resources.Images.BetterAmongUs-Mod.png", 250f); From de95ec8598711a7a4335e07be64928b40cd3b603 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 7 Aug 2024 22:51:41 -0500 Subject: [PATCH 27/29] Canary 6 --- main.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.cs b/main.cs index 09db866..e21e88f 100644 --- a/main.cs +++ b/main.cs @@ -2,7 +2,6 @@ using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; -using BetterAmongUs.Patches; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Innersloth.IO; @@ -27,7 +26,7 @@ public class Main : BasePlugin public const bool IsHotFix = false; public const string PluginGuid = "com.d1gq.betteramongus"; public const string PluginVersion = "1.0.0"; - public const string ReleaseDate = "08.07.2024"; // mm/dd/yyyy + public const string ReleaseDate = "08.08.2024"; // mm/dd/yyyy public const string Github = "https://github.com/D1GQ/BetterAmongUs"; public const string Discord = "https://discord.gg/vjYrXpzNAn"; From d7d72aafe080b6991ffd3644075bf28e2fef124e Mon Sep 17 00:00:00 2001 From: D1GQ Date: Thu, 8 Aug 2024 00:01:01 -0500 Subject: [PATCH 28/29] try --- Patches/PlayerControlPatch.cs | 208 +++++++++++++++++----------------- 1 file changed, 107 insertions(+), 101 deletions(-) diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 6a22443..26f9c29 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -77,127 +77,133 @@ class PlayerControlPatch public static void SetPlayerInfo(PlayerControl player) { - if (player == null || player.Data == null) return; - - var nameText = player.gameObject.transform.Find("Names/NameText_TMP").GetComponent(); - - // Set player text info - if (!player.DataIsCollected()) + try { - nameText.text = "Loading"; - return; - } + if (player == null || player.Data == null) return; - if (!Main.LobbyPlayerInfo.Value && GameStates.IsLobby) - { - player.ResetAllPlayerTextInfo(); - return; - } + var nameText = player.gameObject.transform.Find("Names/NameText_TMP").GetComponent(); - if (Main.AllPlayerControls.Any(pc => player.Data.PlayerId == pc.shapeshiftTargetPlayerId)) - return; - - string NewName = player.Data.PlayerName; - string hashPuid = Utils.GetHashPuid(player); - - 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"; - if (string.IsNullOrEmpty(friendCode) || friendCode == "") - { - friendCode = "???"; - friendCodeColor = "#ff0000"; - } - if (DataManager.Settings.Gameplay.StreamerMode == true) - friendCode = string.Concat('*').Repeat(friendCode.Length); - - var sbTag = new StringBuilder(); - var sbInfo = new StringBuilder(); - var sbTagTop = new StringBuilder(); - var sbInfoTop = new StringBuilder(); - var sbTagBottom = new StringBuilder(); - var sbInfoBottom = new StringBuilder(); - - // Put +++ at the end of each tag - if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.SickoData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.SickoData.ContainsValue(friendCode)) - sbTag.Append("Sicko User+++"); - else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.AUMData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.AUMData.ContainsValue(friendCode)) - sbTag.Append("AUM User+++"); - else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.PlayerData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.PlayerData.ContainsValue(friendCode)) - sbTag.Append("Known Cheater+++"); - - if (GameStates.IsInGame && GameStates.IsLobby && !GameStates.IsFreePlay) - { - if (player.IsHost()) + // Set player text info + if (!player.DataIsCollected()) { - if (Main.LobbyPlayerInfo.Value == true) + nameText.text = "Loading"; + return; + } + + if (!Main.LobbyPlayerInfo.Value && GameStates.IsLobby) + { + player.ResetAllPlayerTextInfo(); + return; + } + + if (Main.AllPlayerControls.Any(pc => player.Data.PlayerId == pc.shapeshiftTargetPlayerId)) + return; + + string NewName = player.Data.PlayerName; + string hashPuid = Utils.GetHashPuid(player); + + 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"; + if (string.IsNullOrEmpty(friendCode) || friendCode == "") + { + friendCode = "???"; + friendCodeColor = "#ff0000"; + } + if (DataManager.Settings.Gameplay.StreamerMode == true) + friendCode = string.Concat('*').Repeat(friendCode.Length); + + var sbTag = new StringBuilder(); + var sbInfo = new StringBuilder(); + var sbTagTop = new StringBuilder(); + var sbInfoTop = new StringBuilder(); + var sbTagBottom = new StringBuilder(); + var sbInfoBottom = new StringBuilder(); + + // Put +++ at the end of each tag + if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.SickoData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.SickoData.ContainsValue(friendCode)) + sbTag.Append("Sicko User+++"); + else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.AUMData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.AUMData.ContainsValue(friendCode)) + sbTag.Append("AUM User+++"); + else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.PlayerData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.PlayerData.ContainsValue(friendCode)) + sbTag.Append("Known Cheater+++"); + + if (GameStates.IsInGame && GameStates.IsLobby && !GameStates.IsFreePlay) + { + if (player.IsHost()) { - NewName = player.GetPlayerNameAndColor(); + if (Main.LobbyPlayerInfo.Value == true) + { + NewName = player.GetPlayerNameAndColor(); + } + } + + if (player.IsDev() && !GameStates.IsInGamePlay) + sbTag.Append("(Dev)+++"); + if (((player == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || player.BetterData().IsBetterHost) && !GameStates.IsInGamePlay) + sbTag.Append("Better Host+++"); + else if ((player == PlayerControl.LocalPlayer || player.BetterData().IsBetterUser) && !GameStates.IsInGamePlay) + sbTag.Append("Better User+++"); + sbTag.Append($"ID: {player.PlayerId}+++"); + + sbTagTop.Append($"{Utils.GetPlatformName(player, useTag: true)}+++"); + + sbTagTop.Append($"Lv: {player.Data.PlayerLevel.ToString()}+++"); + + sbTagBottom.Append($"{friendCode}+++"); + } + else if (GameStates.IsInGame || GameStates.IsFreePlay) + { + if (player.IsImpostorTeammate() || player == PlayerControl.LocalPlayer || !PlayerControl.LocalPlayer.IsAlive() || DebugMenu.RevealRoles) + { + string Role = $"{player.GetRoleName()}"; + sbTagTop.Append($"{Role}+++"); } } - if (player.IsDev() && !GameStates.IsInGamePlay) - sbTag.Append("(Dev)+++"); - if (((player == PlayerControl.LocalPlayer && GameStates.IsHost && Main.BetterHost.Value) || player.BetterData().IsBetterHost) && !GameStates.IsInGamePlay) - sbTag.Append("Better Host+++"); - else if ((player == PlayerControl.LocalPlayer || player.BetterData().IsBetterUser) && !GameStates.IsInGamePlay) - sbTag.Append("Better User+++"); - sbTag.Append($"ID: {player.PlayerId}+++"); - - sbTagTop.Append($"{Utils.GetPlatformName(player, useTag: true)}+++"); - - sbTagTop.Append($"Lv: {player.Data.PlayerLevel.ToString()}+++"); - - sbTagBottom.Append($"{friendCode}+++"); - } - else if (GameStates.IsInGame || GameStates.IsFreePlay) - { - if (player.IsImpostorTeammate() || player == PlayerControl.LocalPlayer || !PlayerControl.LocalPlayer.IsAlive() || DebugMenu.RevealRoles) + if (player.IsImpostorTeammate() && player != PlayerControl.LocalPlayer) { - string Role = $"{player.GetRoleName()}"; - sbTagTop.Append($"{Role}+++"); + NewName = $"{player.Data.PlayerName}"; } - } - if (player.IsImpostorTeammate() && player != PlayerControl.LocalPlayer) - { - NewName = $"{player.Data.PlayerName}"; - } - - if (!player.IsInShapeshift()) - { - player.RawSetName(NewName); - } - - // Put +++ at the end of each tag - void AppendTagInfo(StringBuilder source, StringBuilder destination) - { - if (source.Length > 0) + if (!player.IsInShapeshift()) { - string text = source.ToString(); - string[] parts = text.Split("+++"); - for (int i = 0; i < parts.Length; i++) + player.RawSetName(NewName); + } + + // Put +++ at the end of each tag + void AppendTagInfo(StringBuilder source, StringBuilder destination) + { + if (source.Length > 0) { - if (!string.IsNullOrEmpty(Utils.GetRawText(parts[i]))) + string text = source.ToString(); + string[] parts = text.Split("+++"); + for (int i = 0; i < parts.Length; i++) { - destination.Append(parts[i]); - if (i != parts.Length - 2) + if (!string.IsNullOrEmpty(Utils.GetRawText(parts[i]))) { - destination.Append(" - "); + destination.Append(parts[i]); + if (i != parts.Length - 2) + { + destination.Append(" - "); + } } } } } + + AppendTagInfo(sbTag, sbInfo); + AppendTagInfo(sbTagTop, sbInfoTop); + AppendTagInfo(sbTagBottom, sbInfoBottom); + + player.SetPlayerTextInfo(sbInfoTop.ToString()); + player.SetPlayerTextInfo(sbInfoBottom.ToString(), isBottom: true); + player.SetPlayerTextInfo(sbInfo.ToString(), isInfo: true); + } catch (Exception ex) + { + Logger.Error(ex.ToString()); } - - AppendTagInfo(sbTag, sbInfo); - AppendTagInfo(sbTagTop, sbInfoTop); - AppendTagInfo(sbTagBottom, sbInfoBottom); - - player.SetPlayerTextInfo(sbInfoTop.ToString()); - player.SetPlayerTextInfo(sbInfoBottom.ToString(), isBottom: true); - player.SetPlayerTextInfo(sbInfo.ToString(), isInfo: true); } From 729a47113f2ccd2c72928b91e84e7cd4a6cd879d Mon Sep 17 00:00:00 2001 From: D1GQ Date: Thu, 8 Aug 2024 00:33:08 -0500 Subject: [PATCH 29/29] Support multiple regions on menu --- Patches/ClientPatch.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 1a5940c..3699485 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -32,4 +32,32 @@ public class ClientPatch return false; } } + + [HarmonyPatch(typeof(RegionMenu))] + public class RegionMenuPatch + { + [HarmonyPatch(nameof(RegionMenu.OnEnable))] + [HarmonyPostfix] + public static void AdjustButtonPositions_Postfix(RegionMenu __instance) + { + const int buttonsPerColumn = 6; + float buttonSpacing = 0.6f; + float buttonSpacingSide = 2.25f; + + List buttons = __instance.controllerSelectable.ToArray().ToList(); + + int columnCount = (buttons.Count + buttonsPerColumn - 1) / buttonsPerColumn; + float totalWidth = (columnCount - 1) * buttonSpacingSide; + float totalHeight = (buttonsPerColumn - 1) * buttonSpacing; + + Vector3 startPosition = new Vector3(-totalWidth / 2, totalHeight / 2, 0f); + + for (int i = 0; i < buttons.Count; i++) + { + int col = i / buttonsPerColumn; + int row = i % buttonsPerColumn; + buttons[i].transform.localPosition = startPosition + new Vector3(col * buttonSpacingSide, -row * buttonSpacing, 0f); + } + } + } }