Decompiled source of HeroGear v0.1.0

plugins/HeroGear.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Rendering;

[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("HeroGear")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("HeroGear")]
[assembly: AssemblyTitle("HeroGear")]
[assembly: AssemblyVersion("0.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 HeroGear
{
	internal static class GearContent
	{
		internal const string ReactorId = "Item Arc Reactor";

		internal const float PriceMultiplier = 2.5f;

		internal const int EnergyMultiplier = 4;

		internal static Item Crystal { get; private set; }

		internal static Item Reactor { get; private set; }

		internal static void Register()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Reactor))
			{
				GameObject obj = Load("Items/Item Rubber Duck");
				GameObject source = Load("Items/Item Melee Whip");
				GameObject val = Load("Items/Item Power Crystal");
				GameObject val2 = new GameObject("Hero Gear prefab templates");
				val2.SetActive(false);
				Object.DontDestroyOnLoad((Object)(object)val2);
				GearModels gearModels = new GearModels(obj, val);
				ItemAttributes val3 = Clone(obj, val2.transform, "Item Captain America Shield");
				gearModels.Shield(((Component)val3).transform);
				ItemAttributes obj2 = Clone(source, val2.transform, "Item Web Shooter");
				ReplaceWhip(((Component)obj2).gameObject, gearModels);
				ItemAttributes val4 = Clone(val, val2.transform, "Item Arc Reactor");
				Crystal = val4.item;
				val4.item = Object.Instantiate<Item>(Crystal);
				((Object)val4.item).name = "Item Arc Reactor";
				val4.item.value = Object.Instantiate<Value>(Crystal.value);
				Value value = val4.item.value;
				value.valueMin *= 2.5f;
				Value value2 = val4.item.value;
				value2.valueMax *= 2.5f;
				val4.item.maxAmountInShop = 1;
				val4.item.maxPurchase = false;
				val4.item.physicalItem = false;
				val4.item.itemSecretShopType = (itemSecretShopType)0;
				val4.item.disabled = false;
				val4.item.status = (Status)1;
				SetText(val4.item, "Arc Reactor", "Adds four Power Crystals' worth of energy to the truck charger when purchased.");
				gearModels.Reactor(((Component)val4).transform);
				ReplaceItem(val3, "HeroGear/Shield", "Captain America Shield", "Throw it to ricochet off walls and hit whatever gets in its way.");
				ReplaceItem(obj2, "HeroGear/WebShooter", "Web Shooter", "Hold to aim. Press Interact to web a target, then press it again to release. Uses your Strength upgrades.");
				obj2.item.itemType = (itemType)13;
				if (Items.RegisterItem(val4) == null)
				{
					throw new InvalidOperationException("REPOLib could not register the Arc Reactor.");
				}
				Reactor = val4.item;
			}
		}

		private static GameObject Load(string path)
		{
			GameObject val = Resources.Load<GameObject>(path);
			if (!Object.op_Implicit((Object)(object)val))
			{
				throw new InvalidOperationException("Missing R.E.P.O. item template at " + path + ".");
			}
			return val;
		}

		private static ItemAttributes Clone(GameObject source, Transform parent, string name)
		{
			GameObject val = Object.Instantiate<GameObject>(source, parent, false);
			((Object)val).name = name;
			val.SetActive(true);
			Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val2 in componentsInChildren)
			{
				if ((val2 is MeshRenderer || val2 is SkinnedMeshRenderer) ? true : false)
				{
					val2.enabled = false;
				}
			}
			ItemAttributes component = val.GetComponent<ItemAttributes>();
			component.icon = null;
			return component;
		}

		private static void ReplaceWhip(GameObject template, GearModels models)
		{
			PhotonView component = template.GetComponent<PhotonView>();
			ItemMeleeWhip component2 = template.GetComponent<ItemMeleeWhip>();
			if (Object.op_Implicit((Object)(object)component2.whip))
			{
				((Behaviour)component2.whip).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)component2.crackHurtCollider))
			{
				((Component)component2.crackHurtCollider).gameObject.SetActive(false);
			}
			RemoveObserved(component, (MonoBehaviour)(object)template.GetComponent<ItemMeleeWhipRing>());
			RemoveObserved(component, (MonoBehaviour)(object)component2);
			RemoveObserved(component, (MonoBehaviour)(object)template.GetComponent<ItemMelee>());
			RemoveObserved(component, (MonoBehaviour)(object)template.GetComponent<ItemBattery>());
			Transform muzzle = models.WebShooter(template.transform);
			template.AddComponent<WebShooter>().Configure(muzzle, models.WebMaterial);
		}

		private static void RemoveObserved(PhotonView view, MonoBehaviour component)
		{
			if (Object.op_Implicit((Object)(object)component))
			{
				view.ObservedComponents?.Remove((Component)(object)component);
				Object.DestroyImmediate((Object)(object)component);
			}
		}

		private static void ReplaceItem(ItemAttributes attributes, string resourceId, string name, string description)
		{
			attributes.item.prefab = NetworkPrefabs.RegisterNetworkPrefab(resourceId, ((Component)attributes).gameObject) ?? throw new InvalidOperationException("REPOLib could not register the " + name + " prefab.");
			SetText(attributes.item, name, description);
		}

		private static void SetText(Item item, string name, string description)
		{
			item.itemName = name;
			item.itemNameLocalized = null;
			item.description = description;
		}
	}
	internal sealed class GearModels
	{
		private readonly Shader shader;

		private readonly Material steel;

		private readonly Material dark;

		private readonly Material red;

		private readonly Material navy;

		private readonly Material copper;

		private readonly Material blueCore;

		private readonly Material whiteCore;

		private readonly Mesh box;

		internal Material WebMaterial { get; }

		internal GearModels(GameObject shield, GameObject crystal)
		{
			//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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00e9: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			shader = Shader.Find("Standard") ?? ((Renderer)shield.GetComponentsInChildren<MeshRenderer>(true).First((MeshRenderer renderer) => Object.op_Implicit((Object)(object)((Renderer)renderer).sharedMaterial))).sharedMaterial.shader;
			steel = Metal(Color32.op_Implicit(new Color32((byte)193, (byte)208, (byte)219, byte.MaxValue)), 0.72f);
			dark = Metal(Color32.op_Implicit(new Color32((byte)30, (byte)35, (byte)45, byte.MaxValue)), 0.62f);
			red = Metal(Color32.op_Implicit(new Color32((byte)174, (byte)28, (byte)39, byte.MaxValue)), 0.6f);
			navy = Metal(Color32.op_Implicit(new Color32((byte)21, (byte)54, (byte)95, byte.MaxValue)), 0.52f);
			copper = Metal(Color32.op_Implicit(new Color32((byte)145, (byte)90, (byte)52, byte.MaxValue)), 0.7f);
			blueCore = Metal(Color32.op_Implicit(new Color32((byte)48, (byte)190, byte.MaxValue, byte.MaxValue)), 0.2f, 2f);
			whiteCore = Metal(Color32.op_Implicit(new Color32((byte)204, (byte)246, byte.MaxValue, byte.MaxValue)), 0.16f, 1.8f);
			WebMaterial = new Material(Shader.Find("Sprites/Default") ?? ((Renderer)crystal.GetComponentInChildren<MeshRenderer>(true)).sharedMaterial.shader)
			{
				color = new Color(0.91f, 0.97f, 1f, 1f)
			};
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			val.SetActive(false);
			box = val.GetComponent<MeshFilter>().sharedMesh;
			Object.Destroy((Object)(object)val);
		}

		internal void Shield(Transform template)
		{
			//IL_0015: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: 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_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			Transform root = ModelRoot(template, "Shield", new Vector3(0.78f, 0.73f, 0.78f));
			Part(root, "Forged rim and back", Radial(64, (0f, 0.001f), (0.46f, 0.001f), (0.5f, -0.01f), (0.5f, -0.085f), (0.45f, -0.13f), (0f, -0.15f)), steel);
			Part(root, "Outer red ring", Radial(64, (0.397f, 0.059f), (0.469f, 0.021f), (0.482f, 0.002f)), red);
			Part(root, "Brushed silver ring", Radial(64, (0.322f, 0.094f), (0.397f, 0.059f)), steel);
			Part(root, "Inner red ring", Radial(64, (0.247f, 0.119f), (0.322f, 0.094f)), red);
			Part(root, "Blue center", Radial(64, (0f, 0.145f), (0.247f, 0.119f)), navy);
			Part(root, "Raised star", Radial(10, new(float, float)[3]
			{
				(0f, 0.163f),
				(0.178f, 0.145f),
				(0.178f, 0.125f)
			}, star: true), steel);
			Part(root, "Rear plate", Radial(24, (0f, -0.139f), (0.34f, -0.139f), (0.34f, -0.161f), (0f, -0.161f)), dark);
			Block(root, "Grip", new Vector3(-0.16f, 0f, -0.21f), new Vector3(0.082f, 0.34f, 0.14f), dark);
			Block(root, "Forearm strap", new Vector3(0.17f, 0f, -0.198f), new Vector3(0.068f, 0.39f, 0.12f), dark);
		}

		internal Transform WebShooter(Transform template)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_0113: 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_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ModelRoot(template, "Web Shooter", new Vector3(0.45f, 0.45f, 0.78f));
			Block(val, "Wrist cuff", new Vector3(0f, -0.08f, -0.14f), new Vector3(0.79f, 0.6f, 0.5f), dark);
			Block(val, "Rear collar", new Vector3(0f, -0.09f, -0.37f), new Vector3(0.9f, 0.68f, 0.1f), steel);
			Block(val, "Top housing", new Vector3(0f, 0.16f, -0.08f), new Vector3(0.66f, 0.27f, 0.67f), red);
			Block(val, "Front plate", new Vector3(0f, 0.12f, 0.29f), new Vector3(0.71f, 0.36f, 0.12f), steel);
			Part(val, "Emitter", Radial(16, (0f, 0.1f), (0.087f, 0.1f), (0.14f, 0.05f), (0.14f, 0f), (0f, 0f)), dark, new Vector3(0f, 0.12f, 0.32f));
			Part(val, "Emitter light", Radial(16, (0f, 0.103f), (0.054f, 0.103f)), whiteCore, new Vector3(0f, 0.12f, 0.32f));
			float[] array = new float[2] { -0.284f, 0.284f };
			foreach (float num in array)
			{
				Block(val, "Cartridge", new Vector3(num, 0.067f, 0.068f), new Vector3(0.115f, 0.2f, 0.46f), dark);
				Block(val, "Charge indicator", new Vector3(num, 0.177f, 0.04f), new Vector3(0.045f, 0.032f, 0.28f), blueCore);
			}
			Transform transform = new GameObject("Web muzzle").transform;
			transform.SetParent(val, false);
			transform.localPosition = new Vector3(0f, 0.12f, 0.45f);
			return transform;
		}

		internal void Reactor(Transform template)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: 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_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: 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_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			Transform root = ModelRoot(template, "Arc Reactor", new Vector3(0.65f, 0.65f, 0.65f));
			Part(root, "Machined casing", Radial(32, (0f, 0.11f), (0.34f, 0.11f), (0.45f, 0.08f), (0.49f, 0.018f), (0.49f, -0.17f), (0.4f, -0.23f), (0f, -0.23f)), dark);
			Part(root, "Polished face", Radial(32, (0.31f, 0.119f), (0.39f, 0.116f), (0.44f, 0.08f)), steel);
			Part(root, "Containment ring", Radial(48, (0.19f, 0.124f), (0.28f, 0.124f), (0.31f, 0.11f)), blueCore);
			Part(root, "Central core", Radial(3, (0f, 0.145f), (0.161f, 0.145f), (0.169f, 0.112f)), whiteCore);
			Mesh mesh = Radial(32, (0.24f, 0.237f), (0.37f, 0.237f), (0.4f, 0.218f));
			Material material = steel;
			Quaternion? rotation = Quaternion.Euler(0f, 180f, 0f);
			Part(root, "Rear ring", mesh, material, default(Vector3), rotation);
			for (int i = 0; i < 8; i++)
			{
				float num = (float)i * 45f;
				Quaternion val = Quaternion.Euler(0f, 0f, num);
				Block(root, "Copper winding", val * new Vector3(0f, 0.385f, 0.078f), new Vector3(0.087f, 0.115f, 0.105f), copper, val);
			}
		}

		private Material Metal(Color color, float metallic, float emission = 0f)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(shader)
			{
				color = color
			};
			if (val.HasProperty("_Metallic"))
			{
				val.SetFloat("_Metallic", metallic);
			}
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", 0.42f);
			}
			if (emission > 0f && val.HasProperty("_EmissionColor"))
			{
				val.EnableKeyword("_EMISSION");
				val.SetColor("_EmissionColor", color * emission);
			}
			return val;
		}

		private void Block(Transform root, string name, Vector3 position, Vector3 scale, Material material, Quaternion? rotation = null)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Part(root, name, box, material, position, rotation).localScale = scale;
		}

		private static Transform Part(Transform root, string name, Mesh mesh, Material material, Vector3 position = default(Vector3), Quaternion? rotation = null)
		{
			//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_0017: 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_002a: 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_0038: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name)
			{
				layer = ((Component)root).gameObject.layer
			};
			val.transform.SetParent(root, false);
			val.transform.SetLocalPositionAndRotation(position, (Quaternion)(((??)rotation) ?? Quaternion.identity));
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = material;
			return val.transform;
		}

		private static Mesh Radial(int sides, params (float Radius, float Depth)[] profile)
		{
			return Radial(sides, profile, star: false);
		}

		private static Mesh Radial(int sides, (float Radius, float Depth)[] profile, bool star)
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>(sides * profile.Length);
			List<int> list2 = new List<int>();
			for (int i = 0; i < profile.Length; i++)
			{
				(float Radius, float Depth) tuple = profile[i];
				float item = tuple.Radius;
				float item2 = tuple.Depth;
				for (int j = 0; j < sides; j++)
				{
					float num = ((float)j / (float)sides + 0.25f) * MathF.PI * 2f;
					float num2 = ((star && j % 2 == 1) ? (item * 0.43f) : item);
					list.Add(new Vector3(Mathf.Cos(num) * num2, Mathf.Sin(num) * num2, item2));
				}
			}
			for (int k = 0; k < profile.Length - 1; k++)
			{
				for (int l = 0; l < sides; l++)
				{
					int num3 = k * sides + l;
					int num4 = k * sides + (l + 1) % sides;
					int num5 = num3 + sides;
					int num6 = num4 + sides;
					if (profile[k + 1].Radius > 0f)
					{
						list2.AddRange(new int[3] { num3, num5, num6 });
					}
					if (profile[k].Radius > 0f)
					{
						list2.AddRange(new int[3] { num3, num6, num4 });
					}
				}
			}
			Mesh val = new Mesh
			{
				name = "Hero Gear radial profile"
			};
			val.SetVertices(list);
			val.SetTriangles(list2, 0);
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}

		private static Transform ModelRoot(Transform template, string name, Vector3 fallback)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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)
			//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_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_00a4: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			Bounds val = default(Bounds);
			bool flag = false;
			BoxCollider[] componentsInChildren = ((Component)template).GetComponentsInChildren<BoxCollider>(true);
			Vector3 val4 = default(Vector3);
			foreach (BoxCollider val2 in componentsInChildren)
			{
				if (((Collider)val2).isTrigger || !((Collider)val2).enabled)
				{
					continue;
				}
				Matrix4x4 val3 = template.worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix;
				for (int j = 0; j < 8; j++)
				{
					((Vector3)(ref val4))..ctor((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)));
					Vector3 val5 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(val2.center + Vector3.Scale(val2.size * 0.5f, val4));
					if (!flag)
					{
						((Bounds)(ref val))..ctor(val5, Vector3.zero);
					}
					else
					{
						((Bounds)(ref val)).Encapsulate(val5);
					}
					flag = true;
				}
			}
			Transform transform = new GameObject(name + " model")
			{
				layer = ((Component)template).gameObject.layer
			}.transform;
			transform.SetParent(template, false);
			if (flag)
			{
				Vector3 size = ((Bounds)(ref val)).size;
				if (((Vector3)(ref size)).sqrMagnitude > 0.01f)
				{
					transform.localPosition = ((Bounds)(ref val)).center;
				}
			}
			transform.localScale = ((!flag) ? fallback : Vector3.Max(((Bounds)(ref val)).size, fallback * 0.8f));
			return transform;
		}
	}
	[BepInPlugin("hero.gear.repo", "Hero Gear", "0.1.0")]
	[BepInDependency("REPOLib", "4.5.0")]
	public sealed class HeroGearPlugin : BaseUnityPlugin
	{
		internal const string Id = "hero.gear.repo";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("hero.gear.repo").PatchAll();
		}
	}
	[HarmonyPatch(typeof(RunManager), "Awake")]
	internal static class RegisterOnBoot
	{
		[HarmonyPostfix]
		[HarmonyBefore(new string[] { "REPOLib" })]
		private static void Register(RunManager __instance)
		{
			if ((Object)(object)RunManager.instance == (Object)(object)__instance)
			{
				GearContent.Register();
			}
		}
	}
	[HarmonyPatch(typeof(ItemAttributes), "GetValue")]
	internal static class ReactorPricing
	{
		private static readonly FieldRef<ShopManager, float> ShopMultiplier = AccessTools.FieldRefAccess<ShopManager, float>("itemValueMultiplier");

		private static bool Prefix(ItemAttributes __instance, ref int ___value)
		{
			if (!Object.op_Implicit((Object)(object)__instance.item) || ((Object)__instance.item).name != "Item Arc Reactor")
			{
				return true;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return false;
			}
			Value value = GearContent.Crystal.value;
			ShopManager instance = ShopManager.instance;
			float num = Random.Range(value.valueMin, value.valueMax) * ShopMultiplier.Invoke(instance);
			float num2 = instance.CrystalValueGet(Mathf.Ceil(Mathf.Max(1000f, num) / 1000f));
			___value = Mathf.CeilToInt(num2 * 2.5f);
			PhotonView component = ((Component)__instance).GetComponent<PhotonView>();
			if (SemiFunc.IsMultiplayer() && Object.op_Implicit((Object)(object)component) && component.ViewID != 0)
			{
				component.RPC("GetValueRPC", (RpcTarget)1, new object[1] { ___value });
			}
			return false;
		}
	}
	[HarmonyPatch]
	internal static class ReactorCheckout
	{
		private const string ChargeKey = "chargingStationChargeTotal";

		private const int EnergyPerCrystal = 17;

		private const int MaxEnergy = 100;

		private static IEnumerable<MethodBase> TargetMethods()
		{
			yield return AccessTools.Method(typeof(ExtractionPoint), "DestroyTheFirstPhysObjectsInShopList", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(ExtractionPoint), "DestroyAllPhysObjectsInShoppingList", (Type[])null, (Type[])null);
		}

		private static void Prefix(out int __state)
		{
			__state = ReactorCount();
		}

		private static void Postfix(int __state)
		{
			int num = ReactorCount() - __state;
			if (num > 0)
			{
				StatsManager instance = StatsManager.instance;
				int itemPurchased = instance.GetItemPurchased(GearContent.Crystal);
				instance.SetItemPurchase(GearContent.Crystal, itemPurchased + num * 4);
				int num2 = num * 17 * 3;
				instance.runStats["chargingStationChargeTotal"] = Math.Min(100, instance.runStats["chargingStationChargeTotal"] + num2);
				instance.SetItemPurchase(GearContent.Reactor, 0);
			}
		}

		private static int ReactorCount()
		{
			if (!Object.op_Implicit((Object)(object)GearContent.Reactor) || !Object.op_Implicit((Object)(object)StatsManager.instance))
			{
				return 0;
			}
			return StatsManager.instance.GetItemPurchased(GearContent.Reactor);
		}
	}
	public sealed class WebShooter : MonoBehaviour
	{
		private const float Range = 15f;

		private const float CastDuration = 0.12f;

		private const float MissDuration = 0.27f;

		private const float BaseForce = 160f;

		private const int StrandPoints = 17;

		private static readonly FieldRef<PhysGrabber, PhysGrabObject> GrabbedObject = AccessTools.FieldRefAccess<PhysGrabber, PhysGrabObject>("grabbedPhysGrabObject");

		private static readonly FieldRef<PlayerAvatar, PlayerTumble> Tumble = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble");

		private static readonly FieldRef<PlayerAvatar, bool> IsDead = AccessTools.FieldRefAccess<PlayerAvatar, bool>("deadSet");

		private static readonly FieldRef<PlayerAvatar, bool> IsDisabled = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isDisabled");

		private static readonly Action<PlayerTumble, float> HoldTumble = (Action<PlayerTumble, float>)Delegate.CreateDelegate(typeof(Action<PlayerTumble, float>), AccessTools.Method(typeof(PlayerTumble), "OverrideTumbleHold", (Type[])null, (Type[])null));

		private static readonly FieldRef<Enemy, bool> HasStun = AccessTools.FieldRefAccess<Enemy, bool>("HasStateStunned");

		private static readonly FieldRef<Enemy, EnemyStateStunned> StunState = AccessTools.FieldRefAccess<Enemy, EnemyStateStunned>("StateStunned");

		private static readonly FieldRef<GameDirector, gameState> GameState = AccessTools.FieldRefAccess<GameDirector, gameState>("currentState");

		[SerializeField]
		private Transform nozzle;

		[SerializeField]
		private Material webMaterial;

		private readonly Vector3[] points = (Vector3[])(object)new Vector3[17];

		private PhotonView view;

		private PhysGrabObject body;

		private LineRenderer web;

		private PlayerAvatar holder;

		private PhysGrabObject? target;

		private int targetViewId;

		private Vector3 localHit;

		private Vector3 impact;

		private Vector3 offset;

		private float castAt;

		private bool visible;

		private bool latched;

		internal void Configure(Transform muzzle, Material material)
		{
			nozzle = muzzle;
			webMaterial = material;
		}

		private void Awake()
		{
			view = ((Component)this).GetComponent<PhotonView>();
			body = ((Component)this).GetComponent<PhysGrabObject>();
			web = ((Component)nozzle).gameObject.AddComponent<LineRenderer>();
			((Renderer)web).sharedMaterial = webMaterial;
			web.useWorldSpace = true;
			web.positionCount = 17;
			web.startWidth = 0.03f;
			web.endWidth = 0.016f;
			web.numCapVertices = 2;
			((Renderer)web).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)web).receiveShadows = false;
			((Renderer)web).enabled = false;
		}

		private void Update()
		{
			//IL_0066: 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_0040: 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)
			PlayerAvatar instance = PlayerAvatar.instance;
			Camera val = default(Camera);
			if (CanUse() && IsHolding(instance) && SemiFunc.NoTextInputsActive() && SemiFunc.InputDown((InputKey)2) && SemiFunc.PlayerCameraLocalGet(ref val))
			{
				Transform transform = ((Component)val).transform;
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					Toggle(instance, transform.position, transform.forward);
					return;
				}
				view.RPC("RequestWeb", (RpcTarget)2, new object[2] { transform.position, transform.forward });
			}
		}

		private static bool CanUse()
		{
			if (Object.op_Implicit((Object)(object)GameDirector.instance) && (int)GameState.Invoke(GameDirector.instance) == 2 && Object.op_Implicit((Object)(object)RunManager.instance) && Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.Generated)
			{
				if (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop())
				{
					return SemiFunc.RunIsArena();
				}
				return true;
			}
			return false;
		}

		private static bool Alive(PlayerAvatar player)
		{
			if (Object.op_Implicit((Object)(object)player) && ((Behaviour)player).isActiveAndEnabled && !IsDead.Invoke(player))
			{
				return !IsDisabled.Invoke(player);
			}
			return false;
		}

		private bool IsHolding(PlayerAvatar player)
		{
			if (Alive(player) && Object.op_Implicit((Object)(object)player.physGrabber) && SemiFunc.PhysGrabberIsGrabbing(player.physGrabber))
			{
				return (Object)(object)GrabbedObject.Invoke(player.physGrabber) == (Object)(object)body;
			}
			return false;
		}

		[PunRPC]
		private void RequestWeb(Vector3 origin, Vector3 direction, PhotonMessageInfo info)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			if (PhotonNetwork.IsMasterClient && info.Sender != null)
			{
				Toggle(SemiFunc.PlayerAvatarGetFromPhotonPlayer(info.Sender), origin, direction);
			}
		}

		private void Toggle(PlayerAvatar player, Vector3 origin, Vector3 direction)
		{
			//IL_0057: 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_0067: 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_006e: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: 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_0203: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: 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_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_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			if (!CanUse() || !IsHolding(player))
			{
				return;
			}
			if (latched)
			{
				if ((Object)(object)holder == (Object)(object)player)
				{
					Release();
				}
				return;
			}
			Transform val = (Object.op_Implicit((Object)(object)player.PlayerVisionTarget) ? player.PlayerVisionTarget.VisionTransform : ((Component)player).transform);
			if (!Object.op_Implicit((Object)(object)val) || !Finite(origin) || !Finite(direction))
			{
				return;
			}
			Vector3 val2 = origin - val.position;
			if (((Vector3)(ref val2)).sqrMagnitude > 9f || ((Vector3)(ref direction)).sqrMagnitude < 0.5f || ((Vector3)(ref direction)).sqrMagnitude > 1.5f)
			{
				return;
			}
			((Vector3)(ref direction)).Normalize();
			Vector3 val3 = origin + direction * 15f;
			PhysGrabObject val4 = null;
			RaycastHit[] array = Physics.RaycastAll(origin, direction, 15f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetShouldHits()), (QueryTriggerInteraction)1);
			Array.Sort(array, (RaycastHit left, RaycastHit right) => ((RaycastHit)(ref left)).distance.CompareTo(((RaycastHit)(ref right)).distance));
			RaycastHit[] array2 = array;
			for (int num = 0; num < array2.Length; num++)
			{
				RaycastHit val5 = array2[num];
				PhysGrabObject val6 = ResolveBody(((RaycastHit)(ref val5)).collider);
				if (!((Object)(object)val6 == (Object)(object)body) && !((Component)((RaycastHit)(ref val5)).collider).transform.IsChildOf(((Component)player).transform) && (!Object.op_Implicit((Object)(object)val6) || !Object.op_Implicit((Object)(object)Tumble.Invoke(player)) || !((Object)(object)((Component)val6).gameObject == (Object)(object)((Component)Tumble.Invoke(player)).gameObject)))
				{
					val3 = ((RaycastHit)(ref val5)).point;
					if (ValidTarget(val6))
					{
						val4 = val6;
					}
					break;
				}
			}
			RaycastHit val7 = default(RaycastHit);
			if (Physics.Linecast(nozzle.position, val3, ref val7, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1))
			{
				val2 = ((RaycastHit)(ref val7)).point - val3;
				if (((Vector3)(ref val2)).sqrMagnitude > 0.09f)
				{
					val3 = ((RaycastHit)(ref val7)).point;
					val4 = null;
				}
			}
			if (!Object.op_Implicit((Object)(object)val4))
			{
				SetVisual(0, Vector3.zero, val3, attached: false);
				if (SemiFunc.IsMultiplayer())
				{
					view.RPC("WebVisual", (RpcTarget)1, new object[4]
					{
						0,
						Vector3.zero,
						val3,
						false
					});
				}
				return;
			}
			holder = player;
			PlayerTumble val8 = default(PlayerTumble);
			if (((Component)val4).TryGetComponent<PlayerTumble>(ref val8))
			{
				HoldTumble(val8, 0.3f);
				val8.TumbleSet(true, false, false);
				val3 = val4.rb.worldCenterOfMass;
			}
			offset = ((Component)player).transform.InverseTransformDirection(val4.rb.worldCenterOfMass - nozzle.position);
			Vector3 val9 = ((Component)val4).transform.InverseTransformPoint(val3);
			PhotonView component = ((Component)val4).GetComponent<PhotonView>();
			int num2 = (Object.op_Implicit((Object)(object)component) ? component.ViewID : 0);
			SetVisual(num2, val9, val3, attached: true, val4);
			if (SemiFunc.IsMultiplayer())
			{
				PhotonNetwork.RemoveBufferedRPCs(view.ViewID, "WebVisual", (int[])null);
				view.RPC("WebVisual", (RpcTarget)4, new object[4] { num2, val9, val3, true });
			}
		}

		private static bool Finite(Vector3 value)
		{
			//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			if (float.IsFinite(value.x) && float.IsFinite(value.y))
			{
				return float.IsFinite(value.z);
			}
			return false;
		}

		private static PhysGrabObject? ResolveBody(Collider collider)
		{
			PhysGrabObject componentInParent = ((Component)collider).GetComponentInParent<PhysGrabObject>();
			if (Object.op_Implicit((Object)(object)componentInParent))
			{
				return componentInParent;
			}
			PlayerAvatar val = ((Component)collider).GetComponentInParent<PlayerAvatar>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = ((Component)collider).GetComponentInParent<PlayerAvatarCollision>()?.PlayerAvatar;
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = ((Component)collider).GetComponentInParent<PlayerAvatarVisuals>()?.playerAvatar;
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = ((Component)collider).GetComponentInParent<PlayerController>()?.playerAvatarScript;
			}
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)Tumble.Invoke(val)))
			{
				return ((Component)Tumble.Invoke(val)).GetComponent<PhysGrabObject>();
			}
			if (!Object.op_Implicit((Object)(object)collider.attachedRigidbody))
			{
				return null;
			}
			return ((Component)collider.attachedRigidbody).GetComponent<PhysGrabObject>();
		}

		private static bool ValidTarget(PhysGrabObject? candidate)
		{
			PhysGrabHinge val = default(PhysGrabHinge);
			ItemEquippable val2 = default(ItemEquippable);
			if (!Object.op_Implicit((Object)(object)candidate) || !((Behaviour)candidate).isActiveAndEnabled || candidate.dead || !Object.op_Implicit((Object)(object)candidate.rb) || ((Component)candidate).TryGetComponent<PhysGrabHinge>(ref val) || (((Component)candidate).TryGetComponent<ItemEquippable>(ref val2) && val2.IsEquipped()))
			{
				return false;
			}
			PhotonView val3 = default(PhotonView);
			if (SemiFunc.IsMultiplayer() && (!((Component)candidate).TryGetComponent<PhotonView>(ref val3) || val3.ViewID == 0))
			{
				return false;
			}
			PlayerTumble val4 = default(PlayerTumble);
			if (((Component)candidate).TryGetComponent<PlayerTumble>(ref val4))
			{
				return Alive(val4.playerAvatar);
			}
			EnemyRigidbody val5 = default(EnemyRigidbody);
			if (((Component)candidate).TryGetComponent<EnemyRigidbody>(ref val5))
			{
				if (Object.op_Implicit((Object)(object)val5.enemy))
				{
					if (candidate.rb.isKinematic)
					{
						return HasStun.Invoke(val5.enemy);
					}
					return true;
				}
				return false;
			}
			return !candidate.rb.isKinematic;
		}

		private void FixedUpdate()
		{
			//IL_0046: 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_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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			if (!latched || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (!CanUse() || !IsHolding(holder) || !ValidTarget(target))
			{
				Release();
				return;
			}
			Rigidbody rb = target.rb;
			Vector3 worldCenterOfMass = rb.worldCenterOfMass;
			if (Physics.Linecast(nozzle.position, worldCenterOfMass, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1))
			{
				return;
			}
			target.NetworkTrackerOverride(0.3f);
			float grabStrength = holder.physGrabber.grabStrength;
			float num = Mathf.Min(160f * grabStrength, rb.mass * 35f);
			if (num >= Mathf.Max(25f, rb.mass * 7f))
			{
				PlayerTumble val = default(PlayerTumble);
				EnemyRigidbody val2 = default(EnemyRigidbody);
				if (((Component)target).TryGetComponent<PlayerTumble>(ref val))
				{
					HoldTumble(val, 0.25f);
					val.TumbleSet(true, false, false);
				}
				else if (((Component)target).TryGetComponent<EnemyRigidbody>(ref val2) && HasStun.Invoke(val2.enemy))
				{
					StunState.Invoke(val2.enemy).Set(0.2f);
				}
			}
			if (!rb.isKinematic)
			{
				Vector3 val3 = (nozzle.position + ((Component)holder).transform.TransformDirection(offset) - worldCenterOfMass) * 20f - rb.linearVelocity * 7f;
				if (rb.useGravity)
				{
					val3 -= Physics.gravity;
				}
				rb.AddForce(Vector3.ClampMagnitude(val3 * rb.mass, num), (ForceMode)0);
			}
		}

		private void Release()
		{
			//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)
			holder = null;
			SetVisual(0, Vector3.zero, Vector3.zero, attached: false);
			visible = false;
			if (SemiFunc.IsMultiplayer() && view.ViewID != 0)
			{
				PhotonNetwork.RemoveBufferedRPCs(view.ViewID, "WebVisual", (int[])null);
				view.RPC("ClearWeb", (RpcTarget)1, Array.Empty<object>());
			}
		}

		[PunRPC]
		private void ClearWeb(PhotonMessageInfo info)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(info))
			{
				target = null;
				targetViewId = 0;
				latched = false;
				visible = false;
			}
		}

		[PunRPC]
		private void WebVisual(int id, Vector3 hitLocal, Vector3 point, bool attached, PhotonMessageInfo info)
		{
			//IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(info))
			{
				SetVisual(id, hitLocal, point, attached);
			}
		}

		private void SetVisual(int id, Vector3 hitLocal, Vector3 point, bool attached, PhysGrabObject? hitBody = null)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			targetViewId = id;
			target = hitBody;
			localHit = hitLocal;
			impact = point;
			latched = attached;
			visible = true;
			castAt = Time.time;
		}

		private void LateUpdate()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00aa: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_013c: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			if (!visible)
			{
				((Renderer)web).enabled = false;
				return;
			}
			float num = Time.time - castAt;
			if (!latched && num > 0.27f)
			{
				visible = false;
				((Renderer)web).enabled = false;
				return;
			}
			if (!Object.op_Implicit((Object)(object)target) && targetViewId != 0)
			{
				PhotonView obj = PhotonView.Find(targetViewId);
				target = ((obj != null) ? ((Component)obj).GetComponent<PhysGrabObject>() : null);
			}
			Vector3 position = nozzle.position;
			Vector3 val = (Object.op_Implicit((Object)(object)target) ? ((Component)target).transform.TransformPoint(localHit) : impact);
			float num2 = Mathf.Clamp01(num / 0.12f);
			Vector3 val2 = Vector3.Lerp(position, val, num2);
			Vector3 val3 = val2 - position;
			Vector3 val4 = Vector3.Cross(((Vector3)(ref val3)).normalized, Vector3.up);
			float num3 = Mathf.Lerp(0.11f, 0.022f, num2);
			for (int i = 0; i < points.Length; i++)
			{
				float num4 = (float)i / (float)(points.Length - 1);
				float num5 = Mathf.Sin(num4 * 41f - num * 34f) * Mathf.Sin(num4 * MathF.PI) * num3;
				points[i] = Vector3.Lerp(position, val2, num4) + val4 * num5;
			}
			((Renderer)web).enabled = true;
			web.SetPositions(points);
		}
	}
}