Decompiled source of LC Construct v1.0.2

BepInEx/plugins/GMConstruct.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LC_API.BundleAPI;
using LC_API.ServerAPI;
using MOON_API;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("GMConstruct")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GMConstruct")]
[assembly: AssemblyTitle("GMConstruct")]
[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 LCConstruct
{
	[BepInPlugin("LCConstruct", "LC_Construct", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("LCConstruct");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_Construct LAODED");
		}

		private void OnDestroy()
		{
			ModdedServer.SetServerModdedOnly();
		}
	}
}
namespace GMConstruct
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "GMConstruct";

		public const string PLUGIN_NAME = "GMConstruct";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace GMConstruct.Patches
{
	[HarmonyPatch]
	internal class MainPatches
	{
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPrefix]
		private static bool AwakePatch(StartOfRound __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			SelectableLevel val = new SelectableLevel();
			val.LevelDescription = "POPULATION: Abandoned\nCONDITIONS: Arid. Clear skies.\nFAUNA:nuthin";
			val.planetHasTime = false;
			((Object)val).name = "LC_Construct";
			val.PlanetName = "LC_Construct";
			val.sceneName = "InitSceneLaunchOptions";
			val.riskLevel = "Safe";
			val.spawnEnemiesAndScrap = false;
			val.timeToArrive = 6f;
			val.planetPrefab = ((Component)__instance).GetComponent<StartOfRound>().levels[0].planetPrefab;
			Core.AddMoon(val, BundleLoader.GetLoadedAsset<GameObject>("assets/lcconstruct/main.prefab"));
			return true;
		}

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void AwakePatch2(StartOfRound __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			GameObject val = GameObject.Find("TerminalScript");
			Terminal component = val.GetComponent<Terminal>();
			TerminalKeyword val2 = new TerminalKeyword();
			((Object)val2).name = "Construct";
			val2.word = "construct";
			int num = component.moonsCatalogueList.Length;
			Array.Resize(ref component.moonsCatalogueList, num + 1);
			component.moonsCatalogueList[num] = Core.GetMoons()["LC_Construct"];
			Array.Resize(ref component.terminalNodes.allKeywords, component.terminalNodes.allKeywords.Length + 1);
			component.terminalNodes.allKeywords[component.terminalNodes.allKeywords.Length - 1] = val2;
			TerminalNode val3 = new TerminalNode();
			((Object)val3).name = "construct2";
			val3.itemCost = 0;
			val3.displayText = "Thank you.";
			val3.buyRerouteToMoon = Core.ModdedIds["LC_Construct"];
			val3.clearPreviousText = true;
			val3.buyUnlockable = false;
			CompatibleNoun val4 = new CompatibleNoun();
			val4.noun = component.terminalNodes.allKeywords[3];
			val4.result = val3;
			TerminalNode val5 = new TerminalNode();
			((Object)val5).name = "construct1";
			val5.buyItemIndex = -1;
			val5.clearPreviousText = true;
			val5.buyUnlockable = false;
			val5.displayText = "Are you certain you want to go to LC_Construct?\n\nPlease CONFIRM or DENY.\n\n";
			val5.isConfirmationNode = false;
			val5.itemCost = 0;
			val5.overrideOptions = true;
			val5.maxCharactersToType = 15;
			val5.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
			{
				val4,
				component.terminalNodes.allKeywords[26].compatibleNouns[0].result.terminalOptions[1]
			};
			CompatibleNoun val6 = new CompatibleNoun();
			val6.noun = val2;
			val6.result = val5;
			val2.defaultVerb = component.terminalNodes.allKeywords[26];
			Array.Resize(ref component.terminalNodes.allKeywords[26].compatibleNouns, component.terminalNodes.allKeywords[26].compatibleNouns.Length + 1);
			component.terminalNodes.allKeywords[26].compatibleNouns[component.terminalNodes.allKeywords[26].compatibleNouns.Length - 1] = val6;
			component.terminalNodes.allKeywords[component.terminalNodes.allKeywords.Length - 1] = val2;
		}
	}
}