mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-11-19 13:17:17 +00:00
16 files changed
+346
-318
No files matched your search
+23
-6
@@ -11,6 +11,7 @@ class AntiCheat
|
||||
public static Dictionary<string, string> PlayerData = []; // HashPuid, FriendCode
|
||||
public static Dictionary<string, string> SickoData = []; // HashPuid, FriendCode
|
||||
public static Dictionary<string, string> AUMData = []; // HashPuid, FriendCode
|
||||
public static Dictionary<string, string> KNData = []; // HashPuid, FriendCode
|
||||
private static bool IsEnabled = true;
|
||||
|
||||
public static void Update()
|
||||
@@ -204,7 +205,23 @@ class AntiCheat
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (callId is unchecked((byte)CustomRPC.Killnetwork) && Main.AntiCheat.Value && BetterGameSettings.DetectCheatClients.GetBool())
|
||||
{
|
||||
var flag = KNData.ContainsKey(Utils.GetHashPuid(player));
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
player.ReportPlayer(ReportReasons.Cheating_Hacking);
|
||||
KNData[Utils.GetHashPuid(player)] = player.Data.FriendCode;
|
||||
BetterDataManager.SaveCheatData(Utils.GetHashPuid(player), player.Data.FriendCode, player.Data.PlayerName, "knData", "KN RPC");
|
||||
BetterNotificationManager.NotifyCheat(player, Translator.GetString("AntiCheat.Cheat.KN"), Translator.GetString("AntiCheat.HasBeenDetectedWithCheat2"));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check and notify for invalid rpcs
|
||||
public static void CheckRPC(PlayerControl player, byte callId, MessageReader Oldreader)
|
||||
{
|
||||
@@ -563,13 +580,13 @@ class AntiCheat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.StartMeeting)
|
||||
if (callId is (byte)RpcCalls.StartMeeting or (byte)RpcCalls.ReportDeadBody)
|
||||
{
|
||||
if (GameStates.IsMeeting && MeetingHudUpdatePatch.timeOpen > 0.5f || GameStates.IsHideNSeek || !player.IsAlive() || player.IsInVent() || player.shapeshifting
|
||||
if (GameStates.IsMeeting && MeetingHudUpdatePatch.timeOpen > 0.5f || GameStates.IsHideNSeek || !player.IsAlive() && callId is (byte)RpcCalls.ReportDeadBody || player.IsInVent() || player.shapeshifting
|
||||
|| player.inMovingPlat || player.onLadder || player.MyPhysics.Animations.IsPlayingAnyLadderAnimation())
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidActionRPC"), Enum.GetName((RpcCalls)callId)));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsMeeting} && {GameStates.IsHideNSeek} || {!player.IsAlive()} || {player.IsInVent()} || {player.shapeshifting}" +
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsMeeting} && {MeetingHudUpdatePatch.timeOpen > 0.5f} || {!player.IsAlive() && callId is (byte)RpcCalls.ReportDeadBody} || {player.IsInVent()} || {player.shapeshifting}" +
|
||||
$" || {player.inMovingPlat} || {player.onLadder} || {player.MyPhysics.Animations.IsPlayingAnyLadderAnimation()}");
|
||||
|
||||
if (GameStates.IsHost)
|
||||
@@ -625,10 +642,10 @@ class AntiCheat
|
||||
_ = reader.ReadByte();
|
||||
var type = reader.ReadByte();
|
||||
|
||||
if (!GameStates.IsMeeting || !Enum.IsDefined(typeof(ChatNoteTypes), type))
|
||||
if (!GameStates.IsMeeting || type != (byte)ChatNoteTypes.DidVote)
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidActionRPC"), Enum.GetName((RpcCalls)callId)));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {!GameStates.IsMeeting} || {!Enum.IsDefined(typeof(ChatNoteTypes), type)}");
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidActionRPC"), Enum.GetName(typeof(RpcCalls), (int)callId)));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(typeof(RpcCalls), (int)callId)}: {!GameStates.IsMeeting} || {type != (byte)ChatNoteTypes.DidVote}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class BetterAccountInfo
|
||||
public bool? IsSponsor = false;
|
||||
public int? SponsorTier = 0;
|
||||
|
||||
public static BetterAccountInfo GenerateInfo(string allUserInfo, NetworkedPlayerInfo data)
|
||||
public static BetterAccountInfo SerializeInfo(string allUserInfo, NetworkedPlayerInfo data)
|
||||
{
|
||||
BetterAccountInfo accInfo = new();
|
||||
|
||||
|
||||
@@ -61,12 +61,13 @@ class BetterDataManager
|
||||
{
|
||||
// Initialize with predefined categories
|
||||
var initialData = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
|
||||
{
|
||||
{ "Data", new Dictionary<string, Dictionary<string, string>>() }, // Default category
|
||||
{ "cheatData", new Dictionary<string, Dictionary<string, string>>() },
|
||||
{ "sickoData", new Dictionary<string, Dictionary<string, string>>() },
|
||||
{ "aumData", new Dictionary<string, Dictionary<string, string>>() }
|
||||
};
|
||||
{
|
||||
{ "Data", new Dictionary<string, Dictionary<string, string>>() }, // Default category
|
||||
{ "cheatData", new Dictionary<string, Dictionary<string, string>>() },
|
||||
{ "sickoData", new Dictionary<string, Dictionary<string, string>>() },
|
||||
{ "aumData", new Dictionary<string, Dictionary<string, string>>() },
|
||||
{ "knData", new Dictionary<string, Dictionary<string, string>>() }
|
||||
};
|
||||
|
||||
string json = JsonSerializer.Serialize(initialData, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(filePath, json);
|
||||
@@ -94,19 +95,23 @@ class BetterDataManager
|
||||
// Check and add missing categories
|
||||
if (!jsonData.ContainsKey("Data"))
|
||||
{
|
||||
jsonData["Data"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
jsonData["Data"] = [];
|
||||
}
|
||||
if (!jsonData.ContainsKey("cheatData"))
|
||||
{
|
||||
jsonData["cheatData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
jsonData["cheatData"] = [];
|
||||
}
|
||||
if (!jsonData.ContainsKey("sickoData"))
|
||||
{
|
||||
jsonData["sickoData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
jsonData["sickoData"] = [];
|
||||
}
|
||||
if (!jsonData.ContainsKey("aumData"))
|
||||
{
|
||||
jsonData["aumData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
jsonData["aumData"] = [];
|
||||
}
|
||||
if (!jsonData.ContainsKey("knData"))
|
||||
{
|
||||
jsonData["knData"] = [];
|
||||
}
|
||||
|
||||
// Write the updated JSON data back to the file
|
||||
@@ -468,6 +473,14 @@ class BetterDataManager
|
||||
AntiCheat.AUMData[item.Value["HashPUID"]] = item.Value["FriendCode"];
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonData.ContainsKey("knData"))
|
||||
{
|
||||
foreach (var item in jsonData["knData"])
|
||||
{
|
||||
AntiCheat.KNData[item.Value["HashPUID"]] = item.Value["FriendCode"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -208,7 +208,7 @@ class BetterHostManager
|
||||
{
|
||||
if (target == null || target.IsLocalPlayer()) continue;
|
||||
|
||||
string NewName = player.CurrentOutfit.PlayerName;
|
||||
string NewName = !player.IsInShapeshift() ? player.Data.PlayerName : GameData.Instance.AllPlayers.ToArray().First(data => data.PlayerId == player.shapeshiftTargetPlayerId).PlayerName;
|
||||
|
||||
StringBuilder sbTopTag = new StringBuilder();
|
||||
|
||||
|
||||
@@ -1,122 +1,116 @@
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BetterAmongUs;
|
||||
|
||||
public class ExtendedPlayerInfo : MonoBehaviour
|
||||
{
|
||||
private bool hasSet = false;
|
||||
public void SetInfo(NetworkedPlayerInfo data)
|
||||
{
|
||||
if (hasSet) return;
|
||||
_Data = data;
|
||||
_PlayerId = data.PlayerId;
|
||||
hasSet = true;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
AntiCheatInfo.TimeSinceLastTask += Time.deltaTime;
|
||||
}
|
||||
|
||||
public void LateUpdate()
|
||||
{
|
||||
if (gameObject == null) return;
|
||||
|
||||
if (_Data != null && string.IsNullOrEmpty(RealName) && !string.IsNullOrEmpty(_Data.PlayerName))
|
||||
{
|
||||
RealName = _Data.PlayerName;
|
||||
}
|
||||
}
|
||||
|
||||
public byte _PlayerId { get; private set; }
|
||||
public NetworkedPlayerInfo? _Data { get; private set; }
|
||||
public string? RealName { get; private set; }
|
||||
public Dictionary<byte, string> LastNameSetFor { get; set; } = [];
|
||||
public bool IsBetterUser { get; set; } = false;
|
||||
public bool IsVerifiedBetterUser { get; set; } = false;
|
||||
public bool IsBetterHost { get; set; } = false;
|
||||
public bool IsTOHEHost { get; set; } = false;
|
||||
public bool HasShowDcMsg { get; set; } = false;
|
||||
public DisconnectReasons DisconnectReason { get; set; } = DisconnectReasons.Unknown;
|
||||
|
||||
public BetterAccountInfo? AccountInfo { get; } = new();
|
||||
public ExtendedRoleInfo? RoleInfo { get; } = new();
|
||||
public ExtendedAntiCheatInfo? AntiCheatInfo { get; } = new();
|
||||
}
|
||||
|
||||
public class ExtendedAntiCheatInfo
|
||||
{
|
||||
public bool BannedByAntiCheat { get; set; } = false;
|
||||
public List<string> AUMChats { get; set; } = [];
|
||||
public int TimesAttemptedKilled { get; set; } = 0;
|
||||
public int OpenSabotageNum { get; set; } = 0;
|
||||
public bool IsFixingPanelSabotage => OpenSabotageNum != 0;
|
||||
public int TimesCalledMeeting { get; set; } = 0;
|
||||
public float TimeSinceLastTask { get; set; } = 5f;
|
||||
public uint LastTaskId { get; set; } = 999;
|
||||
}
|
||||
|
||||
public class ExtendedRoleInfo
|
||||
{
|
||||
public int Kills { get; set; } = 0;
|
||||
public bool HasNoisemakerNotify { get; set; } = false;
|
||||
public RoleTypes DeadDisplayRole { get; set; }
|
||||
}
|
||||
|
||||
public static class PlayerControlDataExtension
|
||||
{
|
||||
// Base
|
||||
public class ExtendedPlayerInfo
|
||||
[HarmonyPatch(typeof(NetworkedPlayerInfo))]
|
||||
class NetworkedPlayerInfoPatch
|
||||
{
|
||||
public BetterAccountInfo? AccountInfo { get; set; }
|
||||
public NetworkedPlayerInfo? _Data { get; set; }
|
||||
public string? RealName { get; set; }
|
||||
public Dictionary<byte, string> LastNameSetFor { get; set; } = [];
|
||||
public bool IsBetterUser { get; set; } = false;
|
||||
public bool IsVerifiedBetterUser { get; set; } = false;
|
||||
public bool IsBetterHost { get; set; } = false;
|
||||
public bool IsTOHEHost { get; set; } = false;
|
||||
public bool HasShowDcMsg { get; set; } = false;
|
||||
|
||||
// Track Game Info
|
||||
public DisconnectReasons DisconnectReason { get; set; } = DisconnectReasons.Unknown;
|
||||
public ExtendedRoleInfo? RoleInfo { get; set; }
|
||||
public ExtendedAntiCheatInfo? AntiCheatInfo { get; set; }
|
||||
}
|
||||
|
||||
public class ExtendedAntiCheatInfo
|
||||
{
|
||||
public bool BannedByAntiCheat { get; set; } = false;
|
||||
public List<string> AUMChats { get; set; } = [];
|
||||
public int TimesAttemptedKilled { get; set; } = 0;
|
||||
public int OpenSabotageNum { get; set; } = 0;
|
||||
public bool IsFixingPanelSabotage => OpenSabotageNum != 0;
|
||||
public int TimesCalledMeeting { get; set; } = 0;
|
||||
public float TimeSinceLastTask { get; set; } = 5f;
|
||||
public uint LastTaskId { get; set; } = 999;
|
||||
}
|
||||
|
||||
public class ExtendedRoleInfo
|
||||
{
|
||||
public int Kills { get; set; } = 0;
|
||||
public bool HasNoisemakerNotify { get; set; } = false;
|
||||
public RoleTypes DeadDisplayRole { get; set; }
|
||||
}
|
||||
|
||||
public static readonly Dictionary<string, ExtendedPlayerInfo> playerInfo = [];
|
||||
|
||||
public static void ClearData(this ExtendedPlayerInfo BetterData) => playerInfo[BetterData._Data.Puid] = new ExtendedPlayerInfo
|
||||
{
|
||||
_Data = BetterData._Data,
|
||||
RoleInfo = new ExtendedRoleInfo(),
|
||||
AntiCheatInfo = new ExtendedAntiCheatInfo(),
|
||||
AccountInfo = new BetterAccountInfo()
|
||||
};
|
||||
|
||||
// Reset info when needed
|
||||
public static void ResetPlayerData(PlayerControl player)
|
||||
{
|
||||
if (player == null) return;
|
||||
|
||||
if (GameStates.IsLobby)
|
||||
[HarmonyPatch(nameof(NetworkedPlayerInfo.Init))]
|
||||
[HarmonyPostfix]
|
||||
public static void Init_Postfix(NetworkedPlayerInfo __instance)
|
||||
{
|
||||
player.BetterData().AntiCheatInfo.TimesCalledMeeting = 0;
|
||||
player.BetterData().RoleInfo.HasNoisemakerNotify = false;
|
||||
player.BetterData().AntiCheatInfo.TimeSinceLastTask = 5f;
|
||||
player.BetterData().AntiCheatInfo.LastTaskId = 999;
|
||||
player.BetterData().RoleInfo.Kills = 0;
|
||||
player.BetterData().AntiCheatInfo.OpenSabotageNum = 0;
|
||||
player.BetterData().AntiCheatInfo.TimesAttemptedKilled = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.BetterData().AntiCheatInfo.TimeSinceLastTask += Time.deltaTime;
|
||||
|
||||
if (player.IsAlive() || player.Data.RoleType == RoleTypes.GuardianAngel)
|
||||
player.BetterData().RoleInfo.DeadDisplayRole = player.Data.RoleType;
|
||||
TryCreateExtendedData(__instance);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(player.BetterData().RealName))
|
||||
[HarmonyPatch(nameof(NetworkedPlayerInfo.Deserialize))]
|
||||
[HarmonyPostfix]
|
||||
public static void Deserialize_Postfix(NetworkedPlayerInfo __instance)
|
||||
{
|
||||
player.BetterData().RealName = player.Data.PlayerName;
|
||||
TryCreateExtendedData(__instance);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper method to initialize and return BetterData
|
||||
private static ExtendedPlayerInfo GetOrCreateBetterData(string puid, NetworkedPlayerInfo data, string? realName = null)
|
||||
{
|
||||
if (!playerInfo.ContainsKey(puid))
|
||||
public static void TryCreateExtendedData(NetworkedPlayerInfo data)
|
||||
{
|
||||
playerInfo[puid] = new ExtendedPlayerInfo
|
||||
if (data.BetterData() == null)
|
||||
{
|
||||
_Data = data,
|
||||
RealName = realName,
|
||||
RoleInfo = new ExtendedRoleInfo(),
|
||||
AntiCheatInfo = new ExtendedAntiCheatInfo(),
|
||||
AccountInfo = new BetterAccountInfo()
|
||||
};
|
||||
ExtendedPlayerInfo newBetterData = data.gameObject.AddComponent<ExtendedPlayerInfo>();
|
||||
newBetterData.SetInfo(data);
|
||||
}
|
||||
}
|
||||
return playerInfo[puid];
|
||||
}
|
||||
|
||||
// Get BetterData from PlayerControl
|
||||
public static ExtendedPlayerInfo? BetterData(this PlayerControl player)
|
||||
{
|
||||
return player == null ? null : GetOrCreateBetterData(player.Data.Puid, player.Data);
|
||||
return player?.Data?.GetComponent<ExtendedPlayerInfo>();
|
||||
}
|
||||
|
||||
// Get BetterData from NetworkedPlayerInfo
|
||||
public static ExtendedPlayerInfo? BetterData(this NetworkedPlayerInfo info)
|
||||
public static ExtendedPlayerInfo? BetterData(this NetworkedPlayerInfo data)
|
||||
{
|
||||
return GetOrCreateBetterData(info.Puid, info);
|
||||
return data?.GetComponent<ExtendedPlayerInfo>();
|
||||
}
|
||||
|
||||
// Get BetterData from ClientData
|
||||
public static ExtendedPlayerInfo? BetterData(this ClientData data)
|
||||
{
|
||||
var player = Utils.PlayerFromClientId(data.Id);
|
||||
return player == null ? null : GetOrCreateBetterData(player.Data.Puid, player.Data, player.Data.PlayerName);
|
||||
return player?.Data?.GetComponent<ExtendedPlayerInfo>();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -10,6 +10,7 @@ enum CustomRPC : int
|
||||
Sicko = 420, // Results in 164
|
||||
AUM = 42069, // Results in 85
|
||||
AUMChat = 101,
|
||||
Killnetwork = 250,
|
||||
|
||||
// TOHE
|
||||
VersionCheck = 80,
|
||||
@@ -235,7 +236,6 @@ internal static class RPC
|
||||
case (byte)RpcCalls.SetName:
|
||||
reader.ReadUInt32();
|
||||
var name = reader.ReadString();
|
||||
player.BetterData().RealName = name;
|
||||
break;
|
||||
case (byte)RpcCalls.SendChat:
|
||||
var text = reader.ReadString();
|
||||
@@ -258,6 +258,7 @@ internal static class RPC
|
||||
|
||||
HashSet<string> bannedWords = new HashSet<string>(
|
||||
File.ReadLines(BetterDataManager.banWordListFile)
|
||||
.Where(line => !line.TrimStart().StartsWith("//"))
|
||||
.Select(normalizeText)
|
||||
.Where(text => !string.IsNullOrWhiteSpace(text))
|
||||
);
|
||||
|
||||
+17
-7
@@ -105,14 +105,15 @@ class ChatPatch
|
||||
[HarmonyPostfix]
|
||||
public static void AddChat_Postfix(ChatController __instance, [HarmonyArgument(0)] PlayerControl sourcePlayer, [HarmonyArgument(1)] string chatText)
|
||||
{
|
||||
ChatBubble chatBubble = SetChatPoolTheme();
|
||||
ChatBubble? chatBubble = SetChatPoolTheme();
|
||||
if (chatBubble == null) return;
|
||||
|
||||
StringBuilder sbTag = new StringBuilder();
|
||||
StringBuilder sbInfo = new StringBuilder();
|
||||
|
||||
string hashPuid = Utils.GetHashPuid(sourcePlayer);
|
||||
string friendCode = sourcePlayer.Data.FriendCode;
|
||||
string playerName = sourcePlayer.Data.PlayerName;
|
||||
string playerName = sourcePlayer.BetterData().RealName ?? "";
|
||||
string Role = $"<size=75%><color={sourcePlayer.GetTeamHexColor()}>{sourcePlayer.GetRoleName()}</color></size>+++";
|
||||
|
||||
if (GameStates.IsLobby && !GameStates.IsFreePlay)
|
||||
@@ -166,7 +167,7 @@ class ChatPatch
|
||||
}
|
||||
sbInfo.Append("</size>");
|
||||
|
||||
bool flag = sourcePlayer == PlayerControl.LocalPlayer;
|
||||
bool flag = sourcePlayer.IsLocalPlayer();
|
||||
if (flag)
|
||||
{
|
||||
playerName = $"{sbInfo} " + playerName;
|
||||
@@ -178,7 +179,14 @@ class ChatPatch
|
||||
|
||||
chatBubble.NameText.text = playerName;
|
||||
chatBubble.ColorBlindName.color = Palette.PlayerColors[sourcePlayer.Data.DefaultOutfit.ColorId];
|
||||
Logger.Log($"{sourcePlayer.Data.PlayerName} -> {chatText}", "ChatLog");
|
||||
if (sourcePlayer.IsAlive() || !PlayerControl.LocalPlayer.IsAlive())
|
||||
{
|
||||
Logger.Log($"{sourcePlayer.Data.PlayerName} -> {chatText}", "ChatLog");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogPrivate($"{sourcePlayer.Data.PlayerName} -> {chatText}", "ChatLog");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(ChatController.AddChatNote))]
|
||||
@@ -227,7 +235,7 @@ class ChatPatch
|
||||
}
|
||||
|
||||
// Set chat theme
|
||||
public static ChatBubble SetChatPoolTheme(ChatBubble? asChatBubble = null)
|
||||
public static ChatBubble? SetChatPoolTheme(ChatBubble? asChatBubble = null)
|
||||
{
|
||||
ChatBubble Get() => HudManager.Instance.Chat.chatBubblePool.activeChildren.ToArray()
|
||||
.Select(c => c.GetComponent<ChatBubble>())
|
||||
@@ -235,16 +243,18 @@ class ChatPatch
|
||||
|
||||
ChatBubble chatBubble = asChatBubble ??= Get();
|
||||
|
||||
if (chatBubble == null) return chatBubble;
|
||||
|
||||
if (Main.ChatDarkMode.Value)
|
||||
{
|
||||
chatBubble.transform.Find("ChatText (TMP)").GetComponent<TextMeshPro>().color = new Color(1f, 1f, 1f, 1f);
|
||||
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.05f, 0.05f, 0.05f, 1f);
|
||||
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.15f, 0.15f, 0.15f, 1f);
|
||||
|
||||
if (chatBubble.transform.Find("PoolablePlayer/xMark") != null)
|
||||
{
|
||||
if (chatBubble.transform.Find("PoolablePlayer/xMark").GetComponent<SpriteRenderer>().enabled == true)
|
||||
{
|
||||
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.05f, 0.05f, 0.05f, 0.5f);
|
||||
chatBubble.transform.Find("Background").GetComponent<SpriteRenderer>().color = new Color(0.15f, 0.15f, 0.15f, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using BepInEx;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -58,9 +59,9 @@ public static class OptionsMenuBehaviourPatch
|
||||
{
|
||||
RPC.SendBetterCheck();
|
||||
|
||||
foreach (var kvp in PlayerControlDataExtension.playerInfo)
|
||||
foreach (var player in Main.AllPlayerControls)
|
||||
{
|
||||
PlayerControlDataExtension.playerInfo[kvp.Key].LastNameSetFor.Clear();
|
||||
player.BetterData().LastNameSetFor.Clear();
|
||||
}
|
||||
|
||||
RPC.SyncAllNames(force: true);
|
||||
@@ -162,6 +163,7 @@ public static class OptionsMenuBehaviourPatch
|
||||
SwitchToVanilla = ClientOptionItem.Create(title, null, __instance, SwitchToVanillaButtonToggle, IsToggle: false, toggleCheck: () => !toggleCheckInGame(title));
|
||||
static void SwitchToVanillaButtonToggle()
|
||||
{
|
||||
ConsoleManager.DetachConsole();
|
||||
UnityEngine.Object.Destroy(BetterNotificationManager.BAUNotificationManagerObj);
|
||||
Harmony.UnpatchAll();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using HarmonyLib;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace BetterAmongUs.Patches;
|
||||
|
||||
@@ -62,6 +63,24 @@ public class ClientPatch
|
||||
{
|
||||
Logger.Log($"Client has left game for: {Enum.GetName(reason)}", "AmongUsClientPatch");
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(AmongUsClient.OnGameEnd))]
|
||||
[HarmonyPrefix]
|
||||
public static void OnGameEnd_Prefix()
|
||||
{
|
||||
foreach (var data in GameData.Instance.AllPlayers)
|
||||
{
|
||||
UnityEngine.Object.DontDestroyOnLoad(data.gameObject);
|
||||
}
|
||||
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
foreach (var data in GameData.Instance.AllPlayers)
|
||||
{
|
||||
SceneManager.MoveGameObjectToScene(data.gameObject, SceneManager.GetActiveScene());
|
||||
}
|
||||
}, 0.6f, shoudLog: false);
|
||||
}
|
||||
}
|
||||
[HarmonyPatch(typeof(InnerNetClient))]
|
||||
public class InnerNetClientPatch
|
||||
|
||||
@@ -40,26 +40,6 @@ class GamePlayManager
|
||||
{
|
||||
if (Main.DisableLobbyTheme.Value)
|
||||
SoundManager.instance.StopSound(LobbyBehaviour.Instance.MapTheme);
|
||||
|
||||
// Clear unused Better Data
|
||||
try
|
||||
{
|
||||
var keysToRemove = new List<string>();
|
||||
|
||||
foreach (var betterInfo in PlayerControlDataExtension.playerInfo)
|
||||
{
|
||||
if (Main.AllPlayerControls.Any(pc => pc.Data.Puid == betterInfo.Key))
|
||||
continue;
|
||||
|
||||
keysToRemove.Add(betterInfo.Key);
|
||||
}
|
||||
|
||||
foreach (var key in keysToRemove)
|
||||
{
|
||||
PlayerControlDataExtension.playerInfo.Remove(key);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(LobbyBehaviour.RpcExtendLobbyTimer))]
|
||||
|
||||
@@ -38,6 +38,9 @@ public class HudManagerPatch
|
||||
BAUNotification.SetActive(false);
|
||||
ChatNotifications.timeOnScreen = 0f;
|
||||
ChatNotifications.gameObject.SetActive(false);
|
||||
BetterNotificationManager.TextArea.enableWordWrapping = true;
|
||||
BetterNotificationManager.TextArea.m_firstOverflowCharacterIndex = 0;
|
||||
BetterNotificationManager.TextArea.overflowMode = TextOverflowModes.Overflow;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
@@ -124,11 +125,13 @@ class MeetingHudUpdatePatch
|
||||
// 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>+++");
|
||||
sbTag.Append($"<color=#00f583>{Translator.GetString("Player.SickoUser")}</color>+++");
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.AUMData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.AUMData.ContainsValue(friendCode))
|
||||
sbTag.Append("<color=#4f0000>AUM User</color>+++");
|
||||
sbTag.Append($"<color=#4f0000>{Translator.GetString("Player.AUMUser")}</color>+++");
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.KNData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.KNData.ContainsValue(friendCode))
|
||||
sbTag.Append($"<color=#4f0000>{Translator.GetString("Player.KNUser")}</color>+++");
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && AntiCheat.PlayerData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && AntiCheat.PlayerData.ContainsValue(friendCode))
|
||||
sbTag.Append("<color=#fc0000>Known Cheater</color>+++");
|
||||
sbTag.Append($"<color=#fc0000>{Translator.GetString("Player.KnownCheater")}</color>+++");
|
||||
|
||||
for (int i = 0; i < sbTag.ToString().Split("+++").Length; i++)
|
||||
{
|
||||
@@ -153,7 +156,7 @@ class MeetingHudUpdatePatch
|
||||
}
|
||||
if (!target.IsImpostorTeammate())
|
||||
{
|
||||
if (PlayerControl.LocalPlayer.IsAlive() && !target.IsLocalPlayer())
|
||||
if (PlayerControl.LocalPlayer.IsAlive() || PlayerControl.LocalPlayer.Is(RoleTypes.GuardianAngel) && !target.IsLocalPlayer())
|
||||
{
|
||||
if (!DebugMenu.RevealRoles)
|
||||
{
|
||||
|
||||
+150
-163
@@ -13,7 +13,7 @@ namespace BetterAmongUs.Patches;
|
||||
[HarmonyPatch(typeof(PlayerControl))]
|
||||
class PlayerControlPatch
|
||||
{
|
||||
public static float infotime = 0f;
|
||||
public static Dictionary<byte, float> time = [];
|
||||
[HarmonyPatch(nameof(PlayerControl.FixedUpdate))]
|
||||
[HarmonyPrefix]
|
||||
public static void FixedUpdate_Prefix(PlayerControl __instance)
|
||||
@@ -60,33 +60,30 @@ class PlayerControlPatch
|
||||
}
|
||||
|
||||
// Set text info
|
||||
infotime -= Time.deltaTime;
|
||||
if (!time.ContainsKey(__instance.PlayerId))
|
||||
{
|
||||
time[__instance.PlayerId] = 0f;
|
||||
}
|
||||
time[__instance.PlayerId] -= Time.deltaTime;
|
||||
|
||||
if (infotime <= 0)
|
||||
if (time[__instance.PlayerId] <= 0)
|
||||
{
|
||||
SetPlayerInfo(__instance);
|
||||
infotime = 0.4f;
|
||||
time[__instance.PlayerId] = 0.6f;
|
||||
}
|
||||
|
||||
// Reset player data in lobby
|
||||
PlayerControlDataExtension.ResetPlayerData(__instance);
|
||||
}
|
||||
|
||||
public static void SetPlayerInfo(PlayerControl player)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (player == null || player.Data == null) return;
|
||||
if (player?.Data == null) return;
|
||||
|
||||
if (GameStates.IsTOHEHostLobby)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
var betterData = player.BetterData();
|
||||
if (GameStates.IsTOHEHostLobby) return;
|
||||
|
||||
var nameText = player.gameObject.transform.Find("Names/NameText_TMP").GetComponent<TextMeshPro>();
|
||||
|
||||
// Set player text info
|
||||
if (!player.DataIsCollected())
|
||||
{
|
||||
nameText.text = Translator.GetString("Player.Loading");
|
||||
@@ -100,181 +97,50 @@ class PlayerControlPatch
|
||||
return;
|
||||
}
|
||||
|
||||
string NewName = player.Data.PlayerName;
|
||||
string newName = player.Data.PlayerName;
|
||||
string hashPuid = Utils.GetHashPuid(player);
|
||||
|
||||
string platform = Utils.GetPlatformName(player, useTag: true);
|
||||
|
||||
string pattern = @"^[a-zA-Z0-9#]+$";
|
||||
string hashtagPattern = @"^#[0-9]{4}$";
|
||||
string friendCode = player.Data.FriendCode;
|
||||
string friendCodeColor = (Regex.Replace(friendCode, hashtagPattern, string.Empty).Length is > 10 or < 5
|
||||
|| !Regex.IsMatch(friendCode, pattern)
|
||||
|| !Regex.IsMatch(friendCode, hashtagPattern)
|
||||
|| friendCode.Contains(' ')) ? "#00f7ff" : "#ff0000";
|
||||
if (string.IsNullOrEmpty(friendCode) || friendCode == "")
|
||||
{
|
||||
friendCode = Translator.GetString("Player.NoFriendCode");
|
||||
friendCodeColor = "#ff0000";
|
||||
string friendCode = ValidateFriendCode(player, out string friendCodeColor);
|
||||
|
||||
if (GameStates.IsHost)
|
||||
{
|
||||
if (BetterGameSettings.InvalidFriendCode.GetBool())
|
||||
{
|
||||
string kickMessage = string.Format(Translator.GetString("AntiCheat.KickMessage"), Translator.GetString("AntiCheat.ByAntiCheat"), Translator.GetString("AntiCheat.Reason.InvalidFriendCode"));
|
||||
player.Kick(true, kickMessage, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DataManager.Settings.Gameplay.StreamerMode == true)
|
||||
if (DataManager.Settings.Gameplay.StreamerMode)
|
||||
{
|
||||
friendCode = string.Concat('*').Repeat(friendCode.Length);
|
||||
platform = Translator.GetString("Player.PlatformHidden");
|
||||
}
|
||||
|
||||
// Set Tags
|
||||
var sbTag = new StringBuilder();
|
||||
var sbTagTop = new StringBuilder();
|
||||
var sbTagBottom = new StringBuilder();
|
||||
|
||||
// Put +++ at the end of each tag
|
||||
if (!string.IsNullOrEmpty(hashPuid) && hashPuid.Length > 0 && AntiCheat.SickoData.ContainsKey(hashPuid)
|
||||
|| !string.IsNullOrEmpty(friendCode) && friendCode.Length > 0 && AntiCheat.SickoData.ContainsValue(friendCode))
|
||||
{
|
||||
sbTag.Append($"<color=#00f583>{Translator.GetString("Player.SickoUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#00f583");
|
||||
}
|
||||
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && hashPuid.Length > 0 && AntiCheat.AUMData.ContainsKey(hashPuid)
|
||||
|| !string.IsNullOrEmpty(friendCode) && friendCode.Length > 0 && AntiCheat.AUMData.ContainsValue(friendCode))
|
||||
{
|
||||
sbTag.Append($"<color=#4f0000>{Translator.GetString("Player.AUMUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#4f0000");
|
||||
}
|
||||
|
||||
else if (!string.IsNullOrEmpty(hashPuid) && hashPuid.Length > 0 && AntiCheat.PlayerData.ContainsKey(hashPuid)
|
||||
|| !string.IsNullOrEmpty(friendCode) && friendCode.Length > 0 && AntiCheat.PlayerData.ContainsValue(friendCode))
|
||||
{
|
||||
sbTag.Append($"<color=#fc0000>{Translator.GetString("Player.KnownCheater")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#fc0000");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
var color = player.cosmetics.currentBodySprite.BodySprite.material.GetColor("_OutlineColor");
|
||||
if (color == Utils.HexToColor32("#00f583") || color == Utils.HexToColor32("#4f0000") || color == Utils.HexToColor32("#fc0000"))
|
||||
{
|
||||
player.SetOutline(false, null);
|
||||
}
|
||||
}
|
||||
SetPlayerOutline(player, hashPuid, friendCode, sbTag);
|
||||
|
||||
if (GameStates.IsInGame && GameStates.IsLobby && !GameStates.IsFreePlay)
|
||||
{
|
||||
if (player.IsHost())
|
||||
{
|
||||
if (Main.LobbyPlayerInfo.Value == true)
|
||||
{
|
||||
NewName = player.GetPlayerNameAndColor();
|
||||
}
|
||||
}
|
||||
|
||||
if (player.IsDev() && !GameStates.IsInGamePlay)
|
||||
sbTag.Append($"<color=#6e6e6e>(<color=#0088ff>{Translator.GetString("Player.Dev")}</color>)</color>+++");
|
||||
if (((player.IsLocalPlayer() && GameStates.IsHost && Main.BetterHost.Value)
|
||||
|| (!player.IsLocalPlayer() && player.BetterData().IsBetterHost && player.IsHost())) && !GameStates.IsInGamePlay)
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterHost"), player.BetterData().IsVerifiedBetterUser || player.IsLocalPlayer() ? "✓ " : "");
|
||||
else if ((player.IsLocalPlayer() || player.BetterData().IsBetterUser) && !GameStates.IsInGamePlay)
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterUser"), player.BetterData().IsVerifiedBetterUser || player.IsLocalPlayer() ? "✓ " : "");
|
||||
sbTag.Append($"<color=#b554ff>ID: {player.PlayerId}</color>+++");
|
||||
|
||||
sbTagTop.Append($"<color=#9e9e9e>{platform}</color>+++");
|
||||
|
||||
sbTagTop.Append($"<color=#ffd829>Lv: {player.Data.PlayerLevel + 1}</color>+++");
|
||||
SetLobbyInfo(player, ref newName, betterData, sbTag);
|
||||
sbTagTop.Append($"<color=#9e9e9e>{platform}</color>+++")
|
||||
.Append($"<color=#ffd829>Lv: {player.Data.PlayerLevel + 1}</color>+++");
|
||||
|
||||
sbTagBottom.Append($"<color={friendCodeColor}>{friendCode}</color>+++");
|
||||
}
|
||||
else if ((GameStates.IsInGame || GameStates.IsFreePlay) && !GameStates.IsHideNSeek)
|
||||
{
|
||||
if (player.IsImpostorTeammate() || player.IsLocalPlayer() || !PlayerControl.LocalPlayer.IsAlive() || DebugMenu.RevealRoles)
|
||||
{
|
||||
string Role = $"<color={player.GetTeamHexColor()}>{player.GetRoleName()}</color>";
|
||||
if (!player.IsImpostorTeam() && player.myTasks.Count > 0)
|
||||
{
|
||||
Role += $" <color=#cbcbcb>({player.Data.Tasks.ToArray().Where(task => task.Complete).Count()}/{player.Data.Tasks.Count})</color>";
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.Is(RoleTypes.GuardianAngel) && !player.IsAlive() || !PlayerControl.LocalPlayer.Is(RoleTypes.GuardianAngel))
|
||||
{
|
||||
sbTagTop.Append($"{Role}+++");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (GameStates.IsInGame || GameStates.IsFreePlay)
|
||||
{
|
||||
if (player.IsLocalPlayer())
|
||||
{
|
||||
if (player.IsImpostorTeam())
|
||||
{
|
||||
sbTagTop.Append($"<color={Utils.GetTeamHexColor(RoleTeamTypes.Impostor)}>Seeker</color>+++");
|
||||
}
|
||||
else
|
||||
{
|
||||
sbTagTop.Append($"<color={Utils.GetTeamHexColor(RoleTeamTypes.Crewmate)}>Hider</color>+++");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player.IsImpostorTeammate() && !player.IsLocalPlayer())
|
||||
{
|
||||
NewName = $"<color=#ff1919>{player.Data.PlayerName}</color>";
|
||||
SetInGameInfo(player, sbTagTop);
|
||||
}
|
||||
|
||||
if (!player.IsInShapeshift())
|
||||
{
|
||||
player.RawSetName(NewName);
|
||||
player.RawSetName(newName);
|
||||
}
|
||||
else
|
||||
else if (!player.shapeshifting)
|
||||
{
|
||||
if (!player.shapeshifting)
|
||||
{
|
||||
var targetData = Utils.PlayerDataFromPlayerId(player.shapeshiftTargetPlayerId);
|
||||
if (targetData != null)
|
||||
{
|
||||
player.RawSetName(targetData.PlayerName);
|
||||
}
|
||||
}
|
||||
var targetData = Utils.PlayerDataFromPlayerId(player.shapeshiftTargetPlayerId);
|
||||
if (targetData != null) player.RawSetName(targetData.BetterData().RealName);
|
||||
}
|
||||
|
||||
// Put +++ at the end of each tag
|
||||
static StringBuilder FormatInfo(StringBuilder source)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
if (source.Length > 0)
|
||||
{
|
||||
string text = source.ToString();
|
||||
string[] parts = text.Split("+++");
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Utils.RemoveHtmlText(parts[i])))
|
||||
{
|
||||
sb.Append(parts[i]);
|
||||
if (i != parts.Length - 2)
|
||||
{
|
||||
sb.Append(" - ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
sbTag = FormatInfo(sbTag);
|
||||
sbTagTop = FormatInfo(sbTagTop);
|
||||
sbTagBottom = FormatInfo(sbTagBottom);
|
||||
|
||||
player.SetPlayerTextInfo(sbTagTop.ToString());
|
||||
player.SetPlayerTextInfo(sbTagBottom.ToString(), isBottom: true);
|
||||
player.SetPlayerTextInfo(sbTag.ToString(), isInfo: true);
|
||||
player.SetPlayerTextInfo(FormatInfo(sbTagTop));
|
||||
player.SetPlayerTextInfo(FormatInfo(sbTagBottom), isBottom: true);
|
||||
player.SetPlayerTextInfo(FormatInfo(sbTag), isInfo: true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -282,6 +148,129 @@ class PlayerControlPatch
|
||||
}
|
||||
}
|
||||
|
||||
private static string ValidateFriendCode(PlayerControl player, out string color)
|
||||
{
|
||||
void TryKick()
|
||||
{
|
||||
if (GameStates.IsHost)
|
||||
{
|
||||
if (BetterGameSettings.InvalidFriendCode.GetBool())
|
||||
{
|
||||
string kickMessage = string.Format(Translator.GetString("AntiCheat.KickMessage"), Translator.GetString("AntiCheat.ByAntiCheat"), Translator.GetString("AntiCheat.Reason.InvalidFriendCode"));
|
||||
player.Kick(true, kickMessage, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string pattern = @"^[a-zA-Z0-9#]+$";
|
||||
string hashtagPattern = @"^#[0-9]{4}$";
|
||||
string friendCode = player.Data.FriendCode;
|
||||
color = (Regex.Replace(friendCode, hashtagPattern, string.Empty).Length is > 10 or < 5
|
||||
|| !Regex.IsMatch(friendCode, pattern)
|
||||
|| !Regex.IsMatch(friendCode, hashtagPattern)
|
||||
|| friendCode.Contains(' ')) ? "#00f7ff" : "#ff0000";
|
||||
|
||||
if (string.IsNullOrEmpty(friendCode) || friendCode == "")
|
||||
{
|
||||
friendCode = Translator.GetString("Player.NoFriendCode");
|
||||
color = "#ff0000";
|
||||
|
||||
TryKick();
|
||||
|
||||
return friendCode;
|
||||
}
|
||||
else if (color == "#ff0000")
|
||||
{
|
||||
TryKick();
|
||||
}
|
||||
|
||||
if (DataManager.Settings.Gameplay.StreamerMode)
|
||||
{
|
||||
friendCode = new string('*', friendCode.Length);
|
||||
}
|
||||
|
||||
return friendCode;
|
||||
}
|
||||
|
||||
private static void SetPlayerOutline(PlayerControl player, string hashPuid, string friendCode, StringBuilder sbTag)
|
||||
{
|
||||
if (AntiCheat.SickoData.ContainsKey(hashPuid) || AntiCheat.SickoData.ContainsValue(friendCode))
|
||||
{
|
||||
sbTag.Append($"<color=#00f583>{Translator.GetString("Player.SickoUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#00f583");
|
||||
}
|
||||
else if (AntiCheat.AUMData.ContainsKey(hashPuid) || AntiCheat.AUMData.ContainsValue(friendCode))
|
||||
{
|
||||
sbTag.Append($"<color=#4f0000>{Translator.GetString("Player.AUMUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#4f0000");
|
||||
}
|
||||
else if (AntiCheat.KNData.ContainsKey(hashPuid) || AntiCheat.KNData.ContainsValue(friendCode))
|
||||
{
|
||||
sbTag.Append($"<color=#8731e7>{Translator.GetString("Player.KNUser")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#8731e7");
|
||||
}
|
||||
else if (AntiCheat.PlayerData.ContainsKey(hashPuid) || AntiCheat.PlayerData.ContainsValue(friendCode))
|
||||
{
|
||||
sbTag.Append($"<color=#fc0000>{Translator.GetString("Player.KnownCheater")}</color>+++");
|
||||
player.SetOutlineByHex(true, "#fc0000");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetOutline(false, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetLobbyInfo(PlayerControl player, ref string newName, ExtendedPlayerInfo betterData, StringBuilder sbTag)
|
||||
{
|
||||
if (player.IsHost() && Main.LobbyPlayerInfo.Value)
|
||||
newName = player.GetPlayerNameAndColor();
|
||||
|
||||
if (player.IsDev() && !GameStates.IsInGamePlay)
|
||||
sbTag.Append($"<color=#6e6e6e>(<color=#0088ff>{Translator.GetString("Player.Dev")}</color>)</color>+++");
|
||||
|
||||
if ((player.IsLocalPlayer() && GameStates.IsHost && Main.BetterHost.Value) ||
|
||||
(betterData.IsBetterHost && player.IsHost()) && !GameStates.IsInGamePlay)
|
||||
{
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterHost"),
|
||||
betterData.IsVerifiedBetterUser || player.IsLocalPlayer() ? "✓ " : "");
|
||||
}
|
||||
else if ((player.IsLocalPlayer() || betterData.IsBetterUser) && !GameStates.IsInGamePlay)
|
||||
{
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterUser"),
|
||||
betterData.IsVerifiedBetterUser || player.IsLocalPlayer() ? "✓ " : "");
|
||||
}
|
||||
sbTag.Append($"<color=#b554ff>ID: {player.PlayerId}</color>+++");
|
||||
}
|
||||
|
||||
private static void SetInGameInfo(PlayerControl player, StringBuilder sbTagTop)
|
||||
{
|
||||
if (player.IsImpostorTeammate() || player.IsLocalPlayer() || !PlayerControl.LocalPlayer.IsAlive() && !PlayerControl.LocalPlayer.Is(RoleTypes.GuardianAngel) || DebugMenu.RevealRoles)
|
||||
{
|
||||
string roleInfo = $"<color={player.GetTeamHexColor()}>{player.GetRoleName()}</color>";
|
||||
if (!player.IsImpostorTeam() && player.myTasks.Count > 0)
|
||||
{
|
||||
roleInfo += $" <color=#cbcbcb>({player.Data.Tasks.ToArray().Where(task => task.Complete).Count()}/{player.Data.Tasks.Count})</color>";
|
||||
}
|
||||
sbTagTop.Append(roleInfo + "+++");
|
||||
}
|
||||
}
|
||||
|
||||
private static string FormatInfo(StringBuilder source)
|
||||
{
|
||||
if (source.Length == 0) return string.Empty;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
foreach (var part in source.ToString().Split("+++"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Utils.RemoveHtmlText(part)))
|
||||
{
|
||||
sb.Append(part).Append(" - ");
|
||||
}
|
||||
}
|
||||
return sb.ToString().TrimEnd(" - ".ToCharArray());
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPatch(nameof(PlayerControl.RpcSetName))]
|
||||
[HarmonyPrefix]
|
||||
public static bool RpcSetName_Prefix(PlayerControl __instance, [HarmonyArgument(0)] string name)
|
||||
@@ -291,8 +280,6 @@ class PlayerControlPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
__instance.BetterData().RealName = name;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,7 @@ class OnGameJoinedPatch
|
||||
{
|
||||
try
|
||||
{
|
||||
PlayerControlDataExtension.playerInfo.Clear();
|
||||
|
||||
PlayerControlPatch.infotime = 0f;
|
||||
PlayerControlPatch.time.Clear();
|
||||
|
||||
AntiCheat.PauseAntiCheat();
|
||||
|
||||
@@ -35,19 +33,12 @@ public static class OnPlayerJoinedPatch
|
||||
{
|
||||
public static void Postfix(/*AmongUsClient __instance,*/ [HarmonyArgument(0)] ClientData client)
|
||||
{
|
||||
PlayerControlPatch.infotime = 0f;
|
||||
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
if (GameStates.IsInGame)
|
||||
{
|
||||
var player = Utils.PlayerFromClientId(client.Id);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.BetterData().ClearData();
|
||||
}
|
||||
|
||||
// Send Better Among Us Check RPC
|
||||
RPC.SendBetterCheck();
|
||||
|
||||
@@ -91,6 +82,7 @@ public static class OnPlayerJoinedPatch
|
||||
// Read all banned names into a HashSet with normalized names
|
||||
HashSet<string> bannedNames = new HashSet<string>(
|
||||
File.ReadLines(BetterDataManager.banNameListFile)
|
||||
.Where(line => !line.TrimStart().StartsWith("//"))
|
||||
.Select(normalizeName)
|
||||
.Where(name => !string.IsNullOrWhiteSpace(name))
|
||||
);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"Player.BetterHost": "Better Host",
|
||||
"Player.SickoUser": "Sicko User",
|
||||
"Player.AUMUser": "AUM User",
|
||||
"Player.KNUser": "KN User",
|
||||
"Player.KnownCheater": "Known Cheater",
|
||||
|
||||
"DisconnectReason.Left": "{0} Left the game!",
|
||||
@@ -114,10 +115,12 @@
|
||||
"AntiCheat.TryBanExploit": "Attempted To Ban Exploit",
|
||||
"AntiCheat.Cheat.Sicko": "Sicko Menu",
|
||||
"AntiCheat.Cheat.AUM": "AUM",
|
||||
"AntiCheat.Cheat.KN": "Kill Network",
|
||||
"AntiCheat.Reason.InvalidFriendCode": "Invalid Friend Code",
|
||||
"AntiCheat.Reason.PlatformSpoofer": "Platform Spoofer",
|
||||
"AntiCheat.Reason.SickoMenuUser": "Known Sicko User",
|
||||
"AntiCheat.Reason.AUMUser": "Known AUM User",
|
||||
"AntiCheat.Reason.KNUser": "Known KN User",
|
||||
"AntiCheat.Reason.KnownCheater": "Known Cheater",
|
||||
|
||||
"GameSummary": "Game Summary",
|
||||
|
||||
@@ -9,6 +9,7 @@ using Innersloth.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using static BetterAmongUs.PlayerControlDataExtension;
|
||||
|
||||
namespace BetterAmongUs;
|
||||
|
||||
@@ -23,13 +24,13 @@ public enum ReleaseTypes : int
|
||||
[BepInProcess("Among Us.exe")]
|
||||
public class Main : BasePlugin
|
||||
{
|
||||
public static readonly ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
|
||||
public const string BetaNum = "0";
|
||||
public const string HotfixNum = "3";
|
||||
public const bool IsHotFix = true;
|
||||
public static readonly ReleaseTypes ReleaseBuildType = ReleaseTypes.Beta;
|
||||
public const string BetaNum = "1";
|
||||
public const string HotfixNum = "0";
|
||||
public const bool IsHotFix = false;
|
||||
public const string PluginGuid = "com.ten.betteramongus";
|
||||
public const string PluginVersion = "1.1.4";
|
||||
public const string ReleaseDate = "09.23.2024"; // mm/dd/yyyy
|
||||
public const string PluginVersion = "1.1.5";
|
||||
public const string ReleaseDate = "10.26.2024"; // mm/dd/yyyy
|
||||
public const string Github = "https://github.com/EnhancedNetwork/BetterAmongUs-Public";
|
||||
public const string Discord = "https://discord.gg/ten";
|
||||
public static BetterAccountInfo myAccountInfo = new();
|
||||
@@ -98,6 +99,7 @@ public class Main : BasePlugin
|
||||
|
||||
public static List<string> SupportedAmongUsVersions =
|
||||
[
|
||||
"2024.10.29",
|
||||
"2024.9.4",
|
||||
"2024.8.13",
|
||||
"2024.6.18",
|
||||
@@ -151,6 +153,8 @@ public class Main : BasePlugin
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
AddComponent<ExtendedPlayerInfo>();
|
||||
|
||||
try
|
||||
{
|
||||
ConsoleManager.CreateConsole();
|
||||
|
||||
Reference in new issue
Block a user