mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-11-19 13:17:17 +00:00
Merge pull request #39 from EnhancedNetwork/dev
V1.1.5 Hotfix 1 - Better Host Removal
This commit is contained in:
32 files changed
+258
-457
No files matched your search
@@ -1,19 +0,0 @@
|
||||
#if DEBUG
|
||||
using BetterAmongUs.Modules;
|
||||
|
||||
namespace BetterAmongUs.Commands;
|
||||
|
||||
public class SyncAllNamesCommand : BaseCommand
|
||||
{
|
||||
public override CommandType Type => CommandType.Debug;
|
||||
public override string Name => "syncallnames";
|
||||
public override string Description => "Sync all players names for better host";
|
||||
public override bool ShowCommand() => GameState.IsHost;
|
||||
|
||||
public override void Run()
|
||||
{
|
||||
RPC.SyncAllNames(force: true);
|
||||
CommandResultText("<color=#0dff00>All player names have been updated and synced!</color>");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -41,7 +41,6 @@ public class ExtendedPlayerInfo : MonoBehaviour
|
||||
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;
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
using AmongUs.GameOptions;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules.AntiCheat;
|
||||
using Hazel;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BetterAmongUs.Managers;
|
||||
|
||||
class BetterHostManager
|
||||
{
|
||||
private static readonly List<PlayerControl> VentStuck = [];
|
||||
|
||||
public static void PlayerUpdate(PlayerControl player)
|
||||
{
|
||||
// Lock up player vent button if it's invalid vent
|
||||
if (!VentStuck.Contains(player) && player.inVent && !player.Is(RoleTypes.Engineer) && !player.IsImpostorTeam())
|
||||
{
|
||||
player.MyPhysics.RpcEnterVent(player.GetPlayerVentId());
|
||||
player.MyPhysics.RpcBootFromVent(player.GetPlayerVentId());
|
||||
VentStuck.Add(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckRange(Vector2 pos1, Vector2 pos2, float range) => Vector2.Distance(pos1, pos2) <= range;
|
||||
|
||||
public static bool CheckRPCAsHost(PlayerControl player, byte callId, MessageReader reader, ref bool canceled)
|
||||
{
|
||||
if (player == null || !GameState.IsHost) return true;
|
||||
|
||||
if (RPCHandler.HandleRPC(callId, player, reader, HandlerFlag.BetterHost) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set player names for better host
|
||||
public static void SetPlayersInfoAsHost(PlayerControl player, bool forMeeting = false, bool force = false, bool IsBetterHost = true)
|
||||
{
|
||||
if (player == null) return;
|
||||
|
||||
if (!Main.BetterHost.Value || forMeeting)
|
||||
{
|
||||
if (player.Data.PlayerName != player.CurrentOutfit.PlayerName && !player.IsInShapeshift() || force)
|
||||
{
|
||||
player.RpcSetName(player.Data.PlayerName);
|
||||
Logger.LogPrivate($"Reset {player.Data.PlayerName} name", "RPC");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsBetterHost && !force) return;
|
||||
|
||||
foreach (PlayerControl target in Main.AllPlayerControls)
|
||||
{
|
||||
if (target == null || target.IsLocalPlayer()) continue;
|
||||
|
||||
string NewName = !player.IsInShapeshift() ? player.Data.PlayerName : Utils.PlayerDataFromPlayerId(player.shapeshiftTargetPlayerId).PlayerName;
|
||||
|
||||
StringBuilder sbTopTag = new StringBuilder();
|
||||
|
||||
if (!player.BetterData().IsBetterUser)
|
||||
{
|
||||
if (GameState.IsLobby)
|
||||
{
|
||||
NewName = player.Data.PlayerName;
|
||||
|
||||
if (player.IsHost())
|
||||
NewName = player.GetPlayerNameAndColor();
|
||||
|
||||
if (player.IsDev())
|
||||
sbTopTag.Append("<color=#6e6e6e>(<color=#0088ff>Dev</color>)</color>+++");
|
||||
|
||||
if (player.IsLocalPlayer())
|
||||
sbTopTag.Append($"<color=#0dff00>Better Host</color>+++");
|
||||
else if (player.BetterData().IsBetterUser)
|
||||
sbTopTag.Append("<color=#0dff00>Better User</color>+++");
|
||||
}
|
||||
else if (GameState.IsInGamePlay && !GameState.IsHideNSeek)
|
||||
{
|
||||
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 (player.IsImpostorTeam() is false || target.IsImpostorTeam() is false)
|
||||
{
|
||||
if (target.IsAlive() && player != target)
|
||||
{
|
||||
Role = "";
|
||||
}
|
||||
}
|
||||
|
||||
sbTopTag.Append($"{Role}+++");
|
||||
}
|
||||
else if (GameState.IsInGamePlay)
|
||||
{
|
||||
if (player == target)
|
||||
{
|
||||
if (player.IsImpostorTeam())
|
||||
{
|
||||
sbTopTag.Append($"<color={Utils.GetTeamHexColor(RoleTeamTypes.Impostor)}>Seeker</color>+++");
|
||||
}
|
||||
else
|
||||
{
|
||||
sbTopTag.Append($"<color={Utils.GetTeamHexColor(RoleTeamTypes.Crewmate)}>Hider</color>+++");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
sbTopTag = FormatInfo(sbTopTag);
|
||||
|
||||
if (sbTopTag.Length > 0)
|
||||
NewName = $"<size=65%>{sbTopTag}</size>\n{NewName}";
|
||||
else
|
||||
NewName = $"{NewName}";
|
||||
|
||||
// Don't send rpc if name is the same!
|
||||
if (player.BetterData().LastNameSetFor.TryGetValue(target.PlayerId, out var lastName))
|
||||
{
|
||||
if (lastName == NewName || !force)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
player.BetterData().LastNameSetFor[target.PlayerId] = NewName;
|
||||
}
|
||||
|
||||
player.RpcSetNamePrivate(NewName, target);
|
||||
Logger.LogPrivate($"Set {player.Data.PlayerName} name to {NewName.Replace("\n", "-")} for {target.Data.PlayerName}", "RPC");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,6 @@ class BAUAntiCheat
|
||||
{
|
||||
if (GameState.IsHost && GameState.IsInGame)
|
||||
{
|
||||
RPC.SyncAllNames(isBetterHost: false);
|
||||
|
||||
foreach (var player in Main.AllPlayerControls)
|
||||
{
|
||||
var hashPuid = Utils.GetHashPuid(player);
|
||||
@@ -158,7 +156,7 @@ class BAUAntiCheat
|
||||
{
|
||||
MessageReader reader = MessageReader.Get(oldReader);
|
||||
|
||||
if (player == null || player.IsLocalPlayer() || player.BetterData().IsBetterHost || reader == null || !IsEnabled || !Main.AntiCheat.Value
|
||||
if (player == null || player.IsLocalPlayer() || (player.IsHost() && player.BetterData().IsBetterUser) || reader == null || !IsEnabled || !Main.AntiCheat.Value
|
||||
|| GameState.IsBetterHostLobby && !GameState.IsHost || !BetterGameSettings.DetectInvalidRPCs.GetBool()) return;
|
||||
|
||||
RPCHandler.HandleRPC(callId, player, reader, HandlerFlag.AntiCheat);
|
||||
@@ -171,7 +169,7 @@ class BAUAntiCheat
|
||||
{
|
||||
MessageReader reader = MessageReader.Get(oldReader);
|
||||
|
||||
if (PlayerControl.LocalPlayer == null || player == null || player.IsLocalPlayer() || player.BetterData().IsBetterHost || reader == null) return true;
|
||||
if (PlayerControl.LocalPlayer == null || player == null || player.IsLocalPlayer() || (player.IsHost() && player.BetterData().IsBetterUser) || reader == null) return true;
|
||||
|
||||
if (!IsEnabled || !Main.AntiCheat.Value || GameState.IsBetterHostLobby && !GameState.IsHost || !BetterGameSettings.DetectInvalidRPCs.GetBool()) return true;
|
||||
|
||||
|
||||
@@ -83,11 +83,11 @@ public abstract class RPCHandler
|
||||
return !(cancel);
|
||||
}
|
||||
|
||||
public void LogRpcInfo(string info)
|
||||
public void LogRpcInfo(string info, PlayerControl? player = null)
|
||||
{
|
||||
string Name = Enum.GetName((RpcCalls)CallId) ?? Enum.GetName((CustomRPC)CallId) ?? $"Unregistered({CallId})";
|
||||
Name = $"[{Enum.GetName(catchedHandlerFlag)}] > " + Name;
|
||||
Logger.LogCheat($"{catchedSender.BetterData().RealName} {Name}: {info}");
|
||||
Logger.LogCheat($"{catchedSender?.BetterData()?.RealName ?? player.BetterData()?.RealName ?? string.Empty} {Name}: {info}");
|
||||
}
|
||||
|
||||
public string GetFormatActionText()
|
||||
|
||||
@@ -32,4 +32,14 @@ public class CheckAppearHandler : RPCHandler
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,18 @@
|
||||
using Hazel;
|
||||
|
||||
namespace BetterAmongUs.Modules.AntiCheat;
|
||||
|
||||
public class CheckColorHandler : RPCHandler
|
||||
{
|
||||
public override byte CallId => (byte)RpcCalls.CheckColor;
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -38,4 +38,14 @@ public class CheckMurderHandler : RPCHandler
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,14 @@ public class CheckProtectHandler : RPCHandler
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,14 @@ public class CheckShapeshiftHandler : RPCHandler
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,18 @@
|
||||
using Hazel;
|
||||
|
||||
namespace BetterAmongUs.Modules.AntiCheat;
|
||||
|
||||
public class CheckSporeHandler : RPCHandler
|
||||
{
|
||||
public override byte CallId => (byte)RpcCalls.CheckSpore;
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,14 @@ public class CheckVanishHandler : RPCHandler
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,18 @@
|
||||
using Hazel;
|
||||
|
||||
namespace BetterAmongUs.Modules.AntiCheat;
|
||||
|
||||
public class CheckZiplineHandler : RPCHandler
|
||||
{
|
||||
public override byte CallId => (byte)RpcCalls.CheckZipline;
|
||||
|
||||
public override bool HandleAntiCheatCancel(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
if (!GameState.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,16 +13,6 @@ public class CompleteTaskHandler : RPCHandler
|
||||
sender.DirtyName();
|
||||
}
|
||||
|
||||
public override bool BetterHandle(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
RPC.SyncAllNames(force: true);
|
||||
}, 1f, shouldLog: false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void HandleAntiCheat(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
var taskId = reader.ReadPackedUInt32();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using BetterAmongUs.Managers;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
|
||||
namespace BetterAmongUs.Modules.AntiCheat;
|
||||
|
||||
public class DeserializeNetObjectHandler : RPCHandler
|
||||
{
|
||||
public override byte GameDataTag => (byte)HandleGameDataTags.NetObjectDeserialize;
|
||||
|
||||
public override void HandleGameData(MessageReader reader)
|
||||
{
|
||||
uint netId = reader.ReadPackedUInt32();
|
||||
var innerNetObject = innerNetClient.FindObjectByNetId<InnerNetObject>(netId);
|
||||
if (innerNetObject?.TryCast<CustomNetworkTransform>() && GameState.IsMeeting && MeetingHudPatch.timeOpen >= 5f)
|
||||
{
|
||||
var player = innerNetObject.Cast<CustomNetworkTransform>()?.myPlayer;
|
||||
if (player == null) return;
|
||||
BetterNotificationManager.NotifyCheat(player, "Attempting to move in meeting", forceBan: true);
|
||||
LogRpcInfo($"{innerNetObject.TryCast<CustomNetworkTransform>()} && {GameState.IsMeeting} && {MeetingHudPatch.timeOpen >= 5f}", player);
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -18,7 +18,7 @@ public class ReportDeadBodyHandler : RPCHandler
|
||||
return CancelAsHost;
|
||||
}
|
||||
|
||||
if (GameState.IsMeeting && MeetingHudPatch.timeOpen > 0.5f || GameState.IsHideNSeek || sender.IsInVent() || sender.shapeshifting
|
||||
if (GameState.IsMeeting && MeetingHudPatch.timeOpen > 2f || GameState.IsHideNSeek || sender.IsInVent() || sender.shapeshifting
|
||||
|| sender.inMovingPlat || sender.onLadder || sender.MyPhysics.Animations.IsPlayingAnyLadderAnimation())
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(sender, string.Format(Translator.GetString("AntiCheat.InvalidActionRPC"), Enum.GetName((RpcCalls)CallId)));
|
||||
|
||||
@@ -204,7 +204,7 @@ public class UpdateSystemHandler : RPCHandler
|
||||
|
||||
private static bool HandleReactorSystem(PlayerControl? sender, ReactorSystemType reactorSystem, byte count)
|
||||
{
|
||||
if (count == 128 || count == 16) // Direct sabotage call from client, which is not possible, only the host should have this count when HandleSabotageSystem it's called
|
||||
if (count == 128) // Direct sabotage call from client, which is not possible, only the host should have this count when HandleSabotageSystem it's called
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -219,6 +219,7 @@ public class UpdateSystemHandler : RPCHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
if (count.HasAnyBit(64))
|
||||
{
|
||||
foreach (var tuple in reactorSystem.UserConsolePairs)
|
||||
@@ -229,6 +230,7 @@ public class UpdateSystemHandler : RPCHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -59,11 +59,6 @@ public class DebugMenu : MonoBehaviour
|
||||
RPC.SendBetterCheck();
|
||||
}, true);
|
||||
|
||||
AddButtonToTab(HostOnly, "Sync All Names", () =>
|
||||
{
|
||||
RPC.SyncAllNames();
|
||||
});
|
||||
|
||||
// Automatically select the first tab
|
||||
if (tabs.Count > 0)
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ public static class GameState
|
||||
public static bool IsCountDown => GameStartManager.InstanceExists && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown;
|
||||
public static bool IsShip => ShipStatus.Instance != null;
|
||||
public static bool IsHost => AmongUsClient.Instance != null && AmongUsClient.Instance.AmHost;
|
||||
public static bool IsBetterHostLobby => PlayerControl.LocalPlayer.IsHost() && Main.BetterHost.Value || Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.BetterData().IsBetterHost);
|
||||
public static bool IsBetterHostLobby => PlayerControl.LocalPlayer.IsHost() || Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.BetterData().IsBetterUser);
|
||||
public static bool IsTOHEHostLobby => Main.AllPlayerControls.Any(pc => pc.IsHost() && pc.BetterData().IsTOHEHost);
|
||||
public static bool IsCanMove => PlayerControl.LocalPlayer?.CanMove is true;
|
||||
public static bool IsDead => PlayerControl.LocalPlayer?.Data?.IsDead is true;
|
||||
|
||||
@@ -45,19 +45,6 @@ internal class PlayerControlRPCHandlerPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
var canceled = false;
|
||||
if (GameState.IsHost)
|
||||
{
|
||||
if (BetterHostManager.CheckRPCAsHost(__instance, callId, reader, ref canceled) != true)
|
||||
{
|
||||
if (canceled)
|
||||
{
|
||||
Logger.LogCheat($"RPC canceled by Host: {Enum.GetName((RpcCalls)callId)}{Enum.GetName((CustomRPC)callId)} - {callId}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
BAUAntiCheat.CheckRPC(__instance, callId, reader);
|
||||
RPC.HandleRPC(__instance, callId, reader);
|
||||
|
||||
@@ -119,10 +106,8 @@ internal static class RPC
|
||||
|
||||
public static void SendBetterCheck()
|
||||
{
|
||||
var flag = GameState.IsHost && Main.BetterHost.Value;
|
||||
MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.BetterCheck, SendOption.None, -1);
|
||||
messageWriter.Write(true);
|
||||
messageWriter.Write(flag);
|
||||
messageWriter.Write(Main.modSignature);
|
||||
messageWriter.Write(Main.GetVersionText().Replace(" ", ""));
|
||||
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
|
||||
@@ -141,17 +126,6 @@ internal static class RPC
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
public static void SyncAllNames(bool isForMeeting = false, bool force = false, bool isBetterHost = true)
|
||||
{
|
||||
if (!GameState.IsHost || !GameState.IsVanillaServer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (PlayerControl player in Main.AllPlayerControls)
|
||||
BetterHostManager.SetPlayersInfoAsHost(player, isForMeeting, force, isBetterHost);
|
||||
}
|
||||
|
||||
public static void ExileAsync(PlayerControl player)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.Exiled, SendOption.Reliable, -1);
|
||||
@@ -172,15 +146,9 @@ internal static class RPC
|
||||
case (byte)CustomRPC.BetterCheck:
|
||||
{
|
||||
var SetBetterUser = reader.ReadBoolean();
|
||||
var IsBetterHost = reader.ReadBoolean();
|
||||
var Signature = reader.ReadString();
|
||||
var Version = reader.ReadString();
|
||||
var IsVerified = Signature == Main.modSignature;
|
||||
if (!player.IsHost() && IsBetterHost)
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((CustomRPC)callId)} called as BetterHost");
|
||||
break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Signature) || string.IsNullOrEmpty(Version))
|
||||
{
|
||||
@@ -189,7 +157,6 @@ internal static class RPC
|
||||
}
|
||||
|
||||
player.BetterData().IsBetterUser = SetBetterUser;
|
||||
player.BetterData().IsBetterHost = IsBetterHost;
|
||||
|
||||
if (IsVerified)
|
||||
{
|
||||
@@ -198,12 +165,10 @@ internal static class RPC
|
||||
|
||||
Logger.Log($"Received better user RPC from: {player.Data.PlayerName}:{player.Data.FriendCode}:{Utils.GetHashPuid(player)} - " +
|
||||
$"BetterUser: {SetBetterUser} - " +
|
||||
$"BetterHost: {IsBetterHost} - " +
|
||||
$"Version: {Version} - " +
|
||||
$"Verified: {IsVerified} - " +
|
||||
$"Signature: {Signature}");
|
||||
|
||||
SyncAllNames(force: true);
|
||||
Utils.DirtyAllNames();
|
||||
}
|
||||
break;
|
||||
|
||||
+11
-9
@@ -19,6 +19,11 @@ class ChatPatch
|
||||
public static List<string> ChatHistory = [];
|
||||
public static int CurrentHistorySelection = -1;
|
||||
|
||||
public static void ClearChat()
|
||||
{
|
||||
HudManager.Instance.Chat.chatBubblePool.ReclaimAll();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.RpcSendChat))]
|
||||
class RpcSendChatPatch
|
||||
{
|
||||
@@ -126,10 +131,7 @@ class ChatPatch
|
||||
if (sourcePlayer.IsDev())
|
||||
sbTag.Append($"<color=#0088ff>Dev</color>+++");
|
||||
|
||||
if (((sourcePlayer.IsLocalPlayer() && GameState.IsHost && Main.BetterHost.Value)
|
||||
|| (!sourcePlayer.IsLocalPlayer() && sourcePlayer.BetterData().IsBetterHost && sourcePlayer.IsHost())))
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterHost"), sourcePlayer.BetterData().IsVerifiedBetterUser || sourcePlayer.IsLocalPlayer() ? "✓ " : "");
|
||||
else if ((sourcePlayer.IsLocalPlayer() || sourcePlayer.BetterData().IsBetterUser))
|
||||
if ((sourcePlayer.IsLocalPlayer() || sourcePlayer.BetterData().IsBetterUser))
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterUser"), sourcePlayer.BetterData().IsVerifiedBetterUser || sourcePlayer.IsLocalPlayer() ? "✓ " : "");
|
||||
|
||||
if (!string.IsNullOrEmpty(hashPuid) && BAUAntiCheat.SickoData.ContainsKey(hashPuid) || !string.IsNullOrEmpty(friendCode) && BAUAntiCheat.SickoData.ContainsValue(friendCode))
|
||||
@@ -298,25 +300,25 @@ class ChatPatch
|
||||
{
|
||||
int length = __instance.textArea.text.Length;
|
||||
__instance.charCountText.text = string.Format("{0}/118", length);
|
||||
__instance.charCountText.color = GetCharColor(length, UnityEngine.Color.white);
|
||||
__instance.charCountText.color = GetCharColor(length, Color.white);
|
||||
}
|
||||
}
|
||||
|
||||
private static UnityEngine.Color GetCharColor(int length, UnityEngine.Color color)
|
||||
private static Color GetCharColor(int length, Color color)
|
||||
{
|
||||
|
||||
switch (length)
|
||||
{
|
||||
case int n when n > 117:
|
||||
if (ColorUtility.TryParseHtmlString("#ff0000", out UnityEngine.Color newColor1))
|
||||
if (ColorUtility.TryParseHtmlString("#ff0000", out Color newColor1))
|
||||
color = newColor1;
|
||||
break;
|
||||
case int n when n > 74:
|
||||
if (ColorUtility.TryParseHtmlString("#ffff00", out UnityEngine.Color newColor3))
|
||||
if (ColorUtility.TryParseHtmlString("#ffff00", out Color newColor3))
|
||||
color = newColor3;
|
||||
break;
|
||||
default:
|
||||
if (ColorUtility.TryParseHtmlString("#00f04c", out UnityEngine.Color newColor4))
|
||||
if (ColorUtility.TryParseHtmlString("#00f04c", out Color newColor4))
|
||||
color = newColor4;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace BetterAmongUs.Patches;
|
||||
public static class OptionsMenuBehaviourPatch
|
||||
{
|
||||
private static ClientOptionItem? AntiCheat;
|
||||
private static ClientOptionItem? BetterHost;
|
||||
private static ClientOptionItem? BetterNotifications;
|
||||
private static ClientOptionItem? ForceOwnLanguage;
|
||||
private static ClientOptionItem? ChatDarkMode;
|
||||
@@ -54,23 +53,6 @@ public static class OptionsMenuBehaviourPatch
|
||||
AntiCheat = ClientOptionItem.Create(title, Main.AntiCheat, __instance);
|
||||
}
|
||||
|
||||
if (BetterHost == null || BetterHost.ToggleButton == null)
|
||||
{
|
||||
string title = Translator.GetString("BetterOption.BetterHost");
|
||||
BetterHost = ClientOptionItem.Create(title, Main.BetterHost, __instance, BetterHostButtonToggle, () => !toggleCheckInGamePlay(title));
|
||||
static void BetterHostButtonToggle()
|
||||
{
|
||||
RPC.SendBetterCheck();
|
||||
|
||||
foreach (var player in Main.AllPlayerControls)
|
||||
{
|
||||
player.BetterData().LastNameSetFor.Clear();
|
||||
}
|
||||
|
||||
RPC.SyncAllNames(force: true);
|
||||
}
|
||||
}
|
||||
|
||||
if (BetterNotifications == null || BetterNotifications.ToggleButton == null)
|
||||
{
|
||||
string title = Translator.GetString("BetterOption.BetterNotifications");
|
||||
|
||||
@@ -36,9 +36,11 @@ class CommandsPatch
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsOnCooldown = 3f - __instance.timeSinceLastMessage > 0f;
|
||||
|
||||
string text = __instance.freeChatField.textArea.text;
|
||||
|
||||
if (!text.StartsWith(CommandPrefix) || 3f - __instance.timeSinceLastMessage > 0f)
|
||||
if (!text.StartsWith(CommandPrefix) || IsOnCooldown)
|
||||
{
|
||||
if (GameState.IsInGame && !GameState.IsLobby && !GameState.IsFreePlay && !GameState.IsMeeting && !GameState.IsExilling && PlayerControl.LocalPlayer.IsAlive())
|
||||
return false;
|
||||
@@ -66,9 +68,8 @@ class CommandsPatch
|
||||
}
|
||||
|
||||
// Set up command helper
|
||||
private static TextMeshPro commandText;
|
||||
private static TextMeshPro commandInfo;
|
||||
private static RandomNameGenerator NameRNG;
|
||||
private static TextMeshPro? commandText;
|
||||
private static TextMeshPro? commandInfo;
|
||||
[HarmonyPatch(nameof(ChatController.Toggle))]
|
||||
[HarmonyPostfix]
|
||||
public static void Awake_Postfix(ChatController __instance)
|
||||
@@ -97,12 +98,6 @@ class CommandsPatch
|
||||
commandInfo.GetComponent<TextMeshPro>().characterWidthAdjustment = 1.5f;
|
||||
commandInfo.GetComponent<TextMeshPro>().enableWordWrapping = false;
|
||||
}
|
||||
|
||||
if (NameRNG == null)
|
||||
{
|
||||
RandomNameGenerator rng = __instance.gameObject.AddComponent<RandomNameGenerator>();
|
||||
NameRNG = rng;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool isTypedOut;
|
||||
|
||||
@@ -30,7 +30,6 @@ class GamePlayManager
|
||||
{
|
||||
if (GameState.IsInGame)
|
||||
{
|
||||
RPC.SyncAllNames(force: true);
|
||||
RPC.SendBetterCheck();
|
||||
}
|
||||
}, 1.5f, "LobbyBehaviourPatch SyncAllNames");
|
||||
|
||||
+102
-114
@@ -8,6 +8,7 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
namespace BetterAmongUs.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(MainMenuManager))]
|
||||
internal class MainMenuPatch
|
||||
{
|
||||
private static List<PassiveButton> buttons = [];
|
||||
@@ -44,132 +45,119 @@ internal class MainMenuPatch
|
||||
|
||||
SceneManager.s_AllowLoadScene = true;
|
||||
}
|
||||
|
||||
bool Flag = __instance?.screenTint?.GetComponent<SpriteRenderer>() != null
|
||||
&& !__instance.screenTint.GetComponent<SpriteRenderer>().enabled;
|
||||
|
||||
foreach (var item in buttonsObj)
|
||||
{
|
||||
item.SetActive(Flag);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace AU logo with BAU logo
|
||||
[HarmonyPatch(typeof(MainMenuManager))]
|
||||
internal class MainMenuManagerPatch
|
||||
[HarmonyPatch(nameof(MainMenuManager.Start))]
|
||||
[HarmonyPostfix]
|
||||
public static void Postfix(MainMenuManager __instance)
|
||||
{
|
||||
[HarmonyPatch(nameof(MainMenuManager.Start))]
|
||||
[HarmonyPostfix]
|
||||
public static void Postfix(MainMenuManager __instance)
|
||||
GameObject logo = GameObject.Find("LeftPanel/Sizer/LOGO-AU");
|
||||
GameObject sizer = logo.transform.parent.gameObject;
|
||||
sizer.transform.localPosition = new Vector3(sizer.transform.localPosition.x, sizer.transform.localPosition.y - 0.035f, sizer.transform.localPosition.z);
|
||||
sizer.transform.position = new Vector3(sizer.transform.position.x, sizer.transform.position.y, -0.5f);
|
||||
logo.transform.localScale = new Vector3(0.003f, 0.0025f, 0f);
|
||||
logo.GetComponent<SpriteRenderer>().sprite = Utils.LoadSprite("BetterAmongUs.Resources.Images.BetterAmongUs-Logo.png", 1f);
|
||||
|
||||
if (template == null) template = __instance.quitButton;
|
||||
|
||||
if (template == null) return;
|
||||
|
||||
buttons.Clear();
|
||||
buttonsObj.Clear();
|
||||
|
||||
/*
|
||||
if (creditsButton == null)
|
||||
{
|
||||
GameObject logo = GameObject.Find("LeftPanel/Sizer/LOGO-AU");
|
||||
GameObject sizer = logo.transform.parent.gameObject;
|
||||
sizer.transform.localPosition = new Vector3(sizer.transform.localPosition.x, sizer.transform.localPosition.y - 0.035f, sizer.transform.localPosition.z);
|
||||
sizer.transform.position = new Vector3(sizer.transform.position.x, sizer.transform.position.y, -0.5f);
|
||||
logo.transform.localScale = new Vector3(0.003f, 0.0025f, 0f);
|
||||
logo.GetComponent<SpriteRenderer>().sprite = Utils.LoadSprite("BetterAmongUs.Resources.Images.BetterAmongUs-Logo.png", 1f);
|
||||
creditsButton = CreateButton(
|
||||
"CreditsButton",
|
||||
new(255, 255, 255, byte.MaxValue),
|
||||
new(200, 200, 200, byte.MaxValue),
|
||||
() =>
|
||||
{
|
||||
DisconnectPopup.Instance.ShowCustom(creditsTextTitle + creditsText);
|
||||
},
|
||||
"Mod Credits"); //"Credits"
|
||||
}
|
||||
*/
|
||||
|
||||
if (template == null) template = __instance.quitButton;
|
||||
|
||||
if (template == null) return;
|
||||
|
||||
buttons.Clear();
|
||||
buttonsObj.Clear();
|
||||
|
||||
string creditsTextTitle = "<size=150%><color=#0dff00><b>-=Mod Credits=-</b></color></size>\n";
|
||||
string creditsText = "<size=75%>◆ <color=#0088ff>Head Developer</color>: <b>D1GQ</b></size>";
|
||||
|
||||
/*
|
||||
if (creditsButton == null)
|
||||
{
|
||||
creditsButton = CreateButton(
|
||||
"CreditsButton",
|
||||
new(255, 255, 255, byte.MaxValue),
|
||||
new(200, 200, 200, byte.MaxValue),
|
||||
() =>
|
||||
{
|
||||
DisconnectPopup.Instance.ShowCustom(creditsTextTitle + creditsText);
|
||||
},
|
||||
"Mod Credits"); //"Credits"
|
||||
}
|
||||
*/
|
||||
|
||||
if (gitHubButton == null)
|
||||
{
|
||||
gitHubButton = CreateButton(
|
||||
"GitHubButton",
|
||||
new(153, 153, 153, byte.MaxValue),
|
||||
new(209, 209, 209, byte.MaxValue),
|
||||
() => Application.OpenURL(Main.Github),
|
||||
"GitHub"); //"GitHub"
|
||||
}
|
||||
|
||||
if (discordButton == null)
|
||||
{
|
||||
discordButton = CreateButton(
|
||||
"DiscordButton",
|
||||
new(88, 101, 242, byte.MaxValue),
|
||||
new(148, 161, byte.MaxValue, byte.MaxValue),
|
||||
() => Application.OpenURL(Main.Discord),
|
||||
"Discord"); //"Discord"
|
||||
}
|
||||
if (gitHubButton == null)
|
||||
{
|
||||
gitHubButton = CreateButton(
|
||||
"GitHubButton",
|
||||
new(153, 153, 153, byte.MaxValue),
|
||||
new(209, 209, 209, byte.MaxValue),
|
||||
() => Application.OpenURL(Main.Github),
|
||||
"GitHub"); //"GitHub"
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(MainMenuManager.LateUpdate))]
|
||||
[HarmonyPostfix]
|
||||
public static void LateUpdate_Postfix(MainMenuManager __instance)
|
||||
if (discordButton == null)
|
||||
{
|
||||
bool Flag = __instance?.screenTint?.GetComponent<SpriteRenderer>() != null
|
||||
&& !__instance.screenTint.GetComponent<SpriteRenderer>().enabled;
|
||||
discordButton = CreateButton(
|
||||
"DiscordButton",
|
||||
new(88, 101, 242, byte.MaxValue),
|
||||
new(148, 161, byte.MaxValue, byte.MaxValue),
|
||||
() => Application.OpenURL(Main.Discord),
|
||||
"Discord"); //"Discord"
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in buttonsObj)
|
||||
{
|
||||
item.SetActive(Flag);
|
||||
}
|
||||
public static PassiveButton CreateButton(string name, Color32 normalColor, Color32 hoverColor, Action action, string label, Vector2? scale = null)
|
||||
{
|
||||
var button = UnityEngine.Object.Instantiate(template);
|
||||
buttons.Add(button);
|
||||
buttonsObj.Add(button.gameObject);
|
||||
button.name = name;
|
||||
button.GetComponent<AspectPosition>().DestroyMono();
|
||||
|
||||
// Set button position and scale
|
||||
float baseY = -2.7882f;
|
||||
float newY = baseY + (0.38f * (buttons.Count - 1));
|
||||
button.transform.localPosition = new Vector3(-0.6118f, newY, -5f);
|
||||
button.transform.localScale = new Vector3(0.78f, 0.78f, 0.78f);
|
||||
|
||||
// Set button action
|
||||
button.OnClick = new();
|
||||
button.OnClick.AddListener(action);
|
||||
|
||||
// Set button text
|
||||
var buttonText = button.transform.Find("FontPlacer/Text_TMP").GetComponent<TMP_Text>();
|
||||
buttonText.DestroyTextTranslator();
|
||||
buttonText.fontSize = buttonText.fontSizeMax = buttonText.fontSizeMin = 3.5f;
|
||||
buttonText.enableWordWrapping = false;
|
||||
buttonText.text = label;
|
||||
|
||||
// Set button colors
|
||||
var normalSprite = button.inactiveSprites.GetComponent<SpriteRenderer>();
|
||||
var hoverSprite = button.activeSprites.GetComponent<SpriteRenderer>();
|
||||
normalSprite.color = normalColor;
|
||||
hoverSprite.color = hoverColor;
|
||||
|
||||
// Align text
|
||||
var container = buttonText.transform.parent;
|
||||
container.GetComponent<AspectPosition>().DestroyMono();
|
||||
buttonText.GetComponent<AspectPosition>().DestroyMono();
|
||||
container.SetLocalX(0f);
|
||||
buttonText.transform.SetLocalX(0f);
|
||||
buttonText.horizontalAlignment = HorizontalAlignmentOptions.Center;
|
||||
|
||||
// Set button collider
|
||||
var buttonCollider = button.GetComponent<BoxCollider2D>();
|
||||
if (scale.HasValue)
|
||||
{
|
||||
normalSprite.size = hoverSprite.size = buttonCollider.size = scale.Value;
|
||||
}
|
||||
|
||||
public static PassiveButton CreateButton(string name, Color32 normalColor, Color32 hoverColor, Action action, string label, Vector2? scale = null)
|
||||
{
|
||||
var button = UnityEngine.Object.Instantiate(template);
|
||||
buttons.Add(button);
|
||||
buttonsObj.Add(button.gameObject);
|
||||
button.name = name;
|
||||
button.GetComponent<AspectPosition>().DestroyMono();
|
||||
|
||||
// Set button position and scale
|
||||
float baseY = -2.7882f;
|
||||
float newY = baseY + (0.38f * (buttons.Count - 1));
|
||||
button.transform.localPosition = new Vector3(-0.6118f, newY, -5f);
|
||||
button.transform.localScale = new Vector3(0.78f, 0.78f, 0.78f);
|
||||
|
||||
// Set button action
|
||||
button.OnClick = new();
|
||||
button.OnClick.AddListener(action);
|
||||
|
||||
// Set button text
|
||||
var buttonText = button.transform.Find("FontPlacer/Text_TMP").GetComponent<TMP_Text>();
|
||||
buttonText.DestroyTextTranslator();
|
||||
buttonText.fontSize = buttonText.fontSizeMax = buttonText.fontSizeMin = 3.5f;
|
||||
buttonText.enableWordWrapping = false;
|
||||
buttonText.text = label;
|
||||
|
||||
// Set button colors
|
||||
var normalSprite = button.inactiveSprites.GetComponent<SpriteRenderer>();
|
||||
var hoverSprite = button.activeSprites.GetComponent<SpriteRenderer>();
|
||||
normalSprite.color = normalColor;
|
||||
hoverSprite.color = hoverColor;
|
||||
|
||||
// Align text
|
||||
var container = buttonText.transform.parent;
|
||||
container.GetComponent<AspectPosition>().DestroyMono();
|
||||
buttonText.GetComponent<AspectPosition>().DestroyMono();
|
||||
container.SetLocalX(0f);
|
||||
buttonText.transform.SetLocalX(0f);
|
||||
buttonText.horizontalAlignment = HorizontalAlignmentOptions.Center;
|
||||
|
||||
// Set button collider
|
||||
var buttonCollider = button.GetComponent<BoxCollider2D>();
|
||||
if (scale.HasValue)
|
||||
{
|
||||
normalSprite.size = hoverSprite.size = buttonCollider.size = scale.Value;
|
||||
}
|
||||
|
||||
buttonCollider.offset = new Vector2(0f, 0f);
|
||||
|
||||
return button;
|
||||
}
|
||||
buttonCollider.offset = new Vector2(0f, 0f);
|
||||
|
||||
return button;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using AmongUs.GameOptions;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules.AntiCheat;
|
||||
using BetterAmongUs.Patches;
|
||||
using HarmonyLib;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
@@ -55,8 +56,6 @@ class MeetingHudPatch
|
||||
PlayerLevel.transform.position += new Vector3(0.23f, 0f);
|
||||
}
|
||||
|
||||
RPC.SyncAllNames(true, true);
|
||||
|
||||
Logger.LogHeader("Meeting Has Started");
|
||||
}
|
||||
|
||||
@@ -222,6 +221,10 @@ class MeetingHudPatch
|
||||
{
|
||||
timeOpen = 0f;
|
||||
Logger.LogHeader("Meeting Has Ended");
|
||||
RPC.SyncAllNames(force: true);
|
||||
|
||||
if (Main.ChatInGameplay.Value && !GameState.IsFreePlay && PlayerControl.LocalPlayer.IsAlive())
|
||||
{
|
||||
ChatPatch.ClearChat();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,11 +38,6 @@ public class PingTrackerPatch
|
||||
|
||||
if (GameState.IsTOHEHostLobby) sb.Append($"<size=75%><color=#e197dc>TOHE Lobby</color></size>\n");
|
||||
|
||||
if (Main.BetterHost.Value && GameState.IsHost)
|
||||
{
|
||||
sb.Append($"<size=75%>{Translator.GetString("BetterOption.BetterHost")}: <color=#00f04c>Enabled</color></size>\n");
|
||||
}
|
||||
|
||||
if (Main.ShowFPS.Value)
|
||||
{
|
||||
float FPSNum = 1.0f / Time.deltaTime;
|
||||
|
||||
@@ -185,16 +185,7 @@ class PlayerControlPatch
|
||||
if (player.IsHost() && Main.LobbyPlayerInfo.Value)
|
||||
newName = player.GetPlayerNameAndColor();
|
||||
|
||||
if (player.IsDev() && !GameState.IsInGamePlay)
|
||||
sbTag.Append($"<color=#6e6e6e>(<color=#0088ff>{Translator.GetString("Player.Dev")}</color>)</color>+++");
|
||||
|
||||
if ((player.IsLocalPlayer() && GameState.IsHost && Main.BetterHost.Value) ||
|
||||
(betterData.IsBetterHost && player.IsHost()) && !GameState.IsInGamePlay)
|
||||
{
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterHost"),
|
||||
betterData.IsVerifiedBetterUser || player.IsLocalPlayer() ? "✓ " : "");
|
||||
}
|
||||
else if ((player.IsLocalPlayer() || betterData.IsBetterUser) && !GameState.IsInGamePlay)
|
||||
if ((player.IsLocalPlayer() || betterData.IsBetterUser) && !GameState.IsInGamePlay)
|
||||
{
|
||||
sbTag.AppendFormat("<color=#0dff00>{1}{0}</color>+++", Translator.GetString("Player.BetterUser"),
|
||||
betterData.IsVerifiedBetterUser || player.IsLocalPlayer() ? "✓ " : "");
|
||||
@@ -241,19 +232,6 @@ class PlayerControlPatch
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(PlayerControl.SetColor))]
|
||||
[HarmonyPostfix]
|
||||
public static void SetColor_Postfix()
|
||||
{
|
||||
if (Main.BetterHost.Value && GameState.IsLobby)
|
||||
{
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
RPC.SyncAllNames(force: true);
|
||||
}, 0.25f, shouldLog: false);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(PlayerControl.CompleteTask))]
|
||||
[HarmonyPostfix]
|
||||
public static void CompleteTask_Postfix(PlayerControl __instance)
|
||||
@@ -293,11 +271,6 @@ class PlayerControlPatch
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
if (GameState.IsHost)
|
||||
{
|
||||
RPC.SyncAllNames();
|
||||
}
|
||||
|
||||
if (__instance != target)
|
||||
Logger.LogPrivate($"{__instance.Data.PlayerName} Has Shapeshifted into {target.Data.PlayerName}, did animate: {animate}", "EventLog");
|
||||
else
|
||||
|
||||
@@ -44,8 +44,6 @@ public static class OnPlayerJoinedPatch
|
||||
// Send Better Among Us Check RPC
|
||||
RPC.SendBetterCheck();
|
||||
|
||||
RPC.SyncAllNames(force: true);
|
||||
|
||||
// Auto ban player on ban list
|
||||
if (BetterGameSettings.UseBanPlayerList.GetBool())
|
||||
{
|
||||
|
||||
@@ -261,11 +261,6 @@ public class RoleManagerPatch
|
||||
|
||||
SetPlayerRole.Clear();
|
||||
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
RPC.SyncAllNames(false, true, Main.BetterHost.Value);
|
||||
}, 1f, "RoleManager SyncAllNames");
|
||||
|
||||
Logger.LogHeader($"Better Role Assignment Has Finished", "RoleManager");
|
||||
}
|
||||
|
||||
@@ -381,11 +376,6 @@ public class RoleManagerPatch
|
||||
player.RpcSetRole(RoleTypes.Engineer);
|
||||
}
|
||||
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
RPC.SyncAllNames(false, true, Main.BetterHost.Value);
|
||||
}, 1f, "RoleManager SyncAllNames");
|
||||
|
||||
Logger.LogHeader($"Better Role Assignment Has Finished", "RoleManager");
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ public enum ReleaseTypes : int
|
||||
[BepInProcess("Among Us.exe")]
|
||||
public class Main : BasePlugin
|
||||
{
|
||||
public static readonly ReleaseTypes ReleaseBuildType = ReleaseTypes.Beta;
|
||||
public const string BetaNum = "3";
|
||||
public const string HotfixNum = "0";
|
||||
public const bool IsHotFix = false;
|
||||
public static readonly ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
|
||||
public const string BetaNum = "0";
|
||||
public const string HotfixNum = "1";
|
||||
public const bool IsHotFix = true;
|
||||
public const string PluginGuid = "com.ten.betteramongus";
|
||||
public const string PluginVersion = "1.1.5";
|
||||
public const string ReleaseDate = "11.3.2024"; // mm/dd/yyyy
|
||||
@@ -90,7 +90,7 @@ public class Main : BasePlugin
|
||||
}
|
||||
|
||||
if (IsHotFix)
|
||||
text += $" Hotfix {HotfixNum}";
|
||||
text += $"{newLineText}Hotfix {HotfixNum}";
|
||||
|
||||
return text;
|
||||
}
|
||||
@@ -237,21 +237,19 @@ public class Main : BasePlugin
|
||||
}
|
||||
}
|
||||
|
||||
public static ConfigEntry<bool> AntiCheat { get; private set; }
|
||||
public static ConfigEntry<bool> BetterHost { get; private set; }
|
||||
public static ConfigEntry<bool> BetterNotifications { get; private set; }
|
||||
public static ConfigEntry<bool> ForceOwnLanguage { get; private set; }
|
||||
public static ConfigEntry<bool> ChatDarkMode { get; private set; }
|
||||
public static ConfigEntry<bool> ChatInGameplay { get; private set; }
|
||||
public static ConfigEntry<bool> LobbyPlayerInfo { get; private set; }
|
||||
public static ConfigEntry<bool> DisableLobbyTheme { get; private set; }
|
||||
public static ConfigEntry<bool> UnlockFPS { get; private set; }
|
||||
public static ConfigEntry<bool> ShowFPS { get; private set; }
|
||||
public static ConfigEntry<string> CommandPrefix { get; set; }
|
||||
public static ConfigEntry<bool>? AntiCheat { get; private set; }
|
||||
public static ConfigEntry<bool>? BetterNotifications { get; private set; }
|
||||
public static ConfigEntry<bool>? ForceOwnLanguage { get; private set; }
|
||||
public static ConfigEntry<bool>? ChatDarkMode { get; private set; }
|
||||
public static ConfigEntry<bool>? ChatInGameplay { get; private set; }
|
||||
public static ConfigEntry<bool>? LobbyPlayerInfo { get; private set; }
|
||||
public static ConfigEntry<bool>? DisableLobbyTheme { get; private set; }
|
||||
public static ConfigEntry<bool>? UnlockFPS { get; private set; }
|
||||
public static ConfigEntry<bool>? ShowFPS { get; private set; }
|
||||
public static ConfigEntry<string>? CommandPrefix { get; set; }
|
||||
private void LoadOptions()
|
||||
{
|
||||
AntiCheat = Config.Bind("Better Options", "AntiCheat", true);
|
||||
BetterHost = Config.Bind("Better Options", "BetterHost", false);
|
||||
BetterNotifications = Config.Bind("Better Options", "BetterNotifications", true);
|
||||
ForceOwnLanguage = Config.Bind("Better Options", "ForceOwnLanguage", false);
|
||||
ChatDarkMode = Config.Bind("Better Options", "ChatDarkMode", true);
|
||||
|
||||
Reference in new issue
Block a user