Decompiled source of DSPBigMechaStorage v1.0.6

DSPBigMechaStorage.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DspFontPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DspFontPatcher")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace DSPBigMechaStorage;

[BepInPlugin("Appun.DSP.plugin.BigMechaStorage", "DSPBigMechaStorage", "1.0.6")]
[BepInProcess("DSPGAME.exe")]
public class DSPBigMechaStorage : BaseUnityPlugin
{
	[HarmonyPatch(typeof(UIMechaWindow), "_OnOpen")]
	public static class UIMechaWindow_OnOpen
	{
		[HarmonyPostfix]
		public static void Postfix(UIMechaWindow __instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			if (!defaultSetting.Value)
			{
				__instance.rectTrans.sizeDelta = new Vector2(__instance.rectTrans.sizeDelta.x, __instance.rectTrans.sizeDelta.y + 500f);
				__instance.fuelGrid.storage.SetSize(reactorStorageSize);
				__instance.fuelGrid.colCount = 4;
				__instance.warpGrid.storage.SetSize(warpStorageSize);
				for (int i = 0; i < warpStorageSize; i++)
				{
					__instance.warpGrid.storage.grids[i].filter = 1210;
					__instance.warpGrid.storage.grids[i].itemId = 1210;
					__instance.warpGrid.storage.grids[i].stackSize = StorageComponent.itemStackCount[1210];
				}
			}
			else
			{
				__instance.fuelGrid.storage.SetSize(4);
				__instance.fuelGrid.colCount = 4;
				__instance.warpGrid.storage.SetSize(1);
			}
		}
	}

	public static int reactorStorageSize = 24;

	public static int warpStorageSize = 6;

	public static ConfigEntry<bool> defaultSetting;

	public void Start()
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		LogManager.Logger = ((BaseUnityPlugin)this).Logger;
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		defaultSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("DefaultSetting", "DefaultSize?", false, "Reset Your Inventory Size?");
		if (!defaultSetting.Value)
		{
			GameObject val = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/panel-bg");
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(val.GetComponent<RectTransform>().sizeDelta.x, val.GetComponent<RectTransform>().sizeDelta.y + 250f);
			GameObject val2 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/ammo-group");
			val2.transform.localPosition = new Vector3(-258f, -267f, 0f);
			GameObject val3 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fighter-group");
			val3.transform.localPosition = new Vector3(-258f, -350f, 0f);
			GameObject val4 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fleet-group");
			val4.transform.localPosition = new Vector3(-258f, -417f, 0f);
			GameObject val5 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/panel-bg/fighter-group-placeholder");
			val5.transform.localPosition = new Vector3(-258f, -108f, 0f);
			GameObject val6 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/panel-bg/fleet-group-placeholder");
			val6.transform.localPosition = new Vector3(-258f, -175f, 0f);
			GameObject val7 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/information");
			val7.transform.localPosition = new Vector3(330f, 50f, 0f);
			GameObject val8 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fuel-group");
			val8.transform.localPosition = new Vector3(-258f, 52f, 0f);
			val8.GetComponent<RectTransform>().sizeDelta = new Vector2(270f, 316f);
			GameObject val9 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fuel-group/fuel-storage");
			val9.GetComponent<RectTransform>().sizeDelta = new Vector2(216f, 312f);
			GameObject val10 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fuel-group/fuel");
			val10.transform.localPosition = new Vector3(5f, -32f, 0f);
			GameObject val11 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fuel-group/warp-storage");
			val11.transform.localPosition = new Vector3(267f, -5f, 0f);
			val11.GetComponent<RectTransform>().sizeDelta = new Vector2(54f, 270f);
			GameObject val12 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fuel-group/warp-storage/bg/border");
			val12.gameObject.SetActive(true);
			((Behaviour)val12.GetComponent<Image>()).enabled = true;
			GameObject val13 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fuel-group/warp-storage/bg");
			((Graphic)val13.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.298f);
			((Behaviour)val13.GetComponent<Image>()).enabled = true;
			GameObject val14 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mecha Window/fuel-group/warp-storage/icon-bg");
			((Graphic)val14.GetComponent<Image>()).color = new Color(0.6557f, 0.9145f, 1f, 0.0627f);
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(Mecha), "Import")]
	public static void Mecha_Import_Postfix(Mecha __instance)
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		Player mainPlayer = GameMain.mainPlayer;
		if (!defaultSetting.Value)
		{
			__instance.reactorStorage = new StorageComponent(reactorStorageSize);
			__instance.warpStorage = new StorageComponent(warpStorageSize);
		}
		else
		{
			__instance.reactorStorage = new StorageComponent(4);
			__instance.warpStorage = new StorageComponent(1);
		}
	}

	public static void Mecha_Init_Patch(Mecha __instance)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		if (!defaultSetting.Value)
		{
			__instance.reactorStorage = new StorageComponent(reactorStorageSize);
			__instance.warpStorage = new StorageComponent(warpStorageSize);
			for (int i = 0; i < warpStorageSize; i++)
			{
				__instance.warpStorage.SetFilterDirect(i, 1210, 500);
			}
		}
	}
}
public class LogManager
{
	public static ManualLogSource Logger;
}