Decompiled source of NeonArsenal v0.1.2

NeonArsenal.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModShared;
using Photon.Pun;
using Photon.Realtime;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NeonArsenal")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NeonArsenal")]
[assembly: AssemblyTitle("NeonArsenal")]
[assembly: AssemblyVersion("1.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 ModShared
{
	internal static class ConfigSync
	{
		private const float Interval = 2f;

		private static ConfigFile _cfg;

		private static ManualLogSource _log;

		private static string _property;

		private static readonly HashSet<string> LocalKeys = new HashSet<string>();

		private static readonly Dictionary<ConfigDefinition, string> Own = new Dictionary<ConfigDefinition, string>();

		private static string _published;

		private static string _applied;

		internal static bool Overridden => Own.Count > 0;

		internal static float TickInterval => 2f;

		internal static event Action Changed;

		internal static void Init(ConfigFile cfg, string modName, ManualLogSource log, params string[] localKeys)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			_cfg = cfg;
			_log = log;
			_property = modName + "_config";
			foreach (string item in localKeys)
			{
				LocalKeys.Add(item);
			}
			GameObject val = new GameObject(modName + "_ConfigSync")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<ConfigSyncRunner>().Tick = Tick;
		}

		private static void Tick()
		{
			//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_006b: Expected O, but got Unknown
			//IL_0072: Expected O, but got Unknown
			if (_cfg == null)
			{
				return;
			}
			if (!SemiFunc.IsMultiplayer() || !PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null)
			{
				Restore();
				_published = null;
			}
			else if (PhotonNetwork.IsMasterClient)
			{
				Restore();
				string text = Serialize();
				if (!(text == _published))
				{
					_published = text;
					Room currentRoom = PhotonNetwork.CurrentRoom;
					Hashtable val = new Hashtable();
					((Dictionary<object, object>)val).Add((object)_property, (object)text);
					currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
					_log.LogInfo((object)"Settings shared with the other players.");
				}
			}
			else
			{
				_published = null;
				if (((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)_property, out object value) && value is string text2 && !(text2 == _applied))
				{
					Apply(text2);
				}
			}
		}

		private static bool IsLocal(ConfigDefinition def)
		{
			return LocalKeys.Contains(def.Section + "|" + def.Key);
		}

		private static string Serialize()
		{
			StringBuilder stringBuilder = new StringBuilder();
			foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in _cfg)
			{
				if (!IsLocal(item.Key))
				{
					string text = item.Value.GetSerializedValue() ?? "";
					stringBuilder.Append(item.Key.Section).Append('\t').Append(item.Key.Key)
						.Append('\t')
						.Append(text.Replace("\n", " ").Replace("\t", " "))
						.Append('\n');
				}
			}
			return stringBuilder.ToString();
		}

		private static void Apply(string data)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			int num = 0;
			_cfg.SaveOnConfigSet = false;
			string[] array = data.Split('\n');
			for (int i = 0; i < array.Length; i++)
			{
				string[] array2 = array[i].Split('\t');
				if (array2.Length < 3)
				{
					continue;
				}
				ConfigDefinition val = new ConfigDefinition(array2[0], array2[1]);
				if (IsLocal(val) || !_cfg.ContainsKey(val))
				{
					continue;
				}
				ConfigEntryBase val2 = _cfg[val];
				try
				{
					string serializedValue = val2.GetSerializedValue();
					if (!(serializedValue == array2[2]))
					{
						if (!Own.ContainsKey(val))
						{
							Own[val] = serializedValue;
						}
						val2.SetSerializedValue(array2[2]);
						num++;
					}
				}
				catch (Exception ex)
				{
					_log.LogDebug((object)("Host setting " + array2[0] + "." + array2[1] + " ignored: " + ex.Message));
				}
			}
			_applied = data;
			if (Own.Count == 0)
			{
				_cfg.SaveOnConfigSet = true;
			}
			_log.LogInfo((object)$"Using the host's settings ({num} value(s) differ from yours).");
			if (num > 0)
			{
				Notify();
			}
		}

		private static void Restore()
		{
			_applied = null;
			if (Own.Count == 0)
			{
				return;
			}
			foreach (KeyValuePair<ConfigDefinition, string> item in Own)
			{
				try
				{
					if (_cfg.ContainsKey(item.Key))
					{
						_cfg[item.Key].SetSerializedValue(item.Value);
					}
				}
				catch (Exception ex)
				{
					_log.LogDebug((object)("Could not restore " + item.Key.Section + "." + item.Key.Key + ": " + ex.Message));
				}
			}
			Own.Clear();
			_cfg.SaveOnConfigSet = true;
			_log.LogInfo((object)"Back to your own settings.");
			Notify();
		}

		private static void Notify()
		{
			try
			{
				ConfigSync.Changed?.Invoke();
			}
			catch (Exception arg)
			{
				_log.LogError((object)$"Applying changed settings failed: {arg}");
			}
		}
	}
	public class ConfigSyncRunner : MonoBehaviour
	{
		internal Action Tick;

		private float _timer;

		private void Update()
		{
			_timer -= Time.unscaledDeltaTime;
			if (_timer > 0f)
			{
				return;
			}
			_timer = ConfigSync.TickInterval;
			try
			{
				Tick?.Invoke();
			}
			catch (Exception)
			{
			}
		}
	}
}
namespace NeonArsenal
{
	public class KatanaAirSlash : MonoBehaviour
	{
		private PhotonView _photonView;

		private PhysGrabObject _physGrabObject;

		private ItemMelee _melee;

		private Transform _tip;

		private Vector3 _prevTip;

		private bool _hasPrev;

		private float _cooldown;

		private void Awake()
		{
			_photonView = ((Component)this).GetComponent<PhotonView>();
			_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			_melee = ((Component)this).GetComponent<ItemMelee>();
			_tip = ((Component)this).transform.Find("Katana Visual/Tip");
		}

		private void FixedUpdate()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_tip == (Object)null || (Object)(object)_physGrabObject == (Object)null || !Plugin.AirSlashEnabled.Value)
			{
				return;
			}
			if (_cooldown > 0f)
			{
				_cooldown -= Time.fixedDeltaTime;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (!_physGrabObject.grabbed || _physGrabObject.playerGrabbing.Count == 0)
			{
				_hasPrev = false;
				return;
			}
			Vector3 position = _tip.position;
			if (_hasPrev && _cooldown <= 0f)
			{
				Vector3 val = (position - _prevTip) / Time.fixedDeltaTime;
				bool num = val.y < 0f - Plugin.AirSlashSwingSpeed.Value;
				bool flag = 0f - val.y > ((Vector3)(ref val)).magnitude * 0.6f;
				if (num && flag)
				{
					Fire(position);
				}
			}
			_prevTip = position;
			_hasPrev = true;
		}

		private void Fire(Vector3 tip)
		{
			//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_0076: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00e3: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: 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_0075: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			_cooldown = Plugin.AirSlashCooldown.Value;
			Vector3 val = ((Component)this).transform.position;
			PhysGrabber val2 = _physGrabObject.playerGrabbing[0];
			if ((Object)(object)val2 != (Object)null && (Object)(object)val2.playerAvatar != (Object)null)
			{
				Transform playerTransform = val2.playerAvatar.playerTransform;
				val = (((Object)(object)playerTransform != (Object)null) ? playerTransform.position : ((Component)val2.playerAvatar).transform.position);
			}
			Vector3 val3 = tip - val;
			val3.y = 0f;
			if (((Vector3)(ref val3)).sqrMagnitude < 0.01f)
			{
				val3 = ((Component)this).transform.forward;
				val3.y = 0f;
			}
			if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f)
			{
				val3 = Vector3.forward;
			}
			((Vector3)(ref val3)).Normalize();
			Vector3 val4 = new Vector3(val.x, val.y + 0.9f, val.z) + val3 * 0.8f;
			if (SemiFunc.IsMultiplayer() && (Object)(object)_photonView != (Object)null)
			{
				_photonView.RPC("AirSlashRPC", (RpcTarget)0, new object[2] { val4, val3 });
			}
			else
			{
				SpawnSlash(val4, val3);
			}
		}

		[PunRPC]
		private void AirSlashRPC(Vector3 pos, Vector3 dir, PhotonMessageInfo info)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(info))
			{
				SpawnSlash(pos, dir);
			}
		}

		private void SpawnSlash(Vector3 pos, Vector3 dir)
		{
			//IL_0023: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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)
			_cooldown = Plugin.AirSlashCooldown.Value;
			if ((Object)(object)Plugin.SlashPrefab == (Object)null)
			{
				return;
			}
			Object.Instantiate<GameObject>(Plugin.SlashPrefab, pos, Quaternion.LookRotation(dir, Vector3.up));
			try
			{
				if ((Object)(object)_melee != (Object)null && _melee.soundSwing != null)
				{
					_melee.soundSwing.Play(pos, 1f, 1f, 1f, 1f);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("Air slash sound failed: " + ex.Message));
			}
		}
	}
	public class AirSlashProjectile : MonoBehaviour
	{
		internal const string VisualName = "Visual";

		internal const string LightName = "Light";

		internal const string HurtName = "Hurt";

		private const float FadeTime = 0.18f;

		private Transform _visual;

		private Light _light;

		private GameObject _hurt;

		private float _lightIntensity;

		private float _speed;

		private float _range;

		private float _travelled;

		private float _fade = -1f;

		private int _wallMask;

		private static readonly FieldRef<EnemyParent, Enemy> ParentEnemy = AccessTools.FieldRefAccess<EnemyParent, Enemy>("Enemy");

		private static readonly FieldRef<Enemy, EnemyHealth> EnemyHealthRef = AccessTools.FieldRefAccess<Enemy, EnemyHealth>("Health");

		private const float HitRadius = 0.9f;

		private static readonly Collider[] Hits = (Collider[])(object)new Collider[64];

		private readonly HashSet<EnemyParent> _hit = new HashSet<EnemyParent>();

		private void Start()
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			_visual = ((Component)this).transform.Find("Visual");
			Transform val = ((Component)this).transform.Find("Light");
			if ((Object)(object)val != (Object)null)
			{
				_light = ((Component)val).GetComponent<Light>();
			}
			if ((Object)(object)_light != (Object)null)
			{
				_lightIntensity = _light.intensity;
			}
			Transform val2 = ((Component)this).transform.Find("Hurt");
			if ((Object)(object)val2 != (Object)null)
			{
				_hurt = ((Component)val2).gameObject;
				_hurt.SetActive(true);
			}
			_speed = Plugin.AirSlashSpeed.Value;
			_range = Plugin.AirSlashRange.Value;
			_wallMask = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct());
		}

		private void Update()
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (_fade >= 0f)
			{
				_fade -= Time.deltaTime;
				float num = Mathf.Clamp01(_fade / 0.18f);
				if ((Object)(object)_visual != (Object)null)
				{
					_visual.localScale = new Vector3(num, 1f, num);
				}
				if ((Object)(object)_light != (Object)null)
				{
					_light.intensity = _lightIntensity * num;
				}
				if (_fade <= 0f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			float num2 = _speed * Time.deltaTime;
			if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, num2 + 0.3f, _wallMask, (QueryTriggerInteraction)1))
			{
				BeginFade();
				return;
			}
			Vector3 position = ((Component)this).transform.position;
			Transform transform = ((Component)this).transform;
			transform.position += ((Component)this).transform.forward * num2;
			_travelled += num2;
			HitEnemies(position, ((Component)this).transform.position);
			((Component)this).transform.localScale = Vector3.one * Mathf.Lerp(1f, 1.3f, _travelled / _range);
			if (_travelled >= _range)
			{
				BeginFade();
			}
		}

		private void HitEnemies(Vector3 from, Vector3 to)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//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_0028: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_002c: 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)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_013d: 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_0143: 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)
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			try
			{
				Vector3 val = Vector3.up * 0.5f;
				for (int i = 0; i < 2; i++)
				{
					Vector3 val2 = ((i == 0) ? val : (-val));
					int num = Physics.OverlapCapsuleNonAlloc(from + val2, to + val2, 0.9f, Hits, -1, (QueryTriggerInteraction)2);
					for (int j = 0; j < num; j++)
					{
						Collider val3 = Hits[j];
						if (!((Object)(object)val3 == (Object)null))
						{
							EnemyParent componentInParent = ((Component)val3).GetComponentInParent<EnemyParent>();
							if ((Object)(object)componentInParent != (Object)null)
							{
								Damage(componentInParent);
							}
						}
					}
				}
				if ((Object)(object)EnemyDirector.instance == (Object)null || EnemyDirector.instance.enemiesSpawned == null)
				{
					return;
				}
				foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned)
				{
					if ((Object)(object)item == (Object)null || _hit.Contains(item))
					{
						continue;
					}
					Enemy val4 = ParentEnemy.Invoke(item);
					if ((Object)(object)val4 == (Object)null || !((Component)val4).gameObject.activeInHierarchy)
					{
						continue;
					}
					Vector3 val5 = (((Object)(object)val4.CenterTransform != (Object)null) ? val4.CenterTransform.position : ((Component)val4).transform.position) - to;
					if (!(Mathf.Abs(val5.y) > 2.5f))
					{
						val5.y = 0f;
						if (((Vector3)(ref val5)).magnitude <= 1.3f)
						{
							Damage(item);
						}
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("Air slash hit check failed: " + ex.Message));
			}
		}

		private void Damage(EnemyParent parent)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (_hit.Add(parent))
			{
				Enemy val = ParentEnemy.Invoke(parent);
				EnemyHealth val2 = (((Object)(object)val != (Object)null) ? EnemyHealthRef.Invoke(val) : null);
				if (!((Object)(object)val2 == (Object)null))
				{
					val2.Hurt(Plugin.AirSlashDamage.Value, ((Component)this).transform.forward);
					Plugin.Log.LogInfo((object)$"Air slash hit {((Object)parent).name} for {Plugin.AirSlashDamage.Value}.");
				}
			}
		}

		private void BeginFade()
		{
			_fade = 0.18f;
			if ((Object)(object)_hurt != (Object)null)
			{
				_hurt.SetActive(false);
			}
		}
	}
	internal class MeshBuilder
	{
		private readonly List<Vector3> _verts = new List<Vector3>();

		private readonly List<Vector2> _uvs = new List<Vector2>();

		private readonly List<int> _tris = new List<int>();

		private readonly float _uvScale;

		public MeshBuilder(float uvScale = 1f)
		{
			_uvScale = uvScale;
		}

		public void Tri(Vector3 a, Vector3 b, Vector3 c, Vector3 outward)
		{
			//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_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_0008: Unknown result type (might be due to invalid IL or missing references)
			//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_0013: 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_0015: 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_004e: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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)
			//IL_0023: 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_0025: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.Cross(b - a, c - a);
			if (Vector3.Dot(val, outward) < 0f)
			{
				Vector3 val2 = b;
				b = c;
				c = val2;
				val = -val;
			}
			int count = _verts.Count;
			_verts.Add(a);
			_verts.Add(b);
			_verts.Add(c);
			_uvs.Add(Uv(a, val));
			_uvs.Add(Uv(b, val));
			_uvs.Add(Uv(c, val));
			_tris.Add(count);
			_tris.Add(count + 1);
			_tris.Add(count + 2);
		}

		public void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 outward)
		{
			//IL_0001: 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_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_000c: 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_000e: 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)
			Tri(a, b, c, outward);
			Tri(a, c, d, outward);
		}

		private Vector2 Uv(Vector3 p, Vector3 n)
		{
			//IL_0000: 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_0018: 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_0062: 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_004d: 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)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Abs(n.x);
			float num2 = Mathf.Abs(n.y);
			float num3 = Mathf.Abs(n.z);
			Vector2 val = default(Vector2);
			if (num >= num2 && num >= num3)
			{
				((Vector2)(ref val))..ctor(p.z, p.y);
			}
			else if (num2 >= num3)
			{
				((Vector2)(ref val))..ctor(p.z, p.x);
			}
			else
			{
				((Vector2)(ref val))..ctor(p.x, p.y);
			}
			return val * _uvScale;
		}

		public Mesh ToMesh(string name)
		{
			//IL_0000: 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)
			//IL_000c: 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)
			//IL_002d: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			Mesh val = new Mesh
			{
				name = name,
				hideFlags = (HideFlags)32
			};
			val.SetVertices(_verts);
			val.SetUVs(0, _uvs);
			val.SetTriangles(_tris, 0);
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}

		public static Vector3 Centroid(Vector3[] ring)
		{
			//IL_0000: 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)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0015: 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_001b: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			foreach (Vector3 val2 in ring)
			{
				val += val2;
			}
			return val / (float)ring.Length;
		}

		public static void Loft(Vector3[] a, Vector3[] b, params MeshBuilder[] perEdge)
		{
			//IL_0001: 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_000c: 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_001b: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_0065: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (Centroid(a) + Centroid(b)) * 0.5f;
			for (int i = 0; i < a.Length; i++)
			{
				int num = (i + 1) % a.Length;
				perEdge[Mathf.Min(i, perEdge.Length - 1)].Quad(outward: (a[i] + a[num] + b[num] + b[i]) * 0.25f - val, a: a[i], b: a[num], c: b[num], d: b[i]);
			}
		}

		public void Cap(Vector3[] ring, Vector3 outward)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Vector3 a = Centroid(ring);
			for (int i = 0; i < ring.Length; i++)
			{
				Tri(a, ring[i], ring[(i + 1) % ring.Length], outward);
			}
		}
	}
	internal static class KatanaModel
	{
		public class Parts
		{
			public Mesh Steel;

			public Mesh Carbon;

			public Mesh Neon;

			public Mesh Accent;
		}

		public const float MinZ = -0.295f;

		private const float BladeStart = 0.012f;

		private const float BladeLen = 0.7f;

		public const float MaxZ = 0.712f;

		public const float Length = 1.007f;

		private const float BladeWidth = 0.034f;

		private const float BladeThick = 0.007f;

		private const float Sori = 0.03f;

		private const float TipStart = 0.9f;

		private static float BladeYOffset(float t)
		{
			return 0.03f * t * t;
		}

		private static Vector3[] BladeRing(float t)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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)
			float num = 0.012f + t * 0.7f;
			float s = ((t <= 0.9f) ? 1f : Mathf.Lerp(1f, 0.03f, (t - 0.9f) / 0.100000024f));
			float num2 = 0.007f * Mathf.Lerp(0.35f, 1f, s);
			float top = 0.017f;
			float yo = BladeYOffset(t);
			return (Vector3[])(object)new Vector3[5]
			{
				new Vector3((0f - num2) * 0.5f, Y(top), num),
				new Vector3(num2 * 0.5f, Y(top), num),
				new Vector3(num2 * 0.5f, Y(-0.0068000006f), num),
				new Vector3(0f, Y(0f - top), num),
				new Vector3((0f - num2) * 0.5f, Y(-0.0068000006f), num)
			};
			float Y(float y)
			{
				return top - (top - y) * s + yo;
			}
		}

		private static Vector3[] FullerRing(float t)
		{
			//IL_002d: 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_0042: 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_0057: 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_006d: 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)
			float num = 0.012f + t * 0.7f;
			float num2 = 0.0043f;
			float num3 = BladeYOffset(t);
			return (Vector3[])(object)new Vector3[4]
			{
				new Vector3(0f - num2, 0.0095f + num3, num),
				new Vector3(num2, 0.0095f + num3, num),
				new Vector3(num2, 0.0055f + num3, num),
				new Vector3(0f - num2, 0.0055f + num3, num)
			};
		}

		private static Vector3[] EllipseRing(float z, float rx, float ry, int n)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[n];
			for (int i = 0; i < n; i++)
			{
				float num = (float)i * MathF.PI * 2f / (float)n;
				array[i] = new Vector3(Mathf.Cos(num) * rx, Mathf.Sin(num) * ry, z);
			}
			return array;
		}

		private static Vector3[] GuardRing(float z, float scale)
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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)
			Vector2[] array = (Vector2[])(object)new Vector2[8]
			{
				new Vector2(0.012f, 0.05f),
				new Vector2(0.03f, 0.02f),
				new Vector2(0.03f, -0.02f),
				new Vector2(0.012f, -0.05f),
				new Vector2(-0.012f, -0.05f),
				new Vector2(-0.03f, -0.02f),
				new Vector2(-0.03f, 0.02f),
				new Vector2(-0.012f, 0.05f)
			};
			Vector3[] array2 = (Vector3[])(object)new Vector3[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array2[i] = new Vector3(array[i].x * scale, array[i].y * scale, z);
			}
			return array2;
		}

		private static void Solid(MeshBuilder mb, Vector3[] a, Vector3[] b)
		{
			//IL_0013: 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)
			MeshBuilder.Loft(a, b, mb);
			mb.Cap(a, Vector3.back);
			mb.Cap(b, Vector3.forward);
		}

		public static Parts Build()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			MeshBuilder meshBuilder = new MeshBuilder(20f);
			MeshBuilder meshBuilder2 = new MeshBuilder(28f);
			MeshBuilder meshBuilder3 = new MeshBuilder();
			MeshBuilder meshBuilder4 = new MeshBuilder();
			Vector3[] array = BladeRing(0f);
			for (int i = 1; i <= 20; i++)
			{
				Vector3[] array2 = BladeRing((float)i / 20f);
				MeshBuilder.Loft(array, array2, meshBuilder, meshBuilder, meshBuilder3, meshBuilder3, meshBuilder);
				array = array2;
			}
			meshBuilder.Cap(array, Vector3.forward);
			Vector3[] array3 = FullerRing(0.05f);
			meshBuilder3.Cap(array3, Vector3.back);
			for (int j = 1; j <= 14; j++)
			{
				Vector3[] array4 = FullerRing(Mathf.Lerp(0.05f, 0.86f, (float)j / 14f));
				MeshBuilder.Loft(array3, array4, meshBuilder3);
				array3 = array4;
			}
			meshBuilder3.Cap(array3, Vector3.forward);
			Solid(meshBuilder, HabakiRing(0.012f), HabakiRing(0.046f));
			Solid(meshBuilder2, GuardRing(0f, 1f), GuardRing(0.012f, 1f));
			Solid(meshBuilder4, GuardRing(0.004f, 1.06f), GuardRing(0.008f, 1.06f));
			float[] array5 = new float[4] { -0.27f, -0.18f, -0.09f, 0f };
			float[] array6 = new float[4] { 1f, 0.93f, 0.93f, 1f };
			for (int k = 0; k < array5.Length - 1; k++)
			{
				MeshBuilder.Loft(EllipseRing(array5[k], 0.013f * array6[k], 0.0175f * array6[k], 10), EllipseRing(array5[k + 1], 0.013f * array6[k + 1], 0.0175f * array6[k + 1], 10), meshBuilder2);
			}
			float[] array7 = new float[3] { -0.06f, -0.135f, -0.21f };
			foreach (float num in array7)
			{
				Solid(meshBuilder4, EllipseRing(num - 0.003f, 0.014040001f, 0.018900001f, 10), EllipseRing(num + 0.003f, 0.014040001f, 0.018900001f, 10));
			}
			Solid(meshBuilder, EllipseRing(-0.295f, 0.01456f, 0.0196f, 10), EllipseRing(-0.27f, 0.01456f, 0.0196f, 10));
			Solid(meshBuilder4, EllipseRing(-0.297f, 0.0078000003f, 0.010500001f, 10), EllipseRing(-0.294f, 0.0078000003f, 0.010500001f, 10));
			return new Parts
			{
				Steel = meshBuilder.ToMesh("Katana Steel"),
				Carbon = meshBuilder2.ToMesh("Katana Carbon"),
				Neon = meshBuilder3.ToMesh("Katana Neon"),
				Accent = meshBuilder4.ToMesh("Katana Accent")
			};
			static Vector3[] HabakiRing(float z)
			{
				//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_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: 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_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				return (Vector3[])(object)new Vector3[4]
				{
					new Vector3(-0.0065f, 0.021f, z),
					new Vector3(0.0065f, 0.021f, z),
					new Vector3(0.0065f, -0.021f, z),
					new Vector3(-0.0065f, -0.021f, z)
				};
			}
		}

		public static Mesh BuildSlash()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			MeshBuilder meshBuilder = new MeshBuilder();
			Vector3[] array = Ring(0f);
			meshBuilder.Cap(array, Vector3.down);
			for (int i = 1; i <= 16; i++)
			{
				Vector3[] array2 = Ring((float)i / 16f);
				MeshBuilder.Loft(array, array2, meshBuilder);
				array = array2;
			}
			meshBuilder.Cap(array, Vector3.up);
			return meshBuilder.ToMesh("Katana Air Slash");
			static Vector3[] Ring(float k)
			{
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: 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_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: 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)
				//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_00a5: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: 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_00c6: 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_00d3: 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)
				float num = Mathf.Lerp(-70f, 70f, k) * (MathF.PI / 180f);
				float num2 = Mathf.Max(0.03f, Mathf.Cos((k - 0.5f) * MathF.PI));
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(0f, Mathf.Sin(num), Mathf.Cos(num));
				Vector3 val2 = val * 0.9f - Vector3.forward * 0.67499995f;
				return (Vector3[])(object)new Vector3[4]
				{
					val2 + val * (0.1f * num2),
					val2 + Vector3.right * (0.018f * num2),
					val2 - val * (0.1f * num2),
					val2 - Vector3.right * (0.018f * num2)
				};
			}
		}

		public static Texture2D BuildCarbonTexture()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_001d: 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: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, true)
			{
				name = "Katana Carbon Weave",
				wrapMode = (TextureWrapMode)0,
				filterMode = (FilterMode)1,
				hideFlags = (HideFlags)32
			};
			Color[] array = (Color[])(object)new Color[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					int num = j / 8;
					int num2 = i / 8;
					bool num3 = (num + num2) % 4 < 2;
					float num4 = Mathf.Sin(((float)(num3 ? (i % 8) : (j % 8)) + 0.5f) / 8f * MathF.PI);
					float num5 = (num3 ? Mathf.Lerp(0.05f, 0.3f, num4) : Mathf.Lerp(0.03f, 0.17f, num4));
					array[i * 64 + j] = new Color(num5, num5, num5 * 1.05f, 1f);
				}
			}
			val.SetPixels(array);
			val.Apply(true, false);
			return val;
		}
	}
	[BepInPlugin("Ondra.NeonArsenal", "NeonArsenal", "0.1.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "Ondra.NeonArsenal";

		public const string Name = "NeonArsenal";

		public const string Version = "0.1.2";

		private const string VanillaPrefabPath = "Items/Item Melee Sword";

		private const string NewItemId = "Item Melee Neon Katana";

		internal const string VisualName = "Katana Visual";

		internal const string TipName = "Tip";

		internal static ManualLogSource Log;

		internal static ConfigEntry<string> DisplayName;

		internal static ConfigEntry<float> DamageMultiplier;

		internal static ConfigEntry<float> PriceMultiplier;

		internal static ConfigEntry<float> LengthMultiplier;

		internal static ConfigEntry<Color> NeonColor;

		internal static ConfigEntry<Color> AccentColor;

		internal static ConfigEntry<float> NeonBrightness;

		internal static ConfigEntry<bool> NeonLight;

		internal static ConfigEntry<bool> FlipBlade;

		internal static ConfigEntry<bool> FlipEdge;

		internal static ConfigEntry<bool> AirSlashEnabled;

		internal static ConfigEntry<int> AirSlashDamage;

		internal static ConfigEntry<float> AirSlashCooldown;

		internal static ConfigEntry<float> AirSlashSwingSpeed;

		internal static ConfigEntry<float> AirSlashSpeed;

		internal static ConfigEntry<float> AirSlashRange;

		internal static ConfigEntry<bool> AirSlashHurtsPlayers;

		internal static GameObject SlashPrefab;

		private static readonly string[] TextureProps = new string[9] { "_BumpMap", "_MetallicGlossMap", "_SpecGlossMap", "_OcclusionMap", "_EmissionMap", "_ParallaxMap", "_DetailAlbedoMap", "_DetailNormalMap", "_DetailMask" };

		private static readonly string[] MapKeywords = new string[6] { "_NORMALMAP", "_METALLICGLOSSMAP", "_SPECGLOSSMAP", "_PARALLAXMAP", "_DETAIL_MULX2", "_OCCLUSIONMAP" };

		private void Awake()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_018e: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Expected O, but got Unknown
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			DisplayName = ((BaseUnityPlugin)this).Config.Bind<string>("Katana", "Name", "Neon Katana", "Item name shown in game.");
			DamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Katana", "DamageMultiplier", 1.5f, new ConfigDescription("Hit damage compared to the vanilla sword.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			PriceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Katana", "PriceMultiplier", 1.5f, new ConfigDescription("Shop price compared to the vanilla sword.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			LengthMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Katana", "LengthMultiplier", 1.1f, new ConfigDescription("Visual length compared to the vanilla sword.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			NeonColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Neon", "BladeColor", new Color(0f, 0.9f, 1f, 1f), "Neon color of the blade edge.");
			AccentColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Neon", "AccentColor", new Color(1f, 0.1f, 0.75f, 1f), "Neon color of the handle rings and guard.");
			NeonBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Neon", "Brightness", 3f, new ConfigDescription("How strongly the neon glows.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			NeonLight = ((BaseUnityPlugin)this).Config.Bind<bool>("Neon", "Light", true, "The blade lights up its surroundings.");
			FlipBlade = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "FlipBlade", false, "Turn on if the blade points the wrong way (handle and tip swapped).");
			FlipEdge = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "FlipEdge", false, "Turn on if the cutting edge faces the wrong side.");
			AirSlashEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("AirSlash", "Enabled", true, "Swinging the katana downwards launches an air slash.");
			AirSlashDamage = ((BaseUnityPlugin)this).Config.Bind<int>("AirSlash", "Damage", 50, new ConfigDescription("Air slash damage to enemies.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
			AirSlashCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("AirSlash", "Cooldown", 1.5f, new ConfigDescription("Seconds between air slashes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 30f), Array.Empty<object>()));
			AirSlashSwingSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("AirSlash", "SwingSpeed", 4f, new ConfigDescription("How fast the tip must move downwards (m/s) to trigger the slash. Lower = easier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 30f), Array.Empty<object>()));
			AirSlashSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("AirSlash", "ProjectileSpeed", 16f, new ConfigDescription("Air slash flight speed (m/s).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			AirSlashRange = ((BaseUnityPlugin)this).Config.Bind<float>("AirSlash", "Range", 14f, new ConfigDescription("Air slash range in meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			AirSlashHurtsPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("AirSlash", "HurtsPlayers", false, "Air slash also damages players (friendly fire).");
			ConfigSync.Init(((BaseUnityPlugin)this).Config, "NeonArsenal", Log);
			try
			{
				CreateAndRegister();
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"Failed to create the katana: {arg}");
			}
		}

		private void CreateAndRegister()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//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)
			GameObject val = Resources.Load<GameObject>("Items/Item Melee Sword");
			if ((Object)(object)val == (Object)null)
			{
				Log.LogError((object)"Vanilla prefab 'Items/Item Melee Sword' not found.");
				return;
			}
			GameObject val2 = new GameObject("NeonArsenal_Prefabs");
			val2.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)val2);
			GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform);
			((Object)val3).name = "Item Melee Neon Katana";
			val3.transform.localPosition = Vector3.zero;
			val3.transform.localRotation = Quaternion.identity;
			ItemAttributes component = val3.GetComponent<ItemAttributes>();
			if ((Object)(object)component == (Object)null || (Object)(object)component.item == (Object)null || (Object)(object)val3.GetComponent<ItemMelee>() == (Object)null)
			{
				Log.LogError((object)"Sword prefab has no ItemAttributes/ItemMelee - the game probably changed.");
				return;
			}
			Log.LogInfo((object)("Vanilla sword hierarchy:\n" + DumpHierarchy(val3.transform)));
			Item val4 = Object.Instantiate<Item>(component.item);
			((Object)val4).name = "Item Melee Neon Katana";
			val4.itemName = DisplayName.Value;
			val4.itemNameLocalized = null;
			val4.description = "Carbon steel katana with neon edge. Swing down for an air slash.";
			if ((Object)(object)val4.value != (Object)null)
			{
				Value val5 = Object.Instantiate<Value>(val4.value);
				((Object)val5).name = "Item Melee Neon Katana Value";
				val5.valueMin *= PriceMultiplier.Value;
				val5.valueMax *= PriceMultiplier.Value;
				val4.value = val5;
			}
			component.item = val4;
			HurtCollider componentInChildren = val3.GetComponentInChildren<HurtCollider>(true);
			HurtCollider[] componentsInChildren = val3.GetComponentsInChildren<HurtCollider>(true);
			foreach (HurtCollider obj in componentsInChildren)
			{
				obj.enemyDamage = Mathf.RoundToInt((float)obj.enemyDamage * DamageMultiplier.Value);
			}
			Material neonTemplate;
			Material val6 = ReplaceVisual(val3, componentInChildren, out neonTemplate);
			if ((Object)(object)componentInChildren != (Object)null && (Object)(object)val6 != (Object)null)
			{
				SlashPrefab = BuildSlashPrefab(val2.transform, componentInChildren, neonTemplate ?? val6);
				val3.AddComponent<KatanaAirSlash>();
			}
			else
			{
				Log.LogWarning((object)"Air slash disabled: sword has no HurtCollider or material.");
			}
			Items.RegisterItem(component);
			Log.LogInfo((object)(DisplayName.Value + " registered."));
		}

		private Material ReplaceVisual(GameObject prefab, HurtCollider swordHurt, out Material neonTemplate)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: 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_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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Expected O, but got Unknown
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0619: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = prefab.transform;
			Material val = null;
			bool flag = false;
			Bounds val2 = default(Bounds);
			foreach (MeshFilter item in FindSwordMeshes(transform))
			{
				MeshRenderer component = ((Component)item).GetComponent<MeshRenderer>();
				if ((Object)(object)component == (Object)null || (Object)(object)item.sharedMesh == (Object)null)
				{
					continue;
				}
				if ((Object)(object)val == (Object)null)
				{
					Material[] sharedMaterials = ((Renderer)component).sharedMaterials;
					foreach (Material val3 in sharedMaterials)
					{
						if ((Object)(object)val3 != (Object)null)
						{
							val = val3;
							break;
						}
					}
				}
				Bounds bounds = item.sharedMesh.bounds;
				for (int j = 0; j < 8; j++)
				{
					Vector3 val4 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1))));
					Vector3 val5 = transform.InverseTransformPoint(((Component)item).transform.TransformPoint(val4));
					if (!flag)
					{
						val2 = new Bounds(val5, Vector3.zero);
						flag = true;
					}
					else
					{
						((Bounds)(ref val2)).Encapsulate(val5);
					}
				}
				item.sharedMesh = null;
			}
			neonTemplate = null;
			if ((Object)(object)val == (Object)null || !flag)
			{
				Log.LogError((object)"Sword has no mesh/material - cannot build katana visual.");
				return null;
			}
			ManualLogSource log = Log;
			string[] obj = new string[7]
			{
				$"Sword material '{((Object)val).name}', shader '{((Object)val.shader).name}', queue {val.renderQueue}, ",
				"keywords [",
				string.Join(" ", val.shaderKeywords),
				"], bounds center ",
				null,
				null,
				null
			};
			Vector3 val6 = ((Bounds)(ref val2)).center;
			obj[4] = ((Vector3)(ref val6)).ToString("F3");
			obj[5] = ", size ";
			val6 = ((Bounds)(ref val2)).size;
			obj[6] = ((Vector3)(ref val6)).ToString("F3");
			log.LogInfo((object)string.Concat(obj));
			int num = 0;
			for (int k = 1; k < 3; k++)
			{
				val6 = ((Bounds)(ref val2)).size;
				float num2 = ((Vector3)(ref val6))[k];
				val6 = ((Bounds)(ref val2)).size;
				if (num2 > ((Vector3)(ref val6))[num])
				{
					num = k;
				}
			}
			int num3 = -1;
			for (int l = 0; l < 3; l++)
			{
				if (l == num)
				{
					continue;
				}
				if (num3 >= 0)
				{
					val6 = ((Bounds)(ref val2)).size;
					float num4 = ((Vector3)(ref val6))[l];
					val6 = ((Bounds)(ref val2)).size;
					if (!(num4 > ((Vector3)(ref val6))[num3]))
					{
						continue;
					}
				}
				num3 = l;
			}
			Vector3 val7 = Vector3.zero;
			((Vector3)(ref val7))[num] = 1f;
			Vector3 val8 = Vector3.zero;
			((Vector3)(ref val8))[num3] = 1f;
			float num5 = 0f;
			Transform val9 = transform.Find("Force Grab Point");
			Transform val10 = transform.Find("Swing Point");
			if ((Object)(object)val9 != (Object)null && (Object)(object)val10 != (Object)null)
			{
				num5 = Vector3.Dot(val10.localPosition - val9.localPosition, val7);
			}
			else if ((Object)(object)val9 != (Object)null)
			{
				num5 = Vector3.Dot(((Bounds)(ref val2)).center - val9.localPosition, val7);
			}
			if (Mathf.Abs(num5) < 0.02f)
			{
				num5 = Vector3.Dot(((Bounds)(ref val2)).center, val7);
			}
			val7 *= ((num5 < 0f) ? (-1f) : 1f);
			if (FlipBlade.Value)
			{
				val7 = -val7;
			}
			if (FlipEdge.Value)
			{
				val8 = -val8;
			}
			val6 = ((Bounds)(ref val2)).size;
			float num6 = ((Vector3)(ref val6))[num];
			float num7 = num6 * LengthMultiplier.Value / 1.007f;
			Vector3 val11 = ((Bounds)(ref val2)).center - val7 * (num6 * 0.5f);
			GameObject val12 = new GameObject("Katana Visual");
			val12.transform.SetParent(transform, false);
			val12.transform.localRotation = Quaternion.LookRotation(val7, val8);
			val12.transform.localScale = Vector3.one * num7;
			val12.transform.localPosition = val11 - val7 * (-0.295f * num7);
			val12.layer = prefab.layer;
			neonTemplate = FindEmissiveTemplate(val.shader);
			Material template = neonTemplate ?? val;
			Log.LogInfo((object)(((Object)(object)neonTemplate != (Object)null) ? ("Neon uses emissive material '" + ((Object)neonTemplate).name + "'.") : "No emissive material found, enabling emission on sword material."));
			Texture2D mainTex = KatanaModel.BuildCarbonTexture();
			Material material = MakeMaterial(val, "Katana Steel", new Color(0.1f, 0.11f, 0.13f), 0.95f, 0.78f, null, Color.black);
			Material material2 = MakeMaterial(val, "Katana Carbon", Color.white, 0.35f, 0.62f, (Texture)(object)mainTex, Color.black);
			Material material3 = MakeMaterial(template, "Katana Neon", NeonColor.Value, 0f, 0.5f, null, NeonColor.Value * NeonBrightness.Value);
			Material material4 = MakeMaterial(template, "Katana Accent", AccentColor.Value, 0f, 0.5f, null, AccentColor.Value * NeonBrightness.Value);
			KatanaModel.Parts parts = KatanaModel.Build();
			AddPart(val12.transform, "Steel", parts.Steel, material);
			AddPart(val12.transform, "Carbon", parts.Carbon, material2);
			AddPart(val12.transform, "Neon", parts.Neon, material3);
			AddPart(val12.transform, "Accent", parts.Accent, material4);
			GameObject val13 = new GameObject("Tip");
			val13.transform.SetParent(val12.transform, false);
			val13.transform.localPosition = new Vector3(0f, 0.03f, 0.712f);
			if (NeonLight.Value)
			{
				GameObject val14 = new GameObject("Neon Light");
				val14.transform.SetParent(val12.transform, false);
				val14.transform.localPosition = new Vector3(0f, 0f, 0.35f);
				Light obj2 = val14.AddComponent<Light>();
				obj2.type = (LightType)2;
				obj2.color = NeonColor.Value;
				obj2.range = 2.5f;
				obj2.intensity = 1.2f;
				obj2.shadows = (LightShadows)0;
			}
			return val;
		}

		private static List<MeshFilter> FindSwordMeshes(Transform root)
		{
			List<MeshFilter> list = new List<MeshFilter>();
			string[] array = new string[2] { "Mesh Healthy", "Mesh Broken" };
			foreach (string text in array)
			{
				Transform val = root.Find(text);
				if ((Object)(object)val != (Object)null)
				{
					list.AddRange(((Component)val).GetComponentsInChildren<MeshFilter>(true));
				}
			}
			if (list.Count > 0)
			{
				return list;
			}
			MeshFilter[] componentsInChildren = ((Component)root).GetComponentsInChildren<MeshFilter>(true);
			foreach (MeshFilter val2 in componentsInChildren)
			{
				if (!((Object)(object)((Component)val2).GetComponent<MeshRenderer>() == (Object)null) && !((Object)(object)((Component)val2).GetComponentInParent<ItemVolume>() != (Object)null) && !((Object)(object)((Component)val2).GetComponent<Collider>() != (Object)null) && !(((Object)val2).name == "ItemEquipCube") && ((Component)val2).gameObject.activeSelf)
				{
					list.Add(val2);
				}
			}
			return list;
		}

		private static void AddPart(Transform parent, string name, Mesh mesh, Material material)
		{
			//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_0013: 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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.layer = ((Component)parent).gameObject.layer;
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = material;
		}

		internal static Material MakeMaterial(Material template, string name, Color color, float metallic, float smoothness, Texture mainTex, Color emission)
		{
			//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_0016: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(template)
			{
				name = name,
				hideFlags = (HideFlags)32
			};
			bool flag = ((Color)(ref emission)).maxColorComponent > 0.001f;
			Texture whiteTexture = (Texture)(object)Texture2D.whiteTexture;
			if (val.HasProperty("_BaseTexture"))
			{
				val.SetTexture("_BaseTexture", ((Object)(object)mainTex != (Object)null) ? mainTex : whiteTexture);
			}
			string[] array = new string[2] { "_MetallicTexture", "_SmoothnessTexture" };
			foreach (string text in array)
			{
				if (val.HasProperty(text))
				{
					val.SetTexture(text, whiteTexture);
				}
			}
			if (val.HasProperty("_EmissionTexture"))
			{
				val.SetTexture("_EmissionTexture", (Texture)(flag ? ((object)whiteTexture) : ((object)Texture2D.blackTexture)));
			}
			if (val.HasProperty("_NormalTexture"))
			{
				val.SetTexture("_NormalTexture", (Texture)null);
			}
			if (val.HasProperty("_NormalStrength"))
			{
				val.SetFloat("_NormalStrength", 0f);
			}
			array = new string[2] { "_TilingX", "_TilingY" };
			foreach (string text2 in array)
			{
				if (val.HasProperty(text2))
				{
					val.SetFloat(text2, 1f);
				}
			}
			array = new string[2] { "_OffsetX", "_OffsetY" };
			foreach (string text3 in array)
			{
				if (val.HasProperty(text3))
				{
					val.SetFloat(text3, 0f);
				}
			}
			if (val.HasProperty("_FresnelColor"))
			{
				val.SetColor("_FresnelColor", (Color)(flag ? color : new Color(0.25f, 0.3f, 0.35f)));
			}
			if (val.HasProperty("_FresnelEmissionColor"))
			{
				val.SetColor("_FresnelEmissionColor", flag ? emission : Color.black);
			}
			array = new string[2] { "_MainTex", "_BaseMap" };
			foreach (string text4 in array)
			{
				if (val.HasProperty(text4))
				{
					val.SetTexture(text4, mainTex);
					val.SetTextureScale(text4, Vector2.one);
					val.SetTextureOffset(text4, Vector2.zero);
				}
			}
			array = TextureProps;
			foreach (string text5 in array)
			{
				if (val.HasProperty(text5))
				{
					val.SetTexture(text5, (Texture)null);
				}
			}
			array = MapKeywords;
			foreach (string text6 in array)
			{
				val.DisableKeyword(text6);
			}
			array = new string[2] { "_Color", "_BaseColor" };
			foreach (string text7 in array)
			{
				if (val.HasProperty(text7))
				{
					val.SetColor(text7, color);
				}
			}
			if (val.HasProperty("_Metallic"))
			{
				val.SetFloat("_Metallic", metallic);
			}
			array = new string[3] { "_Glossiness", "_Smoothness", "_GlossMapScale" };
			foreach (string text8 in array)
			{
				if (val.HasProperty(text8))
				{
					val.SetFloat(text8, smoothness);
				}
			}
			if (val.HasProperty("_EmissionColor"))
			{
				val.SetColor("_EmissionColor", emission);
				if (((Color)(ref emission)).maxColorComponent > 0.001f)
				{
					val.EnableKeyword("_EMISSION");
					val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
				}
				else
				{
					val.DisableKeyword("_EMISSION");
				}
			}
			return val;
		}

		private static Material FindEmissiveTemplate(Shader shader)
		{
			string[] array = new string[8] { "Items/Item Melee Stun Baton", "Items/Item Gun Laser", "Items/Item Gun Stun", "Items/Item Gun Shockwave", "Items/Item Gun Tranq", "Items/Item Gun Handgun", "Items/Item Gun Shotgun", "Items/Item Melee Sword" };
			for (int i = 0; i < array.Length; i++)
			{
				GameObject val = Resources.Load<GameObject>(array[i]);
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val2 in componentsInChildren)
				{
					if (!(val2 is MeshRenderer))
					{
						continue;
					}
					Material[] sharedMaterials = val2.sharedMaterials;
					foreach (Material val3 in sharedMaterials)
					{
						if ((Object)(object)val3 != (Object)null && (Object)(object)val3.shader == (Object)(object)shader && val3.renderQueue < 2500 && val3.HasProperty("_EmissionColor") && val3.IsKeywordEnabled("_EMISSION"))
						{
							return val3;
						}
					}
				}
			}
			return null;
		}

		private static GameObject BuildSlashPrefab(Transform holder, HurtCollider swordHurt, Material neonBase)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Expected O, but got Unknown
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Expected O, but got Unknown
			GameObject val = new GameObject("Neon Katana Air Slash");
			val.transform.SetParent(holder, false);
			val.AddComponent<AirSlashProjectile>();
			Material material = MakeMaterial(neonBase, "Katana Air Slash", NeonColor.Value, 0f, 0.5f, null, NeonColor.Value * Mathf.Max(NeonBrightness.Value, 2f) * 1.5f);
			AddPart(val.transform, "Visual", KatanaModel.BuildSlash(), material);
			GameObject val2 = new GameObject("Light");
			val2.transform.SetParent(val.transform, false);
			Light obj = val2.AddComponent<Light>();
			obj.type = (LightType)2;
			obj.color = NeonColor.Value;
			obj.range = 5f;
			obj.intensity = 2.5f;
			obj.shadows = (LightShadows)0;
			GameObject val3 = Object.Instantiate<GameObject>(((Component)swordHurt).gameObject, val.transform);
			((Object)val3).name = "Hurt";
			val3.transform.localPosition = Vector3.zero;
			val3.transform.localRotation = Quaternion.identity;
			val3.transform.localScale = Vector3.one;
			val3.SetActive(false);
			Collider[] components = val3.GetComponents<Collider>();
			foreach (Collider val4 in components)
			{
				if (!(val4 is BoxCollider))
				{
					Object.DestroyImmediate((Object)(object)val4);
				}
			}
			BoxCollider val5 = val3.GetComponent<BoxCollider>();
			if ((Object)(object)val5 == (Object)null)
			{
				val5 = val3.AddComponent<BoxCollider>();
			}
			((Collider)val5).isTrigger = true;
			val5.center = Vector3.zero;
			val5.size = new Vector3(0.7f, 1.7f, 0.9f);
			HurtCollider component = val3.GetComponent<HurtCollider>();
			component.hasTimer = false;
			component.deathPit = false;
			component.physLogic = false;
			component.enemyLogic = false;
			component.enemyDamage = AirSlashDamage.Value;
			component.enemyDamageCooldown = 3f;
			component.playerLogic = AirSlashHurtsPlayers.Value;
			component.playerDamageCooldown = 3f;
			component.onImpactAny = new UnityEvent();
			component.onImpactEnemy = new UnityEvent();
			component.onImpactPlayer = new UnityEvent();
			component.onImpactPhysObject = new UnityEvent();
			return val;
		}

		private static string DumpHierarchy(Transform root)
		{
			StringBuilder sb = new StringBuilder();
			Walk(root, 0);
			return sb.ToString();
			void Walk(Transform t, int depth)
			{
				//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)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Expected O, but got Unknown
				List<string> list = new List<string>();
				Component[] components = ((Component)t).GetComponents<Component>();
				foreach (Component val in components)
				{
					if ((Object)(object)val != (Object)null && !(val is Transform))
					{
						list.Add(((object)val).GetType().Name);
					}
				}
				StringBuilder stringBuilder = sb.Append(' ', depth * 2).Append(((Object)t).name).Append(((Component)t).gameObject.activeSelf ? "" : " (off)")
					.Append(" pos=");
				Vector3 localPosition = t.localPosition;
				stringBuilder.Append(((Vector3)(ref localPosition)).ToString("F3")).Append(" [").Append(string.Join(", ", list))
					.AppendLine("]");
				foreach (Transform item in t)
				{
					Walk(item, depth + 1);
				}
			}
		}
	}
}