diff --git a/MMOKitchen.csproj b/MMOKitchen.csproj
index 2cf881b..1e2b4f4 100644
--- a/MMOKitchen.csproj
+++ b/MMOKitchen.csproj
@@ -21,7 +21,7 @@
-
+
diff --git a/Mod.cs b/Mod.cs
index 6fb694d..bceb390 100644
--- a/Mod.cs
+++ b/Mod.cs
@@ -6,6 +6,7 @@ using Kitchen;
using KitchenLib.Event;
using KitchenLib.Preferences;
using MMOKitchen.Menus;
+using KitchenLogger = KitchenLib.Logging.KitchenLogger;
namespace MMOKitchen
{
@@ -13,9 +14,9 @@ namespace MMOKitchen
{
public const string MOD_GUID = "com.starfluxgames.mmokitchen";
public const string MOD_NAME = "MMO Kitchen";
- public const string MOD_VERSION = "0.3.0";
+ public const string MOD_VERSION = "0.3.1";
public const string MOD_AUTHOR = "StarFluxGames";
- public const string MOD_GAMEVERSION = ">=1.1.9";
+ public const string MOD_GAMEVERSION = ">=1.2.0";
public static KitchenLogger Logger;
public static PreferenceManager manager;
@@ -41,19 +42,16 @@ namespace MMOKitchen
manager.RegisterPreference(new PreferenceBool("scaleAbove4Players", false));
manager.RegisterPreference(new PreferenceFloat("scaleAbove4PlayersMultiplier", 0.1f));
manager.Load();
-
- ModsPreferencesMenu.RegisterMenu(MOD_NAME, typeof(PreferenceMenu), typeof(PauseMenuAction));
-
- Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) =>
+
+ ModsPreferencesMenu.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu), typeof(MenuAction));
+ ModsPreferencesMenu.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu), typeof(MenuAction));
+ Events.MainMenuView_SetupMenusEvent += (s, args) =>
{
- args.Menus.Add(typeof(PreferenceMenu), new PreferenceMenu(args.Container, args.Module_list));
+ args.addMenu.Invoke(args.instance, new object[] { typeof(PreferenceMenu), new PreferenceMenu(args.instance.ButtonContainer, args.module_list) });
};
-
- ModsPreferencesMenu.RegisterMenu(MOD_NAME, typeof(PreferenceMenu), typeof(MainMenuAction));
-
- Events.PreferenceMenu_MainMenu_CreateSubmenusEvent += (s, args) =>
+ Events.PlayerPauseView_SetupMenusEvent += (s, args) =>
{
- args.Menus.Add(typeof(PreferenceMenu), new PreferenceMenu(args.Container, args.Module_list));
+ args.addMenu.Invoke(args.instance, new object[] { typeof(PreferenceMenu), new PreferenceMenu(args.instance.ButtonContainer, args.module_list) });
};
}
}
diff --git a/Patches/SteamPlatformPatch.cs b/Patches/SteamPlatformPatch.cs
index be3e937..bf8c707 100644
--- a/Patches/SteamPlatformPatch.cs
+++ b/Patches/SteamPlatformPatch.cs
@@ -1,42 +1,33 @@
using HarmonyLib;
using Kitchen.NetworkSupport;
-using Steamworks;
-using Steamworks.Data;
using System;
+using System.Collections.Generic;
using System.Reflection;
-using System.Threading.Tasks;
+using System.Reflection.Emit;
namespace MMOKitchen.Patches
{
/*
* This patch is used to change how many players can join the lobby using Steam.
*/
-
- [HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
+ [HarmonyPatch(typeof(SteamPlatform))]
public class SteamPlatformPatch
- {
- public static bool Prefix(SteamPlatform __instance, Action callback)
+ {
+ private static MethodBase TargetMethod()
{
- if (__instance.IsReady)
- {
- SteamMatchmaking.CreateLobbyAsync(Mod.MaxPlayers).ContinueWith(delegate (Task task)
- {
- if (task.IsCompleted && task.Result != null)
- {
- Lobby valueOrDefault = task.Result.GetValueOrDefault();
- __instance.CurrentInviteLobby = valueOrDefault;
-
- MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions");
- performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions });
- callback(true, valueOrDefault);
- }
- else
- {
- callback(false, default(Lobby));
- }
- });
- }
- return false;
+ Type type = AccessTools.FirstInner(typeof(SteamPlatform), t => t.Name.Contains("d__26"));
+ return AccessTools.FirstMethod(type, method => method.Name.Contains("MoveNext"));
+ }
+ [HarmonyTranspiler]
+ private static IEnumerable Transpiler(IEnumerable instructions)
+ {
+ CodeMatcher matcher = new(instructions);
+
+ matcher.MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(OpCodes.Bne_Un), new CodeMatch(OpCodes.Ldc_I4_4))
+ .Advance(2)
+ .Set(OpCodes.Ldc_I4, Mod.MaxPlayers);
+
+ return matcher.InstructionEnumeration();
}
}
}
diff --git a/Systems/ProfileEditorOverride.cs b/Systems/ProfileEditorOverride.cs
index 5ff9d03..7a99267 100644
--- a/Systems/ProfileEditorOverride.cs
+++ b/Systems/ProfileEditorOverride.cs
@@ -17,6 +17,6 @@ namespace MMOKitchen.Systems
SetComponent(data.Target, Editor);
}
- private CTriggerProfileEditor Editor;
+ private CTriggerPlayerSpecificUI Editor;
}
}
\ No newline at end of file