A lot of fixes and Hotfix 2

This commit is contained in:
D1GQ committed 2024-08-20 22:14:29 -05:00
1 parent c5bbf92570
commit 596ce9e892
8 files changed
+69 -52

No files matched your search

+47 -35
View File
@@ -78,7 +78,7 @@ class AntiCheat
{
player.ReportPlayer(ReportReasons.Cheating_Hacking);
BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat");
Logger.LogCheat($"{player.Data.PlayerName} Platform Spoofer: {__instance.XboxPlatformId}");
Logger.LogCheat($"{player.BetterData().RealName} Platform Spoofer: {__instance.XboxPlatformId}");
}
}
@@ -88,7 +88,7 @@ class AntiCheat
{
player.ReportPlayer(ReportReasons.Cheating_Hacking);
BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat");
Logger.LogCheat($"{player.Data.PlayerName} Platform Spoofer: {__instance.PsnPlatformId}");
Logger.LogCheat($"{player.BetterData().RealName} Platform Spoofer: {__instance.PsnPlatformId}");
}
}
}
@@ -196,7 +196,7 @@ class AntiCheat
if (player.IsAlive() && GameStates.IsInGamePlay && !GameStates.IsMeeting && !GameStates.IsExilling)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.IsAlive()} && {GameStates.IsInGamePlay} && {!GameStates.IsMeeting} && {!GameStates.IsExilling}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {player.IsAlive()} && {GameStates.IsInGamePlay} && {!GameStates.IsMeeting} && {!GameStates.IsExilling}");
}
return;
@@ -207,7 +207,7 @@ class AntiCheat
if ((!player.IsImpostorTeam() && Role != RoleTypes.Engineer) || player.Data.IsDead)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.IsImpostorTeam()} && {Role != RoleTypes.Engineer} || {player.Data.IsDead}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {player.IsImpostorTeam()} && {Role != RoleTypes.Engineer} || {player.Data.IsDead}");
}
return;
@@ -218,7 +218,7 @@ class AntiCheat
if (Role is not RoleTypes.GuardianAngel)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {Role is not RoleTypes.GuardianAngel}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {Role is not RoleTypes.GuardianAngel}");
}
return;
@@ -230,12 +230,20 @@ class AntiCheat
{
PlayerControl target = reader.ReadNetObject<PlayerControl>();
if (GameStates.IsHost)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsHost}");
return;
}
if (target != null)
{
if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || target.IsImpostorTeam())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} || {player.IsInVanish()}" +
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()} || {player.IsInVanish()}" +
$" || {!target.IsAlive()} || {target.IsImpostorTeam()}");
}
}
@@ -252,7 +260,7 @@ class AntiCheat
if (level >= 200)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Level: {level}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {level >= 200}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {level >= 200}");
}
}
return;
@@ -266,7 +274,7 @@ class AntiCheat
{
byte Type = reader.ReadByte();
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)} - {Enum.GetName((SystemTypes)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()}");
return;
}
@@ -282,7 +290,7 @@ class AntiCheat
&& 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.IsImpostorTeam()} || {!player.Data.Tasks.ToArray().Any(task => task.Id == taskId)} ||" +
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {player.IsImpostorTeam()} || {!player.Data.Tasks.ToArray().Any(task => task.Id == taskId)} ||" +
$" {player.BetterData().LastTaskId == taskId} || {player.BetterData().LastTaskId != taskId} && {player.BetterData().TimeSinceLastTask < 1.25f}");
player.BetterData().TimeSinceLastTask = 0f;
@@ -300,7 +308,7 @@ class AntiCheat
if (!player.IsImpostorTeam())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {!player.IsImpostorTeam()}");
}
}
@@ -309,7 +317,7 @@ class AntiCheat
if (player?.CurrentOutfit?.PetId == "pet_EmptyPet")
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player?.CurrentOutfit?.PetId == "pet_EmptyPet"}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {player?.CurrentOutfit?.PetId == "pet_EmptyPet"}");
}
return;
@@ -380,7 +388,7 @@ class AntiCheat
if (!player.IsImpostorTeam() || GameStates.IsAnySabotageActive() || !Utils.SystemTypeIsSabotage(SaboType))
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(SaboType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(SaboType)}: {!player.IsImpostorTeam()} || {GameStates.IsAnySabotageActive()} " +
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(SaboType)}: {!player.IsImpostorTeam()} || {GameStates.IsAnySabotageActive()} " +
$"|| {!Utils.SystemTypeIsSabotage(SaboType)}");
return false;
}
@@ -392,7 +400,7 @@ class AntiCheat
if (amount == hostNum && !player.IsHost())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(systemType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(systemType)}: {amount == hostNum} && {!player.IsHost()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(systemType)}: {amount == hostNum} && {!player.IsHost()}");
return false;
}
@@ -401,7 +409,7 @@ class AntiCheat
if (systemType is SystemTypes.Electrical)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(systemType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(systemType)}: {systemType is SystemTypes.Electrical}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(systemType)}: {systemType is SystemTypes.Electrical}");
}
return false;
@@ -412,14 +420,14 @@ class AntiCheat
if (player.BetterData().OpenSabotageNum == 0)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(systemType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(systemType)}: {player.BetterData().OpenSabotageNum == 0}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(systemType)}: {player.BetterData().OpenSabotageNum == 0}");
return false;
}
if (amount == openPanelNum && amount == openPanelNum + 1)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(systemType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(systemType)}: {amount == openPanelNum} && {amount == openPanelNum + 1}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(systemType)}: {amount == openPanelNum} && {amount == openPanelNum + 1}");
return false;
}
@@ -427,7 +435,7 @@ class AntiCheat
|| player.BetterData().OpenSabotageNum == 2 && amount == openPanelNum)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(systemType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(systemType)}: {player.BetterData().OpenSabotageNum == 1} && {amount == openPanelNum + 1} " +
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(systemType)}: {player.BetterData().OpenSabotageNum == 1} && {amount == openPanelNum + 1} " +
$"|| {player.BetterData().OpenSabotageNum == 2} && {amount == openPanelNum}");
return false;
}
@@ -439,7 +447,7 @@ class AntiCheat
&& amount > MaxLightNum)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(systemType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(systemType)}: {amount != fixNum} && {amount != fixNum + 1}" +
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(systemType)}: {amount != fixNum} && {amount != fixNum + 1}" +
$" && {amount != closePanelNum} && {amount != closePanelNum + 1}" +
$" && {amount > MaxLightNum}");
return false;
@@ -450,7 +458,7 @@ class AntiCheat
if (amount > MaxLightNum)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName(systemType)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName(systemType)}: {amount > MaxLightNum}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName(systemType)}: {amount > MaxLightNum}");
return false;
}
}
@@ -480,15 +488,19 @@ class AntiCheat
{
if (target == PlayerControl.LocalPlayer)
{
if (target.BetterData().CheckBanExploit && !target.IsAlive())
target.BetterData().TimesAttemptedKilled++;
if (target.BetterData().TimesAttemptedKilled >= 5 && !target.IsAlive())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action: Attempted To Ban Exploit");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 2: {target.BetterData().CheckBanExploit} && {!target.IsAlive()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)} 2: {target.BetterData().CheckBanExploit} && {!target.IsAlive()}");
return false;
}
else
// Cancel murder on client
if (!target.IsAlive())
{
target.BetterData().CheckBanExploit = true;
return false;
}
}
}
@@ -513,7 +525,7 @@ class AntiCheat
|| player.inMovingPlat || player.onLadder || player.MyPhysics.Animations.IsPlayingAnyLadderAnimation())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {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} && {GameStates.IsHideNSeek} || {!player.IsAlive()} || {player.IsInVent()} || {player.shapeshifting}" +
$" || {player.inMovingPlat} || {player.onLadder} || {player.MyPhysics.Animations.IsPlayingAnyLadderAnimation()}");
if (GameStates.IsHost)
@@ -534,7 +546,7 @@ class AntiCheat
if (!UnityEngine.Object.FindAnyObjectByType<DeadBody>() || !deadPlayerInfo.IsDead || deadPlayerInfo == player.Data)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!UnityEngine.Object.FindAnyObjectByType<DeadBody>()} || {!deadPlayerInfo.IsDead} || {deadPlayerInfo == player.Data}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {!UnityEngine.Object.FindAnyObjectByType<DeadBody>()} || {!deadPlayerInfo.IsDead} || {deadPlayerInfo == player.Data}");
if (GameStates.IsHost)
{
return false;
@@ -550,7 +562,7 @@ class AntiCheat
if (player.BetterData().TimesCalledMeeting >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {player.BetterData().TimesCalledMeeting} -> {GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}" +
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {player.BetterData().TimesCalledMeeting} -> {GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}" +
$" - {player.BetterData().TimesCalledMeeting >= GameOptionsManager.Instance.currentNormalGameOptions.NumEmergencyMeetings}");
if (GameStates.IsHost)
{
@@ -573,14 +585,14 @@ class AntiCheat
if (Role is not RoleTypes.Shapeshifter || !player.IsAlive())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 1: {Role is not RoleTypes.Shapeshifter} || {!player.IsAlive()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)} 1: {Role is not RoleTypes.Shapeshifter} || {!player.IsAlive()}");
return false;
}
else if (!flag && !GameStates.IsMeeting && !GameStates.IsExilling && !player.IsInVent())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 2: {!flag} && {!GameStates.IsMeeting} && {!GameStates.IsExilling} && {!player.IsInVent()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)} 2: {!flag} && {!GameStates.IsMeeting} && {!GameStates.IsExilling} && {!player.IsInVent()}");
return false;
}
}
@@ -590,7 +602,7 @@ class AntiCheat
if (Role is not RoleTypes.Phantom || player.Data.IsDead)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 1: {Role is not RoleTypes.Phantom} || {player.Data.IsDead}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)} 1: {Role is not RoleTypes.Phantom} || {player.Data.IsDead}");
return false;
}
@@ -599,7 +611,7 @@ class AntiCheat
if (player.IsInVent())
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)} 2: {player.IsInVent()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)} 2: {player.IsInVent()}");
}
}
}
@@ -611,7 +623,7 @@ class AntiCheat
or (byte)RpcCalls.CloseMeeting)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Host RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {!player.IsHost()}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {!player.IsHost()}");
return false;
}
}
@@ -621,13 +633,13 @@ class AntiCheat
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}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {player.DataIsCollected() == true}");
if (callId is (byte)RpcCalls.CheckName)
{
var name = reader.ReadString();
Utils.AddChatPrivate($"{player.GetPlayerNameAndColor()} Has tried to change their name to '{name}' but has been undone!");
Logger.LogCheat($"{player.Data.PlayerName} Has tried to change their name to '{name}' but has been undone!");
Logger.LogCheat($"{player.BetterData().RealName} Has tried to change their name to '{name}' but has been undone!");
}
return false;
}
@@ -643,7 +655,7 @@ class AntiCheat
or (byte)RpcCalls.SetNamePlate)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Set RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsInGamePlay}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsInGamePlay}");
return false;
}
}
@@ -678,7 +690,7 @@ class AntiCheat
or (byte)RpcCalls.CheckVanish)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Lobby RPC: {Enum.GetName((RpcCalls)callId)}");
Logger.LogCheat($"{player.Data.PlayerName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsInGame} && {GameStates.IsLobby}");
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {GameStates.IsInGame} && {GameStates.IsLobby}");
return false;
}
}
+5 -5
View File
@@ -35,23 +35,23 @@ class BetterNotificationManager
public static void NotifyCheat(PlayerControl player, string reason, string newText = "", bool kickPlayer = true)
{
string text = $"Player: <color=#0097b5>{player?.CurrentOutfit.PlayerName}</color> Has been detected doing an unauthorized action: <b><color=#fc0000>{reason}</color></b>";
string text = $"Player: <color=#0097b5>{player?.BetterData().RealName}</color> Has been detected doing an unauthorized action: <b><color=#fc0000>{reason}</color></b>";
if (newText != "")
text = $"Player: <color=#0097b5>{player?.CurrentOutfit.PlayerName}</color> " + newText + $": <b><color=#fc0000>{reason}</color></b>";
text = $"Player: <color=#0097b5>{player?.BetterData().RealName}</color> " + newText + $": <b><color=#fc0000>{reason}</color></b>";
if (!AntiCheat.PlayerData.ContainsKey(Utils.GetHashPuid(player)))
{
AntiCheat.PlayerData[Utils.GetHashPuid(player)] = player.Data.FriendCode;
BetterDataManager.SaveCheatData(Utils.GetHashPuid(player), player.Data.FriendCode, player.Data.PlayerName, "cheatData", reason);
BetterDataManager.SaveCheatData(Utils.GetHashPuid(player), player.Data.FriendCode, player?.BetterData().RealName, "cheatData", reason);
Notify(text, Time: 8f);
}
Logger.LogCheat(Utils.RemoveHtmlText(text));
if (GameStates.IsHost && kickPlayer)
{
player.Kick(true, $"banned by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#fc0000>{reason}</color>", true);
}
Logger.LogCheat(Utils.RemoveHtmlText(text));
}
public static void Update()
+1 -1
View File
@@ -111,7 +111,7 @@ static class ExtendedPlayerControl
player.BetterData().BannedByAntiCheat = AntiCheatBan && ban;
NetworkedPlayerInfo playerInfo = player.Data;
string saveName = player.Data.PlayerName;
string saveName = player.BetterData().RealName;
if (setReasonInfo != "")
{
+8 -7
View File
@@ -8,19 +8,20 @@ public static class PlayerControlDataExtension
{
public class ExtendedPlayerInfo
{
public NetworkedPlayerInfo? ThisPlayerData { get; set; }
public NetworkedPlayerInfo? _Data { get; set; }
public string RealName { get; set; } = string.Empty;
public Dictionary<byte, string> LastNameSetFor { get; set; } = [];
public bool IsBetterUser { get; set; } = false;
public bool IsBetterHost { get; set; } = false;
public bool IsTOHEHost { get; set; } = false;
public bool BannedByAntiCheat { get; set; } = false;
public bool CheckBanExploit { get; set; } = false;
public int TimesAttemptedKilled { get; set; } = 0;
// Track Game Info
public int OpenSabotageNum { get; set; } = 0;
public bool IsFixingPanelSabotage => OpenSabotageNum != 0;
public float TimeSinceLastTask { get; set; } = 5f;
public uint LastTaskId { get; set; } = 0;
public uint LastTaskId { get; set; } = 999;
public int TimesCalledMeeting { get; set; } = 0;
public DisconnectReasons DisconnectReason { get; set; } = DisconnectReasons.Unknown;
public ExtendedRoleInfo? RoleInfo { get; set; }
@@ -46,7 +47,7 @@ public static class PlayerControlDataExtension
player.BetterData().LastTaskId = 999;
player.BetterData().RoleInfo.Kills = 0;
player.BetterData().OpenSabotageNum = 0;
player.BetterData().CheckBanExploit = false;
player.BetterData().TimesAttemptedKilled = 0;
}
else
{
@@ -66,7 +67,7 @@ public static class PlayerControlDataExtension
{
playerInfo[player.Data.Puid] = new ExtendedPlayerInfo
{
ThisPlayerData = player.Data,
_Data = player.Data,
RoleInfo = new ExtendedRoleInfo()
};
}
@@ -81,7 +82,7 @@ public static class PlayerControlDataExtension
{
playerInfo[info.Puid] = new ExtendedPlayerInfo
{
ThisPlayerData = info,
_Data = info,
RoleInfo = new ExtendedRoleInfo()
};
}
@@ -100,7 +101,7 @@ public static class PlayerControlDataExtension
{
playerInfo[player.Data.Puid] = new ExtendedPlayerInfo
{
ThisPlayerData = player.Data,
_Data = player.Data,
RoleInfo = new ExtendedRoleInfo()
};
}
+1 -1
View File
@@ -77,7 +77,7 @@ public class ClientPatch
[HarmonyPrefix]
public static void KickPlayer_Prefix(ref int clientId, ref bool ban)
{
if (ban)
if (ban && Main.UseBannedList.Value)
{
NetworkedPlayerInfo info = Utils.PlayerFromClientId(clientId).Data;
BetterDataManager.SaveBanList(info.FriendCode, info.Puid);
+1 -1
View File
@@ -251,7 +251,7 @@ class GamePlayManager
foreach (var data in playersData)
{
var name = $"<color={Utils.Color32ToHex(Palette.PlayerColors[data.DefaultOutfit.ColorId])}>{data.PlayerName}</color>";
var name = $"<color={Utils.Color32ToHex(Palette.PlayerColors[data.DefaultOutfit.ColorId])}>{data.BetterData().RealName}</color>";
string playerTheme(string text) => $"<color={Utils.GetTeamHexColor(data.Role.TeamType)}>{text}</color>";
string roleInfo;
+5 -1
View File
@@ -1,7 +1,9 @@
using AmongUs.Data;
using AmongUs.GameOptions;
using HarmonyLib;
using Hazel;
using Il2CppSystem.Linq;
using InnerNet;
using LibCpp2IL;
using System.Text;
using System.Text.RegularExpressions;
@@ -223,13 +225,15 @@ class PlayerControlPatch
[HarmonyPatch(nameof(PlayerControl.RpcSetName))]
[HarmonyPrefix]
public static bool RpcSetName_Prefix([HarmonyArgument(0)] string name)
public static bool RpcSetName_Prefix(PlayerControl __instance, [HarmonyArgument(0)] string name)
{
if (!GameStates.IsVanillaServer && Utils.IsHtmlText(name))
{
return false;
}
__instance.BetterData().RealName = name;
return true;
}
+1 -1
View File
@@ -24,7 +24,7 @@ public class Main : BasePlugin
{
public const ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
public const string CanaryNum = "0";
public const string HotfixNum = "1";
public const string HotfixNum = "2";
public const bool IsHotFix = true;
public const string PluginGuid = "com.d1gq.betteramongus";
public const string PluginVersion = "1.0.4";