Decompiled source of Bunject v1.3.0
Bunject.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using Bunburrows; using Bunject.Computer; using Bunject.Dialogue; using Bunject.Internal; using Bunject.Levels; using Bunject.Map; using Bunject.Menu; using Bunject.Monitoring; using Bunject.Patches.PaqueretteActionResolverPatches; using Bunject.Patches.SaveFileManipulationUtilityPatches; using Bunject.Tiling; using Bunject.Utility; using Characters; using Characters.Bunny.Data; using Computer.Opheline; using Computer.Opheline.Map; using Computer.Opheline.Tabs; using Computer.Paquerette.Logs; using Dialogue; using HarmonyLib; using Items; using Levels; using Menu; using Misc; using Newtonsoft.Json; using Pause; using PlatformSpecific; using Saving; using Saving.Architecture; using State; using TMPro; using Tiling.Behaviour; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.Tilemaps; using UnityEngine.UI; using VisualEffects; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Bunject")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Bunject")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2cdf8a36-d56d-43fc-a1a4-2e64ac6b8d90")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace Bunject { public class BunjectAPI { private List<IBunjectorPlugin> bunjectors; internal static BunjectAPI Instance { get; private set; } internal static ForwardingBunjector Forward { get; private set; } internal static IReadOnlyList<IBunjectorPlugin> Bunjectors => Instance.bunjectors; internal static IEnumerable<ITileSource> TileSources => Instance.bunjectors.OfType<ITileSource>(); internal static IEnumerable<IMonitor> Monitors => Instance.bunjectors.OfType<IMonitor>(); internal static IEnumerable<IMenuSource> MenuOptions => Instance.bunjectors.OfType<IMenuSource>(); internal static IEnumerable<IComputerPageSource> ComputerPageSources => Instance.bunjectors.OfType<IComputerPageSource>(); static BunjectAPI() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) Forward = new ForwardingBunjector(); Instance = new BunjectAPI(); new Harmony("bunject.API").PatchAll(Assembly.GetAssembly(typeof(BunjectAPI))); } public static void RegisterPlugin(IBunjectorPlugin bunjector) { Instance.bunjectors.Add(bunjector); } public static void RegisterBunburrow(IModBunburrow modBunburrow) { BunburrowManager.RegisterBurrow(modBunburrow); } public static void RegisterElevator(int bunburrowID, int depth) { BunburrowManager.RegisterElevator(bunburrowID, depth); } public static void ClearRegisters() { BunburrowManager.ClearRegisters(); } public static void BeginLoadingScreen() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) MenuController val = Object.FindFirstObjectByType<MenuController>(); if (!((Object)(object)val == (Object)null)) { new Traverse((object)val).Field<Camera>("mainCamera").Value.backgroundColor = new Color(0.97f, 0.94f, 0.94f); val.ShowLoadingScreen(); } } public static void CancelLoadingScreen() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) MenuController val = Object.FindFirstObjectByType<MenuController>(); if (!((Object)(object)val == (Object)null)) { new Traverse((object)val).Field<Camera>("mainCamera").Value.backgroundColor = new Color(0.2509804f, 0.0627451f, 5f / 32f); new Traverse((object)val).Field<GameObject>("loadingScreen").Value.SetActive(false); } } public static bool LoadSave(string pluginName, string saveName) { SaveFileCustomData.CustomSavePath = SaveFileModUtility.GetPluginSaveFilePath(pluginName, saveName); SaveFileCustomData.CustomSaveBackupPath = SaveFileModUtility.GetPluginSaveBackupFilePath(pluginName, saveName); SaveFileCustomData.CustomDeletedSavePath = SaveFileModUtility.GetPluginSaveDeletedFilePath(pluginName, saveName); SaveFileCustomData.CustomOldSaveDataPath = SaveFileCustomData.CustomSavePath + ".old"; EnsureFileExists(SaveFileCustomData.CustomSavePath); EnsureFileExists(SaveFileCustomData.CustomSaveBackupPath); EnsureFileExists(SaveFileCustomData.CustomDeletedSavePath); EnsureFileExists(SaveFileCustomData.CustomOldSaveDataPath); SaveFileManipulationUtility.TryLoadSave(999); SceneManager.LoadSceneAsync("Game"); return true; } private static void EnsureFileExists(string path) { if (!File.Exists(path)) { new FileInfo(path).Directory.Create(); File.WriteAllBytes(path, new byte[0]); } } private BunjectAPI() { bunjectors = new List<IBunjectorPlugin>(); } } public interface IBunjectorPlugin { void OnAssetsLoaded(); void OnProgressionLoaded(GeneralProgression progression); } } namespace Bunject.Utility { internal class DebugUtil { public static void Trace(string message) { Debug.Log((object)("[Bunject.Computer] " + message)); } public static void DumpHierarchy(GameObject obj) { try { WholeThing(obj); } catch (Exception ex) { Debug.LogException(ex); } } private static void WholeThing(GameObject obj) { Debug.Log((object)("Game Object: " + ((Object)obj).name + " << " + ((object)obj).GetType().Name + " >>")); Component[] components = obj.GetComponents<Component>(); foreach (Component val in components) { Debug.Log((object)(" - " + ((object)val).GetType().Name)); Traverse val2 = Traverse.Create((object)val); foreach (string item in val2.Fields()) { Debug.Log((object)$" - : {item} - {val2.Field(item)}"); } foreach (string item2 in val2.Properties()) { Debug.Log((object)$" - : {item2} - {val2.Property(item2, (object[])null)}"); } } Debug.Log((object)("======================= " + ((Object)obj).name + " CHILDREN =======================")); foreach (GameObject item3 in from tr in ((IEnumerable)obj.transform).OfType<Transform>() select ((Component)tr).gameObject) { WholeThing(item3); } Debug.Log((object)("!!!!!!!!!!!!!!!!!!!!!!! " + ((Object)obj).name + " CHILDREN END !!!!!!!!!!!!!!!!!!!!!!!")); } } internal class InjectionDictionary<K, V> : Dictionary<K, V>, IDictionary<K, V>, ICollection<KeyValuePair<K, V>>, IEnumerable<KeyValuePair<K, V>>, IEnumerable where V : class { private Func<K, V, V> injector; public new V this[K key] { get { V value; V val = ((!base.TryGetValue(key, out value)) ? injector(key, null) : injector(key, value)); if (val == null) { throw new KeyNotFoundException(); } return val; } set { base[key] = value; } } public InjectionDictionary(Func<K, V, V> injector, IDictionary<K, V> source) : base(source) { this.injector = injector; } public new bool TryGetValue(K key, out V result) { result = null; if (base.TryGetValue(key, out result)) { result = injector(key, result); } else { result = injector(key, null); } return result == null; } } } namespace Bunject.Tiling { public abstract class BaseTileSourcePlugin { public abstract void Awake(); public virtual void OnAssetsLoaded() { } public virtual void OnProgressionLoaded(GeneralProgression progression) { } public virtual LevelsList LoadEmergencyLevelsList(LevelsList original) { return original; } public abstract bool SupportsTile(string tile); public abstract Tile LoadTile(LevelObject levelObject, string tile, Vector2Int position); } public interface ITileSource : IBunjectorPlugin { bool SupportsTile(string tile); Tile LoadTile(LevelObject levelObject, string tile, Vector2Int position); } public interface IUpdateTileSprite { void UpdateTileSprite(); } public sealed class Tile { public TileLevelData Instance { get; set; } public bool IsBunnyTile { get; set; } public bool IsStartTile { get; set; } public bool IsHoleTile { get; set; } public bool HasStartTrap { get; set; } public bool HasStartCarrot { get; set; } public Tile(TileLevelData instance) { Instance = instance; } } public static class TileValidator { private const string VALID_TILES = "^(S(?:{K})?|B(?:{[KB]*})?|E|F|D[0-9]|P[0-9]|N[0-9]+|\\!|Oph|Her|X|C|T(?:{[URLDCTKBPS]+})?|W(?:{[URLD]*[0-9]?})?|R(?:{[URLD]*[0-9]?})?|EW|ER|PU|A|Y(?:{K})?)$"; private static readonly Regex ValidTileRegex = new Regex("^(S(?:{K})?|B(?:{[KB]*})?|E|F|D[0-9]|P[0-9]|N[0-9]+|\\!|Oph|Her|X|C|T(?:{[URLDCTKBPS]+})?|W(?:{[URLD]*[0-9]?})?|R(?:{[URLD]*[0-9]?})?|EW|ER|PU|A|Y(?:{K})?)$"); private static readonly string[] Separators = new string[4] { ",", "\r\n", "\r", "\n" }; public static List<string> GetTilesFromContent(string content) { return content.Split(Separators, StringSplitOptions.RemoveEmptyEntries).ToList(); } public static bool ValidateTiles(string content) { return ValidateTiles(GetTilesFromContent(content)); } public static bool ValidateTiles(IEnumerable<string> tiles) { bool flag = true; foreach (string tile in tiles) { flag &= ValidateTiles(tile); } return flag; } public static bool ValidateTile(string tile) { if (!ValidTileRegex.IsMatch(tile)) { return BunjectAPI.Forward.SupportsTile(tile); } return true; } } } namespace Bunject.Patches { [HarmonyPatch(typeof(BunniesReleaseAnimator), "ConvertBunburrowToReleaseTargetsList")] internal class ConvertBunburrowToReleaseTargetsListPatches { private static bool Prefix(ref List<Vector2Int> __result, Bunburrow bunburrow) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (!bunburrow.IsCustomBunburrow()) { return true; } IModBunburrow modBunburrow = bunburrow.GetModBunburrow(); __result = modBunburrow.GetReleasePath() ?? new List<Vector2Int>(); return false; } } } namespace Bunject.Patches.VisualEffectsPatches { [HarmonyPatch(typeof(VisualEffectsController), "UpdateVisualEffects", new Type[] { typeof(VisualEffectsInfo) })] internal class UpdateVisualEffectsPatch { [HarmonyPriority(600)] private static void Prefix(ref VisualEffectsInfo visualEffectsInfo) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) Bunburrow? bunburrow = visualEffectsInfo.Bunburrow; if (bunburrow.HasValue) { Bunburrow valueOrDefault = bunburrow.GetValueOrDefault(); if (valueOrDefault.IsCustomBunburrow()) { LevelObject val = AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(valueOrDefault)][visualEffectsInfo.Depth]; visualEffectsInfo = new VisualEffectsInfo((Bunburrow?)val.BunburrowStyle.Bunburrow, visualEffectsInfo.Depth, val.IsHell, val.IsTemple, false); } } } } } namespace Bunject.Patches.TileLevelDataPatches { [HarmonyPatch(typeof(TileLevelData), "UpdateTileSprite")] internal class UpdateTileSpritePatch { private static bool Prefix(TileLevelData __instance) { if (__instance is IUpdateTileSprite updateTileSprite) { updateTileSprite.UpdateTileSprite(); return false; } return true; } } } namespace Bunject.Patches.StringHelpersPatches { [HarmonyPatch(typeof(StringHelpers), "ReplaceVariables")] internal class ReplaceVariablesPatch { private static readonly Regex VariablePattern = new Regex("\\$[\\w_-]+"); private static string BunburrowColor = "<color=$bunburrowColor>"; private static string EndColor = "</color>"; private static void Prefix(ref string text) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Bunburrow bunburrow; bool haveCount; BunniesCount count; if (HandleTalkButtonPressPatches.targetBurrow.HasValue) { bunburrow = HandleTalkButtonPressPatches.targetBurrow.Value; haveCount = false; count = default(BunniesCount); text = VariablePattern.Replace(text, (Match match) => match.Value.Substring(1) switch { "bunburrowProgress" => GetCount().RegularBunniesCount.ToString(), "bunburrowTotal" => GetCount().RegularBunniesTotal.ToString(), "bunburrowRequirement" => DescribeRequirement(bunburrow), "bunburrowExtraProgress" => Traverse.Create(typeof(StringHelpers)).Method("CreateAdditionalProgressLine", new object[1] { bunburrow }).GetValue<string>(), _ => match.Value, }); } BunniesCount GetCount() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!haveCount) { count = GameManager.GeneralProgression.GetBunniesCountByBunburrow(bunburrow, false); haveCount = true; } return count; } } private static string DescribeRequirement(Bunburrow bunburrow) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!bunburrow.IsCustomBunburrow()) { return GameManager.GeneralProgression.BunburrowsUnlockRequirements[bunburrow].ToString(); } BunburrowRequirements bunburrowRequirements = bunburrow.GetModBunburrow()?.Requirements ?? new BunburrowRequirements(); GeneralProgression generalProgression = GameManager.GeneralProgression; List<string> list = new List<string>(); if (generalProgression.HistoryCapturedBunnies.Count < bunburrowRequirements.Bunnies) { list.Add(bunburrowRequirements.Bunnies + EndColor); } if (generalProgression.ExistingCouples.Count < bunburrowRequirements.Babies) { list.Add(bunburrowRequirements.Babies + EndColor + " baby"); } if (generalProgression.HomeCapturedBunnies.Count < bunburrowRequirements.HomeCaptures) { list.Add(bunburrowRequirements.HomeCaptures + EndColor + " home-captured"); } if (list.Count == 0) { list.Add(bunburrowRequirements.Bunnies.ToString()); } StringBuilder stringBuilder = new StringBuilder(list[0]); for (int i = 1; i < list.Count; i++) { stringBuilder.Append(" bunnies"); stringBuilder.Append((i == list.Count - 1) ? " and " : ", "); stringBuilder.Append(BunburrowColor); stringBuilder.Append(list[i]); } return stringBuilder.ToString(); } } } namespace Bunject.Patches.SettingsManagerPatches { [HarmonyPatch(typeof(SettingsManager), "HandleBoot")] internal class HandleBootPatches { private static void Postfix() { BunjectAPI.Forward.OnAssetsLoaded(); } } } namespace Bunject.Patches.SaveFileManipulationUtilityPatches { internal static class SaveFileCustomData { internal const int CustomSaveFileIndex = 999; internal static string CustomSavePath { get; set; } internal static string CustomSaveBackupPath { get; set; } internal static string CustomDeletedSavePath { get; set; } internal static string CustomOldSaveDataPath { get; set; } } [HarmonyPatch(typeof(SaveFileManipulationUtility), "GetSaveDataPath")] internal class GetSaveDataPath { internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result) { if (saveIndex == 999) { __result = SaveFileCustomData.CustomSavePath; return false; } return true; } } [HarmonyPatch(typeof(SaveFileManipulationUtility), "GetBackupSaveDataPath")] internal class GetBackupSaveDataPath { internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result) { if (saveIndex == 999) { __result = SaveFileCustomData.CustomSaveBackupPath; return false; } return true; } } [HarmonyPatch(typeof(SaveFileManipulationUtility), "GetOldSaveDataPath")] internal class GetOldSaveDataPath { internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result) { if (saveIndex == 999) { __result = SaveFileCustomData.CustomOldSaveDataPath; return false; } return true; } } [HarmonyPatch(typeof(SaveFileManipulationUtility), "GetDeletedSaveDataPath")] internal class GetDeletedSaveDataPath { internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result) { if (saveIndex == 999) { __result = SaveFileCustomData.CustomDeletedSavePath; return false; } return true; } } [HarmonyPatch(typeof(SaveFileManipulationUtility), "HandleBackToMainMenu")] internal class HandleBackToMainMenu { internal static void Postfix() { SaveFileCustomData.CustomSavePath = null; SaveFileCustomData.CustomSaveBackupPath = null; } } } namespace Bunject.Patches.PowerUnlockTilePatches { [HarmonyPatch(typeof(PowerUnlockTile), "HandlePaquerettePassAsSpecificFloor")] internal static class HandlePaquerettePassAsSpecificFloorPatch { private static bool Prefix(PowerUnlockTile __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) LevelIdentity? val = GameManager.LevelStates.CurrentLevelState?.LevelIdentity; if (!val.HasValue) { return true; } LevelIdentity here = val.Value; BunjectAPI.Forward.OnPowerTile(__instance, here, Dismiss); return !here.Bunburrow.IsCustomBunburrow(); void Dismiss() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) LevelState currentLevelState = GameManager.LevelStates.CurrentLevelState; if (currentLevelState != null && ((LevelIdentity)(ref currentLevelState.LevelIdentity)).Equals(here)) { Traverse.Create((object)__instance).Method("UpdateTileVisuals", Array.Empty<object>()).GetValue(); } } } } [HarmonyPatch(typeof(PowerUnlockTile), "UpdateTileVisuals")] internal static class UpdateTileVisualsPatch { private static void Postfix(PowerUnlockTile __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) LevelIdentity? val = GameManager.LevelStates.CurrentLevelState?.LevelIdentity; if (val.HasValue && val.Value.Bunburrow.IsCustomBunburrow() && BunjectAPI.Forward.TryResolvePowerTileSprite(__instance, val.Value, out var sprite)) { GameManager.TileMaps.RocksTileMap.SetTile(VectorConversions.ToVector3Int(((TileLevelData)__instance).Position), sprite); } } } } namespace Bunject.Patches.PlatformSpecificManagerPatches { [HarmonyPatch(typeof(PlatformSpecificManager), "UnlockAchievement")] internal class UnlockAchievementPatches { private static bool Prefix() { return false; } } [HarmonyPatch(typeof(PlatformSpecificManager), "CheckAchievementsOnStart")] internal class CheckAchievementsOnStartPatches { private static bool Prefix() { return false; } } } namespace Bunject.Patches.PauseControllerPatches { [HarmonyPatch(typeof(PauseController), "HandleBackToMenuConfirm")] internal static class HandleBackToMenuConfirm { internal static void Postfix() { BunjectAPI.Forward.OnMainMenu(); } } } namespace Bunject.Patches.PaqueretteLogsWindowControllerPatches { [HarmonyPatch(typeof(PaqueretteLogsWindowController), "<OpenWindow>g__AddDialogues|18_0")] internal class AddDialoguesPatches { private static void Prefix(ref IReadOnlyList<string> dialogueNames) { List<string> list = new List<string>(); foreach (string dialogueName in dialogueNames) { if (AssetsManager.Dialogues.ContainsKey(dialogueName)) { list.Add(dialogueName); } } dialogueNames = list; } } } namespace Bunject.Patches.PaqueretteItemExtensionPatches { [HarmonyPatch(typeof(PaqueretteItemExtension), "IsAvailableInContext")] internal class IsAvailableInContextPatch { private static bool Prefix(ref bool __result, Item item) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)item == 4 && GameManager.LevelStates.CurrentLevelState.LevelIdentity.Depth != 0 && GameManager.CurrentLevel.BaseData is ModLevelObject && ((Object)(object)GameManager.OphelineController != (Object)null || (Object)(object)GameManager.HerbeController != (Object)null)) { __result = true; return false; } return true; } } } namespace Bunject.Patches.PaqueretteControllerPatches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class CanTalkPatches { private static void Postfix(ref bool __result) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) TileLevelData currentTile = ((MovingCharacterController)GameManager.PaqueretteController).CurrentTile; TileLevelData val = null; if (currentTile != null) { val = currentTile.GetAdjacentTile(((MovingCharacterController)GameManager.PaqueretteController).FacedDirection); } if ((Object)(object)GameManager.OphelineController != (Object)null && val != null && val == ((MovingCharacterController)GameManager.OphelineController).CurrentTile && GameManager.CurrentLevel.BaseData is ModLevelObject) { ModLevelObject modLevelObject = (ModLevelObject)(object)GameManager.CurrentLevel.BaseData; if (modLevelObject.OphelineDialogues != null && modLevelObject.OphelineDialogues.Count != 0) { foreach (NPCDialogueObject ophelineDialogue in modLevelObject.OphelineDialogues) { if (ophelineDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && (!ophelineDialogue.ShouldOnlyPlayOnce || !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)GameManager.GeneralProgression.PlayedOphelineDialogues, ophelineDialogue.Name))) { __result = true; break; } } } } if (!((Object)(object)GameManager.HerbeController != (Object)null) || val == null || val != ((MovingCharacterController)GameManager.HerbeController).CurrentTile || !(GameManager.CurrentLevel.BaseData is ModLevelObject)) { return; } ModLevelObject modLevelObject2 = (ModLevelObject)(object)GameManager.CurrentLevel.BaseData; if (modLevelObject2.HerbeDialogues == null || modLevelObject2.HerbeDialogues.Count == 0) { return; } foreach (NPCDialogueObject herbeDialogue in modLevelObject2.HerbeDialogues) { if (herbeDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && (!herbeDialogue.ShouldOnlyPlayOnce || !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)GameManager.GeneralProgression.PlayedHerbeDialogues, herbeDialogue.Name))) { __result = true; break; } } } } } namespace Bunject.Patches.PaqueretteActionResolverPatches { [HarmonyPatch(typeof(PaqueretteActionResolver), "HandleTalkButtonPress")] internal class HandleTalkButtonPressPatches { public static Bunburrow? targetBurrow; private static MethodInfo GetBunburrowUnlockStatus = typeof(GeneralProgression).GetProperty("BunburrowsUnlockStatus").GetGetMethod(); private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { int detectionState = 0; Label? label = default(Label?); foreach (CodeInstruction instruction in instructions) { switch (detectionState) { case 0: if (CodeInstructionExtensions.Calls(instruction, GetBunburrowUnlockStatus)) { detectionState++; } break; case 1: if (CodeInstructionExtensions.Branches(instruction, ref label)) { CodeInstruction val = new CodeInstruction(OpCodes.Ldloc_S, (object)4); val.labels.AddRange(instruction.labels); instruction.labels.Clear(); yield return val; yield return CodeInstruction.Call(typeof(BunburrowSignController), "get_Bunburrow", (Type[])null, (Type[])null); yield return CodeInstruction.Call(typeof(HandleTalkButtonPressPatches), "ExtractBurrow", (Type[])null, (Type[])null); yield return new CodeInstruction(OpCodes.Ldloc_S, (object)4); yield return CodeInstruction.Call(typeof(BunburrowSignController), "get_Bunburrow", (Type[])null, (Type[])null); yield return CodeInstruction.Call(typeof(HandleTalkButtonPressPatches), "CombineUnlock", (Type[])null, (Type[])null); yield return instruction; detectionState++; continue; } break; } yield return instruction; } } private static bool Prefix() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) LevelObject baseData = GameManager.CurrentLevel.BaseData; if (baseData is ModLevelObject && !baseData.IsSurface) { ModLevelObject modLevelObject = (ModLevelObject)(object)baseData; TileLevelData currentTile = ((MovingCharacterController)GameManager.PaqueretteController).CurrentTile; if (currentTile != null) { TileLevelData adjacentTile = currentTile.GetAdjacentTile(((MovingCharacterController)GameManager.PaqueretteController).FacedDirection); bool flag = false; if ((Object)(object)GameManager.OphelineController != (Object)null && ((MovingCharacterController)GameManager.OphelineController).CurrentTile == adjacentTile) { flag = true; if ((Object)(object)GameManager.OphelineController.NextDialogue != (Object)null) { GameManager.OphelineController.StartDialogue(false); } else if (modLevelObject.OphelineDialogues != null && modLevelObject.OphelineDialogues.Count != 0) { foreach (NPCDialogueObject ophelineDialogue in modLevelObject.OphelineDialogues) { if (ophelineDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && !ophelineDialogue.ShouldOnlyPlayOnce) { GameManager.OphelineController.StartDialogue(true); GameManager.UIController.DisplayDialogue((DialogueObject)(object)ophelineDialogue, GameManager.CurrentBunburrowStyle, true, false); break; } } } } if ((Object)(object)GameManager.HerbeController != (Object)null && ((MovingCharacterController)GameManager.HerbeController).CurrentTile == adjacentTile) { flag = true; if ((Object)(object)GameManager.HerbeController.NextDialogue != (Object)null) { GameManager.HerbeController.StartDialogue(false); } else if (modLevelObject.HerbeDialogues != null && modLevelObject.HerbeDialogues.Count != 0) { foreach (NPCDialogueObject herbeDialogue in modLevelObject.HerbeDialogues) { if (herbeDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && !herbeDialogue.ShouldOnlyPlayOnce) { GameManager.HerbeController.StartDialogue(true); GameManager.UIController.DisplayDialogue((DialogueObject)(object)herbeDialogue, GameManager.CurrentBunburrowStyle, true, false); break; } } } } if (flag) { return false; } } } return true; } private static void ExtractBurrow(Bunburrow bunburrow) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) targetBurrow = bunburrow; } private static bool CombineUnlock(bool vanillaUnlockStatus, Bunburrow bunburrow) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) if (vanillaUnlockStatus) { return bunburrow.IsUnlocked(); } return false; } } [HarmonyPatch(typeof(UIController), "EndDialogue")] internal class EndDialoguePatches { private static void Postfix() { HandleTalkButtonPressPatches.targetBurrow = null; } } [HarmonyPatch(typeof(PaqueretteActionResolver), "HandleDirectionFacedChange")] internal class HandleDirectionFacedChangePatches { private static void Postfix() { if (GameManager.PaqueretteController.CanTalk) { GameManager.PaqueretteController.HandleContextualItemSwitch((Item)4); } } } } namespace Bunject.Patches.OphelineSpeechManagerPatches { [HarmonyPatch(typeof(OphelineSpeechManager), "TryGetNextDialogue")] internal class TryGetNextDialoguePatch { private static bool Prefix(ref bool __result, out DialogueObject dialogue) { LevelObject baseData = GameManager.CurrentLevel.BaseData; if (baseData is ModLevelObject) { ModLevelObject modLevelObject = (ModLevelObject)(object)baseData; if (modLevelObject.OphelineDialogues != null && modLevelObject.OphelineDialogues.Count != 0) { foreach (NPCDialogueObject ophelineDialogue in modLevelObject.OphelineDialogues) { if (ophelineDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && ophelineDialogue.ShouldOnlyPlayOnce && !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)GameManager.GeneralProgression.PlayedOphelineDialogues, ophelineDialogue.Name)) { dialogue = (DialogueObject)(object)ophelineDialogue; __result = true; return false; } } } dialogue = null; __result = false; return false; } dialogue = null; return true; } } [HarmonyPatch(typeof(OphelineSpeechManager), "TryGetNextHellDialogue")] internal class TryGetNextHellDialoguePatch { private static bool Prefix(ref bool __result, out DialogueObject dialogue) { LevelObject baseData = GameManager.CurrentLevel.BaseData; if (baseData is ModLevelObject) { ModLevelObject modLevelObject = (ModLevelObject)(object)baseData; if (modLevelObject.OphelineDialogues != null && modLevelObject.OphelineDialogues.Count != 0) { foreach (NPCDialogueObject ophelineDialogue in modLevelObject.OphelineDialogues) { if (ophelineDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && ophelineDialogue.ShouldOnlyPlayOnce && !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)GameManager.GeneralProgression.PlayedOphelineDialogues, ophelineDialogue.Name)) { dialogue = (DialogueObject)(object)ophelineDialogue; __result = true; return false; } } } dialogue = null; __result = false; return false; } dialogue = null; return true; } } } namespace Bunject.Patches.OphelineComputerOptionsTabControllerPatches { [HarmonyPatch(typeof(OphelineComputerOptionsTabController), "HandleOpen")] internal class HandleOpen { internal static void Postfix(OphelineComputerOptionsTabController __instance) { ComputerExtraButtonBehavior computerExtraButtonBehavior = ((Component)__instance).GetComponent<ComputerExtraButtonBehavior>(); if ((Object)(object)computerExtraButtonBehavior == (Object)null) { computerExtraButtonBehavior = ((Component)__instance).gameObject.AddComponent<ComputerExtraButtonBehavior>(); } Traverse obj = Traverse.Create((object)__instance); List<ButtonController> value = obj.Field<List<ButtonController>>("buttons").Value; List<MenuButtonStyleController> value2 = obj.Field<List<MenuButtonStyleController>>("buttonStyleControllers").Value; List<CustomExtraButton> list = new List<CustomExtraButton>(); foreach (CustomExtraButton button in computerExtraButtonBehavior.Buttons) { bool flag = button.Page.ShouldShow(); button.ChildObject.SetActive(flag); if (flag) { list.Add(button); } } value.InsertRange(value.Count - 1, list.Select((CustomExtraButton b) => b.ButtonController)); value2.InsertRange(value2.Count - 1, list.Select((CustomExtraButton b) => b.Style)); } } } namespace Bunject.Patches.OphelineComputerMapTabControllerPatches { [HarmonyPatch(typeof(OphelineComputerMapTabController), "HandleOpen")] internal static class HandleOpenPatch { internal static void Prefix() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) MapContext.Instance?.Dispose(); Bunburrow? val = GameManager.LevelStates.CurrentLevelState?.LevelIdentity.Bunburrow; if (val.HasValue && val.Value.IsCustomBunburrow()) { new MapContext(val.Value); } } } [HarmonyPatch(typeof(OphelineComputerMapTabController), "UpdateHeaderText")] internal static class UpdateHeaderText { internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)typeof(List<BunnyIdentity>).GetMethod("Add"), (string)null) }).SetInstruction(Transpilers.EmitDelegate<Action<List<BunnyIdentity>, BunnyIdentity>>((Action<List<BunnyIdentity>, BunnyIdentity>)AddIfUnique)); return val.InstructionEnumeration(); } private static void AddIfUnique(List<BunnyIdentity> list, BunnyIdentity identity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!list.Any((BunnyIdentity i) => ((BunnyIdentity)(ref i)).Equals(identity))) { list.Add(identity); } } } } namespace Bunject.Patches.OphelineComputerCanvasControllerPatches { [HarmonyPatch(typeof(OphelineComputerCanvasController), "Awake")] internal static class Awake { internal static void Postfix(OphelineComputerCanvasController __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent<CustomComputerPagesListBehavior>() == (Object)null) { OphelineComputerTabsList value = Traverse.Create((object)__instance).Field<OphelineComputerTabsList>("ophelineComputerTabsList").Value; ((Component)__instance).gameObject.AddComponent<CustomComputerPagesListBehavior>().Initialize(value); } } } [HarmonyPatch(typeof(OphelineComputerCanvasController), "SwitchTab")] internal static class SwitchTab { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)typeof(OphelineComputerTabsList).GetProperties().Single((PropertyInfo p) => p.GetIndexParameters().Length != 0).GetMethod, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), Transpilers.EmitDelegate<Func<OphelineComputerTabsList, OphelineComputerTab, OphelineComputerCanvasController, OphelineComputerTabController>>((Func<OphelineComputerTabsList, OphelineComputerTab, OphelineComputerCanvasController, OphelineComputerTabController>)IndexExtendedPages) }).RemoveInstruction(); return val.InstructionEnumeration().ToList(); } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] public static void Invoke(OphelineComputerCanvasController instance, OphelineComputerTab newTab, bool isFromOpen = false) { } private static OphelineComputerTabController IndexExtendedPages(OphelineComputerTabsList list, OphelineComputerTab tab, OphelineComputerCanvasController canvasController) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ((Component)canvasController).gameObject.GetComponent<CustomComputerPagesListBehavior>().GetByIndex(tab); } } [HarmonyPatch(typeof(OphelineComputerCanvasController), "Open")] internal static class Open { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)typeof(OphelineComputerTabsList).GetMethod("GetEnumerator"), (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), Transpilers.EmitDelegate<Func<OphelineComputerTabsList, OphelineComputerCanvasController, IEnumerator<OphelineComputerTabController>>>((Func<OphelineComputerTabsList, OphelineComputerCanvasController, IEnumerator<OphelineComputerTabController>>)GetExtendedPages) }).RemoveInstruction(); return val.InstructionEnumeration().ToList(); } private static IEnumerator<OphelineComputerTabController> GetExtendedPages(OphelineComputerTabsList list, OphelineComputerCanvasController canvasController) { return ((Component)canvasController).gameObject.GetComponent<CustomComputerPagesListBehavior>().GetPageControllers().GetEnumerator(); } } } namespace Bunject.Patches.MenuPatches { [HarmonyPatch(typeof(MenuController), "Update")] internal class MenuPatches_Update { private static void Postfix(MenuController __instance) { if ((Object)(object)__instance != (Object)null) { BunjectAPI.Forward.ShowOrHideMenu(__instance.IsReady && !__instance.IsInBunstack && !__instance.IsInOptions && !__instance.IsInSaveScreen); } else { BunjectAPI.Forward.ShowOrHideMenu(showMenu: false); } } } } namespace Bunject.Patches.MenuButtonStyleControllerPatches { [HarmonyPatch(typeof(MenuButtonStyleController), "Awake")] internal class Awake { private static void Prefix(MenuButtonStyleController __instance) { Traverse<ButtonController> val = Traverse.Create((object)__instance).Field<ButtonController>("buttonController"); Traverse<TextMeshProUGUI> val2 = Traverse.Create((object)__instance).Field<TextMeshProUGUI>("textComponent"); if ((Object)(object)val.Value == (Object)null) { val.Value = ((Component)__instance).GetComponent<ButtonController>(); } if ((Object)(object)val2.Value == (Object)null) { val2.Value = ((Component)__instance).GetComponent<TextMeshProUGUI>(); } } } } namespace Bunject.Patches.LevelStatePatches { [HarmonyPatch(typeof(LevelState), "HandleBunnyCapture")] internal class LevelStatePatch_HandleBunnyCapture { private static void Postfix(BunnyCaptureData bunnyCaptureData) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) BunjectAPI.Forward.OnBunnyCapture(bunnyCaptureData.BunnyIdentity, bunnyCaptureData.IsHomeCapture); } } } namespace Bunject.Patches.LevelsListPatches { [HarmonyPatch] internal class IndexerPatch { private static MethodBase TargetMethod() { return typeof(LevelsList).GetProperties().First((PropertyInfo pi) => pi.GetIndexParameters().Length == 1).GetGetMethod(); } private static Exception Finalizer(Exception __exception, ref LevelObject __result, LevelsList __instance, int depth) { if (__instance is ModLevelsList modLevelsList) { __result = modLevelsList.LoadLevel(depth, CurrentLoadingContext.Value); } if ((Object)(object)__result == (Object)null) { Console.WriteLine("Level Load Failure! Deferring to Emergency Level"); LevelsList val = BunjectAPI.Forward.LoadEmergencyLevelsList(null); if ((Object)(object)val != (Object)(object)__instance) { __result = val[depth]; } } return null; } } } namespace Bunject.Patches.LevelLoaderPatches { [HarmonyPatch(typeof(LevelLoader), "LoadLevel")] internal class LoadLevelPatch { private static bool Prefix(LevelObject levelObject, out List<string> __result) { List<string> tilesFromContent = TileValidator.GetTilesFromContent(levelObject.Content); foreach (string item in tilesFromContent) { if (!TileValidator.ValidateTile(item)) { Debug.LogWarning((object)("Invalid tile string: " + item)); } } __result = tilesFromContent; return false; } } } namespace Bunject.Patches.LevelIndicatorGeneratorPatches { [HarmonyPatch(typeof(LevelIndicatorGenerator), "GetLongLevelIndicator")] internal class GetLongLevelIndicatorPatches { private static string Postfix(string __result, bool useWhite) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) string title = __result; LevelIdentity levelIdentity = GameManager.LevelStates.CurrentLevelState.LevelIdentity; if (levelIdentity.Bunburrow.IsCustomBunburrow()) { string text = LevelIndicatorGenerator.GetShortLevelIndicator() + Traverse.Create(typeof(LevelIndicatorGenerator)).Method("GenerateBunniesStringForLevelIndicator", new object[1] { useWhite }).GetValue<string>() + " "; string customNameKey = GameManager.CurrentLevel.BaseData.CustomNameKey; title = text + ((BunburrowExtension.IsVoidBunburrow(levelIdentity.Bunburrow) && string.IsNullOrWhiteSpace(customNameKey)) ? LevelIndicatorGenerator.GenerateVoidLevelName("") : customNameKey); } return BunjectAPI.Forward.OnLevelTitle(title, levelIdentity, useWhite); } } [HarmonyPatch(typeof(LevelIndicatorGenerator), "GetLevelBunburrowStyle")] internal class GetLevelBunburrowStylePatch { public static BunburrowStyle Postfix(BunburrowStyle __result, LevelIdentity levelIdentity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (levelIdentity.Bunburrow.IsCustomBunburrow()) { return AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(levelIdentity.Bunburrow)][levelIdentity.Depth].BunburrowStyle; } return __result; } } } namespace Bunject.Patches.LevelBuilderPatches { [HarmonyPatch] internal class BuildNewLevelPatch_SupportMoreSurfaceEntries { private static MethodInfo TargetMethod() { return typeof(LevelBuilder).GetMethod("BuildNewLevel", new Type[3] { typeof(LevelObject), typeof(BunburrowStyle), typeof(bool) }); } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { MethodInfo startsWith = typeof(string).GetMethod("StartsWith", new Type[1] { typeof(string) }); MethodInfo get_Chars = typeof(string).GetProperty("Chars").GetGetMethod(); MethodInfo char_ToString = typeof(char).GetMethod("ToString", new Type[0]); int detectionStage = 0; foreach (CodeInstruction instruction in instructions) { CodeInstruction val = instruction; switch (detectionStage) { case 0: if (val.opcode == OpCodes.Ldstr && (string)val.operand == "N") { detectionStage = 1; } break; case 1: detectionStage = (CodeInstructionExtensions.Calls(val, startsWith) ? 2 : 0); break; case 2: if (CodeInstructionExtensions.Calls(val, get_Chars)) { detectionStage = 3; val = CodeInstruction.Call(typeof(string), "Substring", new Type[1] { typeof(int) }, (Type[])null); } break; case 3: if (CodeInstructionExtensions.Calls(val, char_ToString)) { detectionStage = 4; } continue; } yield return val; } } } [HarmonyPatch(typeof(LevelBuilder), "BuildNewLevel", new Type[] { typeof(LevelObject), typeof(BunburrowStyle), typeof(bool) })] internal class BuildNewLevelPatch_ModifyNPCSpawnConditions { private static MethodInfo getMadeIntroBunnyFlee = typeof(GeneralProgression).GetProperty("MadeIntroBunnyFlee").GetGetMethod(); private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { int stage = 0; foreach (CodeInstruction instruction in instructions) { switch (stage) { case 0: if (CodeInstructionExtensions.Calls(instruction, getMadeIntroBunnyFlee)) { stage++; } break; case 1: if (instruction.opcode == OpCodes.Ldarg_2) { stage++; } break; case 2: yield return instruction; yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Isinst, (object)typeof(ModLevelObject)); yield return new CodeInstruction(OpCodes.Brtrue_S, instruction.operand); stage++; continue; case 3: if (instruction.opcode == OpCodes.Ldarg_2) { stage++; } break; case 4: yield return instruction; yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Isinst, (object)typeof(ModLevelObject)); yield return new CodeInstruction(OpCodes.Brtrue_S, instruction.operand); stage++; continue; } yield return instruction; } } } } namespace Bunject.Patches.HerbeSpeechManagerPatches { [HarmonyPatch(typeof(HerbeSpeechManager), "TryGetNextDialogue")] internal class TryGetNextDialoguePatch { private static bool Prefix(ref bool __result, out DialogueObject dialogue) { LevelObject baseData = GameManager.CurrentLevel.BaseData; if (baseData is ModLevelObject) { ModLevelObject modLevelObject = (ModLevelObject)(object)baseData; if (modLevelObject.HerbeDialogues != null && modLevelObject.HerbeDialogues.Count != 0) { foreach (NPCDialogueObject herbeDialogue in modLevelObject.HerbeDialogues) { if (herbeDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && herbeDialogue.ShouldOnlyPlayOnce && !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)GameManager.GeneralProgression.PlayedHerbeDialogues, herbeDialogue.Name)) { dialogue = (DialogueObject)(object)herbeDialogue; __result = true; return false; } } } dialogue = null; __result = false; return false; } dialogue = null; return true; } } [HarmonyPatch(typeof(HerbeSpeechManager), "TryGetNextTempleDialogue")] internal class TryGetNextTempleDialogue { private static bool Prefix(ref bool __result, out DialogueObject dialogue) { LevelObject baseData = GameManager.CurrentLevel.BaseData; if (baseData is ModLevelObject) { ModLevelObject modLevelObject = (ModLevelObject)(object)baseData; if (modLevelObject.HerbeDialogues != null && modLevelObject.HerbeDialogues.Count != 0) { foreach (NPCDialogueObject herbeDialogue in modLevelObject.HerbeDialogues) { if (herbeDialogue.AreConditionsSatisfied(GameManager.GeneralProgression) && herbeDialogue.ShouldOnlyPlayOnce && !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)GameManager.GeneralProgression.PlayedHerbeDialogues, herbeDialogue.Name)) { dialogue = (DialogueObject)(object)herbeDialogue; __result = true; return false; } } } dialogue = null; __result = false; return false; } dialogue = null; return true; } } } namespace Bunject.Patches.GeneralProgressionPatches { [HarmonyPatch(typeof(GeneralProgression), "FreeAllNonVoidBunnies")] internal class FreeAllNonVoidBunniesPatches { private static void Postfix() { BunnyReleaser.NotifyReleased(); } } [HarmonyPatch(typeof(GeneralProgression), "FreeBunniesFromBunburrow")] internal class FreeBunniesFromBunburrowPatches { private static void Postfix() { BunnyReleaser.NotifyReleased(); } } [HarmonyPatch(typeof(GeneralProgression), "HandleElevatorUnlock")] internal class HandleElevatorUnlockPatch { public static void Postfix(GeneralProgression __instance) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (ElevatorManager.ElevatorUnlock(GameManager.LevelStates.CurrentLevelState.LevelIdentity, out var elevatorData) && !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)__instance.UnlockedElevators, elevatorData)) { Traverse.Create((object)__instance).Field<List<string>>("unlockedElevators").Value.Add(elevatorData); } } } [HarmonyPatch(typeof(GeneralProgression), "GetNonVoidBunniesSpreadSort")] internal class GetNonVoidBunniesSpreadSortPatch { public static List<BunnyIdentity> Postfix(List<BunnyIdentity> values, GeneralProgression __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) foreach (BunburrowMetadata bunburrow in BunburrowManager.Bunburrows) { if (bunburrow.IsCustom) { Bunburrow val = (Bunburrow)bunburrow.ID; values.AddRange(__instance.GetCapturedBunniesFromBunburrow(val)); } } values.Sort((BunnyIdentity l, BunnyIdentity r) => (l.InitialDepth >= r.InitialDepth) ? 1 : (-1)); return values; } } [HarmonyPatch(typeof(GeneralProgression), "GetNonVoidBunniesCount")] internal class GetNonVoidBunniesCountPatch { public static bool Prefix(ref int __result, GeneralProgression __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (BunnyIdentity capturedBunny in __instance.CapturedBunnies) { if (!capturedBunny.Bunburrow.IsCustomBunburrow() && BunburrowExtension.IsNonVoidBunburrow(capturedBunny.Bunburrow)) { num++; } } __result = num; return false; } } } namespace Bunject.Patches.GameManagerPatches { [HarmonyPatch(typeof(GameManager), "HandleDialogueEvent")] internal class HandleDialogueEventPatches { private static void Prefix(string eventKey, ref Bunburrow? bunburrowInfo) { if (eventKey == "release") { bunburrowInfo = HandleTalkButtonPressPatches.targetBurrow; HandleTalkButtonPressPatches.targetBurrow = null; } } } [HarmonyPatch(typeof(GameManager), "HandleRappelling")] internal class HandleRappellingPatches { private static MethodInfo StartLevelTransition = typeof(GameManager).GetMethod("StartLevelTransition", BindingFlags.Static | BindingFlags.NonPublic); private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { int state = 0; foreach (CodeInstruction instruction in instructions) { switch (state) { case 0: if (CodeInstructionExtensions.Calls(instruction, StartLevelTransition)) { state++; } break; case 1: if (CodeInstructionExtensions.Calls(instruction, StartLevelTransition)) { yield return CodeInstruction.Call(typeof(HandleRappellingPatches), "StartLevelRappellingTransition", (Type[])null, (Type[])null); state++; continue; } break; } yield return instruction; } } private static void StartLevelRappellingTransition(LevelObject surfaceLevel, LevelTransitionType levelTransitionType, LevelIdentity levelIdentity, LevelIdentity? elevatorTargetLevelIdentity) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) Bunburrow value = Traverse.Create<GameManager>().Field<Bunburrow>("previousBunburrow").Value; LevelObject val = BunjectAPI.Forward.LoadBurrowSurfaceLevel(((Object)AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(value)]).name, surfaceLevel); StartLevelTransition.Invoke(null, new object[4] { val, levelTransitionType, levelIdentity, elevatorTargetLevelIdentity }); } } [HarmonyPatch(typeof(GameManager), "StartLevelTransition")] internal class StartLevelTransitionPatches { private static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class SetGeneralProgressionPatches { private static void Prefix(GeneralProgression value) { BunjectAPI.Forward.OnProgressionLoaded(value); } } [HarmonyPatch(typeof(GameManager), "HandleSurfaceElevatorUse")] internal class HandleSurfaceElevatorUsePatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); MethodInfo TryGetValue = AccessTools.Method(typeof(IReadOnlyDictionary<string, LevelIdentity>), "TryGetValue", (Type[])null, (Type[])null); int num = list.FindIndex((CodeInstruction x) => CodeInstructionExtensions.Calls(x, TryGetValue)); Label? label = default(Label?); if (num >= 0 && num + 2 < list.Count && CodeInstructionExtensions.Branches(list[num + 1], ref label)) { Label label2 = il.DefineLabel(); list.Insert(num + 2, CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Nop, (object)null), new Label[1] { label2 })); list.InsertRange(num + 1, new List<CodeInstruction> { new CodeInstruction(OpCodes.Brtrue, (object)label2), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloca, (object)0), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(HandleSurfaceElevatorUsePatch), "Infix", (Type[])null, (Type[])null)) }); } return list; } private static bool Infix(string elevatorName, out LevelIdentity level) { return ElevatorManager.IsElevatorUnlock(elevatorName, out level); } } [HarmonyPatch(typeof(GameManager), "Init")] internal class Init { public static IEnumerator Postfix(IEnumerator __result) { while (__result.MoveNext()) { yield return __result.Current; } yield return ElevatorManager.ExtractElevatorProgression(); HeadshotManager.GetAllHeadshots(); } } [HarmonyPatch(typeof(GameManager), "InstantiateBunburrowEntrySigns")] internal class InstantiateBunburrowEntrySignsPatch { internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { MethodInfo tileLevelData_LeftTile = AccessTools.PropertyGetter(typeof(TileLevelData), "LeftTile"); int state = 0; foreach (CodeInstruction code in instructions) { yield return code; switch (state) { case 0: if (CodeInstructionExtensions.Calls(code, tileLevelData_LeftTile)) { state = 1; } break; case 1: if (CodeInstructionExtensions.IsStloc(code, (LocalBuilder)null)) { yield return new CodeInstruction(OpCodes.Ldloc_2, (object)null); yield return new CodeInstruction(OpCodes.Ldloc_3, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(InstantiateBunburrowEntrySignsPatch), "GetSignTile", (Type[])null, (Type[])null)); yield return new CodeInstruction(OpCodes.Stloc_3, (object)null); state = 2; } break; } } } private static FloorTile GetSignTile(BunburrowEntryTile currentHole, FloorTile otherwise) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) FloorTile val = otherwise; Bunburrow? bunburrow = currentHole.Bunburrow; if (bunburrow.HasValue) { Bunburrow valueOrDefault = bunburrow.GetValueOrDefault(); if (valueOrDefault.IsCustomBunburrow()) { IModBunburrow modBunburrow = valueOrDefault.GetModBunburrow(); if (modBunburrow != null) { if (!modBunburrow.HasSign) { val = null; } else if (!modBunburrow.HasEntrance) { val = (FloorTile)(object)currentHole; } else { Vector2Int? val2 = modBunburrow.OverrideSignCoordinate(); if (val2.HasValue) { Vector2Int valueOrDefault2 = val2.GetValueOrDefault(); TileLevelData tileInListByCoordinates = LevelBuilderExtensions.GetTileInListByCoordinates(GameManager.CurrentLevel.Tiles.ToList(), ((Vector2Int)(ref valueOrDefault2)).y, ((Vector2Int)(ref valueOrDefault2)).x); val = (FloorTile)(((object)((tileInListByCoordinates is FloorTile) ? tileInListByCoordinates : null)) ?? ((object)val)); } } } } } return val; } } [HarmonyPatch(typeof(GameManager), "LoadLevel")] internal class LoadLevelPatches { public static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity, LevelTransitionType levelTransitionType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((int)levelTransitionType != 3 && levelIdentity.Bunburrow.IsCustomBunburrow()) { IModBunburrow modBunburrow = levelIdentity.Bunburrow.GetModBunburrow(); if (modBunburrow != null) { LevelsList levels = modBunburrow.GetLevels(); if (levels != null) { LoadingContext value = CurrentLoadingContext.Value; try { CurrentLoadingContext.Value = LoadingContext.LevelTransition; levelObject = levels[levelIdentity.Depth]; } finally { CurrentLoadingContext.Value = value; } } } } levelObject = BunjectAPI.Forward.OnLevelLoad(levelObject, levelIdentity); } } [HarmonyPatch(typeof(GameManager), "LoadLevelAtUndo")] internal class LoadLevelAtUndo { public static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) levelObject = BunjectAPI.Forward.OnLevelLoad(levelObject, levelIdentity); } } [HarmonyPatch(typeof(GameManager), "LoadLevelFromSave")] internal class LoadLevelFromSave { public static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) levelObject = BunjectAPI.Forward.OnLevelLoad(levelObject, levelIdentity); } } } namespace Bunject.Patches.ElevatorControllerPatches { [HarmonyPatch(typeof(ElevatorController), "StartElevating")] internal static class StartElevating { internal static void Prefix(bool displayCredits) { if (displayCredits) { BunjectAPI.Forward.OnShowCredits(); } } } } namespace Bunject.Patches.DisplayDialoguePatches { [HarmonyPatch(typeof(UIController), "DisplayDialogue")] internal class ConvertToCustomDialoguePatch { private static bool Prefix(ref DialogueObject dialogue) { if (dialogue is CustomDialogueObject) { CustomDialogueObject customDialogueObject = (CustomDialogueObject)(object)dialogue; if (customDialogueObject.DialogueLines == null || customDialogueObject.DialogueLines.Count == 0) { Debug.LogWarning((object)"Dialogue has no DialogueLines."); return false; } List<DialogueLine> list = new List<DialogueLine>(); foreach (CustomDialogueLine dialogueLine in customDialogueObject.DialogueLines) { if (!HeadshotManager.TryResolve(dialogueLine.Headshot, out var headshot)) { Debug.LogWarning((object)("HeadshotObject " + dialogueLine.Headshot + " not found.")); } dialogueLine.HeadshotObject = headshot; if (dialogueLine.Content == null) { dialogueLine.Content = ""; } list.Add((DialogueLine)(object)dialogueLine); } customDialogueObject.DialogueLines = list; dialogue = (DialogueObject)(object)customDialogueObject; } return true; } } [HarmonyPatch(typeof(UIController), "DisplayDialogue")] internal class CustomDialogueLocalizationPatch { private static MethodInfo getLanguageLocalizationObjectLoadedIn = typeof(AssetsManager).GetProperty("LanguageLocalizationObjectLoadedIn").GetGetMethod(); private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { int stage = 0; foreach (CodeInstruction instruction in instructions) { switch (stage) { case 0: if (CodeInstructionExtensions.Calls(instruction, getLanguageLocalizationObjectLoadedIn)) { stage++; } break; case 1: if (instruction.opcode == OpCodes.Ldloca_S) { stage++; } break; case 2: stage++; break; case 3: yield return instruction; yield return new CodeInstruction(OpCodes.Ldarg_1, (object)null); yield return new CodeInstruction(OpCodes.Isinst, (object)typeof(CustomDialogueObject)); yield return new CodeInstruction(OpCodes.Brtrue_S, instruction.operand); stage++; continue; } yield return instruction; } } } } namespace Bunject.Patches.ChoiceSelectorPatches { [HarmonyPatch(typeof(ChoiceSelector), "StartListeningToInputs")] internal class StartListeningToInputsPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); MethodInfo GeneralInputManager = AccessTools.Property(typeof(GameManager), "GeneralInputManager").GetGetMethod(); List<Label> labels = list.FindLast((CodeInstruction x) => CodeInstructionExtensions.Calls(x, GeneralInputManager))?.labels; if (labels != null) { int num = list.FindIndex((CodeInstruction x) => labels.Any((Label y) => y.Equals(x.operand))); if (num >= 0) { list.InsertRange(num, new List<CodeInstruction> { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(StartListeningToInputsPatch), "Infix", (Type[])null, (Type[])null)) }); } } return list; } private static void Infix(ChoiceSelector @this) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) List<(LevelIdentity, ChoiceObject)> list = new List<(LevelIdentity, ChoiceObject)>(); foreach (string unlockedElevator in GameManager.GeneralProgression.UnlockedElevators) { if (ElevatorManager.IsElevatorUnlock(unlockedElevator, out var level)) { list.Add((level, new ChoiceObject(unlockedElevator, unlockedElevator, false))); } } list.Sort(((LevelIdentity identity, ChoiceObject dialogue) x, (LevelIdentity identity, ChoiceObject dialogue) y) => ((LevelIdentity)(ref x.identity)).CompareTo(y.identity)); IReadOnlyList<(LevelIdentity, ChoiceObject)> readOnlyList = list; Traverse obj = Traverse.Create((object)@this); List<ChoiceLineController> value = obj.Field<List<ChoiceLineController>>("choicesLineControllers").Value; RectTransform value2 = obj.Field<RectTransform>("contentRectTransform").Value; for (int num = 0; num < readOnlyList.Count; num++) { LevelIdentity item = readOnlyList[num].Item1; BunburrowStyle levelBunburrowStyle = LevelIndicatorGenerator.GetLevelBunburrowStyle(item); ChoiceLineController component = Object.Instantiate<GameObject>(AssetsManager.ChoiceLinePrefab, (Transform)(object)value2).GetComponent<ChoiceLineController>(); value.Add(component); component.Init(readOnlyList[num].Item2, LevelIndicatorGenerator.GetShortLevelIndicator(item)); component.UpdateStyle(Color.black, levelBunburrowStyle.SkyboxColor, levelBunburrowStyle.UIWhiteColor, levelBunburrowStyle.ButtonDefaultColor, levelBunburrowStyle.FlowerSprite); } } } } namespace Bunject.Patches.BunburrowSignControllerPatches { [HarmonyPatch(typeof(BunburrowSignController), "UpdateContent")] internal class UpdateContentPatch { private static void Postfix(BunburrowSignController __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Bunburrow bunburrow = __instance.Bunburrow; if (!bunburrow.IsCustomBunburrow() || bunburrow.IsUnlocked()) { return; } BunburrowRequirements bunburrowRequirements = bunburrow.GetModBunburrow()?.Requirements ?? new BunburrowRequirements(); GeneralProgression generalProgression = GameManager.GeneralProgression; int num; if (generalProgression.HistoryCapturedBunnies.Count < bunburrowRequirements.Bunnies) { num = bunburrowRequirements.Bunnies; } else if (generalProgression.ExistingCouples.Count < bunburrowRequirements.Babies) { num = bunburrowRequirements.Babies; } else { if (generalProgression.HomeCapturedBunnies.Count >= bunburrowRequirements.HomeCaptures) { return; } num = bunburrowRequirements.HomeCaptures; } num = Mathf.Clamp(num, 0, 99); Traverse obj = Traverse.Create((object)__instance); obj.Field("progressPercentageParentObject").GetValue<GameObject>().SetActive(false); obj.Field("completeIcon").GetValue<GameObject>().SetActive(false); obj.Field("homeIcon").GetValue<GameObject>().SetActive(false); obj.Field("extraSparkles").GetValue<GameObject>().SetActive(false); obj.Field("bunnyRequirementParentObject").GetValue<GameObject>().SetActive(true); obj.Field("requirementFirstDigitSpriteRenderer").GetValue<SpriteRenderer>().sprite = AssetsManager.ItemCounterAssets[num / 10]; obj.Field("requirementSecondDigitSpriteRenderer").GetValue<SpriteRenderer>().sprite = AssetsManager.ItemCounterAssets[num % 10]; } } } namespace Bunject.Patches.BunburrowsListOfStylesPatches { [HarmonyPatch] internal class IndexerPatch { private static MethodBase TargetMethod() { return typeof(BunburrowsListOfStyles).GetProperties().First((PropertyInfo pi) => pi.GetIndexParameters().Length == 1).GetGetMethod(); } private static BunburrowStyle Postfix(BunburrowStyle __result, Bunburrow bunburrow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (bunburrow.IsCustomBunburrow()) { return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow?.Style ?? __result; } return __result; } } } namespace Bunject.Patches.BunburrowExtensionPatches { [HarmonyPatch(typeof(BunburrowExtension), "ToBunburrow", new Type[] { typeof(string) })] internal class ToBunburrowStringPatch { public static Bunburrow Postfix(Bunburrow __result, string bunburrowName) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) return (Bunburrow)(((??)BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ModBunburrow?.Name == bunburrowName)?.ID) ?? __result); } } [HarmonyPatch(typeof(BunburrowExtension), "ToBunburrow", new Type[] { typeof(int) })] internal class ToBunburrowIntPatch { private static Bunburrow Postfix(Bunburrow __result, int bunburrowID) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (((Bunburrow)bunburrowID).IsCustomBunburrow()) { return (Bunburrow)bunburrowID; } return __result; } } [HarmonyPatch(typeof(BunburrowExtension), "ToBunburrowName")] internal class ToBunburrowNamePatch { private static string Postfix(string __result, Bunburrow bunburrow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (bunburrow.IsCustomBunburrow()) { return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow.Name; } return __result; } } [HarmonyPatch(typeof(BunburrowExtension), "ToComparisonIndex")] internal class ToComparisonIndexPatch { private static int Postfix(int __result, Bunburrow bunburrow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (bunburrow.IsCustomBunburrow()) { return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ComparisonIndex ?? __result; } return __result; } } [HarmonyPatch(typeof(BunburrowExtension), "ToIndicator")] internal class ToIndicatorPatch { private static string Postfix(string __result, Bunburrow bunburrow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (bunburrow.IsCustomBunburrow()) { return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow?.Indicator; } return __result; } } [HarmonyPatch(typeof(BunburrowExtension), "IsNonVoidBunburrow")] internal class IsNonVoidBunburrowPatch { private static bool Postfix(bool __result, Bunburrow bunburrow) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (bunburrow.IsCustomBunburrow()) { return !BunburrowExtension.IsVoidBunburrow(bunburrow); } return __result; } } [HarmonyPatch(typeof(BunburrowExtension), "IsVoidBunburrow")] internal class IsVoidBunburrowPatch { private static bool Postfix(bool __result, Bunburrow bunburrow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (bunburrow.IsCustomBunburrow()) { return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow?.IsVoid ?? __result; } return __result; } } [HarmonyPatch(typeof(BunburrowExtension), "GetBunburrowsInMapOrderList")] internal class GetBunburrowsInMapOrderListPatch { private static void Postfix(ref IEnumerable<Bunburrow> __result) { if (MapContext.Instance != null) { __result = MapContext.Instance; } } } [HarmonyPatch(typeof(BunburrowExtension), "GetMapIndex")] internal class GetMapIndexPatch { private static void Postfix(ref Vector2Int __result) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (MapContext.Instance != null) { __result = MapContext.Instance.CurrentCoordinates; } } } [HarmonyPatch(typeof(BunburrowExtension), "TryGetBunburrowFromMapIndex")] internal class TryGetBunburrowFromMapIndexPatch { private static void Postfix(ref bool __result, Vector2Int mapIndex, ref Bunburrow bunburrow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown if (MapContext.Instance != null) { MapCoordinate mapCoordinate = MapContext.Instance.Coordinates.FirstOrDefault((MapCoordinate c) => c.MapIndex == mapIndex); if (mapCoordinate != null) { bunburrow = (Bunburrow)(int)mapCoordinate.Bunburrow; __result = true; } else { __result = false; } } } } } namespace Bunject.Patches.BunburrowEntryTilePatches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class ConstructorPatch { private static void Postfix(BunburrowEntryTile __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Traverse val = Traverse.Create((object)__instance); Traverse<int> val2 = val.Field<int>("specialIndex"); Bunburrow val3 = (Bunburrow)val2.Value; if (val3.IsCustomBunburrow()) { val.Field<Bunburrow?>("Bunburrow").Value = val3; val.Field("isUnlocked").SetValue((object)val3.IsUnlocked()); val2.Value = -1; } } } [HarmonyPatch(typeof(BunburrowEntryTile), "HandleLevelReset")] internal class HandleLevelResetPatch { private static void Postfix(BunburrowEntryTile __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (__instance.Bunburrow.HasValue && __instance.Bunburrow.Value.IsCustomBunburrow()) { IModBunburrow modBunburrow = __instance.Bunburrow.Value.GetModBunburrow(); if (modBunburrow != null && !modBunburrow.HasEntrance) { GameManager.TileMaps.ExitsTileMap.SetTile(VectorConversions.ToVector3Int(((TileLevelData)__instance).Position), (TileBase)null); } } } } } namespace Bunject.Patches.AssetsManagerPatches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class LevelsListsPatch { private static void Prefix(ref ReadOnlyDictionary<string, LevelsList> value) { value = new ReadOnlyDictionary<string, LevelsList>(new InjectionDictionary<string, LevelsList>(AssetsManagerRewiring.LoadLevelsList, value)); } } } namespace Bunject.Monitoring { public interface IMonitor : IBunjectorPlugin { LevelObject OnLevelLoad(LevelObject level, LevelIdentity identity); string OnLevelTitle(string title, LevelIdentity identity, bool useWhite); LevelsList LoadEmergencyLevelsList(LevelsList original); void OnBunnyCapture(BunnyIdentity bunnyIdentity, bool wasHomeCapture); void OnMainMenu(); void OnShowCredits(); void OnPowerTile(PowerUnlockTile tile, LevelIdentity identity, Action dismiss); bool TryResolvePowerTileSprite(PowerUnlockTile tile, LevelIdentity identity, out TileBase sprite); } } namespace Bunject.Menu { public interface IMenuSource : IBunjectorPlugin { string MenuTitle { get; } void DrawMenuOptions(); } internal class MenuDisplay : MonoBehaviour { private Rect windowRect = new Rect(20f, 20f, 0f, 0f); private List<IMenuSource> menuSources; private int activeMenu; private void OnGUI() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) float num = 2f; float num2 = 2f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, num2, 1f); GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, val); menuSources = BunjectAPI.MenuOptions.ToList(); if (menuSources.Count > 0) { activeMenu %= menuSources.Count; GUILayout.Window(0, windowRect, new WindowFunction(RenderWindow), "Bunject", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.MinWidth(400f), GUILayout.MinHeight(50f) }); } } private void RenderWindow(int windowId) { GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (menuSources.Count > 1) { if (GUILayout.Button("<", Array.Empty<GUILayoutOption>())) { activeMenu = (activeMenu + menuSources.Count - 1) % menuSources.Count; } GUILayout.Label(menuSources[activeMenu % menuSources.Count].MenuTitle, Array.Empty<GUILayoutOption>()); if (GUILayout.Button(">", Array.Empty<GUILayoutOption>())) { activeMenu = (activeMenu + 1) % menuSources.Count; } } GUILayout.EndHorizontal(); menuSources[activeMenu].DrawMenuOptions(); GUILayout.EndVertical(); } } } namespace Bunject.Map { internal class MapContext : IDisposable, IEnumerable<Bunburrow>, IEnumerable { private class MapContextEnumerator : IEnumerator<Bunburrow>, IEnumerator, IDisposable { private MapContext owner; public Bunburrow Current => owner.Current; object IEnumerator.Current => Current; public MapContextEnumerator(MapContext owner) { this.owner = owner; } public void Dispose() { } public bool MoveNext() { return owner.MoveNext(); } public void Reset() { owner.Reset(); } } private IEnumerator<MapCoordinate> coordinateEnumerator; private bool disposedValue; public static MapContext Instance { get; private set; } public Bunburrow Bunburrow { get; private set; } public IReadOnlyList<MapCoordinate> Coordinates { get; private set; } public Vector2Int CurrentCoordinates => coordinateEnumerator.Current.MapIndex; public Vector2Int InitialCenter { get; private set; } public Bunburrow Current => coordinateEnumerator.Current.Bunburrow; public MapContext(Bunburrow bunburrow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Bunburrow = bunburrow; List<MapCoordinate> item = GenerateMap(bunburrow).Item1; Coordinates = item; Instance = this; } private static (List<MapCoordinate>, Vector2Int) GenerateMap(Bunburrow bunburrow) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Invalid comparison between Unknown and I4 //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) Dictionary<LevelsList, Bunburrow> dictionary = new Dictionary<LevelsList, Bunburrow>(); foreach (BunburrowMetadata bunburrow2 in BunburrowManager.Bunburrows) { dictionary.Add(bunburrow2.ModBunburrow.GetLevels(), BunburrowExtension.ToBunburrow(bunburrow2.ID)); } List<Bunburrow> second = GetAllBunburrowsInDirection(bunburrow, (Direction)2, dictionary).Skip(1).ToList(); List<Bunburrow> list = GetAllBunburrowsInDirection(bunburrow, (Direction)3, dictionary).Reverse().ToList(); List<Bunburrow> list2 = GetAllBunburrowsInDirection(bunburrow, (Direction)0, dictionary).Reverse().ToList(); List<Bunburrow> second2 = GetAllBunburrowsInDirection(bunburrow, (Direction)1, dictionary).Skip(1).ToList(); Bunburrow[] array = list2.Concat(second2).ToArray(); Bunburrow[] array2 = list.Concat(second).ToArray(); int num = array.Length; int num2 = array2.Length; int num3 = list2.Count - 1; int num4 = list.Count - 1; Bunburrow[,] array3 = new Bunburrow[num, num2]; for (int i = 0; i < num; i++) { for (int j = 0; j < num2; j++) { array3[i, j] = (Bunburrow)(-1); } } for (int k = 0; k < num; k++) { array3[k, num4] = array[k]; } for (int l = 0; l < num2; l++) { array3[num3, l] = array2[l]; } InitializeQuadrant(array3, num3, num4, -1, 1, -1, num2, (Direction)0, (Direction)2, dictionary); InitializeQuadrant(array3, num3, num4, 1, 1, num, num2, (Direction)1, (Direction)2, dictionary); InitializeQuadrant(array3, num3, num4, 1, -1, num, -1, (Direction)1, (Direction)3, dictionary); InitializeQuadrant(array3, num3, num4, -1, -1, -1, -1, (Direction)0, (Direction)3, dictionary); List<MapCoordinate> list3 = new List<MapCoordinate>(); for (int m = 0; m < num; m++) { for (int n = 0; n < num2; n++) { if ((int)array3[m, n] >= 0) { list3.Add(new MapCoordinate { MapIndex = new Vector2Int(m - num3 + 1, n - num4 + 1), Bunburrow = array3[m, n] }); } } } return (list3, CreatePixelOffset(num3, num4)); } private static void InitializeQuadrant(Bunburrow[,] coordinates, int centerX, int centerY, int xStep, int yStep, int xBound, int yBound, Direction xDirection, Direction yDirection, IReadOnlyDictionary<LevelsList, Bunburrow> burrowLookup) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) for (int i = centerX + xStep; i != xBound; i += xStep) { for (int j = centerY + yStep; j != yBound; j += yStep) { Bunburrow val = coordinates[i - xStep, j]; Bunburrow val2 = coordinates[i, j - yStep]; Bunburrow? val3 = (((int)val >= 0) ? GetNextBunburrow(val, xDirection, burrowLookup) : ((Bunburrow?)null)); Bunburrow? val4 = (((int)val2 >= 0) ? GetNextBunburrow(val2, yDirection, burrowLookup) : ((Bunburrow?)null)); if (val3.HasValue) { if (val4.HasValue) { if (val4 == val3) { coordinates[i, j] = val3.Value; } } else { coordinates[i, j] = val3.Value; } } else if (val4.HasValue) { coordinates[i, j] = val4.Value; } } } } private static Bunburrow? GetNextBunburrow(Bunburrow bunburrow, Direction step, IReadOnlyDictionary<LevelsList, Bunburrow> burrowLookup) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) LevelsList key = bunburrow.GetModBunburrow().GetLevels().AdjacentBunburrows[step]; if (burrowLookup.ContainsKey(key)) { return burrowLookup[key]; } return null; } private static IEnumerable<Bunburrow> GetAllBunburrowsInDirection(Bunburrow bunburrow, Direction step, IReadOnlyDictionary<LevelsList, Bunburrow> burrowLookup) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) List<Bunburrow> list = new List<Bunburrow>(); Bunburrow val = bunburrow; do { list.Add(val); _ = bunburrow.GetModBunburrow().GetLevels().AdjacentBunburrows[step]; Bunburrow? nextBunburrow = GetNextBunburrow(val, step, burrowLookup); if (!nextBunburrow.HasValue) { return list; } val = nextBunburrow.Value; } while (!list.Contains(val)); list.Add(val); return list; } private static Vector2Int CreatePixelOffset(int centerX, int centerY) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) double num = ((double)centerX + 0.5) * (double)((Vector2Int)(ref ComputerMapBuilder.LevelPixelSize)).x + 6.0; double num2 = ((double)centerY + 0.5) * (double)((Vector2Int)(ref ComputerMapBuilder.LevelPixelSize)).y + 5.0; return new Vector2Int((int)num, (int)num2); } public IEnumerator<Bunburrow> GetEnumerator() { coordinateEnumerator = Coordinates.GetEnumerator(); return new MapContextEnumerator(this); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public bool MoveNext() { return coordinateEnumerator.MoveNext(); } public void Reset() { coordinateEnumerator.Reset(); } protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing && Instance == this) { Instance = null; } disposedValue = true; } } public void Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } } internal class MapCoordinate { public Bunburrow Bunburrow { get; set; } public Vector2Int MapIndex { get; set; } } } namespace Bunject.Levels { public class BunburrowRequirements { public int Bunnies { get; set; } public int Babies { get; set; } public int HomeCaptures { get; set; } public bool AreMet(GeneralProgression progression) { if (progression.HistoryCapturedBunnies.Count >= Bunnies && progression.ExistingCouples.Count >= Babies) { return progression.HomeCapturedBunnies.Count >= HomeCaptures; } return false; } } internal class CoreBunburrow : IModBunburrow { private LevelsList levels; public string Name { get; } public string Indicator { get; } public bool IsVoid { get; } public int ID { get; set; } public BunburrowStyle Style { get; } public bool HasEntrance => true; public bool HasSign => true; public BunburrowRequirements Requirements => new BunburrowRequirements(); public CoreBunburrow(string name, string indicator, bool isVoid) { Name = name; Indicator = indicator; IsVoid = isVoid; } public Vector2Int? OverrideSignCoordinate() { return null; } public LevelsList GetLevels() { if ((Object)(object)levels == (Object)null) { levels = AssetsManager.LevelsLists[Name]; } return levels; } public LevelObject GetLevel(int depth) { return GetLevels()[depth]; } public LevelObject GetSurfaceLevel() { return AssetsManager.SurfaceRightLevel; } public List<Vector2Int> GetReleasePath() { return null; } } public interface IModBunburrow { int ID { get; set; } string Name { get; } string Indicator { get; } bool IsVoid { get; } BunburrowStyle Style { get; } bool HasEntrance { get; } bool HasSign { get; } BunburrowRequirements Requirements { get; } Vector2Int? OverrideSignCoordinate(); LevelsList GetLevels(); LevelObject GetSurfaceLevel(); List<Vector2Int> GetReleasePath(); } public enum LoadingContext { Metadata, LevelTransition } internal static class CurrentLoadingContext { public static LoadingContext Value { get; set; } } public class ModLevelObject : LevelObject { private Traverse traverse; public string BunburrowName { get; set; } public int Depth { get; set; } public List<NPCDialogueObject> OphelineDialogues { get; set; } public List<NPCDialogueObject> HerbeDialogues { get; set; } private Traverse Traverse { get { if (traverse == null) { traverse = Traverse.Create((object)this); } return traverse; } } public string CustomNameKey { get { return ((LevelObject)this).CustomNameKey; } set { Traverse.Field<string>("customNameKey").Value = value; } } public string Content { get { return ((LevelObject)this).Content; } set { Traverse.Field<string>("content").Value = value; } } public int NumberOfTraps { get { return ((LevelObject)this).NumberOfTraps; } set { Traverse.Field<int>("numberOfTraps").Value = value; } } public int NumberOfPickaxes { get { return ((LevelObject)this).NumberOfPickaxes; } set { Traverse.Field<int>("numberOfPickaxes").Value = value; } } public int NumberOfShovels { get { return ((LevelObject)this).NumberOfShovels; } set { Traverse.Field<int>("numberOfShovels").Value = value; } } public int NumberOfCarrots { get { return ((LevelObject)this).NumberOfCarrots; } set { Traverse.Field<int>("numberOfCarrots").Value = value; } } public BunburrowStyle BunburrowStyle { get { return ((LevelObject)this).BunburrowStyle; } set { Traverse.Field<BunburrowStyle>("bunburrowStyle").Value = value; } } public Sprite SpecificBackground { get { return ((LevelObject)this).SpecificBackground; } set { Traverse.Field<Sprite>("specificBackground").Value = value; } } public bool IsTemple { get { return ((LevelObject)this).IsTemple; } set { Traverse.Field<bool>("isTemple").Value = value; } } public bool IsHell { get { return ((LevelObject)this).IsHell; } set { Traverse.Field<bool>("isHell").Value = value; } } public bool IsSurface { get { return ((LevelObject)this).IsSurface; } set { Traverse.Field<bool>("isSurface").Value = value; } } public DirectionsListOf<LevelObject> SideLevels { get { return ((LevelObject)this).SideLevels; } set { Traverse.Field<DirectionsListOf<LevelObject>>("sideLevels").Value = value; } } public List<DialogueObject> Dialogues { get { return Traverse.Field<List<DialogueObject>>("dialogues").Value; } set { Traverse.Field<List<DialogueObject>>("dialogues").Value = value; } } public IReadOnlyList<Solution> Solutions { get { return ((LevelObject)this).Solutions; } set { Traverse.Field<List<Solution>>("solutions").Value = new List<Solution>(value); } } public Vector2Int TeleportPosition { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ((LevelObject)this).TeleportPosition; } set { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Traverse.Field<Vector2Int>("teleportPosition").Value = value; } } public ModLevelObject() { Dialogues = new List<DialogueObject>(); Traverse.Field("contextualDialogues").SetValue((object)new List<ContextualDialogueInfo>()); SideLevels = new DirectionsListOf<LevelObject>((LevelObject)null, (LevelObject)null, (LevelObject)null, (LevelObject)null); } } public class ModLevelsList : LevelsList { private Traverse traverse; private Traverse<List<LevelObject>> traverseList; protected Traverse Traverse { get { if (traverse == null) { traverse = Traverse.Create((object)this); } return traverse; } } public int NumberOfRegularBunnies { get { return ((LevelsList)this).NumberOfRegularBunnies; } set { Traverse.Field<int>("numberOfRegularBunnies").Value = value; } } public int NumberOfTempleBunnies { get { return ((LevelsList)this).NumberOfTempleBunnies; } set { Traverse.Field<int>("numberOfTempleBunnies").Value = value; } } public int NumberOfHellBunnies { get { return ((LevelsList)this).NumberOfHellBunnies; } set { Traverse.Field<int>("numberOfHellBunnies").Value = value; } } public DirectionsListOf<LevelsList> AdjacentBunburrows { get { return ((LevelsList)this).AdjacentBunburrows; } set { Traverse.Field<DirectionsLis