Decompiled source of PalCompany v1.0.3

plugins/PalCompany/PalCompany.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using PalCompany.Behavior;
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("PalCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PalCompany")]
[assembly: AssemblyTitle("PalCompany")]
[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 PalCompany
{
	[BepInPlugin("dawn.palpercy", "Pal Percy Mod", "1.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "dawn.palpercy";

		private const string NAME = "Pal Percy Mod";

		private const string VERSION = "1.0.3";

		public static Plugin instance;

		private void Awake()
		{
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "palpercy");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/Items/Pal Percy.asset");
			AudioClip beep = val.LoadAsset<AudioClip>("Assets/Items/ppgrr.wav");
			PalPercy palPercy = val2.spawnPrefab.AddComponent<PalPercy>();
			((GrabbableObject)palPercy).grabbable = true;
			palPercy.beep = beep;
			((GrabbableObject)palPercy).grabbableToEnemies = true;
			((GrabbableObject)palPercy).itemProperties = val2;
			((GrabbableObject)palPercy).isInFactory = true;
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, 18, (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Your best pal has been added! (Successfully loaded Pal Percy Mod)");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "PalCompany";

		public const string PLUGIN_NAME = "PalCompany";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace PalCompany.Behavior
{
	internal class PalPercy : NoisemakerProp
	{
		private float anger = 0f;

		private bool pocket = false;

		private bool angry = false;

		private bool canAngry = true;

		public AudioClip beep;

		private AudioSource audio;

		private Animator anim;

		public override void Start()
		{
			((NoisemakerProp)this).Start();
			anim = ((Component)this).GetComponent<Animator>();
			audio = ((Component)this).GetComponent<AudioSource>();
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			pocket = true;
			Debug.Log((object)"Pocketed...");
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			pocket = false;
			Debug.Log((object)"Equipped!");
		}

		public override void OnBroughtToShip()
		{
			((GrabbableObject)this).OnBroughtToShip();
			canAngry = false;
			anger = 0f;
		}

		public void FixedUpdate()
		{
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			if (pocket && canAngry)
			{
				anger = Math.Clamp(anger + 1f, 0f, 1500f);
			}
			else
			{
				anger = Math.Clamp(anger - 1f, 0f, 1500f);
			}
			if (anger >= 1200f && !angry)
			{
				angry = true;
				anim.SetBool("angry", true);
				audio.loop = true;
				audio.clip = beep;
				audio.Play();
				anger = 1300f;
				Debug.Log((object)"He Angry!!");
			}
			else if (anger < 1200f && angry)
			{
				angry = false;
				anger = 0f;
				audio.clip = beep;
				audio.Stop();
				audio.loop = false;
				anim.SetBool("angry", false);
				Debug.Log((object)"He NOT Angry!!");
			}
			if (angry)
			{
				if ((Object)(object)audio.clip != (Object)(object)beep)
				{
					audio.clip = beep;
				}
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 40f, 0.9f, 4, false, 5);
			}
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			anger += 250f;
		}
	}
}