using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreCompany.Utils;
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("Sai_Inval")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Sai_Inval")]
[assembly: AssemblyTitle("Sai_Inval")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace Sai_Inval
{
[HarmonyPatch]
internal class BugPatch
{
[HarmonyPatch(typeof(HoarderBugAI), "Start")]
[HarmonyPostfix]
public static void addController(HoarderBugAI __instance)
{
((Component)__instance).gameObject.AddComponent<CatController>();
}
}
internal class CatController : MonoBehaviour
{
private HoarderBugAI BugAI;
private Animator animator;
private bool IsDead;
private Vector3 prevPosition;
private static GameObject CatModel;
private void HideBug()
{
try
{
Renderer[] componentsInChildren = ((Component)((Component)BugAI).transform.Find("HoarderBugModel")).GetComponentsInChildren<Renderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].enabled = false;
}
}
catch (Exception)
{
for (int j = 0; j < ((Component)BugAI).transform.childCount - 1; j++)
{
}
}
}
private void ShowNewModel()
{
try
{
MeshRenderer[] componentsInChildren = CatModel.GetComponentsInChildren<MeshRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Renderer)componentsInChildren[i]).enabled = true;
}
}
catch (Exception)
{
}
}
private void Start()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
BugAI = ((Component)this).GetComponent<HoarderBugAI>();
CatModel = Object.Instantiate<GameObject>(Plugin.Cat, ((Component)BugAI).transform.position, Quaternion.identity, ((Component)BugAI).transform);
animator = CatModel.GetComponent<Animator>();
HideBug();
ShowNewModel();
}
private void Update()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
animator.SetBool("Hostile", ((EnemyAI)BugAI).movingTowardsTargetPlayer);
animator.SetBool("Moving", prevPosition != ((Component)this).transform.position);
prevPosition = ((Component)this).transform.position;
if (((EnemyAI)BugAI).isEnemyDead && !IsDead)
{
Die();
}
}
private void Die()
{
animator.SetBool("Dead", true);
IsDead = true;
}
}
[BepInPlugin("Sai.Inval", "Invalid Gateway Pack", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private static Plugin _instance;
private static Harmony _harmony;
public static ManualLogSource log;
private bool _initialized;
public static GameObject Cat;
internal static Plugin Instance
{
get
{
return _instance;
}
set
{
if ((Object)(object)_instance == (Object)null)
{
_instance = value;
}
else
{
Object.Destroy((Object)(object)value);
}
}
}
private void Awake()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
_instance = this;
if (_harmony == null)
{
_harmony = new Harmony("Sai.Inval");
}
_harmony.PatchAll(typeof(BugPatch));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Sai_Inval is loaded!");
LoadAssets();
}
private void LoadAssets()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if (executingAssembly == null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to get assembly.");
}
AssetBundle val = BundleUtilities.LoadBundleFromInternalAssembly("Sai_Inval.Bundles.cat", executingAssembly);
if ((Object)(object)val == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Where the fuck is the cat");
}
Cat = val.LoadAsset<GameObject>("Cat.prefab");
if ((Object)(object)Cat != (Object)null)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Cat Exists");
}
}
}
public static class PluginInfo
{
public const string PLUGIN_ID = "Sai_Inval";
public const string PLUGIN_NAME = "Invalid Gateway Pack";
public const string PLUGIN_VERSION = "1.0.0";
public const string PLUGIN_GUID = "Sai.Inval";
}
}