using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SpookyThomasPlugin;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("SpookyThomas")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Spooky Thomas Plugin for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("SpookyThomas")]
[assembly: AssemblyTitle("SpookyThomas")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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 SpookyThomas.Patches
{
[HarmonyPatch]
internal class EnemyTypes
{
[HarmonyPatch(typeof(FlowermanAI), "Start")]
[HarmonyPostfix]
public static void SummonThomas(FlowermanAI __instance)
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
GameObject thomasHead = Class1.thomasHead;
if ((Object)(object)thomasHead != (Object)null)
{
Transform val = ((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("AnimContainer").Find("metarig");
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"Failed to find 'AnimContainer' object. --exiting");
return;
}
GameObject gameObject = ((Component)val.Find("Torso1").Find("Torso2").Find("Torso3")
.Find("Neck1")
.Find("Neck2")).gameObject;
if ((Object)(object)gameObject != (Object)null)
{
gameObject.transform.localScale = Vector3.zero;
GameObject val2 = Object.Instantiate<GameObject>(thomasHead, gameObject.transform.position, gameObject.transform.rotation);
val2.transform.SetParent(gameObject.transform.parent, true);
val2.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
val2.transform.Rotate(new Vector3(310f, 0f, 22f));
AudioClip iwanabethomas = Class1.iwanabethomas;
if ((Object)(object)iwanabethomas != (Object)null)
{
AudioSource val3 = ((Component)__instance).gameObject.GetComponent<AudioSource>();
if ((Object)(object)val3 == (Object)null)
{
val3 = ((Component)__instance).gameObject.AddComponent<AudioSource>();
}
val3.clip = iwanabethomas;
val3.volume = 0.5f;
val3.loop = true;
val3.spatialBlend = 1f;
val3.pitch = 0.8f;
val3.Play();
AudioReverbFilter val4 = ((Component)__instance).gameObject.AddComponent<AudioReverbFilter>();
val4.reverbPreset = (AudioReverbPreset)9;
AudioHighPassFilter val5 = ((Component)__instance).gameObject.AddComponent<AudioHighPassFilter>();
val5.cutoffFrequency = 500f;
}
else
{
Debug.LogError((object)"Failed to load 'iwanabethomas.wav'");
}
Debug.Log((object)"~Thomas has been summoned~");
}
else
{
Debug.LogError((object)"Could not get neck from metarig -- exiting");
}
}
else
{
Debug.LogError((object)"SpookyThomas Asset could not be loaded from bundle");
}
}
}
}
namespace SpookyThomasPlugin
{
[BepInPlugin("SpookyThomas", "SpookyThomas", "1.0.3")]
public class Class1 : BaseUnityPlugin
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "SpookyThomas";
public const string PLUGIN_NAME = "SpookyThomas";
public const string PLUGIN_VERSION = "1.0.3";
}
public Harmony harmonymain;
public static AssetBundle Bundle;
public static string PluginDirectory;
public static ManualLogSource Logging;
public static AudioClip iwanabethomas;
public static GameObject thomasHead;
private void Awake()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
Logging = ((BaseUnityPlugin)this).Logger;
PluginDirectory = ((BaseUnityPlugin)this).Info.Location;
LoadAssets();
harmonymain = new Harmony("SpookyThomas");
harmonymain.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SpookyThomas is loaded!");
}
private void LoadAssets()
{
try
{
Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "spookythomasbundle"));
}
catch (Exception ex)
{
Logging.LogError((object)("Couldn't load asset bundle: " + ex.Message));
return;
}
try
{
iwanabethomas = Bundle.LoadAsset<AudioClip>("Assets/thomasMP3.mp3");
thomasHead = Bundle.LoadAsset<GameObject>("Assets/Prefabs/ThomasParent.prefab");
}
catch (Exception ex2)
{
Logging.LogError((object)("Error extracting asset from bundle after bundle load: " + ex2.Message));
return;
}
Logging.LogMessage((object)"Succcessfully loaded spooky thomas assets");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SpookyThomas";
public const string PLUGIN_NAME = "SpookyThomas";
public const string PLUGIN_VERSION = "1.0.3";
}
}