Decompiled source of BetterBoxedBullets v0.2.0

it will work eventually.dll

Decompiled 2 days 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 BetterBoxedBullets.Cards;
using HarmonyLib;
using KFC.UnessesaryAddons;
using Microsoft.CodeAnalysis;
using ModsPlus;
using Photon.Pun;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("it will work eventually")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("it will work eventually")]
[assembly: AssemblyTitle("it will work eventually")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace BetterBoxedBullets
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("joan.better.boxed.bullets", "Better Boxed Bullets", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class BetterBoxedBulletsMod : BaseUnityPlugin
	{
		private const string ModId = "joan.better.boxed.bullets";

		private const string ModName = "Better Boxed Bullets";

		public const string Version = "1.0.0";

		public const string ModInitials = "BBB";

		internal static GameObject BoxProj;

		internal static int BoxCap = 100;

		public static BetterBoxedBullets instance { get; private set; }

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("joan.better.boxed.bullets");
			val.PatchAll();
		}

		private void Start()
		{
			CustomCard.BuildCard<BetterBoxedBullets>();
			CustomCard.BuildCard<Pinball>();
			CustomCard.BuildCard<WhereWasI>();
			CustomCard.BuildCard<MadeInHeaven>();
			CustomCard.BuildCard<PerfectMovement>();
		}
	}
	public class BetterBoxedBullets : CustomEffectCard<BoxThoseBullets>
	{
		public override CardDetails<BoxThoseBullets> Details => new CardDetails<BoxThoseBullets>
		{
			Title = "Better Boxed Bullets",
			Description = "Shoot boxes at people instead of bullets--with even more boxes!",
			ModName = "BBB",
			Art = null,
			Rarity = (Rarity)2,
			Theme = (CardThemeColorType)3,
			OwnerOnly = true
		};

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.allowMultiple = false;
		}
	}
	public class Pinball : CustomEffectCard<BounceBounceBounce>
	{
		public override CardDetails<BounceBounceBounce> Details => new CardDetails<BounceBounceBounce>
		{
			Title = "Pinball Maneuver",
			Description = "Whenever touching a wall or the ground, you are launched.",
			ModName = "BBB",
			Art = null,
			Rarity = (Rarity)2,
			Theme = (CardThemeColorType)3,
			OwnerOnly = true
		};

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.allowMultiple = false;
		}
	}
	public class WhereWasI : CustomEffectCard<BeamMeUp>
	{
		public override CardDetails<BeamMeUp> Details => new CardDetails<BeamMeUp>
		{
			Title = "Where Was I?",
			Description = "After block recharges or weapon reloads, teleport to a location that you have been before in this round.",
			ModName = "BBB",
			Art = null,
			Rarity = (Rarity)2,
			Theme = (CardThemeColorType)3,
			OwnerOnly = true
		};

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.allowMultiple = false;
		}
	}
	public class MadeInHeaven : CustomEffectCard<TimePassing>
	{
		public override CardDetails<TimePassing> Details => new CardDetails<TimePassing>
		{
			Title = "Made In Heaven",
			Description = "Time continually accelerates after match start.",
			ModName = "BBB",
			Art = null,
			Rarity = (Rarity)2,
			Theme = (CardThemeColorType)3,
			OwnerOnly = true
		};

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			cardInfo.allowMultiple = false;
		}
	}
	public class BoxThoseBullets : CardEffect
	{
		public List<GameObject> Boxes = new List<GameObject>();

		private int curBox = 0;

		protected override void OnDestroy()
		{
			KillBoxes();
		}

		public override void OnShoot(GameObject projectile)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			if (Boxes.Count == 0)
			{
				SpawnBoxes();
			}
			GameObject val = Boxes[curBox];
			curBox++;
			if (curBox == BetterBoxedBulletsMod.BoxCap)
			{
				curBox = 0;
			}
			val.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
			val.transform.position = projectile.transform.position + ((Vector3)(ref ((CardEffect)this).player.data.aimDirection)).normalized * 3f;
			val.transform.rotation = Quaternion.identity;
			float num = Mathf.Sqrt(((CardEffect)this).gun.projectileSpeed);
			Vector3 normalized = ((Vector3)(ref ((CardEffect)this).player.data.aimDirection)).normalized;
			float num2 = Random.Range(0f - ((CardEffect)this).gun.spread, ((CardEffect)this).gun.spread);
			num2 /= (1f + ((CardEffect)this).gun.projectileSpeed * 0.5f) * 0.5f;
			normalized += Vector3.Cross(normalized, Vector3.forward) * num2;
			Rigidbody2D component = val.GetComponent<Rigidbody2D>();
			Vector3 val2 = normalized;
			component.AddForce(Vector2.op_Implicit(((Vector3)(ref val2)).normalized) * 40000000f * ((CardEffect)this).gun.damage * num);
			PhotonNetwork.Destroy(projectile);
		}

		[UnboundRPC]
		public static void RPCDistributeOwners(int playerId)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			OwnerScript[] array = Object.FindObjectsOfType<OwnerScript>();
			OwnerScript[] array2 = array;
			foreach (OwnerScript val in array2)
			{
				if ((Object)val.Owner == (Object)null)
				{
					val.Owner = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, playerId);
					break;
				}
			}
		}

		public override void OnTakeDamage(Vector2 damage, bool selfDamage)
		{
			if (((CardEffect)this).player.data.health < 0f)
			{
				ResetBoxes();
			}
		}

		public override IEnumerator OnPointEnd(IGameModeHandler gameModeHandler)
		{
			KillBoxes();
			yield return null;
		}

		public override IEnumerator OnPointStart(IGameModeHandler gameModeHandler)
		{
			SpawnBoxes();
			yield return null;
		}

		public void SpawnBoxes()
		{
			//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)
			if (Boxes.Count > 0)
			{
				KillBoxes();
			}
			for (int i = 0; i < BetterBoxedBulletsMod.BoxCap; i++)
			{
				GameObject item = PhotonNetwork.Instantiate("VKFC_Box", new Vector3(999f, 999f, 0f), Quaternion.identity, (byte)0, (object[])null);
				Boxes.Add(item);
				NetworkingManager.RPC(typeof(BoxThoseBullets), "RPCDistributeOwners", new object[1] { ((CardEffect)this).player.playerID });
			}
		}

		public void ResetBoxes()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject box in Boxes)
			{
				box.transform.position = new Vector3(999f, 999f, 0f);
			}
		}

		public void KillBoxes()
		{
			foreach (GameObject box in Boxes)
			{
				PhotonNetwork.Destroy(box.gameObject);
			}
			Boxes.Clear();
		}
	}
	public class BounceBounceBounce : CardEffect
	{
		public override void OnTouchWall(float timeSinceLastGrab, Vector3 position, Vector3 wallNormal)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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)
			((CardEffect)this).OnTouchWall(timeSinceLastGrab, position, wallNormal);
			((CardEffect)this).data.healthHandler.TakeForce(Vector2.op_Implicit(wallNormal), (ForceMode2D)1, false, false, 0f);
		}

		public override void OnTouchGround(float timeSinceGrounded, Vector3 position, Vector3 groundNormal, Transform groundTransform)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			((CardEffect)this).OnTouchGround(timeSinceGrounded, position, groundNormal, groundTransform);
			((CardEffect)this).data.healthHandler.TakeForce(Vector2.op_Implicit(groundNormal), (ForceMode2D)1, false, false, 0f);
		}
	}
	public class BeamMeUp : CardEffect
	{
		public List<Vector3> positions = new List<Vector3>();

		private Vector3 temporary;

		public override IEnumerator OnPointEnd(IGameModeHandler gameModeHandler)
		{
			positions = new List<Vector3>();
			yield return null;
		}

		public override void OnBlock(BlockTriggerType blockTriggerType)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			((CardEffect)this).OnBlock(blockTriggerType);
			temporary = ((Component)this).transform.position;
			positions.Add(temporary);
		}

		public override void OnShoot(GameObject projectile)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			((CardEffect)this).OnShoot(projectile);
			temporary = ((Component)this).transform.position;
			positions.Add(temporary);
		}

		public override void OnJump()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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)
			((CardEffect)this).OnJump();
			temporary = ((Component)this).transform.position;
			positions.Add(temporary);
		}

		public override void OnOutOfAmmo(int bulletsReloaded)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			((CardEffect)this).OnOutOfAmmo(bulletsReloaded);
			temporary = ((Component)this).transform.position;
			positions.Add(temporary);
		}

		public override void OnReloadDone(int bulletsReloaded)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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)
			((CardEffect)this).OnReloadDone(bulletsReloaded);
			temporary = ((Component)this).transform.position;
			((Component)this).transform.position = positions[Random.Range(0, positions.Count)];
			positions.Add(temporary);
		}

		public override void OnBlockRecharge()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			((CardEffect)this).OnBlockRecharge();
			temporary = ((Component)this).transform.position;
			((Component)this).transform.position = positions[Random.Range(0, positions.Count)];
			positions.Add(temporary);
		}
	}
	public class TimePassing : CardEffect
	{
		private bool madeInHeaven;

		public override IEnumerator OnPointStart(IGameModeHandler gameModeHandler)
		{
			madeInHeaven = true;
			((MonoBehaviour)this).StartCoroutine("MadeInHeaven");
			return ((CardEffect)this).OnPointStart(gameModeHandler);
		}

		public IEnumerator MadeInHeaven()
		{
			while (madeInHeaven)
			{
				TimeHandler.timeScale += TimeHandler.timeScale / 20f;
			}
			yield return null;
		}

		public override void OnTakeDamage(Vector2 damage, bool selfDamage)
		{
			if (((CardEffect)this).player.data.health < 0f)
			{
				madeInHeaven = false;
			}
		}
	}
}
namespace BetterBoxedBullets.Cards
{
	internal class PerfectMovement : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			statModifiers.gravity = 0f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			characterStats.movementSpeed *= 2f;
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		protected override string GetTitle()
		{
			return "Perfect Movement";
		}

		protected override string GetDescription()
		{
			return "";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (Rarity)2;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_002b: 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_0033: Expected O, but got Unknown
			//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)
			//IL_0041: 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_0057: 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_005f: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Health",
					amount = "+100%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Gravity",
					amount = "-100%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (CardThemeColorType)3;
		}

		public override string GetModName()
		{
			return "BBB";
		}
	}
	internal class Template : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		protected override string GetTitle()
		{
			return "CardName";
		}

		protected override string GetDescription()
		{
			return "CardDescription";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (Rarity)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_002b: 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_0033: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Effect",
					amount = "No",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (CardThemeColorType)7;
		}

		public override string GetModName()
		{
			return "BBB";
		}
	}
}