Decompiled source of CupuycMod v1.0.0

CupuycMod.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Extensions;
using ModdingUtils.Utils;
using Photon.Pun;
using UnboundLib.Cards;
using UnboundLib.GameModes;
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 A_AmmoGain : MonoBehaviour
{
	public void AddAmmo()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		GunAmmo val = new GunAmmo();
		GunAmmoStatModifier val2 = new GunAmmoStatModifier();
		val2.currentAmmo_delta += 3;
		val2.ApplyGunAmmoStatModifier(val);
	}
}
public class A_CoolMushroom : MonoBehaviour
{
	private Random rnd = new Random();

	private Player owner;

	private float[] mults;

	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()
	{
		if (owner.data.view.IsMine)
		{
			owner.data.maxHealth = rnd.Next(1, 201) / 100;
			owner.data.stats.movementSpeed = 1f * mults[rnd.Next(4, 13)];
			owner.data.jumps = 1 + rnd.Next(0, 5);
			owner.data.weaponHandler.gun.damage = rnd.Next(1, 201) / 100;
			owner.data.block.cooldown = 4f * mults[rnd.Next(4, 13)];
			owner.data.weaponHandler.gun.attackSpeed = 0.3f * mults[rnd.Next(0, 18)];
			owner.data.weaponHandler.gun.projectileSpeed = 1f * mults[rnd.Next(4, 13)];
			owner.data.weaponHandler.gun.reloadTime = 2f * mults[rnd.Next(0, 18)];
		}
		yield break;
	}

	public void OnDestroy()
	{
		GameModeManager.RemoveHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)([CompilerGenerated] (IGameModeHandler _) => Trigger()));
	}

	public A_CoolMushroom()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		Single[] array = new Single[18];
		RuntimeHelpers.InitializeArray((Array)(object)array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
		mults = (float[])(object)array;
		((MonoBehaviour)this)..ctor();
	}
}
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, BestModFromCupuyc.modInitials, current.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
			}
		}
		finally
		{
			((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
		Enumerator<GameObject> enumerator2 = HiddenCards.GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				GameObject current2 = enumerator2.Current;
				CustomCard.RegisterUnityCard(current2, BestModFromCupuyc.modInitials, current2.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
				Cards.instance.AddHiddenCard(current2.GetComponent<CardInfo>());
			}
		}
		finally
		{
			((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose();
		}
	}
}
public class DeathTrigger : Player
{
	public UnityEvent triggerEvent;

	private bool isDead = false;

	public void Start()
	{
		isDead = false;
	}

	public void Update()
	{
		//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)
		Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				Player current = enumerator.Current;
				if (!current.data.isPlaying && !isDead)
				{
					isDead = true;
					triggerEvent.Invoke();
				}
			}
		}
		finally
		{
			((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
	}
}
public class Force_reload : WeaponHandler
{
	private Player owner;

	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()
	{
		Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				Player player = enumerator.Current;
				if (player.teamID != owner.teamID)
				{
					((Component)base.gun).GetComponentInChildren<GunAmmo>().ReloadAmmo(true);
				}
			}
		}
		finally
		{
			((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
		yield break;
	}
}
public class JumpShoot : MonoBehaviour
{
	private Player owner;

	public void Start()
	{
		owner = ((Component)this).GetComponentInParent<Player>();
	}

	public void Update()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		if (!owner.data.view.IsMine)
		{
			return;
		}
		Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				Player current = enumerator.Current;
				if (current.teamID != owner.teamID && !owner.data.isGrounded && owner.data.currentJumps != owner.data.jumps && Math.Abs(owner.data.groundPos.x - current.data.groundPos.x) < 2f && current.data.groundPos.y < owner.data.groundPos.y)
				{
					((Damagable)current.data.healthHandler).CallTakeDamage(Vector2.down * 0.2f, Vector2.op_Implicit(((Component)owner).transform.position), (GameObject)null, owner, true);
				}
			}
		}
		finally
		{
			((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("rounds.unbound.plugin.bestmodfromcupuyc", "Best mod from Cupuyc", "0.0.1")]
[BepInProcess("Rounds.exe")]
public class BestModFromCupuyc : BaseUnityPlugin
{
	internal static string modInitials = "BMFC";

	internal static AssetBundle assets;

	private void Awake()
	{
		assets = AssetUtils.LoadAssetBundleFromResources("assets", typeof(BestModFromCupuyc).Assembly);
	}

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

	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()
	{
		if (owner.data.view.IsMine)
		{
			owner.data.weaponHandler.gun.dontAllowAutoFire = true;
			owner.data.weaponHandler.gun.ammo = 1;
			owner.data.weaponHandler.gun.projectileSpeed = 1f;
			owner.data.weaponHandler.gun.destroyBulletAfter = 0.15f;
			owner.data.weaponHandler.gun.reflects = 0;
			owner.data.weaponHandler.gun.cos = 0f;
			owner.data.weaponHandler.gun.spread = 0f;
			owner.data.weaponHandler.gun.projectileColor = GetPlayerColor.GetColorMin(owner);
		}
		yield break;
	}

	public void OnDestroy()
	{
		GameModeManager.RemoveHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)([CompilerGenerated] (IGameModeHandler _) => Trigger()));
	}
}
public class RockBottom : MonoBehaviour
{
	private Player owner;

	private float hp;

	private float dmg;

	private float spd;

	private float bcd;

	private float atkspd;

	private float bspd;

	private float rld;

	public void Start()
	{
		owner = ((Component)this).GetComponentInParent<Player>();
		hp = owner.data.stats.health;
		spd = owner.data.stats.movementSpeed;
		bcd = owner.data.block.cooldown;
		atkspd = owner.data.weaponHandler.gun.attackSpeed;
		dmg = owner.data.weaponHandler.gun.damage;
		bspd = owner.data.weaponHandler.gun.projectileSpeed;
		rld = owner.data.weaponHandler.gun.reloadTime;
	}

	public void Update()
	{
		if (hp > owner.data.stats.health)
		{
			owner.data.stats.health = hp;
		}
		if (spd > owner.data.stats.movementSpeed)
		{
			owner.data.stats.movementSpeed = spd;
		}
		if (bcd < owner.data.block.cooldown)
		{
			owner.data.block.cooldown = bcd;
		}
		if (atkspd < owner.data.weaponHandler.gun.attackSpeed)
		{
			owner.data.weaponHandler.gun.attackSpeed = atkspd;
		}
		if (dmg > owner.data.weaponHandler.gun.damage)
		{
			owner.data.weaponHandler.gun.damage = dmg;
		}
		if (bspd > owner.data.weaponHandler.gun.projectileSpeed)
		{
			owner.data.weaponHandler.gun.projectileSpeed = bspd;
		}
		if (rld > owner.data.weaponHandler.gun.reloadTime)
		{
			owner.data.weaponHandler.gun.reloadTime = rld;
		}
	}
}
public class Scaling_bursts : MonoBehaviour
{
	private Player owner;

	private Random rnd = new Random();

	private int bursts_counter = 1;

	public void Start()
	{
		owner = ((Component)this).GetComponentInParent<Player>();
	}

	public void Update()
	{
		bursts_counter = rnd.Next(1, 4);
		owner.data.weaponHandler.gun.bursts = bursts_counter;
	}
}
public class Schrödinger_cat : MonoBehaviour
{
	private Player owner;

	private float hp_1;

	private float hp_2;

	private int curr_hp = 1;

	private float previous_hp;

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

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator RoundBegin()
	{
		previous_hp = owner.data.maxHealth;
		hp_1 = owner.data.maxHealth;
		hp_2 = owner.data.maxHealth;
		yield break;
	}

	public void Update()
	{
		if (owner.data.health != previous_hp)
		{
			if (curr_hp == 1)
			{
				hp_1 = owner.data.health;
				owner.data.health = hp_2;
				curr_hp = 2;
			}
			else
			{
				hp_2 = owner.data.health;
				owner.data.health = hp_1;
				curr_hp = 1;
			}
		}
		previous_hp = owner.data.health;
	}
}
public class ShareWizFriends : MonoBehaviour
{
	private Player owner;

	public void Start()
	{
		owner = ((Component)this).GetComponentInParent<Player>();
	}

	public void Update()
	{
		Trigger();
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator Trigger()
	{
		Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				Player player = enumerator.Current;
				if ((Object)(object)player != (Object)(object)owner)
				{
					player.data.health = (owner.data.maxHealth - owner.data.health) * 0.2f;
				}
			}
		}
		finally
		{
			((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
		yield break;
	}
}
public class SpawnRandomObject : MonoBehaviour
{
	public enum SpawnRot : Enum
	{
		Identity,
		TransformRotation
	}

	private Random rnd = new Random();

	public GameObject[] objectToSpawn;

	public SpawnRot spawnRot;

	public bool inheritScale;

	private PhotonView view;

	public bool destroyObject;

	public bool destroyRoot;

	public GameObject mostRecentlySpawnedObject;

	public Action<GameObject> SpawnedAction;

	public void RandomClip()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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)
		int num = rnd.Next(0, Enumerable.Count<GameObject>((IEnumerable<GameObject>)(object)objectToSpawn) + 1);
		Quaternion val = Quaternion.identity;
		if (spawnRot == SpawnRot.TransformRotation)
		{
			val = ((Component)this).transform.rotation;
		}
		GameObject go = Object.Instantiate<GameObject>(objectToSpawn[num], ((Component)this).transform.position, val);
		ConfigureObject(go);
		mostRecentlySpawnedObject = go;
		if (destroyObject)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		if (destroyRoot)
		{
			Object.Destroy((Object)(object)((Component)((Component)this).transform.root).gameObject);
		}
	}

	private void ConfigureObject(GameObject go)
	{
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		SpawnedAttack val = go.GetComponent<SpawnedAttack>();
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = go.AddComponent<SpawnedAttack>();
		}
		val.spawner = ((Component)((Component)this).transform.root).GetComponent<Player>();
		if (!Object.op_Implicit((Object)(object)val.spawner))
		{
			SpawnedAttack componentInParent = ((Component)((Component)this).transform).GetComponentInParent<SpawnedAttack>();
			if (Object.op_Implicit((Object)(object)componentInParent))
			{
				componentInParent.CopySpawnedAttackTo(go);
			}
		}
		AttackLevel componentInParent2 = ((Component)this).GetComponentInParent<AttackLevel>();
		if (Object.op_Implicit((Object)(object)componentInParent2))
		{
			val.attackLevel = componentInParent2.attackLevel;
		}
		if (inheritScale)
		{
			Transform transform = go.transform;
			transform.localScale *= ((Component)this).transform.localScale.x;
		}
		if (SpawnedAction != null)
		{
			SpawnedAction.Invoke(go);
		}
	}
}
public class SSB : Explosion
{
	private Player owner;

	public void Start()
	{
		owner = ((Component)this).GetComponentInParent<Player>();
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator knockback()
	{
		Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				Player player = enumerator.Current;
				float knockback = 0f;
				if (player.data.health < player.data.maxHealth)
				{
					knockback = 2f * player.data.health / player.data.maxHealth;
				}
				knockback += 5f;
				player.data.weaponHandler.gun.knockback = knockback;
			}
		}
		finally
		{
			((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
		yield break;
	}

	public void Update()
	{
		knockback();
	}
}