mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
anti cheat tasks
This commit is contained in:
1 parent
1bbab59e3e
commit
aef41e668b
3 files changed
+29
-17
No files matched your search
+15
-17
@@ -287,27 +287,16 @@ class AntiCheat
|
||||
}
|
||||
}
|
||||
|
||||
if (player.IsImpostorTeam())
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.CompleteTask)
|
||||
{
|
||||
var taskId = reader.ReadPackedUInt32();
|
||||
|
||||
if (!player.myTasks.ToArray().Any(task => task.Id == taskId)
|
||||
|| GameStates.IsMeeting || player.BetterData().LastTaskId != taskId && player.BetterData().TimeSinceLastTask < 3f)
|
||||
var taskId = reader.ReadPackedUInt32();
|
||||
|
||||
if (player.IsImpostorTeam() || !player.myTasks.ToArray().Any(task => task.Id == taskId)
|
||||
|| GameStates.IsMeeting || player.BetterData().LastTaskId == taskId || player.BetterData().LastTaskId != taskId && player.BetterData().TimeSinceLastTask < 1.25f)
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
|
||||
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.myTasks.ToArray().Any(task => task.Id == taskId)} - {GameStates.IsMeeting}" +
|
||||
$" - {player.BetterData().LastTaskId != taskId} && {player.BetterData().TimeSinceLastTask < 3f}");
|
||||
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.IsImpostorTeam()} - {!player.Data.Tasks.ToArray().Any(task => task.Id == taskId)} - {GameStates.IsMeeting}" +
|
||||
$" - {player.BetterData().LastTaskId == taskId} - {player.BetterData().LastTaskId != taskId} && {player.BetterData().TimeSinceLastTask < 1.25f}");
|
||||
|
||||
player.BetterData().TimeSinceLastTask = 0f;
|
||||
player.BetterData().LastTaskId = taskId;
|
||||
@@ -319,6 +308,15 @@ class AntiCheat
|
||||
player.BetterData().LastTaskId = taskId;
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.BootFromVent)
|
||||
{
|
||||
if (player.IsImpostorTeam() || player.myTasks.ToArray().Any(task => task.Id == (uint)TaskTypes.VentCleaning && !task.IsComplete))
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
|
||||
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.IsImpostorTeam()} - {player.myTasks.ToArray().Any(task => task.Id == (uint)TaskTypes.VentCleaning && !task.IsComplete)}");
|
||||
}
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.Pet or (byte)RpcCalls.CancelPet)
|
||||
{
|
||||
if (player?.CurrentOutfit?.PetId == "pet_EmptyPet")
|
||||
|
||||
@@ -167,6 +167,17 @@ class BetterHostManager
|
||||
}
|
||||
break;
|
||||
|
||||
case (byte)RpcCalls.CompleteTask:
|
||||
{
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
RPC.SyncAllNames();
|
||||
}, 0.25f, shoudLog: false);
|
||||
|
||||
shouldReturn = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
shouldReturn = true;
|
||||
break;
|
||||
|
||||
@@ -10,6 +10,9 @@ public class ExtendedPlayerInfo
|
||||
public bool IsBetterHost { get; set; } = false;
|
||||
public bool IsTOHEHost { get; set; } = false;
|
||||
public bool BannedByAntiCheat { get; set; } = false;
|
||||
|
||||
// Track Game Info
|
||||
|
||||
public bool HasNoisemakerNotify { get; set; } = false;
|
||||
public float TimeSinceLastTask { get; set; } = 5f;
|
||||
public uint LastTaskId { get; set; } = 0;
|
||||
|
||||
Reference in new issue
Block a user