Decompiled source of AleatoriedadesCompany v0.1.6

AleatoriedadesCompany.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using LCSoundTool;
using LethalLib.Modules;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AleatoriedadesCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AleatoriedadesCompany")]
[assembly: AssemblyTitle("AleatoriedadesCompany")]
[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;
		}
	}
}
public class BansheegoItem : PhysicsProp
{
	private Animator animator;

	private AudioClip[] grabSounds_Player;

	private AudioClip[] grabSounds_Enemy;

	private AudioClip[] dropSounds;

	private AudioClip[] aloneSounds;

	private float elapsedTime;

	private bool onTheGround = true;

	private float delayBetweenRandomSounds = 20f;

	private AudioSource AS;

	private float yPos;

	private bool grabbedByEnemy;

	private const string modFolder = "fepoe-AleatoriedadesCompany";

	private void Awake()
	{
		AS = ((Component)this).GetComponent<AudioSource>();
		animator = ((Component)this).GetComponent<Animator>();
		dropSounds = (AudioClip[])(object)new AudioClip[4]
		{
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_Ahnn.mp3"),
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_NaoMeDeixa_1.mp3"),
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_NaoMeDeixa_2.mp3"),
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_NaoMeDeixa_3.mp3")
		};
		aloneSounds = (AudioClip[])(object)new AudioClip[3]
		{
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_Ahnn.mp3"),
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_AlguemAe_1.mp3"),
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_AlguemAe_2.mp3")
		};
		grabSounds_Player = (AudioClip[])(object)new AudioClip[1] { SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_Oii.mp3") };
		grabSounds_Enemy = (AudioClip[])(object)new AudioClip[3]
		{
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_MeSalva_1.mp3"),
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_MeSalva_2.mp3"),
			SoundTool.GetAudioClip("fepoe-AleatoriedadesCompany", "Audios", "Bansheego_MeSalva_3.mp3")
		};
	}

	private void FixedUpdate()
	{
		if (onTheGround)
		{
			elapsedTime += Time.deltaTime;
			float num = elapsedTime / delayBetweenRandomSounds;
			if (num >= 1f)
			{
				SendRandomAloneSound();
				elapsedTime = 0f;
			}
		}
	}

	private void SendRandomAloneSound()
	{
		int num = Random.Range(0, aloneSounds.Length);
		AS.PlayOneShot(aloneSounds[num], 1f);
	}

	public override void DiscardItem()
	{
		int num = Random.Range(0, dropSounds.Length);
		((GrabbableObject)this).itemProperties.dropSFX = dropSounds[num];
		((GrabbableObject)this).DiscardItem();
		animator.Play("OnGround");
		elapsedTime = 0f;
		onTheGround = true;
		grabbedByEnemy = false;
	}

	public override void GrabItem()
	{
		int num = Random.Range(0, grabSounds_Player.Length);
		((GrabbableObject)this).itemProperties.grabSFX = grabSounds_Player[num];
		((GrabbableObject)this).GrabItem();
		animator.Play("BeingHeld");
		onTheGround = false;
	}
}
namespace AleatoriedadesCompany
{
	[BepInPlugin("Fepoe.AleatoriedadesCompany", "AleatoriedadesCompany", "0.1.5")]
	public class AleatoriedadesCompanyBase : BaseUnityPlugin
	{
		private const string modGUID = "Fepoe.AleatoriedadesCompany";

		private const string modName = "AleatoriedadesCompany";

		private const string modVersion = "0.1.5";

		public static AleatoriedadesCompanyBase Instance;

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null)
			{
				Instance = this;
			}
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Aleatoriedadescompany");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/AleatoriedadesCompany/Bansheego/BansheegoItem.asset");
			BansheegoItem bansheegoItem = val2.spawnPrefab.AddComponent<BansheegoItem>();
			((GrabbableObject)bansheegoItem).grabbable = true;
			((GrabbableObject)bansheegoItem).grabbableToEnemies = true;
			((GrabbableObject)bansheegoItem).itemProperties = val2;
			((GrabbableObject)bansheegoItem).scrapValue = 70;
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, 40, (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched AleatoriedadesCompany");
		}
	}
}