mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-22 07:36:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02f7ddc63a | ||
|
|
600234b5f2 | ||
|
|
15d6f54982 | ||
|
|
5570d6f4ea | ||
|
|
e9f1c1aaf1 | ||
|
|
a6c3220892 | ||
|
|
673386336a | ||
|
|
2ac4728f8a | ||
|
|
88599a0680 | ||
|
|
5ae6d648e3 | ||
|
|
21dec84e64 |
No files matched your search
+7
-1
@@ -11,6 +11,9 @@ using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
// dotnet build -c release
|
||||
// dotnet build -c android
|
||||
|
||||
[BepInAutoPlugin]
|
||||
[BepInProcess("Among Us.exe")]
|
||||
public partial class Main : BasePlugin
|
||||
@@ -33,12 +36,15 @@ public partial class Main : BasePlugin
|
||||
public static ConfigEntry<bool> LobbyMusic { get; private set; }
|
||||
|
||||
public static NormalGameOptionsV10 NormalOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentNormalGameOptions : null;
|
||||
public static HideNSeekGameOptionsV10 HideNSeekOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentHideNSeekGameOptions : null;
|
||||
public static bool HasArgumentException;
|
||||
public static string CredentialsText;
|
||||
public const string ModVersion = "v1.3.3";
|
||||
public const string ModVersion = "v1.5.1";
|
||||
|
||||
public static float GameTimer;
|
||||
|
||||
public static readonly Dictionary<int, int> SayStartTimes = [];
|
||||
|
||||
public static PlayerControl[] AllPlayerControls
|
||||
{
|
||||
get
|
||||
|
||||
+17
-8
@@ -1,24 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Configuration)' == 'Android'">net8.0</TargetFramework>
|
||||
<TargetFramework Condition="'$(Configuration)' != 'Android'">net6.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<DebugType>embedded</DebugType>
|
||||
|
||||
<VersionPrefix>1.0.0</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
<Description>The ultimate Host-Only mod without Modded Protocol</Description>
|
||||
<Authors>Most Various</Authors>
|
||||
<Authors>apemv</Authors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Configurations>Release;Android</Configurations>
|
||||
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" Private="false" ExcludeAssets="runtime;native" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2025.11.18" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" ExcludeAssets="runtime;native" />
|
||||
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2025.11.18" PrivateAssets="all" Condition="'$(Configuration)' == 'Release'"/>
|
||||
<PackageReference Include="AmongUs.GameLibs.Android" Version="2025.10.14" PrivateAssets="all" Condition="'$(Configuration)' == 'Android'"/>
|
||||
|
||||
<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" PrivateAssets="all" ExcludeAssets="runtime" />
|
||||
|
||||
<EmbeddedResource Include=".\Resources\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != '' And '$(Configuration)' != 'Android'">
|
||||
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(AmongUs)/BepInEx/plugins/" UseSymboliclinksIfPossible="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
+29
-5
@@ -5,22 +5,30 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
// https://github.com/EnhancedNetwork/TownofHost-Enhanced/blob/main/Modules/BanManager.cs
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
public static class BanManager
|
||||
{
|
||||
public static readonly string DataPath =
|
||||
#if ANDROID
|
||||
Application.persistentDataPath;
|
||||
#else
|
||||
".";
|
||||
#endif
|
||||
|
||||
public static string RemoveHtmlTags(this string str) => Regex.Replace(str, "<[^>]*?>", "");
|
||||
private static readonly string DenyNameListPath = "./AUR-DATA/DenyNameList.txt";
|
||||
private static string BanListPath = "./AUR-DATA/BanList.txt";
|
||||
private static string ModeratorListPath = "./AUR-DATA/ModeratorList.txt";
|
||||
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";
|
||||
public static List<string> TempBanWhiteList = [];
|
||||
public static void Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory("AUR-DATA");
|
||||
if (!Directory.Exists($"{DataPath}/AUR-DATA")) Directory.CreateDirectory($"{DataPath}/AUR-DATA");
|
||||
|
||||
if (!File.Exists(DenyNameListPath))
|
||||
{
|
||||
@@ -120,8 +128,9 @@ public static class BanManager
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory("AUR-DATA");
|
||||
if (!Directory.Exists($"{DataPath}/AUR-DATA")) Directory.CreateDirectory($"{DataPath}/AUR-DATA");
|
||||
if (!File.Exists(BanListPath)) File.Create(BanListPath).Close();
|
||||
|
||||
using StreamReader sr = new(BanListPath);
|
||||
string line;
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
@@ -141,6 +150,21 @@ public static class BanManager
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool IsPlayerInDenyName(ClientData client, string name)
|
||||
{
|
||||
if (name == "" || !AmongUsClient.Instance.AmHost || !Options.ApplyDenyNameList.GetBool()) return false;
|
||||
|
||||
var deniedNames = File.ReadAllLines(DenyNameListPath);
|
||||
|
||||
if (deniedNames.Where(code => !string.IsNullOrWhiteSpace(code)).Any(code => name.Contains(code, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(client.Id, false);
|
||||
Logger.Info($" {name} was kicked because their name was in DenyNameList.txt", "Kick");
|
||||
Logger.SendInGame($" {name} was kicked because their name was in DenyNameList.txt");
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
}
|
||||
[HarmonyPatch(typeof(BanMenu), nameof(BanMenu.Select))]
|
||||
|
||||
@@ -4,23 +4,6 @@ using UnityEngine;
|
||||
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionHolder.cs
|
||||
namespace AmongUsRevamped
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public static class Options
|
||||
{
|
||||
static Task taskOptionsLoad;
|
||||
|
||||
[HarmonyPatch(typeof(TranslationController), nameof(TranslationController.Initialize)), HarmonyPostfix]
|
||||
public static void OptionsLoadStart()
|
||||
{
|
||||
taskOptionsLoad = Task.Run(Load);
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start)), HarmonyPostfix]
|
||||
public static void WaitOptionsLoad()
|
||||
{
|
||||
taskOptionsLoad.Wait();
|
||||
}
|
||||
|
||||
public static class CL
|
||||
{
|
||||
public static Color32 Hex(string hex)
|
||||
@@ -41,8 +24,26 @@ namespace AmongUsRevamped
|
||||
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
return new Color32(r, g, b, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class Options
|
||||
{
|
||||
static Task taskOptionsLoad;
|
||||
|
||||
[HarmonyPatch(typeof(TranslationController), nameof(TranslationController.Initialize)), HarmonyPostfix]
|
||||
public static void OptionsLoadStart()
|
||||
{
|
||||
taskOptionsLoad = Task.Run(Load);
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start)), HarmonyPostfix]
|
||||
public static void WaitOptionsLoad()
|
||||
{
|
||||
taskOptionsLoad.Wait();
|
||||
}
|
||||
|
||||
public const int PresetId = 0;
|
||||
|
||||
private static readonly string[] presets =
|
||||
@@ -77,6 +78,11 @@ namespace AmongUsRevamped
|
||||
public static OptionItem ApplyModeratorList;
|
||||
public static OptionItem ModeratorCanUseCommand;
|
||||
|
||||
public static OptionItem AutoKickStart;
|
||||
public static OptionItem AutoKickStartAsBan;
|
||||
public static OptionItem AutoKickStartTimes;
|
||||
public static OptionItem AutoKickStartStrength;
|
||||
|
||||
public static OptionItem TabGroupAutomation;
|
||||
|
||||
public static OptionItem AutoSendGameInfo;
|
||||
@@ -227,6 +233,7 @@ namespace AmongUsRevamped
|
||||
|
||||
// Roles
|
||||
public static OptionItem TabGroupCrewmate;
|
||||
public static OptionItem MayorPerc;
|
||||
|
||||
public static OptionItem TabGroupNeutral;
|
||||
public static OptionItem JesterPerc;
|
||||
@@ -264,6 +271,15 @@ namespace AmongUsRevamped
|
||||
ApplyModeratorList = BooleanOptionItem.Create(60121, "Apply Moderator List", true, TabGroup.SystemSettings, false);
|
||||
ModeratorCanUseCommand = BooleanOptionItem.Create(60122, "Moderators can use commands", true, TabGroup.SystemSettings, false);
|
||||
|
||||
AutoKickStart = BooleanOptionItem.Create(60123, "Kick Players Who Say Start", false, TabGroup.SystemSettings, false);
|
||||
AutoKickStartAsBan = BooleanOptionItem.Create(60124, "Ban Instead Of Kick", false, TabGroup.SystemSettings, false)
|
||||
.SetParent(AutoKickStart);
|
||||
AutoKickStartTimes = IntegerOptionItem.Create(60125, "Start messages needed to kick", new(1, 10, 1), 1, TabGroup.SystemSettings, false)
|
||||
.SetParent(AutoKickStart)
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
AutoKickStartStrength = BooleanOptionItem.Create(60126, "Strict detection mode", false, TabGroup.SystemSettings, false)
|
||||
.SetParent(AutoKickStart);
|
||||
|
||||
TabGroupAutomation = TextOptionItem.Create(60149, "Automation", TabGroup.SystemSettings)
|
||||
.SetColor(Color.yellow);
|
||||
|
||||
@@ -291,6 +307,9 @@ namespace AmongUsRevamped
|
||||
// Custom role settings
|
||||
TabGroupCrewmate = TextOptionItem.Create(100000, "Crewmate Roles", TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#8cffff"));
|
||||
MayorPerc = IntegerOptionItem.Create(100001, "PLACEHOLDER", new(0, 100, 5), 0, TabGroup.CustomRoleSettings, false)
|
||||
.SetValueFormat(OptionFormat.Percent)
|
||||
.SetColor(CL.Hex("#204d42"));
|
||||
|
||||
TabGroupNeutral = TextOptionItem.Create(101000, "Neutral Roles", TabGroup.CustomRoleSettings)
|
||||
.SetColor(CL.Hex("#FFFF99"));
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
using AmongUs.GameOptions;
|
||||
using System;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
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 void AssignRoles()
|
||||
{
|
||||
// crewmateRoles = assigned with crewmate role base
|
||||
// impostorRoles = assigned with impostor role base
|
||||
List<(string roleName, int percentage)> crewmateRoles = new()
|
||||
{
|
||||
("Jester", Options.JesterPerc.GetInt()),
|
||||
("Mayor", Options.MayorPerc.GetInt())
|
||||
};
|
||||
|
||||
List<(string roleName, int percentage)> impostorRoles = new()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
List<PlayerControl> availablePlayers = new();
|
||||
foreach (var player in PlayerControl.AllPlayerControls) availablePlayers.Add(player);
|
||||
availablePlayers = availablePlayers.OrderBy(x => random.Next()).ToList();
|
||||
PlayerRoles.Clear();
|
||||
|
||||
HashSet<string> assignedRoles = new HashSet<string>();
|
||||
HashSet<string> attemptedRoles = new HashSet<string>();
|
||||
|
||||
foreach (var player in availablePlayers)
|
||||
{
|
||||
bool isCrewmate = !player.Data.Role.IsImpostor;
|
||||
var rolesToAssign = isCrewmate ? crewmateRoles : impostorRoles;
|
||||
|
||||
foreach (var (roleName, percentage) in rolesToAssign)
|
||||
{
|
||||
if (attemptedRoles.Contains(roleName)) continue;
|
||||
|
||||
attemptedRoles.Add(roleName);
|
||||
|
||||
int randomValue = random.Next(0, 101);
|
||||
Logger.Info($"{roleName}, Value: {randomValue}, Percentage: {percentage}", "StartGameCustomRole1");
|
||||
|
||||
if (randomValue >= percentage) continue;
|
||||
if (PlayerRoles.ContainsKey(player.PlayerId)) continue;
|
||||
|
||||
PlayerRoles[player.PlayerId] = roleName;
|
||||
assignedRoles.Add(roleName);
|
||||
|
||||
Logger.Info($"({player.PlayerId}) {player.Data.PlayerName} -> {roleName}", "StartGameCustomRole2");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetActiveRoles()
|
||||
{
|
||||
var crewmateRoles = new List<string>();
|
||||
var neutralRoles = new List<string>();
|
||||
var impostorRoles = new List<string>();
|
||||
var lines = new List<string>();
|
||||
|
||||
if (Options.MayorPerc.GetInt() > 1) crewmateRoles.Add($"Mayor");
|
||||
|
||||
if (Options.JesterPerc.GetInt() > 1) neutralRoles.Add($"Jester");
|
||||
|
||||
void AddCategory(string header, List<string> roles)
|
||||
{
|
||||
if (roles.Count == 0) return;
|
||||
|
||||
if (lines.Count > 0) lines.Add("");
|
||||
|
||||
lines.Add(header);
|
||||
lines.AddRange(roles);
|
||||
}
|
||||
|
||||
AddCategory("Crewmate:", crewmateRoles);
|
||||
AddCategory("Neutral:", neutralRoles);
|
||||
AddCategory("Impostor:", impostorRoles);
|
||||
|
||||
return lines.Count > 0 ? string.Join("\n", lines) : string.Empty;
|
||||
}
|
||||
|
||||
public static bool HandlingRoleMessages = false;
|
||||
private static int PendingRoleMessages = 0;
|
||||
public static void SendRoleMessages(Dictionary<string, string> roleMessages)
|
||||
{
|
||||
HashSet<string> sentRoles = new HashSet<string>();
|
||||
|
||||
var players = PlayerControl.AllPlayerControls.ToArray().ToList();
|
||||
float delay = 0f;
|
||||
|
||||
PendingRoleMessages = 0;
|
||||
HandlingRoleMessages = false;
|
||||
foreach (var player in players)
|
||||
{
|
||||
if (!PlayerRoles.TryGetValue(player.PlayerId, out string role)) continue;
|
||||
if (!roleMessages.ContainsKey(role)) continue;
|
||||
if (sentRoles.Contains(role)) continue;
|
||||
|
||||
PendingRoleMessages++;
|
||||
new LateTask(() =>
|
||||
{
|
||||
Utils.SendPrivateMessage(player, roleMessages[role]);
|
||||
PendingRoleMessages--;
|
||||
|
||||
if (PendingRoleMessages <= 0)
|
||||
{
|
||||
PendingRoleMessages = 0;
|
||||
HandlingRoleMessages = false;
|
||||
}
|
||||
}, delay, "SendRoleMessage");
|
||||
|
||||
sentRoles.Add(role);
|
||||
delay += 2.2f;
|
||||
}
|
||||
}
|
||||
|
||||
public static string PlayerToCustomRole()
|
||||
{
|
||||
if (CustomRoleManagement.PlayerRoles.Count == 0) return string.Empty;
|
||||
|
||||
Dictionary<string, List<string>> roleToPlayers = new Dictionary<string, List<string>>();
|
||||
|
||||
foreach (var kvp in CustomRoleManagement.PlayerRoles)
|
||||
{
|
||||
byte playerId = kvp.Key;
|
||||
string role = kvp.Value;
|
||||
|
||||
PlayerControl pc = null;
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.PlayerId == playerId)
|
||||
{
|
||||
pc = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pc == null) continue;
|
||||
|
||||
if (!roleToPlayers.ContainsKey(role)) roleToPlayers[role] = new List<string>();
|
||||
roleToPlayers[role].Add(pc.Data.PlayerName);
|
||||
}
|
||||
|
||||
if (roleToPlayers.Count == 0) return string.Empty;
|
||||
|
||||
var lines = new List<string>();
|
||||
|
||||
foreach (var entry in roleToPlayers)
|
||||
{
|
||||
string players = string.Join(", ", entry.Value);
|
||||
lines.Add($"{entry.Key}: {players}");
|
||||
}
|
||||
return string.Join("\n", lines);
|
||||
}
|
||||
}
|
||||
+17
-9
@@ -5,16 +5,24 @@ using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
#if !ANDROID
|
||||
[HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))]
|
||||
internal class Hotkeys
|
||||
{
|
||||
public static int IncrementMultiplier;
|
||||
public static void Postfix()
|
||||
{
|
||||
// I don't know which psychopath would use right keys, but I know someday, someone will complain
|
||||
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);
|
||||
|
||||
if ((!AmongUsClient.Instance.IsGameStarted || !Utils.IsOnlineGame) && Utils.CanMove && PlayerControl.LocalPlayer.Collider != null)
|
||||
{
|
||||
PlayerControl.LocalPlayer.Collider.enabled = !Ctrl;
|
||||
}
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (Input.GetKey(KeyCode.L) && Shift && Enter)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
@@ -34,21 +42,21 @@ internal class Hotkeys
|
||||
}
|
||||
}
|
||||
|
||||
if (Shift && GameStartManager.InstanceExists && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
if (Shift && GameStartManager.InstanceExists && GameStartManager.Instance != null && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
GameStartManager.Instance.countDownTimer = 0;
|
||||
}
|
||||
|
||||
if ((!AmongUsClient.Instance.IsGameStarted || !Utils.IsOnlineGame) && Utils.CanMove && PlayerControl.LocalPlayer.Collider != null)
|
||||
{
|
||||
PlayerControl.LocalPlayer.Collider.enabled = !Ctrl;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C) && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening && Utils.IsLobby)
|
||||
if (Input.GetKeyDown(KeyCode.C) && GameStartManager.InstanceExists && GameStartManager.Instance != null && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening && Utils.IsLobby)
|
||||
{
|
||||
Logger.Info("Resetted start countdown", "KeyCommand");
|
||||
GameStartManager.Instance.ResetStartState();
|
||||
Logger.SendInGame("Starting countdown canceled");
|
||||
}
|
||||
|
||||
if (Shift) IncrementMultiplier = 5;
|
||||
else if (Ctrl) IncrementMultiplier = 10;
|
||||
else IncrementMultiplier = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+61
-26
@@ -52,28 +52,11 @@ public static class Utils
|
||||
{
|
||||
if (friendCode == "") return false;
|
||||
|
||||
var friendCodesFilePath = @"./AUR-DATA/ModeratorList.txt";
|
||||
var friendCodesFilePath = @$"{BanManager.DataPath}/AUR-DATA/ModeratorList.txt";
|
||||
var friendCodes = File.ReadAllLines(friendCodesFilePath);
|
||||
return friendCodes.Any(code => code.Contains(friendCode));
|
||||
}
|
||||
|
||||
public static bool IsPlayerInDenyName(ClientData client, string name)
|
||||
{
|
||||
if (name == "" || !AmongUsClient.Instance.AmHost || !Options.ApplyDenyNameList.GetBool()) return false;
|
||||
|
||||
var denyNameFilePath = @"./AUR-DATA/DenyNameList.txt";
|
||||
var deniedNames = File.ReadAllLines(denyNameFilePath);
|
||||
|
||||
if (deniedNames.Where(code => !string.IsNullOrWhiteSpace(code)).Any(code => name.Contains(code, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(client.Id, false);
|
||||
Logger.Info($" {name} was kicked because their name was in DenyNameList.txt", "Kick");
|
||||
Logger.SendInGame($" {name} was kicked because their name was in DenyNameList.txt");
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
public static string GetTabName(TabGroup tab)
|
||||
{
|
||||
switch (tab)
|
||||
@@ -151,9 +134,16 @@ public static class Utils
|
||||
|
||||
string name = region.Name;
|
||||
|
||||
// Joining games shows incorrect regions
|
||||
if (!AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
name = "";
|
||||
return name;
|
||||
}
|
||||
|
||||
if (AmongUsClient.Instance.NetworkMode != NetworkModes.OnlineGame)
|
||||
{
|
||||
name = "Local Game";
|
||||
name = "Server: Local Game";
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -162,9 +152,9 @@ public static class Utils
|
||||
// Official servers
|
||||
name = name switch
|
||||
{
|
||||
"North America" => "NA",
|
||||
"Europe" => "EU",
|
||||
"Asia" => "AS",
|
||||
"North America" => "Server: NA",
|
||||
"Europe" => "Server: EU",
|
||||
"Asia" => "Server: AS",
|
||||
_ => name
|
||||
};
|
||||
|
||||
@@ -177,11 +167,11 @@ public static class Utils
|
||||
{
|
||||
// Modded Servers
|
||||
if (ip.Contains("au-eu"))
|
||||
name = "MEU";
|
||||
name = "Server: MEU";
|
||||
else if (ip.Contains("au-as"))
|
||||
name = "MAS";
|
||||
name = "Server: MAS";
|
||||
else
|
||||
name = "MNA";
|
||||
name = "Server: MNA";
|
||||
|
||||
return name;
|
||||
}
|
||||
@@ -208,6 +198,7 @@ public static class Utils
|
||||
LateTask.Tasks.Clear();
|
||||
FixedUpdateInGamePatch.ProcessedModerators.Clear();
|
||||
NormalGameEndChecker.ImpCheckComplete = false;
|
||||
CreateOptionsPickerPatch.SetDleks2 = false;
|
||||
}
|
||||
|
||||
public static PlayerControl[] AllAlivePlayerControls
|
||||
@@ -394,8 +385,12 @@ public static class Utils
|
||||
|
||||
public static void DumpLog()
|
||||
{
|
||||
string f = $"{Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}/AUR-logs/";
|
||||
string t = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss");
|
||||
#if ANDROID
|
||||
var f = $"{BanManager.DataPath}/AUR-Logs/{t}";
|
||||
#else
|
||||
string f = $"{Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}/AUR-logs/";
|
||||
#endif
|
||||
string filename = $"{f}AUR-{Main.ModVersion}-{t}.log";
|
||||
if (!Directory.Exists(f)) Directory.CreateDirectory(f);
|
||||
FileInfo file = new(@$"{Environment.CurrentDirectory}/BepInEx/LogOutput.log");
|
||||
@@ -404,8 +399,48 @@ public static class Utils
|
||||
if (PlayerControl.LocalPlayer != null)
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"/Dump command activated\n\nFile: AUR-{Main.ModVersion}-{t}");
|
||||
#if !ANDROID
|
||||
ProcessStartInfo psi = new("Explorer.exe") { Arguments = "/e,/select," + @filename.Replace("/", "\\") };
|
||||
Process.Start(psi);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static Dictionary<string, Sprite> CachedSprites = [];
|
||||
public static Sprite LoadSprite(string path, float pixelsPerUnit = 1f)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (CachedSprites.TryGetValue(path + pixelsPerUnit, out var sprite)) return sprite;
|
||||
Texture2D texture = LoadTextureFromResources(path);
|
||||
sprite = Sprite.Create(texture, new(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
||||
sprite.hideFlags |= HideFlags.HideAndDontSave | HideFlags.DontSaveInEditor;
|
||||
return CachedSprites[path + pixelsPerUnit] = sprite;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Error($"Failed to read Texture: {path}", "LoadSprite");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static unsafe Texture2D LoadTextureFromResources(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
Texture2D texture = new(2, 2, TextureFormat.ARGB32, true);
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
Stream stream = assembly.GetManifestResourceStream(path);
|
||||
var length = stream.Length;
|
||||
var byteTexture = new Il2CppStructArray<byte>(length);
|
||||
stream.Read(new Span<byte>(IntPtr.Add(byteTexture.Pointer, IntPtr.Size * 4).ToPointer(), (int)length));
|
||||
ImageConversion.LoadImage(texture, byteTexture, false);
|
||||
return texture;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Error($"Failed to read Texture: {path}", "LoadTextureFromResources");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -4,6 +4,7 @@ using UnityEngine;
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
// https://github.com/Yumenopai/TownOfHost_Y
|
||||
#if !ANDROID
|
||||
[HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))]
|
||||
public static class Zoom
|
||||
{
|
||||
@@ -16,9 +17,7 @@ public static class Zoom
|
||||
|
||||
public static void Postfix()
|
||||
{
|
||||
bool canZoom =
|
||||
(Utils.IsShip && !Utils.IsMeeting && Utils.CanMove && PlayerControl.LocalPlayer.Data.IsDead)
|
||||
|| (Utils.IsLobby && Utils.CanMove);
|
||||
bool canZoom = (Utils.IsShip && !Utils.IsMeeting && Utils.CanMove && PlayerControl.LocalPlayer.Data.IsDead) || (Utils.IsLobby && Utils.CanMove);
|
||||
|
||||
if (!canZoom)
|
||||
{
|
||||
@@ -100,4 +99,5 @@ public static class Flag
|
||||
{
|
||||
OneTimeList.Remove(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+91
-36
@@ -5,7 +5,6 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
// https://github.com/SuperNewRoles/SuperNewRoles/blob/master/SuperNewRoles/Patches/LobbyBehaviourPatch.cs
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(ChatController), nameof(ChatController.Update))]
|
||||
@@ -14,6 +13,9 @@ internal static class ChatControllerUpdatePatch
|
||||
|
||||
public static void Postfix(ChatController __instance)
|
||||
{
|
||||
if (!__instance||!__instance.freeChatField||!__instance.freeChatField.textArea||!__instance.freeChatField.background||__instance.freeChatField.textArea.compoText == null||!__instance.freeChatField.textArea.outputText) return;
|
||||
if (!__instance.quickChatField||!__instance.quickChatField.background||__instance.quickChatField.text==null) return;
|
||||
|
||||
if (Main.DarkTheme.Value)
|
||||
{
|
||||
__instance.freeChatField.background.color = new Color32(40, 40, 40, byte.MaxValue);
|
||||
@@ -40,13 +42,15 @@ internal static class ChatBubbleSetNamePatch
|
||||
{
|
||||
public static void Postfix(ChatBubble __instance, [HarmonyArgument(2)] bool voted)
|
||||
{
|
||||
PlayerControl seer = PlayerControl.LocalPlayer;
|
||||
if (!__instance||!__instance.playerInfo||!__instance.playerInfo.Object||!__instance.playerInfo.Object.Data||!__instance.TextArea||!__instance.Background) return;
|
||||
|
||||
PlayerControl target = __instance.playerInfo.Object;
|
||||
|
||||
if (Main.DarkTheme.Value)
|
||||
{
|
||||
__instance.Background.color = new(0.1f, 0.1f, 0.1f, 1f);
|
||||
__instance.TextArea.color = Color.white;
|
||||
|
||||
if (__instance.playerInfo.Object.Data.IsDead && Utils.InGame) __instance.Background.color = new(0.1f, 0.1f, 0.1f, 0.7f);
|
||||
}
|
||||
}
|
||||
@@ -55,18 +59,10 @@ internal static class ChatBubbleSetNamePatch
|
||||
[HarmonyPatch(typeof(ChatController), nameof(ChatController.SendChat))]
|
||||
internal static class SendChatPatch
|
||||
{
|
||||
public static string noKcdMode = "0 Kill Cooldown:\n\nImpostors have no kill cooldown, Crewmates have low tasks\nThink fast and pay attention!";
|
||||
public static string SnSModeOne = "Shift and Seek:\n\nImpostors can only kill someone while shapeshifted as them\nSabotages & Meetings = Off";
|
||||
public static string SnSModeTwo = $"Crew wins by tasks/surviving {Options.CrewAutoWinsGameAfter.GetInt()}s\nImp wins by killing\nOne wrong kill = Can't kill for {Options.CantKillTime.GetInt()}s\n{Utils.BasicIntToWord(Options.MisfiresToSuicide.GetInt())} wrong kills = suicide";
|
||||
public static string speedrunMode = $"Speedrun:\n\nEveryone is a crewmate The 1st player to finish tasks wins the game Game auto ends after {Options.GameAutoEndsAfter.GetInt()}s";
|
||||
|
||||
public static string 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";
|
||||
public static string allCommandsOne = "Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info";
|
||||
public static string allCommandsTwo = "/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color";
|
||||
|
||||
public static bool Prefix(ChatController __instance)
|
||||
{
|
||||
string text = __instance.freeChatField.textArea.text.Trim();
|
||||
string msgtext = __instance.freeChatField.textArea.text.Trim();
|
||||
string text = msgtext.ToLower();
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
@@ -80,13 +76,35 @@ internal static class SendChatPatch
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
{
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{allCommandsFull}");
|
||||
HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, $"{String.allCommandsFull}");
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat) return false;
|
||||
if (text == "/eg" || text == "/endgame")
|
||||
{
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
|
||||
if (!Utils.InGame) return false;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
|
||||
writer.Write((byte)GameOverReason.ImpostorDisconnect);
|
||||
AmongUsClient.Instance.FinishEndGame(writer);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/em" || text == "/endmeeting")
|
||||
{
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
|
||||
if ( !Utils.InGame || !Utils.IsMeeting) return false;
|
||||
MeetingHud.Instance.RpcClose();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat || CustomRoleManagement.HandlingRoleMessages) return false;
|
||||
|
||||
if (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
|
||||
{
|
||||
@@ -95,21 +113,27 @@ internal static class SendChatPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/aur" || text == "/amongusrevamped" || text == "/socials" || text == "/github" || text == "/discord")
|
||||
{
|
||||
Utils.ChatCommand(__instance, $"{String.SocialsAll}", "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
|
||||
{
|
||||
Utils.ChatCommand(__instance, $"{noKcdMode}", "", false);
|
||||
Utils.ChatCommand(__instance, $"{String.noKcdMode}", "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
|
||||
{
|
||||
Utils.ChatCommand(__instance, $"{SnSModeOne}", $"{SnSModeTwo}", true);
|
||||
Utils.ChatCommand(__instance, $"{String.SnSModeOne}", $"{String.SnSModeTwo}", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text == "/sp" || text == "/sr" || text == "/speedrun")
|
||||
{
|
||||
Utils.ChatCommand(__instance, $"{speedrunMode}", "", false);
|
||||
Utils.ChatCommand(__instance, $"{String.speedrunMode}", "", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,25 +142,25 @@ internal static class SendChatPatch
|
||||
switch (Options.Gamemode.GetValue())
|
||||
{
|
||||
case 0:
|
||||
PlayerControl.LocalPlayer.RpcSendChat($"Custom roles:\nThere are no custom roles.");
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
Utils.ChatCommand(__instance, $"Enabled Custom Roles:\n\n{CustomRoleManagement.GetActiveRoles()}", "", false);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Utils.ChatCommand(__instance, $"{noKcdMode}", "", false);
|
||||
Utils.ChatCommand(__instance, $"{String.noKcdMode}", "", false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Utils.ChatCommand(__instance, $"{SnSModeOne}", $"{SnSModeTwo}", true);
|
||||
Utils.ChatCommand(__instance, $"{String.SnSModeOne}", $"{String.SnSModeTwo}", true);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Utils.ChatCommand(__instance, $"{speedrunMode}", "", false);
|
||||
Utils.ChatCommand(__instance, $"{String.speedrunMode}", "", false);
|
||||
break;
|
||||
|
||||
}
|
||||
__instance.timeSinceLastMessage = 0.8f;
|
||||
__instance.freeChatField.textArea.Clear();
|
||||
__instance.freeChatField.textArea.SetText(string.Empty);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -171,7 +195,7 @@ internal static class SendChatPatch
|
||||
|
||||
if (!isKick && !isBan && !isColorKick && !isColorBan)
|
||||
{
|
||||
Logger.Info($" {PlayerControl.LocalPlayer.Data.PlayerName}: {text}", "SendChat");
|
||||
Logger.Info($" {PlayerControl.LocalPlayer.Data.PlayerName}: {msgtext}", "SendChat");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -225,8 +249,39 @@ public static class RPCHandlerPatch
|
||||
{
|
||||
case RpcCalls.SendChat:
|
||||
{
|
||||
string text = subReader.ReadString();
|
||||
Logger.Info($" {__instance.Data.PlayerName}: {text}", "SendChat");
|
||||
string msgtext = subReader.ReadString();
|
||||
string text = msgtext.ToLower();
|
||||
|
||||
Logger.Info($" {__instance.Data.PlayerName}: {msgtext}", "SendChat");
|
||||
|
||||
string[] keywords = Options.AutoKickStartStrength.GetBool() ? new[] { "start", "begin", "commence" } : new[] { "start", "begin", "commence", "s t a r t", "go" };
|
||||
|
||||
bool c = false;
|
||||
|
||||
if (Options.AutoKickStartStrength.GetBool())
|
||||
{
|
||||
c = keywords.Any(k => text.Contains(k));
|
||||
}
|
||||
else
|
||||
{
|
||||
c = keywords.Any(k => text == k);
|
||||
}
|
||||
if (c && !Utils.IsPlayerModerator(__instance.Data.FriendCode) && Options.AutoKickStart.GetBool())
|
||||
{
|
||||
int clientId = __instance.Data.ClientId;
|
||||
|
||||
if (!Main.SayStartTimes.ContainsKey(clientId))
|
||||
Main.SayStartTimes.Add(clientId, 0);
|
||||
Main.SayStartTimes[clientId]++;
|
||||
|
||||
if (Main.SayStartTimes[clientId] >= Options.AutoKickStartTimes.GetInt())
|
||||
{
|
||||
bool sBan = Options.AutoKickStartAsBan.GetBool();
|
||||
AmongUsClient.Instance.KickPlayer(clientId, sBan);
|
||||
Logger.Info($" {__instance.Data.PlayerName} was {(sBan ? "banned" : "kicked")} for saying start", "KickAnnoyingKids");
|
||||
Logger.SendInGame($" {__instance.Data.PlayerName} was {(sBan ? "banned" : "kicked")} for saying start");
|
||||
}
|
||||
}
|
||||
|
||||
if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands")
|
||||
{
|
||||
@@ -235,12 +290,12 @@ public static class RPCHandlerPatch
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
Utils.SendPrivateMessage(__instance, $"{SendChatPatch.allCommandsOne}");
|
||||
Utils.SendPrivateMessage(__instance, $"{String.allCommandsOne}");
|
||||
}, 2.2f, "MHP1");
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
Utils.SendPrivateMessage(__instance, $"{SendChatPatch.allCommandsTwo}");
|
||||
Utils.SendPrivateMessage(__instance, $"{String.allCommandsTwo}");
|
||||
}, 4.4f, "MHP2");
|
||||
|
||||
new LateTask(() =>
|
||||
@@ -259,18 +314,18 @@ public static class RPCHandlerPatch
|
||||
if (text == "/0kc" || text == "/0kcd" || text == "/0killcooldown")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.noKcdMode}", "", false);
|
||||
Utils.ModeratorChatCommand($"{String.noKcdMode}", "", false);
|
||||
}
|
||||
if (text == "/sns" || text == "/shiftandseek" || text == "/shift&seek")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.SnSModeOne}", $"{SendChatPatch.SnSModeTwo}", true);
|
||||
Utils.ModeratorChatCommand($"{String.SnSModeOne}", $"{String.SnSModeTwo}", true);
|
||||
}
|
||||
|
||||
if (text == "/sp" || text == "/sr" || text == "/speedrun")
|
||||
{
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.speedrunMode}", "", false);
|
||||
Utils.ModeratorChatCommand($"{String.speedrunMode}", "", false);
|
||||
}
|
||||
|
||||
if (text == "/r" || text == "/roles" || text == "/gamemode" || text == "/gm")
|
||||
@@ -282,15 +337,15 @@ public static class RPCHandlerPatch
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.noKcdMode}", "", false);
|
||||
Utils.ModeratorChatCommand($"{String.noKcdMode}", "", false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.SnSModeOne}", $"{SendChatPatch.SnSModeTwo}", true);
|
||||
Utils.ModeratorChatCommand($"{String.SnSModeOne}", $"{String.SnSModeTwo}", true);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Utils.ModeratorChatCommand($"{SendChatPatch.speedrunMode}", "", false);
|
||||
Utils.ModeratorChatCommand($"{String.speedrunMode}", "", false);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -317,7 +372,7 @@ public static class RPCHandlerPatch
|
||||
{
|
||||
|
||||
if (!Utils.IsPlayerModerator(__instance.Data.FriendCode)) return;
|
||||
// Banning works by name and color. Commands are seperated incase someone has a color as their name
|
||||
// Banning works by name and color. Commands are separated incase someone has a color as their name
|
||||
bool isKick = text.StartsWith("/kick ");
|
||||
bool isBan = text.StartsWith("/ban ");
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Il2CppInterop.Runtime.InteropTypes.Arrays;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
//https://github.com/Gurge44/EndlessHostRoles/blob/main/Patches/CredentialsPatch.cs
|
||||
namespace AmongUsRevamped
|
||||
@@ -123,8 +125,12 @@ namespace AmongUsRevamped
|
||||
|
||||
Sb.Append(Utils.InGame ? " - " : "\r\n");
|
||||
Sb.Append($"<color={color}>Ping: {ping}</color>");
|
||||
AppendSeparator();
|
||||
Sb.Append($"Server: {Utils.GetRegionName()}");
|
||||
|
||||
if (Utils.GetRegionName() != "")
|
||||
{
|
||||
AppendSeparator();
|
||||
Sb.Append(Utils.GetRegionName());
|
||||
}
|
||||
|
||||
if (Main.ShowFps.Value && LastFPS.Count > 0)
|
||||
{
|
||||
@@ -244,4 +250,39 @@ public static class MainMenuManagerStartPatch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !ANDROID
|
||||
[HarmonyPatch(typeof(ServerDropdown), nameof(ServerDropdown.FillServerOptions))]
|
||||
public static class ServerDropdownPatch
|
||||
{
|
||||
public static bool Prefix(ServerDropdown __instance)
|
||||
{
|
||||
if (SceneManager.GetActiveScene().name == "FindAGame") return true;
|
||||
SpriteRenderer bg = __instance.background;
|
||||
bg.size = new Vector2(4, 1);
|
||||
ServerManager sm = ServerManager.Instance;
|
||||
TranslationController tc = TranslationController.Instance;
|
||||
int totalCols = Mathf.Max(1, Mathf.CeilToInt(sm.AvailableRegions.Length / (float)5));
|
||||
int rowLimit = Mathf.Min(sm.AvailableRegions.Length, 5);
|
||||
|
||||
for (var index = 0; index < sm.AvailableRegions.Length; index++)
|
||||
{
|
||||
IRegionInfo ri = sm.AvailableRegions[index];
|
||||
var b = __instance.ButtonPool.Get<ServerListButton>();
|
||||
b.transform.localPosition = new Vector3(((index / 5) - ((totalCols - 1) / 2f)) * 3.15f, __instance.y_posButton - (0.5f * (index % 5)), -1f);
|
||||
b.Text.text = tc.GetStringWithDefault(ri.TranslateName, ri.Name, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
|
||||
b.Text.ForceMeshUpdate();
|
||||
b.Button.OnClick.RemoveAllListeners();
|
||||
b.Button.OnClick.AddListener((Action)(() => __instance.ChooseOption(ri)));
|
||||
__instance.controllerSelectable.Add(b.Button);
|
||||
}
|
||||
|
||||
float h = 1.2f + (0.5f * (rowLimit - 1));
|
||||
float w = totalCols > 1 ? (3.15f * (totalCols - 1)) + bg.size.x : bg.size.x;
|
||||
bg.transform.localPosition = new Vector3(0f, __instance.initialYPos - ((h - 1.2f) / 2f), 0f);
|
||||
bg.size = new Vector2(w, h);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -16,9 +16,14 @@ public class DiscordRPC
|
||||
{
|
||||
if (activity == null) return;
|
||||
|
||||
var details = $"AmongUsRevamped {Main.ModVersion}";
|
||||
var details = $"Revamped {Main.ModVersion}";
|
||||
activity.Details = details;
|
||||
|
||||
activity.Assets = new ActivityAssets
|
||||
{
|
||||
LargeImage = "https://i.imgur.com/cxqgNyW.png"
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
if (activity.State != "In Menus")
|
||||
@@ -31,10 +36,10 @@ public class DiscordRPC
|
||||
Region = Utils.GetRegionName();
|
||||
}
|
||||
|
||||
if (Lobbycode != "" && Region != "") details = $"AmongUsRevamped - {Lobbycode} ({Region})";
|
||||
if (Lobbycode != "" && Region != "") details = $"Revamped - {Lobbycode} ({Region})";
|
||||
}
|
||||
else
|
||||
details = $"AmongUsRevamped {Main.ModVersion}";
|
||||
details = $"Revamped {Main.ModVersion}";
|
||||
|
||||
activity.Details = details;
|
||||
}
|
||||
@@ -43,7 +48,7 @@ public class DiscordRPC
|
||||
{
|
||||
Logger.Error("Error in updating discord rpc", "DiscordPatch");
|
||||
Logger.Exception(ex, "DiscordPatch");
|
||||
details = $"AmongUsRevamped v{Main.ModVersion}";
|
||||
details = $"Revamped v{Main.ModVersion}";
|
||||
activity.Details = details;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(AmongUsDateTime), nameof(AmongUsDateTime.UtcNow), MethodType.Getter)]
|
||||
public static class AmongUsDateTime_UtcNow
|
||||
{
|
||||
public static bool Prefix(ref Il2CppSystem.DateTime __result)
|
||||
{
|
||||
if (!CreateOptionsPickerPatch.SetDleks) return true;
|
||||
|
||||
var managedDate = new DateTime(DateTime.UtcNow.Year, 4, 2, 7, 1, 0, DateTimeKind.Utc);
|
||||
__result = new Il2CppSystem.DateTime(managedDate.Ticks);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class CreateOptionsPickerPatch
|
||||
{
|
||||
public static bool SetDleks = false;
|
||||
public static bool SetDleks2;
|
||||
private static MapSelectButton DleksButton;
|
||||
[HarmonyPatch]
|
||||
public static class GameOptionsMapPickerPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(GameOptionsMapPicker), nameof(GameOptionsMapPicker.SetupMapButtons))]
|
||||
[HarmonyPostfix]
|
||||
public static void Postfix_Initialize(CreateGameMapPicker __instance)
|
||||
{
|
||||
float delay = SceneManager.GetActiveScene().name == "MainMenu" ? 0.2f : 0f;
|
||||
if (SceneManager.GetActiveScene().name == "FindAGame") return;
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
int DleksPos = 3;
|
||||
|
||||
MapSelectButton[] AllMapButton = __instance.transform.GetComponentsInChildren<MapSelectButton>();
|
||||
AllMapButton = AllMapButton.Where(x => x.gameObject.name != "DleksButton").ToArray();
|
||||
|
||||
if (AllMapButton != null)
|
||||
{
|
||||
GameObject dlekS_ehT = null;
|
||||
if (!SetDleks2 || SceneManager.GetActiveScene().name != "MainMenu")
|
||||
{
|
||||
dlekS_ehT = UnityEngine.Object.Instantiate(AllMapButton[0].gameObject, __instance.transform);
|
||||
dlekS_ehT.name = "DleksButton";
|
||||
SetDleks2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dlekS_ehT = __instance.transform.Find("DleksButton")?.gameObject;
|
||||
}
|
||||
|
||||
if (dlekS_ehT == null) return;
|
||||
dlekS_ehT.name = "DleksButton";
|
||||
dlekS_ehT.transform.position = AllMapButton[DleksPos].transform.position;
|
||||
dlekS_ehT.transform.SetSiblingIndex(DleksPos + 2);
|
||||
MapSelectButton dlekS_ehT_MapButton = dlekS_ehT.GetComponent<MapSelectButton>();
|
||||
DleksButton = dlekS_ehT_MapButton;
|
||||
|
||||
foreach (var icon in dlekS_ehT_MapButton.MapIcon)
|
||||
{
|
||||
if (icon == null || icon.transform == null) continue;
|
||||
icon.flipX = true;
|
||||
}
|
||||
dlekS_ehT_MapButton.Button.OnClick.RemoveAllListeners();
|
||||
dlekS_ehT_MapButton.Button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
|
||||
{
|
||||
__instance.SelectMap(__instance.AllMapIcons[0]);
|
||||
|
||||
if (__instance.selectedButton)
|
||||
{
|
||||
__instance.selectedButton.Button.SelectButton(false);
|
||||
}
|
||||
__instance.selectedButton = dlekS_ehT_MapButton;
|
||||
__instance.selectedButton.Button.SelectButton(true);
|
||||
__instance.selectedMapId = 3;
|
||||
|
||||
if (!Utils.isHideNSeek)
|
||||
Main.NormalOptions.MapId = 0;
|
||||
else if (Utils.isHideNSeek)
|
||||
Main.HideNSeekOptions.MapId = 0;
|
||||
|
||||
__instance.MapImage.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner.png", 100f);
|
||||
__instance.MapName.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner-Wordart.png", 100f);
|
||||
}));
|
||||
|
||||
for (int i = DleksPos; i < AllMapButton.Length; i++)
|
||||
{
|
||||
AllMapButton[i].transform.localPosition += new Vector3(0.625f, 0f, 0f);
|
||||
}
|
||||
|
||||
if (DleksButton != null)
|
||||
{
|
||||
if (SetDleks)
|
||||
{
|
||||
if (__instance.selectedButton)
|
||||
{
|
||||
__instance.selectedButton.Button.SelectButton(false);
|
||||
}
|
||||
DleksButton.Button.SelectButton(true);
|
||||
__instance.selectedButton = DleksButton;
|
||||
__instance.selectedMapId = 3;
|
||||
|
||||
__instance.MapImage.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner.png", 100f);
|
||||
__instance.MapName.sprite = Utils.LoadSprite($"AmongUsRevamped.Resources.Images.DleksBanner-Wordart.png", 100f);
|
||||
}
|
||||
else
|
||||
{
|
||||
DleksButton.Button.SelectButton(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, delay, "ApplyDleks");
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameOptionsMapPicker), nameof(GameOptionsMapPicker.FixedUpdate))]
|
||||
[HarmonyPrefix]
|
||||
public static bool Prefix_FixedUpdate(GameOptionsMapPicker __instance)
|
||||
{
|
||||
if (__instance == null) return true;
|
||||
|
||||
if (__instance.MapName == null) return false;
|
||||
|
||||
if (DleksButton != null) SetDleks = __instance.selectedMapId == 3;
|
||||
|
||||
if (__instance.selectedMapId == 3)
|
||||
{
|
||||
if (SceneManager.GetActiveScene().name == "FindAGame")
|
||||
{
|
||||
__instance.SelectMap(0);
|
||||
SetDleks = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CreateOptionsPicker), nameof(CreateOptionsPicker.Awake))]
|
||||
class MenuMapPickerPatch
|
||||
{
|
||||
public static void Postfix(CreateOptionsPicker __instance)
|
||||
{
|
||||
Transform mapPickerTransform = __instance.transform.Find("MapPicker");
|
||||
MapPickerMenu mapPickerMenu = mapPickerTransform.Find("Map Picker Menu").GetComponent<MapPickerMenu>();
|
||||
|
||||
MapFilterButton airhipIconInMenu = __instance.MapMenu.MapButtons[3];
|
||||
MapFilterButton fungleIconInMenu = __instance.MapMenu.MapButtons[4];
|
||||
MapFilterButton skeldIconInMenu = __instance.MapMenu.MapButtons[0];
|
||||
MapFilterButton dleksIconInMenuCopy = UnityEngine.Object.Instantiate(airhipIconInMenu, airhipIconInMenu.transform.parent);
|
||||
|
||||
Transform skeldMenuButton = mapPickerMenu.transform.Find("Skeld");
|
||||
Transform polusMenuButton = mapPickerMenu.transform.Find("Polus");
|
||||
Transform airshipMenuButton = mapPickerMenu.transform.Find("Airship");
|
||||
Transform fungleMenuButton = mapPickerMenu.transform.Find("Fungle");
|
||||
Transform dleksMenuButtonCopy = UnityEngine.Object.Instantiate(airshipMenuButton, airshipMenuButton.parent);
|
||||
|
||||
// Set mapid for Dleks button
|
||||
PassiveButton dleksButton = dleksMenuButtonCopy.GetComponent<PassiveButton>();
|
||||
dleksButton.OnClick.m_PersistentCalls.m_Calls._items[0].arguments.intArgument = (int)MapNames.Dleks;
|
||||
|
||||
SpriteRenderer dleksImage = dleksMenuButtonCopy.Find("Image").GetComponent<SpriteRenderer>();
|
||||
dleksImage.sprite = skeldMenuButton.Find("Image").GetComponent<SpriteRenderer>().sprite;
|
||||
|
||||
dleksIconInMenuCopy.name = "Dleks";
|
||||
dleksIconInMenuCopy.transform.localPosition = new Vector3(0.8f, airhipIconInMenu.transform.localPosition.y, airhipIconInMenu.transform.localPosition.z);
|
||||
dleksIconInMenuCopy.MapId = MapNames.Dleks;
|
||||
dleksIconInMenuCopy.Button = dleksButton;
|
||||
dleksIconInMenuCopy.ButtonCheck = dleksMenuButtonCopy.Find("selectedCheck").GetComponent<SpriteRenderer>();
|
||||
dleksIconInMenuCopy.ButtonImage = dleksImage;
|
||||
dleksIconInMenuCopy.ButtonOutline = dleksImage.transform.parent.GetComponent<SpriteRenderer>();
|
||||
dleksIconInMenuCopy.Icon.sprite = skeldIconInMenu.Icon.sprite;
|
||||
|
||||
dleksMenuButtonCopy.name = "Dleks";
|
||||
dleksMenuButtonCopy.position = new Vector3(dleksMenuButtonCopy.position.x, 2f * dleksMenuButtonCopy.position.y - polusMenuButton.transform.position.y, dleksMenuButtonCopy.position.z);
|
||||
fungleMenuButton.position = new Vector3(fungleMenuButton.position.x, dleksMenuButtonCopy.transform.position.y - 0.6f, fungleMenuButton.position.z);
|
||||
|
||||
__instance.MapMenu.MapButtons = HarmonyLib.CollectionExtensions.AddItem(__instance.MapMenu.MapButtons, dleksIconInMenuCopy).ToArray();
|
||||
|
||||
float xPos = -1f;
|
||||
for (int index = 0; index < 6; ++index)
|
||||
{
|
||||
__instance.MapMenu.MapButtons[index].transform.SetLocalX(xPos);
|
||||
xPos += 0.34f;
|
||||
}
|
||||
|
||||
if (__instance.mode == SettingsMode.Host)
|
||||
{
|
||||
mapPickerMenu.transform.localPosition = new Vector3(mapPickerMenu.transform.localPosition.x, 0.85f, mapPickerMenu.transform.localPosition.z);
|
||||
|
||||
mapPickerTransform.localScale = new Vector3(0.86f, 0.85f, 1f);
|
||||
mapPickerTransform.transform.localPosition = new Vector3(mapPickerTransform.transform.localPosition.x + 0.05f, mapPickerTransform.transform.localPosition.y + 0.03f, mapPickerTransform.transform.localPosition.z);
|
||||
}
|
||||
|
||||
SwapIconOrButtomsPositions(airhipIconInMenu, dleksIconInMenuCopy);
|
||||
SwapIconOrButtomsPositions(fungleIconInMenu, airhipIconInMenu);
|
||||
|
||||
SwapIconOrButtomsPositions(airshipMenuButton, dleksMenuButtonCopy);
|
||||
|
||||
__instance.MapMenu.MapButtons[5].SetFlipped(true);
|
||||
|
||||
mapPickerMenu.transform.Find("Backdrop").localScale *= 5;
|
||||
}
|
||||
private static void SwapIconOrButtomsPositions(Component one, Component two)
|
||||
{
|
||||
Transform transform1 = one.transform;
|
||||
Transform transform2 = two.transform;
|
||||
Vector3 position1 = two.transform.position;
|
||||
Vector3 position2 = one.transform.position;
|
||||
transform1.position = position1;
|
||||
transform2.position = position2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,21 +39,24 @@ class NormalGameEndChecker
|
||||
ImpCheckComplete = true;
|
||||
}
|
||||
|
||||
var customRoles = CustomRoleManagement.PlayerToCustomRole();
|
||||
var impostorList = string.Join(", ", imps.Select(p => p.Data.PlayerName));
|
||||
|
||||
if (Utils.AliveImpostors == 0)
|
||||
{
|
||||
LastWinReason = $"★ Crewmates win!\n\nImpostors:\n" + string.Join("\n", imps.Select(p => p.Data.PlayerName));
|
||||
LastWinReason = $"Crewmates win!\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
}
|
||||
else if (Utils.AliveImpostors >= Utils.AliveCrewmates)
|
||||
{
|
||||
LastWinReason = $"★ Impostors win!\n\nImpostors:\n★" + string.Join("\n★", imps.Select(p => p.Data.PlayerName));
|
||||
LastWinReason = $"Impostors win!\n\nImpostor: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
}
|
||||
else if (GameData.Instance != null && GameData.Instance.TotalTasks > 0 && GameData.Instance.CompletedTasks >= GameData.Instance.TotalTasks)
|
||||
{
|
||||
LastWinReason = $"★ Crewmates win! (Tasks)\n\nImpostors:\n" + string.Join("\n", imps.Select(p => p.Data.PlayerName));
|
||||
LastWinReason = $"Crewmates win! (Tasks)\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
}
|
||||
else if (Options.Gamemode.GetValue() < 2)
|
||||
{
|
||||
LastWinReason = $"★ Impostors win! (Sabotage)\n\nImpostors:\n★" + string.Join("\n★", imps.Select(p => p.Data.PlayerName));
|
||||
LastWinReason = $"Impostors win! (Sabotage)\n\nImpostors: {impostorList}" + (string.IsNullOrEmpty(customRoles) ? "" : "\n\n" + customRoles);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
class ExileControllerWrapUpPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(ExileController), nameof(ExileController.WrapUp))]
|
||||
class ExileControllerPatch
|
||||
{
|
||||
public static void Postfix(ExileController __instance)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
var ejectedPlayer = __instance.initData?.networkedPlayer;
|
||||
if (ejectedPlayer == null) return;
|
||||
|
||||
PlayerControl pc = null;
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.PlayerId == ejectedPlayer.PlayerId)
|
||||
{
|
||||
pc = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Info($" {ejectedPlayer.PlayerName} was ejected", "ExileController");
|
||||
|
||||
if (!CustomRoleManagement.PlayerRoles.TryGetValue(ejectedPlayer.PlayerId, out var role)) return;
|
||||
|
||||
if (role == "Jester")
|
||||
{
|
||||
Utils.CustomWinnerEndGame(pc, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
using System;
|
||||
using Il2CppSystem.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
#if ANDROID
|
||||
using System.Collections.Generic;
|
||||
#else
|
||||
using Il2CppSystem.Collections.Generic;
|
||||
#endif
|
||||
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
// https://github.com/Yumenopai/TownOfHost_Y/blob/main/Patches/GameOptionsPatch.cs
|
||||
|
||||
@@ -12,22 +12,18 @@ public static class GameStartManagerUpdatePatch
|
||||
|
||||
public static void Prefix(GameStartManager __instance)
|
||||
{
|
||||
if (!GameStartManager.InstanceExists || AmongUsClient.Instance == null || !AmongUsClient.Instance.AmHost) return;
|
||||
if (__instance == null || MeetingHud.Instance != null) return;
|
||||
if (AmongUsClient.Instance == null || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
var data = GameData.Instance;
|
||||
if (__instance.StartButton == null || __instance.GameStartText == null) return;
|
||||
|
||||
__instance.MinPlayers = 1;
|
||||
|
||||
if (Main.AutoStart.Value && OnGameJoinedPatch.AutoStartCheck && GameStartManager.InstanceExists && GameStartManager.Instance.startState != GameStartManager.StartingStates.Countdown && data != null && data.PlayerCount >= Options.PlayerAutoStart.GetInt())
|
||||
if (Main.AutoStart.Value && OnGameJoinedPatch.AutoStartCheck && GameStartManager.InstanceExists && __instance.startState != GameStartManager.StartingStates.Countdown && GameData.Instance?.PlayerCount >= Options.PlayerAutoStart.GetInt())
|
||||
{
|
||||
GameStartManager.Instance.startState = GameStartManager.StartingStates.Countdown;
|
||||
GameStartManager.Instance.countDownTimer = Options.AutoStartTimer.GetFloat();
|
||||
|
||||
var sb = GameStartManager.Instance?.StartButton;
|
||||
if (sb != null)
|
||||
{
|
||||
sb.gameObject.SetActive(false);
|
||||
}
|
||||
__instance.startState = GameStartManager.StartingStates.Countdown;
|
||||
__instance.countDownTimer = Options.AutoStartTimer.GetFloat();
|
||||
__instance.StartButton.gameObject.SetActive(false);
|
||||
Autostarting = true;
|
||||
}
|
||||
|
||||
@@ -35,7 +31,6 @@ public static class GameStartManagerUpdatePatch
|
||||
{
|
||||
__instance.countDownTimer = Options.StartCountdown.GetInt();
|
||||
CustomTimerApplied = true;
|
||||
|
||||
}
|
||||
|
||||
if (__instance.startState != GameStartManager.StartingStates.Countdown)
|
||||
@@ -49,7 +44,10 @@ public static class GameStartManagerUpdatePatch
|
||||
{
|
||||
string warningMessage = "";
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
if (__instance == null || MeetingHud.Instance != null) return;
|
||||
if (AmongUsClient.Instance == null || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (__instance.StartButton == null || __instance.GameStartText == null) return;
|
||||
|
||||
if (GameStartManagerStartPatch.warningText != null)
|
||||
{
|
||||
@@ -80,40 +78,32 @@ public static class GameStartManagerUpdatePatch
|
||||
public class GameStartManagerStartPatch
|
||||
{
|
||||
public static TextMeshPro warningText;
|
||||
private static Vector3 GameStartTextlocalPosition;
|
||||
public static PassiveButton cancelButton;
|
||||
|
||||
public static void Postfix(GameStartManager __instance)
|
||||
{
|
||||
if (__instance == null || !Utils.IsLobby) return;
|
||||
|
||||
warningText = UnityEngine.Object.Instantiate(__instance.GameStartText, __instance.transform.parent);
|
||||
warningText.name = "WarningText";
|
||||
warningText.transform.localPosition = new(0f, __instance.transform.localPosition.y + 3f, -1f);
|
||||
warningText.transform.localPosition = new Vector3(0f, __instance.transform.localPosition.y + 3f, -1f);
|
||||
warningText.gameObject.SetActive(false);
|
||||
|
||||
cancelButton = UnityEngine.Object.Instantiate(__instance.StartButton, __instance.transform);
|
||||
cancelButton.name = "CancelButton";
|
||||
|
||||
var cancelLabel = cancelButton.buttonText;
|
||||
cancelLabel.DestroyTranslator();
|
||||
cancelLabel.text = "Cancel";
|
||||
//cancelButton.transform.localScale = new(0.5f, 0.5f, 1f);
|
||||
var cancelButtonInactiveRenderer = cancelButton.inactiveSprites.GetComponent<SpriteRenderer>();
|
||||
cancelButtonInactiveRenderer.color = new(0.8f, 0f, 0f, 1f);
|
||||
var cancelButtonActiveRenderer = cancelButton.activeSprites.GetComponent<SpriteRenderer>();
|
||||
cancelButtonActiveRenderer.color = Color.red;
|
||||
var cancelButtonInactiveShine = cancelButton.inactiveSprites.transform.Find("Shine");
|
||||
if (cancelButtonInactiveShine)
|
||||
{
|
||||
cancelButtonInactiveShine.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
cancelButton.activeTextColor = cancelButton.inactiveTextColor = Color.white;
|
||||
//cancelButton.transform.localPosition = new(2f, 0.13f, 0f);
|
||||
GameStartTextlocalPosition = __instance.GameStartText.transform.localPosition;
|
||||
cancelButton.gameObject.SetActive(false);
|
||||
|
||||
cancelButton.OnClick = new();
|
||||
cancelButton.OnClick.AddListener((UnityEngine.Events.UnityAction)(() =>
|
||||
{
|
||||
__instance.ResetStartState();
|
||||
}));
|
||||
cancelButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(HudManager), nameof(HudManager.CoShowIntro))]
|
||||
internal static class CoShowIntroPatch
|
||||
{
|
||||
public static void Postfix(IntroCutscene __instance)
|
||||
{
|
||||
Logger.Info("Intro initiated", "CoShowIntro");
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if ((Options.Gamemode.GetValue() == 0 || Options.Gamemode.GetValue() == 1) && !Utils.isHideNSeek)
|
||||
{
|
||||
CustomRoleManagement.AssignRoles();
|
||||
}
|
||||
|
||||
CustomRoleManagement.SendRoleMessages(new Dictionary<string, string>
|
||||
{
|
||||
{ "Jester", $"{String.Jester}"},
|
||||
{ "Mayor", $"{String.Mayor}"}
|
||||
});
|
||||
|
||||
if (!Utils.isHideNSeek) return;
|
||||
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data.Role.TeamType == RoleTeamTypes.Impostor)
|
||||
{
|
||||
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ internal static class OnGameJoinedPatch
|
||||
public static bool AutoStartCheck;
|
||||
public static void Postfix()
|
||||
{
|
||||
Logger.Info(" -------- JOINED GAME --------", "OnGameJoined");
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
WaitingForChat = false;
|
||||
@@ -78,7 +80,7 @@ class OnPlayerJoinedPatch
|
||||
{
|
||||
BanManager.CheckBanPlayer(Client);
|
||||
|
||||
Utils.IsPlayerInDenyName(Client, Client.PlayerName);
|
||||
BanManager.IsPlayerInDenyName(Client, Client.PlayerName);
|
||||
|
||||
if (Utils.IsPlayerModerator(Client.FriendCode) && Options.ApplyModeratorList.GetBool())
|
||||
{
|
||||
|
||||
+31
-1
@@ -1,4 +1,5 @@
|
||||
using InnerNet;
|
||||
using Il2CppSystem.Collections;
|
||||
using InnerNet;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -25,4 +26,33 @@ internal static class LobbyBehaviourUpdatePatch
|
||||
SoundManager.Instance.CrossFadeSound("MapTheme", __instance.MapTheme, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(LobbyBehaviour), nameof(LobbyBehaviour.Start))]
|
||||
public class LobbyStartPatch
|
||||
{
|
||||
private static GameObject LobbyPaintObject;
|
||||
private static Sprite LobbyPaintSprite;
|
||||
|
||||
public static void Prefix()
|
||||
{
|
||||
LobbyPaintSprite = Utils.LoadSprite("AmongUsRevamped.Resources.Images.doger.png", 290f);
|
||||
}
|
||||
|
||||
public static void Postfix(LobbyBehaviour __instance)
|
||||
{
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
var LeftBox = GameObject.Find("Leftbox");
|
||||
if (LeftBox != null)
|
||||
{
|
||||
LobbyPaintObject = UnityEngine.Object.Instantiate(LeftBox, LeftBox.transform.parent);
|
||||
LobbyPaintObject.name = "Lobby Paint";
|
||||
LobbyPaintObject.transform.localPosition = new Vector3(0.042f, -2.59f, -10.5f);
|
||||
|
||||
SpriteRenderer renderer = LobbyPaintObject.GetComponent<SpriteRenderer>();
|
||||
renderer.sprite = LobbyPaintSprite;
|
||||
}
|
||||
}, 0.25f, "Co Load Dropship Decorations");
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,32 @@
|
||||
using AmongUs.GameOptions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
// https://github.com/astra1dev/AUnlocker/blob/main/src/OptionsPatches.cs
|
||||
|
||||
[HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Increase))]
|
||||
public static class NumberOption_Increase
|
||||
{
|
||||
public static bool Prefix(NumberOption __instance)
|
||||
{
|
||||
if (ModGameOptionsMenu.TabIndex >= 3) return true;
|
||||
float increment = Hotkeys.IncrementMultiplier * __instance.Increment;
|
||||
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
{
|
||||
__instance.Value += __instance.Increment;
|
||||
__instance.UpdateValue();
|
||||
__instance.OnValueChanged.Invoke(__instance);
|
||||
__instance.AdjustButtonsActiveState();
|
||||
return false;
|
||||
|
||||
if (__instance.Value + increment > __instance.ValidRange.max)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.Value += increment;
|
||||
__instance.UpdateValue();
|
||||
__instance.OnValueChanged.Invoke(__instance);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,17 +35,23 @@ public static class NumberOption_Decrease
|
||||
{
|
||||
public static bool Prefix(NumberOption __instance)
|
||||
{
|
||||
if (ModGameOptionsMenu.TabIndex >= 3) return true;
|
||||
float increment = Hotkeys.IncrementMultiplier * __instance.Increment;
|
||||
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
{
|
||||
__instance.Value -= __instance.Increment;
|
||||
__instance.UpdateValue();
|
||||
__instance.OnValueChanged.Invoke(__instance);
|
||||
__instance.AdjustButtonsActiveState();
|
||||
return false;
|
||||
if (__instance.Value - increment < __instance.ValidRange.min)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.Value -= increment;
|
||||
__instance.UpdateValue();
|
||||
__instance.OnValueChanged.Invoke(__instance);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +62,29 @@ public static class NumberOption_Initialize
|
||||
{
|
||||
if (ModGameOptionsMenu.TabIndex >= 3) return;
|
||||
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
if (Utils.isHideNSeek || Utils.IsLobby && !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
{
|
||||
__instance.ValidRange = new FloatRange(-900f, 900f);
|
||||
__instance.ValidRange = new FloatRange(0f, 900f);
|
||||
}
|
||||
|
||||
switch (__instance.Title)
|
||||
{
|
||||
case StringNames.GameVotingTime:
|
||||
case StringNames.GameDiscussTime:
|
||||
__instance.Increment = 5f;
|
||||
break;
|
||||
case StringNames.GameKillCooldown:
|
||||
__instance.Increment = 0.5f;
|
||||
break;
|
||||
case StringNames.GamePlayerSpeed:
|
||||
case StringNames.GameCrewLight:
|
||||
case StringNames.GameImpostorLight:
|
||||
__instance.Increment = 0.05f;
|
||||
break;
|
||||
|
||||
default:
|
||||
__instance.Increment = 1f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.CoStartGame))]
|
||||
internal class ApplyCustomImpostorCount
|
||||
internal class CoStartGamePatch
|
||||
{
|
||||
public static void Postfix(AmongUsClient __instance)
|
||||
{
|
||||
@@ -67,28 +67,11 @@ internal class ApplyCustomImpostorCount
|
||||
(candidates[i], candidates[j]) = (candidates[j], candidates[i]);
|
||||
}
|
||||
|
||||
// 1st RpcSetRole forces the role on that user. 2nd is needed to allow them to kill.
|
||||
for (int i = 0; i < toAdd; i++)
|
||||
{
|
||||
var player = candidates[i];
|
||||
|
||||
player.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false);
|
||||
|
||||
foreach (var p in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (p.Data.Role.TeamType == RoleTeamTypes.Impostor)
|
||||
{
|
||||
new LateTask(() =>
|
||||
{
|
||||
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false);
|
||||
}, 5f, "HNS Secondary RPCSetRole");
|
||||
|
||||
new LateTask(() =>
|
||||
{
|
||||
p.RpcSetRole(AmongUs.GameOptions.RoleTypes.Impostor, false);
|
||||
}, 9f, "HNS Tertiary RPCSetRole");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ class ReportDeadBodyPatch
|
||||
{
|
||||
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] NetworkedPlayerInfo target)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
if (!AmongUsClient.Instance.AmHost || target == null || __instance == null) return true;
|
||||
|
||||
if (Options.DisableReport.GetBool() && target != null || Options.Gamemode.GetValue() == 2 || Options.Gamemode.GetValue() == 3)
|
||||
if (Options.DisableReport.GetBool() || Options.Gamemode.GetValue() == 2 || Options.Gamemode.GetValue() == 3)
|
||||
{
|
||||
Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch");
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@ internal static class AddVotePatch
|
||||
|
||||
Logger.Info($" Kicked {target.Data.PlayerName}, {target.Data.FriendCode}", "KickPatch");
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<img src="https://github.com/astra1dev/AUnlocker/assets/90265231/14226f03-a003-4efc-b27b-6df53fb394d6" width=410 height=240>****
|
||||
|
||||
|
||||
# 🎮 Features (v1.2.1):
|
||||
# 🎮 Features (v1.4.0):
|
||||
- <b>🔶 Client Side settings:</b>
|
||||
- Game Master
|
||||
- Unlock FPS
|
||||
@@ -45,6 +45,7 @@
|
||||
- Moderator system
|
||||
- Banlist system
|
||||
- Enable No Game End
|
||||
- Custom starting countdown
|
||||
- <b>🔶 Automation settings:</b>
|
||||
- Auto start game and conditions for it
|
||||
- Auto rejoin lobby
|
||||
@@ -53,30 +54,51 @@
|
||||
- Disable critical sabotages
|
||||
- Disable door sabotages
|
||||
- Disable body reporting
|
||||
- Enable/Disable any desired tasks
|
||||
- Enable/Disable any task
|
||||
- All players have same tasks
|
||||
- Hide and Seek: Custom Impostor count
|
||||
- <b>🔶 Custom Gamemodes:</b>
|
||||
- 0 Kill Cooldown
|
||||
- Shift and Seek
|
||||
- Speedrun
|
||||
- <b>🔷 Extra features:</b>
|
||||
- Shift + L + Enter - Force End Game
|
||||
- Shift + M + Enter - Force Call/Close Meeting
|
||||
- /help command
|
||||
- Specific gamemode info commands -> /0kc, /sns, /sp
|
||||
- Current gamemode info command -> /r
|
||||
- <b>🔷 Other:</b>
|
||||
- Ability to cancel starting countdown
|
||||
- Improved main menu
|
||||
- Custom anticheat system
|
||||
- Zoom out in lobby or when dead
|
||||
- Unlimited default Option ranges
|
||||
- Logging for useful information
|
||||
|
||||
- <b>🎉 And this all without Modded Protocol!</b>
|
||||
|
||||
### Hotkeys
|
||||
| HotKey | Function | Usable Scene |
|
||||
| ------------------- | ------------------------------------------- | ---------------------------------- |
|
||||
| `Shift`+`L`+`Enter` | Force End Game | In Game |
|
||||
| `Shift`+`M`+`Enter` | Skip meeting or call meeting | In Game |
|
||||
| `C` | Cancel game start | In Countdown |
|
||||
| `Shift` | Start the game immediately | In Countdown |
|
||||
| `Ctrl` | Noclip in lobby | In Lobby |
|
||||
|
||||
### Chat Commands
|
||||
| Command | Function |
|
||||
| ------------------------------------------- | ------------------------------------------------- |
|
||||
| /h<br>/help | Show command help |
|
||||
| /l<br>/win | Show winner |
|
||||
| /r | Show current gamemode/roles description |
|
||||
| /0kc<br>/sns</br>/sp | Show respective gamemode description |
|
||||
| /ban <name> | Ban a player by name |
|
||||
| /kick <name> | Kick a player by name |
|
||||
| /cban <color> | Ban a player by color |
|
||||
| /ckick <color> | Kick a player by color |
|
||||
| /dump | Copy your LogOutput file |
|
||||
| /color <color> | Set color |
|
||||
|
||||
|
||||
**Credit to these mods and their developers for their code:**
|
||||
### :star: [AUnlocker](https://github.com/astra1dev/AUnlocker)
|
||||
> - NumberOptionsPatch
|
||||
### :star: [EHR (Formerly TOHE+)](https://github.com/Gurge44/EndlessHostRoles)
|
||||
> - Dark Theme
|
||||
> - Task Patching
|
||||
### :star: [TOH](https://github.com/tukasa0001/TownOfHost) :
|
||||
> - Ban Manager
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
@@ -0,0 +1,43 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
// Used post-1.4.0 incase AUR ever gets translations. Not fully updated.
|
||||
|
||||
/* TEMPLATE
|
||||
|
||||
public static string x{get{
|
||||
return $"y";}}
|
||||
*/
|
||||
public static class String
|
||||
{
|
||||
public static string noKcdMode{get{
|
||||
return $"0 Kill Cooldown:\n\nImpostors have no kill cooldown, Crewmates have low tasks\nThink fast and pay attention!";}}
|
||||
|
||||
public static string SnSModeOne{get{
|
||||
return $"Shift and Seek:\n\nImpostors can only kill someone while shapeshifted as them\nSabotages & Meetings = Off";}}
|
||||
|
||||
public static string SnSModeTwo{get{
|
||||
return $"Crew wins by tasks/surviving {Options.CrewAutoWinsGameAfter.GetInt()}s\n" + "Imp wins by killing\n" + (Options.MisfiresToSuicide.GetInt() == 1 ? "" : $"One wrong kill = Can't kill for {Options.CantKillTime.GetInt()}s\n") + $"{Utils.BasicIntToWord(Options.MisfiresToSuicide.GetInt())} wrong kill{(Options.MisfiresToSuicide.GetInt() == 1 ? "" : "s")} = suicide";}}
|
||||
|
||||
public static string speedrunMode{get{
|
||||
return $"Speedrun:\n\nEveryone is a crewmate. The 1st player to finish tasks wins the game. Game auto ends after {Options.GameAutoEndsAfter.GetInt()}s";}}
|
||||
|
||||
public static string allCommandsFull{get{
|
||||
return $"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";}}
|
||||
|
||||
public static string allCommandsOne{get{
|
||||
return $"Commands:\n/r - Current mode description\n/0kc, /sns, /sp - Specific mode description\n/l - Shows last winner info";}}
|
||||
|
||||
public static string allCommandsTwo{get{
|
||||
return $"/kick, /ban - Bans or kicks a player by name\n/ckick, /cban - Bans or kicks a player by color";}}
|
||||
|
||||
public static string SocialsAll{get{
|
||||
return $"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";}}
|
||||
|
||||
public static string Mayor{get{
|
||||
return $"PRIVATE:\n\nYour role is Mayor!\n\nYou are a crewmate with i total votes. Use your voting power to eject Impostors.";}}
|
||||
|
||||
public static string Jester{get{
|
||||
return $"PRIVATE:\n\nYour role is Jester!\nYou are NOT a crewmate!\n\nYou win by getting voted. Act as suspicious as possible.";}}
|
||||
}
|
||||
Reference in new issue
Block a user