

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.EntityFramework;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.ObjectScripts;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.UI.Shop;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.IO;
using MelonLoader;
using Microsoft.CodeAnalysis;
using S1API.Entities;
using S1API.Messaging;
using Toileportation;
using UnityEngine;
using UnityEngine.UIElements;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "Toileportation", "1.0.0", "weedeej", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Toileportation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+922cea03388403ef4be329f72ed6ed4dea148d7e")]
[assembly: AssemblyProduct("Toileportation")]
[assembly: AssemblyTitle("Toileportation")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Toileportation
{
[HarmonyPatch(typeof(ShopListing), "Initialize")]
public static class GoldenToiletPatch
{
public static void Postfix(ShopListing __instance)
{
if (__instance.name == null || !__instance.name.Contains("Golden Toilet"))
{
return;
}
try
{
((ItemDefinition)__instance.Item).Description = "The lost artifact of Zaza.\nWho knows what power resides... \n(Stock resets every week)";
__instance.OverriddenPrice = 80000f;
__instance.OverridePrice = true;
__instance.DefaultStock = 2;
__instance.RestockRate = (ERestockRate)1;
__instance.SetStock(2, true);
MelonLogger.Msg("Patched Golden Toilet successfully!");
}
catch (Exception value)
{
MelonLogger.Error($"Failed to patch Golden Toilet: {value}");
}
}
}
[HarmonyPatch(typeof(Toilet), "Interacted")]
public static class ToiletFlushPatch
{
[CompilerGenerated]
private sealed class <HideConversation>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HideConversation>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(5f);
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
Enumerator<NPC> enumerator = NPCManager.NPCRegistry.GetEnumerator();
while (enumerator.MoveNext())
{
NPC current = enumerator.Current;
if (current.FirstName == "Golden" && current.LastName == "Toilet")
{
current.MSGConversation.SetEntryVisibility(false);
}
}
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <HideResponses>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HideResponses>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
Enumerator<NPC> enumerator = NPCManager.NPCRegistry.GetEnumerator();
while (enumerator.MoveNext())
{
NPC current = enumerator.Current;
if (current.FirstName == "Golden" && current.LastName == "Toilet")
{
current.MSGConversation.SetResponseContainerVisible(false);
}
}
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static void Prefix(Toilet __instance)
{
//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)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
if (((BuildableItem)__instance).ItemInstance.Definition.Name != "Golden Toilet")
{
return;
}
Player local = Player.Local;
Vector3 position = local.Avatar.MiddleSpine.position;
Vector3 position2 = ((BuildableItem)__instance).BuildPoint.position;
float num = Vector3.Distance(position, position2);
float num2 = position.y - position2.y;
if (!(position.y < position2.y) && !((double)num2 <= 1.4) && !((double)num2 >= 1.6) && !((double)num > 1.5) && local.Crouched)
{
NPC toiletNPC = NPC.Get<ToiletNPC>();
Response[] array = (Response[])(object)new Response[2]
{
new Response
{
OnTriggered = delegate
{
toiletNPC.SendTextMessage("And you will be guided.", (Response[])null, 1f, true);
new TeleporterUI().ShowTeleportationUI();
},
Text = "Guide me through"
},
new Response
{
OnTriggered = delegate
{
toiletNPC.SendTextMessage("And so it will be.", (Response[])null, 1f, true);
MelonCoroutines.Start(HideConversation());
},
Text = "Leave the tale untold"
}
};
toiletNPC.SendTextMessage("Thou hast uncovered the long-lost secret of the Golden Throne — a relic of legend, whispered of in forgotten tongues and hidden beneath veils of time.\n\nWhat fate shall thee choose?", array, 1f, true);
MelonCoroutines.Start(HideResponses());
}
}
[IteratorStateMachine(typeof(<HideConversation>d__1))]
private static IEnumerator HideConversation()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HideConversation>d__1(0);
}
[IteratorStateMachine(typeof(<HideResponses>d__2))]
private static IEnumerator HideResponses()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HideResponses>d__2(0);
}
}
public class Core : MelonMod
{
private Il2CppAssetBundle bundle;
public override void OnInitializeMelon()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
try
{
Stream manifestResourceStream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream("Toileportation.toiletportation.bundle");
if (manifestResourceStream == null)
{
((MelonBase)this).Unregister("AssetBundle stream not found", false);
return;
}
byte[] array;
using (MemoryStream memoryStream = new MemoryStream())
{
manifestResourceStream.CopyTo(memoryStream);
array = memoryStream.ToArray();
}
Stream val = (Stream)new MemoryStream(Il2CppStructArray<byte>.op_Implicit(array));
bundle = Il2CppAssetBundleManager.LoadFromStream(val);
}
catch (Exception value)
{
((MelonBase)this).Unregister($"Failed to load AssetBundle. Please report to dev: {value}", false);
return;
}
((MelonBase)this).LoggerInstance.Msg("Initialized Toileportation");
}
}
public static class ModUtilities
{
public static Dictionary<string, BuildableItem[]> GetAllGoldenToilet()
{
BuildableItem[] array = ((IEnumerable<BuildableItem>)Object.FindObjectsOfType<BuildableItem>()).Where((BuildableItem builtItem) => builtItem.ParentProperty.IsOwned && builtItem.ItemInstance.Name == "Golden Toilet").ToArray();
Dictionary<string, BuildableItem[]> dictionary = new Dictionary<string, BuildableItem[]>();
BuildableItem[] array2 = array;
foreach (BuildableItem val in array2)
{
string propertyName = val.ParentProperty.PropertyName;
if (!dictionary.ContainsKey(propertyName))
{
dictionary[propertyName] = (BuildableItem[])(object)new BuildableItem[1] { val };
}
else
{
List<BuildableItem> list = new List<BuildableItem>(dictionary[propertyName]);
list.Add(val);
dictionary[propertyName] = list.ToArray();
}
}
return dictionary;
}
}
public class TeleporterUI
{
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0
{
public GameObject instance;
internal void <ShowUICoro>b__0(ClickEvent ev)
{
Object.Destroy((Object)(object)instance);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass3_1
{
public BuildableItem toilet;
public <>c__DisplayClass3_0 CS$<>8__locals1;
internal void <ShowUICoro>b__1(ClickEvent ev)
{
//IL_000b: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = toilet.BuildPoint.position;
position.y += 2f;
Player local = Player.Local;
PlayerSingleton<PlayerMovement>.Instance.Teleport(position);
((Component)local).transform.forward = ((Component)toilet).transform.forward;
local.SendCrouched(true);
local.SetCrouchedLocal(true);
Object.Destroy((Object)(object)CS$<>8__locals1.instance);
}
}
[CompilerGenerated]
private sealed class <ShowUICoro>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private <>c__DisplayClass3_0 <>8__1;
public TeleporterUI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ShowUICoro>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Expected O, but got Unknown
int num = <>1__state;
TeleporterUI teleporterUI = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass3_0();
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
<>8__1.instance = teleporterUI.bundle.LoadAsset<GameObject>("assets/toiletportationui.prefab");
<>8__1.instance = Object.Instantiate<GameObject>(<>8__1.instance);
VisualElement rootVisualElement = <>8__1.instance.GetComponent<UIDocument>().rootVisualElement;
ScrollView val = UQueryExtensions.Q<ScrollView>(rootVisualElement, "propertiesContainer", (string)null);
((CallbackEventHandler)UQueryExtensions.Q<Button>(rootVisualElement, "closeBtn", (string)null)).RegisterCallback<ClickEvent>(EventCallback<ClickEvent>.op_Implicit((Action<ClickEvent>)delegate
{
Object.Destroy((Object)(object)<>8__1.instance);
}), (TrickleDown)0);
VisualTreeAsset val2 = teleporterUI.bundle.LoadAsset<VisualTreeAsset>("assets/entry.uxml");
VisualTreeAsset val3 = teleporterUI.bundle.LoadAsset<VisualTreeAsset>("assets/goldentoiletentry.uxml");
Dictionary<string, BuildableItem[]> allGoldenToilet = ModUtilities.GetAllGoldenToilet();
Sprite icon = Registry.GetItem("goldentoilet").Icon;
foreach (KeyValuePair<string, BuildableItem[]> item in allGoldenToilet)
{
if (item.Value.Length == 0)
{
continue;
}
TemplateContainer val4 = val2.CloneTree();
Foldout val5 = UQueryExtensions.Q<Foldout>((VisualElement)(object)val4, "entry", (string)null);
val5.text = item.Key;
BuildableItem[] value = item.Value;
for (int i = 0; i < value.Length; i++)
{
<>c__DisplayClass3_1 CS$<>8__locals0 = new <>c__DisplayClass3_1
{
CS$<>8__locals1 = <>8__1,
toilet = value[i]
};
TemplateContainer val6 = val3.CloneTree();
Button obj = UQueryExtensions.Q<Button>((VisualElement)(object)val6, "goldenToilet", (string)null);
Image val7 = new Image();
val7.sprite = icon;
((VisualElement)obj).Add((VisualElement)(object)val7);
((CallbackEventHandler)obj).RegisterCallback<ClickEvent>(EventCallback<ClickEvent>.op_Implicit((Action<ClickEvent>)delegate
{
//IL_000b: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = CS$<>8__locals0.toilet.BuildPoint.position;
position.y += 2f;
Player local = Player.Local;
PlayerSingleton<PlayerMovement>.Instance.Teleport(position);
((Component)local).transform.forward = ((Component)CS$<>8__locals0.toilet).transform.forward;
local.SendCrouched(true);
local.SetCrouchedLocal(true);
Object.Destroy((Object)(object)CS$<>8__locals0.CS$<>8__locals1.instance);
}), (TrickleDown)0);
((VisualElement)val5).contentContainer.Add((VisualElement)(object)val6);
}
((VisualElement)val).contentContainer.Add((VisualElement)(object)val4);
}
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private Il2CppAssetBundle bundle;
public TeleporterUI()
{
Il2CppAssetBundle[] array = Il2CppAssetBundleManager.GetAllLoadedAssetBundles().ToArray();
if (array.Length == 1)
{
bundle = array[0];
return;
}
Il2CppAssetBundle[] array2 = array;
foreach (Il2CppAssetBundle val in array2)
{
if (val.Contains("assets/toiletportationui.prefab"))
{
bundle = val;
break;
}
}
}
public void ShowTeleportationUI()
{
MelonCoroutines.Start(ShowUICoro());
}
[IteratorStateMachine(typeof(<ShowUICoro>d__3))]
public IEnumerator ShowUICoro()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ShowUICoro>d__3(0)
{
<>4__this = this
};
}
}
public class ToiletNPC : NPC
{
public ToiletNPC()
: base(Guid.NewGuid().ToString(), "Golden", "Toilet", Registry.GetItem("goldentoilet").Icon)
{
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using S1API.Entities;
using S1API.Messaging;
using ScheduleOne;
using ScheduleOne.DevUtilities;
using ScheduleOne.EntityFramework;
using ScheduleOne.ItemFramework;
using ScheduleOne.NPCs;
using ScheduleOne.ObjectScripts;
using ScheduleOne.PlayerScripts;
using ScheduleOne.UI.Shop;
using Toileportation;
using UnityEngine;
using UnityEngine.UIElements;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "Toileportation", "1.0.0", "weedeej", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Toileportation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c5233f496e8911a5768c86256f05c3e7c03354a2")]
[assembly: AssemblyProduct("Toileportation")]
[assembly: AssemblyTitle("Toileportation")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Toileportation
{
[HarmonyPatch(typeof(ShopListing), "Initialize")]
public static class GoldenToiletPatch
{
public static void Postfix(ShopListing __instance)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (__instance.name == null || !__instance.name.Contains("Golden Toilet"))
{
return;
}
try
{
((ItemDefinition)__instance.Item).Description = "The lost artifact of Zaza.\nWho knows what power resides... \n(Stock resets every week)";
__instance.OverriddenPrice = 80000f;
__instance.OverridePrice = true;
__instance.DefaultStock = 2;
__instance.RestockRate = (ERestockRate)1;
__instance.SetStock(2, true);
MelonLogger.Msg("Patched Golden Toilet successfully!");
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch Golden Toilet: {arg}");
}
}
}
[HarmonyPatch(typeof(Toilet), "Interacted")]
public static class ToiletFlushPatch
{
[CompilerGenerated]
private sealed class <HideConversation>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HideConversation>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
NPCManager.NPCRegistry.Find((NPC npc) => npc.FirstName == "Golden" && npc.LastName == "Toilet").MSGConversation.SetEntryVisibility(false);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <HideResponses>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HideResponses>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
NPCManager.NPCRegistry.Find((NPC npc) => npc.FirstName == "Golden" && npc.LastName == "Toilet").MSGConversation.SetResponseContainerVisible(false);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static void Postfix(Toilet __instance)
{
//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)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
if (((BuildableItem)__instance).ItemInstance.Definition.Name != "Golden Toilet")
{
return;
}
Player local = Player.Local;
Vector3 position = local.Avatar.MiddleSpine.position;
Vector3 position2 = ((BuildableItem)__instance).BuildPoint.position;
float num = Vector3.Distance(position, position2);
float num2 = position.y - position2.y;
if (!(position.y < position2.y) && !((double)num2 <= 1.4) && !((double)num2 >= 1.6) && !((double)num > 1.5) && local.Crouched)
{
NPC toiletNPC = NPC.Get<ToiletNPC>();
Response[] array = (Response[])(object)new Response[2]
{
new Response
{
OnTriggered = delegate
{
toiletNPC.SendTextMessage("And you will be guided.", (Response[])null, 1f, true);
new TeleporterUI().ShowTeleportationUI();
},
Text = "Guide me through"
},
new Response
{
OnTriggered = delegate
{
toiletNPC.SendTextMessage("And so it will be.", (Response[])null, 1f, true);
MelonCoroutines.Start(HideConversation());
},
Text = "Leave the tale untold"
}
};
toiletNPC.SendTextMessage("Thou hast uncovered the long-lost secret of the Golden Throne — a relic of legend, whispered of in forgotten tongues and hidden beneath veils of time.\n\nWhat fate shall thee choose?", array, 1f, true);
MelonCoroutines.Start(HideResponses());
}
}
[IteratorStateMachine(typeof(<HideConversation>d__1))]
private static IEnumerator HideConversation()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HideConversation>d__1(0);
}
[IteratorStateMachine(typeof(<HideResponses>d__2))]
private static IEnumerator HideResponses()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HideResponses>d__2(0);
}
}
public class Core : MelonMod
{
private AssetBundle bundle;
public override void OnInitializeMelon()
{
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Toileportation.toiletportation.bundle");
if (manifestResourceStream == null)
{
((MelonBase)this).Unregister("AssetBundle stream not found", false);
}
else
{
bundle = AssetBundle.LoadFromStream(manifestResourceStream);
}
}
}
public static class ModUtilities
{
public static Dictionary<string, BuildableItem[]> GetAllGoldenToilet()
{
BuildableItem[] array = (from builtItem in Object.FindObjectsOfType<BuildableItem>()
where builtItem.ParentProperty.IsOwned && builtItem.ItemInstance.Name == "Golden Toilet"
select builtItem).ToArray();
Dictionary<string, BuildableItem[]> dictionary = new Dictionary<string, BuildableItem[]>();
BuildableItem[] array2 = array;
foreach (BuildableItem val in array2)
{
string propertyName = val.ParentProperty.PropertyName;
if (!dictionary.ContainsKey(propertyName))
{
dictionary[propertyName] = (BuildableItem[])(object)new BuildableItem[1] { val };
}
else
{
List<BuildableItem> list = new List<BuildableItem>(dictionary[propertyName]);
list.Add(val);
dictionary[propertyName] = list.ToArray();
}
}
return dictionary;
}
}
public class TeleporterUI
{
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0
{
public GameObject instance;
internal void <ShowUICoro>b__0(ClickEvent ev)
{
Object.Destroy((Object)(object)instance);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass3_1
{
public BuildableItem toilet;
public <>c__DisplayClass3_0 CS$<>8__locals1;
internal void <ShowUICoro>b__1(ClickEvent ev)
{
//IL_000b: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = toilet.BuildPoint.position;
position.y += 2f;
Player local = Player.Local;
PlayerSingleton<PlayerMovement>.Instance.Teleport(position);
((Component)local).transform.forward = ((Component)toilet).transform.forward;
local.SendCrouched(true);
local.SetCrouchedLocal(true);
Object.Destroy((Object)(object)CS$<>8__locals1.instance);
}
}
[CompilerGenerated]
private sealed class <ShowUICoro>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private <>c__DisplayClass3_0 <>8__1;
public TeleporterUI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ShowUICoro>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
TeleporterUI teleporterUI = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass3_0();
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
<>8__1.instance = teleporterUI.bundle.LoadAsset<GameObject>("assets/toiletportationui.prefab");
<>8__1.instance = Object.Instantiate<GameObject>(<>8__1.instance);
VisualElement rootVisualElement = <>8__1.instance.GetComponent<UIDocument>().rootVisualElement;
ScrollView val = UQueryExtensions.Q<ScrollView>(rootVisualElement, "propertiesContainer", (string)null);
((CallbackEventHandler)UQueryExtensions.Q<Button>(rootVisualElement, "closeBtn", (string)null)).RegisterCallback<ClickEvent>((EventCallback<ClickEvent>)delegate
{
Object.Destroy((Object)(object)<>8__1.instance);
}, (TrickleDown)0);
VisualTreeAsset val2 = teleporterUI.bundle.LoadAsset<VisualTreeAsset>("assets/entry.uxml");
VisualTreeAsset val3 = teleporterUI.bundle.LoadAsset<VisualTreeAsset>("assets/goldentoiletentry.uxml");
Dictionary<string, BuildableItem[]> allGoldenToilet = ModUtilities.GetAllGoldenToilet();
Sprite icon = Registry.GetItem("goldentoilet").Icon;
foreach (KeyValuePair<string, BuildableItem[]> item in allGoldenToilet)
{
if (item.Value.Length == 0)
{
continue;
}
TemplateContainer val4 = val2.CloneTree();
Foldout val5 = UQueryExtensions.Q<Foldout>((VisualElement)(object)val4, "entry", (string)null);
val5.text = item.Key;
BuildableItem[] value = item.Value;
for (int i = 0; i < value.Length; i++)
{
<>c__DisplayClass3_1 CS$<>8__locals0 = new <>c__DisplayClass3_1
{
CS$<>8__locals1 = <>8__1,
toilet = value[i]
};
TemplateContainer val6 = val3.CloneTree();
Button obj = UQueryExtensions.Q<Button>((VisualElement)(object)val6, "goldenToilet", (string)null);
IStyle style = ((VisualElement)obj).style;
StyleBackground backgroundImage = default(StyleBackground);
Background value2 = default(Background);
((Background)(ref value2)).sprite = icon;
((StyleBackground)(ref backgroundImage)).value = value2;
style.backgroundImage = backgroundImage;
((CallbackEventHandler)obj).RegisterCallback<ClickEvent>((EventCallback<ClickEvent>)delegate
{
//IL_000b: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = CS$<>8__locals0.toilet.BuildPoint.position;
position.y += 2f;
Player local = Player.Local;
PlayerSingleton<PlayerMovement>.Instance.Teleport(position);
((Component)local).transform.forward = ((Component)CS$<>8__locals0.toilet).transform.forward;
local.SendCrouched(true);
local.SetCrouchedLocal(true);
Object.Destroy((Object)(object)CS$<>8__locals0.CS$<>8__locals1.instance);
}, (TrickleDown)0);
((VisualElement)val5).contentContainer.Add((VisualElement)(object)val6);
}
((VisualElement)val).contentContainer.Add((VisualElement)(object)val4);
}
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private AssetBundle bundle;
public TeleporterUI()
{
foreach (AssetBundle item in AssetBundle.GetAllLoadedAssetBundles().ToList())
{
if (((Object)item).name == "toiletportation.bundle")
{
bundle = item;
break;
}
}
}
public void ShowTeleportationUI()
{
MelonCoroutines.Start(ShowUICoro());
}
[IteratorStateMachine(typeof(<ShowUICoro>d__3))]
public IEnumerator ShowUICoro()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ShowUICoro>d__3(0)
{
<>4__this = this
};
}
}
public class ToiletNPC : NPC
{
public ToiletNPC()
: base(Guid.NewGuid().ToString(), "Golden", "Toilet", Registry.GetItem("goldentoilet").Icon)
{
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}