Transfer HNSR -> AUR

Time to pray to God this all goes well!
This commit is contained in:
Ape committed 2025-12-17 16:08:45 +01:00
1 parent 73929cc189
commit 9d20bdfb95
38 files changed
+381 -74

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
bin/
obj/
HNSRevamped.sln
AmongUsRevamped.sln
+9 -7
View File
@@ -9,7 +9,7 @@ using BepInEx.Unity.IL2CPP;
using System;
using UnityEngine;
namespace HNSRevamped;
namespace AmongUsRevamped;
[BepInAutoPlugin]
[BepInProcess("Among Us.exe")]
@@ -29,7 +29,9 @@ public partial class Main : BasePlugin
public static NormalGameOptionsV10 NormalOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentNormalGameOptions : null;
public static bool HasArgumentException;
public static string CredentialsText;
public const string ModVersion = "v0.4.0";
public const string ModVersion = "v1.0.0";
public static float GameTimer;
public static PlayerControl[] AllPlayerControls
{
@@ -55,17 +57,17 @@ public partial class Main : BasePlugin
public override void Load()
{
var handler = HNSRevamped.Logger.Handler("GitVersion");
Logger = BepInEx.Logging.Logger.CreateLogSource("HNSRevamped");
HNSRevamped.Logger.Enable();
var handler = AmongUsRevamped.Logger.Handler("GitVersion");
Logger = BepInEx.Logging.Logger.CreateLogSource("AmongUsRevamped");
AmongUsRevamped.Logger.Enable();
Instance = this;
AutoStart = Config.Bind("Client Options", "Auto Start", false);
GM = Config.Bind("Client Options", "GM", false);
GM = Config.Bind("Client Options", "Game Master", false);
UnlockFps = Config.Bind("Client Options", "Unlock FPS", false);
ShowFps = Config.Bind("Client Options", "Show FPS", false);
AutoStart = Config.Bind("Client Options", "Auto Start", false);
DarkTheme = Config.Bind("Client Options", "Dark Theme", true);
DarkTheme = Config.Bind("Client Options", "Dark Theme", false);
LobbyMusic = Config.Bind("Client Options", "Lobby Music", false);
BanManager.Init();
@@ -6,8 +6,8 @@
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<Description>Mod generated using Reactor Template</Description>
<!-- <Authors>your name</Authors> -->
<Description>The ultimate Host-Only mod without Modded Protocol</Description>
<Authors>Most Various</Authors>
</PropertyGroup>
<ItemGroup>
+139
View File
@@ -0,0 +1,139 @@
using AmongUs.GameOptions;
namespace AmongUsRevamped;
public static class AURoleOptions
{
private static IGameOptions Opt;
public static float KillCooldown
{
get => Opt.GetFloat(FloatOptionNames.KillCooldown);
set => Opt.SetFloat(FloatOptionNames.KillCooldown, value);
}
public static float PlayerSpeedMod
{
get => Opt.GetFloat(FloatOptionNames.PlayerSpeedMod);
set => Opt.SetFloat(FloatOptionNames.PlayerSpeedMod, value);
}
public static float ScientistCooldown
{
get => Opt.GetFloat(FloatOptionNames.ScientistCooldown);
set => Opt.SetFloat(FloatOptionNames.ScientistCooldown, value);
}
public static float ScientistBatteryCharge
{
get => Opt.GetFloat(FloatOptionNames.ScientistBatteryCharge);
set => Opt.SetFloat(FloatOptionNames.ScientistBatteryCharge, value);
}
public static float EngineerCooldown
{
get => Opt.GetFloat(FloatOptionNames.EngineerCooldown);
set => Opt.SetFloat(FloatOptionNames.EngineerCooldown, value);
}
public static float EngineerInVentMaxTime
{
get => Opt.GetFloat(FloatOptionNames.EngineerInVentMaxTime);
set => Opt.SetFloat(FloatOptionNames.EngineerInVentMaxTime, value);
}
public static float GuardianAngelCooldown
{
get => Opt.GetFloat(FloatOptionNames.GuardianAngelCooldown);
set => Opt.SetFloat(FloatOptionNames.GuardianAngelCooldown, value);
}
public static float ProtectionDurationSeconds
{
get => Opt.GetFloat(FloatOptionNames.ProtectionDurationSeconds);
set => Opt.SetFloat(FloatOptionNames.ProtectionDurationSeconds, value);
}
public static bool ImpostorsCanSeeProtect
{
get => Opt.GetBool(BoolOptionNames.ImpostorsCanSeeProtect);
set => Opt.SetBool(BoolOptionNames.ImpostorsCanSeeProtect, value);
}
public static float ShapeshifterDuration
{
get => Opt.GetFloat(FloatOptionNames.ShapeshifterDuration);
set => Opt.SetFloat(FloatOptionNames.ShapeshifterDuration, value);
}
public static float ShapeshifterCooldown
{
get => Opt.GetFloat(FloatOptionNames.ShapeshifterCooldown);
set => Opt.SetFloat(FloatOptionNames.ShapeshifterCooldown, value);
}
public static bool ShapeshifterLeaveSkin
{
get => Opt.GetBool(BoolOptionNames.ShapeshifterLeaveSkin);
set => Opt.SetBool(BoolOptionNames.ShapeshifterLeaveSkin, value);
}
public static bool NoisemakerImpostorAlert
{
get => Opt.GetBool(BoolOptionNames.NoisemakerImpostorAlert);
set => Opt.SetBool(BoolOptionNames.NoisemakerImpostorAlert, value);
}
public static float NoisemakerAlertDuration
{
get => Opt.GetFloat(FloatOptionNames.NoisemakerAlertDuration);
set => Opt.SetFloat(FloatOptionNames.NoisemakerAlertDuration, value);
}
public static float PhantomCooldown
{
get => Opt.GetFloat(FloatOptionNames.PhantomCooldown);
set => Opt.SetFloat(FloatOptionNames.PhantomCooldown, value);
}
public static float PhantomDuration
{
get => Opt.GetFloat(FloatOptionNames.PhantomDuration);
set => Opt.SetFloat(FloatOptionNames.PhantomDuration, value);
}
public static float TrackerCooldown
{
get => Opt.GetFloat(FloatOptionNames.TrackerCooldown);
set => Opt.SetFloat(FloatOptionNames.TrackerCooldown, value);
}
public static float TrackerDuration
{
get => Opt.GetFloat(FloatOptionNames.TrackerDuration);
set => Opt.SetFloat(FloatOptionNames.TrackerDuration, value);
}
public static float TrackerDelay
{
get => Opt.GetFloat(FloatOptionNames.TrackerDelay);
set => Opt.SetFloat(FloatOptionNames.TrackerDelay, value);
}
public static float ViperDissolveTime
{
get => Opt.GetFloat(FloatOptionNames.ViperDissolveTime);
set => Opt.SetFloat(FloatOptionNames.ViperDissolveTime, value);
}
public static float DetectiveSuspectLimit
{
get => Opt.GetFloat(FloatOptionNames.DetectiveSuspectLimit);
set => Opt.SetFloat(FloatOptionNames.DetectiveSuspectLimit, value);
}
public static void SetOpt(IGameOptions opt)
{
Opt = opt;
}
}
+5 -5
View File
@@ -7,19 +7,19 @@ using System.Text.RegularExpressions;
using System.Reflection;
// https://github.com/EnhancedNetwork/TownofHost-Enhanced/blob/main/Modules/BanManager.cs
namespace HNSRevamped;
namespace AmongUsRevamped;
public static class BanManager
{
public static string RemoveHtmlTags(this string str) => Regex.Replace(str, "<[^>]*?>", "");
private static string BanListPath = "./HNSR-DATA/BanList.txt";
private static string ModeratorListPath = "./HNSR-DATA/ModeratorList.txt";
private static string BanListPath = "./AUR-DATA/BanList.txt";
private static string ModeratorListPath = "./AUR-DATA/ModeratorList.txt";
public static List<string> TempBanWhiteList = [];
public static void Init()
{
try
{
Directory.CreateDirectory("HNSR-DATA");
Directory.CreateDirectory("AUR-DATA");
if (!File.Exists(BanListPath))
{
@@ -114,7 +114,7 @@ public static class BanManager
try
{
Directory.CreateDirectory("HNSR-DATA");
Directory.CreateDirectory("AUR-DATA");
if (!File.Exists(BanListPath)) File.Create(BanListPath).Close();
using StreamReader sr = new(BanListPath);
string line;
+3 -3
View File
@@ -2,7 +2,7 @@ using System;
using BepInEx.Configuration;
using UnityEngine;
namespace HNSRevamped;
namespace AmongUsRevamped;
// Credit: https://github.com/tukasa0001/TownOfHost
public class ClientOptionItem
@@ -65,8 +65,8 @@ public class ClientOptionItem
ToggleButtonBehaviour modOptionsButton = UnityEngine.Object.Instantiate(mouseMoveToggle, generalTab);
modOptionsButton.transform.localPosition = leaveButton?.transform.localPosition ?? new(0f, -2.4f, 1f);
modOptionsButton.name = "HNSR Options";
modOptionsButton.Text.text = "HNSR Options";
modOptionsButton.name = "AUR Options";
modOptionsButton.Text.text = "AUR Options";
modOptionsButton.Background.color = new Color32(0, 165, 255, byte.MaxValue);
var modOptionsPassiveButton = modOptionsButton.GetComponent<PassiveButton>();
modOptionsPassiveButton.OnClick = new();
+38 -11
View File
@@ -2,7 +2,7 @@
using UnityEngine;
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionHolder.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
[HarmonyPatch]
public static class Options
@@ -161,9 +161,20 @@ namespace HNSRevamped
public static OptionItem DisableSubmitScan;
public static OptionItem DisableUploadData;
// HNS
// Gamemode
public static OptionItem TabGroupHNS;
public static OptionItem NumSeekers;
public static OptionItem TabGroup0Kcd;
public static OptionItem NoKcdSettingsOverride;
public static OptionItem TabGroupSNS;
public static OptionItem SNSSettingsOverride;
public static OptionItem CrewAutoWinsGameAfter;
public static OptionItem CantKillTime;
public static OptionItem MisfiresToSuicide;
public static bool IsLoaded = false;
public static void Load()
@@ -174,7 +185,7 @@ namespace HNSRevamped
.SetColor(Color.green)
.SetHeader(true);
TabGroupMain = TextOptionItem.Create(2, "Main", TabGroup.SystemSettings)
TabGroupMain = TextOptionItem.Create(60000, "Main", TabGroup.SystemSettings)
.SetColor(Color.yellow);
KickLowLevelPlayer = IntegerOptionItem.Create(60050, "Kick Players Under Level", new(0, 100, 1), 0, TabGroup.SystemSettings, false)
@@ -187,26 +198,42 @@ namespace HNSRevamped
.SetParent(KickInvalidFriendCodes);
ApplyBanList = BooleanOptionItem.Create(60110, "Apply BanList", true, TabGroup.SystemSettings, true);
ApplyModeratorList = BooleanOptionItem.Create(60120, "Apply ModeratorList", false, TabGroup.SystemSettings, false);
ApplyModeratorList = BooleanOptionItem.Create(60120, "Apply ModeratorList", true, TabGroup.SystemSettings, false);
AutoRejoinLobby = BooleanOptionItem.Create(60210, "Auto Rejoin Lobby", false, TabGroup.SystemSettings, false);
AutoStartTimer = IntegerOptionItem.Create(44420, "Countdown For Auto Start", new(1, 600, 1), 5, TabGroup.SystemSettings, false)
.SetValueFormat(OptionFormat.Seconds);
WaitAutoStart = IntegerOptionItem.Create(44421, "AutoStart After", new(10, 600, 10), 5, TabGroup.SystemSettings, false)
WaitAutoStart = IntegerOptionItem.Create(44421, "Auto Start After", new(10, 600, 10), 300, TabGroup.SystemSettings, false)
.SetValueFormat(OptionFormat.Seconds);
PlayerAutoStart = IntegerOptionItem.Create(44422, "Players Needed To Start", new(1, 15, 1), 5, TabGroup.SystemSettings, false);
PlayerAutoStart = IntegerOptionItem.Create(44422, "Players Needed To Auto Start", new(1, 15, 1), 1, TabGroup.SystemSettings, false);
NoGameEnd = BooleanOptionItem.Create(60380, "No Game End", false, TabGroup.SystemSettings, false)
.SetColor(Color.red)
.SetHeader(true);
// HNS Settings
NumSeekers = IntegerOptionItem.Create(70000, "# Seekers", new(0, 15, 1), 1, TabGroup.HNSSettings, false)
.SetValueFormat(OptionFormat.Level)
.SetHeader(true);
// Gamemode Settings
TabGroupHNS = TextOptionItem.Create(70000, "Hide and Seek", TabGroup.GamemodeSettings)
.SetColor(Color.green);
NumSeekers = IntegerOptionItem.Create(70001, "# Seekers", new(0, 15, 1), 1, TabGroup.GamemodeSettings, false)
.SetValueFormat(OptionFormat.Level);
// Mod Settings
TabGroup0Kcd = TextOptionItem.Create(70025, "0 Kill Cooldown", TabGroup.GamemodeSettings)
.SetColor(Color.red);
NoKcdSettingsOverride = BooleanOptionItem.Create(70026, "Auto Update Settings", true, TabGroup.GamemodeSettings, false);
TabGroupSNS = TextOptionItem.Create(70050, "Shift and Seek", TabGroup.GamemodeSettings)
.SetColor(Color.yellow);
SNSSettingsOverride = BooleanOptionItem.Create(70051, "Auto Update Settings", true, TabGroup.GamemodeSettings, false);
CantKillTime = IntegerOptionItem.Create(70053, "After Misfiring, Can't kill for", new(0, 60, 5), 20, TabGroup.GamemodeSettings, false)
.SetValueFormat(OptionFormat.Seconds);
MisfiresToSuicide = IntegerOptionItem.Create(70052, "Suicide After Amount Of Misfires", new(1, 15, 1), 2, TabGroup.GamemodeSettings, false);
CrewAutoWinsGameAfter = IntegerOptionItem.Create(70054, "Crewmates Automatically Win After", new(0, 600, 10), 300, TabGroup.GamemodeSettings, false)
.SetValueFormat(OptionFormat.Seconds);
// Gameplay Settings
DisableSabotage = BooleanOptionItem.Create(60565, "Disable Critical Sabotages", false, TabGroup.ModSettings, false)
.SetColor(new Color32(255, 153, 153, byte.MaxValue))
.SetHeader(true);
+35
View File
@@ -0,0 +1,35 @@
using Hazel;
using System;
using System.Runtime.CompilerServices;
using InnerNet;
using UnityEngine;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.FixedUpdate))]
public static class FixedUpdate
{
public static void Postfix()
{
if (!AmongUsClient.Instance.AmHost) return;
if (Utils.InGame && !Utils.IsMeeting && !ExileController.Instance)
{
// 2 = Shift and Seek
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && Options.CrewAutoWinsGameAfter.GetInt() != 0 && !Options.NoGameEnd.GetBool())
{
Main.GameTimer += Time.fixedDeltaTime;
if (Main.GameTimer > Options.CrewAutoWinsGameAfter.GetInt())
{
Main.GameTimer = 0f;
MessageWriter writer = AmongUsClient.Instance.StartEndGame();
writer.Write((byte)GameOverReason.CrewmatesByVote);
AmongUsClient.Instance.FinishEndGame(writer);
Logger.Info($" Crewmates win because the game took longer than {Options.CrewAutoWinsGameAfter.GetInt()}s", "SNSManager");
}
}
}
}
}
+1 -1
View File
@@ -2,7 +2,7 @@ using System;
using System.Runtime.CompilerServices;
namespace HNSRevamped;
namespace AmongUsRevamped;
class LateTask
{
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Net.Http;
using System.Runtime.CompilerServices;
using LogLevel = BepInEx.Logging.LogLevel;
namespace HNSRevamped;
namespace AmongUsRevamped;
public interface ILogHandler
{
+1 -1
View File
@@ -2,7 +2,7 @@ using System;
using AmongUs.GameOptions;
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionBackup/OptionBackupData.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public class OptionBackupData
{
+1 -1
View File
@@ -2,7 +2,7 @@ using System;
using AmongUs.GameOptions;
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionBackup/OptionBackupValue.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public abstract class OptionBackupValue
{
+1 -1
View File
@@ -1,5 +1,5 @@
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionItems/BooleanOptionItem.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public class BooleanOptionItem : OptionItem
{
+1 -1
View File
@@ -1,5 +1,5 @@
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionItems/FloatOptionItem.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public class FloatOptionItem : OptionItem
{
+1 -1
View File
@@ -1,5 +1,5 @@
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionItems/IntegerOptionItem.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public class IntegerOptionItem : OptionItem
{
+2 -2
View File
@@ -4,7 +4,7 @@ using BepInEx.Configuration;
using UnityEngine;
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionItems/OptionItem.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public abstract class OptionItem
{
@@ -215,7 +215,7 @@ namespace HNSRevamped
{
SystemSettings,
ModSettings,
HNSSettings,
GamemodeSettings,
}
+1 -1
View File
@@ -1,5 +1,5 @@
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionItems/StringOptionItem.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public class StringOptionItem : OptionItem
{
+1 -1
View File
@@ -1,5 +1,5 @@
// https://github.com/Yumenopai/TownOfHost_Y/blob/main/Modules/OptionItem/TextOptionItem.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public class TextOptionItem : OptionItem
{
+1 -1
View File
@@ -1,7 +1,7 @@
using System;
// https://github.com/tukasa0001/TownOfHost/blob/main/Modules/OptionItems/ValueRule.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public abstract class ValueRule<T>
{
+1 -1
View File
@@ -6,7 +6,7 @@ using AmongUs.GameOptions;
using Object = UnityEngine.Object;
namespace HNSRevamped
namespace AmongUsRevamped
{
public enum CustomRPC
{
+5 -5
View File
@@ -14,7 +14,7 @@ using AmongUs.InnerNet.GameDataMessages;
using Object = UnityEngine.Object;
namespace HNSRevamped;
namespace AmongUsRevamped;
public static class Utils
{
@@ -43,7 +43,7 @@ public static class Utils
{
if (friendCode == "") return false;
var friendCodesFilePath = @"./HNSR-DATA/Moderators.txt";
var friendCodesFilePath = @"./AUR-DATA/Moderators.txt";
var friendCodes = File.ReadAllLines(friendCodesFilePath);
return friendCodes.Any(code => code.Contains(friendCode));
}
@@ -55,9 +55,9 @@ public static class Utils
case TabGroup.SystemSettings:
return "System Settings";
case TabGroup.ModSettings:
return "Mod Settings";
case TabGroup.HNSSettings:
return "HNS Settings";
return "Gameplay Settings";
case TabGroup.GamemodeSettings:
return "Gamemode Settings";
default:
return "";
}
+1 -1
View File
@@ -1,7 +1,7 @@
using System;
using UnityEngine;
namespace HNSRevamped;
namespace AmongUsRevamped;
// https://github.com/Yumenopai/TownOfHost_Y
[HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))]
+1 -1
View File
@@ -4,7 +4,7 @@ using System;
using UnityEngine;
// https://github.com/SuperNewRoles/SuperNewRoles/blob/master/SuperNewRoles/Patches/LobbyBehaviourPatch.cs
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(ChatController), nameof(ChatController.Update))]
internal static class ChatControllerUpdatePatch
+3 -3
View File
@@ -3,13 +3,13 @@ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
namespace HNSRevamped
namespace AmongUsRevamped
{
// https://github.com/tukasa0001/TownOfHost
[HarmonyPatch(typeof(OptionsMenuBehaviour), nameof(OptionsMenuBehaviour.Start))]
public static class OptionsMenuBehaviourStartPatch
{
private static ClientOptionItem GM; // Currently not used yet
private static ClientOptionItem GM;
private static ClientOptionItem UnlockFPS;
private static ClientOptionItem ShowFPS;
private static ClientOptionItem AutoStart;
@@ -22,7 +22,7 @@ namespace HNSRevamped
if (GM == null || GM.ToggleButton == null)
{
GM = ClientOptionItem.Create("GM", Main.GM, __instance, GMButtonToggle);
GM = ClientOptionItem.Create("Game Master", Main.GM, __instance, GMButtonToggle);
static void GMButtonToggle()
{
+5 -2
View File
@@ -4,7 +4,7 @@ using TMPro;
using UnityEngine;
//https://github.com/Gurge44/EndlessHostRoles/blob/main/Patches/CredentialsPatch.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public enum ErrorCode
{
@@ -53,8 +53,11 @@ namespace HNSRevamped
{
RpcSetTasksPatch.GlobalTaskIds = null;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
Main.CredentialsText = $"<color=#FFD700>Hide And Seek Revamped</color><color=#ffffff> {Main.ModVersion}</color>";
Main.CredentialsText = $"<color=#FFD700>Among Us Revamped</color><color=#ffffff> {Main.ModVersion}</color>";
var credentials = UnityEngine.Object.Instantiate(__instance.text);
credentials.text = Main.CredentialsText;
+4 -1
View File
@@ -3,7 +3,7 @@ using Hazel;
using InnerNet;
using UnityEngine;
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(EndGameManager), nameof(EndGameManager.ShowButtons))]
public static class EndGameManagerPatch
@@ -12,6 +12,9 @@ public static class EndGameManagerPatch
{
RpcSetTasksPatch.GlobalTaskIds = null;
OnGameJoinedPatch.AutoStartCheck = false;
Main.GameTimer = 0f;
MurderPlayerPatch.misfireCount.Clear();
LateTask.Tasks.Clear();
EndGameNavigation navigation = __instance.Navigation;
if (!AmongUsClient.Instance.AmHost || __instance == null || navigation == null || !Options.AutoRejoinLobby.GetBool()) return;
+1 -1
View File
@@ -5,7 +5,7 @@ using UnityEngine;
using Object = UnityEngine.Object;
// https://github.com/Yumenopai/TownOfHost_Y/blob/main/Patches/GameOptionsPatch.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
public static class ModGameOptionsMenu
{
+5 -5
View File
@@ -4,7 +4,7 @@ using UnityEngine;
using Object = UnityEngine.Object;
// https://github.com/Yumenopai/TownOfHost_Y/blob/main/Patches/GameSettingMenuPatch.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
[HarmonyPatch(typeof(GameSettingMenu))]
public class GameSettingMenuPatch
@@ -114,13 +114,13 @@ namespace HNSRevamped
switch ((TabGroup)(tabNum - 3))
{
case TabGroup.SystemSettings:
__instance.MenuDescriptionText.text = "System Settings";
__instance.MenuDescriptionText.text = "Quality settings to improve comfort and testing";
break;
case TabGroup.ModSettings:
__instance.MenuDescriptionText.text = "Mod Settings";
__instance.MenuDescriptionText.text = "Gameplay Settings to improve the in-game experience";
break;
case TabGroup.HNSSettings:
__instance.MenuDescriptionText.text = "HNS Settings";
case TabGroup.GamemodeSettings:
__instance.MenuDescriptionText.text = "Situational settings to apply for specific gamemodes";
break;
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
using System;
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Update))]
public static class GameStartManagerUpdatePatch
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Text.RegularExpressions;
using TMPro;
using UnityEngine;
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnGameJoined))]
internal static class OnGameJoinedPatch
+1 -1
View File
@@ -2,7 +2,7 @@
using UnityEngine;
// https://github.com/tukasa0001/TownOfHost/blob/main/Patches/ClientPatch.cs
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.KickPlayer))]
internal class KickPlayerPatch
+1 -1
View File
@@ -3,7 +3,7 @@ using System;
using UnityEngine;
// https://github.com/SuperNewRoles/SuperNewRoles/blob/master/SuperNewRoles/Patches/LobbyBehaviourPatch.cs
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(LobbyBehaviour), nameof(LobbyBehaviour.Update))]
internal static class LobbyBehaviourUpdatePatch
+1 -1
View File
@@ -5,7 +5,7 @@ using UnityEngine;
using Object = UnityEngine.Object;
// https://github.com/Rabek009/MoreGamemodes/blob/master/Patches/LobbyViewSettingsPatch.cs
namespace HNSRevamped
namespace AmongUsRevamped
{
[HarmonyPatch(typeof(LobbyViewSettingsPane))]
public class LobbyViewPatch
+1 -1
View File
@@ -1,6 +1,6 @@
using AmongUs.GameOptions;
namespace HNSRevamped;
namespace AmongUsRevamped;
// https://github.com/astra1dev/AUnlocker/blob/main/src/OptionsPatches.cs
+4 -2
View File
@@ -2,7 +2,7 @@
using InnerNet;
using UnityEngine;
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.CoStartGame))]
internal class ApplyCustomImpostorCount
@@ -24,8 +24,9 @@ internal class ApplyCustomImpostorCount
}
}
if (!Utils.isHideNSeek) return;
if (Utils.isHideNSeek)
{
int seekersCount = Options.NumSeekers.GetInt();
int toAdd = Math.Max(0, seekersCount - 1);
@@ -66,3 +67,4 @@ internal class ApplyCustomImpostorCount
}
}
}
}
+99 -3
View File
@@ -1,8 +1,10 @@
using AmongUs.Data;
using AmongUs.GameOptions;
using Hazel;
using InnerNet;
using System;
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))]
class FixedUpdateInGamePatch
{
@@ -10,19 +12,42 @@ class FixedUpdateInGamePatch
{
if (__instance == null || __instance.PlayerId == 255) return;
// 0Kc
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 0.01f)
{
Main.NormalOptions.KillCooldown = 0.01f;
if (Options.NoKcdSettingsOverride.GetBool())
{
Main.NormalOptions.EmergencyCooldown = 0;
Main.NormalOptions.DiscussionTime = 0;
Main.NormalOptions.VotingTime = 30;
Main.NormalOptions.TaskBarMode = 0;
Main.NormalOptions.NumCommonTasks = 0;
Main.NormalOptions.NumShortTasks = 1;
Main.NormalOptions.NumLongTasks = 0;
}
}
if (Options.Gamemode.GetValue() < 1 && Main.NormalOptions.KillCooldown <= 0.01f)
// SnS
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 2.5f)
{
Main.NormalOptions.KillCooldown = 2.5f;
if (Options.SNSSettingsOverride.GetBool())
{
Main.NormalOptions.NumEmergencyMeetings = 0;
Main.NormalOptions.TaskBarMode = 0;
Options.DisableSabotage.SetValue(1);
Options.DisableCloseDoor.SetValue(1);
Options.DisableReport.SetValue(1);
}
}
if (Options.Gamemode.GetValue() == 0 && Main.NormalOptions.KillCooldown <= 0.01f)
{
Main.NormalOptions.KillCooldown = 25f;
}
@@ -55,8 +80,79 @@ class ReportDeadBodyPatch
{
if (!AmongUsClient.Instance.AmHost) return true;
if (target != null && Options.DisableReport.GetBool())
if (Options.DisableReport.GetBool() && target != null)
{
Logger.Info($" Stopped {__instance.Data.PlayerName} reporting the body of {target.PlayerName}", "ReportDeadBodyPatch");
return false;
}
else return true;
}
}
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.MurderPlayer))]
internal static class MurderPlayerPatch
{
public static readonly Dictionary<byte, int> misfireCount = new();
public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target, [HarmonyArgument(1)] MurderResultFlags resultFlags, ref bool __state)
{
if (!AmongUsClient.Instance.AmHost) return;
//2 = Shift and Seek
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek)
{
if (!resultFlags.HasFlag(MurderResultFlags.Succeeded))
return;
byte playerId = __instance.Data.PlayerId;
if (target.Data.PlayerId == __instance.shapeshiftTargetPlayerId)
{
Logger.Info($" {__instance.Data.PlayerName} correctly killed {target.Data.PlayerName} ", "SNSKillManager");
}
else
{
if (!misfireCount.ContainsKey(playerId))
misfireCount[playerId] = 0;
misfireCount[playerId]++;
__instance.RpcSetRole(RoleTypes.Crewmate);
__instance.isNew = true;
Logger.Info($" {__instance.Data.PlayerName} killed {target.Data.PlayerName} incorrectly and can't kill for {Options.CantKillTime.GetInt()}s", "SNSKillManager");
Logger.SendInGame($" {__instance.Data.PlayerName} killed {target.Data.PlayerName}, incorrectly and can't kill for {Options.CantKillTime.GetInt()}s");
new LateTask(() =>
{
__instance.isNew = false;
if (!__instance.Data.IsDead) {__instance.RpcSetRole(RoleTypes.Shapeshifter, false);}
}, Options.CantKillTime.GetInt(), "SNSResetRole");
if (misfireCount[__instance.Data.PlayerId] >= Options.MisfiresToSuicide.GetValue())
{
__instance.RpcSetRole(RoleTypes.ImpostorGhost);
Logger.Info($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} times and suicided", "SNSKillManager");
Logger.SendInGame($" {__instance.Data.PlayerName} misfired {misfireCount[playerId]} times and suicided");
}
}
}
}
}
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CheckShapeshift))]
internal static class CheckShapeshiftPatch
{
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target)
{
if (!AmongUsClient.Instance.AmHost) return true;
// Canceling a Shapeshift freezes the player until they successfully Shapeshift again. Unavoidable game logic.
if (Options.Gamemode.GetValue() == 2 && !Utils.isHideNSeek && __instance.isNew)
{
Logger.Info($" {__instance.Data.PlayerName} shapeshifted during misfire cooldown, making the game temporarily freeze them.", "SNSShapeshiftManager");
Logger.SendInGame($" {__instance.Data.PlayerName} shapeshifted during misfire cooldown, making the game temporarily freeze them.");
return false;
}
else return true;
+1 -1
View File
@@ -2,7 +2,7 @@
using InnerNet;
using UnityEngine;
namespace HNSRevamped;
namespace AmongUsRevamped;
[HarmonyPatch(typeof(SabotageSystemType), nameof(SabotageSystemType.UpdateSystem))] // SetInitialSabotageCooldown - set sabotage cooldown in start game
public static class SabotageSystemTypeRepairDamagePatch
+1 -1
View File
@@ -2,7 +2,7 @@ using AmongUs.GameOptions;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Random = UnityEngine.Random;
namespace HNSRevamped;
namespace AmongUsRevamped;
// https://github.com/Gurge44/EndlessHostRoles/blob/main/Patches/TaskAssignPatch.cs