Decompiled source of ShadeCards v0.0.5

ShadeCards.dll

Decompiled 7 hours 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 GunChargePatch.Extensions;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using Shade.Extensions;
using UnboundLib;
using UnboundLib.Cards;
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<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, MyMod.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, MyMod.modInitials, current2.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
				Cards.instance.AddHiddenCard(current2.GetComponent<CardInfo>());
			}
		}
		finally
		{
			((IDisposable)enumerator2).Dispose();
		}
	}
}
public class LaserPointer : MonoBehaviour
{
	private LineRenderer lr;

	private Player player;

	public void Awake()
	{
		player = ((Component)this).GetComponentInParent<Player>();
	}

	public void Update()
	{
		if (!player.data.view.IsMine)
		{
		}
	}

	private void OnDestroy()
	{
		Object.Destroy((Object)(object)lr);
	}
}
public class Martyrdom : MonoBehaviour
{
	private Player player;

	private void Start()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		((MonoBehaviour)this).StartCoroutine(Blow_up_after(1));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator Blow_up_after(int num_seconds = 0)
	{
		yield return new WaitForSecondsRealtime((float)num_seconds);
		((Damagable)player.data.healthHandler).CallTakeDamage(Vector2.right * 1000f, Vector2.zero, (GameObject)null, (Player)null, true);
		Debug.Log((object)"Boom");
	}
}
public class Present : MonoBehaviour
{
	private Player player;

	private Gun gun;

	private const float variableDamage = 1f;

	private void Start()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		gun = player.data.weaponHandler.gun;
		GunExtension.GenAdditionalData(gun).variableDamage = 1f;
	}

	private void OnDestroy()
	{
		GunExtension.GenAdditionalData(gun).variableDamage = 0f;
	}
}
public class Railgun : MonoBehaviour
{
	private Player player;

	private Gun gun;

	private GunAmmo gunAmmo;

	private Coroutine thereCanOnlyBeOne = null;

	internal float chargeLevel;

	internal int chargeThresh;

	internal float chargeSpeed = 0.33f;

	internal float maxCharge = 1f;

	internal float previousMaxAmmo = 0f;

	internal bool previouslyCharging = false;

	private void Start()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		gun = player.data.weaponHandler.gun;
		gunAmmo = ((Component)gun).GetComponentInChildren<GunAmmo>();
		updateChargeInfo();
	}

	private void Update()
	{
		if (Object.op_Implicit((Object)(object)player) && player.data.view.IsMine && Object.op_Implicit((Object)(object)gun) && gun.useCharge && previouslyCharging != GunExtension.GenAdditionalData(gun).charging)
		{
			previouslyCharging = GunExtension.GenAdditionalData(gun).charging;
			if (previouslyCharging)
			{
				StartCharging();
			}
			else
			{
				((MonoBehaviour)this).StopCoroutine(thereCanOnlyBeOne);
			}
		}
	}

	private void StartCharging()
	{
		if (thereCanOnlyBeOne != null)
		{
			((MonoBehaviour)this).StopCoroutine(thereCanOnlyBeOne);
		}
		if ((float)gunAmmo.maxAmmo != previousMaxAmmo)
		{
			updateChargeInfo();
		}
		float timeBetweenCharges = GunExtensions.GetAdditionalData(gun).chargeTime / GunExtensions.GetAdditionalData(gun).maxCharge;
		thereCanOnlyBeOne = ((MonoBehaviour)this).StartCoroutine(KeepCharging(timeBetweenCharges));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator KeepCharging(float timeBetweenCharges)
	{
		yield return new WaitForSeconds(timeBetweenCharges);
		chargeBullet();
	}

	private void chargeBullet()
	{
		Gun obj = gun;
		obj.ammo--;
		gunAmmo.ReDrawTotalBullets();
	}

	private void updateChargeInfo()
	{
		previousMaxAmmo = gunAmmo.maxAmmo;
		GunExtensions.GetAdditionalData(gun).maxCharge = maxCharge * previousMaxAmmo;
		GunExtensions.GetAdditionalData(gun).chargeTime = chargeSpeed * gun.attackSpeed * gun.attackSpeedMultiplier;
	}
}
public class Relativity : MonoBehaviour
{
	private Player player;

	private Gun gun;

	private const float maxDamageMult = 1.5f;

	private const float maxReloadRate = 2f;

	private const float bulletSpeedCutoff = 1f;

	private void Start()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		gun = player.data.weaponHandler.gun;
		Gun obj = gun;
		obj.ShootPojectileAction = (Action<GameObject>)(object)Delegate.Combine((Delegate)(object)obj.ShootPojectileAction, (Delegate)(object)new Action<GameObject>(ShootAction));
	}

	private void OnDestroy()
	{
		Gun obj = gun;
		obj.ShootPojectileAction = (Action<GameObject>)(object)Delegate.Remove((Delegate)(object)obj.ShootPojectileAction, (Delegate)(object)new Action<GameObject>(ShootAction));
	}

	private void ShootAction(GameObject projectile)
	{
		if (Object.op_Implicit((Object)(object)gun))
		{
			ProjectileHit component = projectile.GetComponent<ProjectileHit>();
			float num = gun.projectielSimulatonSpeed * gun.projectileSpeed;
			if (num > 1f)
			{
				component.dealDamageMultiplierr += Mathf.Min((num - 1f) * 1.5f, 1.5f);
				return;
			}
			Gun obj = gun;
			((Weapon)obj).sinceAttack = ((Weapon)obj).sinceAttack + gun.defaultCooldown / Mathf.Min((1f - num) * 2f, 2f);
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("shade.plugin.trinkets", "Shade's Trinkets", "0.0.7")]
[BepInProcess("Rounds.exe")]
public class ShadeCards : BaseUnityPlugin
{
	internal const string modID = "shade.plugin.trinkets";

	internal const string modName = "Shade's Trinkets";

	internal const string version = "0.0.7";

	internal static string modInitials = MyMod.modInitials;

	internal static AssetBundle assets = AssetUtils.LoadAssetBundleFromResources("shadecards", typeof(ShadeCards).Assembly);

	private void Start()
	{
	}

	private void Awake()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		assets.LoadAsset<GameObject>("ModCards").GetComponent<CardHolder>().RegisterCards();
		new Harmony("Shade's Trinkets").PatchAll();
	}

	private void Update()
	{
	}
}
public static class MyMod : Object
{
	public static string modInitials = "ST";
}
public class Tests : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass9_0 : Object
	{
		public Tests <>4__this;

		public IEnumerator coroutine;

		internal void <SafeStartCoroutine>b__0()
		{
			((MonoBehaviour)<>4__this.player).StartCoroutine(coroutine);
		}
	}

	private Player player;

	private CharacterStatModifiers statMods;

	private Gun gun;

	private float damage;

	private void Start()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		gun = player.data.weaponHandler.gun;
		damage = gun.damage * 2f;
		Debug.Log((object)"Debug card loaded");
		statMods = ((Component)player).GetComponent<CharacterStatModifiers>();
		CharacterStatModifiers obj = statMods;
		obj.WasDealtDamageAction = (Action<Vector2, bool>)(object)Delegate.Combine((Delegate)(object)obj.WasDealtDamageAction, (Delegate)(object)new Action<Vector2, bool>(checkIfDead));
	}

	private void OnDestroy()
	{
	}

	private void checkIfDead(Vector2 damage, bool selfDamage)
	{
		if (player.data.health < 0f)
		{
			Debug.Log((object)"took damage and died");
			return;
		}
		Debug.Log((object)"took damage but lived");
		SafeStartCoroutine(Blow_up_after());
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator Blow_up_after(float num_seconds = 0.25f)
	{
		Explosion expy = ((Component)player).gameObject.AddComponent<Explosion>();
		expy.damage = damage;
		expy.range = 3f;
		expy.dmgColor = Color.yellow;
		expy.hitPlayerAction = (Action<CharacterData, float>)(object)Delegate.Combine((Delegate)(object)expy.hitPlayerAction, (Delegate)(object)new Action<CharacterData, float>(HitPlayer));
		yield return new WaitForSecondsRealtime(num_seconds);
		expy.Explode();
		Debug.Log((object)"Boom");
	}

	private void HitPlayer(CharacterData data, float rangeMultiplier)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		SpawnedAttack componentInParent = ((Component)this).GetComponentInParent<SpawnedAttack>();
		if (componentInParent.IsMine())
		{
			HealthHandler healthHandler = data.healthHandler;
			float num = damage;
			Vector3 val = ((Component)data).transform.position - ((Component)componentInParent.spawner).transform.position;
			((Damagable)healthHandler).CallTakeDamage(Vector2.op_Implicit(num * ((Vector3)(ref val)).normalized), Vector2.op_Implicit(((Component)player).transform.position), (GameObject)null, ((Component)this).GetComponentInParent<SpawnedAttack>().spawner, true);
		}
	}

	private void SafeStartCoroutine(IEnumerator coroutine)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		<>c__DisplayClass9_0 CS$<>8__locals0 = new <>c__DisplayClass9_0();
		CS$<>8__locals0.<>4__this = this;
		CS$<>8__locals0.coroutine = coroutine;
		((MonoBehaviour)Unbound.Instance).StartCoroutine(ExecuteWhenPlayerActive((Action)delegate
		{
			((MonoBehaviour)CS$<>8__locals0.<>4__this.player).StartCoroutine(CS$<>8__locals0.coroutine);
		}));
	}

	private void SafeExecuteAction(Action action)
	{
		((MonoBehaviour)Unbound.Instance).StartCoroutine(ExecuteWhenPlayerActive(action));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator ExecuteWhenPlayerActive(Action action)
	{
		yield return new WaitUntil((Func<bool>)([CompilerGenerated] () => ((Component)player).gameObject.activeInHierarchy));
		if (action != null)
		{
			action.Invoke();
		}
	}
}