Decompiled source of PlayableLemurian v1.0.0

PlayableLemurian.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PlayableLemurian")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PlayableLemurian")]
[assembly: AssemblyTitle("PlayableLemurian")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 PlayableLemurian
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Quki.PlayableLemurian", "PlayableLemurian", "1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGUID = "Quki.PlayableLemurian";

		public const string PluginName = "PlayableLemurian";

		public const string PluginVersion = "1.0";

		private const string LemurianBodyKey = "RoR2/Base/Lemurian/LemurianBody.prefab";

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianBody.prefab").WaitForCompletion();
			if (!Object.op_Implicit((Object)(object)val))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Could not load RoR2/Base/Lemurian/LemurianBody.prefab.");
				return;
			}
			GameObject val2 = PrefabAPI.InstantiateClone(val, "PlayableLemurianBody", true);
			CharacterBody component = val2.GetComponent<CharacterBody>();
			component.baseNameToken = "PLAYABLELEMURIAN_BODY_NAME";
			component.subtitleNameToken = "PLAYABLELEMURIAN_BODY_SUBTITLE";
			DeathRewards component2 = val2.GetComponent<DeathRewards>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				Object.DestroyImmediate((Object)(object)component2);
			}
			if (!Object.op_Implicit((Object)(object)val2.GetComponent<Interactor>()))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Body has no Interactor, adding one.");
				Interactor val3 = val2.AddComponent<Interactor>();
				val3.maxInteractionDistance = 3f;
			}
			if (!Object.op_Implicit((Object)(object)val2.GetComponent<InteractionDriver>()))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Body has no InteractionDriver, adding one.");
				val2.AddComponent<InteractionDriver>();
			}
			if (!Object.op_Implicit((Object)(object)component.defaultCrosshairPrefab))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Body has no crosshair prefab.");
			}
			Transform modelTransform = val2.GetComponent<ModelLocator>().modelTransform;
			GameObject val4 = PrefabAPI.InstantiateClone(((Component)modelTransform).gameObject, "PlayableLemurianDisplay", false);
			Transform transform = val4.transform;
			transform.localScale *= 0.6f;
			CharacterModel[] componentsInChildren = val4.GetComponentsInChildren<CharacterModel>(true);
			foreach (CharacterModel obj in componentsInChildren)
			{
				FieldInfo field = typeof(CharacterModel).GetField("disableFade", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					field.SetValue(obj, true);
				}
			}
			SurvivorDef val5 = ScriptableObject.CreateInstance<SurvivorDef>();
			val5.cachedName = "PlayableLemurian";
			val5.displayNameToken = "PLAYABLELEMURIAN_NAME";
			val5.descriptionToken = "PLAYABLELEMURIAN_DESC";
			val5.outroFlavorToken = "PLAYABLELEMURIAN_OUTRO";
			val5.mainEndingEscapeFailureFlavorToken = "PLAYABLELEMURIAN_FAIL";
			val5.bodyPrefab = val2;
			val5.displayPrefab = val4;
			val5.primaryColor = new Color(0.78f, 0.34f, 0.2f);
			val5.desiredSortPosition = 100f;
			ContentAddition.AddBody(val2);
			ContentAddition.AddSurvivorDef(val5);
			try
			{
				GameObject val6 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianMaster.prefab").WaitForCompletion();
				GameObject val7 = PrefabAPI.InstantiateClone(val6, "PlayableLemurianMonsterMaster", true);
				val7.GetComponent<CharacterMaster>().bodyPrefab = val2;
				ContentAddition.AddMaster(val7);
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not create the AI master: " + ex.Message));
			}
			LanguageAPI.Add("PLAYABLELEMURIAN_BODY_NAME", "Lemurian");
			LanguageAPI.Add("PLAYABLELEMURIAN_BODY_SUBTITLE", "Native Lizard");
			LanguageAPI.Add("PLAYABLELEMURIAN_NAME", "Lemurian");
			LanguageAPI.Add("PLAYABLELEMURIAN_DESC", "Rawr growl grrrr graawwrrr mmmrrrrwwrrrr, graaawrrrr. Rawwwrrrrr groaar gr! Grrrr... graawwrrrr! RAAWWRR Grrr grrr. GROAAWWRR. -Lemurian 2056");
			LanguageAPI.Add("PLAYABLELEMURIAN_OUTRO", "..and so it left, still growling.");
			LanguageAPI.Add("PLAYABLELEMURIAN_FAIL", "..and so it stayed, hissing angrily.");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PlayableLemurian registered.");
		}
	}
}