Decompiled source of HookGun v1.5.0

HookGun.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using HookGun.Patches;
using LethalLib.Modules;
using ReservedItemSlotCore.Data;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HookGun")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HookGun")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("56cd2431-e59f-4623-8b05-4f3a954ed7df")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HookGun
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.BLKNeko.HookGunWeapon", "HookGunWeapon", "1.5.0")]
	public class HookGunMain : BaseUnityPlugin
	{
		public class HookGunScript : GrabbableObject
		{
			private AudioSource audioSource;

			private RoundManager roundManager;

			private MeshRenderer HookGO;

			public LayerMask whatIsGrappleable = LayerMask.op_Implicit(234918656);

			public LayerMask whatIsGrappleableToPull = LayerMask.op_Implicit(1048640);

			public LayerMask whatIsGrappleableNew = LayerMask.op_Implicit(52644608);

			public LineRenderer lr;

			public float maxGrappleDistance = 60f;

			public float grappleDelayTime = 1f;

			public float overshootYAxis = 1.5f;

			public float HookSpeed = 48f;

			public float OkDistance = 1f;

			public float HookmaxTimer = 6f;

			public float HookTimer = 0f;

			public float smoothTime = 1.3f;

			public static bool grappling;

			public static bool pulling;

			public static bool shoudFall;

			public static bool DisableJump;

			public static bool DisableFall;

			private bool grapplingSlowY = false;

			private bool JumpNoDmg = true;

			public static bool isJumping;

			public static bool NoDmg;

			private Vector3 grapplePoint = Vector3.zero;

			private Vector3 targetPosition = Vector3.zero;

			private Vector3 forces = Vector3.zero;

			private Vector3 forcesP = Vector3.zero;

			private GameObject pullingGameObject;

			private RaycastHit hit;

			public void Awake()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				audioSource = ((Component)this).GetComponent<AudioSource>();
				roundManager = Object.FindObjectOfType<RoundManager>();
				base.grabbable = true;
				base.grabbableToEnemies = true;
				base.useCooldown = HookGunPlugin.itemCooldown.Value;
				base.insertedBattery = new Battery(false, 1f);
				base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>();
			}

			public override void Update()
			{
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//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_00d8: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: 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_0136: 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_015a: 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_0166: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0262: 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_03a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ac: 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_0406: Unknown result type (might be due to invalid IL or missing references)
				//IL_040b: 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_02c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
				((GrabbableObject)this).Update();
				if (!base.isHeld)
				{
					return;
				}
				if (base.currentUseCooldown <= 0f && base.insertedBattery.charge > 0f)
				{
					((Component)((Component)this).gameObject.transform.Find("HookMesh")).gameObject.active = true;
				}
				else
				{
					((Component)((Component)this).gameObject.transform.Find("HookMesh")).gameObject.active = false;
				}
				if (pulling)
				{
					_ = targetPosition;
					if (targetPosition != Vector3.zero && !base.playerHeldBy.isPlayerDead)
					{
						((Component)pullingGameObject.GetComponent<GrabbableObject>()).transform.position = ((Component)base.playerHeldBy).transform.position + new Vector3(0.2f, 0.8f, 0.2f);
						pullingGameObject.GetComponent<GrabbableObject>().FallToGround(false);
						HookTimer = 0f;
						HookSpeed = 0f;
						forcesP = Vector3.zero;
						pulling = false;
						targetPosition = Vector3.zero;
						((MonoBehaviour)this).Invoke("backToNormal", 0.5f);
					}
				}
				if (!grappling)
				{
					return;
				}
				_ = targetPosition;
				if (!(targetPosition != Vector3.zero) || base.playerHeldBy.isPlayerDead)
				{
					return;
				}
				if (!base.playerHeldBy.isInsideFactory)
				{
					NoDmg = true;
				}
				if (HookTimer >= HookmaxTimer)
				{
					((MonoBehaviour)this).Invoke("backToNormal", 1f);
					((MonoBehaviour)this).Invoke("enableDamage", 4f);
					HookTimer = 0f;
					HookSpeed = 0f;
					forces = Vector3.zero;
					grappling = false;
					targetPosition = Vector3.zero;
					base.playerHeldBy.ResetFallGravity();
					base.playerHeldBy.averageVelocity = 0f;
					base.playerHeldBy.externalForces = Vector3.zero;
				}
				else
				{
					HookTimer += Time.fixedDeltaTime;
				}
				if (Vector3.Distance(((Component)base.playerHeldBy).transform.position, targetPosition) >= OkDistance)
				{
					if (base.playerHeldBy.isInsideFactory)
					{
						HookSpeed = 38f;
					}
					else
					{
						HookSpeed = 45f;
					}
					forces = Vector3.Normalize(targetPosition - ((Component)base.playerHeldBy).transform.position) * HookSpeed;
					if (base.playerHeldBy.isInsideFactory)
					{
						forces.y *= 2f;
					}
					else
					{
						forces.y *= 1.5f;
					}
					base.playerHeldBy.externalForces.x += forces.x;
					base.playerHeldBy.externalForces.z += forces.z;
					base.playerHeldBy.externalForces.y += forces.y;
				}
				else
				{
					HookTimer = 0f;
					HookSpeed = 0f;
					forces = Vector3.zero;
					grappling = false;
					targetPosition = Vector3.zero;
					((MonoBehaviour)this).Invoke("backToNormal", 2f);
					((MonoBehaviour)this).Invoke("enableDamage", 8f);
					base.playerHeldBy.ResetFallGravity();
					base.playerHeldBy.averageVelocity = 0f;
					base.playerHeldBy.externalForces = Vector3.zero;
				}
			}

			public override void ItemActivate(bool used, bool buttonDown = true)
			{
				((GrabbableObject)this).ItemActivate(used, buttonDown);
				if (base.playerHeldBy.isInsideFactory)
				{
					OkDistance = 2f;
					HookmaxTimer = 4f;
				}
				else
				{
					OkDistance = 1f;
					HookmaxTimer = 6f;
				}
				if (base.insertedBattery.charge >= HookGunPlugin.energyCost.Value)
				{
					Battery insertedBattery = base.insertedBattery;
					insertedBattery.charge -= HookGunPlugin.energyCost.Value;
					if (base.insertedBattery.charge < HookGunPlugin.energyCost.Value)
					{
						base.insertedBattery.charge = 0f;
					}
					audioSource.PlayOneShot(HookGunPlugin.Assets.ShootSFX);
					StartGrapple();
				}
				else
				{
					audioSource.PlayOneShot(HookGunPlugin.Assets.NoAmmoSFX);
				}
			}

			private void TestGrapple()
			{
				//IL_002e: 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_0048: 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_007d: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
				LineRenderer component = ((Component)Object.Instantiate<HookGunScript>(this, ((Component)this).gameObject.transform.GetChild(0))).GetComponent<LineRenderer>();
				Debug.DrawRay(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, Color.green, 10f);
				if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref hit, maxGrappleDistance, LayerMask.op_Implicit(whatIsGrappleableNew)))
				{
					SpawnTrail(component, ((RaycastHit)(ref hit)).point);
				}
				for (int i = 0; i < 48; i++)
				{
					if (Physics.GetIgnoreLayerCollision(3, i))
					{
						Debug.Log((object)("O jogador NÃO colide com a camada " + LayerMask.LayerToName(i)));
					}
					else
					{
						Debug.Log((object)("O jogador colide com a camada " + LayerMask.LayerToName(i)));
					}
				}
			}

			private void StartGrapple()
			{
				//IL_002e: 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_0055: 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_0157: 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_0073: 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_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: 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_00ad: 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_00be: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: 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_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: 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_00fa: 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_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ec: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Unknown result type (might be due to invalid IL or missing references)
				//IL_0219: Unknown result type (might be due to invalid IL or missing references)
				LineRenderer component = ((Component)Object.Instantiate<HookGunScript>(this, ((Component)this).gameObject.transform.GetChild(0))).GetComponent<LineRenderer>();
				if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref hit, maxGrappleDistance, LayerMask.op_Implicit(whatIsGrappleableToPull)))
				{
					grapplePoint = ((RaycastHit)(ref hit)).point;
					SpawnTrail(component, ((RaycastHit)(ref hit)).point);
					targetPosition = grapplePoint;
					Vector3 position = ((Component)base.playerHeldBy).transform.position;
					Vector3 val = position - ((RaycastHit)(ref hit)).point;
					((Vector3)(ref val)).Normalize();
					val *= 1f;
					position = ((RaycastHit)(ref hit)).point + val;
					position.y *= 1.1f;
					targetPosition = position;
					pulling = true;
					pullingGameObject = ((Component)((RaycastHit)(ref hit)).transform).gameObject;
					audioSource.PlayOneShot(HookGunPlugin.Assets.HitSFX);
				}
				else if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref hit, maxGrappleDistance, LayerMask.op_Implicit(whatIsGrappleable)))
				{
					grapplePoint = ((RaycastHit)(ref hit)).point;
					SpawnTrail(component, ((RaycastHit)(ref hit)).point);
					targetPosition = grapplePoint;
					Vector3 position2 = ((Component)base.playerHeldBy).transform.position;
					Vector3 val2 = position2 - ((RaycastHit)(ref hit)).point;
					((Vector3)(ref val2)).Normalize();
					val2 *= 1f;
					position2 = ((RaycastHit)(ref hit)).point + val2;
					position2.y *= 1.1f;
					targetPosition = position2;
					grappling = true;
					audioSource.PlayOneShot(HookGunPlugin.Assets.HitSFX);
				}
				else
				{
					audioSource.PlayOneShot(HookGunPlugin.Assets.MissSFX);
					((Component)component).gameObject.AddComponent<LineRendererFadeOut>();
					Battery insertedBattery = base.insertedBattery;
					insertedBattery.charge += HookGunPlugin.energyCost.Value;
				}
			}

			private void SpawnTrail(LineRenderer Trail, Vector3 HitPoint)
			{
				//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_0027: 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)
				Trail.SetPositions((Vector3[])(object)new Vector3[2]
				{
					((Component)this).gameObject.transform.GetChild(0).position,
					HitPoint
				});
				((Component)Trail).gameObject.AddComponent<LineRendererFadeOut>();
			}

			private void backToNormal()
			{
				//IL_0018: 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_0029: 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_0055: 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)
				HookSpeed = 0f;
				HookTimer = 0f;
				forces = Vector3.zero;
				grappling = false;
				targetPosition = Vector3.zero;
				base.playerHeldBy.ResetFallGravity();
				base.playerHeldBy.averageVelocity = 0f;
				base.playerHeldBy.externalForces = Vector3.zero;
			}

			private void enableDamage()
			{
				NoDmg = false;
			}
		}

		public class LineRendererFadeOut : MonoBehaviour
		{
			public LineRenderer lineRenderer;

			public float fadeDuration = 1f;

			public float destroyDelay = 0.5f;

			private float elapsed = 0f;

			private bool isFading = true;

			private void Start()
			{
				lineRenderer = ((Component)this).GetComponent<LineRenderer>();
			}

			private void Update()
			{
				//IL_00c4: 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_00ee: 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_0058: 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_0082: 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)
				if (isFading)
				{
					if (elapsed < fadeDuration)
					{
						float num = Mathf.Lerp(1f, 0f, elapsed / fadeDuration);
						((Renderer)lineRenderer).material.color = new Color(((Renderer)lineRenderer).material.color.r, ((Renderer)lineRenderer).material.color.g, ((Renderer)lineRenderer).material.color.b, num);
						elapsed += Time.deltaTime;
					}
					else
					{
						((Renderer)lineRenderer).material.color = new Color(((Renderer)lineRenderer).material.color.r, ((Renderer)lineRenderer).material.color.g, ((Renderer)lineRenderer).material.color.b, 0f);
						isFading = false;
						Object.Destroy((Object)(object)((Component)this).gameObject, destroyDelay);
					}
				}
			}
		}

		private readonly Harmony harmony = new Harmony("com.BLKNeko.HookGunWeapon");

		private static HookGunMain Instance;

		internal ManualLogSource mls;

		private Item IHookGun;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("com.BLKNeko.HookGunWeapon");
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			IHookGun = HookGunPlugin.Assets.HGItem;
			HookGunScript hookGunScript = IHookGun.spawnPrefab.AddComponent<HookGunScript>();
			((GrabbableObject)hookGunScript).itemProperties = IHookGun;
			Items.RegisterShopItem(IHookGun, HookGunPlugin.itemPrice.Value);
			NetworkPrefabs.RegisterNetworkPrefab(IHookGun.spawnPrefab);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.BLKNeko.RSHookGun", "RSHookGunWeapon", "1.5.0")]
	public class RSHookGunMain : BaseUnityPlugin
	{
		public class HookGunScript : GrabbableObject
		{
			private AudioSource audioSource;

			private RoundManager roundManager;

			private MeshRenderer HookGO;

			public LayerMask whatIsGrappleable = LayerMask.op_Implicit(234918656);

			public LayerMask whatIsGrappleableToPull = LayerMask.op_Implicit(1048640);

			public LayerMask whatIsGrappleableNew = LayerMask.op_Implicit(52644608);

			public LineRenderer lr;

			public float maxGrappleDistance = 60f;

			public float grappleDelayTime = 1f;

			public float overshootYAxis = 1.5f;

			public float HookSpeed = 48f;

			public float OkDistance = 1f;

			public float HookmaxTimer = 6f;

			public float HookTimer = 0f;

			public float smoothTime = 1.3f;

			public static bool grappling;

			public static bool pulling;

			public static bool shoudFall;

			public static bool DisableJump;

			public static bool DisableFall;

			private bool grapplingSlowY = false;

			private bool JumpNoDmg = true;

			public static bool isJumping;

			public static bool NoDmg;

			private Vector3 grapplePoint = Vector3.zero;

			private Vector3 targetPosition = Vector3.zero;

			private Vector3 forces = Vector3.zero;

			private Vector3 forcesP = Vector3.zero;

			private GameObject pullingGameObject;

			private RaycastHit hit;

			public void Awake()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				audioSource = ((Component)this).GetComponent<AudioSource>();
				roundManager = Object.FindObjectOfType<RoundManager>();
				base.grabbable = true;
				base.grabbableToEnemies = true;
				base.useCooldown = HookGunPlugin.itemCooldown.Value;
				base.insertedBattery = new Battery(false, 1f);
				base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>();
			}

			public override void Update()
			{
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//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_00d8: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: 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_0136: 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_015a: 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_0166: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0262: 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_03a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ac: 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_0406: Unknown result type (might be due to invalid IL or missing references)
				//IL_040b: 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_02c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
				((GrabbableObject)this).Update();
				if (!base.isHeld)
				{
					return;
				}
				if (base.currentUseCooldown <= 0f && base.insertedBattery.charge > 0f)
				{
					((Component)((Component)this).gameObject.transform.Find("HookMesh")).gameObject.active = true;
				}
				else
				{
					((Component)((Component)this).gameObject.transform.Find("HookMesh")).gameObject.active = false;
				}
				if (pulling)
				{
					_ = targetPosition;
					if (targetPosition != Vector3.zero && !base.playerHeldBy.isPlayerDead)
					{
						((Component)pullingGameObject.GetComponent<GrabbableObject>()).transform.position = ((Component)base.playerHeldBy).transform.position + new Vector3(0.2f, 0.8f, 0.2f);
						pullingGameObject.GetComponent<GrabbableObject>().FallToGround(false);
						HookTimer = 0f;
						HookSpeed = 0f;
						forcesP = Vector3.zero;
						pulling = false;
						targetPosition = Vector3.zero;
						((MonoBehaviour)this).Invoke("backToNormal", 0.5f);
					}
				}
				if (!grappling)
				{
					return;
				}
				_ = targetPosition;
				if (!(targetPosition != Vector3.zero) || base.playerHeldBy.isPlayerDead)
				{
					return;
				}
				if (!base.playerHeldBy.isInsideFactory)
				{
					NoDmg = true;
				}
				if (HookTimer >= HookmaxTimer)
				{
					((MonoBehaviour)this).Invoke("backToNormal", 1f);
					((MonoBehaviour)this).Invoke("enableDamage", 4f);
					HookTimer = 0f;
					HookSpeed = 0f;
					forces = Vector3.zero;
					grappling = false;
					targetPosition = Vector3.zero;
					base.playerHeldBy.ResetFallGravity();
					base.playerHeldBy.averageVelocity = 0f;
					base.playerHeldBy.externalForces = Vector3.zero;
				}
				else
				{
					HookTimer += Time.fixedDeltaTime;
				}
				if (Vector3.Distance(((Component)base.playerHeldBy).transform.position, targetPosition) >= OkDistance)
				{
					if (base.playerHeldBy.isInsideFactory)
					{
						HookSpeed = 38f;
					}
					else
					{
						HookSpeed = 45f;
					}
					forces = Vector3.Normalize(targetPosition - ((Component)base.playerHeldBy).transform.position) * HookSpeed;
					if (base.playerHeldBy.isInsideFactory)
					{
						forces.y *= 2f;
					}
					else
					{
						forces.y *= 1.5f;
					}
					base.playerHeldBy.externalForces.x += forces.x;
					base.playerHeldBy.externalForces.z += forces.z;
					base.playerHeldBy.externalForces.y += forces.y;
				}
				else
				{
					HookTimer = 0f;
					HookSpeed = 0f;
					forces = Vector3.zero;
					grappling = false;
					targetPosition = Vector3.zero;
					((MonoBehaviour)this).Invoke("backToNormal", 2f);
					((MonoBehaviour)this).Invoke("enableDamage", 8f);
					base.playerHeldBy.ResetFallGravity();
					base.playerHeldBy.averageVelocity = 0f;
					base.playerHeldBy.externalForces = Vector3.zero;
				}
			}

			public override void ItemActivate(bool used, bool buttonDown = true)
			{
				((GrabbableObject)this).ItemActivate(used, buttonDown);
				if (base.playerHeldBy.isInsideFactory)
				{
					OkDistance = 2f;
					HookmaxTimer = 4f;
				}
				else
				{
					OkDistance = 1f;
					HookmaxTimer = 6f;
				}
				if (base.insertedBattery.charge >= HookGunPlugin.energyCost.Value)
				{
					Battery insertedBattery = base.insertedBattery;
					insertedBattery.charge -= HookGunPlugin.energyCost.Value;
					if (base.insertedBattery.charge < HookGunPlugin.energyCost.Value)
					{
						base.insertedBattery.charge = 0f;
					}
					audioSource.PlayOneShot(HookGunPlugin.Assets.ShootSFX);
					StartGrapple();
				}
				else
				{
					audioSource.PlayOneShot(HookGunPlugin.Assets.NoAmmoSFX);
				}
			}

			private void TestGrapple()
			{
				//IL_002e: 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_0048: 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_007d: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
				LineRenderer component = ((Component)Object.Instantiate<HookGunScript>(this, ((Component)this).gameObject.transform.GetChild(0))).GetComponent<LineRenderer>();
				Debug.DrawRay(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, Color.green, 10f);
				if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref hit, maxGrappleDistance, LayerMask.op_Implicit(whatIsGrappleableNew)))
				{
					SpawnTrail(component, ((RaycastHit)(ref hit)).point);
				}
				for (int i = 0; i < 48; i++)
				{
					if (Physics.GetIgnoreLayerCollision(3, i))
					{
						Debug.Log((object)("O jogador NÃO colide com a camada " + LayerMask.LayerToName(i)));
					}
					else
					{
						Debug.Log((object)("O jogador colide com a camada " + LayerMask.LayerToName(i)));
					}
				}
			}

			private void StartGrapple()
			{
				//IL_002e: 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_0055: 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_0157: 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_0073: 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_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: 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_00ad: 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_00be: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: 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_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: 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_00fa: 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_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ec: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Unknown result type (might be due to invalid IL or missing references)
				//IL_0219: Unknown result type (might be due to invalid IL or missing references)
				LineRenderer component = ((Component)Object.Instantiate<HookGunScript>(this, ((Component)this).gameObject.transform.GetChild(0))).GetComponent<LineRenderer>();
				if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref hit, maxGrappleDistance, LayerMask.op_Implicit(whatIsGrappleableToPull)))
				{
					grapplePoint = ((RaycastHit)(ref hit)).point;
					SpawnTrail(component, ((RaycastHit)(ref hit)).point);
					targetPosition = grapplePoint;
					Vector3 position = ((Component)base.playerHeldBy).transform.position;
					Vector3 val = position - ((RaycastHit)(ref hit)).point;
					((Vector3)(ref val)).Normalize();
					val *= 1f;
					position = ((RaycastHit)(ref hit)).point + val;
					position.y *= 1.1f;
					targetPosition = position;
					pulling = true;
					pullingGameObject = ((Component)((RaycastHit)(ref hit)).transform).gameObject;
					audioSource.PlayOneShot(HookGunPlugin.Assets.HitSFX);
				}
				else if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref hit, maxGrappleDistance, LayerMask.op_Implicit(whatIsGrappleable)))
				{
					grapplePoint = ((RaycastHit)(ref hit)).point;
					SpawnTrail(component, ((RaycastHit)(ref hit)).point);
					targetPosition = grapplePoint;
					Vector3 position2 = ((Component)base.playerHeldBy).transform.position;
					Vector3 val2 = position2 - ((RaycastHit)(ref hit)).point;
					((Vector3)(ref val2)).Normalize();
					val2 *= 1f;
					position2 = ((RaycastHit)(ref hit)).point + val2;
					position2.y *= 1.1f;
					targetPosition = position2;
					grappling = true;
					audioSource.PlayOneShot(HookGunPlugin.Assets.HitSFX);
				}
				else
				{
					audioSource.PlayOneShot(HookGunPlugin.Assets.MissSFX);
					((Component)component).gameObject.AddComponent<LineRendererFadeOut>();
					Battery insertedBattery = base.insertedBattery;
					insertedBattery.charge += HookGunPlugin.energyCost.Value;
				}
			}

			private void SpawnTrail(LineRenderer Trail, Vector3 HitPoint)
			{
				//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_0027: 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)
				Trail.SetPositions((Vector3[])(object)new Vector3[2]
				{
					((Component)this).gameObject.transform.GetChild(0).position,
					HitPoint
				});
				((Component)Trail).gameObject.AddComponent<LineRendererFadeOut>();
			}

			private void backToNormal()
			{
				//IL_0018: 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_0029: 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_0055: 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)
				HookSpeed = 0f;
				HookTimer = 0f;
				forces = Vector3.zero;
				grappling = false;
				targetPosition = Vector3.zero;
				base.playerHeldBy.ResetFallGravity();
				base.playerHeldBy.averageVelocity = 0f;
				base.playerHeldBy.externalForces = Vector3.zero;
			}

			private void enableDamage()
			{
				NoDmg = false;
			}
		}

		public class LineRendererFadeOut : MonoBehaviour
		{
			public LineRenderer lineRenderer;

			public float fadeDuration = 1f;

			public float destroyDelay = 0.5f;

			private float elapsed = 0f;

			private bool isFading = true;

			private void Start()
			{
				lineRenderer = ((Component)this).GetComponent<LineRenderer>();
			}

			private void Update()
			{
				//IL_00c4: 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_00ee: 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_0058: 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_0082: 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)
				if (isFading)
				{
					if (elapsed < fadeDuration)
					{
						float num = Mathf.Lerp(1f, 0f, elapsed / fadeDuration);
						((Renderer)lineRenderer).material.color = new Color(((Renderer)lineRenderer).material.color.r, ((Renderer)lineRenderer).material.color.g, ((Renderer)lineRenderer).material.color.b, num);
						elapsed += Time.deltaTime;
					}
					else
					{
						((Renderer)lineRenderer).material.color = new Color(((Renderer)lineRenderer).material.color.r, ((Renderer)lineRenderer).material.color.g, ((Renderer)lineRenderer).material.color.b, 0f);
						isFading = false;
						Object.Destroy((Object)(object)((Component)this).gameObject, destroyDelay);
					}
				}
			}
		}

		private readonly Harmony harmony = new Harmony("com.BLKNeko.HookGunWeapon");

		private static RSHookGunMain Instance;

		internal ManualLogSource mls;

		public static ReservedItemSlotData HGRSSlotData;

		public static ReservedItemData HGRSData;

		public static List<ReservedItemData> HGRSadditionalItemData = new List<ReservedItemData>();

		private Item IRSHookGun;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("com.BLKNeko.HookGunWeapon");
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			IRSHookGun = HookGunPlugin.Assets.HGItemRS;
			HookGunScript hookGunScript = IRSHookGun.spawnPrefab.AddComponent<HookGunScript>();
			((GrabbableObject)hookGunScript).itemProperties = IRSHookGun;
			Items.RegisterShopItem(IRSHookGun, HookGunPlugin.itemPrice.Value);
			NetworkPrefabs.RegisterNetworkPrefab(IRSHookGun.spawnPrefab);
			CreateReservedItemSlots();
		}

		private void CreateReservedItemSlots()
		{
			//IL_0037: 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_005a: Expected O, but got Unknown
			HGRSSlotData = ReservedItemSlotData.CreateReservedItemSlotData("RSHookGun", 23, HookGunPlugin.itemPrice.Value);
			HGRSData = HGRSSlotData.AddItemToReservedItemSlot(new ReservedItemData("RSHookGun", (PlayerBone)14, new Vector3(-0.2f, 0.25f, 0f), new Vector3(0f, 90f, 90f)));
		}
	}
	public static class PluginInfo
	{
		public const string MODUID = "com.BLKNeko.HookGunWeapon";

		public const string MODNAME = "HookGunWeapon";

		public const string MODUID2 = "com.BLKNeko.RSHookGun";

		public const string MODNAME2 = "RSHookGunWeapon";

		public const string MODUID3 = "com.BLKNeko.HookGun";

		public const string MODNAME3 = "HookGunPlugin";

		public const string MODVERSION = "1.5.0";
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.BLKNeko.HookGun", "HookGunPlugin", "1.5.0")]
	public class HookGunPlugin : BaseUnityPlugin
	{
		public class Assets
		{
			internal static AssetBundle mainAssetBundle;

			private const string assetbundleName = "hookgunitem";

			private static string[] assetNames = new string[0];

			public static Item HGItem;

			public static Item HGItemRS;

			public static Sprite HGSprite;

			public static AudioClip ShootSFX;

			public static AudioClip HitSFX;

			public static AudioClip MissSFX;

			public static AudioClip NoAmmoSFX;

			public static Mesh HGMesh;

			public static Mesh HOMesh;

			internal static void LoadAssetBundle()
			{
				if ((Object)(object)mainAssetBundle == (Object)null)
				{
					using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HookGun.hookgunitem");
					mainAssetBundle = AssetBundle.LoadFromStream(stream);
				}
				assetNames = mainAssetBundle.GetAllAssetNames();
			}

			internal static void PopulateAssets()
			{
				if (!Object.op_Implicit((Object)(object)mainAssetBundle))
				{
					Debug.LogError((object)"There is no AssetBundle to load assets from.");
					return;
				}
				HGSprite = mainAssetBundle.LoadAsset<Sprite>("HGSprite");
				ShootSFX = mainAssetBundle.LoadAsset<AudioClip>("ShootSFX");
				HitSFX = mainAssetBundle.LoadAsset<AudioClip>("HitSFX");
				MissSFX = mainAssetBundle.LoadAsset<AudioClip>("MissSFX");
				NoAmmoSFX = mainAssetBundle.LoadAsset<AudioClip>("NoAmmoSFX");
				HGItem = mainAssetBundle.LoadAsset<Item>("HookGunItem");
				HGItemRS = mainAssetBundle.LoadAsset<Item>("RSHookGunItem");
			}
		}

		private readonly Harmony harmony = new Harmony("com.BLKNeko.HookGunWeapon");

		private static HookGunPlugin Instance;

		internal ManualLogSource mls;

		public static ConfigEntry<int> itemPrice { get; set; }

		public static ConfigEntry<float> itemCooldown { get; set; }

		public static ConfigEntry<float> energyCost { get; set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("com.BLKNeko.HookGunWeapon");
			bool flag = Chainloader.PluginInfos.Any((KeyValuePair<string, PluginInfo> plugin) => plugin.Key == "FlipMods.ReservedItemSlotCore");
			Debug.Log((object)("isRSModLoaded: " + flag));
			Assets.LoadAssetBundle();
			Assets.PopulateAssets();
			harmony.PatchAll(typeof(HookGunPlugin));
			harmony.PatchAll(typeof(HookGunMain));
			harmony.PatchAll(typeof(AllowDeathPatch));
			if (flag)
			{
				try
				{
					Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ReservedItemSlotCore");
					if (assembly == null)
					{
						((BaseUnityPlugin)this).Logger.LogError((object)"Assembly 'ReservedItemSlotCore' não encontrado, mesmo com mod detectado.");
						return;
					}
					Type type = assembly.GetType("ReservedItemSlotCore.Data.ReservedItemSlotData");
					Type type2 = assembly.GetType("ReservedItemSlotCore.Data.ReservedItemData");
					if (type != null)
					{
						harmony.PatchAll(type);
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Patch aplicado para ReservedItemSlotData.");
					}
					else
					{
						((BaseUnityPlugin)this).Logger.LogError((object)"Tipo 'ReservedItemSlotData' não encontrado, mesmo com mod detectado.");
					}
					if (type2 != null)
					{
						harmony.PatchAll(type2);
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Patch aplicado para ReservedItemSlotData.");
					}
					else
					{
						((BaseUnityPlugin)this).Logger.LogError((object)"Tipo 'ReservedItemData' não encontrado, mesmo com mod detectado.");
					}
				}
				catch (Exception ex)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("Erro ao aplicar patch para ReservedItemSlotData: " + ex.Message));
				}
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Outro mod não detectado. Prosseguindo sem ReservedItemSlotData.");
			}
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type3 in array)
			{
				MethodInfo[] methods = type3.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			itemPrice = ((BaseUnityPlugin)this).Config.Bind<int>("ItemPrice", "Price", 25, "This is the item price, my default is 25, [INTEGER 1,2,30...]");
			itemCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("ItemCooldown", "Cooldown", 2f, "This is the item cooldown, my default is 2, [FLOAT 0.5,1.8,18.9,...]");
			energyCost = ((BaseUnityPlugin)this).Config.Bind<float>("EnergyCost", "Cost", 0.05f, "This is the item energy cost of activation, my default is 0.05, the MAX energy is 1f so 0.05 give you 20 sucessfull activations [FLOAT 0.01,0.1,1 -- DON'T USE MORE THAN 1]");
		}
	}
}
namespace HookGun.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class AllowDeathPatch
	{
		[HarmonyPatch("AllowPlayerDeath")]
		[HarmonyPrefix]
		private static bool ChangeAllowDeath()
		{
			if (HookGunMain.HookGunScript.NoDmg)
			{
				return false;
			}
			return true;
		}
	}
}