Decompiled source of AbilityStorm v1.4.0

AbilityStorm.dll

Decompiled 7 months ago
using System;
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;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("BoplBattleTemplate")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BoplBattleTemplate")]
[assembly: AssemblyTitle("BoplBattleTemplate")]
[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.abilitystorm", "Ability Storm", "1.3.0")]
	[BepInProcess("BoplBattle.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string pluginGuid = "com.unluckycrafter.abilitystorm";

		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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0090: 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 BoplBattleTemplate is loaded!");
			Harmony val = new Harmony("com.unluckycrafter.abilitystorm");
			MethodInfo methodInfo = AccessTools.Method(typeof(AbilitySpawner), "UpdateSim", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Plugin), "UpdateSim_p", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(SlimeController), "AddAdditionalAbility", (Type[])null, (Type[])null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(Plugin), "AddAdditionalAbility_p", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static bool AddAdditionalAbility_p(AbilityMonoBehaviour ability, Sprite indicatorSprite, GameObject abilityPrefab, ref SlimeController __instance, ref Fix[] ___abilityCooldownTimers)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.abilities.Count == 3)
			{
				int num = Updater.RandomInt(0, 2);
				__instance.abilities[num] = ability;
				PlayerHandler.Get().GetPlayer(__instance.playerNumber).CurrentAbilities[2] = abilityPrefab;
				__instance.AbilityReadyIndicators[num].SetSprite(indicatorSprite, true);
				__instance.AbilityReadyIndicators[num].ResetAnimation();
				___abilityCooldownTimers[num] = (Fix)100000L;
			}
			else if (__instance.abilities.Count > 0 && (Object)(object)__instance.AbilityReadyIndicators[0] != (Object)null)
			{
				__instance.abilities.Add(ability);
				PlayerHandler.Get().GetPlayer(__instance.playerNumber).CurrentAbilities.Add(abilityPrefab);
				__instance.AbilityReadyIndicators[__instance.abilities.Count - 1].SetSprite(indicatorSprite, true);
				__instance.AbilityReadyIndicators[__instance.abilities.Count - 1].ResetAnimation();
				___abilityCooldownTimers[__instance.abilities.Count - 1] = (Fix)100000L;
				for (int i = 0; i < __instance.abilities.Count; i++)
				{
					if ((Object)(object)__instance.abilities[i] == (Object)null || ((MonoUpdatable)__instance.abilities[i]).IsDestroyed)
					{
						return false;
					}
					((Component)__instance.AbilityReadyIndicators[i]).gameObject.SetActive(true);
					__instance.AbilityReadyIndicators[i].InstantlySyncTransform();
				}
			}
			AudioManager.Get().Play("abilityPickup");
			return false;
		}

		public static bool UpdateSim_p(Fix simDeltaTime, ref Fix ___time, ref Fix ___SpawnDelay, ref int ___spawns, ref int ___MaxSpawns, ref AbilitySpawner __instance, ref FixTransform ___fixTrans)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			___time += (GameTime.IsTimeStopped() ? Fix.Zero : simDeltaTime);
			if (___time > (Fix)1L)
			{
				___time = Fix.Zero;
				Vec2 position = ___fixTrans.position;
				ref Fix x = ref position.x;
				x += Updater.RandomFix((Fix)(-50L), (Fix)50L);
				ref Fix y = ref position.y;
				y += Updater.RandomFix((Fix)(-50L), (Fix)50L);
				DynamicAbilityPickup val = FixTransform.InstantiateFixed<DynamicAbilityPickup>(__instance.pickupPrefab, position);
				val.InitPickup((GameObject)null, (Sprite)null, Updater.RandomUnitVector());
				val.SwapToRandomAbility();
			}
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BoplBattleTemplate";

		public const string PLUGIN_NAME = "BoplBattleTemplate";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}