Decompiled source of OneBiggon v1.0.1

OneBiggon.dll

Decompiled 7 months ago
using System;
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 BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("UnluckyCrafterModDev")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UnluckyCrafterModDev")]
[assembly: AssemblyTitle("UnluckyCrafterModDev")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BoplBattleTemplate
{
	[BepInPlugin("com.unluckycrafter.onebiggon", "OneBiggon", "1.0.1")]
	[BepInProcess("BoplBattle.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string pluginGuid = "com.unluckycrafter.onebiggon";

		public static int biggonId = 0;

		public static int oldPlayerCount = -10;

		public static SlimeController[] curSc;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin UnluckyCrafterModDev is loaded!");
			Harmony val = new Harmony("com.unluckycrafter.onebiggon");
			MethodInfo methodInfo = AccessTools.Method(typeof(GameSessionHandler), "SpawnPlayers", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Plugin), "SpawnPlayers_p", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(Ability), "Awake", (Type[])null, (Type[])null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(Plugin), "LessCooldown", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void ScaleBiggon()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = PlayerHandler.Get().PlayerList();
			list[biggonId].Scale = (Fix)3L;
		}

		public static void TransferBiggon(int idOfKiller, long timestamp, CauseOfDeath causeOfDeath)
		{
			if (idOfKiller >= -1 && 4 >= idOfKiller)
			{
				biggonId = idOfKiller;
				commitBiggon();
			}
		}

		public static void LessCooldown(ref Ability __instance, ref Fix ___Cooldown)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.GetPlayerInfo().playerId == biggonId)
			{
				___Cooldown /= (Fix)2L;
			}
		}

		public static void commitBiggon()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			int num = biggonId;
			SlimeController[] array = curSc;
			List<Player> list = PlayerHandler.Get().PlayerList();
			SlimeController[] array2 = array;
			foreach (SlimeController val in array2)
			{
				val.GetActivePlayerCollision().isSquishable = true;
			}
			list[num].Scale = (Fix)3L;
			array[num].GetActivePlayerCollision().isSquishable = false;
			if (!list[num].IsLocalPlayer)
			{
				AbilityReadyIndicator[] abilityReadyIndicators = array[num].AbilityReadyIndicators;
				foreach (AbilityReadyIndicator val2 in abilityReadyIndicators)
				{
					val2.SetSprite(array[num].abilityIconsFull.GetSprite(1), false);
				}
			}
		}

		public static void SpawnPlayers_p(ref SlimeController[] ___slimeControllers)
		{
			List<Player> list = PlayerHandler.Get().PlayerList();
			if (oldPlayerCount != list.Count)
			{
				biggonId = 0;
				oldPlayerCount = list.Count;
			}
			biggonId++;
			biggonId %= list.Count;
			curSc = ___slimeControllers;
			commitBiggon();
		}

		public static bool temp_p()
		{
			return true;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "UnluckyCrafterModDev";

		public const string PLUGIN_NAME = "UnluckyCrafterModDev";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}