mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
fixes
This commit is contained in:
1 parent
7e89b5f518
commit
497243f573
6 files changed
+18
-26
No files matched your search
@@ -290,7 +290,7 @@ static class PlayerControlHelper
|
||||
BAUAntiCheat.SickoData.ContainsKey(player.GetHashPuid()) ||
|
||||
BAUAntiCheat.AUMData.ContainsKey(player.GetHashPuid()));
|
||||
// Check if player is the host
|
||||
public static bool IsHost(this PlayerControl player) => player?.Data != null && GameData.Instance?.GetHost()?.Puid == player.Data.Puid;
|
||||
public static bool IsHost(this PlayerControl player) => player?.Data != null && GameData.Instance?.GetHost() == player.Data;
|
||||
|
||||
// Get players HashPuid
|
||||
public static string GetHashPuid(this PlayerControl player)
|
||||
|
||||
+1
-7
@@ -113,13 +113,7 @@ public static class Utils
|
||||
public static string GetHashPuid(PlayerControl player)
|
||||
{
|
||||
if (player?.Data?.Puid == null) return "";
|
||||
|
||||
string puid = player.Data.Puid;
|
||||
|
||||
using SHA256 sha256 = SHA256.Create();
|
||||
byte[] sha256Bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(puid));
|
||||
string sha256Hash = BitConverter.ToString(sha256Bytes).Replace("-", "").ToLower();
|
||||
return sha256Hash.Substring(0, 5) + sha256Hash.Substring(sha256Hash.Length - 4);
|
||||
return GetHashStr(player.Data.Puid);
|
||||
}
|
||||
// Get HashPuid from puid
|
||||
public static string GetHashStr(string str)
|
||||
|
||||
@@ -11,7 +11,7 @@ public class DespawnNetObjectHandler : RPCHandler
|
||||
|
||||
public override void HandleGameData(MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost) return;
|
||||
// if (!GameState.IsHost) return;
|
||||
|
||||
uint netId = reader.ReadPackedUInt32();
|
||||
var innerNetObject = innerNetClient.FindObjectByNetId<InnerNetObject>(netId);
|
||||
|
||||
@@ -10,10 +10,10 @@ public class SendQuickChatHandler : RPCHandler
|
||||
|
||||
public override void HandleAntiCheat(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (sender.IsAlive() && GameState.IsInGamePlay && !GameState.IsMeeting && !GameState.IsExilling)
|
||||
if (sender.IsAlive() && GameState.IsInGamePlay && !GameState.IsMeeting && !GameState.IsExilling || reader.BytesRemaining == 0)
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(sender, GetFormatActionText());
|
||||
LogRpcInfo($"{sender.IsAlive()} && {GameState.IsInGamePlay} && {!GameState.IsMeeting} && {!GameState.IsExilling}");
|
||||
LogRpcInfo($"{sender.IsAlive()} && {GameState.IsInGamePlay} && {!GameState.IsMeeting} && {!GameState.IsExilling} || {reader.BytesRemaining == 0}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ namespace BetterAmongUs.Patches;
|
||||
[HarmonyPatch(typeof(PlayerControl))]
|
||||
class PlayerControlPatch
|
||||
{
|
||||
public static Dictionary<byte, float> time = [];
|
||||
[HarmonyPatch(nameof(PlayerControl.FixedUpdate))]
|
||||
[HarmonyPrefix]
|
||||
public static void FixedUpdate_Prefix(PlayerControl __instance)
|
||||
@@ -71,7 +70,7 @@ class PlayerControlPatch
|
||||
var sbTagTop = new StringBuilder();
|
||||
var sbTagBottom = new StringBuilder();
|
||||
|
||||
SetPlayerOutline(player, hashPuid, friendCode, sbTag);
|
||||
SetPlayerOutline(player, hashPuid, player.Data.FriendCode, sbTag);
|
||||
|
||||
if (GameState.IsInGame && GameState.IsLobby && !GameState.IsFreePlay)
|
||||
{
|
||||
@@ -104,7 +103,7 @@ class PlayerControlPatch
|
||||
private static string ValidateFriendCode(PlayerControl player, out string color)
|
||||
{
|
||||
color = "#FFFFFF";
|
||||
if (player?.Data == null) return "";
|
||||
if (player?.Data == null) return string.Empty;
|
||||
|
||||
void TryKick()
|
||||
{
|
||||
@@ -145,36 +144,37 @@ class PlayerControlPatch
|
||||
friendCode = new string('*', friendCode.Length);
|
||||
}
|
||||
|
||||
return friendCode;
|
||||
return friendCode.Trim();
|
||||
}
|
||||
|
||||
private static void SetPlayerOutline(PlayerControl player, string hashPuid, string friendCode, StringBuilder sbTag)
|
||||
{
|
||||
if (hashPuid != "" && BAUAntiCheat.SickoData.ContainsKey(hashPuid)
|
||||
|| friendCode != "" && BAUAntiCheat.SickoData.ContainsValue(friendCode))
|
||||
var color = player.cosmetics.currentBodySprite.BodySprite.material.GetColor("_OutlineColor");
|
||||
if ((!string.IsNullOrEmpty(hashPuid) && hashPuid.Length > 0 && BAUAntiCheat.SickoData.ContainsKey(hashPuid))
|
||||
|| (!string.IsNullOrEmpty(friendCode) && friendCode.Length > 0 && BAUAntiCheat.SickoData.ContainsValue(friendCode)))
|
||||
{
|
||||
sbTag.Append($"<color=#00f583>{Translator.GetString("Player.SickoUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#00f583");
|
||||
}
|
||||
else if (hashPuid != "" && BAUAntiCheat.AUMData.ContainsKey(hashPuid)
|
||||
|| friendCode != "" && BAUAntiCheat.AUMData.ContainsValue(friendCode))
|
||||
else if ((!string.IsNullOrEmpty(hashPuid) && hashPuid.Length > 0 && BAUAntiCheat.AUMData.ContainsKey(hashPuid))
|
||||
|| (!string.IsNullOrEmpty(friendCode) && friendCode.Length > 0 && BAUAntiCheat.AUMData.ContainsValue(friendCode)))
|
||||
{
|
||||
sbTag.Append($"<color=#4f0000>{Translator.GetString("Player.AUMUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#4f0000");
|
||||
}
|
||||
else if (hashPuid != "" && BAUAntiCheat.KNData.ContainsKey(hashPuid)
|
||||
|| friendCode != "" && BAUAntiCheat.KNData.ContainsValue(friendCode))
|
||||
else if ((!string.IsNullOrEmpty(hashPuid) && hashPuid.Length > 0 && BAUAntiCheat.KNData.ContainsKey(hashPuid))
|
||||
|| (!string.IsNullOrEmpty(friendCode) && friendCode.Length > 0 && BAUAntiCheat.KNData.ContainsValue(friendCode)))
|
||||
{
|
||||
sbTag.Append($"<color=#8731e7>{Translator.GetString("Player.KNUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#8731e7");
|
||||
}
|
||||
else if (hashPuid != "" && BAUAntiCheat.PlayerData.ContainsKey(hashPuid)
|
||||
|| friendCode != "" && BAUAntiCheat.PlayerData.ContainsValue(friendCode))
|
||||
else if ((!string.IsNullOrEmpty(hashPuid) && hashPuid.Length > 0 && BAUAntiCheat.PlayerData.ContainsKey(hashPuid))
|
||||
|| (!string.IsNullOrEmpty(friendCode) && friendCode.Length > 0 && BAUAntiCheat.PlayerData.ContainsValue(friendCode)))
|
||||
{
|
||||
sbTag.Append($"<color=#fc0000>{Translator.GetString("Player.KnownCheater")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#fc0000");
|
||||
}
|
||||
else
|
||||
else if (color == Utils.HexToColor32("#00f583") || color == Utils.HexToColor32("#4f0000") || color == Utils.HexToColor32("#fc0000") || color == Utils.HexToColor32("#8731e7"))
|
||||
{
|
||||
player.SetOutline(false, null);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ class OnGameJoinedPatch
|
||||
{
|
||||
try
|
||||
{
|
||||
PlayerControlPatch.time.Clear();
|
||||
|
||||
BAUAntiCheat.PauseAntiCheat();
|
||||
|
||||
// Fix host icon in lobby on modded servers
|
||||
|
||||
Reference in new issue
Block a user