Decompiled source of LunarsDumbCards v0.2.5

LunarsDumbCards.dll

Decompiled 6 months 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 BepInEx;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using Sonigon;
using UnboundLib.Cards;
using UnityEditor;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class GroundPound : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass27_0 : Object
	{
		public int playerID;

		internal bool <RPCA_Collide>b__0(Player x)
		{
			return x.playerID == playerID;
		}
	}

	[Header("Sounds")]
	public SoundEvent soundShieldCharge;

	[Header("Settings")]
	public float damagePerLevel;

	[Header("Settings")]
	public float knockBackPerLevel;

	public float forcePerLevel;

	public float timePerLevel;

	public ParticleSystem hitPart;

	public float shake;

	public float damage;

	public float knockBack;

	public float stopForce;

	public AnimationCurve forceCurve;

	public float force;

	public float drag;

	public float time;

	private CharacterData data;

	private AttackLevel level;

	private Vector3 dir;

	private bool cancelForce;

	private List<CharacterData> hitDatas = new List<CharacterData>();

	private float blockTime;

	private void Start()
	{
		level = ((Component)this).GetComponent<AttackLevel>();
		data = ((Component)this).GetComponentInParent<CharacterData>();
		PlayerCollision component = ((Component)data).GetComponent<PlayerCollision>();
		component.collideWithPlayerAction = (Action<Vector2, Vector2, Player>)(object)Delegate.Combine((Delegate)(object)component.collideWithPlayerAction, (Delegate)(object)new Action<Vector2, Vector2, Player>(Collide));
		((Component)this).GetComponentInParent<ChildRPC>().childRPCsVector2Vector2Int.Add("ShieldChargeCollide", (Action<Vector2, Vector2, int>)RPCA_Collide);
		Block componentInParent = ((Component)this).GetComponentInParent<Block>();
		componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)(object)Delegate.Combine((Delegate)(object)componentInParent.SuperFirstBlockAction, (Delegate)(object)new Action<BlockTriggerType>(DoBlock));
	}

	private void OnDestroy()
	{
		PlayerCollision component = ((Component)data).GetComponent<PlayerCollision>();
		component.collideWithPlayerAction = (Action<Vector2, Vector2, Player>)(object)Delegate.Remove((Delegate)(object)component.collideWithPlayerAction, (Delegate)(object)new Action<Vector2, Vector2, Player>(Collide));
		((Component)this).GetComponentInParent<ChildRPC>().childRPCsVector2Vector2Int.Remove("ShieldChargeCollide");
		Block componentInParent = ((Component)this).GetComponentInParent<Block>();
		componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)(object)Delegate.Remove((Delegate)(object)componentInParent.SuperFirstBlockAction, (Delegate)(object)new Action<BlockTriggerType>(DoBlock));
	}

	private void Update()
	{
		blockTime -= TimeHandler.deltaTime;
	}

	public void DoBlock(BlockTriggerType trigger)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Invalid comparison between Unknown and I4
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if ((int)trigger != 2)
		{
			Charge(trigger);
		}
	}

	public void Charge(BlockTriggerType trigger)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StartCoroutine(DoCharge(trigger));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator DoCharge(BlockTriggerType trigger)
	{
		//IL_000e: 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)
		SoundManager.Instance.Play(soundShieldCharge, ((Component)this).transform);
		cancelForce = false;
		hitDatas.Clear();
		dir = Vector3.down;
		float usedTime = (blockTime = time + (float)level.LevelsUp() * timePerLevel);
		float num = time * 0.1f + (float)level.LevelsUp() * time * 0.15f;
		for (int i = 0; i < level.LevelsUp(); i++)
		{
			float num2 = time / (float)level.attackLevel;
			_ = time;
			num += num2;
			((MonoBehaviour)this).StartCoroutine(DelayBlock(num));
		}
		float c = 0f;
		while (c < 1f)
		{
			c += Time.fixedDeltaTime / usedTime;
			if (!cancelForce)
			{
				data.healthHandler.TakeForce(Vector2.op_Implicit(dir * forceCurve.Evaluate(c) * (force + (float)level.LevelsUp() * forcePerLevel)), (ForceMode2D)0, true, true, 0f);
			}
			data.sinceGrounded = 0f;
			yield return new WaitForFixedUpdate();
		}
		data.block.RPCA_DoBlock(false, true, (BlockTriggerType)2, default(Vector3), false);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator DelayBlock(float delay)
	{
		yield return new WaitForSeconds(delay);
		data.block.RPCA_DoBlock(false, true, (BlockTriggerType)2, default(Vector3), false);
	}

	public void RPCA_Collide(Vector2 pos, Vector2 colDir, int playerID)
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		<>c__DisplayClass27_0 CS$<>8__locals0 = new <>c__DisplayClass27_0();
		CS$<>8__locals0.playerID = playerID;
		CharacterData componentInParent = ((Component)PlayerManager.instance.players.Find((Predicate<Player>)((Player x) => x.playerID == CS$<>8__locals0.playerID))).gameObject.GetComponentInParent<CharacterData>();
		if (Object.op_Implicit((Object)(object)componentInParent))
		{
			cancelForce = true;
			((Component)hitPart).transform.rotation = Quaternion.LookRotation(dir);
			hitPart.Play();
			((Damagable)componentInParent.healthHandler).TakeDamage(Vector2.op_Implicit(dir * (damage + (float)level.LevelsUp() * damagePerLevel)), Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, data.player, true, false);
			componentInParent.healthHandler.TakeForce(Vector2.op_Implicit(dir * (knockBack + (float)level.LevelsUp() * knockBackPerLevel)), (ForceMode2D)1, false, false, 0f);
			data.healthHandler.TakeForce(Vector2.op_Implicit(-dir * knockBack), (ForceMode2D)1, false, true, 0f);
			data.healthHandler.TakeForce(Vector2.op_Implicit(-dir * stopForce), (ForceMode2D)1, true, true, 0f);
			data.block.RPCA_DoBlock(false, true, (BlockTriggerType)2, default(Vector3), false);
			GamefeelManager.GameFeel(Vector2.op_Implicit(dir * shake));
		}
	}

	public void Collide(Vector2 pos, Vector2 colDir, Player player)
	{
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		if (!data.view.IsMine || blockTime < 0f)
		{
			return;
		}
		CharacterData componentInParent = ((Component)player).gameObject.GetComponentInParent<CharacterData>();
		if (!hitDatas.Contains(componentInParent))
		{
			hitDatas.Add(componentInParent);
			if (Object.op_Implicit((Object)(object)componentInParent))
			{
				((Component)this).GetComponentInParent<ChildRPC>().CallFunction("ShieldChargeCollide", pos, colDir, player.playerID);
			}
		}
	}
}
public class RadialDetonation : MonoBehaviour
{
	public UnityEvent detionationEvent;

	public float radius;

	public Player owner;

	private bool detEnabled;

	public float detEnableTime;

	private void Start()
	{
		if (detEnableTime > 0f)
		{
			((MonoBehaviour)this).StartCoroutine(EnableDetonation());
		}
		else
		{
			detEnabled = true;
		}
	}

	private void Update()
	{
		//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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		if (detEnabled)
		{
			Player closestPlayer = PlayerManager.instance.GetClosestPlayer(Vector2.op_Implicit(((Component)this).transform.position), true);
			if (Vector2.Distance(Vector2.op_Implicit(((Component)closestPlayer).transform.position), Vector2.op_Implicit(((Component)this).transform.position)) >= radius * ((Component)this).transform.localScale.x)
			{
				detionationEvent.Invoke();
			}
		}
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator EnableDetonation()
	{
		yield return new WaitForSeconds(detEnableTime);
		RadialDetonation radialDetonation = this;
		bool flag = true;
		radialDetonation.detEnabled = true;
		yield return (object)flag;
	}

	private void OnDrawGizmos()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		Handles.DrawWireArc(((Component)this).transform.position, Vector3.forward, Vector3.up, 360f, radius);
	}
}
namespace LunarsCards
{
	public class CardHolder : MonoBehaviour
	{
		public List<GameObject> Cards;

		public List<GameObject> HiddenCards;

		internal void RegisterCards()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<GameObject> enumerator = Cards.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					GameObject current = enumerator.Current;
					CustomCard.RegisterUnityCard(current, LunarsDumbCards.modInitials, current.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			Enumerator<GameObject> enumerator2 = HiddenCards.GetEnumerator();
			try
			{
				while (enumerator2.MoveNext())
				{
					GameObject current2 = enumerator2.Current;
					CustomCard.RegisterUnityCard(current2, LunarsDumbCards.modInitials, current2.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
					Cards.instance.AddHiddenCard(current2.GetComponent<CardInfo>());
				}
			}
			finally
			{
				((IDisposable)enumerator2).Dispose();
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("lunar.rounds.dumbcards", "Lunars Dumb Cards", "0.0.1")]
	[BepInProcess("Rounds.exe")]
	public class LunarsDumbCards : BaseUnityPlugin
	{
		internal static string modInitials = "LDC";

		internal static AssetBundle assets;

		private void Awake()
		{
			assets = AssetUtils.LoadAssetBundleFromResources("lunarscards", typeof(LunarsDumbCards).Assembly);
			assets.LoadAsset<GameObject>("ModCards").GetComponent<CardHolder>().RegisterCards();
		}

		private void Start()
		{
			Debug.Log((object)"You're using Lunar's Dumb Cards! I am now changing your gender.");
		}
	}
}