mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
Add protection to timeout exploit
This commit is contained in:
1 parent
30af93801a
commit
fd365fd837
7 files changed
+65
-5
No files matched your search
@@ -199,8 +199,6 @@ internal static class NetworkManager
|
||||
HandleInvalidTag(reader);
|
||||
break;
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -144,7 +144,6 @@ internal sealed class BAUUpdateData
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,7 +6,7 @@ using HarmonyLib;
|
||||
namespace BetterAmongUs.Patches.Gameplay.Anticheat;
|
||||
|
||||
[HarmonyPatch]
|
||||
internal class CheckPlayerLevelPatch
|
||||
internal static class CheckPlayerLevelPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))]
|
||||
[HarmonyPostfix]
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using BepInEx.Unity.IL2CPP.Utils.Collections;
|
||||
using BetterAmongUs.Generated;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Utilities;
|
||||
using HarmonyLib;
|
||||
using System.Collections;
|
||||
|
||||
namespace BetterAmongUs.Patches.Gameplay.Anticheat;
|
||||
|
||||
[HarmonyPatch]
|
||||
internal static class InitializePlayerTimeoutPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.ClientInitialize))]
|
||||
[HarmonyPostfix]
|
||||
private static void PlayerControl_ClientInitialize_Postfix(PlayerControl __instance, ref Il2CppSystem.Collections.IEnumerator __result)
|
||||
{
|
||||
__result = CoClientInitialize(__instance, __result).WrapToIl2Cpp();
|
||||
}
|
||||
|
||||
private static IEnumerator CoClientInitialize(PlayerControl player, Il2CppSystem.Collections.IEnumerator original)
|
||||
{
|
||||
player.Visible = false;
|
||||
bool exit = false;
|
||||
yield return player.AssertWithTimeout((Func<bool>)(() => GameData.Instance != null && player.Data != null && !player.Data.IsIncomplete), (Action)(() =>
|
||||
{
|
||||
if (GameState.IsHost)
|
||||
{
|
||||
player.Kick(true, TranslationStrings.AntiCheat_Reason_Initialize.LocalizedString, true, forceBan: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameData.Instance != null && player.Data != null)
|
||||
{
|
||||
var outfit = player.Data.DefaultOutfit;
|
||||
outfit.PlayerName = TranslationStrings.Player_Loading.LocalizedString;
|
||||
outfit.HatId = HatData.EmptyId;
|
||||
outfit.VisorId = VisorData.EmptyId;
|
||||
outfit.SkinId = SkinData.EmptyId;
|
||||
outfit.PetId = PetData.EmptyId;
|
||||
outfit.NamePlateId = NamePlateData.EmptyId;
|
||||
outfit.ColorId = 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
exit = true;
|
||||
}
|
||||
}
|
||||
}), 25f);
|
||||
|
||||
if (exit)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return original;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ using UnityEngine;
|
||||
namespace BetterAmongUs.Patches.Gameplay.Anticheat;
|
||||
|
||||
[HarmonyPatch]
|
||||
internal class PlatformSpoofPatch
|
||||
internal static class PlatformSpoofPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(PlatformSpecificData), nameof(PlatformSpecificData.Deserialize))]
|
||||
[HarmonyPostfix]
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
"AntiCheat.Reason.PlatformSpoofer": "Platform Spoofer",
|
||||
"AntiCheat.Reason.RPCSentPS": "RPC Spam",
|
||||
"AntiCheat.Reason.VoteKick": "Vote Kick Exploit",
|
||||
"AntiCheat.Reason.Initialize": "Failed To Initialize Player",
|
||||
"AntiCheat.Reason.SickoMenuUser": "Known Sicko User",
|
||||
"AntiCheat.Reason.AUMUser": "Known AUM User",
|
||||
"AntiCheat.Reason.KNUser": "Known KN User",
|
||||
|
||||
@@ -673,6 +673,11 @@ public static class TranslationStrings
|
||||
/// </summary>
|
||||
public static readonly TranslationString AntiCheat_Reason_VoteKick = new("AntiCheat.Reason.VoteKick");
|
||||
|
||||
/// <summary>
|
||||
/// Base Translation: Failed To Initialize Player
|
||||
/// </summary>
|
||||
public static readonly TranslationString AntiCheat_Reason_Initialize = new("AntiCheat.Reason.Initialize");
|
||||
|
||||
/// <summary>
|
||||
/// Base Translation: Known Sicko User
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user