Decompiled source of JeusticeHazards v1.0.2

JeusticeHazards.dll

Decompiled 14 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using JeusticeHazards.MapObjects;
using JeusticeHazards.Properties;
using MapsExt;
using MapsExt.MapObjects;
using MapsExt.Properties;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnboundLib;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.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(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JeusticeHazards
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.jeustice.rounds.hazards", "Jeustice Hazards", "1.0.2")]
	[BepInProcess("Rounds.exe")]
	public class JeusticeHazards : BaseUnityPlugin
	{
		public const string ModId = "com.jeustice.rounds.hazards";

		public const string ModName = "Jeustice Hazards";

		public const string Version = "1.0.2";

		public static JeusticeHazards Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.jeustice.rounds.hazards").PatchAll();
		}

		private void Start()
		{
			Unbound.RegisterCredits("Jeustice Hazards", new string[1] { "Jeustice" }, new string[0], new string[0]);
			((MonoBehaviour)this).StartCoroutine(Sounds.LoadAll(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)));
		}

		private void Update()
		{
			PowderKegExplosion.EnsureRpc();
		}
	}
	public static class PlayerDps
	{
		public const float BaseBulletDamage = 55f;

		public const float Base = 70f;

		public static float Estimate(Player player)
		{
			Gun val = (((Object)(object)player != (Object)null) ? player.data.weaponHandler.gun : null);
			if ((Object)(object)val == (Object)null)
			{
				return 70f;
			}
			GunAmmo componentInChildren = ((Component)val).GetComponentInChildren<GunAmmo>();
			float num = 55f * val.damage * val.bulletDamageMultiplier * (float)Mathf.Max(1, val.numberOfProjectiles) * (float)Mathf.Max(1, val.bursts);
			float num2 = val.attackSpeed / Mathf.Max(0.01f, val.attackSpeedMultiplier);
			int num3 = (((Object)(object)componentInChildren != (Object)null) ? Mathf.Max(1, componentInChildren.maxAmmo) : 3);
			float num4 = (((Object)(object)componentInChildren != (Object)null) ? ((componentInChildren.reloadTime + componentInChildren.reloadTimeAdd) * componentInChildren.reloadTimeMultiplier) : 1.5f);
			float num5 = Mathf.Max(0.05f, (float)num3 * num2 + num4);
			return Mathf.Max(0f, (float)num3 * num / num5);
		}
	}
	internal static class Sounds
	{
		public static AudioClip PowderKegExplosion { get; private set; }

		public static IEnumerator LoadAll(string folder)
		{
			yield return Load(Path.Combine(folder, "PowderKegExplosion.ogg"), delegate(AudioClip clip)
			{
				PowderKegExplosion = clip;
			});
		}

		private static IEnumerator Load(string path, Action<AudioClip> done)
		{
			if (!File.Exists(path))
			{
				JeusticeHazards.Log.LogWarning((object)("Sound not found: " + path));
				yield break;
			}
			UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file:///" + path.Replace('\\', '/'), (AudioType)14);
			try
			{
				yield return request.SendWebRequest();
				if (request.isNetworkError || request.isHttpError)
				{
					JeusticeHazards.Log.LogWarning((object)("Could not load sound " + path + ": " + request.error));
					yield break;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(request);
				((Object)content).name = Path.GetFileNameWithoutExtension(path);
				done(content);
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		public static void Play(AudioClip clip, Vector2 position, float volume = 1f, float pitchVariation = 0.08f)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			if (!((Object)(object)clip == (Object)null))
			{
				GameObject val = new GameObject("Sound " + ((Object)clip).name);
				val.transform.position = Vector2.op_Implicit(position);
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = clip;
				val2.spatialBlend = 0f;
				val2.volume = Mathf.Clamp01(volume * Optionshandler.vol_Master * Optionshandler.vol_Sfx);
				val2.pitch = 1f + Random.Range(0f - pitchVariation, pitchVariation);
				val2.Play();
				Object.Destroy((Object)val, clip.length / Mathf.Max(0.1f, val2.pitch) + 0.1f);
			}
		}
	}
	internal static class Visuals
	{
		private static Material s_material;

		private static Sprite s_square;

		private static Sprite s_circle;

		private static Sprite s_squareLeftPivot;

		public static Material Material
		{
			get
			{
				//IL_0013: 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_001e: Expected O, but got Unknown
				object obj = s_material;
				if (obj == null)
				{
					Material val = new Material(Shader.Find("Sprites/Default"));
					s_material = val;
					obj = (object)val;
				}
				return (Material)obj;
			}
		}

		public static Sprite Square
		{
			get
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)s_square == (Object)null)
				{
					Texture2D whiteTexture = Texture2D.whiteTexture;
					s_square = Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0.5f, 0.5f), (float)((Texture)whiteTexture).width);
				}
				return s_square;
			}
		}

		public static Sprite SquareLeftPivot
		{
			get
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)s_squareLeftPivot == (Object)null)
				{
					Texture2D whiteTexture = Texture2D.whiteTexture;
					s_squareLeftPivot = Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0f, 0.5f), (float)((Texture)whiteTexture).width);
				}
				return s_squareLeftPivot;
			}
		}

		public static Sprite Circle
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: 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_007a: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)s_circle == (Object)null)
				{
					Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
					float num = 64f;
					for (int i = 0; i < 128; i++)
					{
						for (int j = 0; j < 128; j++)
						{
							float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(num, num)) / num;
							val.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01((1f - num2) * 12f)));
						}
					}
					val.Apply();
					s_circle = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 128f);
				}
				return s_circle;
			}
		}

		public static GameObject CreateSolidTemplate(string name, bool leftPivot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0013: Expected O, but got Unknown
			//IL_001e: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.SetActive(false);
			Object.DontDestroyOnLoad((Object)val);
			GameObject val2 = MapObjectManager.LoadCustomAsset<GameObject>("Ground");
			val.layer = (((Object)(object)val2 != (Object)null) ? val2.layer : 0);
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = (leftPivot ? SquareLeftPivot : Square);
			((Renderer)obj).material = Material;
			BoxCollider2D obj2 = val.AddComponent<BoxCollider2D>();
			obj2.size = Vector2.one;
			((Collider2D)obj2).offset = (Vector2)(leftPivot ? new Vector2(0.5f, 0f) : Vector2.zero);
			Rigidbody2D obj3 = val.AddComponent<Rigidbody2D>();
			obj3.isKinematic = true;
			obj3.useFullKinematicContacts = true;
			obj3.interpolation = (RigidbodyInterpolation2D)1;
			return val;
		}

		public static SpriteRenderer CreateSprite(string name, Transform parent, Sprite sprite, Color color, int sortingOrder)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = sprite;
			((Renderer)obj).material = Material;
			obj.color = color;
			((Renderer)obj).sortingOrder = sortingOrder;
			return obj;
		}
	}
}
namespace JeusticeHazards.Properties
{
	public abstract class FloatProperty : ValueProperty<float>
	{
		[SerializeField]
		private readonly float _value;

		public override float Value => _value;

		protected FloatProperty(float value)
		{
			_value = value;
		}
	}
}
namespace JeusticeHazards.MapObjects
{
	public class FlipperData : SpatialMapObjectData
	{
		public const float DefaultPower = 35f;

		[SerializeField]
		private float _interval = 3f;

		[SerializeField]
		private float _delay;

		[SerializeField]
		private float _power = 35f;

		[SerializeField]
		private float _flipAngle = 55f;

		public KickerIntervalProperty Interval
		{
			get
			{
				return new KickerIntervalProperty(_interval);
			}
			set
			{
				_interval = ((ValueProperty<float>)value).Value;
			}
		}

		public KickerDelayProperty Delay
		{
			get
			{
				return new KickerDelayProperty(_delay);
			}
			set
			{
				_delay = ((ValueProperty<float>)value).Value;
			}
		}

		public KickerPowerProperty Power
		{
			get
			{
				return new KickerPowerProperty(_power);
			}
			set
			{
				_power = ((ValueProperty<float>)value).Value;
			}
		}

		public FlipAngleProperty FlipAngle
		{
			get
			{
				return new FlipAngleProperty(_flipAngle);
			}
			set
			{
				_flipAngle = ((ValueProperty<float>)value).Value;
			}
		}
	}
	public class FlipAngleProperty : FloatProperty
	{
		public const float Default = 55f;

		public FlipAngleProperty()
			: this(55f)
		{
		}

		public FlipAngleProperty(float value)
			: base(value)
		{
		}
	}
	[PropertySerializer(typeof(FlipAngleProperty))]
	public class FlipAnglePropertySerializer : IPropertyWriter<FlipAngleProperty>
	{
		public virtual void WriteProperty(FlipAngleProperty property, GameObject target)
		{
			target.GetComponent<FlipperMono>().flipAngle = ((ValueProperty<float>)property).Value;
		}
	}
	[MapObject(typeof(FlipperData))]
	public class Flipper : IMapObject
	{
		private static GameObject s_prefab;

		public virtual GameObject Prefab => s_prefab ?? (s_prefab = Visuals.CreateSolidTemplate("Flipper", leftPivot: true));

		public virtual void OnInstantiate(GameObject instance)
		{
			instance.AddComponent<FlipperMono>();
		}
	}
	public class FlipperMono : KickerMono
	{
		private const float UpTime = 0.1f;

		private const float HoldTime = 0.35f;

		private const float DownTime = 0.25f;

		public float flipAngle = 55f;

		private float _restAngle;

		protected override void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			base.Start();
			_restAngle = ((Component)this).transform.eulerAngles.z;
			((Component)this).GetComponent<SpriteRenderer>().color = new Color(0.95f, 0.95f, 0.95f);
		}

		private float Raise(float t)
		{
			float num = Cycle - 0.1f - 0.35f - 0.25f;
			if (t < num)
			{
				return 0f;
			}
			t -= num;
			if (t < 0.1f)
			{
				return t / 0.1f;
			}
			if (t < 0.45f)
			{
				return 1f;
			}
			return 1f - Mathf.SmoothStep(0f, 1f, (t - 0.1f - 0.35f) / 0.25f);
		}

		private void FixedUpdate()
		{
			//IL_007f: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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)
			//IL_011a: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			if (!base.Running || (Object)(object)base.Body == (Object)null)
			{
				return;
			}
			float cycleTime = base.CycleTime;
			base.Body.MoveRotation(_restAngle + flipAngle * Raise(cycleTime));
			float num = Cycle - 0.1f - 0.35f - 0.25f;
			if (cycleTime >= num && cycleTime < num + 0.1f)
			{
				float length = Mathf.Abs(((Component)this).transform.lossyScale.x);
				float num2 = Mathf.Abs(((Component)this).transform.lossyScale.y);
				Vector2 along = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, _restAngle) * Vector2.op_Implicit(Vector2.right));
				Vector2 val = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, _restAngle) * Vector2.op_Implicit(Vector2.up) * Mathf.Sign(flipAngle));
				Vector2 pivot = Vector2.op_Implicit(((Component)this).transform.position);
				Vector2 center = pivot + along * length / 2f + val * (num2 / 2f + 1f);
				Vector2 val2 = val + Vector2.up * 0.5f;
				Vector2 normalized = ((Vector2)(ref val2)).normalized;
				KickOnce(center, new Vector2(length, num2 + 2f), _restAngle, normalized, delegate(Vector2 p)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: 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)
					float num3 = Mathf.Clamp01(Vector2.Dot(p - pivot, along) / length);
					return power * (0.4f + 0.6f * num3);
				});
			}
		}
	}
	public abstract class KickerMono : SyncedCycleMono
	{
		public float interval = 3f;

		public float power;

		private int _lastKickCycle = int.MinValue;

		private readonly HashSet<Player> _players = new HashSet<Player>();

		private readonly HashSet<Rigidbody2D> _bodies = new HashSet<Rigidbody2D>();

		protected Rigidbody2D Body { get; private set; }

		protected override float Cycle => Mathf.Max(0.5f, interval);

		protected override void Start()
		{
			base.Start();
			Body = ((Component)this).GetComponent<Rigidbody2D>();
		}

		protected void KickOnce(Vector2 center, Vector2 size, float angle, Vector2 direction, Func<Vector2, float> speedAt)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			if (base.CycleIndex == _lastKickCycle)
			{
				return;
			}
			_lastKickCycle = base.CycleIndex;
			_players.Clear();
			_bodies.Clear();
			Collider2D[] array = Physics2D.OverlapBoxAll(center, size, angle);
			foreach (Collider2D val in array)
			{
				if (!((Object)(object)val.attachedRigidbody == (Object)(object)Body))
				{
					Player componentInParent = ((Component)val).GetComponentInParent<Player>();
					if ((Object)(object)componentInParent != (Object)null)
					{
						_players.Add(componentInParent);
					}
					else if ((Object)(object)val.attachedRigidbody != (Object)null && !val.attachedRigidbody.isKinematic)
					{
						_bodies.Add(val.attachedRigidbody);
					}
				}
			}
			foreach (Player player in _players)
			{
				if (!player.data.dead && player.data.view.IsMine)
				{
					float num = speedAt(Vector2.op_Implicit(((Component)player).transform.position));
					player.data.healthHandler.CallTakeForce(direction * num * 100f, (ForceMode2D)1, false, true, 0f);
				}
			}
			if (PhotonNetwork.IsMasterClient)
			{
				foreach (Rigidbody2D body in _bodies)
				{
					Vector2 val2 = Vector2.Perpendicular(direction);
					body.velocity = val2 * Vector2.Dot(body.velocity, val2) + direction * speedAt(body.position);
				}
			}
			if (_players.Count <= 0 && _bodies.Count <= 0)
			{
				return;
			}
			foreach (Rigidbody2D body2 in _bodies)
			{
				JeusticeHazards.Log.LogInfo((object)($"{((object)this).GetType().Name} kicked {((Object)body2).name} at {speedAt(body2.position):F0} u/s " + $"(gravity {Physics2D.gravity.y:F1} x scale {body2.gravityScale:F1}, mass {body2.mass:F0})"));
			}
			foreach (Player player2 in _players)
			{
				JeusticeHazards.Log.LogInfo((object)$"{((object)this).GetType().Name} kicked player {player2.playerID} at {speedAt(Vector2.op_Implicit(((Component)player2).transform.position)):F0} u/s");
			}
		}
	}
	public class KickerIntervalProperty : FloatProperty
	{
		public const float Default = 3f;

		public KickerIntervalProperty()
			: this(3f)
		{
		}

		public KickerIntervalProperty(float value)
			: base(value)
		{
		}
	}
	public class KickerDelayProperty : FloatProperty
	{
		public const float Default = 0f;

		public KickerDelayProperty()
			: this(0f)
		{
		}

		public KickerDelayProperty(float value)
			: base(value)
		{
		}
	}
	public class KickerPowerProperty : FloatProperty
	{
		public KickerPowerProperty()
			: this(30f)
		{
		}

		public KickerPowerProperty(float value)
			: base(value)
		{
		}
	}
	[PropertySerializer(typeof(KickerIntervalProperty))]
	public class KickerIntervalPropertySerializer : IPropertyWriter<KickerIntervalProperty>
	{
		public virtual void WriteProperty(KickerIntervalProperty property, GameObject target)
		{
			target.GetComponent<KickerMono>().interval = ((ValueProperty<float>)property).Value;
		}
	}
	[PropertySerializer(typeof(KickerDelayProperty))]
	public class KickerDelayPropertySerializer : IPropertyWriter<KickerDelayProperty>
	{
		public virtual void WriteProperty(KickerDelayProperty property, GameObject target)
		{
			target.GetComponent<KickerMono>().delay = ((ValueProperty<float>)property).Value;
		}
	}
	[PropertySerializer(typeof(KickerPowerProperty))]
	public class KickerPowerPropertySerializer : IPropertyWriter<KickerPowerProperty>
	{
		public virtual void WriteProperty(KickerPowerProperty property, GameObject target)
		{
			target.GetComponent<KickerMono>().power = ((ValueProperty<float>)property).Value;
		}
	}
	public class LaserData : SpatialMapObjectData
	{
		[SerializeField]
		private float _offTime = 3f;

		[SerializeField]
		private float _warnTime = 1f;

		[SerializeField]
		private float _onTime = 2f;

		[SerializeField]
		private float _delay;

		public LaserOffTimeProperty OffTime
		{
			get
			{
				return new LaserOffTimeProperty(_offTime);
			}
			set
			{
				_offTime = ((ValueProperty<float>)value).Value;
			}
		}

		public LaserWarnTimeProperty WarnTime
		{
			get
			{
				return new LaserWarnTimeProperty(_warnTime);
			}
			set
			{
				_warnTime = ((ValueProperty<float>)value).Value;
			}
		}

		public LaserOnTimeProperty OnTime
		{
			get
			{
				return new LaserOnTimeProperty(_onTime);
			}
			set
			{
				_onTime = ((ValueProperty<float>)value).Value;
			}
		}

		public LaserDelayProperty Delay
		{
			get
			{
				return new LaserDelayProperty(_delay);
			}
			set
			{
				_delay = ((ValueProperty<float>)value).Value;
			}
		}
	}
	[MapObject(typeof(LaserData))]
	public class Laser : IMapObject
	{
		public virtual GameObject Prefab => MapObjectManager.LoadCustomAsset<GameObject>("Ground");

		public virtual void OnInstantiate(GameObject instance)
		{
			ExtensionMethods.GetOrAddComponent<LaserMono>(instance, false);
		}
	}
	public class LaserMono : SyncedCycleMono
	{
		private enum Phase
		{
			Off,
			Warn,
			On
		}

		private const float DamageTick = 0.1f;

		private const float MaxHealthPerSecond = 2f;

		private const float RailThickness = 0.12f;

		private const float WarnThickness = 0.3f;

		private static readonly Color RailColor = new Color(1f, 0.15f, 0.15f, 0.35f);

		private static readonly Color WarnColor = new Color(1f, 0.3f, 0.2f, 0.6f);

		private static readonly Color FireColor = new Color(1f, 0.1f, 0.1f, 0.9f);

		private static readonly Color CoreColor = new Color(1f, 0.85f, 0.85f, 1f);

		public float offTime = 3f;

		public float warnTime = 1f;

		public float onTime = 2f;

		private SpriteRenderer _rail;

		private SpriteRenderer _beam;

		private SpriteRenderer _core;

		private readonly Dictionary<Player, float> _nextDamageTime = new Dictionary<Player, float>();

		private readonly HashSet<Player> _hitThisFrame = new HashSet<Player>();

		protected override float Cycle => Mathf.Max(0.1f, offTime + warnTime + onTime);

		protected override void Start()
		{
			base.Start();
			((Component)this).gameObject.layer = LayerMask.NameToLayer("BackgroundObject");
			((Collider2D)ExtensionMethods.GetOrAddComponent<BoxCollider2D>(((Component)this).gameObject, false)).isTrigger = true;
			_rail = CreateLayer("Rail", 0);
			_beam = CreateLayer("Beam", 1);
			_core = CreateLayer("Core", 2);
		}

		private SpriteRenderer CreateLayer(string name, int order)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			SpriteRenderer obj = Visuals.CreateSprite(name, ((Component)this).transform, Visuals.Square, Color.white, 10 + order);
			((Component)obj).gameObject.layer = ((Component)this).gameObject.layer;
			return obj;
		}

		private Phase CurrentPhase(out float phaseTime)
		{
			float cycleTime = base.CycleTime;
			if (cycleTime < offTime)
			{
				phaseTime = cycleTime;
				return Phase.Off;
			}
			if (cycleTime < offTime + warnTime)
			{
				phaseTime = cycleTime - offTime;
				return Phase.Warn;
			}
			phaseTime = cycleTime - offTime - warnTime;
			return Phase.On;
		}

		protected override void Update()
		{
			base.Update();
			SpriteMask component = ((Component)this).GetComponent<SpriteMask>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			SpriteRenderer component2 = ((Component)this).GetComponent<SpriteRenderer>();
			if ((Object)(object)component2 != (Object)null && ((Renderer)component2).enabled)
			{
				((Renderer)component2).enabled = false;
			}
			UpdateVisuals();
		}

		private void UpdateVisuals()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_rail == (Object)null))
			{
				SetLayer(_rail, 0.12f, RailColor);
				float phaseTime;
				switch (CurrentPhase(out phaseTime))
				{
				case Phase.Off:
					((Renderer)_beam).enabled = false;
					((Renderer)_core).enabled = false;
					break;
				case Phase.Warn:
				{
					float num2 = ((warnTime > 0f) ? (phaseTime / warnTime) : 1f);
					float num3 = Mathf.Lerp(6f, 20f, num2);
					bool enabled = Mathf.Repeat(phaseTime * num3, 1f) < 0.5f;
					((Renderer)_beam).enabled = enabled;
					((Renderer)_core).enabled = false;
					SetLayer(_beam, 0.3f, WarnColor);
					break;
				}
				case Phase.On:
				{
					float num = 1f + 0.06f * Mathf.Sin(Time.time * 40f);
					((Renderer)_beam).enabled = true;
					((Renderer)_core).enabled = true;
					SetLayer(_beam, num, FireColor);
					SetLayer(_core, 0.35f * num, CoreColor);
					break;
				}
				}
			}
		}

		private static void SetLayer(SpriteRenderer sr, float thickness, Color color)
		{
			//IL_0011: 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)
			((Component)sr).transform.localScale = new Vector3(1f, thickness, 1f);
			sr.color = color;
		}

		private void FixedUpdate()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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 (!base.Running || CurrentPhase(out var _) != Phase.On)
			{
				return;
			}
			Vector2 val = Vector2.op_Implicit(((Component)this).transform.position);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(Mathf.Abs(((Component)this).transform.lossyScale.x), Mathf.Abs(((Component)this).transform.lossyScale.y));
			float z = ((Component)this).transform.eulerAngles.z;
			_hitThisFrame.Clear();
			Collider2D[] array = Physics2D.OverlapBoxAll(val, val2, z);
			for (int i = 0; i < array.Length; i++)
			{
				Player componentInParent = ((Component)array[i]).GetComponentInParent<Player>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					_hitThisFrame.Add(componentInParent);
				}
			}
			foreach (Player item in _hitThisFrame)
			{
				if (!item.data.dead && item.data.view.IsMine && (!_nextDamageTime.TryGetValue(item, out var value) || !(Time.time < value)))
				{
					_nextDamageTime[item] = Time.time + 0.1f;
					Vector2 val3 = Vector2.op_Implicit(((Component)this).transform.up);
					if (Vector2.Dot(Vector2.op_Implicit(((Component)item).transform.position) - val, val3) < 0f)
					{
						val3 = -val3;
					}
					float num = item.data.maxHealth * 2f * 0.1f;
					((Damagable)item.data.healthHandler).CallTakeDamage(val3 * num, Vector2.op_Implicit(((Component)item).transform.position), (GameObject)null, (Player)null, true);
				}
			}
		}
	}
	public class LaserOffTimeProperty : FloatProperty
	{
		public const float Default = 3f;

		public LaserOffTimeProperty()
			: this(3f)
		{
		}

		public LaserOffTimeProperty(float value)
			: base(value)
		{
		}
	}
	public class LaserWarnTimeProperty : FloatProperty
	{
		public const float Default = 1f;

		public LaserWarnTimeProperty()
			: this(1f)
		{
		}

		public LaserWarnTimeProperty(float value)
			: base(value)
		{
		}
	}
	public class LaserOnTimeProperty : FloatProperty
	{
		public const float Default = 2f;

		public LaserOnTimeProperty()
			: this(2f)
		{
		}

		public LaserOnTimeProperty(float value)
			: base(value)
		{
		}
	}
	public class LaserDelayProperty : FloatProperty
	{
		public const float Default = 0f;

		public LaserDelayProperty()
			: this(0f)
		{
		}

		public LaserDelayProperty(float value)
			: base(value)
		{
		}
	}
	[PropertySerializer(typeof(LaserOffTimeProperty))]
	public class LaserOffTimePropertySerializer : IPropertyWriter<LaserOffTimeProperty>
	{
		public virtual void WriteProperty(LaserOffTimeProperty property, GameObject target)
		{
			ExtensionMethods.GetOrAddComponent<LaserMono>(target, false).offTime = ((ValueProperty<float>)property).Value;
		}
	}
	[PropertySerializer(typeof(LaserWarnTimeProperty))]
	public class LaserWarnTimePropertySerializer : IPropertyWriter<LaserWarnTimeProperty>
	{
		public virtual void WriteProperty(LaserWarnTimeProperty property, GameObject target)
		{
			ExtensionMethods.GetOrAddComponent<LaserMono>(target, false).warnTime = ((ValueProperty<float>)property).Value;
		}
	}
	[PropertySerializer(typeof(LaserOnTimeProperty))]
	public class LaserOnTimePropertySerializer : IPropertyWriter<LaserOnTimeProperty>
	{
		public virtual void WriteProperty(LaserOnTimeProperty property, GameObject target)
		{
			ExtensionMethods.GetOrAddComponent<LaserMono>(target, false).onTime = ((ValueProperty<float>)property).Value;
		}
	}
	[PropertySerializer(typeof(LaserDelayProperty))]
	public class LaserDelayPropertySerializer : IPropertyWriter<LaserDelayProperty>
	{
		public virtual void WriteProperty(LaserDelayProperty property, GameObject target)
		{
			ExtensionMethods.GetOrAddComponent<LaserMono>(target, false).delay = ((ValueProperty<float>)property).Value;
		}
	}
	public class LauncherData : SpatialMapObjectData
	{
		public const float DefaultPower = 45f;

		[SerializeField]
		private float _interval = 3f;

		[SerializeField]
		private float _delay;

		[SerializeField]
		private float _power = 45f;

		public KickerIntervalProperty Interval
		{
			get
			{
				return new KickerIntervalProperty(_interval);
			}
			set
			{
				_interval = ((ValueProperty<float>)value).Value;
			}
		}

		public KickerDelayProperty Delay
		{
			get
			{
				return new KickerDelayProperty(_delay);
			}
			set
			{
				_delay = ((ValueProperty<float>)value).Value;
			}
		}

		public KickerPowerProperty Power
		{
			get
			{
				return new KickerPowerProperty(_power);
			}
			set
			{
				_power = ((ValueProperty<float>)value).Value;
			}
		}
	}
	[MapObject(typeof(LauncherData))]
	public class Launcher : IMapObject
	{
		private static GameObject s_prefab;

		public virtual GameObject Prefab => s_prefab ?? (s_prefab = Visuals.CreateSolidTemplate("Launcher", leftPivot: false));

		public virtual void OnInstantiate(GameObject instance)
		{
			instance.AddComponent<LauncherMono>();
		}
	}
	public class LauncherMono : KickerMono
	{
		private const float ChargeTime = 1f;

		private const float FireTime = 0.12f;

		private const float ReturnTime = 0.4f;

		private const float PullBack = 0.8f;

		private const float Throw = 1.2f;

		private static readonly Color Idle = new Color(0.85f, 0.15f, 0.15f);

		private static readonly Color Charged = new Color(1f, 0.85f, 0.3f);

		private Vector2 _rest;

		private SpriteRenderer _renderer;

		protected override void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			base.Start();
			_rest = Vector2.op_Implicit(((Component)this).transform.position);
			_renderer = ((Component)this).GetComponent<SpriteRenderer>();
			_renderer.color = Idle;
		}

		private (float offset, float charge) Pose(float t)
		{
			float num = Cycle - 0.12f;
			float num2 = num - 1f;
			if (t >= num)
			{
				return (offset: Mathf.Lerp(-0.8f, 1.2f, (t - num) / 0.12f), charge: 1f);
			}
			if (t >= num2)
			{
				float num3 = (t - num2) / 1f;
				return (offset: -0.8f * num3 * num3, charge: num3);
			}
			if (t < 0.4f)
			{
				return (offset: Mathf.Lerp(1.2f, 0f, t / 0.4f), charge: 0f);
			}
			return (offset: 0f, charge: 0f);
		}

		protected override 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)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			base.Update();
			_renderer.color = Color.Lerp(Idle, Charged, Pose(base.CycleTime).charge);
		}

		private void FixedUpdate()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_003b: 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)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00a0: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			if (!base.Running || (Object)(object)base.Body == (Object)null)
			{
				return;
			}
			Vector2 val = Vector2.op_Implicit(((Component)this).transform.up);
			float cycleTime = base.CycleTime;
			base.Body.MovePosition(_rest + val * Pose(cycleTime).offset);
			if (cycleTime >= Cycle - 0.12f)
			{
				Vector2 size = default(Vector2);
				((Vector2)(ref size))..ctor(Mathf.Abs(((Component)this).transform.lossyScale.x) * 0.95f, 3f);
				Vector2 center = Vector2.op_Implicit(((Component)this).transform.position) + val * (Mathf.Abs(((Component)this).transform.lossyScale.y) / 2f + 1.5f);
				KickOnce(center, size, ((Component)this).transform.eulerAngles.z, val, (Vector2 _) => power);
			}
		}
	}
	public class PowderKegData : SpatialMapObjectData
	{
		public PowderKegProperty PowderKeg
		{
			get
			{
				return new PowderKegProperty();
			}
			set
			{
			}
		}
	}
	public class PowderKegProperty : IProperty
	{
	}
	[PropertySerializer(typeof(PowderKegProperty))]
	public class PowderKegPropertySerializer : IPropertyWriter<PowderKegProperty>
	{
		public virtual void WriteProperty(PowderKegProperty property, GameObject target)
		{
			ExtensionMethods.GetOrAddComponent<PowderKegMono>(target, false);
		}
	}
	[MapObject(typeof(PowderKegData))]
	public class PowderKeg : IMapObject
	{
		public virtual GameObject Prefab => MapObjectManager.LoadCustomAsset<GameObject>("Box Destructible");

		public virtual void OnInstantiate(GameObject instance)
		{
		}
	}
	public class PowderKegExplosion : MonoBehaviour
	{
		public const float DpsMultiplier = 2.5f;

		public const float MaxDamage = 30000f;

		public const float CoverMultiplier = 0.5f;

		public const float BaseRadius = 6f;

		public const float MinRadius = 4f;

		public const float MaxRadius = 12f;

		private const string RpcKey = "JeusticeHazards PowderKegExplosion";

		private const float PlayerForce = 3500f;

		private const float ObjectForce = 2500f;

		private const float CrateDamage = 200f;

		private const float ChainDelay = 0.15f;

		private const float EffectDuration = 0.45f;

		private static readonly Dictionary<int, float> s_exploded = new Dictionary<int, float>();

		private Vector2 _center;

		private float _dps;

		private int _immunePlayerId = -1;

		private float _damage;

		private float _radius;

		public static float DamageFor(float dps)
		{
			return Mathf.Min(dps * 2.5f, 30000f);
		}

		public static float RadiusFor(float dps)
		{
			return Mathf.Clamp(6f * Mathf.Sqrt(Mathf.Max(0f, dps) / 70f), 4f, 12f);
		}

		public static void RegisterRpc()
		{
			ChildRPC val = (((Object)(object)MapManager.instance != (Object)null) ? ((Component)MapManager.instance).GetComponent<ChildRPC>() : null);
			if ((Object)(object)val != (Object)null)
			{
				val.childRPCsVector2Vector2Int["JeusticeHazards PowderKegExplosion"] = delegate(Vector2 center, Vector2 data, int kegId)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					Receive(center, data.x, kegId, (int)data.y);
				};
			}
		}

		public static void EnsureRpc()
		{
			ChildRPC val = (((Object)(object)MapManager.instance != (Object)null) ? ((Component)MapManager.instance).GetComponent<ChildRPC>() : null);
			if ((Object)(object)val != (Object)null && !val.childRPCsVector2Vector2Int.ContainsKey("JeusticeHazards PowderKegExplosion"))
			{
				RegisterRpc();
			}
		}

		public static bool HasExploded(int kegId)
		{
			if (s_exploded.TryGetValue(kegId, out var value))
			{
				return Time.time - value < 5f;
			}
			return false;
		}

		public static void Call(Vector2 center, float dps, int kegId, int immunePlayerId = -1)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			ChildRPC val = (((Object)(object)MapManager.instance != (Object)null) ? ((Component)MapManager.instance).GetComponent<ChildRPC>() : null);
			JeusticeHazards.Log.LogInfo((object)string.Format("Powder keg {0}: sending explosion (DPS {1:F0}, RPC {2})", kegId, dps, ((Object)(object)val != (Object)null) ? "yes" : "no, local only"));
			if ((Object)(object)val != (Object)null)
			{
				val.CallFunction("JeusticeHazards PowderKegExplosion", center, new Vector2(dps, (float)immunePlayerId), kegId);
			}
			else
			{
				Receive(center, dps, kegId, immunePlayerId);
			}
		}

		private static void Receive(Vector2 center, float dps, int kegId, int immunePlayerId)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (!HasExploded(kegId))
			{
				s_exploded[kegId] = Time.time;
				JeusticeHazards.Log.LogInfo((object)$"Powder keg {kegId} explodes: damage {DamageFor(dps):F0}, radius {RadiusFor(dps):F1}");
				GameObject val = new GameObject("Powder Keg Explosion");
				val.transform.position = Vector2.op_Implicit(center);
				PowderKegExplosion powderKegExplosion = val.AddComponent<PowderKegExplosion>();
				powderKegExplosion._center = center;
				powderKegExplosion._dps = dps;
				powderKegExplosion._immunePlayerId = immunePlayerId;
				powderKegExplosion._damage = DamageFor(dps);
				powderKegExplosion._radius = RadiusFor(dps);
			}
		}

		private void Start()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			DamageLocalPlayers();
			((MonoBehaviour)this).StartCoroutine(Effect());
			float num = (_radius - 4f) / 8f;
			Sounds.Play(Sounds.PowderKegExplosion, _center, Mathf.Lerp(0.7f, 1f, num), 0.06f);
			try
			{
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				GamefeelManager.GameFeel(((Vector2)(ref insideUnitCircle)).normalized * Mathf.Lerp(6f, 14f, (_radius - 4f) / 8f));
			}
			catch (Exception ex)
			{
				JeusticeHazards.Log.LogWarning((object)("Screen shake failed: " + ex.Message));
			}
			if (PhotonNetwork.IsMasterClient)
			{
				((MonoBehaviour)this).StartCoroutine(AffectSurroundings());
			}
		}

		private void DamageLocalPlayers()
		{
			//IL_0087: 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_0091: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			foreach (Player item in PlayerManager.instance.players.ToList())
			{
				if ((Object)(object)item == (Object)null || item.data.dead || !item.data.view.IsMine || item.playerID == _immunePlayerId)
				{
					continue;
				}
				Collider2D component = ((Component)item).GetComponent<Collider2D>();
				Vector2 val;
				if (!((Object)(object)component != (Object)null))
				{
					val = Vector2.op_Implicit(((Component)item).transform.position);
				}
				else
				{
					Bounds bounds = component.bounds;
					val = Vector2.op_Implicit(((Bounds)(ref bounds)).ClosestPoint(Vector2.op_Implicit(_center)));
				}
				Vector2 val2 = val;
				float num = Vector2.Distance(_center, val2);
				if (num > _radius)
				{
					JeusticeHazards.Log.LogInfo((object)$"  player {item.playerID} out of range ({num:F1} > {_radius:F1})");
					continue;
				}
				bool flag = IsCovered(item);
				float num2 = (flag ? 0.5f : 1f);
				JeusticeHazards.Log.LogInfo((object)string.Format("  player {0} hit: {1:F0} damage{2}, blocking: {3}", item.playerID, _damage * num2, flag ? " (covered)" : "", item.data.block.IsBlocking()));
				Vector2 val3 = Vector2.op_Implicit(((Component)item).transform.position) - _center;
				Vector2 val4 = ((Vector2)(ref val3)).normalized;
				if (val4 == Vector2.zero)
				{
					val4 = Vector2.up;
				}
				((Damagable)item.data.healthHandler).CallTakeDamage(val4 * _damage * num2, _center, (GameObject)null, (Player)null, true);
				item.data.healthHandler.CallTakeForce(val4 * 3500f * num2, (ForceMode2D)1, false, false, 0f);
			}
		}

		private bool IsCovered(Player player)
		{
			//IL_0001: 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)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit2D[] array = Physics2D.LinecastAll(_center, Vector2.op_Implicit(((Component)player).transform.position));
			for (int i = 0; i < array.Length; i++)
			{
				RaycastHit2D val = array[i];
				Collider2D collider = ((RaycastHit2D)(ref val)).collider;
				if (!collider.isTrigger && ((Component)collider).gameObject.layer != LayerMask.NameToLayer("BackgroundObject") && !((Object)(object)((Component)collider).GetComponentInParent<Player>() != (Object)null) && !((Object)(object)((Component)collider).GetComponentInParent<ProjectileHit>() != (Object)null))
				{
					PowderKegMono componentInParent = ((Component)collider).GetComponentInParent<PowderKegMono>();
					if (!((Object)(object)componentInParent != (Object)null) || !componentInParent.Exploded)
					{
						return true;
					}
				}
			}
			return false;
		}

		private IEnumerator AffectSurroundings()
		{
			yield return (object)new WaitForSeconds(0.15f);
			Collider2D[] array = Physics2D.OverlapCircleAll(_center, _radius);
			foreach (Collider2D val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Vector2 val2 = Vector2.op_Implicit(((Component)val).transform.position) - _center;
				Vector2 normalized = ((Vector2)(ref val2)).normalized;
				Vector2 center = _center;
				Bounds bounds = val.bounds;
				float num = Mathf.Clamp01(1f - Vector2.Distance(center, Vector2.op_Implicit(((Bounds)(ref bounds)).ClosestPoint(Vector2.op_Implicit(_center)))) / _radius);
				PowderKegMono componentInParent = ((Component)val).GetComponentInParent<PowderKegMono>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					componentInParent.Detonate(_dps);
					continue;
				}
				DamagableEvent componentInParent2 = ((Component)val).GetComponentInParent<DamagableEvent>();
				if ((Object)(object)componentInParent2 != (Object)null && !componentInParent2.dead)
				{
					((Damagable)componentInParent2).TakeDamage(normalized * 200f, _center, (GameObject)null, (Player)null, true, false);
				}
				NetworkPhysicsObject component = ((Component)val).GetComponent<NetworkPhysicsObject>();
				if ((Object)(object)component != (Object)null && component.photonView.IsMine)
				{
					component.BulletPush(normalized * 2500f * num, Vector2.zero, (CharacterData)null);
				}
			}
		}

		private IEnumerator Effect()
		{
			SpriteRenderer blast = Visuals.CreateSprite("Blast", ((Component)this).transform, Visuals.Circle, Color.clear, 50);
			SpriteRenderer core = Visuals.CreateSprite("Core", ((Component)this).transform, Visuals.Circle, Color.clear, 51);
			SpriteRenderer ring = Visuals.CreateSprite("Ring", ((Component)this).transform, Visuals.Circle, Color.clear, 49);
			for (float t = 0f; t < 0.45f; t += Time.deltaTime)
			{
				float num = t / 0.45f;
				float num2 = 1f - Mathf.Pow(1f - num, 3f);
				((Component)blast).transform.localScale = Vector3.one * _radius * 2f * num2;
				((Component)ring).transform.localScale = Vector3.one * _radius * 2f * Mathf.Min(1f, num2 * 1.08f);
				((Component)core).transform.localScale = Vector3.one * _radius * 0.9f * (1f - num);
				blast.color = new Color(1f, 0.55f, 0.1f, 0.55f * (1f - num));
				ring.color = new Color(1f, 0.3f, 0.1f, 0.8f * (1f - num) * (1f - num));
				core.color = new Color(1f, 0.95f, 0.6f, 0.95f * (1f - num));
				yield return null;
			}
			yield return (object)new WaitForSeconds(0.15f);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class PowderKegMono : MonoBehaviour
	{
		public const float ImpactSpeed = 20f;

		private const float ImpactGracePeriod = 1f;

		private const float FallbackDelay = 0.3f;

		private static readonly Color KegTint = new Color(1f, 0.45f, 0.35f, 1f);

		private static readonly Color HoopColor = new Color(0.15f, 0.1f, 0.08f, 1f);

		private DamagableEvent _damagable;

		private Map _map;

		private float _sinceMapReady;

		private bool _mapReady;

		private bool _explosionCalled;

		internal float? PendingDps { get; private set; }

		public bool Exploded
		{
			get
			{
				if ((Object)(object)_damagable != (Object)null)
				{
					return _damagable.dead;
				}
				return false;
			}
		}

		public int KegId
		{
			get
			{
				PhotonView component = ((Component)this).GetComponent<PhotonView>();
				if (!((Object)(object)component != (Object)null))
				{
					return ((Object)this).GetInstanceID();
				}
				return component.ViewID;
			}
		}

		private void Start()
		{
			_damagable = ((Component)this).GetComponentInChildren<DamagableEvent>();
			if ((Object)(object)_damagable != (Object)null)
			{
				DamagableEvent damagable = _damagable;
				damagable.DieAction = (Action<Vector2>)Delegate.Combine(damagable.DieAction, new Action<Vector2>(OnDie));
			}
			PowderKegExplosion.RegisterRpc();
			JeusticeHazards.Log.LogInfo((object)string.Format("Powder keg {0} ready (crate HP: {1})", KegId, ((Object)(object)_damagable != (Object)null) ? _damagable.currentHP.ToString() : "no DamagableEvent!"));
			_map = ((Component)this).GetComponentInParent<Map>();
			if ((Object)(object)_map != (Object)null)
			{
				_mapReady = _map.hasEntered;
				Map map = _map;
				map.mapIsReadyAction = (Action)Delegate.Combine(map.mapIsReadyAction, (Action)delegate
				{
					_mapReady = true;
					_sinceMapReady = 0f;
				});
			}
			DecorateAsKeg();
		}

		private void DecorateAsKeg()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//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_006e: 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)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			SpriteRenderer componentInChildren = ((Component)this).GetComponentInChildren<SpriteRenderer>();
			SpriteRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<SpriteRenderer>();
			foreach (SpriteRenderer obj in componentsInChildren)
			{
				obj.color *= KegTint;
			}
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				float[] array = new float[2] { -0.28f, 0.28f };
				foreach (float num in array)
				{
					SpriteRenderer obj2 = Visuals.CreateSprite("Hoop", ((Component)componentInChildren).transform, Visuals.Square, HoopColor, ((Renderer)componentInChildren).sortingOrder + 1);
					((Renderer)obj2).sortingLayerID = ((Renderer)componentInChildren).sortingLayerID;
					((Component)obj2).transform.localPosition = new Vector3(0f, num, 0f);
					((Component)obj2).transform.localScale = new Vector3(1f, 0.1f, 1f);
				}
			}
		}

		private void Update()
		{
			if (_mapReady)
			{
				_sinceMapReady += TimeHandler.deltaTime;
			}
		}

		private void OnCollisionEnter2D(Collision2D collision)
		{
			//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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsMasterClient || Exploded || !_mapReady || _sinceMapReady < 1f)
			{
				return;
			}
			Rigidbody2D rigidbody = collision.rigidbody;
			if ((Object)(object)rigidbody == (Object)null || (Object)(object)((Component)rigidbody).GetComponentInParent<Player>() != (Object)null)
			{
				return;
			}
			Vector2 val = rigidbody.velocity;
			if (((Vector2)(ref val)).magnitude >= 20f)
			{
				val = collision.relativeVelocity;
				if (((Vector2)(ref val)).magnitude >= 20f)
				{
					ManualLogSource log = JeusticeHazards.Log;
					object arg = KegId;
					string name = ((Object)rigidbody).name;
					val = rigidbody.velocity;
					log.LogInfo((object)$"Powder keg {arg} hit by {name} at {((Vector2)(ref val)).magnitude:F1} u/s");
					Detonate(70f);
				}
			}
		}

		public void Detonate(float dps)
		{
			//IL_0030: 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_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)
			if (PhotonNetwork.IsMasterClient && !Exploded && !((Object)(object)_damagable == (Object)null))
			{
				PendingDps = dps;
				((Damagable)_damagable).TakeDamage(Vector2.up * 1000000f, Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, (Player)null, true, false);
			}
		}

		internal void OnKilledHere(Player killer)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (!_explosionCalled)
			{
				_explosionCalled = true;
				float num = (((Object)(object)killer != (Object)null) ? PlayerDps.Estimate(killer) : (PendingDps ?? 70f));
				JeusticeHazards.Log.LogInfo((object)string.Format("Powder keg {0} destroyed by {1}, DPS {2:F0}", KegId, ((Object)(object)killer != (Object)null) ? ("player " + killer.playerID) : "environment", num));
				PowderKegExplosion.Call(Vector2.op_Implicit(((Component)this).transform.position), num, KegId);
			}
		}

		private void OnDie(Vector2 damage)
		{
			//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)
			JeusticeHazards.Log.LogInfo((object)$"Powder keg {KegId} died");
			if (PhotonNetwork.IsMasterClient)
			{
				((MonoBehaviour)JeusticeHazards.Instance).StartCoroutine(Fallback(Vector2.op_Implicit(((Component)this).transform.position), KegId, _damagable.lastPlayer, PendingDps));
			}
		}

		private static IEnumerator Fallback(Vector2 center, int kegId, Player lastPlayer, float? pendingDps)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForSeconds(0.3f);
			if (!PowderKegExplosion.HasExploded(kegId))
			{
				float num = (((Object)(object)lastPlayer != (Object)null) ? PlayerDps.Estimate(lastPlayer) : (pendingDps ?? 70f));
				JeusticeHazards.Log.LogWarning((object)$"Powder keg {kegId}: no explosion received, host fallback with DPS {num:F0}");
				PowderKegExplosion.Call(center, num, kegId);
			}
		}
	}
	[HarmonyPatch(typeof(DamagableEvent), "TakeDamage", new Type[]
	{
		typeof(Vector2),
		typeof(Vector2),
		typeof(GameObject),
		typeof(Player),
		typeof(bool),
		typeof(bool)
	})]
	internal static class DamagableEvent_TakeDamage
	{
		private static void Prefix(DamagableEvent __instance, out bool __state)
		{
			__state = __instance.dead;
		}

		private static void Postfix(DamagableEvent __instance, Player damagingPlayer, bool __state)
		{
			if (__state || !__instance.dead)
			{
				return;
			}
			PowderKegMono powderKegMono = null;
			Transform val = ((Component)__instance).transform;
			while ((Object)(object)val != (Object)null && (Object)(object)powderKegMono == (Object)null)
			{
				powderKegMono = ((Component)val).GetComponent<PowderKegMono>();
				val = val.parent;
			}
			if (!((Object)(object)powderKegMono == (Object)null))
			{
				bool flag = (((Object)(object)damagingPlayer != (Object)null) ? damagingPlayer.data.view.IsMine : PhotonNetwork.IsMasterClient);
				JeusticeHazards.Log.LogInfo((object)$"Powder keg {powderKegMono.KegId} killing blow seen here (authority: {flag})");
				if (flag)
				{
					powderKegMono.OnKilledHere(damagingPlayer);
				}
			}
		}
	}
	public abstract class SyncedCycleMono : MonoBehaviour
	{
		public float delay;

		private float _elapsed;

		private int _lastLoop;

		private bool _mapEntered;

		private Map _map;

		private string _rpcKey;

		protected abstract float Cycle { get; }

		protected bool Running
		{
			get
			{
				if (!((Object)(object)_map == (Object)null))
				{
					return _mapEntered;
				}
				return true;
			}
		}

		protected float CycleTime => Mathf.Repeat(_elapsed + delay, Mathf.Max(0.05f, Cycle));

		protected int CycleIndex => Mathf.FloorToInt((_elapsed + delay) / Mathf.Max(0.05f, Cycle));

		protected virtual void Start()
		{
			_map = ((Component)this).GetComponentInParent<Map>();
			if ((Object)(object)_map == (Object)null)
			{
				return;
			}
			_mapEntered = _map.hasEntered;
			Map map = _map;
			map.mapIsReadyAction = (Action)Delegate.Combine(map.mapIsReadyAction, (Action)delegate
			{
				_mapEntered = true;
				_elapsed = 0f;
				_lastLoop = 0;
			});
			Map map2 = _map;
			map2.mapMovingOutAction = (Action)Delegate.Combine(map2.mapMovingOutAction, (Action)delegate
			{
				_mapEntered = false;
			});
			ChildRPC val = (((Object)(object)MapManager.instance != (Object)null) ? ((Component)MapManager.instance).GetComponent<ChildRPC>() : null);
			if ((Object)(object)val != (Object)null)
			{
				_rpcKey = string.Format("JeusticeHazards {0} {1} {2}", ((object)this).GetType().Name, ExtensionMethods.GetFieldValue((object)_map, "levelID"), ((Component)this).transform.GetSiblingIndex());
				val.childRPCsVector2[_rpcKey] = delegate(Vector2 data)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					_elapsed = data.x;
				};
			}
		}

		protected virtual void OnDestroy()
		{
			ChildRPC val = (((Object)(object)MapManager.instance != (Object)null) ? ((Component)MapManager.instance).GetComponent<ChildRPC>() : null);
			if (_rpcKey != null && (Object)(object)val != (Object)null)
			{
				val.childRPCsVector2.Remove(_rpcKey);
			}
		}

		protected virtual void Update()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			if (!Running)
			{
				return;
			}
			_elapsed += TimeHandler.deltaTime;
			int num = Mathf.FloorToInt(_elapsed / Mathf.Max(0.05f, Cycle));
			if (num != _lastLoop)
			{
				_lastLoop = num;
				if (_rpcKey != null && PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode)
				{
					((Component)MapManager.instance).GetComponent<ChildRPC>().CallFunction(_rpcKey, new Vector2(_elapsed, 0f));
				}
			}
		}
	}
}

JeusticeHazards.Editor.dll

Decompiled 14 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using JeusticeHazards.Editor.Properties;
using JeusticeHazards.MapObjects;
using JeusticeHazards.Properties;
using MapsExt;
using MapsExt.Editor.MapObjects;
using MapsExt.Editor.Properties;
using MapsExt.Editor.UI;
using MapsExt.Properties;
using MapsExt.Utils;
using Microsoft.CodeAnalysis;
using UnboundLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.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(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JeusticeHazards
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.jeustice.rounds.hazards.editor", "Jeustice Hazards Editor", "1.0.2")]
	[BepInProcess("Rounds.exe")]
	public class JeusticeHazardsEditor : BaseUnityPlugin
	{
		public const string ModId = "com.jeustice.rounds.hazards.editor";

		public const string ModName = "Jeustice Hazards Editor";
	}
}
namespace JeusticeHazards.Editor.Properties
{
	public abstract class FloatPropertyElement<T> : FloatElement where T : FloatProperty
	{
		private readonly float _step;

		protected FloatPropertyElement(string name, float min, float max, float sliderMax, float step)
			: base(name, min, max, min, sliderMax)
		{
			_step = step;
		}

		protected abstract T Create(float value);

		protected override float GetValue()
		{
			return ((ValueProperty<float>)PropertyExtensions.ReadProperty<T>(((InspectorElement)this).Context.InspectorTarget)).Value;
		}

		protected override void OnChange(float value, ChangeType changeType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			if ((int)changeType == 1 || (int)changeType == 2)
			{
				PropertyExtensions.WriteProperty<T>(((InspectorElement)this).Context.InspectorTarget, Create(Mathf.Round(value / _step) * _step));
			}
			if ((int)changeType == 2)
			{
				((InspectorElement)this).Context.Editor.TakeSnaphot();
			}
		}
	}
	public abstract class ComponentFloatPropertySerializer<T, TComponent> : IPropertySerializer<T>, IPropertyWriter<T>, IPropertyReader<T> where T : FloatProperty where TComponent : Component
	{
		protected abstract T Create(float value);

		protected abstract float Get(TComponent component);

		protected abstract void Set(TComponent component, float value);

		public virtual void WriteProperty(T property, GameObject target)
		{
			Set(ExtensionMethods.GetOrAddComponent<TComponent>(target, false), ((ValueProperty<float>)property).Value);
		}

		public virtual T ReadProperty(GameObject instance)
		{
			return Create(Get(instance.GetComponent<TComponent>()));
		}
	}
}
namespace JeusticeHazards.Editor.MapObjects
{
	[EditorMapObject(typeof(LaserData), "Laser", Category = "Jeustice Hazards")]
	public sealed class EditorLaser : Laser
	{
	}
	[EditorMapObject(typeof(PowderKegData), "Powder Keg", Category = "Jeustice Hazards")]
	public sealed class EditorPowderKeg : PowderKeg
	{
		public override void OnInstantiate(GameObject instance)
		{
			((PowderKeg)this).OnInstantiate(instance);
			GameObjectUtils.DisableRigidbody(instance);
			Object.Destroy((Object)(object)instance.GetComponent<Damagable>());
		}
	}
	[EditorPropertySerializer(typeof(PowderKegProperty))]
	public class EditorPowderKegPropertySerializer : PowderKegPropertySerializer, IPropertyReader<PowderKegProperty>
	{
		public PowderKegProperty ReadProperty(GameObject instance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			return new PowderKegProperty();
		}

		public override void WriteProperty(PowderKegProperty property, GameObject target)
		{
		}
	}
	[InspectorElement(typeof(LaserOffTimeProperty))]
	public class LaserOffTimeElement : FloatPropertyElement<LaserOffTimeProperty>
	{
		public LaserOffTimeElement()
			: base("Idle time (s)", 0f, 60f, 10f, 0.25f)
		{
		}

		protected override LaserOffTimeProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserOffTimeProperty(value);
		}
	}
	[InspectorElement(typeof(LaserWarnTimeProperty))]
	public class LaserWarnTimeElement : FloatPropertyElement<LaserWarnTimeProperty>
	{
		public LaserWarnTimeElement()
			: base("Warning time (s)", 0f, 10f, 3f, 0.25f)
		{
		}

		protected override LaserWarnTimeProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserWarnTimeProperty(value);
		}
	}
	[InspectorElement(typeof(LaserOnTimeProperty))]
	public class LaserOnTimeElement : FloatPropertyElement<LaserOnTimeProperty>
	{
		public LaserOnTimeElement()
			: base("Firing time (s)", 0f, 60f, 10f, 0.25f)
		{
		}

		protected override LaserOnTimeProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserOnTimeProperty(value);
		}
	}
	[InspectorElement(typeof(LaserDelayProperty))]
	public class LaserDelayElement : FloatPropertyElement<LaserDelayProperty>
	{
		public LaserDelayElement()
			: base("Cycle delay (s)", 0f, 60f, 10f, 0.25f)
		{
		}

		protected override LaserDelayProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserDelayProperty(value);
		}
	}
	[EditorPropertySerializer(typeof(LaserOffTimeProperty))]
	public class EditorLaserOffTimeSerializer : ComponentFloatPropertySerializer<LaserOffTimeProperty, LaserMono>
	{
		protected override LaserOffTimeProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserOffTimeProperty(value);
		}

		protected override float Get(LaserMono laser)
		{
			return laser.offTime;
		}

		protected override void Set(LaserMono laser, float value)
		{
			laser.offTime = value;
		}
	}
	[EditorPropertySerializer(typeof(LaserWarnTimeProperty))]
	public class EditorLaserWarnTimeSerializer : ComponentFloatPropertySerializer<LaserWarnTimeProperty, LaserMono>
	{
		protected override LaserWarnTimeProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserWarnTimeProperty(value);
		}

		protected override float Get(LaserMono laser)
		{
			return laser.warnTime;
		}

		protected override void Set(LaserMono laser, float value)
		{
			laser.warnTime = value;
		}
	}
	[EditorPropertySerializer(typeof(LaserOnTimeProperty))]
	public class EditorLaserOnTimeSerializer : ComponentFloatPropertySerializer<LaserOnTimeProperty, LaserMono>
	{
		protected override LaserOnTimeProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserOnTimeProperty(value);
		}

		protected override float Get(LaserMono laser)
		{
			return laser.onTime;
		}

		protected override void Set(LaserMono laser, float value)
		{
			laser.onTime = value;
		}
	}
	[EditorPropertySerializer(typeof(LaserDelayProperty))]
	public class EditorLaserDelaySerializer : ComponentFloatPropertySerializer<LaserDelayProperty, LaserMono>
	{
		protected override LaserDelayProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new LaserDelayProperty(value);
		}

		protected override float Get(LaserMono laser)
		{
			return ((SyncedCycleMono)laser).delay;
		}

		protected override void Set(LaserMono laser, float value)
		{
			((SyncedCycleMono)laser).delay = value;
		}
	}
	[EditorMapObject(typeof(LauncherData), "Launcher", Category = "Jeustice Hazards")]
	public sealed class EditorLauncher : Launcher
	{
	}
	[EditorMapObject(typeof(FlipperData), "Flipper", Category = "Jeustice Hazards")]
	public sealed class EditorFlipper : Flipper
	{
	}
	[InspectorElement(typeof(KickerIntervalProperty))]
	public class KickerIntervalElement : FloatPropertyElement<KickerIntervalProperty>
	{
		public KickerIntervalElement()
			: base("Fires every (s)", 0.5f, 60f, 10f, 0.25f)
		{
		}

		protected override KickerIntervalProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new KickerIntervalProperty(value);
		}
	}
	[InspectorElement(typeof(KickerDelayProperty))]
	public class KickerDelayElement : FloatPropertyElement<KickerDelayProperty>
	{
		public KickerDelayElement()
			: base("Cycle delay (s)", 0f, 60f, 10f, 0.25f)
		{
		}

		protected override KickerDelayProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new KickerDelayProperty(value);
		}
	}
	[InspectorElement(typeof(KickerPowerProperty))]
	public class KickerPowerElement : FloatPropertyElement<KickerPowerProperty>
	{
		public KickerPowerElement()
			: base("Launch speed", 0f, 200f, 100f, 1f)
		{
		}

		protected override KickerPowerProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new KickerPowerProperty(value);
		}
	}
	[InspectorElement(typeof(FlipAngleProperty))]
	public class FlipAngleElement : FloatPropertyElement<FlipAngleProperty>
	{
		public FlipAngleElement()
			: base("Flip angle", -180f, 180f, 90f, 5f)
		{
		}

		protected override FlipAngleProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new FlipAngleProperty(value);
		}
	}
	[EditorPropertySerializer(typeof(KickerIntervalProperty))]
	public class EditorKickerIntervalSerializer : ComponentFloatPropertySerializer<KickerIntervalProperty, KickerMono>
	{
		protected override KickerIntervalProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new KickerIntervalProperty(value);
		}

		protected override float Get(KickerMono kicker)
		{
			return kicker.interval;
		}

		protected override void Set(KickerMono kicker, float value)
		{
			kicker.interval = value;
		}
	}
	[EditorPropertySerializer(typeof(KickerDelayProperty))]
	public class EditorKickerDelaySerializer : ComponentFloatPropertySerializer<KickerDelayProperty, KickerMono>
	{
		protected override KickerDelayProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new KickerDelayProperty(value);
		}

		protected override float Get(KickerMono kicker)
		{
			return ((SyncedCycleMono)kicker).delay;
		}

		protected override void Set(KickerMono kicker, float value)
		{
			((SyncedCycleMono)kicker).delay = value;
		}
	}
	[EditorPropertySerializer(typeof(KickerPowerProperty))]
	public class EditorKickerPowerSerializer : ComponentFloatPropertySerializer<KickerPowerProperty, KickerMono>
	{
		protected override KickerPowerProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new KickerPowerProperty(value);
		}

		protected override float Get(KickerMono kicker)
		{
			return kicker.power;
		}

		protected override void Set(KickerMono kicker, float value)
		{
			kicker.power = value;
		}
	}
	[EditorPropertySerializer(typeof(FlipAngleProperty))]
	public class EditorFlipAngleSerializer : ComponentFloatPropertySerializer<FlipAngleProperty, FlipperMono>
	{
		protected override FlipAngleProperty Create(float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			return new FlipAngleProperty(value);
		}

		protected override float Get(FlipperMono flipper)
		{
			return flipper.flipAngle;
		}

		protected override void Set(FlipperMono flipper, float value)
		{
			flipper.flipAngle = value;
		}
	}
}