diff --git a/src/CrowdedMod/Components/MeetingHudPagingBehaviour.cs b/src/CrowdedMod/Components/MeetingHudPagingBehaviour.cs
index b8276ac..38f60e1 100644
--- a/src/CrowdedMod/Components/MeetingHudPagingBehaviour.cs
+++ b/src/CrowdedMod/Components/MeetingHudPagingBehaviour.cs
@@ -1,8 +1,8 @@
+using Il2CppInterop.Runtime.Attributes;
+using Reactor.Utilities.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
-using Il2CppInterop.Runtime.Attributes;
-using Reactor.Utilities.Attributes;
using UnityEngine;
namespace CrowdedMod.Components;
@@ -36,8 +36,10 @@ public override void OnPageChanged()
{
var i = 0;
- foreach (var button in Targets) {
- if (i >= PageIndex * MaxPerPage && i < (PageIndex + 1) * MaxPerPage) {
+ foreach (var button in Targets)
+ {
+ if (i >= PageIndex * MaxPerPage && i < (PageIndex + 1) * MaxPerPage)
+ {
button.gameObject.SetActive(true);
var relativeIndex = i % MaxPerPage;
@@ -50,7 +52,9 @@ public override void OnPageChanged()
meetingHud.VoteButtonOffsets.y * row,
buttonTransform.localPosition.z
);
- } else {
+ }
+ else
+ {
button.gameObject.SetActive(false);
}
i++;
diff --git a/src/CrowdedMod/Components/ShapeShifterPagingBehaviour.cs b/src/CrowdedMod/Components/ShapeShifterPagingBehaviour.cs
index 9efbba3..ce51376 100644
--- a/src/CrowdedMod/Components/ShapeShifterPagingBehaviour.cs
+++ b/src/CrowdedMod/Components/ShapeShifterPagingBehaviour.cs
@@ -1,8 +1,8 @@
-using System;
+using Il2CppInterop.Runtime.Attributes;
+using Reactor.Utilities.Attributes;
+using System;
using System.Collections.Generic;
using System.Linq;
-using Il2CppInterop.Runtime.Attributes;
-using Reactor.Utilities.Attributes;
using TMPro;
using UnityEngine;
@@ -40,7 +40,8 @@ public override void OnPageChanged()
foreach (var panel in Targets)
{
- if (i >= PageIndex * MaxPerPage && i < (PageIndex + 1) * MaxPerPage) {
+ if (i >= PageIndex * MaxPerPage && i < (PageIndex + 1) * MaxPerPage)
+ {
panel.gameObject.SetActive(true);
var relativeIndex = i % MaxPerPage;
@@ -52,7 +53,9 @@ public override void OnPageChanged()
shapeshifterMinigame.YStart + shapeshifterMinigame.YOffset * row,
buttonTransform.localPosition.z
);
- } else {
+ }
+ else
+ {
panel.gameObject.SetActive(false);
}
diff --git a/src/CrowdedMod/Components/VitalsPagingBehaviour.cs b/src/CrowdedMod/Components/VitalsPagingBehaviour.cs
index 227eee4..bae43ad 100644
--- a/src/CrowdedMod/Components/VitalsPagingBehaviour.cs
+++ b/src/CrowdedMod/Components/VitalsPagingBehaviour.cs
@@ -1,9 +1,9 @@
+using Il2CppInterop.Runtime.Attributes;
+using Reactor.Utilities.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
-using Il2CppInterop.Runtime.Attributes;
using TMPro;
-using Reactor.Utilities.Attributes;
using UnityEngine;
namespace CrowdedMod.Components;
@@ -11,7 +11,7 @@ namespace CrowdedMod.Components;
[RegisterInIl2Cpp]
public class VitalsPagingBehaviour : AbstractPagingBehaviour
{
- public VitalsPagingBehaviour(IntPtr ptr) : base(ptr) {}
+ public VitalsPagingBehaviour(IntPtr ptr) : base(ptr) { }
public VitalsMinigame vitalsMinigame = null!;
diff --git a/src/CrowdedMod/CrowdedMod.csproj b/src/CrowdedMod/CrowdedMod.csproj
index df6b53a..f24f210 100644
--- a/src/CrowdedMod/CrowdedMod.csproj
+++ b/src/CrowdedMod/CrowdedMod.csproj
@@ -11,7 +11,7 @@
Steam
- 2023.3.28
+ 2024.6.18
@@ -21,9 +21,6 @@
-
-
-
diff --git a/src/CrowdedMod/CrowdedModPlugin.cs b/src/CrowdedMod/CrowdedModPlugin.cs
index 797dcb1..8caee96 100644
--- a/src/CrowdedMod/CrowdedModPlugin.cs
+++ b/src/CrowdedMod/CrowdedModPlugin.cs
@@ -1,11 +1,11 @@
-using System.Linq;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Reactor;
using Reactor.Networking;
using Reactor.Networking.Attributes;
+using System.Linq;
namespace CrowdedMod;
@@ -19,12 +19,12 @@ public partial class CrowdedModPlugin : BasePlugin
public const int MaxPlayers = 127;
public const int MaxImpostors = 127 / 2;
- private Harmony Harmony { get; } = new (Id);
+ private Harmony Harmony { get; } = new(Id);
public override void Load()
{
- NormalGameOptionsV07.RecommendedImpostors = NormalGameOptionsV07.MaxImpostors = Enumerable.Repeat(127, 127).ToArray();
- NormalGameOptionsV07.MinPlayers = Enumerable.Repeat(4, 127).ToArray();
+ NormalGameOptionsV08.RecommendedImpostors = NormalGameOptionsV08.MaxImpostors = Enumerable.Repeat(127, 127).ToArray();
+ NormalGameOptionsV08.MinPlayers = Enumerable.Repeat(4, 127).ToArray();
Harmony.PatchAll();
}
diff --git a/src/CrowdedMod/Net/SetColorRpc.cs b/src/CrowdedMod/Net/SetColorRpc.cs
index aab154c..fa78391 100644
--- a/src/CrowdedMod/Net/SetColorRpc.cs
+++ b/src/CrowdedMod/Net/SetColorRpc.cs
@@ -3,7 +3,7 @@
using Reactor.Networking.Rpc;
namespace CrowdedMod.Net;
-[RegisterCustomRpc((uint) CustomRpcCalls.SetColor)]
+[RegisterCustomRpc((uint)CustomRpcCalls.SetColor)]
public class SetColorRpc : PlayerCustomRpc
{
public SetColorRpc(CrowdedModPlugin plugin, uint id) : base(plugin, id)
diff --git a/src/CrowdedMod/Patches/CreateGameOptionsPatches.cs b/src/CrowdedMod/Patches/CreateGameOptionsPatches.cs
index 5f0c2ca..a81c3f2 100644
--- a/src/CrowdedMod/Patches/CreateGameOptionsPatches.cs
+++ b/src/CrowdedMod/Patches/CreateGameOptionsPatches.cs
@@ -1,7 +1,7 @@
-using System;
-using AmongUs.GameOptions;
+using AmongUs.GameOptions;
using HarmonyLib;
using Reactor.Utilities.Extensions;
+using System;
using TMPro;
using UnityEngine;
@@ -98,7 +98,8 @@ public static void Postfix(CreateOptionsPicker __instance)
var firstPassiveButton = firstButton.PassiveButton;
firstPassiveButton.OnClick.RemoveAllListeners();
- firstPassiveButton.OnClick.AddListener((Action)(() => {
+ firstPassiveButton.OnClick.AddListener((Action)(() =>
+ {
var newVal = Mathf.Clamp(
byte.Parse(secondButtonText.text) - 1,
1,
@@ -114,7 +115,8 @@ public static void Postfix(CreateOptionsPicker __instance)
var thirdPassiveButton = thirdButton.PassiveButton;
thirdPassiveButton.OnClick.RemoveAllListeners();
- thirdPassiveButton.OnClick.AddListener((Action)(() => {
+ thirdPassiveButton.OnClick.AddListener((Action)(() =>
+ {
var newVal = Mathf.Clamp(
byte.Parse(secondButtonText.text) + 1,
1,
@@ -155,37 +157,5 @@ public static bool Prefix()
return false;
}
}
-
- [HarmonyPatch(typeof(CreateOptionsPicker), nameof(CreateOptionsPicker.SetImpostorButtons))]
- public static class CreateOptionsPicker_SetImpostorButtons
- {
- public static bool Prefix(CreateOptionsPicker __instance, int numImpostors)
- {
- IGameOptions targetOptions = __instance.GetTargetOptions();
- targetOptions.SetInt(Int32OptionNames.NumImpostors, numImpostors);
- __instance.SetTargetOptions(targetOptions);
- __instance.UpdateImpostorsButtons(numImpostors);
-
- return false;
- }
- }
-
- [HarmonyPatch(typeof(CreateOptionsPicker), nameof(CreateOptionsPicker.SetMaxPlayersButtons))]
- public static class CreateOptionsPicker_SetMaxPlayersButtons
- {
- public static bool Prefix(CreateOptionsPicker __instance, int maxPlayers)
- {
- if (DestroyableSingleton.InstanceExists)
- {
- return true;
- }
-
- IGameOptions targetOptions = __instance.GetTargetOptions();
- targetOptions.SetInt(Int32OptionNames.MaxPlayers, maxPlayers);
- __instance.SetTargetOptions(targetOptions);
- __instance.UpdateMaxPlayersButtons(targetOptions);
-
- return false;
- }
- }
}
+
diff --git a/src/CrowdedMod/Patches/GenericPatches.cs b/src/CrowdedMod/Patches/GenericPatches.cs
index 9dfcdfb..773e9e8 100644
--- a/src/CrowdedMod/Patches/GenericPatches.cs
+++ b/src/CrowdedMod/Patches/GenericPatches.cs
@@ -1,24 +1,26 @@
-using System.Linq;
using AmongUs.GameOptions;
using CrowdedMod.Net;
using HarmonyLib;
-using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Reactor.Networking.Rpc;
-using UnityEngine;
+using System.Linq;
namespace CrowdedMod.Patches;
-internal static class GenericPatches {
+internal static class GenericPatches
+{
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CmdCheckColor))]
- public static class PlayerControlCmdCheckColorPatch {
- public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte colorId) {
+ public static class PlayerControlCmdCheckColorPatch
+ {
+ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte colorId)
+ {
Rpc.Instance.Send(__instance, colorId);
return false;
}
}
[HarmonyPatch(typeof(PlayerTab), nameof(PlayerTab.Update))]
- public static class PlayerTabIsSelectedItemEquippedPatch {
+ public static class PlayerTabIsSelectedItemEquippedPatch
+ {
public static void Postfix(PlayerTab __instance)
{
__instance.currentColorIsEquipped = false;
@@ -33,7 +35,7 @@ public static bool Prefix(PlayerTab __instance)
__instance.AvailableColors.Clear();
for (var i = 0; i < Palette.PlayerColors.Count; i++)
{
- if(!PlayerControl.LocalPlayer || PlayerControl.LocalPlayer.CurrentOutfit.ColorId != i)
+ if (!PlayerControl.LocalPlayer || PlayerControl.LocalPlayer.CurrentOutfit.ColorId != i)
{
__instance.AvailableColors.Add(i);
}
@@ -72,7 +74,8 @@ public static void Prefix(GameStartManager __instance)
if (__instance.LastPlayerCount > __instance.MinPlayers)
{
fixDummyCounterColor = "";
- } else if (__instance.LastPlayerCount == __instance.MinPlayers)
+ }
+ else if (__instance.LastPlayerCount == __instance.MinPlayers)
{
fixDummyCounterColor = "";
}
@@ -88,7 +91,7 @@ public static void Postfix(GameStartManager __instance)
{
return;
}
-
+
__instance.PlayerCounter.text = $"{fixDummyCounterColor}{GameData.Instance.PlayerCount}/{GameManager.Instance.LogicOptions.MaxPlayers}";
fixDummyCounterColor = null;
}
@@ -157,11 +160,12 @@ public static void Postfix(GameOptionsMenu __instance)
{
var numberOptions = __instance.GetComponentsInChildren();
- if (numberOptions.Any(o => o.Title == StringNames.GameNumImpostors))
+ var impostorsOption = numberOptions.FirstOrDefault(o => o.Title == StringNames.GameNumImpostors);
+ if (impostorsOption != null)
{
- numberOptions.First(o => o.Title == StringNames.GameNumImpostors)
- .ValidRange = new FloatRange(1, CrowdedModPlugin.MaxImpostors);
+ impostorsOption.ValidRange = new FloatRange(1, CrowdedModPlugin.MaxImpostors);
}
+
}
}
-}
\ No newline at end of file
+}
diff --git a/src/CrowdedMod/Patches/PagingPatches.cs b/src/CrowdedMod/Patches/PagingPatches.cs
index fdfb22b..9fe11f5 100644
--- a/src/CrowdedMod/Patches/PagingPatches.cs
+++ b/src/CrowdedMod/Patches/PagingPatches.cs
@@ -1,5 +1,5 @@
-using HarmonyLib;
-using CrowdedMod.Components;
+using CrowdedMod.Components;
+using HarmonyLib;
namespace CrowdedMod.Patches;