mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
8 files changed
+61
-27
No files matched your search
+18
-1
@@ -281,7 +281,7 @@ class AntiCheat
|
||||
|
||||
if (level + 1 > BetterGameSettings.DetectedLevelAbove.GetInt())
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("InvalidLevelRPC"), level));
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidLevelRPC"), level));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {level > BetterGameSettings.DetectedLevelAbove.GetInt()} - {level} > {BetterGameSettings.DetectedLevelAbove.GetInt()}");
|
||||
}
|
||||
|
||||
@@ -621,6 +621,22 @@ class AntiCheat
|
||||
}
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.SendChatNote)
|
||||
{
|
||||
var type = reader.ReadByte();
|
||||
|
||||
if (!GameStates.IsMeeting || (ChatNoteTypes)type == ChatNoteTypes.DidVote && player.BetterData().AntiCheatInfo.ChatDidVote)
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidActionRPC"), Enum.GetName((RpcCalls)callId)));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {!GameStates.IsMeeting} || {(ChatNoteTypes)type == ChatNoteTypes.DidVote} && {player.BetterData().AntiCheatInfo.ChatDidVote}");
|
||||
}
|
||||
|
||||
if ((ChatNoteTypes)type == ChatNoteTypes.DidVote)
|
||||
{
|
||||
player.BetterData().AntiCheatInfo.ChatDidVote = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.Shapeshift)
|
||||
{
|
||||
var target = reader.ReadNetObject<PlayerControl>();
|
||||
@@ -713,6 +729,7 @@ class AntiCheat
|
||||
{
|
||||
if (callId is (byte)RpcCalls.StartMeeting
|
||||
or (byte)RpcCalls.ReportDeadBody
|
||||
or (byte)RpcCalls.SendChatNote
|
||||
or (byte)RpcCalls.CloseMeeting
|
||||
or (byte)RpcCalls.Exiled
|
||||
or (byte)RpcCalls.CastVote
|
||||
|
||||
@@ -27,6 +27,7 @@ public static class PlayerControlDataExtension
|
||||
public class ExtendedAntiCheatInfo
|
||||
{
|
||||
public bool BannedByAntiCheat { get; set; } = false;
|
||||
public bool ChatDidVote { get; set; } = false;
|
||||
public List<string> AUMChats { get; set; } = [];
|
||||
public int TimesAttemptedKilled { get; set; } = 0;
|
||||
public int OpenSabotageNum { get; set; } = 0;
|
||||
@@ -75,6 +76,11 @@ public static class PlayerControlDataExtension
|
||||
player.BetterData().RoleInfo.DeadDisplayRole = player.Data.RoleType;
|
||||
}
|
||||
|
||||
if (!GameStates.IsMeeting)
|
||||
{
|
||||
player.BetterData().AntiCheatInfo.ChatDidVote = false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(player.BetterData().RealName))
|
||||
{
|
||||
player.BetterData().RealName = player.Data.PlayerName;
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ internal static class RPC
|
||||
|
||||
try
|
||||
{
|
||||
if (!GameStates.IsTOHEHostLobby)
|
||||
if (!GameStates.IsTOHEHostLobby && callId is not unchecked((byte)CustomRPC.Sicko) or unchecked((byte)CustomRPC.AUM) or (byte)CustomRPC.AUMChat)
|
||||
{
|
||||
var flag = Enum.IsDefined(typeof(CustomRPC), (int)callId) || Enum.IsDefined(typeof(RpcCalls), callId);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ClientPatch
|
||||
[HarmonyPostfix]
|
||||
public static void StartInitialLoginFlow_Postfix(EOSManager __instance)
|
||||
{
|
||||
__instance.StartCoroutine(DataBaseConnect.Init());
|
||||
// __instance.StartCoroutine(DataBaseConnect.Init());
|
||||
}
|
||||
}
|
||||
// Log game exit
|
||||
|
||||
@@ -150,11 +150,11 @@ class GamePlayManager
|
||||
__instance.StartButton.gameObject.SetActive(true);
|
||||
if (__instance.startState == GameStartManager.StartingStates.Countdown)
|
||||
{
|
||||
__instance.StartButton.buttonText.text = string.Format("Cancel: {0}", (int)__instance.countDownTimer + 1);
|
||||
__instance.StartButton.buttonText.text = string.Format("{0}: {1}", Translator.GetString(StringNames.Cancel),(int)__instance.countDownTimer + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.StartButton.buttonText.text = "Start Game";
|
||||
__instance.StartButton.buttonText.text = Translator.GetString(StringNames.StartLabel);
|
||||
}
|
||||
}
|
||||
[HarmonyPatch(nameof(GameStartManager.BeginGame))]
|
||||
|
||||
@@ -204,6 +204,19 @@ class MeetingHudUpdatePatch
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.ClearVote))]
|
||||
class MeetingHud_ClearVotePatch
|
||||
{
|
||||
public static void Postfix()
|
||||
{
|
||||
// Clear info for Anti-Cheat
|
||||
foreach (var player in Main.AllPlayerControls)
|
||||
{
|
||||
player.BetterData().AntiCheatInfo.ChatDidVote = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.OnDestroy))]
|
||||
class MeetingHud_OnDestroyPatch
|
||||
{
|
||||
|
||||
+16
-18
@@ -1,6 +1,7 @@
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
using Hazel;
|
||||
using static Il2CppSystem.Globalization.CultureInfo;
|
||||
|
||||
namespace BetterAmongUs.Patches;
|
||||
|
||||
@@ -276,8 +277,9 @@ public class RoleManagerPatch
|
||||
if (NumImpostors > Main.AllPlayerControls.Length)
|
||||
NumImpostors = Main.AllPlayerControls.Length;
|
||||
|
||||
List<PlayerControl> Impostors = [];
|
||||
List<PlayerControl> Crewmates = [];
|
||||
List<NetworkedPlayerInfo> Impostors = [];
|
||||
List<NetworkedPlayerInfo> Crewmates = [];
|
||||
List<NetworkedPlayerInfo> CrewAndImps() => [.. Impostors, .. Crewmates];
|
||||
|
||||
// Set imp from settings
|
||||
int[] betterImpostorSettings =
|
||||
@@ -300,7 +302,7 @@ public class RoleManagerPatch
|
||||
{
|
||||
if (Impostors.Count < NumImpostors)
|
||||
{
|
||||
Impostors.Add(player);
|
||||
Impostors.Add(player.Data);
|
||||
Logger.LogPrivate($"Settings Assigned {Utils.GetRoleName(RoleTypes.Impostor)} role to {player.Data.PlayerName}", "RoleManager");
|
||||
}
|
||||
}
|
||||
@@ -320,14 +322,14 @@ public class RoleManagerPatch
|
||||
{
|
||||
if (Impostors.Count < NumImpostors)
|
||||
{
|
||||
Impostors.Add(player);
|
||||
Impostors.Add(player.Data);
|
||||
Logger.LogPrivate($"Override Assigned {Utils.GetRoleName(RoleTypes.Impostor)} role to {player.Data.PlayerName}", "RoleManager");
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
else if (role is RoleTypes.Engineer)
|
||||
{
|
||||
Crewmates.Add(player);
|
||||
Crewmates.Add(player.Data);
|
||||
Logger.LogPrivate($"Override Assigned {Utils.GetRoleName(RoleTypes.Engineer)} role to {player.Data.PlayerName}", "RoleManager");
|
||||
}
|
||||
}
|
||||
@@ -336,7 +338,7 @@ public class RoleManagerPatch
|
||||
|
||||
// Get players in random order
|
||||
List<PlayerControl> players = Main.AllPlayerControls
|
||||
.Where(player => !Impostors.Contains(player) && !Crewmates.Contains(player))
|
||||
.Where(player => !CrewAndImps().Contains(player.Data))
|
||||
.ToList();
|
||||
|
||||
int n = players.Count;
|
||||
@@ -356,29 +358,25 @@ public class RoleManagerPatch
|
||||
|
||||
if (Impostors.Count < NumImpostors)
|
||||
{
|
||||
if (!Crewmates.Contains(pc))
|
||||
{
|
||||
Impostors.Add(pc);
|
||||
Logger.LogPrivate($"Assigned {Utils.GetRoleName(RoleTypes.Impostor)} role to {pc.Data.PlayerName}", "RoleManager");
|
||||
}
|
||||
Impostors.Add(pc.Data);
|
||||
Logger.LogPrivate($"Assigned {Utils.GetRoleName(RoleTypes.Impostor)} role to {pc.Data.PlayerName}", "RoleManager");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Impostors.Contains(pc))
|
||||
{
|
||||
Crewmates.Add(pc);
|
||||
Logger.LogPrivate($"Assigned {Utils.GetRoleName(RoleTypes.Engineer)} role to {pc.Data.PlayerName}", "RoleManager");
|
||||
}
|
||||
Crewmates.Add(pc.Data);
|
||||
Logger.LogPrivate($"Assigned {Utils.GetRoleName(RoleTypes.Engineer)} role to {pc.Data.PlayerName}", "RoleManager");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var player in Impostors)
|
||||
foreach (var data in Impostors)
|
||||
{
|
||||
var player = Utils.PlayerFromPlayerId(data.PlayerId);
|
||||
player.RpcSetRole(RoleTypes.Impostor);
|
||||
}
|
||||
|
||||
foreach (var player in Crewmates)
|
||||
foreach (var data in Crewmates)
|
||||
{
|
||||
var player = Utils.PlayerFromPlayerId(data.PlayerId);
|
||||
player.RpcSetRole(RoleTypes.Engineer);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ public class Main : BasePlugin
|
||||
{
|
||||
public static readonly ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
|
||||
public const string BetaNum = "0";
|
||||
public const string HotfixNum = "0";
|
||||
public const bool IsHotFix = false;
|
||||
public const string HotfixNum = "1";
|
||||
public const bool IsHotFix = true;
|
||||
public const string PluginGuid = "com.ten.betteramongus";
|
||||
public const string PluginVersion = "1.1.4";
|
||||
public const string ReleaseDate = "09.20.2024"; // mm/dd/yyyy
|
||||
@@ -155,11 +155,11 @@ public class Main : BasePlugin
|
||||
{
|
||||
Logger = BepInEx.Logging.Logger.CreateLogSource(PluginGuid);
|
||||
|
||||
BetterDataManager.SetUp();
|
||||
BetterDataManager.LoadData();
|
||||
LoadOptions();
|
||||
Translator.Init();
|
||||
Harmony.PatchAll();
|
||||
BetterDataManager.SetUp();
|
||||
BetterDataManager.LoadData();
|
||||
GameSettingMenuPatch.SetupSettings(true);
|
||||
|
||||
if (PlatformData.Platform == Platforms.StandaloneSteamPC)
|
||||
|
||||
Reference in new issue
Block a user