mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-22 07:36:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a5fbe7300 | ||
|
|
fbf9b2b6eb | ||
|
|
7da659af7b | ||
|
|
58df006f07 | ||
|
|
0f373b8328 | ||
|
|
16ed549de4 | ||
|
|
bc2aa74046 | ||
|
|
45859032bd | ||
|
|
66a5eb0b09 | ||
|
|
95306ba8a9 | ||
|
|
2ee17166f2 | ||
|
|
10bae07af1 | ||
|
|
df0a68ff19 | ||
|
|
69ecb3c7a0 | ||
|
|
b30fa9a1e7 | ||
|
|
aa56c78c70 | ||
|
|
cd1de51a1f | ||
|
|
6d0d80b736 | ||
|
|
9af84609d9 |
No files matched your search
+1
-1
@@ -42,7 +42,7 @@ public partial class Main : BasePlugin
|
||||
|
||||
public static bool HasArgumentException;
|
||||
public static string CredentialsText;
|
||||
public const string ModVersion = "v1.6.0";
|
||||
public const string ModVersion = "v1.7.0";
|
||||
|
||||
public static float GameTimer;
|
||||
|
||||
|
||||
+51
-16
@@ -21,8 +21,11 @@ public static class BanManager
|
||||
|
||||
public static string RemoveHtmlTags(this string str) => Regex.Replace(str, "<[^>]*?>", "");
|
||||
private static readonly string DenyNameListPath = $"{DataPath}/AUR-DATA/DenyNameList.txt";
|
||||
private static string BanListPath = $"{DataPath}/AUR-DATA/BanList.txt";
|
||||
private static string ModeratorListPath = $"{DataPath}/AUR-DATA/ModeratorList.txt";
|
||||
private static string BanListPath = $"{DataPath}/AUR-DATA/Banlist.txt";
|
||||
private static string BanWordPath = $"{DataPath}/AUR-DATA/Bannedwords.txt";
|
||||
private static string VipListPath = $"{DataPath}/AUR-DATA/VIP.txt";
|
||||
private static string ModeratorListPath = $"{DataPath}/AUR-DATA/Moderator.txt";
|
||||
private static string AdminListPath = $"{DataPath}/AUR-DATA/Admin.txt";
|
||||
public static List<string> TempBanWhiteList = [];
|
||||
public static void Init()
|
||||
{
|
||||
@@ -37,14 +40,29 @@ public static class BanManager
|
||||
}
|
||||
if (!File.Exists(BanListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new BanList.txt file", "BanManager");
|
||||
Logger.Warn("Creating a new Banlist.txt file", "BanManager");
|
||||
File.Create(BanListPath).Close();
|
||||
}
|
||||
if (!File.Exists(BanWordPath))
|
||||
{
|
||||
Logger.Warn("Creating a new Banlist.txt file", "BanManager");
|
||||
File.Create(BanWordPath).Close();
|
||||
}
|
||||
if (!File.Exists(VipListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new VIP.txt file", "BanManager");
|
||||
File.Create(VipListPath).Close();
|
||||
}
|
||||
if (!File.Exists(ModeratorListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new ModeratorList.txt file", "BanManager");
|
||||
Logger.Warn("Creating a new Moderator.txt file", "BanManager");
|
||||
File.Create(ModeratorListPath).Close();
|
||||
}
|
||||
if (!File.Exists(AdminListPath))
|
||||
{
|
||||
Logger.Warn("Creating a new Admin.txt file", "BanManager");
|
||||
File.Create(AdminListPath).Close();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -99,7 +117,7 @@ public static class BanManager
|
||||
string friendcode = player?.FriendCode;
|
||||
|
||||
// Check file BanList.txt
|
||||
if (Options.ApplyBanList.GetBool() && CheckBanList(friendcode, player?.GetHashedPuid()))
|
||||
if (CheckBanList(friendcode, player?.GetHashedPuid()))
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(player.Id, true);
|
||||
Logger.Info($"{player.PlayerName} was in the BanList and has been banned", "BanListBan");
|
||||
@@ -152,7 +170,7 @@ public static class BanManager
|
||||
}
|
||||
public static bool IsPlayerInDenyName(ClientData client, string name)
|
||||
{
|
||||
if (name == "" || !AmongUsClient.Instance.AmHost || !Options.ApplyDenyNameList.GetBool()) return false;
|
||||
if (name == "" || !AmongUsClient.Instance.AmHost) return false;
|
||||
|
||||
var deniedNames = File.ReadAllLines(DenyNameListPath);
|
||||
|
||||
@@ -160,22 +178,39 @@ public static class BanManager
|
||||
{
|
||||
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");
|
||||
Logger.SendInGame($"{name} was kicked because their name was in DenyNameList.txt");
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
}
|
||||
[HarmonyPatch(typeof(BanMenu), nameof(BanMenu.Select))]
|
||||
class BanMenuSelectPatch
|
||||
{
|
||||
public static void Postfix(BanMenu __instance, int clientId)
|
||||
public static bool IsWordBanned(PlayerControl player, string input)
|
||||
{
|
||||
ClientData recentClient = AmongUsClient.Instance.GetRecentClient(clientId);
|
||||
if (recentClient == null) return;
|
||||
if (input == "" || !AmongUsClient.Instance.AmHost || Utils.CheckAccessLevel(player.Data.FriendCode) > 0) return false;
|
||||
|
||||
if (!BanManager.CheckBanList(recentClient?.FriendCode, recentClient?.GetHashedPuid()))
|
||||
__instance.BanButton.GetComponent<ButtonRolloverHandler>().SetEnabledColors();
|
||||
var bannedWords = File.ReadAllLines(BanWordPath);
|
||||
|
||||
if (bannedWords.Where(code => !string.IsNullOrWhiteSpace(code)).Any(code => input.Contains(code, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(player.Data.ClientId, false);
|
||||
Logger.Info($" {player.Data.PlayerName} was kicked because they sent a banned word", "Kick");
|
||||
Logger.SendInGame($"{player.Data.PlayerName} was kicked because they sent a banned word");
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(BanMenu), nameof(BanMenu.Select))]
|
||||
class BanMenuSelectPatch
|
||||
{
|
||||
public static void Postfix(BanMenu __instance, int clientId)
|
||||
{
|
||||
ClientData recentClient = AmongUsClient.Instance.GetRecentClient(clientId);
|
||||
if (recentClient == null) return;
|
||||
|
||||
if (!BanManager.CheckBanList(recentClient?.FriendCode, recentClient?.GetHashedPuid()))
|
||||
__instance.BanButton.GetComponent<ButtonRolloverHandler>().SetEnabledColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,12 +54,12 @@ namespace AmongUsRevamped
|
||||
|
||||
public static readonly string[] gameModes =
|
||||
{
|
||||
"None", "0 Kill Cooldown", "Shift And Seek", "Speedrun"
|
||||
"Standard", "0 Kill Cooldown", "Shift And Seek", "Speedrun"
|
||||
};
|
||||
|
||||
public static readonly string[] colorLevels =
|
||||
public static readonly string[] accessLevels =
|
||||
{
|
||||
"Moderators", "Everyone", "Nobody"
|
||||
"Everyone", "<color=yellow>VIP</color> And Above", "<color=purple>Moderator</color> And Above", "<color=red>Admin</color>", "Only You"
|
||||
};
|
||||
|
||||
//System
|
||||
@@ -73,11 +73,6 @@ namespace AmongUsRevamped
|
||||
public static OptionItem KickInvalidFriendCodes;
|
||||
public static OptionItem TempBanInvalidFriendCodes;
|
||||
|
||||
public static OptionItem ApplyBanList;
|
||||
public static OptionItem ApplyDenyNameList;
|
||||
public static OptionItem ApplyModeratorList;
|
||||
public static OptionItem ModeratorCanUseCommand;
|
||||
|
||||
public static OptionItem AutoKickStart;
|
||||
public static OptionItem AutoKickStartAsBan;
|
||||
public static OptionItem AutoKickStartTimes;
|
||||
@@ -97,6 +92,16 @@ namespace AmongUsRevamped
|
||||
public static OptionItem ColorCommandLevel;
|
||||
public static OptionItem AllowFortegreen;
|
||||
public static OptionItem NoGameEnd;
|
||||
|
||||
public static OptionItem TabGroupAccess;
|
||||
public static OptionItem SlashColorCmd;
|
||||
public static OptionItem SlashRolesAndGamemodeCmd;
|
||||
public static OptionItem SlashLastGameCmd;
|
||||
public static OptionItem SlashHelpAndAurCmd;
|
||||
public static OptionItem SlashKickCmd;
|
||||
public static OptionItem SlashBanCmd;
|
||||
public static OptionItem SlashEndMeetingCmd;
|
||||
public static OptionItem SlashStartAndEndGameCmd;
|
||||
|
||||
//Gameplay
|
||||
public static OptionItem TabGroupSabotages;
|
||||
@@ -112,13 +117,13 @@ namespace AmongUsRevamped
|
||||
|
||||
public static OptionItem TabGroupGameplayGeneral;
|
||||
public static OptionItem DisableAnnoyingMeetingCalls;
|
||||
public static OptionItem DisableReport;
|
||||
|
||||
public static OptionItem ChangeDecontaminationTime;
|
||||
public static OptionItem DecontaminationTimeOnMiraHQ;
|
||||
public static OptionItem DecontaminationDoorOpenTimeOnMiraHQ;
|
||||
public static OptionItem DecontaminationTimeOnPolus;
|
||||
public static OptionItem DecontaminationDoorOpenTimeOnPolus;
|
||||
public static OptionItem DisableSporeTrigger;
|
||||
|
||||
public static OptionItem DisableDevices;
|
||||
private static OptionItem DisableSkeldDevices;
|
||||
@@ -143,8 +148,8 @@ namespace AmongUsRevamped
|
||||
|
||||
public static OptionItem TabGroupTasks;
|
||||
public static OptionItem OverrideTaskSettings;
|
||||
|
||||
public static OptionItem AllPlayersSameTasks;
|
||||
public static OptionItem TaskPercentNeededToWin;
|
||||
|
||||
public static OptionItem DisableMiraTasks;
|
||||
|
||||
@@ -251,6 +256,9 @@ namespace AmongUsRevamped
|
||||
public static OptionItem DisableUploadData;
|
||||
|
||||
// Gamemode
|
||||
public static OptionItem TabGroupStandard;
|
||||
public static OptionItem ChatBeforeFirstMeeting;
|
||||
|
||||
public static OptionItem TabGroupHNS;
|
||||
public static OptionItem NumSeekers;
|
||||
|
||||
@@ -259,6 +267,7 @@ namespace AmongUsRevamped
|
||||
|
||||
public static OptionItem TabGroupSNS;
|
||||
public static OptionItem SNSSettingsOverride;
|
||||
public static OptionItem SNSChatInGame;
|
||||
public static OptionItem CrewAutoWinsGameAfter;
|
||||
public static OptionItem CantKillTime;
|
||||
public static OptionItem MisfiresToSuicide;
|
||||
@@ -278,9 +287,12 @@ namespace AmongUsRevamped
|
||||
// Roles
|
||||
public static OptionItem TabGroupCrewmate;
|
||||
public static OptionItem MayorPerc;
|
||||
public static OptionItem MayorExtraVoteCount;
|
||||
public static OptionItem MayorVentToMeeting;
|
||||
|
||||
public static OptionItem TabGroupNeutral;
|
||||
public static OptionItem JesterPerc;
|
||||
public static OptionItem JesterCanVent;
|
||||
|
||||
public static OptionItem TabGroupImpostor;
|
||||
|
||||
@@ -310,11 +322,6 @@ namespace AmongUsRevamped
|
||||
TempBanInvalidFriendCodes = BooleanOptionItem.Create(60081, Translator.Get("tempBanInvalidFriendCodes"), false, TabGroup.SystemSettings, false)
|
||||
.SetParent(KickInvalidFriendCodes);
|
||||
|
||||
ApplyBanList = BooleanOptionItem.Create(60110, Translator.Get("applyBanList"), true, TabGroup.SystemSettings, true);
|
||||
ApplyDenyNameList = BooleanOptionItem.Create(60120, Translator.Get("applyDenyNameList"), true, TabGroup.SystemSettings, false);
|
||||
ApplyModeratorList = BooleanOptionItem.Create(60121, Translator.Get("applyModeratorList"), true, TabGroup.SystemSettings, false);
|
||||
ModeratorCanUseCommand = BooleanOptionItem.Create(60122, Translator.Get("moderatorCanUseCommand"), true, TabGroup.SystemSettings, false);
|
||||
|
||||
AutoKickStart = BooleanOptionItem.Create(60123, Translator.Get("autoKickStart"), false, TabGroup.SystemSettings, false);
|
||||
AutoKickStartAsBan = BooleanOptionItem.Create(60124, Translator.Get("autoKickStartAsBan"), false, TabGroup.SystemSettings, false)
|
||||
.SetParent(AutoKickStart);
|
||||
@@ -340,31 +347,50 @@ namespace AmongUsRevamped
|
||||
|
||||
StartCountdown = IntegerOptionItem.Create(60380, Translator.Get("startCountdown"), new(1, 600, 1), 5, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
ColorCommandLevel = StringOptionItem.Create(60381, Translator.Get("colorCommandLevel"), colorLevels, 0, TabGroup.SystemSettings, false);
|
||||
AllowFortegreen = BooleanOptionItem.Create(60382, Translator.Get("allowFortegreen"), false, TabGroup.SystemSettings, false);
|
||||
NoGameEnd = BooleanOptionItem.Create(60383, Translator.Get("noGameEnd"), false, TabGroup.SystemSettings, false)
|
||||
.SetColor(Color.red);
|
||||
|
||||
|
||||
TabGroupAccess = TextOptionItem.Create(60400, Translator.Get("tabGroupAccess"), TabGroup.SystemSettings)
|
||||
.SetColor(Color.red);
|
||||
SlashColorCmd = StringOptionItem.Create(60401, Translator.Get("slashColorCmd"), accessLevels, 1, TabGroup.SystemSettings, false);
|
||||
SlashRolesAndGamemodeCmd = StringOptionItem.Create(60402, Translator.Get("slashRolesAndGamemodeCmd"), accessLevels, 1, TabGroup.SystemSettings, false);
|
||||
SlashLastGameCmd = StringOptionItem.Create(60403, Translator.Get("slashLastGameCmd"), accessLevels, 1, TabGroup.SystemSettings, false);
|
||||
SlashHelpAndAurCmd = StringOptionItem.Create(60404, Translator.Get("slashHelpAndAurCmd"), accessLevels, 1, TabGroup.SystemSettings, false);
|
||||
SlashKickCmd = StringOptionItem.Create(60405, Translator.Get("slashKickCmd"), accessLevels, 2, TabGroup.SystemSettings, false);
|
||||
SlashBanCmd = StringOptionItem.Create(60406, Translator.Get("slashBanCmd"), accessLevels, 2, TabGroup.SystemSettings, false);
|
||||
SlashEndMeetingCmd = StringOptionItem.Create(60407, Translator.Get("slashEndMeetingCmd"), accessLevels, 3, TabGroup.SystemSettings, false);
|
||||
SlashStartAndEndGameCmd = StringOptionItem.Create(60408, Translator.Get("slashStartAndEndGameCmd"), accessLevels, 3, TabGroup.SystemSettings, false);
|
||||
|
||||
|
||||
// Custom role settings
|
||||
TabGroupCrewmate = TextOptionItem.Create(100000, Translator.Get("tabGroupCrewmate"), TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#8cffff"));
|
||||
MayorPerc = IntegerOptionItem.Create(100001, Translator.Get("mayorPerc"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
MayorPerc = IntegerOptionItem.Create(100001, Translator.Get("Mayor"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
.SetValueFormat(OptionFormat.Percent)
|
||||
.SetColor(CL.Hex("#204d42"));
|
||||
MayorExtraVoteCount = IntegerOptionItem.Create(100002, Translator.Get("mayorExtraVoteCount"), new(1, 15, 1), 1, TabGroup.CustomRoleSettings, false)
|
||||
.SetValueFormat(OptionFormat.Level)
|
||||
.SetParent(MayorPerc);
|
||||
MayorVentToMeeting = BooleanOptionItem.Create(100003, Translator.Get("mayorVentToMeeting"), true, TabGroup.CustomRoleSettings, false)
|
||||
.SetParent(MayorPerc);
|
||||
|
||||
TabGroupNeutral = TextOptionItem.Create(101000, Translator.Get("tabGroupNeutral"), TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#FFFF99"));
|
||||
JesterPerc = IntegerOptionItem.Create(101001, Translator.Get("jesterPerc"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
JesterPerc = IntegerOptionItem.Create(101001, Translator.Get("Jester"), new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
.SetValueFormat(OptionFormat.Percent)
|
||||
.SetColor(CL.Hex("#ec62a5"));
|
||||
JesterCanVent = BooleanOptionItem.Create(101002, Translator.Get("jesterCanVent"), false, TabGroup.CustomRoleSettings, false)
|
||||
.SetParent(JesterPerc);
|
||||
|
||||
TabGroupImpostor = TextOptionItem.Create(102000, Translator.Get("tabGroupImpostor"), TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#ff1919"));
|
||||
|
||||
// Gamemode Settings
|
||||
TabGroupStandard = TextOptionItem.Create(69998, Translator.Get("tabGroupStandard"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.white);
|
||||
ChatBeforeFirstMeeting = BooleanOptionItem.Create(69999, Translator.Get("chatBeforeFirstMeeting"), false, TabGroup.GamemodeSettings, false);
|
||||
|
||||
TabGroupHNS = TextOptionItem.Create(70000, Translator.Get("tabGroupHNS"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.green);
|
||||
NumSeekers = IntegerOptionItem.Create(70001, Translator.Get("numSeekers"), new(1, 15, 1), 1, TabGroup.GamemodeSettings, false)
|
||||
@@ -377,6 +403,7 @@ namespace AmongUsRevamped
|
||||
TabGroupSNS = TextOptionItem.Create(70050, Translator.Get("tabGroupSNS"), TabGroup.GamemodeSettings)
|
||||
.SetColor(Color.yellow);
|
||||
SNSSettingsOverride = BooleanOptionItem.Create(70051, Translator.Get("snsSettingsOverride"), true, TabGroup.GamemodeSettings, false);
|
||||
SNSChatInGame = BooleanOptionItem.Create(70063, Translator.Get("snsChatInGame"), false, TabGroup.GamemodeSettings, false);
|
||||
CantKillTime = IntegerOptionItem.Create(70053, Translator.Get("cantKillTime"), new(0, 60, 5), 20, TabGroup.GamemodeSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
MisfiresToSuicide = IntegerOptionItem.Create(70052, Translator.Get("misfiresToSuicide"), new(1, 10, 1), 2, TabGroup.GamemodeSettings, false);
|
||||
@@ -443,8 +470,6 @@ namespace AmongUsRevamped
|
||||
.SetColor(Color.blue);
|
||||
DisableAnnoyingMeetingCalls = BooleanOptionItem.Create(60565, Translator.Get("disableAnnoyingMeetingCalls"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
DisableReport = BooleanOptionItem.Create(60520, Translator.Get("disableReport"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
|
||||
ChangeDecontaminationTime = BooleanOptionItem.Create(60550, Translator.Get("changeDecontaminationTime"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
@@ -465,6 +490,9 @@ namespace AmongUsRevamped
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
|
||||
DisableSporeTrigger = BooleanOptionItem.Create(60558, Translator.Get("disableSporeTrigger"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
|
||||
DisableDevices = BooleanOptionItem.Create(22900, Translator.Get("disableDevices"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(Color.red);
|
||||
|
||||
@@ -517,99 +545,97 @@ namespace AmongUsRevamped
|
||||
.SetParent(DisableAirshipDevices)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
|
||||
DisableFungleDevices = BooleanOptionItem.Create(22925, "Disable Fungle Devices", false, TabGroup.ModSettings, false)
|
||||
DisableFungleDevices = BooleanOptionItem.Create(22925, Translator.Get("disableFungleDevices"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableDevices)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
|
||||
DisableFungleCamera = BooleanOptionItem.Create(22926, "Disable Fungle Camera", false, TabGroup.ModSettings, false)
|
||||
DisableFungleCamera = BooleanOptionItem.Create(22926, Translator.Get("disableFungleCamera"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableFungleDevices)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
|
||||
DisableFungleVital = BooleanOptionItem.Create(22927, "Disable Fungle Vitals", false, TabGroup.ModSettings, false)
|
||||
DisableFungleVital = BooleanOptionItem.Create(22927, Translator.Get("disableFungleVital"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableFungleDevices)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
|
||||
|
||||
TabGroupTasks = TextOptionItem.Create(22997, "Tasks", TabGroup.ModSettings)
|
||||
TabGroupTasks = TextOptionItem.Create(22995, Translator.Get("tabGroupTasks"), TabGroup.ModSettings)
|
||||
.SetColor(Color.yellow);
|
||||
AllPlayersSameTasks = BooleanOptionItem.Create(22998, "Everyone has same tasks", false, TabGroup.ModSettings, false)
|
||||
TaskPercentNeededToWin = IntegerOptionItem.Create(22996, Translator.Get("taskPercentNeededToWin"), new(30, 100, 5), 100, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(255, 255, 153, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Percent);
|
||||
AllPlayersSameTasks = BooleanOptionItem.Create(22998, Translator.Get("allPlayersSameTasks"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(255, 255, 153, byte.MaxValue));
|
||||
OverrideTaskSettings = BooleanOptionItem.Create(22999, Translator.Get("overrideTaskSettings"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(255, 255, 153, byte.MaxValue));
|
||||
OverrideTaskSettings = BooleanOptionItem.Create(22999, "<#ffd>Di<#ffb>sa<#ff9>bl<#ffb>e T<#ffd>as<#ffb>ks", false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(239, 89, 175, byte.MaxValue));
|
||||
|
||||
DisableMiraTasks = BooleanOptionItem.Create(23000, "Disable Mira HQ Tasks", false, TabGroup.ModSettings, false)
|
||||
DisableMiraTasks = BooleanOptionItem.Create(23000, Translator.Get("disableMiraTasks"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(173, 216, 230, byte.MaxValue))
|
||||
.SetParent(OverrideTaskSettings);
|
||||
|
||||
DisableBuyBeverage = BooleanOptionItem.Create(23001, "Disable Buy Beverage", false, TabGroup.ModSettings, false)
|
||||
DisableBuyBeverage = BooleanOptionItem.Create(23001, Translator.Get("disableBuyBeverage"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableMiraTasks);
|
||||
DisableMeasureWeather = BooleanOptionItem.Create(23002, "Disable Measure Weather", false, TabGroup.ModSettings, false)
|
||||
DisableMeasureWeather = BooleanOptionItem.Create(23002, Translator.Get("disableMeasureWeather"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableMiraTasks);
|
||||
DisableProcessData = BooleanOptionItem.Create(23003, "Disable Process Data", false, TabGroup.ModSettings, false)
|
||||
DisableProcessData = BooleanOptionItem.Create(23003, Translator.Get("disableProcessData"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableMiraTasks);
|
||||
DisableRunDiagnostics = BooleanOptionItem.Create(23004, "Disable Run Diagnostics", false, TabGroup.ModSettings, false)
|
||||
DisableRunDiagnostics = BooleanOptionItem.Create(23004, Translator.Get("disableRunDiagnostics"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableMiraTasks);
|
||||
DisableSortSamples = BooleanOptionItem.Create(23005, "Disable Sort Samples", false, TabGroup.ModSettings, false)
|
||||
DisableSortSamples = BooleanOptionItem.Create(23005, Translator.Get("disableSortSamples"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableMiraTasks);
|
||||
|
||||
|
||||
|
||||
DisablePolusTasks = BooleanOptionItem.Create(23100, "Disable Polus Tasks", false, TabGroup.ModSettings, false)
|
||||
DisablePolusTasks = BooleanOptionItem.Create(23100, Translator.Get("disablePolusTasks"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(173, 216, 230, byte.MaxValue))
|
||||
.SetParent(OverrideTaskSettings);
|
||||
|
||||
DisableActivateWeatherNodes = BooleanOptionItem.Create(23101, "Disable Activate Weather Nodes", false, TabGroup.ModSettings, false)
|
||||
DisableActivateWeatherNodes = BooleanOptionItem.Create(23101, Translator.Get("disableActivateWeatherNodes"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
DisableAlignTelescope = BooleanOptionItem.Create(23102, "Disable Align Telescope", false, TabGroup.ModSettings, false)
|
||||
DisableAlignTelescope = BooleanOptionItem.Create(23102, Translator.Get("disableAlignTelescope"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
DisableFillCanisters = BooleanOptionItem.Create(23103, "Disable Fill Canisters", false, TabGroup.ModSettings, false)
|
||||
DisableFillCanisters = BooleanOptionItem.Create(23103, Translator.Get("disableFillCanisters"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
DisableInsertKeys = BooleanOptionItem.Create(23104, "Disable Insert Keys", false, TabGroup.ModSettings, false)
|
||||
DisableInsertKeys = BooleanOptionItem.Create(23104, Translator.Get("disableInsertKeys"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
DisableOpenWaterways = BooleanOptionItem.Create(23105, "Disable Open Waterways", false, TabGroup.ModSettings, false)
|
||||
DisableOpenWaterways = BooleanOptionItem.Create(23105, Translator.Get("disableOpenWaterways"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
DisableRebootWifi = BooleanOptionItem.Create(23106, "Disable Reboot Wifi", false, TabGroup.ModSettings, false)
|
||||
DisableRebootWifi = BooleanOptionItem.Create(23106, Translator.Get("disableRebootWifi"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
DisableRepairDrill = BooleanOptionItem.Create(23107, "Disable Repair Drill", false, TabGroup.ModSettings, false)
|
||||
DisableRepairDrill = BooleanOptionItem.Create(23107, Translator.Get("disableRepairDrill"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
DisableScanBoardingPass = BooleanOptionItem.Create(23108, "Disable Scan Boarding Pass", false, TabGroup.ModSettings, false)
|
||||
DisableScanBoardingPass = BooleanOptionItem.Create(23108, Translator.Get("disableScanBoardingPass"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisablePolusTasks);
|
||||
|
||||
|
||||
|
||||
DisableAirshipTasks = BooleanOptionItem.Create(23200, "Disable Airship Tasks", false, TabGroup.ModSettings, false)
|
||||
DisableAirshipTasks = BooleanOptionItem.Create(23200, Translator.Get("disableAirshipTasks"), false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(173, 216, 230, byte.MaxValue))
|
||||
.SetParent(OverrideTaskSettings);
|
||||
|
||||
DisableCleanToilet = BooleanOptionItem.Create(23201, "Disable Clean Toilet", false, TabGroup.ModSettings, false)
|
||||
DisableCleanToilet = BooleanOptionItem.Create(23201, Translator.Get("disableCleanToilet"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableDecontaminate = BooleanOptionItem.Create(23202, "Disable Decontaminate", false, TabGroup.ModSettings, false)
|
||||
DisableDecontaminate = BooleanOptionItem.Create(23202, Translator.Get("disableDecontaminate"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableDevelopPhotos = BooleanOptionItem.Create(23203, "Disable Develop Photos", false, TabGroup.ModSettings, false)
|
||||
DisableDevelopPhotos = BooleanOptionItem.Create(23203, Translator.Get("disableDevelopPhotos"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableDressMannequin = BooleanOptionItem.Create(23204, "Disable Dress Mannequin", false, TabGroup.ModSettings, false)
|
||||
DisableDressMannequin = BooleanOptionItem.Create(23204, Translator.Get("disableDressMannequin"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableFixShower = BooleanOptionItem.Create(23205, "Disable Fix Shower", false, TabGroup.ModSettings, false)
|
||||
DisableFixShower = BooleanOptionItem.Create(23205, Translator.Get("disableFixShower"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableMakeBurger = BooleanOptionItem.Create(23206, "Disable Make Burger", false, TabGroup.ModSettings, false)
|
||||
DisableMakeBurger = BooleanOptionItem.Create(23206, Translator.Get("disableMakeBurger"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisablePickUpTowels = BooleanOptionItem.Create(23207, "Disable Pick Up Towels", false, TabGroup.ModSettings, false)
|
||||
DisablePickUpTowels = BooleanOptionItem.Create(23207, Translator.Get("disablePickUpTowels"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisablePolishRuby = BooleanOptionItem.Create(23208, "Disable Polish Ruby", false, TabGroup.ModSettings, false)
|
||||
DisablePolishRuby = BooleanOptionItem.Create(23208, Translator.Get("disablePolishRuby"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisablePutAwayPistols = BooleanOptionItem.Create(23209, "Disable Put Away Pistols", false, TabGroup.ModSettings, false)
|
||||
DisablePutAwayPistols = BooleanOptionItem.Create(23209, Translator.Get("disablePutAwayPistols"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisablePutAwayRifles = BooleanOptionItem.Create(23210, "Disable Put Away Rifles", false, TabGroup.ModSettings, false)
|
||||
DisablePutAwayRifles = BooleanOptionItem.Create(23210, Translator.Get("disablePutAwayRifles"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableRewindTapes = BooleanOptionItem.Create(23211, "Disable Rewind Tapes", false, TabGroup.ModSettings, false)
|
||||
DisableRewindTapes = BooleanOptionItem.Create(23211, Translator.Get("disableRewindTapes"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableResetBreaker = BooleanOptionItem.Create(23212, "Disable Reset Breaker Task", false, TabGroup.ModSettings, false)
|
||||
DisableResetBreaker = BooleanOptionItem.Create(23212, Translator.Get("disableResetBreaker"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableSortRecords = BooleanOptionItem.Create(23213, "Disable Sort Records", false, TabGroup.ModSettings, false)
|
||||
DisableSortRecords = BooleanOptionItem.Create(23213, Translator.Get("disableSortRecords"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableStartFans = BooleanOptionItem.Create(23214, "Disable Start Fans", false, TabGroup.ModSettings, false)
|
||||
DisableStartFans = BooleanOptionItem.Create(23214, Translator.Get("disableStartFans"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
DisableUnlockSafe = BooleanOptionItem.Create(23215, "Disable Unlock Safe Task", false, TabGroup.ModSettings, false)
|
||||
DisableUnlockSafe = BooleanOptionItem.Create(23215, Translator.Get("disableUnlockSafe"), false, TabGroup.ModSettings, false)
|
||||
.SetParent(DisableAirshipTasks);
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using AmongUs.GameOptions;
|
||||
using Hazel;
|
||||
using System;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
@@ -10,8 +11,16 @@ public static class CustomRoleManagement
|
||||
public static Dictionary<byte, string> PlayerRoles = new Dictionary<byte, string>();
|
||||
private static readonly System.Random random = new System.Random();
|
||||
|
||||
public static string GetRole(byte playerId)
|
||||
{
|
||||
PlayerRoles.TryGetValue(playerId, out string role);
|
||||
return role ?? "None";
|
||||
}
|
||||
|
||||
public static void AssignRoles()
|
||||
{
|
||||
if (Options.Gamemode.GetValue() > 1) return;
|
||||
|
||||
// crewmateRoles = assigned with crewmate role base
|
||||
// impostorRoles = assigned with impostor role base
|
||||
List<(string roleName, int percentage)> crewmateRoles = new()
|
||||
@@ -40,14 +49,14 @@ public static class CustomRoleManagement
|
||||
|
||||
foreach (var (roleName, percentage) in rolesToAssign)
|
||||
{
|
||||
if (attemptedRoles.Contains(roleName)) continue;
|
||||
if (attemptedRoles.Contains(roleName) || percentage == 0) continue;
|
||||
|
||||
attemptedRoles.Add(roleName);
|
||||
|
||||
int randomValue = random.Next(0, 101);
|
||||
Logger.Info($"{roleName}, Value: {randomValue}, Percentage: {percentage}", "StartGameCustomRole1");
|
||||
|
||||
if (randomValue >= percentage) continue;
|
||||
if (randomValue > percentage) continue;
|
||||
if (PlayerRoles.ContainsKey(player.PlayerId)) continue;
|
||||
|
||||
PlayerRoles[player.PlayerId] = roleName;
|
||||
@@ -73,7 +82,7 @@ public static class CustomRoleManagement
|
||||
sb.Append(c);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetActiveRoles()
|
||||
{
|
||||
@@ -107,29 +116,45 @@ public static class CustomRoleManagement
|
||||
private static int PendingRoleMessages = 0;
|
||||
public static void SendRoleMessages(Dictionary<string, string> roleMessages)
|
||||
{
|
||||
if (PlayerRoles.Count == 0 || PlayerControl.LocalPlayer.Data.IsDead) return;
|
||||
|
||||
HashSet<string> sentRoles = new HashSet<string>();
|
||||
|
||||
var players = PlayerControl.AllPlayerControls.ToArray().ToList();
|
||||
float delay = 0f;
|
||||
float delay = 2.2f;
|
||||
|
||||
PendingRoleMessages = 0;
|
||||
HandlingRoleMessages = false;
|
||||
HandlingRoleMessages = true;
|
||||
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"{Translator.Get("customRoleAnnouncement")}");
|
||||
|
||||
foreach (var player in players)
|
||||
{
|
||||
if (!PlayerRoles.TryGetValue(player.PlayerId, out string role)) continue;
|
||||
PlayerRoles.TryGetValue(player.PlayerId, out string role);
|
||||
|
||||
if (string.IsNullOrEmpty(role)) continue;
|
||||
if (!roleMessages.ContainsKey(role)) continue;
|
||||
if (sentRoles.Contains(role)) continue;
|
||||
|
||||
PendingRoleMessages++;
|
||||
new LateTask(() =>
|
||||
{
|
||||
Utils.SendPrivateMessage(player, roleMessages[role]);
|
||||
if (Utils.InGame)
|
||||
{
|
||||
Utils.SendPrivateMessage(player, roleMessages[role]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("Role sending was forcefully canceled. This should not happen.", "SendRoleMessages");
|
||||
}
|
||||
|
||||
PendingRoleMessages--;
|
||||
|
||||
if (PendingRoleMessages <= 0)
|
||||
{
|
||||
PendingRoleMessages = 0;
|
||||
HandlingRoleMessages = false;
|
||||
sentRoles.Clear();
|
||||
}
|
||||
}, delay, "SendRoleMessage");
|
||||
|
||||
|
||||
+55
-47
@@ -36,65 +36,73 @@ public static class FixedUpdate
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))]
|
||||
class FixedUpdateInGamePatch
|
||||
{
|
||||
public static readonly HashSet<byte> ProcessedModerators = new HashSet<byte>();
|
||||
private static Dictionary<byte, string> LastColors = new();
|
||||
private static float t;
|
||||
private static GameObject settingsLabel;
|
||||
|
||||
public static void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (__instance == null || __instance.PlayerId == 255 || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (Utils.IsPlayerModerator(__instance.Data.FriendCode) && !ProcessedModerators.Contains(__instance.PlayerId))
|
||||
t += Time.deltaTime;
|
||||
if (t < 0.2f) return;
|
||||
t = 0f;
|
||||
|
||||
if (Utils.IsLobby)
|
||||
{
|
||||
__instance.SetName($"★{__instance.Data.PlayerName}★");
|
||||
ProcessedModerators.Add(__instance.PlayerId);
|
||||
}
|
||||
|
||||
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() && g == null)
|
||||
int access = Utils.CheckAccessLevel(__instance.Data.FriendCode);
|
||||
string color = access switch
|
||||
{
|
||||
Main.NormalOptions.EmergencyCooldown = 0;
|
||||
1 => "yellow",
|
||||
2 => "purple",
|
||||
3 => "red",
|
||||
_ => "white"
|
||||
};
|
||||
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
if (!LastColors.TryGetValue(__instance.PlayerId, out var lastColor) || lastColor != color || !__instance.cosmetics.nameText.text.Contains($"<color={color}>"))
|
||||
{
|
||||
__instance.cosmetics.nameText.text = $"<color={color}>{__instance.Data.PlayerName}</color>";
|
||||
LastColors[__instance.PlayerId] = color;
|
||||
}
|
||||
}
|
||||
|
||||
// SnS
|
||||
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 2.5f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 2.5f;
|
||||
if (settingsLabel == null) settingsLabel = GameObject.Find("GameSettingsLabel");
|
||||
|
||||
if (Options.SNSSettingsOverride.GetBool() && g == null)
|
||||
{
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
}
|
||||
int gamemode = Options.Gamemode.GetValue();
|
||||
|
||||
switch (gamemode)
|
||||
{
|
||||
case 1: // 0Kc
|
||||
if (Main.NormalOptions.KillCooldown != 0.01f)
|
||||
Main.NormalOptions.KillCooldown = 0.01f;
|
||||
|
||||
if (Options.NoKcdSettingsOverride.GetBool() && settingsLabel == null)
|
||||
{
|
||||
Main.NormalOptions.EmergencyCooldown = 0;
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // SnS
|
||||
if (Main.NormalOptions.KillCooldown != 2.5f)
|
||||
Main.NormalOptions.KillCooldown = 2.5f;
|
||||
|
||||
if (Options.SNSSettingsOverride.GetBool() && settingsLabel == null)
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
break;
|
||||
|
||||
case 3: // Speedrun
|
||||
if (settingsLabel == null)
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
break;
|
||||
|
||||
case 0: // Reset
|
||||
if (Main.NormalOptions.KillCooldown <= 0.01f)
|
||||
Main.NormalOptions.KillCooldown = 25f;
|
||||
break;
|
||||
}
|
||||
|
||||
// Speedrun
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek && g == null)
|
||||
{
|
||||
Main.NormalOptions.TaskBarMode = 0;
|
||||
|
||||
if (__instance.AllTasksCompleted() && Utils.InGame && Utils.GamePastRoleSelection && !Utils.HandlingGameEnd)
|
||||
{
|
||||
if (__instance == PlayerControl.LocalPlayer && Main.GM.Value) return;
|
||||
|
||||
Utils.CustomWinnerEndGame(__instance, 1);
|
||||
NormalGameEndChecker.LastWinReason = $"★ {__instance.Data.PlayerName} Wins! (Completed tasks first)";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() == 0 && Main.NormalOptions.KillCooldown <= 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 25f;
|
||||
}
|
||||
|
||||
if (__instance.Data.PlayerLevel != 0 && __instance.Data.PlayerLevel < Options.KickLowLevelPlayer.GetInt() && __instance.Data.ClientId != AmongUsClient.Instance.HostId)
|
||||
if (__instance.Data.PlayerLevel != 0 && __instance.Data.PlayerLevel < Options.KickLowLevelPlayer.GetInt() - 1 && __instance.Data.ClientId != AmongUsClient.Instance.HostId)
|
||||
{
|
||||
if (!Options.TempBanLowLevelPlayer.GetBool())
|
||||
{
|
||||
@@ -121,7 +129,7 @@ class FixedUpdateInGamePatch
|
||||
|
||||
Utils.ContinueEndGame((byte)GameOverReason.CrewmatesByVote);
|
||||
Logger.Info($" Crewmates won because the game took longer than {Options.CrewAutoWinsGameAfter.GetInt()}s", "SNSManager");
|
||||
NormalGameEndChecker.LastWinReason = $"★ Crewmates win! (Timer)\n\nImpostors:\n" + string.Join("\n", NormalGameEndChecker.imps.Select(p => p.Data.PlayerName));
|
||||
NormalGameEndChecker.LastWinReason = $"Crewmates win! (Timer)\n\nImpostors:\n" + string.Join("\n", NormalGameEndChecker.imps.Select(p => p.Data.PlayerName));
|
||||
}
|
||||
}
|
||||
// 3 = Speedrun
|
||||
@@ -133,7 +141,7 @@ class FixedUpdateInGamePatch
|
||||
|
||||
Utils.CustomWinnerEndGame(PlayerControl.LocalPlayer, 0);
|
||||
Logger.Info($" No one won because the game took longer than {Options.GameAutoEndsAfter.GetInt()}s", "SpeedrunManager");
|
||||
NormalGameEndChecker.LastWinReason = $"★ No one wins! (Timer)";
|
||||
NormalGameEndChecker.LastWinReason = $"No one wins! (Timer)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ internal class Hotkeys
|
||||
public static int IncrementMultiplier;
|
||||
public static void Postfix()
|
||||
{
|
||||
if (AmongUsClient.Instance == null || PlayerControl.LocalPlayer == null) return;
|
||||
|
||||
bool Shift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
|
||||
bool Ctrl = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
|
||||
bool Enter = Input.GetKeyDown(KeyCode.Return);
|
||||
|
||||
+18
-1
@@ -77,7 +77,7 @@ public static class Translator
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadLanguage(SupportedLangs lang)
|
||||
private static void LoadLanguage(SupportedLangs lang, bool reset = false)
|
||||
{
|
||||
string path = GetLanguagePath(lang);
|
||||
|
||||
@@ -121,6 +121,23 @@ public static class Translator
|
||||
|
||||
public static void Reload()
|
||||
{
|
||||
string path = GetLanguagePath(_currentLang);
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
string targetFile = $"{_currentLang}.json";
|
||||
|
||||
foreach (var name in assembly.GetManifestResourceNames())
|
||||
{
|
||||
if (name.EndsWith(targetFile, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
using var stream = assembly.GetManifestResourceStream(name);
|
||||
using var reader = new StreamReader(stream);
|
||||
string json = reader.ReadToEnd();
|
||||
|
||||
File.WriteAllText(path, json);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
LoadLanguage(_currentLang);
|
||||
}
|
||||
}
|
||||
+33
-8
@@ -47,13 +47,24 @@ public static class Utils
|
||||
public static string ColorToHex(Color32 color) => $"#{color.r:x2}{color.g:x2}{color.b:x2}{color.a:x2}";
|
||||
public static byte GetActiveMapId() => GameOptionsManager.Instance.CurrentGameOptions.MapId;
|
||||
|
||||
public static bool IsPlayerModerator(string friendCode)
|
||||
public static int CheckAccessLevel(string friendCode)
|
||||
{
|
||||
if (friendCode == "") return false;
|
||||
if (friendCode == "") return 0;
|
||||
|
||||
var friendCodesFilePath = @$"{BanManager.DataPath}/AUR-DATA/ModeratorList.txt";
|
||||
var friendCodes = File.ReadAllLines(friendCodesFilePath);
|
||||
return friendCodes.Any(code => code.Contains(friendCode));
|
||||
var vipFilePath = @$"{BanManager.DataPath}/AUR-DATA/VIP.txt";
|
||||
var vipFriendCodes = File.ReadAllLines(vipFilePath);
|
||||
|
||||
var moderatorFilePath = @$"{BanManager.DataPath}/AUR-DATA/Moderator.txt";
|
||||
var moderatorFriendCodes = File.ReadAllLines(moderatorFilePath);
|
||||
|
||||
var adminFilePath = @$"{BanManager.DataPath}/AUR-DATA/Admin.txt";
|
||||
var adminFriendCodes = File.ReadAllLines(adminFilePath);
|
||||
|
||||
if (adminFriendCodes.Any(code => code.Contains(friendCode))) return 3;
|
||||
if (moderatorFriendCodes.Any(code => code.Contains(friendCode))) return 2;
|
||||
if (vipFriendCodes.Any(code => code.Contains(friendCode))) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static string GetTabName(TabGroup tab)
|
||||
@@ -193,13 +204,22 @@ public static class Utils
|
||||
HandlingGameEnd = false;
|
||||
OnGameJoinedPatch.AutoStartCheck = false;
|
||||
Main.GameTimer = 0f;
|
||||
NormalGameEndChecker.canUpdateWinnerText = true;
|
||||
MurderPlayerPatch.misfireCount.Clear();
|
||||
LateTask.Tasks.Clear();
|
||||
FixedUpdateInGamePatch.ProcessedModerators.Clear();
|
||||
MurderPlayerPatch.killCount.Clear();
|
||||
|
||||
LateTask.Tasks.Clear();
|
||||
NormalGameEndChecker.ImpCheckComplete = false;
|
||||
CreateOptionsPickerPatch.SetDleks2 = false;
|
||||
CanCallMeetings = true;
|
||||
CustomRoleManagement.HandlingRoleMessages = false;
|
||||
PlayerControlSetRolePatch.FirstAssign = true;
|
||||
|
||||
PlayerControlCompleteTaskPatch.playerTasksCompleted.Clear();
|
||||
PlayerControlCompleteTaskPatch.tasksPerPlayer.Clear();
|
||||
PlayerControlCompleteTaskPatch.tasksInitiated = false;
|
||||
PlayerControlCompleteTaskPatch.ignoredCompletedTasks = 0;
|
||||
PlayerControlCompleteTaskPatch.ignoredTasks = 0;
|
||||
}
|
||||
|
||||
public static PlayerControl[] AllAlivePlayerControls
|
||||
@@ -453,7 +473,6 @@ public static class Utils
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
HandlingGameEnd = false;
|
||||
Logger.Info($"{gameOverReason}", "ContinueEndGame");
|
||||
Logger.Info(" -------- GAME ENDED --------", "ContinueEndGame");
|
||||
}
|
||||
|
||||
public static void DumpLog()
|
||||
@@ -516,4 +535,10 @@ public static class Utils
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SetChatVisible()
|
||||
{
|
||||
PlayerControl.LocalPlayer.CmdReportDeadBody(null);
|
||||
MeetingHud.Instance.RpcClose();
|
||||
}
|
||||
}
|
||||
+67
-19
@@ -91,8 +91,9 @@ internal static class SendChatPatch
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (text == "/reload" || text == "/translatereload" || text == "/reset" || text == "/translatereset")
|
||||
if (text == "/reload")
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{Translator.Get("translationReloaded")}");
|
||||
Translator.Reload();
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
@@ -106,8 +107,7 @@ internal static class SendChatPatch
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
if (text == "/h" || text == "/help")
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{Translator.Get("allCommandsFull")}");
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
@@ -115,6 +115,12 @@ internal static class SendChatPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/s" || text == "/start")
|
||||
{
|
||||
GameStartManager.Instance.BeginGame();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/eg" || text == "/endgame")
|
||||
{
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
@@ -145,20 +151,28 @@ internal static class SendChatPatch
|
||||
Utils.ChatCommand(__instance, $"{NormalGameEndChecker.LastWinReason}", "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/r jester"){
|
||||
Utils.ChatCommand(__instance, Translator.Get("jesterPublic"), "", false);
|
||||
return false;}
|
||||
|
||||
if (text == "/aur" || text == "/amongusrevamped" || text == "/socials" || text == "/github" || text == "/discord")
|
||||
if (text == "/r mayor"){
|
||||
Utils.ChatCommand(__instance, Translator.Get("mayorPublic", Options.MayorExtraVoteCount.GetInt()), "", false);
|
||||
return false;}
|
||||
|
||||
if (text == "/aur" || text == "/amongusrevamped" || text == "/socials")
|
||||
{
|
||||
Utils.ChatCommand(__instance, Translator.Get("socialsAll"), "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
|
||||
if (text == "/0kc" || text == "/0killcooldown")
|
||||
{
|
||||
Utils.ChatCommand(__instance, Translator.Get("noKcdMode"), "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
|
||||
if (text == "/sns" || text == "/shiftandseek")
|
||||
{
|
||||
Utils.ChatCommand(__instance, Translator.Get("SnSModeOne"), Translator.Get("SnSModeTwo", Options.CrewAutoWinsGameAfter.GetInt(), Options.CantKillTime.GetInt(), Options.MisfiresToSuicide.GetInt()), true);
|
||||
return false;
|
||||
@@ -303,7 +317,7 @@ public static class RPCHandlerPatch
|
||||
c = keywords.Any(k => text == k);
|
||||
}
|
||||
|
||||
if (c && !Utils.IsPlayerModerator(__instance.Data.FriendCode) && Options.AutoKickStart.GetBool() && !Utils.InGame)
|
||||
if (c && Utils.CheckAccessLevel(__instance.Data.FriendCode) < 1 && Options.AutoKickStart.GetBool() && !Utils.InGame)
|
||||
{
|
||||
int clientId = __instance.Data.ClientId;
|
||||
|
||||
@@ -320,6 +334,8 @@ public static class RPCHandlerPatch
|
||||
}
|
||||
}
|
||||
|
||||
BanManager.IsWordBanned(__instance, text);
|
||||
|
||||
bool col1 = text.StartsWith("/col ") || text.StartsWith("/cor ");
|
||||
bool col2 = text.StartsWith("/color ");
|
||||
bool col3 = text.StartsWith("/colour ");
|
||||
@@ -330,7 +346,7 @@ public static class RPCHandlerPatch
|
||||
|
||||
if (Utils.TryGetColorId(argCol, out byte colId))
|
||||
{
|
||||
if (Options.ColorCommandLevel.GetValue() == 0 && Utils.IsPlayerModerator(__instance.Data.FriendCode) || Options.ColorCommandLevel.GetValue() == 1)
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) >= Options.SlashColorCmd.GetValue())
|
||||
{
|
||||
if (colId > 17 && !Options.AllowFortegreen.GetBool()) return;
|
||||
__instance.RpcSetColor(colId);
|
||||
@@ -349,7 +365,7 @@ public static class RPCHandlerPatch
|
||||
|
||||
if (isKick || isBan || isColorKick || isColorBan)
|
||||
{
|
||||
if (Utils.IsPlayerModerator(__instance.Data.FriendCode))
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) >= Options.SlashKickCmd.GetValue())
|
||||
{
|
||||
string arg = text.Substring(isKick ? 6 : isBan ? 5 : isColorKick ? 7 : isColorBan ? 6 : 0).Trim();
|
||||
|
||||
@@ -357,7 +373,7 @@ public static class RPCHandlerPatch
|
||||
|
||||
foreach (PlayerControl p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data == null || p == PlayerControl.LocalPlayer || Utils.IsPlayerModerator(p.Data.FriendCode)) continue;
|
||||
if (p.Data == null || p == PlayerControl.LocalPlayer || Utils.CheckAccessLevel(p.Data.FriendCode) >= 1) continue;
|
||||
|
||||
if ((isKick || isBan) && p.Data.PlayerName.Equals(arg, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -374,6 +390,7 @@ public static class RPCHandlerPatch
|
||||
}
|
||||
}
|
||||
}
|
||||
if (banLog && Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashBanCmd.GetValue()) return;
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
@@ -385,9 +402,9 @@ public static class RPCHandlerPatch
|
||||
|
||||
if (CustomRoleManagement.HandlingRoleMessages || OnGameJoinedPatch.WaitingForChat) return;
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
if (text == "/h" || text == "/help")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashHelpAndAurCmd.GetValue()) return;
|
||||
OnGameJoinedPatch.WaitingForChat = true;
|
||||
|
||||
new LateTask(() =>
|
||||
@@ -406,36 +423,60 @@ public static class RPCHandlerPatch
|
||||
}, 6.6f, "MHP3");
|
||||
}
|
||||
|
||||
if (text == "/eg" || text == "/endgame")
|
||||
{
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashStartAndEndGameCmd.GetValue()) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write((byte)GameOverReason.ImpostorDisconnect);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
}
|
||||
|
||||
if (text == "/em" || text == "/endmeeting")
|
||||
{
|
||||
if (Utils.IsMeeting)
|
||||
{
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashEndMeetingCmd.GetValue()) return;
|
||||
MeetingHud.Instance.RpcClose();
|
||||
}
|
||||
}
|
||||
|
||||
if (text == "/s" || text == "/start")
|
||||
{
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashStartAndEndGameCmd.GetValue()) return;
|
||||
GameStartManager.Instance.BeginGame();
|
||||
}
|
||||
|
||||
if (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashLastGameCmd.GetValue()) return;
|
||||
if (string.IsNullOrEmpty(NormalGameEndChecker.LastWinReason) || Utils.InGame) return;
|
||||
Utils.ModeratorChatCommand($"{NormalGameEndChecker.LastWinReason}", "", false);
|
||||
}
|
||||
|
||||
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
|
||||
if (text == "/0kc" || text == "/0killcooldown")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashRolesAndGamemodeCmd.GetValue()) return;
|
||||
Utils.ModeratorChatCommand(Translator.Get("noKcdMode"), "", false);
|
||||
}
|
||||
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
|
||||
if (text == "/sns" || text == "/shiftandseek")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashRolesAndGamemodeCmd.GetValue()) return;
|
||||
Utils.ModeratorChatCommand(Translator.Get("SnSModeOne"), Translator.Get("SnSModeTwo", Options.CrewAutoWinsGameAfter.GetInt(), Options.CantKillTime.GetInt(), Options.MisfiresToSuicide.GetInt()), true);
|
||||
}
|
||||
|
||||
if (text == "/sp" || text == "/sr" || text == "/speedrun")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashRolesAndGamemodeCmd.GetValue()) return;
|
||||
Utils.ModeratorChatCommand(Translator.Get("speedrunMode", Options.GameAutoEndsAfter.GetInt()), "", false);
|
||||
}
|
||||
|
||||
if (text == "/r" || text == "/roles" || text == "/gamemode" || text == "/gm")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
if (Utils.CheckAccessLevel(__instance.Data.FriendCode) < Options.SlashRolesAndGamemodeCmd.GetValue()) return;
|
||||
switch (Options.Gamemode.GetValue())
|
||||
{
|
||||
case 0:
|
||||
Utils.ModeratorChatCommand($"Enabled Custom Roles:\n\n{CustomRoleManagement.GetActiveRoles()}", "", false);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -452,6 +493,13 @@ public static class RPCHandlerPatch
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (text == "/r jester"){
|
||||
Utils.ModeratorChatCommand(Translator.Get("jesterPublic"), "", false);}
|
||||
|
||||
if (text == "/r mayor"){
|
||||
Utils.ModeratorChatCommand(Translator.Get("mayorPublic", Options.MayorExtraVoteCount.GetInt()), "", false);}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,18 +22,18 @@ namespace AmongUsRevamped
|
||||
|
||||
if (GM == null || GM.ToggleButton == null)
|
||||
{
|
||||
GM = ClientOptionItem.Create("Game Master", Main.GM, __instance, GMButtonToggle);
|
||||
GM = ClientOptionItem.Create(Translator.Get("gameMaster"), Main.GM, __instance, GMButtonToggle);
|
||||
|
||||
static void GMButtonToggle()
|
||||
{
|
||||
if (Main.GM.Value)
|
||||
HudManager.Instance.ShowPopUp("You will now spectate games until GM is turned off.");
|
||||
HudManager.Instance.ShowPopUp(Translator.Get("gameMasterWarning"));
|
||||
}
|
||||
}
|
||||
|
||||
if (UnlockFPS == null || UnlockFPS.ToggleButton == null)
|
||||
{
|
||||
UnlockFPS = ClientOptionItem.Create("Unlock FPS", Main.UnlockFps, __instance, UnlockFPSButtonToggle);
|
||||
UnlockFPS = ClientOptionItem.Create(Translator.Get("unlockFPS"), Main.UnlockFps, __instance, UnlockFPSButtonToggle);
|
||||
|
||||
static void UnlockFPSButtonToggle()
|
||||
{
|
||||
@@ -43,11 +43,11 @@ namespace AmongUsRevamped
|
||||
}
|
||||
|
||||
if (ShowFPS == null || ShowFPS.ToggleButton == null)
|
||||
ShowFPS = ClientOptionItem.Create("Show FPS", Main.ShowFps, __instance);
|
||||
ShowFPS = ClientOptionItem.Create(Translator.Get("showFPS"), Main.ShowFps, __instance);
|
||||
|
||||
if (AutoStart == null || AutoStart.ToggleButton == null)
|
||||
{
|
||||
AutoStart = ClientOptionItem.Create("Auto Start", Main.AutoStart, __instance, AutoStartButtonToggle);
|
||||
AutoStart = ClientOptionItem.Create(Translator.Get("autoStart"), Main.AutoStart, __instance, AutoStartButtonToggle);
|
||||
|
||||
static void AutoStartButtonToggle()
|
||||
{
|
||||
@@ -55,16 +55,16 @@ namespace AmongUsRevamped
|
||||
GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown)
|
||||
{
|
||||
GameStartManager.Instance.ResetStartState();
|
||||
Logger.SendInGame("CancelStartCountDown");
|
||||
Logger.SendInGame(Translator.Get("CancelStartCountDown"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (DarkTheme == null || DarkTheme.ToggleButton == null)
|
||||
DarkTheme = ClientOptionItem.Create("Enable Dark Theme", Main.DarkTheme, __instance);
|
||||
DarkTheme = ClientOptionItem.Create(Translator.Get("enableDarkTheme"), Main.DarkTheme, __instance);
|
||||
|
||||
if (LobbyMusic == null || LobbyMusic.ToggleButton == null)
|
||||
LobbyMusic = ClientOptionItem.Create("Lobby Music", Main.LobbyMusic, __instance);
|
||||
LobbyMusic = ClientOptionItem.Create(Translator.Get("enableLobbyMusic"), Main.LobbyMusic, __instance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace AmongUsRevamped
|
||||
{
|
||||
public static void Postfix(HudManager __instance)
|
||||
{
|
||||
if (Main.GM.Value)
|
||||
if (Main.GM.Value && AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
__instance.Chat.gameObject.SetActive(true);
|
||||
__instance.MapButton.gameObject.SetActive(true);
|
||||
|
||||
+12
-1
@@ -22,6 +22,7 @@ class CreateOptionsPickerPatch
|
||||
{
|
||||
public static bool SetDleks = false;
|
||||
public static bool SetDleks2;
|
||||
private static bool InitiatedDleks;
|
||||
private static MapSelectButton DleksButton;
|
||||
[HarmonyPatch]
|
||||
public static class GameOptionsMapPickerPatch
|
||||
@@ -30,7 +31,17 @@ class CreateOptionsPickerPatch
|
||||
[HarmonyPostfix]
|
||||
public static void Postfix_Initialize(CreateGameMapPicker __instance)
|
||||
{
|
||||
float delay = SceneManager.GetActiveScene().name == "MainMenu" ? 0.2f : 0f;
|
||||
float delay;
|
||||
if (SceneManager.GetActiveScene().name == "MainMenu" && InitiatedDleks)
|
||||
{
|
||||
delay = 0.2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = 0f;
|
||||
InitiatedDleks = true;
|
||||
}
|
||||
|
||||
if (SceneManager.GetActiveScene().name == "FindAGame") return;
|
||||
|
||||
new LateTask(() =>
|
||||
|
||||
@@ -39,26 +39,44 @@ class NormalGameEndChecker
|
||||
ImpCheckComplete = true;
|
||||
}
|
||||
|
||||
var customRoles = CustomRoleManagement.PlayerToCustomRole();
|
||||
var impostorList = string.Join(", ", imps.Select(p => p.Data.PlayerName));
|
||||
CheckWinnerText("");
|
||||
|
||||
if (Utils.AliveImpostors == 0)
|
||||
return true;
|
||||
}
|
||||
public static bool canUpdateWinnerText;
|
||||
public static string customRoles { get; set; }
|
||||
public static void CheckWinnerText(string Winner)
|
||||
{
|
||||
var impostorList = string.Join(", ", imps.Select(p => p.Data.PlayerName));
|
||||
|
||||
if (!canUpdateWinnerText) return;
|
||||
|
||||
if (Winner == "Jester")
|
||||
{
|
||||
LastWinReason = $"Jester wins! (Voted)\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
canUpdateWinnerText = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utils.AliveImpostors == 0 || Winner == "Crewmate")
|
||||
{
|
||||
LastWinReason = $"Crewmates win!\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
canUpdateWinnerText = false;
|
||||
}
|
||||
else if (Utils.AliveImpostors >= Utils.AliveCrewmates)
|
||||
else if (Utils.AliveImpostors >= Utils.AliveCrewmates || Winner == "Impostor")
|
||||
{
|
||||
LastWinReason = $"Impostors win!\n\nImpostor: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
canUpdateWinnerText = false;
|
||||
}
|
||||
else if (GameData.Instance != null && GameData.Instance.TotalTasks > 0 && GameData.Instance.CompletedTasks >= GameData.Instance.TotalTasks)
|
||||
else if (GameData.Instance != null && GameData.Instance.TotalTasks > 0 && GameData.Instance.CompletedTasks >= GameData.Instance.TotalTasks || Winner == "CrewmateTasks")
|
||||
{
|
||||
LastWinReason = $"Crewmates win! (Tasks)\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
LastWinReason = $"Crewmates win! ({Options.TaskPercentNeededToWin.GetInt()}% Tasks)\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
canUpdateWinnerText = false;
|
||||
}
|
||||
else if (Options.Gamemode.GetValue() < 2)
|
||||
else if (Options.Gamemode.GetValue() < 2 || Winner == "ImpostorSabotage")
|
||||
{
|
||||
LastWinReason = $"Impostors win! (Sabotage)\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+58
-5
@@ -6,10 +6,14 @@ class ExileControllerWrapUpPatch
|
||||
class ExileControllerPatch
|
||||
{
|
||||
public static void Postfix(ExileController __instance)
|
||||
{
|
||||
AfterExile(__instance.initData.networkedPlayer);
|
||||
}
|
||||
|
||||
public static void AfterExile(NetworkedPlayerInfo ejectedPlayer)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
var ejectedPlayer = __instance.initData?.networkedPlayer;
|
||||
if (ejectedPlayer == null) return;
|
||||
|
||||
PlayerControl pc = null;
|
||||
@@ -18,18 +22,67 @@ class ExileControllerWrapUpPatch
|
||||
if (p.PlayerId == ejectedPlayer.PlayerId)
|
||||
{
|
||||
pc = p;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ejectedPlayer == PlayerControl.LocalPlayer.Data)
|
||||
{
|
||||
if (p.Data.Role.IsImpostor)
|
||||
{
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=red><size=90%>({MurderPlayerPatch.killCount[p.Data.PlayerId]}†)";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!PlayerControlCompleteTaskPatch.playerTasksCompleted.ContainsKey(p))
|
||||
{
|
||||
PlayerControlCompleteTaskPatch.playerTasksCompleted[p] = 0;
|
||||
}
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=green><size=90%>({PlayerControlCompleteTaskPatch.playerTasksCompleted[p]}/{PlayerControlCompleteTaskPatch.tasksPerPlayer[p]})";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Info($" {ejectedPlayer.PlayerName} was ejected", "ExileController");
|
||||
|
||||
if (!CustomRoleManagement.PlayerRoles.TryGetValue(ejectedPlayer.PlayerId, out var role)) return;
|
||||
|
||||
if (role == "Jester")
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(ejectedPlayer.PlayerId, out var role) && role == "Jester")
|
||||
{
|
||||
Utils.CustomWinnerEndGame(pc, 1);
|
||||
NormalGameEndChecker.CheckWinnerText("Jester");
|
||||
return;
|
||||
}
|
||||
|
||||
if (CustomRoleManagement.HandlingRoleMessages)
|
||||
{
|
||||
Logger.Info(" SRM2 is called before SRM1 finished. This should not happen.", "ExileController");
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomRoleManagement.SendRoleMessages(new Dictionary<string, string>
|
||||
{
|
||||
{ "Jester", Translator.Get("jesterPriv")},
|
||||
{ "Mayor", Translator.Get("mayorPriv", Options.MayorExtraVoteCount.GetInt())},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ANDROID
|
||||
[HarmonyPatch(typeof(AirshipExileController), nameof(AirshipExileController.WrapUpAndSpawn))]
|
||||
class AirshipExileControllerPatchAndroid
|
||||
{
|
||||
public static void Postfix(AirshipExileController __instance)
|
||||
{
|
||||
ExileControllerPatch.AfterExile(__instance.initData.networkedPlayer);
|
||||
}
|
||||
}
|
||||
#else
|
||||
[HarmonyPatch(typeof(AirshipExileController._WrapUpAndSpawn_d__11), nameof(AirshipExileController._WrapUpAndSpawn_d__11.MoveNext))]
|
||||
class AirshipExileControllerPatchPC
|
||||
{
|
||||
public static void Postfix(AirshipExileController._WrapUpAndSpawn_d__11 __instance, ref bool __result)
|
||||
{
|
||||
var instance = __instance.__4__this;
|
||||
ExileControllerPatch.AfterExile(instance.initData.networkedPlayer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+33
-10
@@ -15,24 +15,47 @@ internal static class CoShowIntroPatch
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if ((Options.Gamemode.GetValue() == 0 || Options.Gamemode.GetValue() == 1) && !Utils.isHideNSeek)
|
||||
NormalGameEndChecker.customRoles = CustomRoleManagement.PlayerToCustomRole();
|
||||
|
||||
if (CustomRoleManagement.PlayerRoles.Count != 0 && !Utils.isHideNSeek && Options.Gamemode.GetValue() < 2)
|
||||
{
|
||||
CustomRoleManagement.AssignRoles();
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
CustomRoleManagement.SendRoleMessages(new Dictionary<string, string>
|
||||
{
|
||||
{ "Jester", Translator.Get("jesterPriv")},
|
||||
{ "Mayor", Translator.Get("mayorPriv", Options.MayorExtraVoteCount.GetInt())},
|
||||
});
|
||||
}, 1f, "BlockACKick");
|
||||
}
|
||||
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
p.cosmetics.nameText.text = p.Data.PlayerName;
|
||||
|
||||
MurderPlayerPatch.killCount[p.Data.PlayerId] = 0;
|
||||
MurderPlayerPatch.misfireCount[p.Data.PlayerId] = 0;
|
||||
PlayerControlCompleteTaskPatch.playerTasksCompleted[p] = 0;
|
||||
PlayerControlCompleteTaskPatch.tasksPerPlayer[p] = 0;
|
||||
}
|
||||
|
||||
CustomRoleManagement.SendRoleMessages(new Dictionary<string, string>
|
||||
{
|
||||
{ "Jester", Translator.Get("JesterPriv")},
|
||||
{ "Mayor", Translator.Get("MayorPriv")}
|
||||
});
|
||||
|
||||
if (Options.DisableAnnoyingMeetingCalls.GetBool())
|
||||
if (Options.DisableAnnoyingMeetingCalls.GetBool() && !Utils.isHideNSeek)
|
||||
{
|
||||
Utils.CanCallMeetings = false;
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
Utils.CanCallMeetings = true;
|
||||
}, 33f, "MeetingEnabled");
|
||||
}, Options.ChatBeforeFirstMeeting.GetBool() ? 39.5f : 33f, "MeetingEnabled");
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() == 2 && Options.SNSChatInGame.GetBool() || Options.Gamemode.GetValue() == 0 && Options.ChatBeforeFirstMeeting.GetBool())
|
||||
{
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
PlayerControl.LocalPlayer.CmdReportDeadBody(null);
|
||||
if (MeetingHud.Instance != null) MeetingHud.Instance.RpcClose();
|
||||
|
||||
}, 9f, "SetChatVisible");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,13 +79,8 @@ class OnPlayerJoinedPatch
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
BanManager.CheckBanPlayer(Client);
|
||||
|
||||
BanManager.IsPlayerInDenyName(Client, Client.PlayerName);
|
||||
|
||||
if (Utils.IsPlayerModerator(Client.FriendCode) && Options.ApplyModeratorList.GetBool())
|
||||
{
|
||||
Logger.Info($" {Client.PlayerName} is moderator", "ModeratorCheck");
|
||||
}
|
||||
Logger.Info($" {Client.PlayerName} has access level {Utils.CheckAccessLevel(Client.FriendCode)}", "AccessCheck");
|
||||
|
||||
if (HasInvalidFriendCode(Client.FriendCode) && Options.KickInvalidFriendCodes.GetBool())
|
||||
{
|
||||
@@ -109,9 +104,11 @@ class OnPlayerJoinedPatch
|
||||
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnPlayerLeft))]
|
||||
class OnPlayerLeftPatch
|
||||
{
|
||||
static void Prefix([HarmonyArgument(0)] ClientData client)
|
||||
static void Postfix([HarmonyArgument(0)] ClientData client)
|
||||
{
|
||||
if (client?.Character == null) return;
|
||||
FixedUpdateInGamePatch.ProcessedModerators.Remove(client.Character.PlayerId);
|
||||
if (!AmongUsClient.Instance.AmHost || !Utils.InGame) return;
|
||||
{
|
||||
PlayerControlCompleteTaskPatch.CalculateTaskWin();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.CheckForEndVoting))]
|
||||
public static class CheckForEndVotingPatch
|
||||
{
|
||||
public static bool Prefix(MeetingHud __instance)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (!__instance.playerStates.All(ps => ps.AmDead || ps.DidVote)) return true;
|
||||
|
||||
var votes = __instance.CalculateVotes();
|
||||
var visualVotes = new List<MeetingHud.VoterState>();
|
||||
|
||||
foreach (var ps in __instance.playerStates)
|
||||
{
|
||||
if (ps == null) continue;
|
||||
|
||||
byte voterId = ps.TargetPlayerId;
|
||||
byte votedFor = ps.VotedFor;
|
||||
if (votedFor == byte.MaxValue) continue;
|
||||
|
||||
visualVotes.Add(new MeetingHud.VoterState { VoterId = voterId, VotedForId = votedFor });
|
||||
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(voterId, out string role) && role == "Mayor")
|
||||
{
|
||||
int extraVotes = Options.MayorExtraVoteCount.GetInt();
|
||||
if (!votes.TryGetValue(votedFor, out int currentVotes)) currentVotes = 0;
|
||||
votes[votedFor] = currentVotes + extraVotes;
|
||||
|
||||
for (int i = 0; i < extraVotes; i++)
|
||||
visualVotes.Add(new MeetingHud.VoterState { VoterId = voterId, VotedForId = votedFor });
|
||||
}
|
||||
}
|
||||
|
||||
var max = votes.MaxPair(out var tie);
|
||||
var exiled = GameData.Instance.AllPlayers.ToArray().FirstOrDefault(p => !tie && p.PlayerId == max.Key);
|
||||
var statesArray = visualVotes.ToArray();
|
||||
|
||||
__instance.RpcVotingComplete(statesArray, exiled, tie);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
|
||||
class MeetingHudStartPatch
|
||||
{
|
||||
public static void Postfix(MeetingHud __instance)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
foreach (var playerState in __instance.playerStates)
|
||||
{
|
||||
PlayerControl player = null;
|
||||
foreach (var pc in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (pc.PlayerId == playerState.TargetPlayerId)
|
||||
{
|
||||
player = pc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (player == null || !PlayerControl.LocalPlayer.Data.IsDead) continue;
|
||||
|
||||
var textTemplate = playerState.NameText;
|
||||
var taskText = GetProgressText(player);
|
||||
|
||||
var taskTextMeeting = UnityEngine.Object.Instantiate(textTemplate);
|
||||
taskTextMeeting.transform.SetParent(textTemplate.transform);
|
||||
taskTextMeeting.transform.localPosition = new Vector3(0f, 0.18f, 0f);
|
||||
taskTextMeeting.fontSize = 1.6f;
|
||||
taskTextMeeting.text = taskText;
|
||||
taskTextMeeting.gameObject.name = "TaskTextMeeting";
|
||||
taskTextMeeting.enableWordWrapping = false;
|
||||
taskTextMeeting.enabled = player.AmOwner || player.PlayerId == playerState.TargetPlayerId;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetProgressText(PlayerControl player)
|
||||
{
|
||||
int totalTasks = 0;
|
||||
int tasksCompleted = 0;
|
||||
|
||||
if (player.Data.Tasks != null && !player.Data.Role.IsImpostor)
|
||||
{
|
||||
foreach (var task in player.Data.Tasks)
|
||||
{
|
||||
totalTasks++;
|
||||
if (task.Complete) tasksCompleted++;
|
||||
}
|
||||
return $"<color=green>({tasksCompleted}/{totalTasks})</color>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"<color=red>({MurderPlayerPatch.killCount[player.Data.PlayerId]}†)</color>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public static class NumberOption_Increase
|
||||
float increment = Hotkeys.IncrementMultiplier * __instance.Increment;
|
||||
#endif
|
||||
|
||||
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
if (Utils.IsLobby)
|
||||
{
|
||||
if (__instance.Value <= __instance.ValidRange.min)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ public static class NumberOption_Decrease
|
||||
float increment = Hotkeys.IncrementMultiplier * __instance.Increment;
|
||||
#endif
|
||||
|
||||
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
if (Utils.IsLobby)
|
||||
{
|
||||
if (__instance.Value >= __instance.ValidRange.max)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,12 @@ internal class CoStartGamePatch
|
||||
|
||||
Logger.Info(" -------- GAME STARTED --------", "StartGame");
|
||||
Logger.Info($" Gamemode: {Options.Gamemode.GetValue()}", "StartGame");
|
||||
Logger.Info($" Players: {PlayerControl.AllPlayerControls.Count}", "StartGame");
|
||||
|
||||
if ((Options.Gamemode.GetValue() == 0 || Options.Gamemode.GetValue() == 1) && !Utils.isHideNSeek)
|
||||
{
|
||||
CustomRoleManagement.AssignRoles();
|
||||
}
|
||||
NormalGameEndChecker.imps.Clear();
|
||||
NormalGameEndChecker.LastWinReason = "";
|
||||
|
||||
@@ -38,6 +43,32 @@ class PlayerControlSetRolePatch
|
||||
if (Main.GM.Value && __instance == PlayerControl.LocalPlayer)
|
||||
{
|
||||
roleType = RoleTypes.CrewmateGhost;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var role) && role == "Mayor" && Options.Gamemode.GetValue() < 2)
|
||||
{
|
||||
if (Options.MayorVentToMeeting.GetBool())
|
||||
{
|
||||
roleType = RoleTypes.Engineer;
|
||||
Logger.Info($"{__instance.Data.PlayerName} is Engineer due to being Mayor", "SetRolePatch");
|
||||
}
|
||||
else
|
||||
{
|
||||
roleType = RoleTypes.Crewmate;
|
||||
}
|
||||
}
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(__instance.PlayerId, out var r) && r == "Jester" && Options.Gamemode.GetValue() < 2)
|
||||
{
|
||||
if (Options.JesterCanVent.GetBool())
|
||||
{
|
||||
roleType = RoleTypes.Engineer;
|
||||
Logger.Info($"{__instance.Data.PlayerName} is Engineer due to being Jester", "SetRolePatch");
|
||||
}
|
||||
else
|
||||
{
|
||||
roleType = RoleTypes.Crewmate;
|
||||
}
|
||||
}
|
||||
|
||||
if (Utils.isHideNSeek && i == 0)
|
||||
@@ -47,7 +78,7 @@ class PlayerControlSetRolePatch
|
||||
var candidates = new List<PlayerControl>();
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (Main.GM.Value && p != PlayerControl.LocalPlayer) candidates.Add(p);
|
||||
if (!Main.GM.Value || p != PlayerControl.LocalPlayer) candidates.Add(p);
|
||||
}
|
||||
|
||||
seekersCount = Math.Min(seekersCount, candidates.Count);
|
||||
@@ -67,7 +98,7 @@ class PlayerControlSetRolePatch
|
||||
if (Utils.isHideNSeek)
|
||||
{
|
||||
if (Seekers.Contains(__instance.PlayerId)) roleType = RoleTypes.Impostor;
|
||||
else roleType = RoleTypes.Crewmate;
|
||||
else roleType = RoleTypes.Engineer;
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() == 3 && !Utils.isHideNSeek)
|
||||
@@ -86,7 +117,7 @@ class PlayerControlSetRolePatch
|
||||
Seekers.Clear();
|
||||
FirstAssign = false;
|
||||
i = 0;
|
||||
Logger.Info("PCSRP successful", ".");
|
||||
Logger.Info("PCSRP successful", "RoleManaging");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -3,7 +3,9 @@ using AmongUs.GameOptions;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
@@ -14,18 +16,19 @@ class ReportDeadBodyPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || __instance == null) return true;
|
||||
|
||||
if (Options.DisableAnnoyingMeetingCalls.GetBool() && !Utils.CanCallMeetings && target == null)
|
||||
if (Options.DisableAnnoyingMeetingCalls.GetBool() && !Utils.CanCallMeetings && !Options.ChatBeforeFirstMeeting.GetBool() && target == null)
|
||||
{
|
||||
Logger.Info($" {__instance.Data.PlayerName} is calling a meeting too fast, attempt blocked", "ReportDeadBodyPatch");
|
||||
return false;
|
||||
}
|
||||
|
||||
// target == null means meeting
|
||||
if (target == null) return true;
|
||||
|
||||
if (Options.DisableReport.GetBool() || Options.Gamemode.GetValue() == 2 || Options.Gamemode.GetValue() == 3)
|
||||
if (Options.Gamemode.GetValue() == 2 || Options.Gamemode.GetValue() == 3)
|
||||
{
|
||||
Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch");
|
||||
if (target != null) Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch");
|
||||
else Logger.Info($" Stopped {__instance.Data.PlayerName} trying to call a meeting", "ReportDeadBodyPatch");
|
||||
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
@@ -36,10 +39,39 @@ class ReportDeadBodyPatch
|
||||
internal static class MurderPlayerPatch
|
||||
{
|
||||
public static readonly Dictionary<byte, int> misfireCount = new();
|
||||
public static readonly Dictionary<byte, int> killCount = new();
|
||||
|
||||
public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target, [HarmonyArgument(1)] MurderResultFlags resultFlags, ref bool __state)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
if (!AmongUsClient.Instance.AmHost || !resultFlags.HasFlag(MurderResultFlags.Succeeded)) return;
|
||||
|
||||
byte playerId = __instance.Data.PlayerId;
|
||||
|
||||
if (!killCount.ContainsKey(playerId))
|
||||
{
|
||||
killCount[playerId] = 0;
|
||||
}
|
||||
|
||||
if (!__instance.isNew)
|
||||
{
|
||||
killCount[playerId]++;
|
||||
Logger.Info($" {__instance.Data.PlayerName} killed {target.Data.PlayerName}", "MurderPlayer");
|
||||
|
||||
if (target == PlayerControl.LocalPlayer || PlayerControl.LocalPlayer.Data.IsDead)
|
||||
{
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data.Role.IsImpostor)
|
||||
{
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=red><size=90%>({killCount[p.Data.PlayerId]}†)";
|
||||
}
|
||||
else
|
||||
{
|
||||
p.cosmetics.nameText.text = $"{p.Data.PlayerName}<color=green><size=90%>({PlayerControlCompleteTaskPatch.playerTasksCompleted[p]}/{PlayerControlCompleteTaskPatch.tasksPerPlayer[p]})";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//2 = Shift and Seek
|
||||
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek)
|
||||
@@ -47,8 +79,6 @@ internal static class MurderPlayerPatch
|
||||
if (!resultFlags.HasFlag(MurderResultFlags.Succeeded))
|
||||
return;
|
||||
|
||||
byte playerId = __instance.Data.PlayerId;
|
||||
|
||||
if (target.Data.PlayerId == __instance.shapeshiftTargetPlayerId)
|
||||
{
|
||||
Logger.Info($" {__instance.Data.PlayerName} correctly killed {target.Data.PlayerName} ", "SNSKillManager");
|
||||
@@ -77,8 +107,8 @@ internal static class MurderPlayerPatch
|
||||
if (misfireCount[__instance.Data.PlayerId] >= Options.MisfiresToSuicide.GetFloat())
|
||||
{
|
||||
__instance.RpcSetRole(RoleTypes.ImpostorGhost);
|
||||
Logger.Info($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} times and suicided", "SNSKillManager");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} times and suicided");
|
||||
Logger.Info($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} time(s) and suicided", "SNSKillManager");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} time(s) and suicided");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,3 +134,86 @@ internal static class CheckShapeshiftPatch
|
||||
else return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CompleteTask))]
|
||||
class PlayerControlCompleteTaskPatch
|
||||
{
|
||||
public static Dictionary<PlayerControl, int> playerTasksCompleted = new Dictionary<PlayerControl, int>();
|
||||
public static Dictionary<PlayerControl, int> tasksPerPlayer = new Dictionary<PlayerControl, int>();
|
||||
public static List<string> ignoredRoles = new List<string> {"Jester"};
|
||||
public static int ignoredTasks;
|
||||
public static int ignoredCompletedTasks;
|
||||
public static bool tasksInitiated;
|
||||
|
||||
public static void Postfix(PlayerControl __instance, uint idx)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (ignoredRoles.Contains(CustomRoleManagement.GetRole(p.PlayerId)) && !tasksInitiated)
|
||||
{
|
||||
ignoredTasks += p.Data.Tasks.Count;
|
||||
tasksInitiated = true;
|
||||
}
|
||||
|
||||
if (!playerTasksCompleted.ContainsKey(p))
|
||||
{
|
||||
playerTasksCompleted[p] = 0;
|
||||
}
|
||||
tasksPerPlayer[p] = p.Data.Tasks.Count;
|
||||
}
|
||||
|
||||
playerTasksCompleted[__instance]++;
|
||||
|
||||
if (ignoredRoles.Contains(CustomRoleManagement.GetRole(__instance.PlayerId)))
|
||||
{
|
||||
ignoredCompletedTasks = playerTasksCompleted[__instance];
|
||||
}
|
||||
|
||||
Logger.Info($" {__instance.Data.PlayerName} completed {idx}", "TaskPatch");
|
||||
|
||||
if (Options.Gamemode.GetValue() != 3) CalculateTaskWin();
|
||||
|
||||
if (Options.Gamemode.GetValue() == 3)
|
||||
{
|
||||
if (!__instance.Data.IsDead && playerTasksCompleted[__instance] >= __instance.Data.Tasks.Count)
|
||||
{
|
||||
Utils.CustomWinnerEndGame(__instance, 1);
|
||||
NormalGameEndChecker.LastWinReason = $"{__instance.Data.PlayerName} wins! (Completed tasks)";
|
||||
NormalGameEndChecker.canUpdateWinnerText = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.Data.IsDead)
|
||||
{
|
||||
TMP_Text nameText = __instance.cosmetics.nameText;
|
||||
nameText.text = $"{__instance.Data.PlayerName}<color=green><size=90%>({playerTasksCompleted[__instance]}/{tasksPerPlayer[__instance]})</color>";
|
||||
}
|
||||
}
|
||||
|
||||
public static void CalculateTaskWin()
|
||||
{
|
||||
if (!Utils.GamePastRoleSelection || Utils.isHideNSeek || Options.NoGameEnd.GetBool()) return;
|
||||
|
||||
//Logger.Info($" Checking if {GameData.Instance.CompletedTasks} - {ignoredCompletedTasks} >= ({GameData.Instance.TotalTasks} - {ignoredTasks}) * 0.01 * {Options.TaskPercentNeededToWin.GetInt()}", "TaskPatch");
|
||||
|
||||
if ((GameData.Instance.CompletedTasks - ignoredCompletedTasks) >= (GameData.Instance.TotalTasks - ignoredTasks)*0.01*Options.TaskPercentNeededToWin.GetInt())
|
||||
{
|
||||
Utils.ContinueEndGame((byte)GameOverReason.CrewmatesByVote);
|
||||
NormalGameEndChecker.CheckWinnerText("CrewmateTasks");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CheckSporeTrigger))]
|
||||
public static class PlayerControlCheckSporeTriggerPatch
|
||||
{
|
||||
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] Mushroom mushroom)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (Options.DisableSporeTrigger.GetBool()) return false;
|
||||
else return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(Vent), nameof(Vent.EnterVent))]
|
||||
class EnterVentPatch
|
||||
{
|
||||
public static void Postfix(Vent __instance, [HarmonyArgument(0)] PlayerControl pc)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (CustomRoleManagement.PlayerRoles.TryGetValue(pc.PlayerId, out var role) && role == "Mayor")
|
||||
{
|
||||
pc.CmdReportDeadBody(null);
|
||||
Logger.Info($" The Mayor, {pc.Data.PlayerName}, called a meeting by venting", "EnterVent");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,6 @@ internal static class AddVotePatch
|
||||
|
||||
if (AmongUsClient.Instance.ClientId == srcClient)
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(target.Data.ClientId, false);
|
||||
|
||||
Logger.Info($" Kicked {target.Data.PlayerName}, {target.Data.FriendCode}", "KickPatch");
|
||||
}
|
||||
return true;
|
||||
@@ -48,6 +46,16 @@ internal static class BanMenuSetVisiblePatch
|
||||
__instance.KickButton.gameObject.SetActive(true);
|
||||
__instance.MenuButton.gameObject.SetActive(show);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.CanBan))]
|
||||
internal class InnerNetClientCanBanPatch
|
||||
{
|
||||
public static bool Prefix(InnerNetClient __instance, ref bool __result)
|
||||
{
|
||||
__result = __instance.AmHost;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
# Welcome to AmongUsRevamped!
|
||||
# Welcome to Among Us Revamped!
|
||||
<br>
|
||||
|
||||
</p>
|
||||
@@ -29,7 +29,12 @@
|
||||
<img src="https://github.com/astra1dev/AUnlocker/assets/90265231/14226f03-a003-4efc-b27b-6df53fb394d6" width=410 height=240>****
|
||||
|
||||
|
||||
# 🎮 Features (v1.6.0):
|
||||
# 🎮 Features (v1.7.0):
|
||||
## <b> 🌟 Custom Roles:</b>
|
||||
- Mayor (Crewmate)
|
||||
- The mayor has extra votes and can call meetings by venting, depending on settings.
|
||||
- Jester (Neutral)
|
||||
- The jester has to get voted to win alone and does not win with any other team.
|
||||
## <b>♠️ Client Side settings:</b>
|
||||
- Game Master
|
||||
- Unlock FPS
|
||||
@@ -40,14 +45,16 @@
|
||||
## <b>⚙️ Technical settings:</b>
|
||||
- Kick/Ban players under a certain level
|
||||
- Kick/Ban invalid FriendCodes
|
||||
- Kick/Ban players who say "start" and conitions
|
||||
- DenyName system
|
||||
- Moderator system
|
||||
- Kick/Ban players who say "start"
|
||||
- Banword system
|
||||
- Banlist system
|
||||
- DenyName system
|
||||
- Multi layer moderator system
|
||||
- To add Admins, Moderators and VIP's, type the user's Friendcode in the designated files located in AUR-DATA
|
||||
- Enable No Game End
|
||||
- Custom starting countdown
|
||||
## <b>♻️ Automation settings:</b>
|
||||
- Automatically start game and conditions for it
|
||||
- Automatically start game
|
||||
- Automatically rejoin lobby
|
||||
- Automatically send winner info
|
||||
## <b>🔧 Gameplay Settings:</b>
|
||||
@@ -58,6 +65,8 @@
|
||||
- Disable body reports
|
||||
- Disable devices (per map, individual)
|
||||
- Override decontamination time (per map)
|
||||
- Disable spore triggers on The Fungle
|
||||
- % Tasks completed for Crewmates to win
|
||||
- Enable/Disable any task
|
||||
- All players have same tasks
|
||||
- Hide and Seek: Custom Impostor count
|
||||
@@ -72,9 +81,8 @@
|
||||
- Faster startup time
|
||||
- Custom anticheat system
|
||||
- Zoom out in lobby or when dead
|
||||
- Near unlimited default Option ranges
|
||||
- More accurate Option incrementing
|
||||
- Logging for useful information
|
||||
- See player kill/task count when dead
|
||||
- Higher and more accurate Option ranges
|
||||
- <b>🎉 And this all works in public lobbies!</b>
|
||||
|
||||
### Hotkeys
|
||||
@@ -104,7 +112,8 @@
|
||||
| /endmeeting | Instantly end an ongoing meeting |
|
||||
| /aur | Sends AUR socials (GitHub, Discord) |
|
||||
| /color | Sets color. Can be used to bypass color limit |
|
||||
| /reload | Resets the *Language*.JSON file to default |
|
||||
| /reload | Resets the *Language*.JSON file to default |
|
||||
| /start | Starts game countdown |
|
||||
|
||||
|
||||
**Credit to these mods and their developers for their code:**
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
{
|
||||
"LanguageID": "0",
|
||||
|
||||
"gameMaster": "Game Master",
|
||||
"unlockFPS": "Unlock FPS",
|
||||
"showFPS": "Show FPS",
|
||||
"autoStart": "Auto Start",
|
||||
"enableDarkTheme": "Enable Dark Theme",
|
||||
"enableLobbyMusic": "Lobby Music",
|
||||
|
||||
"gameMasterWarning":"You will now spectate games until GM is turned off. WARNING: Custom role notifications will not work with this setting on!",
|
||||
|
||||
"cancelStartCountdown": "Start countdown canceled",
|
||||
|
||||
"gamemode": "Gamemode",
|
||||
"tabGroupMain": "Moderation",
|
||||
"kickLowLevelPlayer": "Kick Players Under Level",
|
||||
@@ -27,17 +38,29 @@
|
||||
"allowFortegreen": "Allow Fortegreen Color",
|
||||
"noGameEnd": "No Game End",
|
||||
|
||||
"tabGroupAccess": "Access Levels",
|
||||
"slashColorCmd": "Who Can Use /color",
|
||||
"slashRolesAndGamemodeCmd": "Who Can Use /r",
|
||||
"slashLastGameCmd": "Who Can Use /l",
|
||||
"slashHelpAndAurCmd": "Who Can Use /help And /aur",
|
||||
"slashKickCmd": "Who Can Use /kick And /ckick",
|
||||
"slashBanCmd": "Who Can Use /ban And /cban",
|
||||
"slashEndMeetingCmd": "Who Can Use /endmeeting",
|
||||
"slashStartAndEndGameCmd": "Who Can Use /startgame And /endgame",
|
||||
|
||||
"tabGroupCrewmate": "Crewmate Roles",
|
||||
"mayorPerc": "PLACEHOLDER",
|
||||
"tabGroupNeutral": "Neutral Roles",
|
||||
"jesterPerc": "PLACEHOLDER",
|
||||
"tabGroupImpostor": "Impostor Roles",
|
||||
|
||||
"tabGroupStandard": "Standard",
|
||||
"chatBeforeFirstMeeting": "Force chat 1st round to see roles (experimental)",
|
||||
|
||||
"tabGroupHNS": "Hide and Seek",
|
||||
"numSeekers": "# Seekers",
|
||||
"tabGroup0Kcd": "0 Kill Cooldown",
|
||||
"noKcdSettingsOverride": "Auto Update Settings",
|
||||
"tabGroupSNS": "Shift and Seek",
|
||||
"snsChatInGame": "Chat during gameplay (experimental)",
|
||||
"snsSettingsOverride": "Auto Update Settings",
|
||||
"cantKillTime": "After Misfiring, Can't kill for",
|
||||
"misfiresToSuicide": "Suicide After Amount Of Misfires",
|
||||
@@ -73,6 +96,7 @@
|
||||
"decontaminationDoorOpenTimeOnMiraHQ": "Mira HQ Door Open Duration",
|
||||
"decontaminationTimeOnPolus": "Polus Decon Duration",
|
||||
"decontaminationDoorOpenTimeOnPolus": "Polus Door Open Duration",
|
||||
"disableSporeTrigger": "Disable Spores On The Fungle",
|
||||
|
||||
"disableDevices": "Disable Devices",
|
||||
"disableSkeldDevices": "Disable Skeld Devices",
|
||||
@@ -96,7 +120,8 @@
|
||||
|
||||
"tabGroupTasks": "Tasks",
|
||||
"allPlayersSameTasks": "Everyone has same tasks",
|
||||
"overrideTaskSettings": "<#ffd>Di<#ffb>sa<#ff9>bl<#ffb>e T<#ffd>as<#ffb>ks",
|
||||
"overrideTaskSettings": "Disable Tasks",
|
||||
"taskPercentNeededToWin": "% Tasks completed for crewmates to win",
|
||||
|
||||
"disableMiraTasks": "Disable Mira HQ Tasks",
|
||||
"disableBuyBeverage": "Disable Buy Beverage",
|
||||
@@ -127,10 +152,10 @@
|
||||
"disablePutAwayPistols": "Disable Put Away Pistols",
|
||||
"disablePutAwayRifles": "Disable Put Away Rifles",
|
||||
"disableRewindTapes": "Disable Rewind Tapes",
|
||||
"disableResetBreaker": "Disable Reset Breaker Task",
|
||||
"disableResetBreaker": "Disable Reset Breakers",
|
||||
"disableSortRecords": "Disable Sort Records",
|
||||
"disableStartFans": "Disable Start Fans",
|
||||
"disableUnlockSafe": "Disable Unlock Safe Task",
|
||||
"disableUnlockSafe": "Disable Unlock Safe",
|
||||
|
||||
"disableFungleTasks": "Disable Fungle Tasks",
|
||||
"disableBuildSandcastle": "Disable Build Sandcastle",
|
||||
@@ -189,16 +214,25 @@
|
||||
|
||||
"noKcdMode": "0 Kill Cooldown:\n\nImpostors have no kill cooldown, Crewmates have low tasks\nThink fast and pay attention!",
|
||||
"SnSModeOne": "Shift and Seek:\n\nImpostors can only kill someone while shapeshifted as them\nEmergency Meetings = Off",
|
||||
"SnSModeTwo": "Crew wins by tasks/surviving {0}s\nImp wins by killing\nOne wrong kill = Can't kill for {1}s\n{2} wrong kills = suicide",
|
||||
"SnSModeTwo": "Crew wins by tasks/surviving {0}s\nImp wins by killing\nOne wrong kill = Can't kill for {1}s\n{2} wrong kill(s) = suicide",
|
||||
"speedrunMode": "Speedrun:\n\nEveryone is a crewmate. The 1st player to finish tasks wins the game. Game auto ends after {0}s",
|
||||
"allCommandsFull": "Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info\n/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color",
|
||||
"allCommandsOne": "Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info",
|
||||
"allCommandsTwo": "/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color",
|
||||
"socialsAll": "AUR socials:\n\ng i t h u b . c o m /\nApeMV/AmongUsRevamped\n\nd i s c o r d . g g /\n83Zhzhyhya",
|
||||
"translationReloaded": "Your file has successfully been reset.\nTo apply the changes, restart your game.",
|
||||
|
||||
"Mayor": "Mayor",
|
||||
"MayorPriv": "PRIVATE:\n\nYour role is Mayor!\n\nYou are a crewmate with i total votes. Use your voting power to eject Impostors.",
|
||||
"mayorPublic": "Mayor:\n\nThe Mayor is a crewmate with {0} extra vote(s). Depending on settings, they can vent to call a meeting.",
|
||||
"mayorPriv": "Your role is Mayor!\n\nYou are a crewmate with {0} extra vote(s). If you are an Engineer, vent to call a meeting.",
|
||||
"mayorExtraVoteCount": "Extra Votes",
|
||||
"mayorVentToMeeting": "Can Vent To Call Meetings",
|
||||
|
||||
"Jester": "Jester",
|
||||
"JesterPriv": "PRIVATE:\n\nYour role is Jester!\nYou are NOT a crewmate!\n\nYou win by getting voted. Act as suspicious as possible."
|
||||
"jesterPublic": "Jester:\n\nThe Jester wins alone by getting voted. They must act as suspicious as possible.",
|
||||
"jesterPriv": "Your role is Jester!\nYou are NOT a crewmate!\n\nYou win by getting voted. Act as suspicious as possible.",
|
||||
"jesterCanVent": "Can Vent",
|
||||
|
||||
"customRoleAnnouncement": "Custom Roles are enabled!\n\nIf you have a Custom Role, it will show in a message below this one.",
|
||||
"roleDescriptionHelp": "Your Custom Role can be seen at the start of meetings. It is shown by an obvious private text"
|
||||
}
|
||||
Reference in new issue
Block a user