Compare commits

...
8 Commits
Author SHA1 Message Date
Ape 95106ddeeb Settings and settings + settings, settings 2026-02-12 23:19:07 +01:00
Ape f4c157153a Merge branch 'main' of https://github.com/ApeMV/AmongUsRevamped 2026-02-05 14:23:15 +01:00
Ape 84978edc99 Tiniest fixes ever and buttons 2026-02-05 14:23:10 +01:00
Ape 23715a848d Meow 2026-02-05 11:58:23 +01:00
Ape a7cec7787f 1.5.1 readme 2026-02-05 11:54:42 +01:00
Ape 02f7ddc63a Custom role fixes, small setting fix, winner text change 2026-02-02 20:41:26 +01:00
Ape 600234b5f2 Discodr icon 2026-02-02 15:18:40 +01:00
Ape 15d6f54982 Better options, String fix, HnS fix 2026-02-02 14:10:50 +01:00
25 changed files with 929 additions and 176 deletions

No files matched your search

+4 -1
View File
@@ -1,6 +1,7 @@
global using HarmonyLib;
global using System.Collections.Generic;
global using System.Linq;
global using Object = UnityEngine.Object;
using AmongUs.GameOptions;
using BepInEx;
@@ -37,9 +38,11 @@ public partial class Main : BasePlugin
public static NormalGameOptionsV10 NormalOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentNormalGameOptions : null;
public static HideNSeekGameOptionsV10 HideNSeekOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentHideNSeekGameOptions : null;
public static MapNames CurrentMap => (MapNames)NormalOptions.MapId;
public static bool HasArgumentException;
public static string CredentialsText;
public const string ModVersion = "v1.5.0";
public const string ModVersion = "v1.5.2";
public static float GameTimer;
+5
View File
@@ -8,6 +8,11 @@
<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>
+184 -6
View File
@@ -99,12 +99,46 @@ namespace AmongUsRevamped
public static OptionItem NoGameEnd;
//Gameplay
public static OptionItem TabGroupGameplayGeneral;
public static OptionItem TabGroupSabotages;
public static OptionItem DisableSabotage;
public static OptionItem DisableReactor;
public static OptionItem DisableOxygen;
public static OptionItem DisableLights;
public static OptionItem DisableComms;
public static OptionItem DisableHeli;
public static OptionItem DisableMushroomMixup;
public static OptionItem DisableCloseDoor;
public static OptionItem TabGroupGameplayGeneral;
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 DisableDevices;
private static OptionItem DisableSkeldDevices;
public static OptionItem DisableSkeldAdmin;
public static OptionItem DisableSkeldCamera;
private static OptionItem DisableMiraHQDevices;
public static OptionItem DisableMiraHQAdmin;
public static OptionItem DisableMiraHQDoorLog;
private static OptionItem DisablePolusDevices;
public static OptionItem DisablePolusAdmin;
public static OptionItem DisablePolusCamera;
public static OptionItem DisablePolusVital;
private static OptionItem DisableAirshipDevices;
public static OptionItem DisableAirshipCockpitAdmin;
public static OptionItem DisableAirshipRecordsAdmin;
public static OptionItem DisableAirshipCamera;
public static OptionItem DisableAirshipVital;
private static OptionItem DisableFungleDevices;
public static OptionItem DisableFungleCamera;
public static OptionItem DisableFungleVital;
public static OptionItem TabGroupTasks;
public static OptionItem OverrideTaskSettings;
@@ -226,6 +260,14 @@ namespace AmongUsRevamped
public static OptionItem CrewAutoWinsGameAfter;
public static OptionItem CantKillTime;
public static OptionItem MisfiresToSuicide;
public static OptionItem SNSDisableSabotage;
public static OptionItem SNSDisableReactor;
public static OptionItem SNSDisableOxygen;
public static OptionItem SNSDisableLights;
public static OptionItem SNSDisableComms;
public static OptionItem SNSDisableHeli;
public static OptionItem SNSDisableMushroomMixup;
public static OptionItem SNSDisableCloseDoor;
public static OptionItem TabGroupSpeedrun;
public static OptionItem SpeedrunSettingsOverride;
@@ -341,6 +383,28 @@ namespace AmongUsRevamped
MisfiresToSuicide = IntegerOptionItem.Create(70052, "Suicide After Amount Of Misfires", new(1, 10, 1), 2, TabGroup.GamemodeSettings, false);
CrewAutoWinsGameAfter = IntegerOptionItem.Create(70054, "Crewmates Automatically Win After", new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
.SetValueFormat(OptionFormat.Seconds);
SNSDisableSabotage = BooleanOptionItem.Create(70055, "Disable SnS Critical Sabotages", true, TabGroup.GamemodeSettings, false)
.SetColor(Color.red);
SNSDisableReactor = BooleanOptionItem.Create(70056, "Disable Reactor Sabotage", true, TabGroup.GamemodeSettings, false)
.SetParent(SNSDisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
SNSDisableOxygen = BooleanOptionItem.Create(70057, "Disable O2 Sabotage", true, TabGroup.GamemodeSettings, false)
.SetParent(SNSDisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
SNSDisableLights = BooleanOptionItem.Create(70058, "Disable Lights Sabotage", true, TabGroup.GamemodeSettings, false)
.SetParent(SNSDisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
SNSDisableComms = BooleanOptionItem.Create(70059, "Disable Communications Sabotage", true, TabGroup.GamemodeSettings, false)
.SetParent(SNSDisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
SNSDisableHeli = BooleanOptionItem.Create(70060, "Disable Crash Course Sabotage", true, TabGroup.GamemodeSettings, false)
.SetParent(SNSDisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
SNSDisableMushroomMixup = BooleanOptionItem.Create(70061, "Disable Mushroom Mixup Sabotage", true, TabGroup.GamemodeSettings, false)
.SetParent(SNSDisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
SNSDisableCloseDoor = BooleanOptionItem.Create(70062, "Disable SnS Door Sabotages", true, TabGroup.GamemodeSettings, false)
.SetColor(Color.red);
TabGroupSpeedrun = TextOptionItem.Create(70075, "Speedrun", TabGroup.GamemodeSettings)
.SetColor(Color.blue);
@@ -348,15 +412,129 @@ namespace AmongUsRevamped
GameAutoEndsAfter = IntegerOptionItem.Create(70077, "Game automatically ends after", new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
.SetValueFormat(OptionFormat.Seconds);
// Gameplay Settings
TabGroupGameplayGeneral = TextOptionItem.Create(60564, "General", TabGroup.ModSettings)
.SetColor(Color.blue);
DisableSabotage = BooleanOptionItem.Create(60565, "Disable Critical Sabotages", false, TabGroup.ModSettings, false)
TabGroupSabotages = TextOptionItem.Create(60455, "Sabotages", TabGroup.ModSettings)
.SetColor(Color.red);
DisableSabotage = BooleanOptionItem.Create(60456, "Disable Critical Sabotages", false, TabGroup.ModSettings, false)
.SetColor(Color.red);
DisableReactor = BooleanOptionItem.Create(60457, "Disable Reactor Sabotage", false, TabGroup.ModSettings, false)
.SetParent(DisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableOxygen = BooleanOptionItem.Create(60458, "Disable O2 Sabotage", false, TabGroup.ModSettings, false)
.SetParent(DisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableLights = BooleanOptionItem.Create(60459, "Disable Lights Sabotage", false, TabGroup.ModSettings, false)
.SetParent(DisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableComms = BooleanOptionItem.Create(60460, "Disable Communications Sabotage", false, TabGroup.ModSettings, false)
.SetParent(DisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableHeli = BooleanOptionItem.Create(60461, "Disable Crash Course Sabotage", false, TabGroup.ModSettings, false)
.SetParent(DisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableMushroomMixup = BooleanOptionItem.Create(60462, "Disable Mushroom Mixup Sabotage", false, TabGroup.ModSettings, false)
.SetParent(DisableSabotage)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableCloseDoor = BooleanOptionItem.Create(60566, "Disable Door Sabotages", false, TabGroup.ModSettings, false)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
.SetColor(Color.red);
TabGroupGameplayGeneral = TextOptionItem.Create(60564, "General", TabGroup.ModSettings)
.SetColor(Color.blue);
DisableReport = BooleanOptionItem.Create(60520, "Disable Body Reports", false, TabGroup.ModSettings, false)
.SetColor(Color.blue);
ChangeDecontaminationTime = BooleanOptionItem.Create(60550, "Override Decontamination Time", false, TabGroup.ModSettings, false)
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
DecontaminationTimeOnMiraHQ = FloatOptionItem.Create(60551, "Mira HQ Decon Duration", new(0.5f, 10f, 0.25f), 3f, TabGroup.ModSettings, false)
.SetParent(ChangeDecontaminationTime)
.SetValueFormat(OptionFormat.Seconds)
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
DecontaminationDoorOpenTimeOnMiraHQ = FloatOptionItem.Create(60552, "Mira HQ Door Open Duration", new(0.5f, 10f, 0.25f), 3f, TabGroup.ModSettings, false)
.SetParent(ChangeDecontaminationTime)
.SetValueFormat(OptionFormat.Seconds)
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
DecontaminationTimeOnPolus = FloatOptionItem.Create(60553, "Polus Decon Duration", new(0.5f, 10f, 0.25f), 3f, TabGroup.ModSettings, false)
.SetParent(ChangeDecontaminationTime)
.SetValueFormat(OptionFormat.Seconds)
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
DecontaminationDoorOpenTimeOnPolus = FloatOptionItem.Create(60554, "Polus Door Open Duration", new(0.5f, 10f, 0.25f), 3f, TabGroup.ModSettings, false)
.SetParent(ChangeDecontaminationTime)
.SetValueFormat(OptionFormat.Seconds)
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
DisableDevices = BooleanOptionItem.Create(22900, "Disable Devices", false, TabGroup.ModSettings, false)
.SetColor(Color.red);
DisableSkeldDevices = BooleanOptionItem.Create(22905, "Disable Skeld Devices", false, TabGroup.ModSettings, false)
.SetParent(DisableDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableSkeldAdmin = BooleanOptionItem.Create(22906, "Disable Skeld Admin", false, TabGroup.ModSettings, false)
.SetParent(DisableSkeldDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableSkeldCamera = BooleanOptionItem.Create(22907, "Disable Skeld Camera", false, TabGroup.ModSettings, false)
.SetParent(DisableSkeldDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableMiraHQDevices = BooleanOptionItem.Create(22908, "Disable Mira HQ Devices", false, TabGroup.ModSettings, false)
.SetParent(DisableDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableMiraHQAdmin = BooleanOptionItem.Create(22909, "Disable Mira HQ Admin", false, TabGroup.ModSettings, false)
.SetParent(DisableMiraHQDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableMiraHQDoorLog = BooleanOptionItem.Create(22910, "Disable Mira HQ DoorLogs", false, TabGroup.ModSettings, false)
.SetParent(DisableMiraHQDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisablePolusDevices = BooleanOptionItem.Create(22911, "Disable Polus Devices", false, TabGroup.ModSettings, false)
.SetParent(DisableDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisablePolusAdmin = BooleanOptionItem.Create(22912, "Disable Polus Admin", false, TabGroup.ModSettings, false)
.SetParent(DisablePolusDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisablePolusCamera = BooleanOptionItem.Create(22913, "Disable Polus Camera", false, TabGroup.ModSettings, false)
.SetParent(DisablePolusDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisablePolusVital = BooleanOptionItem.Create(22914, "Disable Polus Vitals", false, TabGroup.ModSettings, false)
.SetParent(DisablePolusDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableAirshipDevices = BooleanOptionItem.Create(22915, "Disable Airship Devices", false, TabGroup.ModSettings, false)
.SetParent(DisableDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableAirshipCockpitAdmin = BooleanOptionItem.Create(22916, "Disable Airship Cockpit Admin", false, TabGroup.ModSettings, false)
.SetParent(DisableAirshipDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableAirshipRecordsAdmin = BooleanOptionItem.Create(22917, "Disable Airship Records Admin", false, TabGroup.ModSettings, false)
.SetParent(DisableAirshipDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableAirshipCamera = BooleanOptionItem.Create(22918, "Disable Airship Camera", false, TabGroup.ModSettings, false)
.SetParent(DisableAirshipDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableAirshipVital = BooleanOptionItem.Create(22919, "Disable Airship Vitals", false, TabGroup.ModSettings, false)
.SetParent(DisableAirshipDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableFungleDevices = BooleanOptionItem.Create(22925, "Disable Fungle Devices", 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)
.SetParent(DisableFungleDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
DisableFungleVital = BooleanOptionItem.Create(22927, "Disable Fungle Vitals", false, TabGroup.ModSettings, false)
.SetParent(DisableFungleDevices)
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
+68 -20
View File
@@ -14,50 +14,47 @@ public static class CustomRoleManagement
{
// crewmateRoles = assigned with crewmate role base
// impostorRoles = assigned with impostor role base
List<(string roleName, int percentage)> crewmateRoles = new List<(string, int)>
List<(string roleName, int percentage)> crewmateRoles = new()
{
("Jester", Options.JesterPerc.GetInt()),
("Mayor", Options.MayorPerc.GetInt())
};
List<(string roleName, int percentage)> impostorRoles = new List<(string, int)>
List<(string roleName, int percentage)> impostorRoles = new()
{
};
List<PlayerControl> availablePlayers = new List<PlayerControl>();
foreach (var player in PlayerControl.AllPlayerControls)
{
availablePlayers.Add(player);
}
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;
List<(string roleName, int percentage)> rolesToAssign = isCrewmate ? crewmateRoles : impostorRoles;
var rolesToAssign = isCrewmate ? crewmateRoles : impostorRoles;
foreach (var (roleName, percentage) in rolesToAssign)
{
if (assignedRoles.Contains(roleName))
continue;
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 && !PlayerRoles.ContainsKey(player.PlayerId))
{
PlayerRoles[player.PlayerId] = roleName;
assignedRoles.Add(roleName);
Logger.Info($"({player.PlayerId}) {player.Data.PlayerName} -> {roleName}", "StartGameCustomRole2");
if (randomValue >= percentage) continue;
if (PlayerRoles.ContainsKey(player.PlayerId)) continue;
break;
}
PlayerRoles[player.PlayerId] = roleName;
assignedRoles.Add(roleName);
Logger.Info($"({player.PlayerId}) {player.Data.PlayerName} -> {roleName}", "StartGameCustomRole2");
break;
}
}
}
@@ -90,6 +87,8 @@ public static class CustomRoleManagement
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>();
@@ -97,19 +96,68 @@ public static class CustomRoleManagement
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);
}
}
+3
View File
@@ -27,6 +27,9 @@ public static class FixedUpdate
{
nr.SetActive(false);
}
if (!AmongUsClient.Instance.AmHost) return;
DisableDevice.FixedUpdate();
}
}
+42
View File
@@ -0,0 +1,42 @@
using System;
using System.Linq.Expressions;
using System.Reflection;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using UnityEngine;
namespace AmongUsRevamped;
// Credit: TommyXL
public static class Il2CppCastHelper
{
public static T CastFast<T>(this Il2CppObjectBase obj) where T : Il2CppObjectBase
{
if (obj is T casted) return casted;
#if ANDROID
return obj.Cast<T>();
#else
return obj.Pointer.CastFast<T>();
#endif
}
private static T CastFast<T>(this IntPtr ptr) where T : Il2CppObjectBase
{
return CastHelper<T>.Cast(ptr);
}
private static class CastHelper<T> where T : Il2CppObjectBase
{
public static readonly Func<IntPtr, T> Cast;
static CastHelper()
{
ConstructorInfo constructor = typeof(T).GetConstructor([typeof(IntPtr)]);
ParameterExpression ptr = Expression.Parameter(typeof(IntPtr));
NewExpression create = Expression.New(constructor!, ptr);
Expression<Func<IntPtr, T>> lambda = Expression.Lambda<Func<IntPtr, T>>(create, ptr);
Cast = lambda.Compile();
}
}
}
+5 -4
View File
@@ -9,6 +9,7 @@ namespace AmongUsRevamped;
[HarmonyPatch(typeof(ControllerManager), nameof(ControllerManager.Update))]
internal class Hotkeys
{
public static int IncrementMultiplier;
public static void Postfix()
{
bool Shift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
@@ -35,10 +36,6 @@ internal class Hotkeys
{
MeetingHud.Instance.RpcClose();
}
else
{
PlayerControl.LocalPlayer.ReportDeadBody(PlayerControl.LocalPlayer.Data);
}
}
if (Shift && GameStartManager.InstanceExists && GameStartManager.Instance != null && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown && !HudManager.Instance.Chat.IsOpenOrOpening)
@@ -52,6 +49,10 @@ internal class Hotkeys
GameStartManager.Instance.ResetStartState();
Logger.SendInGame("Starting countdown canceled");
}
if (Shift) IncrementMultiplier = 5;
else if (Ctrl) IncrementMultiplier = 10;
else IncrementMultiplier = 1;
}
}
#endif
-2
View File
@@ -4,8 +4,6 @@ using UnityEngine;
using System;
using AmongUs.GameOptions;
using Object = UnityEngine.Object;
namespace AmongUsRevamped
{
public enum CustomRPC
+83 -3
View File
@@ -12,8 +12,6 @@ using System.Security.Cryptography;
using System.Text;
using AmongUs.InnerNet.GameDataMessages;
using Object = UnityEngine.Object;
namespace AmongUsRevamped;
public static class Utils
@@ -223,6 +221,87 @@ public static class Utils
}
}
public static bool IsActive(SystemTypes type)
{
try
{
if (Utils.IsLobby || !ShipStatus.Instance || !ShipStatus.Instance.Systems.TryGetValue(type, out ISystemType systemType)) return false;
int mapId = Main.NormalOptions.MapId;
switch (type)
{
case SystemTypes.Electrical:
{
if (mapId == 5) return false;
var switchSystem = systemType.CastFast<SwitchSystem>();
return switchSystem is { IsActive: true };
}
case SystemTypes.Reactor:
{
switch (mapId)
{
case 2:
return false;
case 4:
var heliSabotageSystem = systemType.CastFast<HeliSabotageSystem>();
return heliSabotageSystem != null && heliSabotageSystem.IsActive;
default:
var reactorSystemType = systemType.CastFast<ReactorSystemType>();
return reactorSystemType is { IsActive: true };
}
}
case SystemTypes.Laboratory:
{
if (mapId != 2) return false;
var reactorSystemType = systemType.CastFast<ReactorSystemType>();
return reactorSystemType is { IsActive: true };
}
case SystemTypes.LifeSupp:
{
if (mapId is 2 or 4 or 5) return false;
var lifeSuppSystemType = systemType.CastFast<LifeSuppSystemType>();
return lifeSuppSystemType is { IsActive: true };
}
case SystemTypes.Comms:
{
if (mapId is 1 or 5)
{
var hqHudSystemType = systemType.TryCast<HqHudSystemType>();
return hqHudSystemType != null && hqHudSystemType.IsActive;
}
var hudOverrideSystemType = systemType.CastFast<HudOverrideSystemType>();
return hudOverrideSystemType is { IsActive: true };
}
case SystemTypes.HeliSabotage:
{
if (mapId != 4) return false;
var heliSabotageSystem = systemType.CastFast<HeliSabotageSystem>();
return heliSabotageSystem != null && heliSabotageSystem.IsActive;
}
case SystemTypes.MushroomMixupSabotage:
{
if (mapId != 5) return false;
var mushroomMixupSabotageSystem = systemType.CastFast<MushroomMixupSabotageSystem>();
return mushroomMixupSabotageSystem != null && mushroomMixupSabotageSystem.IsActive;
}
default:
return false;
}
}
catch (Exception e)
{
Logger.Exception(e, "IsActive");
return false;
}
}
public static void ShowLastResult(byte playerId = byte.MaxValue)
{
if (InGame)
@@ -380,7 +459,8 @@ public static class Utils
writer.Write(gameOverReason);
AmongUsClient.Instance.FinishEndGame(writer);
HandlingGameEnd = false;
Logger.Info(" -------- GAME ENDED --------", "ManualEndGame");
Logger.Info($"{gameOverReason}", "ContinueEndGame");
Logger.Info(" -------- GAME ENDED --------", "ContinueEndGame");
}
public static void DumpLog()
+6 -5
View File
@@ -104,7 +104,7 @@ internal static class SendChatPatch
return false;
}
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat) return false;
if (__instance.timeSinceLastMessage < 3f || OnGameJoinedPatch.WaitingForChat || CustomRoleManagement.HandlingRoleMessages) return false;
if (text == "/l" || text == "/lastgame" || text == "/win" || text == "/winner")
{
@@ -142,7 +142,7 @@ internal static class SendChatPatch
switch (Options.Gamemode.GetValue())
{
case 0:
Utils.ChatCommand(__instance, $"ENABLED CUSTOM ROLES:\n\n{CustomRoleManagement.GetActiveRoles()}", "", false);
Utils.ChatCommand(__instance, $"Enabled Custom Roles:\n\n{CustomRoleManagement.GetActiveRoles()}", "", false);
break;
case 1:
@@ -238,7 +238,7 @@ internal static class SendChatPatch
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.HandleRpc))]
public static class RPCHandlerPatch
{
public static void Prefix(PlayerControl __instance, byte callId, MessageReader reader)
public static void Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
{
if (!AmongUsClient.Instance.AmHost) return;
@@ -266,7 +266,8 @@ public static class RPCHandlerPatch
{
c = keywords.Any(k => text == k);
}
if (c && !Utils.IsPlayerModerator(__instance.Data.FriendCode))
if (c && !Utils.IsPlayerModerator(__instance.Data.FriendCode) && Options.AutoKickStart.GetBool() && !Utils.InGame)
{
int clientId = __instance.Data.ClientId;
@@ -372,7 +373,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 ");
+127 -60
View File
@@ -172,82 +172,149 @@ namespace AmongUsRevamped
}
}
}
}
// https://github.com/3X3CODE/MainMenuEnhanced/blob/main/MainMenuEnhanced/VisualPatch.cs
[HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))]
public static class MainMenuManagerStartPatch
{
public static void Postfix(MainMenuManager __instance)
// https://github.com/3X3CODE/MainMenuEnhanced/blob/main/MainMenuEnhanced/VisualPatch.cs
[HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))]
public static class MainMenuManagerStartPatch
{
if (__instance == null) return;
var bg = GameObject.Find("BackgroundTexture");
if (bg != null)
private static PassiveButton template;
private static PassiveButton discordButton;
private static PassiveButton gitHubButton;
private static Transform buttonParent;
public static void Postfix(MainMenuManager __instance)
{
bg.SetActive(false);
}
if (__instance == null) return;
if (template == null) template = __instance.quitButton;
if (template == null) return;
var leftPanel = GameObject.Find("LeftPanel");
if (leftPanel != null)
{
leftPanel.gameObject.GetComponent<SpriteRenderer>().enabled = false;
}
var div = GameObject.Find("MainUI/AspectScaler/LeftPanel/Main Buttons/Divider");
if (div != null)
{
div.SetActive(false);
}
Transform tintTrans = __instance.transform.Find("MainUI/Tint");
var tint = tintTrans.gameObject;
if (tint != null)
{
tint.SetActive(false);
}
DisableObject("WindowShine");
DisableComponent("RightPanel");
DisableComponent("MaskedBlackScreen");
Transform playTransform = __instance.transform.Find("MainUI/AspectScaler/LeftPanel/Main Buttons/PlayButton/FontPlacer/Text_TMP");
if (playTransform != null)
{
var playbutton = playTransform.gameObject;
if (playbutton != null)
if (buttonParent == null) buttonParent = template.transform.parent;
if (discordButton == null)
{
if (playbutton.TryGetComponent<TextTranslatorTMP>(out var tmp))
discordButton = CreateButton(
__instance,
"DiscordButton",
new(2.1f, 4.05f, 1f),
new(88, 101, 242, byte.MaxValue),
new(148, 161, byte.MaxValue, byte.MaxValue),
() => Application.OpenURL("https://discord.gg/83Zhzhyhya"),
"Discord");
}
if (gitHubButton == null)
{
gitHubButton = CreateButton(
__instance,
"GitHubButton",
new(3.8f, 4.05f, 1f),
new(153, 153, 153, byte.MaxValue),
new(209, 209, 209, byte.MaxValue),
() => Application.OpenURL("https://github.com/ApeMV/AmongUsRevamped"),
"GitHub");
}
var bg = GameObject.Find("BackgroundTexture");
if (bg != null)
{
bg.SetActive(false);
}
var leftPanel = GameObject.Find("LeftPanel");
if (leftPanel != null)
{
leftPanel.gameObject.GetComponent<SpriteRenderer>().enabled = false;
}
var div = GameObject.Find("MainUI/AspectScaler/LeftPanel/Main Buttons/Divider");
if (div != null)
{
div.SetActive(false);
}
Transform tintTrans = __instance.transform.Find("MainUI/Tint");
var tint = tintTrans.gameObject;
if (tint != null)
{
tint.SetActive(false);
}
DisableObject("WindowShine");
DisableComponent("RightPanel");
DisableComponent("MaskedBlackScreen");
Transform playTransform = __instance.transform.Find("MainUI/AspectScaler/LeftPanel/Main Buttons/PlayButton/FontPlacer/Text_TMP");
if (playTransform != null)
{
var playbutton = playTransform.gameObject;
if (playbutton != null)
{
tmp.enabled = false;
}
if (playbutton.TryGetComponent<TextMeshPro>(out var text))
{
text.text = "Start";
if (playbutton.TryGetComponent<TextTranslatorTMP>(out var tmp))
{
tmp.enabled = false;
}
if (playbutton.TryGetComponent<TextMeshPro>(out var text))
{
text.text = "Start";
}
}
}
}
static void DisableObject(string name)
{
var obj = GameObject.Find(name);
if (obj != null)
static void DisableObject(string name)
{
obj.SetActive(false);
var obj = GameObject.Find(name);
if (obj != null)
{
obj.SetActive(false);
}
}
static void DisableComponent(string name)
{
var obj = GameObject.Find(name);
if (obj != null)
{
if (obj.TryGetComponent<SpriteRenderer>(out var renderer))
{
renderer.enabled = false;
}
}
}
}
static void DisableComponent(string name)
private static PassiveButton CreateButton(MainMenuManager menu, string name, Vector3 localPosition, Color32 normalColor, Color32 hoverColor, Action action, string label)
{
var obj = GameObject.Find(name);
if (obj != null)
var parent = menu.transform.Find("MainUI/AspectScaler/LeftPanel/Main Buttons");
if (parent == null) return null;
var button = Object.Instantiate(menu.quitButton, parent);
button.name = name;
button.transform.localPosition = localPosition;
button.transform.localScale = new Vector3(0.8f, 1f, 1f);
var aspect = button.GetComponent<AspectPosition>();
if (aspect != null)
{
if (obj.TryGetComponent<SpriteRenderer>(out var renderer))
{
renderer.enabled = false;
}
aspect.enabled = false;
}
button.OnClick = new();
button.OnClick.AddListener(action);
var buttonText = button.transform.Find("FontPlacer/Text_TMP").GetComponent<TMP_Text>();
Utils.DestroyTranslator(buttonText);
buttonText.text = label;
buttonText.fontSize = buttonText.fontSizeMax = buttonText.fontSizeMin = 3.5f;
buttonText.enableWordWrapping = false;
buttonText.horizontalAlignment = HorizontalAlignmentOptions.Center;
var normalSprite = button.inactiveSprites.GetComponent<SpriteRenderer>();
var hoverSprite = button.activeSprites.GetComponent<SpriteRenderer>();
normalSprite.color = normalColor;
hoverSprite.color = hoverColor;
button.gameObject.SetActive(true);
return button;
}
}
}
+32
View File
@@ -0,0 +1,32 @@
namespace AmongUsRevamped;
[HarmonyPatch(typeof(DeconSystem), nameof(DeconSystem.UpdateSystem))]
public static class DeconSystemUpdateSystemPatch
{
public static void Prefix(DeconSystem __instance)
{
if (!AmongUsClient.Instance.AmHost) return;
if (Options.ChangeDecontaminationTime.GetBool())
{
__instance.DoorOpenTime = Main.CurrentMap switch
{
MapNames.MiraHQ => Options.DecontaminationDoorOpenTimeOnMiraHQ.GetFloat(),
MapNames.Polus => Options.DecontaminationDoorOpenTimeOnPolus.GetFloat(),
_ => 3f
};
__instance.DeconTime = Main.CurrentMap switch
{
MapNames.MiraHQ => Options.DecontaminationTimeOnMiraHQ.GetFloat(),
MapNames.Polus => Options.DecontaminationTimeOnPolus.GetFloat(),
_ => 3f
};
}
else
{
__instance.DoorOpenTime = 3f;
__instance.DeconTime = 3f;
}
}
}
+196
View File
@@ -0,0 +1,196 @@
using System;
using Hazel;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using UnityEngine;
namespace AmongUsRevamped;
// https://github.com/ykundesu/SuperNewRoles/blob/master/SuperNewRoles/Mode/SuperHostRoles/BlockTool.cs
internal static class DisableDevice
{
public static readonly List<byte> DesyncComms = [];
private static int frame;
public static readonly Dictionary<string, Vector2> DevicePos = new()
{
["SkeldAdmin"] = new(3.48f, -8.62f),
["SkeldCamera"] = new(-13.06f, -2.45f),
["MiraHQAdmin"] = new(21.02f, 19.09f),
["MiraHQDoorLog"] = new(16.22f, 5.82f),
["PolusLeftAdmin"] = new(22.80f, -21.52f),
["PolusRightAdmin"] = new(24.66f, -21.52f),
["PolusCamera"] = new(2.96f, -12.74f),
["PolusVital"] = new(26.70f, -15.94f),
["DleksAdmin"] = new(-3.48f, -8.62f),
["DleksCamera"] = new(13.06f, -2.45f),
["AirshipCockpitAdmin"] = new(-22.32f, 0.91f),
["AirshipRecordsAdmin"] = new(19.89f, 12.60f),
["AirshipCamera"] = new(8.10f, -9.63f),
["AirshipVital"] = new(25.24f, -7.94f),
["FungleCamera"] = new(6.20f, 0.10f),
["FungleVital"] = new(-2.50f, -9.80f),
["SubmergedVital"] = new(5f, 32.54f),
["SubmergedLeftAdmin"] = new(-9.45f, 10.16f),
["SubmergedRightAdmin"] = new(-7.07f, 10.16f),
["SubmergedCamera"] = new(-3.41f, -34.56f)
};
public static bool DoDisable => Options.DisableDevices.GetBool();
public static float UsableDistance => Main.CurrentMap switch
{
MapNames.Skeld => 1.5f,
MapNames.MiraHQ => 2.2f,
MapNames.Polus => 1.4f,
MapNames.Dleks => 1.5f,
MapNames.Airship => 1.6f,
MapNames.Fungle => 1.7f,
_ => 2f
};
public static void FixedUpdate()
{
if (!AmongUsClient.Instance.AmHost || ShipStatus.Instance == null || !Utils.GamePastRoleSelection) return;
frame = frame == 5 ? 0 : ++frame;
if (frame != 0) return;
if (!DoDisable) return;
foreach (PlayerControl pc in Main.AllPlayerControls)
{
try
{
var doComms = false;
Vector2 PlayerPos = pc.GetTruePosition();
if (!Utils.IsActive(SystemTypes.Comms))
{
switch (Main.NormalOptions.MapId)
{
case 0:
if (Options.DisableSkeldAdmin.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldAdmin"]) <= UsableDistance;
if (Options.DisableSkeldCamera.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldCamera"]) <= UsableDistance;
break;
case 1:
if (Options.DisableMiraHQAdmin.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQAdmin"]) <= UsableDistance;
if (Options.DisableMiraHQDoorLog.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQDoorLog"]) <= UsableDistance;
break;
case 2:
if (Options.DisablePolusAdmin.GetBool())
{
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusLeftAdmin"]) <= UsableDistance;
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusRightAdmin"]) <= UsableDistance;
}
if (Options.DisablePolusCamera.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusCamera"]) <= UsableDistance;
if (Options.DisablePolusVital.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusVital"]) <= UsableDistance;
break;
case 3:
if (Options.DisableSkeldAdmin.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksAdmin"]) <= UsableDistance;
if (Options.DisableSkeldCamera.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksCamera"]) <= UsableDistance;
break;
case 4:
if (Options.DisableAirshipCockpitAdmin.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCockpitAdmin"]) <= UsableDistance;
if (Options.DisableAirshipRecordsAdmin.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipRecordsAdmin"]) <= UsableDistance;
if (Options.DisableAirshipCamera.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCamera"]) <= UsableDistance;
if (Options.DisableAirshipVital.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipVital"]) <= UsableDistance;
break;
case 5:
if (Options.DisableFungleCamera.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleCamera"]) <= UsableDistance;
if (Options.DisableFungleVital.GetBool()) doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleVital"]) <= UsableDistance;
break;
}
}
if (doComms && !pc.inVent)
{
if (!DesyncComms.Contains(pc.PlayerId))
{
DesyncComms.Add(pc.PlayerId);
SendDesyncRepair(pc, SystemTypes.Comms, 128);
}
}
else if (!doComms && DesyncComms.Contains(pc.PlayerId))
{
DesyncComms.Remove(pc.PlayerId);
SendDesyncRepair(pc, SystemTypes.Comms, 16);
if (Main.NormalOptions.MapId is 1 or 5) SendDesyncRepair(pc, SystemTypes.Comms, 17);
}
}
catch (Exception ex) { Logger.Exception(ex, "DisableDevice"); }
}
}
public static void SendDesyncRepair(PlayerControl target, SystemTypes systemType, byte amount)
{
if (!AmongUsClient.Instance.AmHost) return;
if (target == null || target.Data == null || target.Data.ClientId == AmongUsClient.Instance.HostId) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(
ShipStatus.Instance.NetId,
(byte)RpcCalls.UpdateSystem,
SendOption.Reliable,
target.Data.ClientId
);
writer.Write((byte)systemType);
writer.WritePacked(target.NetId);
writer.Write(amount);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
}
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Start))]
public class RemoveDisableDevicesPatch
{
public static void Postfix()
{
if (!Options.DisableDevices.GetBool()) return;
UpdateDisableDevices();
}
public static void UpdateDisableDevices()
{
PlayerControl player = PlayerControl.LocalPlayer;
Il2CppArrayBase<MapConsole> admins = Object.FindObjectsOfType<MapConsole>(true);
Il2CppArrayBase<SystemConsole> consoles = Object.FindObjectsOfType<SystemConsole>(true);
if (admins == null || consoles == null) return;
switch (Main.NormalOptions.MapId)
{
case 3:
case 0:
if (Options.DisableSkeldAdmin.GetBool()) admins[0].gameObject.GetComponent<CircleCollider2D>().enabled = false;
if (Options.DisableSkeldCamera.GetBool()) consoles.DoIf(x => x.name == "SurvConsole", x => x.gameObject.GetComponent<PolygonCollider2D>().enabled = false);
break;
case 1:
if (Options.DisableMiraHQAdmin.GetBool()) admins[0].gameObject.GetComponent<CircleCollider2D>().enabled = false;
if (Options.DisableMiraHQDoorLog.GetBool()) consoles.DoIf(x => x.name == "SurvLogConsole", x => x.gameObject.GetComponent<BoxCollider2D>().enabled = false);
break;
case 2:
if (Options.DisablePolusAdmin.GetBool()) admins.Do(x => x.gameObject.GetComponent<BoxCollider2D>().enabled = false);
if (Options.DisablePolusCamera.GetBool()) consoles.DoIf(x => x.name == "Surv_Panel", x => x.gameObject.GetComponent<BoxCollider2D>().enabled = false);
if (Options.DisablePolusVital.GetBool()) consoles.DoIf(x => x.name == "panel_vitals", x => x.gameObject.GetComponent<BoxCollider2D>().enabled = false);
break;
case 4:
admins.Do(x =>
{
if ((Options.DisableAirshipCockpitAdmin.GetBool() && x.name == "panel_cockpit_map") ||
(Options.DisableAirshipRecordsAdmin.GetBool() && x.name == "records_admin_map"))
x.gameObject.GetComponent<BoxCollider2D>().enabled = false;
});
if (Options.DisableAirshipCamera.GetBool()) consoles.DoIf(x => x.name == "task_cams", x => x.gameObject.GetComponent<BoxCollider2D>().enabled = false);
if (Options.DisableAirshipVital.GetBool()) consoles.DoIf(x => x.name == "panel_vitals", x => x.gameObject.GetComponent<CircleCollider2D>().enabled = false);
break;
case 5:
if (Options.DisableFungleCamera.GetBool()) consoles.DoIf(x => x.name == "BinocularsSecurityConsole", x => x.gameObject.GetComponent<PolygonCollider2D>().enabled = false);
if (Options.DisableFungleVital.GetBool()) consoles.DoIf(x => x.name == "VitalsConsole", x => x.gameObject.GetComponent<BoxCollider2D>().enabled = false);
break;
}
}
}
+9 -4
View File
@@ -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/ZnC1toT.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;
}
}
+8 -5
View File
@@ -29,7 +29,7 @@ class NormalGameEndChecker
public static bool Prefix()
{
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3) return false;
if (Options.NoGameEnd.GetBool() || Options.Gamemode.GetValue() == 3 || Utils.HandlingGameEnd) return false;
var allPlayers = PlayerControl.AllPlayerControls.ToArray();
@@ -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;
}
+35
View File
@@ -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);
}
}
}
}
-2
View File
@@ -7,8 +7,6 @@ using System.Collections.Generic;
using Il2CppSystem.Collections.Generic;
#endif
using Object = UnityEngine.Object;
// https://github.com/Yumenopai/TownOfHost_Y/blob/main/Patches/GameOptionsPatch.cs
namespace AmongUsRevamped
{
-1
View File
@@ -1,7 +1,6 @@
using System;
using TMPro;
using UnityEngine;
using Object = UnityEngine.Object;
// https://github.com/Yumenopai/TownOfHost_Y/blob/main/Patches/GameSettingMenuPatch.cs
namespace AmongUsRevamped
+11 -1
View File
@@ -10,7 +10,7 @@ internal static class CoShowIntroPatch
{
public static void Postfix(IntroCutscene __instance)
{
Logger.Info("Intro initiated", "d");
Logger.Info("Intro initiated", "CoShowIntro");
if (!AmongUsClient.Instance.AmHost) return;
@@ -24,5 +24,15 @@ internal static class CoShowIntroPatch
{ "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);
}
}
}
}
-2
View File
@@ -2,8 +2,6 @@ using System;
using TMPro;
using UnityEngine;
using Object = UnityEngine.Object;
// https://github.com/Rabek009/MoreGamemodes/blob/master/Patches/LobbyViewSettingsPatch.cs
namespace AmongUsRevamped
{
+64 -16
View File
@@ -1,25 +1,36 @@
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;
#if ANDROID
float increment = __instance.Increment;
#else
float increment = Hotkeys.IncrementMultiplier * __instance.Increment;
#endif
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 +39,27 @@ public static class NumberOption_Decrease
{
public static bool Prefix(NumberOption __instance)
{
if (ModGameOptionsMenu.TabIndex >= 3) return true;
#if ANDROID
float increment = __instance.Increment;
#else
float increment = Hotkeys.IncrementMultiplier * __instance.Increment;
#endif
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;
}
}
@@ -51,7 +72,34 @@ public static class NumberOption_Initialize
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:
case StringNames.EscapeTime:
case StringNames.FinalEscapeTime:
__instance.Increment = 5f;
break;
case StringNames.GameKillCooldown:
__instance.Increment = 0.5f;
break;
case StringNames.GamePlayerSpeed:
case StringNames.SeekerFinalSpeed:
case StringNames.GameCrewLight:
case StringNames.GameImpostorLight:
case StringNames.CrewmateFlashlightSize:
case StringNames.ImpostorFlashlightSize:
__instance.Increment = 0.05f;
break;
default:
__instance.Increment = 1f;
break;
}
}
}
-17
View File
@@ -67,28 +67,11 @@ internal class CoStartGamePatch
(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");
}
}
}
}
}
+21 -6
View File
@@ -9,8 +9,6 @@ public static class SabotageSystemTypeRepairDamagePatch
{
private static bool Prefix([HarmonyArgument(0)] PlayerControl player, [HarmonyArgument(1)] MessageReader msgReader)
{
if (!AmongUsClient.Instance.AmHost) return true;
byte amount;
{
var newReader = MessageReader.Get(msgReader);
@@ -18,12 +16,27 @@ public static class SabotageSystemTypeRepairDamagePatch
newReader.Recycle();
}
var Sabo = (SystemTypes)amount;
Logger.Info($" {player.Data.PlayerName} is trying to sabotage: {Sabo}", "SabotageCheck");
if (Options.DisableSabotage.GetBool() || Options.Gamemode.GetValue() == 2)
if (player.Data.ClientId == AmongUsClient.Instance.HostId) return true;
if (Options.Gamemode.GetValue() == 0 || Options.Gamemode.GetValue() == 1)
{
Logger.Info($" Sabotage {Sabo} by: {player.Data.PlayerName} was blocked", "SabotageCheck");
return false;
if (Sabo == SystemTypes.LifeSupp && Options.DisableOxygen.GetBool() || Sabo == SystemTypes.Reactor && Options.DisableReactor.GetBool() || Sabo == SystemTypes.Electrical && Options.DisableLights.GetBool() || Sabo == SystemTypes.Comms && Options.DisableComms.GetBool() || Sabo == SystemTypes.HeliSabotage && Options.DisableHeli.GetBool() || Sabo == SystemTypes.MushroomMixupSabotage && Options.DisableMushroomMixup.GetBool())
{
Logger.Info($" Sabotage {Sabo} by: {player.Data.PlayerName} was blocked", "SabotageCheck");
return false;
}
return true;
}
if (Options.Gamemode.GetValue() == 2)
{
if (Sabo == SystemTypes.LifeSupp && Options.SNSDisableOxygen.GetBool() || Sabo == SystemTypes.Reactor && Options.SNSDisableReactor.GetBool() || Sabo == SystemTypes.Electrical && Options.SNSDisableLights.GetBool() || Sabo == SystemTypes.Comms && Options.SNSDisableComms.GetBool() || Sabo == SystemTypes.HeliSabotage && Options.SNSDisableHeli.GetBool() || Sabo == SystemTypes.MushroomMixupSabotage && Options.SNSDisableMushroomMixup.GetBool())
{
Logger.Info($" Sabotage {Sabo} by: {player.Data.PlayerName} was blocked", "SnSSabotageCheck");
return false;
}
return true;
}
else return true;
}
@@ -60,6 +73,8 @@ public static class MessageReaderUpdateSystemPatch
or SystemTypes.Decontamination3
or SystemTypes.MedBay) return true;
if (player.Data.ClientId == AmongUsClient.Instance.HostId) return true;
var amount = MessageReader.Get(reader).ReadByte();
if (EACR.RpcUpdateSystemCheck(player, systemType, amount))
{
+25 -20
View File
@@ -29,56 +29,58 @@
<img src="https://github.com/astra1dev/AUnlocker/assets/90265231/14226f03-a003-4efc-b27b-6df53fb394d6" width=410 height=240>****
‎
# 🎮 Features (v1.4.0):
- <b>🔶 Client Side settings:</b>
# 🎮 Features (v1.5.1):
## <b>♠️ Client Side settings:</b>
- Game Master
- Unlock FPS
- Show FPS
- Dark Theme
- Toggle Lobby Music
- <b>🔷 Technical settings:</b>
## <b>⚙️ Technical settings:</b>
- Kick/Ban players under a certain level
- Kick/Ban invalid FriendCodes
- Kick/Ban command using names
- Ckick/Cban command using colors
- Kick/Ban players who say "start"
- DenyName system
- 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
- Auto send winner info
- <b>🔷 Gameplay Settings:</b>
## <b>♻️ Automation settings:</b>
- Automatically start game and conditions for it
- Automatically rejoin lobby
- Automatically send winner info
## <b>🔧 Gameplay Settings:</b>
- Disable critical sabotages
- Disable door sabotages
- Disable body reporting
- Enable/Disable any task
- All players have same tasks
- Hide and Seek: Custom Impostor count
- <b>🔶 Custom Gamemodes:</b>
## <b>🏆 Custom Gamemodes:</b>
- 0 Kill Cooldown
- Shift and Seek
- Speedrun
- <b>🔷 Other:</b>
## <b>❓ Other Improvements:</b>
- ehT dlekS map (reverse Skeld)
- Ability to cancel starting countdown
- Improved main menu
- Custom anticheat system
- Zoom out in lobby or when dead
- Unlimited default Option ranges
- Near unlimited default Option ranges
- More accurate Option incrementing
- Logging for useful information
- <b>🎉 And this all without Modded Protocol!</b>
- <b>🎉 And this all works in public lobbies!</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 |
| `Shift`+`M`+`Enter` | Skip meeting when active | In Game |
| `C` | Cancel game start | In Starting Countdown |
| `Shift` | Start the game immediately | In Starting Countdown |
| `Shift` | 5x Option increment | In Options Menu |
| `Ctrl` | Noclip in lobby | In Lobby |
| `Ctrl` | 10x Option increment | In Options Menu |
### Chat Commands
| Command | Function |
@@ -92,8 +94,11 @@
| /cban <color> | Ban a player by color |
| /ckick <color> | Kick a player by color |
| /dump | Copy your LogOutput file |
| /color <color> | Set color |
‎
| /endgame | Instantly end the game |
| /endmeeting | Instantly end an ongoing meeting |
| /aur | Sends AUR socials (GitHub, Discord) |
| /color | Sets color. Can be used to bypass color limit |
‎
**Credit to these mods and their developers for their code:**
### :star: [AUnlocker](https://github.com/astra1dev/AUnlocker)
+1 -1
View File
@@ -18,7 +18,7 @@ public static class String
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\nImp wins by killing\nOne wrong kill = Can't kill for {Options.CantKillTime.GetInt()}s\n{Utils.BasicIntToWord(Options.MisfiresToSuicide.GetInt())} wrong kills = suicide";}}
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";}}