Compare commits

..
5 Commits
9 changed files with 89 additions and 23 deletions

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ public partial class Main : BasePlugin
public static NormalGameOptionsV10 NormalOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentNormalGameOptions : null;
public static bool HasArgumentException;
public static string CredentialsText;
public const string ModVersion = "v1.1.0";
public const string ModVersion = "v1.1.1";
public static float GameTimer;
+6
View File
@@ -12,6 +12,7 @@ namespace AmongUsRevamped;
public static class BanManager
{
public static string RemoveHtmlTags(this string str) => Regex.Replace(str, "<[^>]*?>", "");
private static readonly string DenyNameListPath = "./AUR-DATA/DenyNameList.txt";
private static string BanListPath = "./AUR-DATA/BanList.txt";
private static string ModeratorListPath = "./AUR-DATA/ModeratorList.txt";
public static List<string> TempBanWhiteList = [];
@@ -21,6 +22,11 @@ public static class BanManager
{
Directory.CreateDirectory("AUR-DATA");
if (!File.Exists(DenyNameListPath))
{
Logger.Warn("Creating a new DenyNameList.txt file", "BanManager");
File.Create(DenyNameListPath).Close();
}
if (!File.Exists(BanListPath))
{
Logger.Warn("Creating a new BanList.txt file", "BanManager");
+3 -1
View File
@@ -38,6 +38,7 @@ namespace AmongUsRevamped
public static OptionItem TempBanInvalidFriendCodes;
public static OptionItem ApplyBanList;
public static OptionItem ApplyDenyNameList;
public static OptionItem ApplyModeratorList;
public static OptionItem AutoRejoinLobby;
@@ -202,7 +203,8 @@ namespace AmongUsRevamped
.SetParent(KickInvalidFriendCodes);
ApplyBanList = BooleanOptionItem.Create(60110, "Apply BanList", true, TabGroup.SystemSettings, true);
ApplyModeratorList = BooleanOptionItem.Create(60120, "Apply ModeratorList", true, TabGroup.SystemSettings, false);
ApplyDenyNameList = BooleanOptionItem.Create(60120, "Apply DenyName List", true, TabGroup.SystemSettings, false);
ApplyModeratorList = BooleanOptionItem.Create(60121, "Apply Moderator List", true, TabGroup.SystemSettings, false);
AutoRejoinLobby = BooleanOptionItem.Create(60210, "Auto Rejoin Lobby", false, TabGroup.SystemSettings, false);
AutoStartTimer = IntegerOptionItem.Create(44420, "Countdown For Auto Start", new(1, 600, 1), 5, TabGroup.SystemSettings, false)
+51
View File
@@ -25,6 +25,8 @@ public static class Utils
public static long TimeStamp => EpochStartSeconds + (long)Stopwatch.Elapsed.TotalSeconds;
public static int allAlivePlayersCount => AllAlivePlayerControls.Count();
public static bool IsLobby => AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Joined;
public static bool InGame => AmongUsClient.Instance && AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Started;
public static bool isHideNSeek => GameOptionsManager.Instance.CurrentGameOptions.GameMode == GameModes.HideNSeek;
@@ -50,6 +52,23 @@ public static class Utils
return friendCodes.Any(code => code.Contains(friendCode));
}
public static bool IsPlayerInDenyName(ClientData client, string name)
{
if (name == "" || !AmongUsClient.Instance.AmHost || !Options.ApplyDenyNameList.GetBool()) return false;
var denyNameFilePath = @"./AUR-DATA/DenyNameList.txt";
var deniedNames = File.ReadAllLines(denyNameFilePath);
if (deniedNames.Where(code => !string.IsNullOrWhiteSpace(code)).Any(code => name.Contains(code, StringComparison.OrdinalIgnoreCase)))
{
AmongUsClient.Instance.KickPlayer(client.Id, false);
Logger.Info($" {name} was kicked because their name was in DenyNameList.txt", "Kick");
Logger.SendInGame($" {name} was kicked because their name was in DenyNameList.txt");
return true;
}
else return false;
}
public static string GetTabName(TabGroup tab)
{
switch (tab)
@@ -171,4 +190,36 @@ public static class Utils
try { return AmongUsClient.Instance.allClients.ToArray().FirstOrDefault(cd => cd.Id == id); }
catch { return null; }
}
public static void ClearLeftoverData()
{
RpcSetTasksPatch.GlobalTaskIds = null;
HandlingGameEnd = false;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
}
public static PlayerControl[] AllAlivePlayerControls
{
get
{
int count = PlayerControl.AllPlayerControls.Count;
var result = new PlayerControl[count];
var i = 0;
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
{
if (pc == null || pc.Data == null || pc.PlayerId >= 254 || pc.Data.IsDead || (pc.Data.Disconnected)) continue;
result[i++] = pc;
}
if (i == 0) return [];
Array.Resize(ref result, i);
return result;
}
}
}
+1 -6
View File
@@ -51,12 +51,7 @@ namespace AmongUsRevamped
{
private static void Postfix(VersionShower __instance)
{
RpcSetTasksPatch.GlobalTaskIds = null;
Utils.HandlingGameEnd = false;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
Utils.ClearLeftoverData();
Main.CredentialsText = $"<color=#FFD700>Among Us Revamped</color><color=#ffffff> {Main.ModVersion}</color>";
+2 -7
View File
@@ -10,12 +10,7 @@ public static class EndGameManagerPatch
{
public static void Postfix(EndGameManager __instance)
{
RpcSetTasksPatch.GlobalTaskIds = null;
Utils.HandlingGameEnd = false;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
Utils.ClearLeftoverData();
EndGameNavigation navigation = __instance.Navigation;
if (!AmongUsClient.Instance.AmHost || __instance == null || navigation == null || !Options.AutoRejoinLobby.GetBool()) return;
@@ -28,7 +23,7 @@ class NormalGameEndChecker
{
public static bool Prefix()
{
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3) return false;
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3 || Options.Gamemode.GetValue() == 2 && Main.NormalOptions.NumImpostors*2 < Utils.allAlivePlayersCount ) return false;
else return true;
}
}
+2
View File
@@ -56,6 +56,8 @@ class OnPlayerJoinedPatch
{
BanManager.CheckBanPlayer(Client);
Utils.IsPlayerInDenyName(Client, Client.PlayerName);
if (Utils.IsPlayerModerator(Client.FriendCode) && Options.ApplyModeratorList.GetBool())
{
Logger.Info($" {Client.PlayerName} is moderator", "ModeratorCheck");
+7 -4
View File
@@ -3,6 +3,7 @@ using AmongUs.GameOptions;
using Hazel;
using InnerNet;
using System;
using UnityEngine;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))]
@@ -12,12 +13,14 @@ class FixedUpdateInGamePatch
{
if (__instance == null || __instance.PlayerId == 255) return;
GameObject g = GameObject.Find("GameSettingsLabel");
// 0Kc
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 0.01f)
{
Main.NormalOptions.KillCooldown = 0.01f;
if (Options.NoKcdSettingsOverride.GetBool())
if (Options.NoKcdSettingsOverride.GetBool() && g == null)
{
Main.NormalOptions.EmergencyCooldown = 0;
Main.NormalOptions.DiscussionTime = 0;
@@ -35,7 +38,7 @@ class FixedUpdateInGamePatch
{
Main.NormalOptions.KillCooldown = 2.5f;
if (Options.SNSSettingsOverride.GetBool())
if (Options.SNSSettingsOverride.GetBool() && g == null)
{
Main.NormalOptions.NumEmergencyMeetings = 0;
@@ -48,7 +51,7 @@ class FixedUpdateInGamePatch
}
// Speedrun
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek)
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek && g == null)
{
Main.NormalOptions.NumEmergencyMeetings = 0;
@@ -149,7 +152,7 @@ internal static class MurderPlayerPatch
if (!__instance.Data.IsDead) {__instance.RpcSetRole(RoleTypes.Shapeshifter, false);}
}, Options.CantKillTime.GetInt(), "SNSResetRole");
if (misfireCount[__instance.Data.PlayerId] >= Options.MisfiresToSuicide.GetValue())
if (misfireCount[__instance.Data.PlayerId] >= Options.MisfiresToSuicide.GetFloat())
{
__instance.RpcSetRole(RoleTypes.ImpostorGhost);
Logger.Info($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} times and suicided", "SNSKillManager");
+16 -4
View File
@@ -1,6 +1,17 @@
# 📎 AmongUsRevamped
- AmongUsRevamped is a Host-Only mod with one goal: Creating the best Among Us experience possible without Modded Protocol. This includes new settings, utilities and even custom Gamemodes! Enjoy the countless features and feel free to contact me for anything regarding this mod. Happy gaming!
‎
# Welcome to AmongUsRevamped!
<br>
</p>
<p align="center">
<center>
<a href="https://discord.gg/83Zhzhyhya" target="_blank"><img src="https://img.shields.io/badge/Discord%20-%231DA1F2.svg?&style=for-the-badge&logo=discord&logoColor=white&color=5662f6"/></a>
<a href="https://github.com/apemv/AmongUsRevamped/releases/latest" target="_blank"><img src="https://img.shields.io/badge/Latest Version%20-%231DA1F2.svg?&style=for-the-badge&logo=github&logoColor=white&color=181717"/></a>
</center>
</p>
# 💡 How To Install:
- <b>If you have BepInEx, download AmongUsRevamped.dll in releases and move it into Among Us → BepinEx → Plugins</b>
@@ -18,7 +29,7 @@
<img src="https://github.com/astra1dev/AUnlocker/assets/90265231/14226f03-a003-4efc-b27b-6df53fb394d6" width=410 height=240>****
‎
# 🎮 Features (v1.1.0):
# 🎮 Features (v1.1.1):
- <b>🔶 Client Side settings:</b>
- Game Master
- Unlock FPS
@@ -29,6 +40,7 @@
- Kick/Ban players under a certain level
- Kick/Ban invalid FriendCodes
- Kick/Ban command using names instead of ID's
- DenyName system
- Moderator system
- Enable No Game End
- Banlist