Decompiled source of PlushieParty v0.1.2

plugins/com.github.moisesc112.PlushieParty.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PlushieParty.Shared;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.moisesc112.PlushieParty")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.2.0")]
[assembly: AssemblyInformationalVersion("0.1.2+3b209dcccbfd608372ef766cb7032a73bd77cf5b")]
[assembly: AssemblyProduct("com.github.moisesc112.PlushieParty")]
[assembly: AssemblyTitle("PlushieParty")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace PlushieParty
{
	[BepInPlugin("com.github.moisesc112.PlushieParty", "PlushieParty", "0.1.2")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.moisesc112.PlushieParty");

		public const string Id = "com.github.moisesc112.PlushieParty";

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "PlushieParty";

		public static string Version => "0.1.2";

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
}
namespace PlushieParty.Shared
{
	internal static class ModState
	{
		public static readonly List<Character> hitPlayers = new List<Character>();

		public static STATUSTYPE bingBongStatus = (STATUSTYPE)1;
	}
	internal static class ModUtils
	{
		[CompilerGenerated]
		private sealed class <IPlushieCooldown>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Character character;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <IPlushieCooldown>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					ModState.hitPlayers.Add(character);
					<>2__current = (object)new WaitForSeconds(4f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ModState.hitPlayers.Remove(character);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static STATUSTYPE GetBingBongAffliction()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return ModState.bingBongStatus;
		}

		public static void SetBingBongAffliction(STATUSTYPE status)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ModState.bingBongStatus = status;
		}

		[IteratorStateMachine(typeof(<IPlushieCooldown>d__2))]
		public static IEnumerator IPlushieCooldown(Character character)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <IPlushieCooldown>d__2(0)
			{
				character = character
			};
		}
	}
}
namespace PlushieParty.Patches
{
	[HarmonyPatch]
	internal static class CharacterItemsPatch
	{
		[HarmonyPatch(typeof(CharacterItems), "FixedUpdate")]
		[HarmonyPostfix]
		private static void FixedUpdatePostFix(CharacterItems __instance)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Character componentInParent = ((Component)__instance).GetComponentInParent<Character>();
			Item currentItem = componentInParent.data.currentItem;
			if (!((Object)(object)currentItem == (Object)null) && !ModState.hitPlayers.Contains(componentInParent) && (currentItem.itemTags & 0x10) != 0)
			{
				componentInParent.refs.afflictions.SubtractStatus(ModUtils.GetBingBongAffliction(), 0.025f, false);
				((MonoBehaviour)__instance).StartCoroutine(ModUtils.IPlushieCooldown(componentInParent));
			}
		}
	}
	internal static class MountainProgressHandlerPatch
	{
		[HarmonyPatch(typeof(MountainProgressHandler), "TriggerReached")]
		[HarmonyPostfix]
		private static void TriggerReachedPostFix(ProgressPoint progressPoint)
		{
			string title = progressPoint.title;
			if (title == null)
			{
				return;
			}
			switch (title.Length)
			{
			case 7:
				switch (title[0])
				{
				case 'T':
					if (title == "TROPICS")
					{
						ModUtils.SetBingBongAffliction((STATUSTYPE)3);
					}
					break;
				case 'C':
					if (title == "CALDERA")
					{
						ModUtils.SetBingBongAffliction((STATUSTYPE)2);
					}
					break;
				}
				break;
			case 4:
				switch (title[0])
				{
				case 'M':
					if (title == "MESA")
					{
						ModUtils.SetBingBongAffliction((STATUSTYPE)2);
					}
					break;
				case 'P':
					if (title == "PEAK")
					{
						ModUtils.SetBingBongAffliction((STATUSTYPE)1);
					}
					break;
				}
				break;
			case 5:
				if (title == "SHORE")
				{
					ModUtils.SetBingBongAffliction((STATUSTYPE)1);
				}
				break;
			case 6:
				if (title == "ALPINE")
				{
					ModUtils.SetBingBongAffliction((STATUSTYPE)8);
				}
				break;
			case 8:
				if (title == "THE KILN")
				{
					ModUtils.SetBingBongAffliction((STATUSTYPE)0);
				}
				break;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}