Decompiled source of EzuMod v1.0.0

ezumod.dll

Decompiled 2 years ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using LethalLib.Modules;
using LethalThings.MonoBehaviours;
using Microsoft.CodeAnalysis;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ezumod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ezumod")]
[assembly: AssemblyTitle("ezumod")]
[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 ezumod
{
	public class grabobj_monsterenergy : GremlinEnergy
	{
		public IEnumerator undoAnimation()
		{
			yield return (object)new WaitForSeconds(3f);
			if (((NetworkBehaviour)this).IsOwner)
			{
				float originalSpeed = 0f;
				((GrabbableObject)this).playerHeldBy.DamagePlayer(50, true, true, (CauseOfDeath)0, 1, false, default(Vector3));
				if (!((GrabbableObject)this).playerHeldBy.isPlayerDead)
				{
					originalSpeed = ((GrabbableObject)this).playerHeldBy.movementSpeed;
					((GrabbableObject)this).playerHeldBy.movementSpeed = ((GrabbableObject)this).playerHeldBy.movementSpeed * 1.5f;
				}
				((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false);
				((GrabbableObject)this).playerHeldBy.activatingItem = false;
				if (originalSpeed != 0f)
				{
					yield return (object)new WaitForSeconds(30f);
					((GrabbableObject)this).playerHeldBy.movementSpeed = originalSpeed;
				}
			}
		}
	}
	internal class grabobj_timegear
	{
	}
	public class grabobj_warporb : GrabbableObject
	{
		public AudioSource audioSource;

		public AudioClip[] sfx;

		[Space(3f)]
		public float noiseRange;

		public Animator triggerAnimator;

		public bool isCleanable;

		private bool activated = false;

		private int itemSlot = 0;

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (base.isInFactory && !triggerAnimator.GetBool("active"))
			{
				triggerAnimator.SetBool("active", true);
			}
			else if (!base.isInFactory && triggerAnimator.GetBool("active"))
			{
				triggerAnimator.SetBool("active", false);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!buttonDown || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || base.isBeingUsed)
			{
				return;
			}
			if (base.playerHeldBy.isInsideFactory)
			{
				base.isBeingUsed = true;
				audioSource.PlayOneShot(sfx[1]);
				if ((Object)(object)triggerAnimator != (Object)null)
				{
					triggerAnimator.SetTrigger("playAnim");
					playAnimationServerRpc("playAnim");
				}
				WalkieTalkie.TransmitOneShotAudio(audioSource, sfx[1], 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				playNoiseServerRpc(1);
				itemSlot = base.playerHeldBy.currentItemSlot;
				((MonoBehaviour)this).StartCoroutine(warpPlayer());
			}
			else
			{
				audioSource.PlayOneShot(sfx[0]);
				WalkieTalkie.TransmitOneShotAudio(audioSource, sfx[0], 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 8f, 0.5f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				playNoiseServerRpc(0);
			}
		}

		public IEnumerator warpPlayer()
		{
			yield return (object)new WaitForSeconds(1f);
			Vector3 position3 = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
			if (base.isHeld)
			{
				base.playerHeldBy.TeleportPlayer(position3, false, 0f, false, true);
				base.playerHeldBy.DestroyItemInSlotAndSync(itemSlot);
			}
			base.isBeingUsed = false;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			triggerAnimator.ResetTrigger("playAnim");
			base.isBeingUsed = false;
		}

		[ServerRpc]
		public void playAnimationServerRpc(string trigger)
		{
			playAnimationClientRpc(trigger);
		}

		[ClientRpc]
		public void playAnimationClientRpc(string trigger)
		{
			playAnimation(trigger);
		}

		private void playAnimation(string trigger)
		{
			if (!((NetworkBehaviour)this).IsOwner)
			{
				triggerAnimator.SetTrigger(trigger);
				triggerAnimator.ResetTrigger(trigger);
			}
		}

		[ServerRpc]
		public void playNoiseServerRpc(int soundID)
		{
			playNoiseClientRpc(soundID);
		}

		[ClientRpc]
		public void playNoiseClientRpc(int soundID)
		{
			playNoise(soundID);
		}

		private void playNoise(int soundID)
		{
			if (!((NetworkBehaviour)this).IsOwner)
			{
				audioSource.PlayOneShot(sfx[soundID]);
			}
			WalkieTalkie.TransmitOneShotAudio(audioSource, sfx[soundID], 1f);
		}
	}
	[BepInPlugin("ezuvista.ezumod", "EzuMod", "0.0.1")]
	internal class Plugin : BaseUnityPlugin
	{
		private const string GUID = "ezuvista.ezumod";

		private const string NAME = "EzuMod";

		private const string VERSION = "0.0.1";

		public static Plugin instance;

		private void Awake()
		{
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ezumod");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			addItem(val.LoadAsset<Item>("Assets/EzuMod/Scrap/scorbnnuy/ScorbunnyItem.asset"), 12);
			addItem(val.LoadAsset<Item>("Assets/EzuMod/Scrap/kala/KalaItem.asset"), 9);
			addItem(val.LoadAsset<Item>("Assets/EzuMod/Scrap/thisguy/thisguyItem.asset"), 2);
			addItem(val.LoadAsset<Item>("Assets/EzuMod/Scrap/pikahu/pikahuItem.asset"), 15);
			addItem(val.LoadAsset<Item>("Assets/EzuMod/Scrap/rioluplush/rioluplushItem.asset"), 12);
			addItem(val.LoadAsset<Item>("Assets/EzuMod/Scrap/monsterenergy/monsterenergyItem.asset"), 15);
			addItem(val.LoadAsset<Item>("Assets/EzuMod/Scrap/warporb/warporbItem.asset"), 5);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded EzuMod");
		}

		private void addItem(Item item, int spawnRate)
		{
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Utilities.FixMixerGroups(item.spawnPrefab);
			Items.RegisterScrap(item, spawnRate, (LevelTypes)(-1));
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.clearPreviousText = true;
			val.displayText = "Bnnuy Plushie owo\n";
			Items.RegisterShopItem(item, 1);
		}
	}
}