using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Mod.CustomCampaigns.Extensions; using Mod.CustomCampaigns.Scripts; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CustomCampaigns")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CustomCampaigns")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3dd30da1-6c83-4cc3-8922-ea8b1847fd6d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Mod.CustomCampaigns { [BepInPlugin("Distance.CustomCampaigns", "Custom Campaigns", "1.1.0")] public sealed class Mod : BaseUnityPlugin { private const string modGUID = "Distance.CustomCampaigns"; private const string modName = "Custom Campaigns"; private const string modVersion = "1.1.0"; private static readonly Harmony harmony = new Harmony("Distance.CustomCampaigns"); public static ManualLogSource Log = new ManualLogSource("Custom Campaigns"); public static Mod Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Log = Logger.CreateLogSource("Distance.CustomCampaigns"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Thanks for using Custom Campaigns!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading..."); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded!"); } private void OnConfigChanged(object sender, EventArgs e) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null); if (val != null) { } } } } namespace Mod.CustomCampaigns.Scripts { public class CreateCampaignLogic : MonoBehaviour { private LevelGridGrid grid_; private void Awake() { grid_ = ((Component)this).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)grid_)) { Mod.Log.LogError((object)"LevelGridGrid component not found"); } Mod.Log.LogInfo((object)"Created Component!"); } private void Update() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown if (grid_.isGridPushed_ && (int)((LevelSelectMenuAbstract)grid_.levelGridMenu_).displayType_ == 0 && !grid_.playlist_.IsResourcesPlaylist() && G.Sys.InputManager_.GetKeyUp((InputAction)48, -2)) { LevelSet set = new LevelSet(); set.resourcesLevelNameAndPathPairsInSet_ = grid_.playlist_.GetLevelSet(); grid_.levelGridMenu_.menuPanelManager_.ShowOkCancel("Create a campaign out of the [c][9480e7]" + grid_.playlist_.playlistName_ + "[-][c] playlist?", "Create Campaign", (OnButtonClicked)delegate { LevelPlaylist val = LevelPlaylist.Create(set, grid_.playlist_.playlistName_, (GameModeID)15); val.Awake(); val.Save(); ((UIExButtonContainer)grid_.levelGridMenu_.buttonList_).Remove((Entry)(object)grid_.levelGridMenu_.selectedEntry_); ((UIExButtonContainer)grid_.levelGridMenu_.buttonList_).SortAndUpdateVisibleButtons(); grid_.levelGridMenu_.SelectEntry(grid_.levelGridMenu_.ScrollableEntries_[0], true); }, (OnButtonClicked)null, (Pivot)4); } } } public class LevelPlaylistCompoundData : MonoBehaviour { public LevelPlaylist Playlist { get; internal set; } public PlaylistEntry PlaylistEntry { get; internal set; } public string FilePath { get; internal set; } public GameModeID CustomGameModeID { get; internal set; } public LevelGroupFlags LevelGroupFlags { get; internal set; } public Type PlaylistType { get { //IL_000d: Unknown result type (might be due to invalid IL or missing references) PlaylistEntry playlistEntry = PlaylistEntry; return (Type)((playlistEntry == null) ? (-1) : ((int)playlistEntry.type_)); } } } } namespace Mod.CustomCampaigns.Patches { [HarmonyPatch(typeof(LevelGridGrid), "PushGrid")] internal static class LevelGridGrid__PushGrid { [HarmonyTranspiler] internal static IEnumerable AddButton(IEnumerable instructions) { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown Mod.Log.LogInfo((object)"Transpiling..."); List list = new List(instructions); for (int i = 3; i < list.Count; i++) { if (list[i - 2].opcode == OpCodes.Callvirt && ((MethodInfo)list[i - 2].operand).Name == "Push" && list[i].opcode == OpCodes.Call && ((MethodInfo)list[i].operand).Name == "GridPushChange") { Mod.Log.LogInfo((object)$"call MenuPanel.Push @ {i - 2}"); List