diff --git a/Utilla/Behaviours/ConductBoardManager.cs b/Utilla/Behaviours/ConductBoardManager.cs index d4df9af..5075fbb 100644 --- a/Utilla/Behaviours/ConductBoardManager.cs +++ b/Utilla/Behaviours/ConductBoardManager.cs @@ -1,5 +1,4 @@ -using GorillaNetworking; -using GorillaTag; +using GorillaTag; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; diff --git a/Utilla/Constants.cs b/Utilla/Constants.cs index 798ab95..41996fb 100644 --- a/Utilla/Constants.cs +++ b/Utilla/Constants.cs @@ -6,7 +6,7 @@ public class Constants internal const string Name = "Utilla"; - internal const string Version = "1.6.24"; + internal const string Version = "1.6.25"; public const string GamemodePrefix = "MODDED_"; diff --git a/Utilla/Models/Gamemode.cs b/Utilla/Models/Gamemode.cs index fa1aa2e..8a91b4b 100644 --- a/Utilla/Models/Gamemode.cs +++ b/Utilla/Models/Gamemode.cs @@ -72,7 +72,7 @@ public Gamemode(string id, string displayName, GameModeType? game_mode_type = nu { BaseGamemode = game_mode_type; - ID = game_mode_type.HasValue && !id.EndsWith(game_mode_type.Value.ToString()) ? string.Concat(id, game_mode_type) : id; + ID = game_mode_type.HasValue && !id.EndsWith(game_mode_type.Value.ToString()) ? string.Concat(id, "|", game_mode_type) : id; DisplayName = displayName; Logging.Message($"Constructed custom gamemode: {id} based on {(game_mode_type.HasValue ? game_mode_type.Value : "no")} type"); diff --git a/Utilla/Patches/EnumUtilExtPatches.cs b/Utilla/Patches/EnumUtilExtPatches.cs new file mode 100644 index 0000000..6ebe0e1 --- /dev/null +++ b/Utilla/Patches/EnumUtilExtPatches.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using GorillaGameModes; +using HarmonyLib; +using Utilla.Utils; + +namespace Utilla.Patches; + +[HarmonyPatch] +public class EnumUtilExtPatches +{ + public static MethodBase TargetMethod() + { + return typeof(EnumUtilExt) + .GetMethod(nameof(EnumUtilExt.GetName), BindingFlags.Public | BindingFlags.Static) + ?.MakeGenericMethod(typeof(GameModeType)); + } + + public static bool Prefix(GameModeType e, ref string __result) { + if (int.TryParse(e.ToString(), out _)) { + string a = GameModeUtils.GetGameModeInstance(e).GameTypeName(); + __result = a; + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/Utilla/Patches/GameModePatches.cs b/Utilla/Patches/GameModePatches.cs new file mode 100644 index 0000000..7ec00a8 --- /dev/null +++ b/Utilla/Patches/GameModePatches.cs @@ -0,0 +1,17 @@ +using Fusion; +using HarmonyLib; + +namespace Utilla.Patches; + +[HarmonyPatch(typeof(GorillaGameManager)), HarmonyWrapSafe] +public class GameModePatches +{ + [HarmonyPatch("GameTypeName"), HarmonyPrefix] + public static bool GameTypeNamePatch(GorillaGameManager __instance, ref string __result) { + if (int.TryParse(__instance.GameType().ToString(), out _)) { + __result = __instance.GameModeName(); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/Utilla/Utilla.csproj b/Utilla/Utilla.csproj index 71879b9..21e3d64 100644 --- a/Utilla/Utilla.csproj +++ b/Utilla/Utilla.csproj @@ -35,13 +35,13 @@ $(GameAssemblyPath)\Cinemachine.dll - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\Gorilla Tag_Data\Managed\Fusion.Runtime.dll + $(GameAssemblyPath)\Fusion.Runtime.dll $(GameAssemblyPath)\Mono.Security.dll - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\Gorilla Tag_Data\Managed\Newtonsoft.Json.dll + $(GameAssemblyPath)\Newtonsoft.Json.dll $(GameAssemblyPath)\Oculus.Platform.dll