mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-23 01:39:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c380c1b51 |
No files matched your search
+3
-1
@@ -42,7 +42,7 @@ public partial class Main : BasePlugin
|
||||
|
||||
public static bool HasArgumentException;
|
||||
public static string CredentialsText;
|
||||
public const string ModVersion = "v1.7.3";
|
||||
public const string ModVersion = "v1.7.4";
|
||||
|
||||
public static float GameTimer;
|
||||
|
||||
@@ -95,6 +95,8 @@ public partial class Main : BasePlugin
|
||||
BanManager.Init();
|
||||
|
||||
Harmony.PatchAll();
|
||||
|
||||
ConsoleManager.DetachConsole();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ModManager), nameof(ModManager.LateUpdate))]
|
||||
|
||||
+23
-42
@@ -35,48 +35,13 @@ public static class BanManager
|
||||
{
|
||||
if (!Directory.Exists($"{DataPath}/AUR-DATA")) Directory.CreateDirectory($"{DataPath}/AUR-DATA");
|
||||
|
||||
if (!File.Exists(DenyNameListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new DenyNameList.txt file", "BanManager");
|
||||
File.Create(DenyNameListPath).Close();
|
||||
File.WriteAllText(DenyNameListPath, Translator.Get("bannameWelcome"));
|
||||
}
|
||||
if (!File.Exists(BanListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new Banlist.txt file", "BanManager");
|
||||
File.Create(BanListPath).Close();
|
||||
File.WriteAllText(BanListPath, Translator.Get("banlistWelcome"));
|
||||
}
|
||||
if (!File.Exists(BanWordPath))
|
||||
{
|
||||
Logger.Warn("Creating a new Banlist.txt file", "BanManager");
|
||||
File.Create(BanWordPath).Close();
|
||||
File.WriteAllText(BanWordPath, Translator.Get("banwordWelcome"));
|
||||
}
|
||||
if (!File.Exists(VipListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new VIP.txt file", "BanManager");
|
||||
File.Create(VipListPath).Close();
|
||||
File.WriteAllText(VipListPath, Translator.Get("vipWelcome"));
|
||||
}
|
||||
if (!File.Exists(ModeratorListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new Moderator.txt file", "BanManager");
|
||||
File.Create(ModeratorListPath).Close();
|
||||
File.WriteAllText(ModeratorListPath, Translator.Get("moderatorWelcome"));
|
||||
}
|
||||
if (!File.Exists(AdminListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new Admin.txt file", "BanManager");
|
||||
File.Create(AdminListPath).Close();
|
||||
File.WriteAllText(AdminListPath, Translator.Get("adminWelcome"));
|
||||
}
|
||||
if (!File.Exists(TemplatePath))
|
||||
{
|
||||
Logger.Warn("Creating a new Templates.txt file", "BanManager");
|
||||
File.Create(TemplatePath).Close();
|
||||
File.WriteAllText(TemplatePath, Translator.Get("templateWelcome"));
|
||||
}
|
||||
CheckFile(DenyNameListPath, Translator.Get("bannameWelcome"), "DeniedNames.txt");
|
||||
CheckFile(BanListPath, Translator.Get("banlistWelcome"), "Banlist.txt");
|
||||
CheckFile(BanWordPath, Translator.Get("banwordWelcome"), "DeniedWords.txt");
|
||||
CheckFile(VipListPath, Translator.Get("vipWelcome"), "VIP.txt");
|
||||
CheckFile(ModeratorListPath, Translator.Get("moderatorWelcome"), "Moderator.txt");
|
||||
CheckFile(AdminListPath, Translator.Get("adminWelcome"), "Admin.txt");
|
||||
CheckFile(TemplatePath, Translator.Get("templateWelcome"), "Templates.txt");
|
||||
|
||||
LoadTemplates();
|
||||
|
||||
@@ -252,4 +217,20 @@ public static class BanManager
|
||||
if (!Templates.ContainsKey(key)) Templates.Add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckFile(string path, string defaultContent, string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
Logger.Warn($"Creating a new {name} file", "BanManager");
|
||||
File.WriteAllText(path, defaultContent);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Exception(ex, "BanManager");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@ namespace AmongUsRevamped
|
||||
public static OptionItem TabGroupMain;
|
||||
|
||||
public static OptionItem KickLowLevelPlayer;
|
||||
public static OptionItem DontKickLevelOnes;
|
||||
public static OptionItem TempBanLowLevelPlayer;
|
||||
|
||||
public static OptionItem KickInvalidFriendCodes;
|
||||
@@ -356,6 +357,8 @@ namespace AmongUsRevamped
|
||||
.SetValueFormat(OptionFormat.Level);
|
||||
TempBanLowLevelPlayer = BooleanOptionItem.Create(60051, Translator.Get("tempBanLowLevelPlayer"), false, TabGroup.SystemSettings, false)
|
||||
.SetParent(KickLowLevelPlayer);
|
||||
DontKickLevelOnes = BooleanOptionItem.Create(60052, Translator.Get("dontKickLevelOnes"), false, TabGroup.SystemSettings, false)
|
||||
.SetParent(KickLowLevelPlayer);
|
||||
|
||||
KickInvalidFriendCodes = BooleanOptionItem.Create(60080, Translator.Get("kickInvalidFriendCodes"), true, TabGroup.SystemSettings, false);
|
||||
TempBanInvalidFriendCodes = BooleanOptionItem.Create(60081, Translator.Get("tempBanInvalidFriendCodes"), false, TabGroup.SystemSettings, false)
|
||||
@@ -405,7 +408,7 @@ namespace AmongUsRevamped
|
||||
TabGroupCrewmate = TextOptionItem.Create(100000, Translator.Get("tabGroupCrewmate"), TabGroup.AbilitySettings)
|
||||
.SetColor(CL.Hex("#8cffff"));
|
||||
|
||||
CrewmateAbility = StringOptionItem.Create(100002, Translator.Get("crewmateAbility"), crewmateAbilities, 4, TabGroup.AbilitySettings, false)
|
||||
CrewmateAbility = StringOptionItem.Create(100001, Translator.Get("crewmateAbility"), crewmateAbilities, 4, TabGroup.AbilitySettings, false)
|
||||
.SetColor(CL.Hex("#8cffff"));
|
||||
|
||||
ScientistAbility = StringOptionItem.Create(100101, Translator.Get("scientistAbility"), crewmateAbilities, 4, TabGroup.AbilitySettings, false)
|
||||
@@ -429,9 +432,9 @@ namespace AmongUsRevamped
|
||||
.SetValueFormat(OptionFormat.Level);
|
||||
ExtraVotesPerTask = FloatOptionItem.Create(101002, Translator.Get("extraVotesPerTask"), new(0.25f, 3f, 0.25f), 0.5f, TabGroup.AbilitySettings, false)
|
||||
.SetValueFormat(OptionFormat.Level);
|
||||
SpeedrunnerShortTasks = IntegerOptionItem.Create(101003, Translator.Get("speedrunnerShortTasks"), new(0, 15, 1), 1, TabGroup.AbilitySettings, false)
|
||||
SpeedrunnerShortTasks = IntegerOptionItem.Create(101003, Translator.Get("speedrunnerShortTasks"), new(0, 15, 1), 4, TabGroup.AbilitySettings, false)
|
||||
.SetValueFormat(OptionFormat.Level);
|
||||
SpeedrunnerLongTasks = IntegerOptionItem.Create(101004, Translator.Get("speedrunnerLongTasks"), new(0, 15, 1), 1, TabGroup.AbilitySettings, false)
|
||||
SpeedrunnerLongTasks = IntegerOptionItem.Create(101004, Translator.Get("speedrunnerLongTasks"), new(0, 15, 1), 3, TabGroup.AbilitySettings, false)
|
||||
.SetValueFormat(OptionFormat.Level);
|
||||
|
||||
TabGroupImpostor = TextOptionItem.Create(102000, Translator.Get("tabGroupImpostor"), TabGroup.AbilitySettings)
|
||||
|
||||
@@ -128,6 +128,8 @@ public static class AbilityManagement
|
||||
|
||||
public static void SendRoleList(ChatController c, string text, bool moderator)
|
||||
{
|
||||
if (string.IsNullOrEmpty(AbilityManagement.RoleList())) return;
|
||||
|
||||
if (text.Length <= 120)
|
||||
{
|
||||
if (moderator) Utils.ModeratorChatCommand(text, "", false);
|
||||
|
||||
@@ -569,4 +569,15 @@ public static class Utils
|
||||
Logger.Info($"Found {methodName}.MoveNext", "GetStateMachineMoveNext");
|
||||
return moveNext;
|
||||
}
|
||||
|
||||
public static string GetRoleText(PlayerControl p)
|
||||
{
|
||||
if (p == null) return "";
|
||||
|
||||
if (p.Data.RoleType == RoleTypes.Impostor || p.Data.RoleType == RoleTypes.Shapeshifter || p.Data.RoleType == RoleTypes.Phantom || p.Data.RoleType == RoleTypes.Viper)
|
||||
{
|
||||
return $"<color=#ff1919>{p.Data.RoleType}</color>";
|
||||
}
|
||||
else return $"<color=#8cffff>{p.Data.RoleType}</color>";
|
||||
}
|
||||
}
|
||||
+16
-2
@@ -236,7 +236,14 @@ internal static class SendChatPatch
|
||||
|
||||
if (BanManager.Templates.TryGetValue(templateName, out string templateMessage))
|
||||
{
|
||||
Utils.ChatCommand(__instance, templateMessage, "", false);
|
||||
if (templateMessage.Length < 121)
|
||||
{
|
||||
Utils.ChatCommand(__instance, templateMessage, "", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, Translator.Get("tooLongTemplate"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -560,7 +567,14 @@ public static class RPCHandlerPatch
|
||||
|
||||
if (BanManager.Templates.TryGetValue(templateName, out string templateMessage))
|
||||
{
|
||||
Utils.ModeratorChatCommand(templateMessage, "", false);
|
||||
if (templateMessage.Length < 121)
|
||||
{
|
||||
Utils.ModeratorChatCommand(templateMessage, "", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, Translator.Get("tooLongTemplate"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ internal static class CoShowIntroPatch
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
//Utils.ModeratorChatCommand(Translator.Get("abilitiesGenericOne", Options.CrewmateAbility.GetString(), Options.ScientistAbility.GetString(), Options.EngineerAbility.GetString(), Options.NoisemakerAbility.GetString(), Options.TrackerAbility.GetString()), Translator.Get("abilitiesGenericTwo", Options.DetectiveAbility.GetString(), Options.ImpostorAbility.GetString(), Options.ShapeshifterAbility.GetString(), Options.PhantomAbility.GetString(), Options.ViperAbility.GetString()), true);
|
||||
AbilityManagement.SendRoleList(DestroyableSingleton<HudManager>.Instance.Chat, AbilityManagement.RoleList(), true);
|
||||
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
|
||||
@@ -121,6 +121,7 @@ public static class SetLevelPatch
|
||||
{
|
||||
if (AmongUsClient.Instance.AmHost && level < Options.KickLowLevelPlayer.GetInt() - 1 && __instance.Data.ClientId != AmongUsClient.Instance.HostId)
|
||||
{
|
||||
if (level == 0 && Options.DontKickLevelOnes.GetBool()) return;
|
||||
if (HandledLevelKicks.Contains(__instance)) return;
|
||||
|
||||
if (!Options.TempBanLowLevelPlayer.GetBool())
|
||||
|
||||
@@ -107,11 +107,11 @@ class MeetingHudStartPatch
|
||||
totalTasks++;
|
||||
if (task.Complete) tasksCompleted++;
|
||||
}
|
||||
return $"<color=green>({tasksCompleted}/{totalTasks})</color>";
|
||||
return $"<color=green>({tasksCompleted}/{totalTasks})</color> - {Utils.GetRoleText(player)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"<color=red>({MurderPlayerPatch.killCount[player.Data.PlayerId]}†)</color>";
|
||||
return $"<color=red>({MurderPlayerPatch.killCount[player.Data.PlayerId]}†)</color> - {Utils.GetRoleText(player)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,11 +63,11 @@ internal static class MurderPlayerPatch
|
||||
{
|
||||
if (p.Data.Role.IsImpostor)
|
||||
{
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=red><size=90%>({killCount[p.Data.PlayerId]}†)";
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=red><size=90%>({killCount[p.Data.PlayerId]}†)</color> - {Utils.GetRoleText(p)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=green><size=90%>({PlayerControlCompleteTaskPatch.playerTasksCompleted[p]}/{PlayerControlCompleteTaskPatch.tasksPerPlayer[p]})";
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=green><size=90%>({PlayerControlCompleteTaskPatch.playerTasksCompleted[p]}/{PlayerControlCompleteTaskPatch.tasksPerPlayer[p]})</color> - {Utils.GetRoleText(p)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ class PlayerControlCompleteTaskPatch
|
||||
if (PlayerControl.LocalPlayer.Data.IsDead && !Main.DisableInfoWhenDead.Value)
|
||||
{
|
||||
TMP_Text nameText = __instance.cosmetics.nameText;
|
||||
nameText.text = $"{__instance.Data.PlayerName}<color=green><size=90%>({playerTasksCompleted[__instance]}/{tasksPerPlayer[__instance]})</color>";
|
||||
nameText.text = $"{__instance.Data.PlayerName}<color=green><size=90%>({playerTasksCompleted[__instance]}/{tasksPerPlayer[__instance]})</color> - {Utils.GetRoleText(__instance)}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<img src="https://github.com/astra1dev/AUnlocker/assets/90265231/14226f03-a003-4efc-b27b-6df53fb394d6" width=410 height=240>****
|
||||
|
||||
|
||||
# 🎮 Features (v1.7.3):
|
||||
# 🎮 Features (v1.7.4):
|
||||
## <b> 🌟 Custom Abilities:</b>
|
||||
- Mayor (Crewmate)
|
||||
- The Mayor has a configurable amount of extra votes
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"tabGroupMain": "Moderation",
|
||||
"kickLowLevelPlayer": "Kick Players Under Level",
|
||||
"tempBanLowLevelPlayer": "Ban Instead Of Kick",
|
||||
"dontKickLevelOnes": "Don't Kick Lv.1 Players For Glitched Lobbies",
|
||||
"kickInvalidFriendCodes": "Kick Invalid FriendCodes",
|
||||
"tempBanInvalidFriendCodes": "Ban Instead Of Kick",
|
||||
"applyBanList": "Apply BanList",
|
||||
@@ -270,5 +271,7 @@
|
||||
"banwordWelcome": "# In this file you can set denied words, automatically kicking anyone in-game who sends words listed here.\n# Make sure to separate words by using new lines.",
|
||||
"bannameWelcome": "# In this file you can set denied names, automatically kicking anyone in-game who uses names listed here.\n# Make sure to separate names by using new lines.",
|
||||
|
||||
"noGameEndWarning": "WARNING: No Game End is enabled"
|
||||
"noGameEndWarning": "WARNING: No Game End is enabled",
|
||||
|
||||
"tooLongTemplate": "Your Template is longer than 120 characters and would kick you upon sending. Please reduce the length."
|
||||
}
|
||||
Reference in new issue
Block a user