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; }
|
||||
}
|
||||
|
||||
@@ -119,6 +119,10 @@ class MeetingHudUpdatePatch
|
||||
|
||||
string RoleHexColor = target.IsImpostorTeam() ? "#ff1919" : "#8cffff";
|
||||
string Role = $"<color={RoleHexColor}>{target.GetRoleName()}</color>";
|
||||
if (!target.IsImpostorTeam() && target.myTasks.Count > 0)
|
||||
{
|
||||
Role += $" <color=#cbcbcb>({target.myTasks.ToArray().Where(task => task.IsComplete).Count()}/{target.myTasks.Count})</color>";
|
||||
}
|
||||
if (!target.IsImpostorTeammate())
|
||||
{
|
||||
if (PlayerControl.LocalPlayer.IsAlive() && target != PlayerControl.LocalPlayer)
|
||||
|
||||
@@ -72,6 +72,12 @@ class PlayerControlPatch
|
||||
{
|
||||
__instance.BetterData().TimesCalledMeeting = 0;
|
||||
__instance.BetterData().HasNoisemakerNotify = false;
|
||||
__instance.BetterData().TimeSinceLastTask = 5f;
|
||||
__instance.BetterData().LastTaskId = 999;
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.BetterData().TimeSinceLastTask += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,12 +137,15 @@ class PlayerControlPatch
|
||||
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("<color=#00f583>Sicko User</color>+++");
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.AUMData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.AUMData.ContainsValue(friendCode))
|
||||
sbTag.Append("<color=#4f0000>AUM User</color>+++");
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.PlayerData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.PlayerData.ContainsValue(friendCode))
|
||||
sbTag.Append("<color=#fc0000>Known Cheater</color>+++");
|
||||
if (!player.isDummy)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.SickoData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.SickoData.ContainsValue(friendCode))
|
||||
sbTag.Append("<color=#00f583>Sicko User</color>+++");
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.AUMData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.AUMData.ContainsValue(friendCode))
|
||||
sbTag.Append("<color=#4f0000>AUM User</color>+++");
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.PlayerData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.PlayerData.ContainsValue(friendCode))
|
||||
sbTag.Append("<color=#fc0000>Known Cheater</color>+++");
|
||||
}
|
||||
|
||||
if (GameStates.IsInGame && GameStates.IsLobby && !GameStates.IsFreePlay)
|
||||
{
|
||||
@@ -167,6 +176,10 @@ class PlayerControlPatch
|
||||
if (player.IsImpostorTeammate() || player == PlayerControl.LocalPlayer || !PlayerControl.LocalPlayer.IsAlive() || DebugMenu.RevealRoles)
|
||||
{
|
||||
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>";
|
||||
}
|
||||
sbTagTop.Append($"{Role}+++");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Main : BasePlugin
|
||||
public const bool IsHotFix = false;
|
||||
public const string PluginGuid = "com.d1gq.betteramongus";
|
||||
public const string PluginVersion = "1.0.2";
|
||||
public const string ReleaseDate = "08.15.2024"; // mm/dd/yyyy
|
||||
public const string ReleaseDate = "08.16.2024"; // mm/dd/yyyy
|
||||
public const string Github = "https://github.com/D1GQ/BetterAmongUs-Public";
|
||||
public const string Discord = "https://discord.gg/vjYrXpzNAn";
|
||||
|
||||
|
||||
Reference in new issue
Block a user