Decompiled source of Kips Silly Stuff v2.0.4

SillyStuff.dll

Decompiled 9 months ago
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 SillyStuff.Behavior;
using Unity.Netcode;
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("SillyStuff")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SillyStuff")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d9b46a54-65ac-4f00-a727-52a2645273d4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SillyStuff
{
	[BepInPlugin("KipStuff.SillyStuff", "Kip's Silly Stuff", "2.0.4")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "KipStuff.SillyStuff";

		private const string modName = "Kip's Silly Stuff";

		private const string modVersion = "2.0.4";

		public static Plugin instance;

		private void Awake()
		{
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "KipMod");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/Items/EnderFumo/EnderFumoItem.asset");
			EnderBehavior enderBehavior = val2.spawnPrefab.AddComponent<EnderBehavior>();
			((GrabbableObject)enderBehavior).grabbable = true;
			((GrabbableObject)enderBehavior).grabbableToEnemies = true;
			((GrabbableObject)enderBehavior).itemProperties = val2;
			enderBehavior.enderBundle = val;
			enderBehavior.enderAudio = val2.spawnPrefab.GetComponent<AudioSource>();
			enderBehavior.enderAudio.maxDistance = 15f;
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, 5, (LevelTypes)(-1));
			Item val3 = val.LoadAsset<Item>("Assets/Items/WardenFumo/WardenFumoItem.asset");
			WardenBehavior wardenBehavior = val3.spawnPrefab.AddComponent<WardenBehavior>();
			((GrabbableObject)wardenBehavior).grabbable = true;
			((GrabbableObject)wardenBehavior).grabbableToEnemies = true;
			((GrabbableObject)wardenBehavior).itemProperties = val3;
			wardenBehavior.wardenBundle = val;
			wardenBehavior.wardenAudio = val3.spawnPrefab.GetComponent<AudioSource>();
			wardenBehavior.wardenAudio.maxDistance = 15f;
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			Utilities.FixMixerGroups(val3.spawnPrefab);
			Items.RegisterScrap(val3, 5, (LevelTypes)(-1));
			Item val4 = val.LoadAsset<Item>("Assets/Items/ArtiFumo/ArtiFumoItem.asset");
			ArtiBehavior artiBehavior = val4.spawnPrefab.AddComponent<ArtiBehavior>();
			((GrabbableObject)artiBehavior).grabbable = true;
			((GrabbableObject)artiBehavior).grabbableToEnemies = true;
			((GrabbableObject)artiBehavior).itemProperties = val4;
			artiBehavior.artiBundle = val;
			artiBehavior.artiAudio = val4.spawnPrefab.GetComponent<AudioSource>();
			artiBehavior.artiAudio.maxDistance = 15f;
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			Utilities.FixMixerGroups(val4.spawnPrefab);
			Items.RegisterScrap(val4, 5, (LevelTypes)(-1));
		}
	}
}
namespace SillyStuff.Behavior
{
	internal class ArtiBehavior : PhysicsProp
	{
		public AssetBundle artiBundle;

		public AudioSource artiAudio;

		public Ray grenadeThrowRay;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			((GrabbableObject)this).useCooldown = 0.5f;
			if (buttonDown)
			{
				artiAudio.Stop();
				artiAudio.PlayOneShot(artiBundle.LoadAsset<AudioClip>("Assets/Items/ArtiFumo/laugh-track.wav"));
			}
		}

		private void Throw()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetGrenadeThrowDestination(), true);
		}

		public Vector3 GetGrenadeThrowDestination()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			grenadeThrowRay = new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward);
			grenadeThrowRay = new Ray(position, Vector3.down);
			return ((Ray)(ref grenadeThrowRay)).GetPoint(30f);
		}
	}
	internal class EnderBehavior : PhysicsProp
	{
		public AssetBundle enderBundle;

		public AudioSource enderAudio;

		private int enderAudioNum;

		[ServerRpc(RequireOwnership = false)]
		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			((GrabbableObject)this).useCooldown = 0.7f;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || !buttonDown)
			{
				return;
			}
			enderAudioNum = Random.Range(0, 4);
			if (enderAudioNum == 0)
			{
				enderAudio.Stop();
				enderAudio.PlayOneShot(enderBundle.LoadAsset<AudioClip>("Assets/Items/EnderFumo/whos_cooking.wav"));
			}
			if (enderAudioNum == 1)
			{
				enderAudio.Stop();
				enderAudio.PlayOneShot(enderBundle.LoadAsset<AudioClip>("Assets/Items/EnderFumo/-24.wav"));
			}
			if (enderAudioNum == 2)
			{
				enderAudio.Stop();
				enderAudio.PlayOneShot(enderBundle.LoadAsset<AudioClip>("Assets/Items/EnderFumo/inverse.wav"));
			}
			if (enderAudioNum == 3)
			{
				enderAudioNum = Random.Range(0, 4);
				if (enderAudioNum != 3)
				{
					enderAudio.Stop();
					enderAudio.PlayOneShot(enderBundle.LoadAsset<AudioClip>("Assets/Items/EnderFumo/whos_cooking.wav"));
				}
				else
				{
					enderAudio.Stop();
					enderAudio.PlayOneShot(enderBundle.LoadAsset<AudioClip>("Assets/Items/EnderFumo/fuck_you.wav"));
					((MonoBehaviour)this).Invoke("Explode", 0.5f);
				}
			}
		}

		private void Explode()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, ((Component)this).transform.position, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true);
			Vector3 val = (((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position - ((Component)this).transform.position) * 80f / Vector3.Distance(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)this).transform.position);
			((GrabbableObject)this).playerHeldBy.KillPlayer(val, true, (CauseOfDeath)3, 0);
		}
	}
	internal class WardenBehavior : PhysicsProp
	{
		public AssetBundle wardenBundle;

		public AudioSource wardenAudio;

		public int wardenAudioNum;

		private bool grabbed = false;

		private bool thanked = false;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			((GrabbableObject)this).useCooldown = 0.5f;
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && buttonDown)
			{
				wardenAudioNum = Random.Range(0, 6);
				if (wardenAudioNum == 0)
				{
					wardenAudio.Stop();
					wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/acess_denied.wav");
					wardenAudio.Play();
				}
				if (wardenAudioNum == 1)
				{
					wardenAudio.Stop();
					wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/beep_beep.wav");
					wardenAudio.Play();
				}
				if (wardenAudioNum == 2)
				{
					wardenAudio.Stop();
					wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/ha_ha.wav");
					wardenAudio.Play();
				}
				if (wardenAudioNum == 3)
				{
					wardenAudio.Stop();
					wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/ho_ho_ho.wav");
					wardenAudio.Play();
				}
				if (wardenAudioNum == 4)
				{
					wardenAudio.Stop();
					wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/this_happening.wav");
					wardenAudio.Play();
				}
				if (wardenAudioNum == 5)
				{
					wardenAudio.Stop();
					wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/we_champion.wav");
					wardenAudio.Play();
				}
			}
		}

		public override void OnBroughtToShip()
		{
			((GrabbableObject)this).OnBroughtToShip();
			if (!thanked)
			{
				thanked = true;
				wardenAudio.Stop();
				wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/thanks.wav");
				wardenAudio.Play();
			}
		}

		public override void GrabItem()
		{
			grabbed = true;
			((GrabbableObject)this).GrabItem();
			wardenAudio.Stop();
			wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/joining_you.wav");
			wardenAudio.Play();
		}

		public override void Update()
		{
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				if (!grabbed)
				{
					wardenAudio.maxDistance = 25f;
					int num = Random.Range(0, 2000);
					if (num == 1)
					{
						wardenAudio.Stop();
						wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/michael_leave.wav");
						wardenAudio.Play();
					}
				}
				else
				{
					wardenAudio.maxDistance = 15f;
				}
			}
			((GrabbableObject)this).Update();
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			wardenAudio.Stop();
			wardenAudio.clip = wardenBundle.LoadAsset<AudioClip>("Assets/Items/WardenFumo/goodbye.wav");
			wardenAudio.Play();
		}

		private void Explode()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, ((Component)this).transform.position, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true);
			Vector3 val = (((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position - ((Component)this).transform.position) * 80f / Vector3.Distance(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)this).transform.position);
			((GrabbableObject)this).playerHeldBy.KillPlayer(val, true, (CauseOfDeath)3, 0);
		}
	}
}