Decompiled source of MVP 6TWELVE Shop v1.0.1

MVP_6TWELVE_Shop.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Empress_ShopLoaderAPI;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MVP_6TWELVE_Shop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MVP_6TWELVE_Shop")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("af4f7a3f-621c-4973-a412-d39c167dd900")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("dev.thatdrw.mvp.6twelveshopmod", "MVP 6TWELVE ShopMod", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MVP_6TWELVE_ShopMod : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin loaded, preparing initialization.");
		Harmony val = new Harmony("dev.thatdrw.mvp.6twelveshopmod");
		val.PatchAll();
		SceneManager.sceneLoaded += OnSceneLoaded;
		HookShopAPI();
	}

	private void HookShopAPI()
	{
		string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "mvp_6twelve_shopmod_bundle");
		AssetBundle val = AssetBundle.LoadFromFile(text);
		if ((Object)(object)val != (Object)null)
		{
			GameObject val2 = val.LoadAsset<GameObject>("Module - Shop - N - Generic MVP 6TWELVE Shop");
			if ((Object)(object)val2 != (Object)null)
			{
				ShopAPI.RegisterShop(val2, "DaRealMVP/6TWELVE");
			}
		}
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Scene loaded: " + ((Scene)(ref scene)).name));
		if ((Object)(object)GameObject.Find("MVP6TWELVEShopModHandler") == (Object)null)
		{
			GameObject val = new GameObject("MVP6TWELVEShopModHandler");
			val.AddComponent<MVP_6TWELVE_ShopModHandler>();
			Object.DontDestroyOnLoad((Object)(object)val);
		}
	}

	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class MVP_6TWELVE_ShopModHandler : MonoBehaviour
{
	private bool levelInitialized;

	private object levelGeneratorInstance;

	private Type levelGeneratorType;

	private void Update()
	{
		LogKeyInputs();
		if (!levelInitialized && TryGetLevelGeneratorInstance(out levelGeneratorInstance, out levelGeneratorType))
		{
			FieldInfo field = levelGeneratorType.GetField("Generated", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field != null && (bool)field.GetValue(levelGeneratorInstance))
			{
				levelInitialized = true;
				Debug.Log((object)"Level is initialized and LG.Generated == true");
			}
		}
	}

	private void LogKeyInputs()
	{
		//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_0026: Unknown result type (might be due to invalid IL or missing references)
		foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
		{
			if (!Input.GetKeyDown(value))
			{
			}
		}
	}

	private bool TryGetLevelGeneratorInstance(out object instance, out Type type)
	{
		type = AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.Name == "LevelGenerator");
		if (type != null)
		{
			FieldInfo field = type.GetField("Instance", BindingFlags.Static | BindingFlags.Public);
			if (field != null)
			{
				instance = field.GetValue(null);
				return instance != null;
			}
		}
		instance = null;
		return false;
	}
}