mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-19 15:51:59 +00:00
Fixes & Settings in preparation for Shift And Seek
This commit is contained in:
1 parent
8d29a2ad84
commit
73929cc189
7 files changed
+116
-29
No files matched your search
@@ -25,7 +25,6 @@ public partial class Main : BasePlugin
|
||||
public static ConfigEntry<bool> AutoStart { get; private set; }
|
||||
public static ConfigEntry<bool> DarkTheme { get; private set; }
|
||||
public static ConfigEntry<bool> LobbyMusic { get; private set; }
|
||||
public static ConfigEntry<bool> NoKcdMode { get; private set; }
|
||||
|
||||
public static NormalGameOptionsV10 NormalOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentNormalGameOptions : null;
|
||||
public static bool HasArgumentException;
|
||||
@@ -68,7 +67,6 @@ public partial class Main : BasePlugin
|
||||
AutoStart = Config.Bind("Client Options", "Auto Start", false);
|
||||
DarkTheme = Config.Bind("Client Options", "Dark Theme", true);
|
||||
LobbyMusic = Config.Bind("Client Options", "Lobby Music", false);
|
||||
NoKcdMode = Config.Bind("Client Options", "0 Kill Cooldown", false);
|
||||
|
||||
BanManager.Init();
|
||||
|
||||
|
||||
@@ -21,7 +21,16 @@ namespace HNSRevamped
|
||||
taskOptionsLoad.Wait();
|
||||
}
|
||||
|
||||
public static readonly string[] gameModes =
|
||||
{
|
||||
"None", "0 Kill Cooldown", "Shift And Seek"
|
||||
};
|
||||
|
||||
//System
|
||||
public static OptionItem Gamemode;
|
||||
|
||||
public static OptionItem TabGroupMain;
|
||||
|
||||
public static OptionItem KickLowLevelPlayer;
|
||||
public static OptionItem TempBanLowLevelPlayer;
|
||||
|
||||
@@ -39,6 +48,11 @@ namespace HNSRevamped
|
||||
public static OptionItem NoGameEnd;
|
||||
|
||||
//Mod
|
||||
public static OptionItem DisableSabotage;
|
||||
public static OptionItem DisableCloseDoor;
|
||||
|
||||
public static OptionItem DisableReport;
|
||||
|
||||
public static OptionItem OverrideTaskSettings;
|
||||
|
||||
public static OptionItem AllPlayersSameTasks;
|
||||
@@ -156,7 +170,13 @@ namespace HNSRevamped
|
||||
{
|
||||
if (IsLoaded) return;
|
||||
|
||||
//System Settings
|
||||
Gamemode = StringOptionItem.Create(1, "Gamemode", gameModes, 0, TabGroup.SystemSettings, false)
|
||||
.SetColor(Color.green)
|
||||
.SetHeader(true);
|
||||
|
||||
TabGroupMain = TextOptionItem.Create(2, "Main", TabGroup.SystemSettings)
|
||||
.SetColor(Color.yellow);
|
||||
|
||||
KickLowLevelPlayer = IntegerOptionItem.Create(60050, "Kick Players Under Level", new(0, 100, 1), 0, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Level);
|
||||
TempBanLowLevelPlayer = BooleanOptionItem.Create(60051, "Ban Instead Of Kick", false, TabGroup.SystemSettings, false)
|
||||
@@ -174,7 +194,7 @@ namespace HNSRevamped
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
WaitAutoStart = IntegerOptionItem.Create(44421, "AutoStart After", new(10, 600, 10), 5, TabGroup.SystemSettings, false)
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
PlayerAutoStart = IntegerOptionItem.Create(44422, "PlayerAutoStart", new(1, 15, 1), 5, TabGroup.SystemSettings, false);
|
||||
PlayerAutoStart = IntegerOptionItem.Create(44422, "Players Needed To Start", new(1, 15, 1), 5, TabGroup.SystemSettings, false);
|
||||
|
||||
NoGameEnd = BooleanOptionItem.Create(60380, "No Game End", false, TabGroup.SystemSettings, false)
|
||||
.SetColor(Color.red)
|
||||
@@ -187,6 +207,16 @@ namespace HNSRevamped
|
||||
.SetHeader(true);
|
||||
|
||||
// Mod Settings
|
||||
DisableSabotage = BooleanOptionItem.Create(60565, "Disable Critical Sabotages", false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue))
|
||||
.SetHeader(true);
|
||||
DisableCloseDoor = BooleanOptionItem.Create(60566, "Disable Door Sabotages", false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
DisableReport = BooleanOptionItem.Create(60520, "Disable Body Reports", false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
|
||||
|
||||
|
||||
OverrideTaskSettings = BooleanOptionItem.Create(22998, "<#ffd>Ove<#ffb>rri<#ff9>de T<#ffb>ask <#ffd>Set<#ffb>tin<#ff9>gs", false, TabGroup.ModSettings, false)
|
||||
.SetColor(new Color32(239, 89, 175, byte.MaxValue))
|
||||
.SetHeader(true);
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public static class Zoom
|
||||
|
||||
private static void SetZoomSize(bool times = false, bool reset = false)
|
||||
{
|
||||
var size = 1.2f;
|
||||
var size = 1.5f;
|
||||
if (!times) size = 1 / size;
|
||||
if (reset)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace HNSRevamped
|
||||
private static ClientOptionItem AutoStart;
|
||||
private static ClientOptionItem DarkTheme;
|
||||
private static ClientOptionItem LobbyMusic;
|
||||
private static ClientOptionItem NoKcdMode;
|
||||
|
||||
public static void Postfix(OptionsMenuBehaviour __instance)
|
||||
{
|
||||
@@ -66,9 +65,6 @@ namespace HNSRevamped
|
||||
|
||||
if (LobbyMusic == null || LobbyMusic.ToggleButton == null)
|
||||
LobbyMusic = ClientOptionItem.Create("Lobby Music", Main.LobbyMusic, __instance);
|
||||
|
||||
if (NoKcdMode == null || NoKcdMode.ToggleButton == null)
|
||||
NoKcdMode = ClientOptionItem.Create("0 Kill Cooldown", Main.NoKcdMode, __instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public static class NumberOption_Increase
|
||||
{
|
||||
public static bool Prefix(NumberOption __instance)
|
||||
{
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.TitleText.text != "# Impostors" && __instance.TitleText.text != "Player Speed")
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
{
|
||||
__instance.Value += __instance.Increment;
|
||||
__instance.UpdateValue();
|
||||
@@ -26,7 +26,7 @@ public static class NumberOption_Decrease
|
||||
{
|
||||
public static bool Prefix(NumberOption __instance)
|
||||
{
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.TitleText.text != "# Impostors" && __instance.TitleText.text != "Player Speed")
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
{
|
||||
__instance.Value -= __instance.Increment;
|
||||
__instance.UpdateValue();
|
||||
@@ -43,26 +43,9 @@ public static class NumberOption_Initialize
|
||||
{
|
||||
public static void Postfix(NumberOption __instance)
|
||||
{
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.TitleText.text != "# Impostors" && __instance.TitleText.text != "Player Speed")
|
||||
if (Utils.isHideNSeek || !Utils.isHideNSeek && __instance.Title != StringNames.GameNumImpostors && __instance.Title != StringNames.GamePlayerSpeed)
|
||||
{
|
||||
__instance.ValidRange = new FloatRange(-999f, 999f);
|
||||
}
|
||||
|
||||
if (Main.NoKcdMode.Value && !Utils.isHideNSeek)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 0.01f;
|
||||
|
||||
Main.NormalOptions.EmergencyCooldown = 0;
|
||||
Main.NormalOptions.DiscussionTime = 0;
|
||||
|
||||
Main.NormalOptions.NumCommonTasks = 0;
|
||||
Main.NormalOptions.NumShortTasks = 1;
|
||||
Main.NormalOptions.NumLongTasks = 0;
|
||||
}
|
||||
|
||||
if (!Main.NoKcdMode.Value && Main.NormalOptions.KillCooldown <= 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 25f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,23 @@ class FixedUpdateInGamePatch
|
||||
{
|
||||
if (__instance == null || __instance.PlayerId == 255) return;
|
||||
|
||||
if (Options.Gamemode.GetValue() == 1 && !Utils.isHideNSeek && Main.NormalOptions.KillCooldown != 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 0.01f;
|
||||
|
||||
Main.NormalOptions.EmergencyCooldown = 0;
|
||||
Main.NormalOptions.DiscussionTime = 0;
|
||||
|
||||
Main.NormalOptions.NumCommonTasks = 0;
|
||||
Main.NormalOptions.NumShortTasks = 1;
|
||||
Main.NormalOptions.NumLongTasks = 0;
|
||||
}
|
||||
|
||||
if (Options.Gamemode.GetValue() < 1 && Main.NormalOptions.KillCooldown <= 0.01f)
|
||||
{
|
||||
Main.NormalOptions.KillCooldown = 25f;
|
||||
}
|
||||
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
if (__instance.Data.PlayerLevel != 0 && __instance.Data.PlayerLevel < Options.KickLowLevelPlayer.GetInt() && __instance.Data.ClientId != AmongUsClient.Instance.HostId)
|
||||
@@ -29,4 +46,19 @@ class FixedUpdateInGamePatch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.ReportDeadBody))]
|
||||
class ReportDeadBodyPatch
|
||||
{
|
||||
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] NetworkedPlayerInfo target)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
if (target != null && Options.DisableReport.GetBool())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HNSRevamped;
|
||||
|
||||
[HarmonyPatch(typeof(SabotageSystemType), nameof(SabotageSystemType.UpdateSystem))] // SetInitialSabotageCooldown - set sabotage cooldown in start game
|
||||
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);
|
||||
amount = newReader.ReadByte();
|
||||
newReader.Recycle();
|
||||
}
|
||||
var Sabo = (SystemTypes)amount;
|
||||
|
||||
Logger.Info($" {player.Data.PlayerName} is trying to sabotage: {Sabo}", "SabotageCheck");
|
||||
if (Options.DisableSabotage.GetBool())
|
||||
{
|
||||
Logger.Info($" Sabotage {Sabo} by: {player.Data.PlayerName} was blocked", "SabotageCheck");
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.CloseDoorsOfType))]
|
||||
class ShipStatusCloseDoorsPatch
|
||||
{
|
||||
public static bool Prefix(SystemTypes room)
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return true;
|
||||
|
||||
Logger.Info($" Trying to close the door in: {room}", "DoorCheck");
|
||||
|
||||
if (Options.DisableCloseDoor.GetBool())
|
||||
{
|
||||
Logger.Info($" Door sabotage in: {room} was blocked", "DoorCheck");
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user