mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
Task update!
This commit is contained in:
1 parent
a5bc1ddd0c
commit
1bbab59e3e
7 files changed
+60
-9
No files matched your search
+29
-1
@@ -2,6 +2,7 @@
|
||||
using HarmonyLib;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using UnityEngine.Purchasing;
|
||||
|
||||
namespace BetterAmongUs;
|
||||
|
||||
@@ -297,6 +298,27 @@ class AntiCheat
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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}");
|
||||
|
||||
player.BetterData().TimeSinceLastTask = 0f;
|
||||
player.BetterData().LastTaskId = taskId;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
player.BetterData().TimeSinceLastTask = 0f;
|
||||
player.BetterData().LastTaskId = taskId;
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.Pet or (byte)RpcCalls.CancelPet)
|
||||
{
|
||||
if (player?.CurrentOutfit?.PetId == "pet_EmptyPet")
|
||||
@@ -465,10 +487,16 @@ class AntiCheat
|
||||
|
||||
if (player.DataIsCollected() == true && !GameStates.IsLocalGame && GameStates.IsVanillaServer)
|
||||
{
|
||||
if (callId is (byte)RpcCalls.SetName or (byte)RpcCalls.CheckName or (byte)RpcCalls.SetLevel)
|
||||
if (callId is (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}");
|
||||
|
||||
if (callId is (byte)RpcCalls.CheckName)
|
||||
{
|
||||
var name = reader.ReadString();
|
||||
Logger.LogCheat($"{player.Data.PlayerName} Has tried to change their name to '{name}' but has been undone!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +220,10 @@ class BetterHostManager
|
||||
else if (GameStates.IsInGamePlay)
|
||||
{
|
||||
string Role = $"<color={player.GetTeamHexColor()}>{player.GetRoleName()}</color>";
|
||||
if (!player.IsImpostorTeam() && player.myTasks.Count > 0)
|
||||
{
|
||||
Role += $" <color=#cbcbcb>({player.myTasks.ToArray().Where(task => task.IsComplete).Count()}/{player.myTasks.Count})</color>";
|
||||
}
|
||||
if (player.IsImpostorTeam() is false || target.IsImpostorTeam() is false)
|
||||
{
|
||||
if (target.IsAlive() && player != target)
|
||||
|
||||
@@ -102,7 +102,7 @@ static class ExtendedPlayerControl
|
||||
// Kick player
|
||||
public static void Kick(this PlayerControl player, bool ban = false, string setReasonInfo = "")
|
||||
{
|
||||
if (!GameStates.IsHost || !player.DataIsCollected() || player.IsHost() || player.BetterData().BannedByAntiCheat)
|
||||
if (!GameStates.IsHost || !player.DataIsCollected() || player.IsHost() || player.BetterData().BannedByAntiCheat || player.isDummy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ public class ExtendedPlayerInfo
|
||||
public bool IsTOHEHost { get; set; } = false;
|
||||
public bool BannedByAntiCheat { get; set; } = false;
|
||||
public bool HasNoisemakerNotify { get; set; } = false;
|
||||
public float TimeSinceLastTask { get; set; } = 5f;
|
||||
public uint LastTaskId { get; set; } = 0;
|
||||
public int TimesCalledMeeting { get; set; } = 0;
|
||||
public RoleTypes DeadDisplayRole { get; set; }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user