Decompiled source of OwensCards v1.1.3

OwensCards.dll

Decompiled a year 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 UnboundLib.Cards;
using UnboundLib.GameModes;
using UnityEngine;

[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 CardHolder : MonoBehaviour
{
	public List<CardInfo> cards;

	public List<CardInfo> 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<CardInfo> enumerator = cards.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				CardInfo current = enumerator.Current;
				CustomCard.RegisterUnityCard(((Component)current).gameObject, Plugin.modInitials, current.cardName, true, (Action<CardInfo>)null);
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		Enumerator<CardInfo> enumerator2 = hiddenCards.GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				CardInfo current2 = enumerator2.Current;
				CustomCard.RegisterUnityCard(((Component)current2).gameObject, Plugin.modInitials, current2.cardName, false, (Action<CardInfo>)null);
				Cards.instance.AddHiddenCard(current2);
			}
		}
		finally
		{
			((IDisposable)enumerator2).Dispose();
		}
	}
}
public class Example : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <Trigger>d__3 : Object, IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Example <>4__this;

		private Enumerator<Player> <>s__1;

		private Player <player>5__2;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (<>1__state != 0)
			{
				return false;
			}
			<>1__state = -1;
			if (<>4__this.owner.data.view.IsMine)
			{
				<>s__1 = PlayerManager.instance.players.GetEnumerator();
				try
				{
					while (<>s__1.MoveNext())
					{
						<player>5__2 = <>s__1.Current;
						((Damagable)<player>5__2.data.healthHandler).CallTakeDamage(Vector2.down * (float)<>4__this.damage, Vector2.op_Implicit(((Component)<>4__this.owner).transform.position), (GameObject)null, <>4__this.owner, true);
						<player>5__2 = null;
					}
				}
				finally
				{
					((IDisposable)<>s__1).Dispose();
				}
			}
			return false;
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}
	}

	private Player owner;

	public int damage = 30;

	public void Start()
	{
		owner = ((Component)this).GetComponentInParent<Player>();
		GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)([CompilerGenerated] (IGameModeHandler _) => Trigger()));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator Trigger()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return (IEnumerator)(object)new <Trigger>d__3(0)
		{
			<>4__this = this
		};
	}

	public void OnDestroy()
	{
		GameModeManager.RemoveHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)([CompilerGenerated] (IGameModeHandler _) => Trigger()));
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("None", "OwensCards", "1.0.0")]
[BepInProcess("Rounds.exe")]
public class Plugin : BaseUnityPlugin
{
	internal static string modInitials = "OC";

	internal static AssetBundle asset;

	private void Awake()
	{
		asset = AssetUtils.LoadAssetBundleFromResources("exampleasset", typeof(Plugin).Assembly);
	}

	private void Start()
	{
		asset.LoadAsset<GameObject>("ModCards").GetComponent<CardHolder>().RegisterCards();
	}
}
public class TestBlock : MonoBehaviour
{
	private Player owner;

	public int damage = 30;

	public void Start()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: 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)
		//IL_0069: 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)
		owner = ((Component)this).GetComponentInParent<Player>();
		if (!owner.data.view.IsMine)
		{
			return;
		}
		Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				Player current = enumerator.Current;
				((Damagable)current.data.healthHandler).CallTakeDamage(Vector2.down * (float)damage, Vector2.op_Implicit(((Component)owner).transform.position), (GameObject)null, owner, true);
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
	}
}