using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using LethalLib.Modules;
using LethalUIIAmod.Behaviors;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LethalUIIAmod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalUIIAcat")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("97aae1ef-8b14-4aad-a467-877c269c77c8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.Snow.OIIAcat", "Lethal UIIA Cat", "1.0.0")]
public class UIIAscrap : BaseUnityPlugin
{
public static UIIAscrap instance;
private void Awake()
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
instance = this;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "uiia_cat");
AssetBundle val = AssetBundle.LoadFromFile(text);
string text2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "audiobundle");
AssetBundle val2 = AssetBundle.LoadFromFile(text2);
Item val3 = val.LoadAsset<Item>("Assets/- UIIAcat/UIIA_Item.asset");
UIIABehavior uIIABehavior = val3.spawnPrefab.AddComponent<UIIABehavior>();
val3.rotationOffset = new Vector3(90f, 0f, -90f);
val3.positionOffset = new Vector3(0f, 0.2f, -0.15f);
val3.canBeGrabbedBeforeGameStart = true;
((GrabbableObject)uIIABehavior).grabbable = true;
((GrabbableObject)uIIABehavior).grabbableToEnemies = true;
((GrabbableObject)uIIABehavior).itemProperties = val3;
uIIABehavior.ItemAudioClip[0] = val2.LoadAsset<AudioClip>("Assets/- UIIAcat/After_Dark.mp3");
uIIABehavior.ItemAudioClip[1] = val2.LoadAsset<AudioClip>("Assets/- UIIAcat/Right_Now.mp3");
uIIABehavior.ItemAudioClip[2] = val2.LoadAsset<AudioClip>("Assets/- UIIAcat/Sigma_Boy.mp3");
NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
Utilities.FixMixerGroups(val3.spawnPrefab);
Items.RegisterScrap(val3, 14, (LevelTypes)(-1));
}
}
namespace LethalUIIAmod.Behaviors;
internal class UIIABehavior : PhysicsProp
{
public Animator ItemAnimator;
public AudioSource ItemAudioSrc;
public AudioClip[] ItemAudioClip = (AudioClip[])(object)new AudioClip[3];
public float animtimer = 0f;
public float playtimer = -1f;
public int song = 0;
public bool FRESH = true;
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if ((Object)(object)ItemAnimator != (Object)null && (Object)(object)ItemAudioSrc != (Object)null && animtimer < 0.1f)
{
song = Random.Range(0, 3);
ItemAudioSrc.clip = ItemAudioClip[song];
animtimer = ItemAudioSrc.clip.length;
((Behaviour)ItemAudioSrc).enabled = true;
if (song == 0)
{
ItemAnimator.SetBool("AfterDark_M", true);
}
if (song == 1)
{
ItemAnimator.SetBool("Right_Now", true);
}
if (song == 2)
{
ItemAnimator.SetBool("Sigma_Boy", true);
}
CheckNearby();
}
if ((Object)(object)ItemAnimator != (Object)null && animtimer < 0.1f)
{
ItemAnimator.SetBool("Spinning", false);
ItemAnimator.SetBool("AfterDark_M", false);
ItemAnimator.SetBool("AfterDark_F", false);
ItemAnimator.SetBool("Sigma_Boy", false);
ItemAnimator.SetBool("Right_Now", false);
ItemAudioSrc.clip = null;
((Behaviour)ItemAudioSrc).enabled = false;
}
}
private void CheckNearby()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
RaycastHit[] array = Physics.SphereCastAll(((Component)this).transform.position, 5f, ((Component)this).transform.forward, 0f);
RaycastHit[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val = array2[i];
if (((Object)((Component)((RaycastHit)(ref val)).collider).gameObject).name == "UIIA_cat(Clone)")
{
((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<UIIABehavior>().GetCheck(song);
}
}
}
public void GetCheck(int clip)
{
if ((Object)(object)ItemAnimator != (Object)null)
{
ItemAudioSrc.clip = ItemAudioClip[clip];
animtimer = ItemAudioSrc.clip.length;
if (clip == 0)
{
ItemAnimator.SetBool("AfterDark_F", true);
}
if (clip == 1)
{
ItemAnimator.SetBool("Right_Now", true);
}
if (clip == 2)
{
ItemAnimator.SetBool("Sigma_Boy", true);
}
if (clip != 3)
{
}
}
}
public void Awake()
{
ItemAnimator = ((Component)this).gameObject.GetComponent<Animator>();
ItemAudioSrc = ((Component)this).gameObject.GetComponent<AudioSource>();
((Behaviour)ItemAudioSrc).enabled = false;
}
public override void Update()
{
((GrabbableObject)this).Update();
if (playtimer > 0f)
{
playtimer -= Time.deltaTime;
}
if ((Object)(object)ItemAudioSrc.clip != (Object)null)
{
if (animtimer > 0.1f)
{
animtimer -= Time.deltaTime;
}
if (animtimer < ItemAudioSrc.clip.length / 2f && animtimer > 0.1f)
{
ItemAnimator.SetBool("Spinning", true);
}
if (animtimer < 0.1f)
{
ItemAnimator.SetBool("Spinning", false);
ItemAnimator.SetBool("AfterDark_M", false);
ItemAnimator.SetBool("AfterDark_F", false);
ItemAnimator.SetBool("Sigma_Boy", false);
ItemAnimator.SetBool("Right_Now", false);
ItemAudioSrc.clip = null;
((Behaviour)ItemAudioSrc).enabled = false;
}
}
if (FRESH && playtimer <= 0f)
{
((GrabbableObject)this).ItemActivate(true, true);
playtimer = ItemAudioSrc.clip.length + (float)Random.Range(5, 90);
}
}
public override void GrabItem()
{
((GrabbableObject)this).GrabItem();
FRESH = false;
}
public override int GetItemDataToSave()
{
if (FRESH)
{
return 1;
}
return 0;
}
public override void LoadItemSaveData(int saveData)
{
if (saveData == 0)
{
FRESH = false;
}
else
{
FRESH = true;
}
}
}