mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
add settings and fixes
This commit is contained in:
1 parent
20a5660c14
commit
cd5c2c5339
9 files changed
+102
-33
No files matched your search
@@ -27,15 +27,15 @@ class AntiCheat
|
||||
|
||||
if (SickoData.ContainsKey(hashPuid))
|
||||
{
|
||||
player.Kick(true, $"banned by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#00f583>Known Sicko Menu User</color>", true);
|
||||
player.Kick(true, "{0} by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#00f583>Known Sicko Menu User</color>", true);
|
||||
}
|
||||
else if (AUMData.ContainsKey(hashPuid))
|
||||
{
|
||||
player.Kick(true, $"banned by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#4f0000>Known AUM User</color>", true);
|
||||
player.Kick(true, "{0} by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#4f0000>Known AUM User</color>", true);
|
||||
}
|
||||
else if (PlayerData.ContainsKey(hashPuid))
|
||||
{
|
||||
player.Kick(true, $"banned by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#fc0000>Known Cheater</color>", true);
|
||||
player.Kick(true, "{0} by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#fc0000>Known Cheater</color>", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class BetterNotificationManager
|
||||
|
||||
if (GameStates.IsHost && kickPlayer)
|
||||
{
|
||||
player.Kick(true, $"banned by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#fc0000>{reason}</color>", true);
|
||||
player.Kick(true, "{0} " + $"by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#fc0000>{reason}</color>", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,14 +108,24 @@ static class ExtendedPlayerControl
|
||||
return;
|
||||
}
|
||||
|
||||
if (AntiCheatBan)
|
||||
{
|
||||
if (BetterGameSettings.WhenCheating.GetValue() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ban = ban && BetterGameSettings.WhenCheating.GetValue() == 2;
|
||||
}
|
||||
|
||||
if (setReasonInfo != "")
|
||||
{
|
||||
GameDataShowNotificationPatch.BetterShowNotification(player.Data, forceReasonText: setReasonInfo);
|
||||
GameDataShowNotificationPatch.BetterShowNotification(player.Data, forceReasonText: string.Format(setReasonInfo, ban ? "banned" : "kicked"));
|
||||
}
|
||||
|
||||
AmongUsClient.Instance.KickPlayer(player.GetClientId(), ban);
|
||||
|
||||
player.BetterData().BannedByAntiCheat = AntiCheatBan && ban;
|
||||
player.BetterData().BannedByAntiCheat = AntiCheatBan;
|
||||
}
|
||||
|
||||
// RPCs
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using Rewired;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BetterAmongUs;
|
||||
|
||||
public class BetterOptionTitleItem : BetterOptionItem
|
||||
{
|
||||
public BetterOptionItem Create(GameOptionsMenu gameOptionsMenu, string name)
|
||||
{
|
||||
if (gameOptionsMenu == null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
ToggleOption optionBehaviour = UnityEngine.Object.Instantiate<ToggleOption>(gameOptionsMenu.checkboxOrigin, Vector3.zero, Quaternion.identity, gameOptionsMenu.settingsContainer);
|
||||
optionBehaviour.transform.localPosition = new Vector3(0.952f, 2f - StaticSpacingNum * SpacingNum, -2f);
|
||||
SetUp(optionBehaviour);
|
||||
SpacingNum++;
|
||||
UnityEngine.Object.Destroy(optionBehaviour.CheckMark.transform.parent.gameObject);
|
||||
optionBehaviour.TitleText.alignment = TMPro.TextAlignmentOptions.Center;
|
||||
optionBehaviour.TitleText.outlineColor = Color.black;
|
||||
optionBehaviour.TitleText.outlineWidth = 0.2f;
|
||||
|
||||
// Set data
|
||||
Tab = gameOptionsMenu;
|
||||
Name = $"<b><size=150%>{name}</size></b>";
|
||||
Option = optionBehaviour;
|
||||
TitleText = optionBehaviour.TitleText;
|
||||
|
||||
BetterOptionItems.Add(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void SetData(OptionBehaviour optionBehaviour)
|
||||
{
|
||||
optionBehaviour.data = new BaseGameSetting
|
||||
{
|
||||
Title = StringNames.None,
|
||||
Type = OptionTypes.Checkbox,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -19,26 +19,6 @@ class GamePlayManager
|
||||
{
|
||||
AntiCheat.PauseAntiCheat();
|
||||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
keysToRemove.Add(betterInfo.Key);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var key in keysToRemove)
|
||||
{
|
||||
PlayerControlDataExtension.playerInfo.Remove(key);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
[HarmonyPatch(nameof(LobbyBehaviour.Start))]
|
||||
[HarmonyPostfix]
|
||||
@@ -61,6 +41,26 @@ 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 { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BetterAmongUs.Patches;
|
||||
@@ -7,6 +8,8 @@ namespace BetterAmongUs.Patches;
|
||||
class BetterGameSettings
|
||||
{
|
||||
public static BetterOptionItem? WhenCheating;
|
||||
public static BetterOptionItem? InvalidFriendCode;
|
||||
public static BetterOptionItem? HideAndSeekImpNum;
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameSettingMenu))]
|
||||
@@ -22,10 +25,16 @@ static class GameSettingMenuPatch
|
||||
new BetterOptionHeaderItem().Create(BetterSettingsTab, "<color=#4f92ff>Anti-Cheat Settings</color>");
|
||||
|
||||
BetterGameSettings.WhenCheating = new BetterOptionStringItem().Create(0, BetterSettingsTab, "When a player is caught cheating", ["Do Nothing", "Kick", "Ban"], 2);
|
||||
BetterGameSettings.InvalidFriendCode = new BetterOptionCheckboxItem().Create(100, BetterSettingsTab, "Allow invalid friendCodes", true);
|
||||
|
||||
if (IsPreload || GameStates.IsHideNSeek)
|
||||
{
|
||||
new BetterOptionHeaderItem().Create(BetterSettingsTab, "<color=#d7d700>Advanced Hide And Seek Settings</color>");
|
||||
if (IsPreload || Main.BetterRoleAlgorithma.Value)
|
||||
{
|
||||
new BetterOptionHeaderItem().Create(BetterSettingsTab, "<color=#d7d700>Hide & Seek Settings</color>");
|
||||
new BetterOptionTitleItem().Create(BetterSettingsTab, $"<color={Utils.GetRoleColor(RoleTypes.Impostor)}>Imposter</color>");
|
||||
BetterGameSettings.HideAndSeekImpNum = new BetterOptionIntItem().Create(200, BetterSettingsTab, "# Seekers", [1, 5, 1], 1, "");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -115,6 +115,14 @@ class PlayerControlPatch
|
||||
{
|
||||
friendCode = "No Friend Code";
|
||||
friendCodeColor = "#ff0000";
|
||||
|
||||
if (GameStates.IsHost)
|
||||
{
|
||||
if (BetterGameSettings.InvalidFriendCode.GetBool())
|
||||
{
|
||||
player.Kick(true, "{0} by <color=#4f92ff>Anti-Cheat</color>!\n Reason: <color=#fc0000>Invalid Friend Code</color>", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DataManager.Settings.Gameplay.StreamerMode == true)
|
||||
{
|
||||
|
||||
@@ -268,7 +268,7 @@ public class RoleManagerPatch
|
||||
foreach (var addplayer in Main.AllPlayerControls.Where(pc => !ImpostorMultiplier.ContainsKey(Utils.GetHashPuid(pc))))
|
||||
ImpostorMultiplier[Utils.GetHashPuid(addplayer)] = 0;
|
||||
|
||||
int NumImpostors = 1;
|
||||
int NumImpostors = BetterGameSettings.HideAndSeekImpNum.GetInt();
|
||||
|
||||
int NumPlayers = Main.AllPlayerControls.Length;
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ public class Main : BasePlugin
|
||||
{
|
||||
public const ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
|
||||
public const string CanaryNum = "0";
|
||||
public const string HotfixNum = "3";
|
||||
public const bool IsHotFix = true;
|
||||
public const string HotfixNum = "0";
|
||||
public const bool IsHotFix = false;
|
||||
public const string PluginGuid = "com.d1gq.betteramongus";
|
||||
public const string PluginVersion = "1.0.4";
|
||||
public const string ReleaseDate = "08.21.2024"; // mm/dd/yyyy
|
||||
public const string PluginVersion = "1.0.5";
|
||||
public const string ReleaseDate = "08.22.2024"; // mm/dd/yyyy
|
||||
public const string Github = "https://github.com/D1GQ/BetterAmongUs-Public";
|
||||
public const string Discord = "https://discord.gg/vjYrXpzNAn";
|
||||
|
||||
|
||||
Reference in new issue
Block a user