Decompiled source of Weapons v1.0.0

Mods/Weapons.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using Il2Cpp;
using Il2CppFemur;
using Il2CppGB.Game.Critters;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using Weapons;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(WeaponsMod), "Weapons", "1.0.0", "Zooks", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Weapons")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Weapons")]
[assembly: AssemblyTitle("Weapons")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Weapons;

public enum WeaponType
{
	AK47,
	Shotgun,
	Bomb,
	RPG
}
internal static class KeyInput
{
	public enum Bind
	{
		SpawnAk,
		SpawnShotgun,
		SpawnBomb,
		SpawnRpg,
		Use,
		Reload,
		RepairView,
		Aim
	}

	public static bool Available => Keyboard.current != null;

	private static KeyControl Ctl(Bind b)
	{
		Keyboard current = Keyboard.current;
		if (current == null)
		{
			return null;
		}
		return (KeyControl)(b switch
		{
			Bind.SpawnAk => current.uKey, 
			Bind.SpawnShotgun => current.hKey, 
			Bind.SpawnBomb => current.lKey, 
			Bind.SpawnRpg => current.periodKey, 
			Bind.Reload => current.rKey, 
			Bind.RepairView => current.f8Key, 
			_ => current.eKey, 
		});
	}

	public static bool Down(Bind b)
	{
		if (b == Bind.Aim)
		{
			Mouse current = Mouse.current;
			if (current != null && current.middleButton != null)
			{
				return current.middleButton.wasPressedThisFrame;
			}
			return false;
		}
		KeyControl val = Ctl(b);
		if (val != null)
		{
			return ((ButtonControl)val).wasPressedThisFrame;
		}
		return false;
	}

	public static bool Held(Bind b)
	{
		if (b == Bind.Aim)
		{
			Mouse current = Mouse.current;
			if (current != null && current.middleButton != null)
			{
				return current.middleButton.isPressed;
			}
			return false;
		}
		KeyControl val = Ctl(b);
		if (val != null)
		{
			return ((ButtonControl)val).isPressed;
		}
		return false;
	}
}
internal sealed class MeshBuilder
{
	public const int METAL = 0;

	public const int WOOD = 1;

	public const int BLACK = 2;

	public const int OLIVE = 3;

	public const int RED = 4;

	public const int STEEL_LIGHT = 5;

	public const int WOOD_DARK = 6;

	public const int POLYMER = 7;

	public const int BRASS = 8;

	public const int ORANGE_WOOD = 9;

	public const int BandCount = 10;

	public const int BandPx = 64;

	public const int TexW = 640;

	public const int TexH = 64;

	private readonly List<Vector3> _v = new List<Vector3>();

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

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

	private static void BandUV(int band, out float u0, out float u1)
	{
		u0 = ((float)(band * 64) + 6f) / 640f;
		u1 = ((float)((band + 1) * 64) - 6f) / 640f;
	}

	public void AddTri(Vector3 a, Vector3 b, Vector3 c, int band)
	{
		//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_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		BandUV(band, out var u, out var u2);
		int count = _v.Count;
		_v.Add(a);
		_v.Add(b);
		_v.Add(c);
		_uv.Add(new Vector2(u, 0.05f));
		_uv.Add(new Vector2(u2, 0.05f));
		_uv.Add(new Vector2((u + u2) * 0.5f, 0.95f));
		_t.Add(count);
		_t.Add(count + 1);
		_t.Add(count + 2);
	}

	public void AddQuad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, int band)
	{
		//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_0035: 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_0054: 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_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		BandUV(band, out var u, out var u2);
		int count = _v.Count;
		_v.Add(a);
		_v.Add(b);
		_v.Add(c);
		_v.Add(d);
		_uv.Add(new Vector2(u, 0.05f));
		_uv.Add(new Vector2(u2, 0.05f));
		_uv.Add(new Vector2(u2, 0.95f));
		_uv.Add(new Vector2(u, 0.95f));
		_t.Add(count);
		_t.Add(count + 1);
		_t.Add(count + 2);
		_t.Add(count);
		_t.Add(count + 2);
		_t.Add(count + 3);
	}

	public void AddBox(Vector3 center, Vector3 size, int band)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		AddBox(center, size, Vector3.zero, band);
	}

	public void AddBox(Vector3 center, Vector3 size, Vector3 eulerAngles, int band)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: 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_008e: 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_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: 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_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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: 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_00b9: 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_00bd: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: 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_00d7: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: 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_00f0: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: 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_0122: Unknown result type (might be due to invalid IL or missing references)
		Quaternion val = Quaternion.Euler(eulerAngles);
		Vector3 val2 = size * 0.5f;
		Vector3[] array = (Vector3[])(object)new Vector3[6]
		{
			Vector3.right,
			Vector3.left,
			Vector3.up,
			Vector3.down,
			Vector3.forward,
			Vector3.back
		};
		foreach (Vector3 val3 in array)
		{
			Vector3 val4 = ((Mathf.Abs(val3.y) > 0.5f) ? Vector3.forward : Vector3.up);
			Vector3 val5 = Vector3.Cross(val3, val4);
			Vector3 val6 = Vector3.Scale(val3, val2);
			Vector3 val7 = Vector3.Scale(val4, val2);
			Vector3 val8 = Vector3.Scale(val5, val2);
			AddQuad(center + val * (val6 - val7 - val8), center + val * (val6 + val7 - val8), center + val * (val6 + val7 + val8), center + val * (val6 - val7 + val8), band);
		}
	}

	public void AddCylinder(Vector3 center, Vector3 axis, float radius, float length, int segments, int band)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		AddTaperedCylinder(center, axis, radius, radius, length, segments, band);
	}

	public void AddTaperedCylinder(Vector3 center, Vector3 axis, float rBottom, float rTop, float length, int segments, int band)
	{
		//IL_0007: 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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_0084: 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_0091: 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_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: 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_00c4: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: 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_00f3: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: 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_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: 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_014e: 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_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		((Vector3)(ref axis)).Normalize();
		Vector3 val = ((Mathf.Abs(axis.y) > 0.9f) ? Vector3.forward : Vector3.up);
		Vector3 val2 = val - axis * Vector3.Dot(val, axis);
		val = ((Vector3)(ref val2)).normalized;
		Vector3 val3 = Vector3.Cross(axis, val);
		float num = length * 0.5f;
		Vector3[] array = (Vector3[])(object)new Vector3[segments + 1];
		Vector3[] array2 = (Vector3[])(object)new Vector3[segments + 1];
		for (int i = 0; i <= segments; i++)
		{
			float num2 = (float)Math.PI * 2f * (float)i / (float)segments;
			Vector3 val4 = Mathf.Cos(num2) * val + Mathf.Sin(num2) * val3;
			array[i] = center - axis * num + val4 * rBottom;
			array2[i] = center + axis * num + val4 * rTop;
		}
		Vector3 a = center - axis * num;
		Vector3 a2 = center + axis * num;
		for (int j = 0; j < segments; j++)
		{
			AddQuad(array[j], array[j + 1], array2[j + 1], array2[j], band);
			if (rTop > 0.0001f)
			{
				AddTri(a2, array2[j], array2[j + 1], band);
			}
			if (rBottom > 0.0001f)
			{
				AddTri(a, array[j + 1], array[j], band);
			}
		}
	}

	public void AddRing(Vector3 center, Vector3 axis, float majorR, float minorR, int majSeg, int minSeg, int band)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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_0042: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: 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_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: 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_00ad: 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)
		//IL_00c4: 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_00dc: 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)
		((Vector3)(ref axis)).Normalize();
		Vector3 u = ((Mathf.Abs(axis.y) > 0.9f) ? Vector3.forward : Vector3.up);
		Vector3 val = u - axis * Vector3.Dot(u, axis);
		u = ((Vector3)(ref val)).normalized;
		Vector3 v = Vector3.Cross(axis, u);
		for (int i = 0; i < majSeg; i++)
		{
			for (int j = 0; j < minSeg; j++)
			{
				AddQuad(P(i, j), P(i + 1, j), P(i + 1, j + 1), P(i, j + 1), band);
			}
		}
		Vector3 P(int num2, int num4)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_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_0063: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)Math.PI * 2f * (float)num2 / (float)majSeg;
			float num3 = (float)Math.PI * 2f * (float)num4 / (float)minSeg;
			return center + (Mathf.Cos(num) * u + Mathf.Sin(num) * v) * (majorR + Mathf.Cos(num3) * minorR) + axis * (Mathf.Sin(num3) * minorR);
		}
	}

	public void AddSphere(Vector3 c, float r, int lat, int lon, int band)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: 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_00c1: 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_00c5: 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_00b1: 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)
		for (int i = 0; i < lat; i++)
		{
			float th = (float)Math.PI * (-0.5f + (float)i / (float)lat);
			float th2 = (float)Math.PI * (-0.5f + (float)(i + 1) / (float)lat);
			for (int j = 0; j < lon; j++)
			{
				float ph = (float)Math.PI * 2f * (float)j / (float)lon;
				float ph2 = (float)Math.PI * 2f * (float)(j + 1) / (float)lon;
				Vector3 a = P(th, ph);
				Vector3 b = P(th2, ph);
				Vector3 c2 = P(th2, ph2);
				Vector3 val = P(th, ph2);
				if (i == 0)
				{
					AddTri(a, b, c2, band);
				}
				else if (i == lat - 1)
				{
					AddTri(a, b, val, band);
				}
				else
				{
					AddQuad(a, b, c2, val, band);
				}
			}
		}
		Vector3 P(float num, float num2)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			return c + new Vector3(Mathf.Cos(num) * Mathf.Cos(num2), Mathf.Sin(num), Mathf.Cos(num) * Mathf.Sin(num2)) * r;
		}
	}

	public Mesh Build(string name)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: 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_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		Mesh val = new Mesh
		{
			name = name,
			vertices = Il2CppStructArray<Vector3>.op_Implicit(_v.ToArray()),
			uv = Il2CppStructArray<Vector2>.op_Implicit(_uv.ToArray()),
			triangles = Il2CppStructArray<int>.op_Implicit(_t.ToArray())
		};
		val.RecalculateNormals();
		val.RecalculateBounds();
		((Object)val).hideFlags = (HideFlags)32;
		return val;
	}
}
internal static class Il2CppTypeFinder
{
	private static readonly Dictionary<string, Type> _cache = new Dictionary<string, Type>();

	private static readonly Dictionary<string, Type> _anyCache = new Dictionary<string, Type>();

	public static Type Find(string className)
	{
		if (_cache.TryGetValue(className, out var value))
		{
			return value;
		}
		Type type = FindInternal(className, typeof(Component));
		if (type != null)
		{
			_cache[className] = type;
			MelonLogger.Msg("[InteropType] " + className + " = " + type.AssemblyQualifiedName);
		}
		return type;
	}

	public static Type FindAny(string nameOrFullName, Type requiredBase = null)
	{
		string key = nameOrFullName + "|" + ((requiredBase == null) ? "" : requiredBase.FullName);
		if (_anyCache.TryGetValue(key, out var value))
		{
			return value;
		}
		Type type = FindInternal(nameOrFullName, requiredBase);
		if (type != null)
		{
			_anyCache[key] = type;
		}
		return type;
	}

	private static Type FindInternal(string nameOrFullName, Type requiredBase)
	{
		bool flag = nameOrFullName.IndexOf('.') >= 0;
		List<Assembly> list = new List<Assembly>(AppDomain.CurrentDomain.GetAssemblies());
		list.Sort((Assembly a, Assembly b) => Rank(a).CompareTo(Rank(b)));
		foreach (Assembly item in list)
		{
			Type[] types;
			try
			{
				types = item.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				types = ex.Types;
			}
			catch
			{
				continue;
			}
			Type[] array = types;
			foreach (Type type in array)
			{
				if (!(type == null) && !(flag ? (type.FullName != nameOrFullName) : (type.Name != nameOrFullName)) && (!(requiredBase != null) || requiredBase.IsAssignableFrom(type)))
				{
					return type;
				}
			}
		}
		return null;
	}

	private static int Rank(Assembly a)
	{
		string text = a.GetName().Name ?? "";
		if (text == "Assembly-CSharp" || text == "Il2CppAssembly-CSharp")
		{
			return 0;
		}
		if (text.StartsWith("Il2Cpp") || text.Contains("Mirror") || text.Contains("Network"))
		{
			return 1;
		}
		if (text.StartsWith("UnityEngine") || text.StartsWith("Unity."))
		{
			return 2;
		}
		return 3;
	}
}
internal static class InteractableSetup
{
	public sealed class Result
	{
		public BoxCollider Collider;

		public Rigidbody Rigidbody;

		public object Interactable;

		public bool Configured;

		public InteractableObjectData Data;

		public bool HasInteractable => Interactable != null;
	}

	public static bool AddNetworkIdentity = true;

	public static bool AddSyncRouter;

	public static float Mass = 3f;

	public static int LayerOverride = -1;

	public static CollisionDetectionMode ContinuousMode = (CollisionDetectionMode)2;

	private const Priority WeaponPriority = (Priority)2;

	private const Grab WeaponGrab = (Grab)2;

	private const Damage WeaponDamage = (Damage)2;

	private static Vector3 _setupPosition;

	private static bool _grabSearched;

	private static MemberInfo _grabMember;

	public static void ApplyContinuous(Rigidbody rb)
	{
		//IL_0012: 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)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)rb == (Object)null))
		{
			CollisionDetectionMode val = (CollisionDetectionMode)(rb.isKinematic ? 3 : ((int)ContinuousMode));
			if (rb.collisionDetectionMode != val)
			{
				rb.collisionDetectionMode = val;
			}
		}
	}

	private static object ReadMember(object target, string name)
	{
		if (target == null)
		{
			return null;
		}
		Type type = target.GetType();
		while (!IsBaseType(type))
		{
			PropertyInfo[] properties = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0 && Norm(propertyInfo.Name) == Norm(name))
				{
					try
					{
						return propertyInfo.GetValue(target);
					}
					catch
					{
					}
				}
			}
			FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (Norm(fieldInfo.Name) == Norm(name))
				{
					try
					{
						return fieldInfo.GetValue(target);
					}
					catch
					{
					}
				}
			}
			type = type.BaseType;
		}
		return null;
	}

	private static object FindTemplate(out int layer)
	{
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		layer = -1;
		Type type = Il2CppTypeFinder.Find("InteractableObject");
		if (type == null)
		{
			return null;
		}
		try
		{
			Il2CppReferenceArray<Object> obj = Object.FindObjectsOfType(Il2CppType.From(type));
			object obj2 = null;
			float num = float.NegativeInfinity;
			foreach (Object item in (Il2CppArrayBase<Object>)(object)obj)
			{
				Component val = ((item == (Object)null) ? null : ((Il2CppObjectBase)item).TryCast<Component>());
				if ((Object)(object)val == (Object)null || !val.gameObject.activeInHierarchy || ((Object)val).name.StartsWith("Weapon"))
				{
					continue;
				}
				object obj3 = Activator.CreateInstance(type, ((Il2CppObjectBase)val).Pointer);
				object obj4 = ReadMember(obj3, "mainCollider");
				Collider val2 = (Collider)(((obj4 is Collider) ? obj4 : null) ?? val.GetComponent<Collider>());
				Rigidbody val3 = (((Object)(object)val2 == (Object)null) ? null : val2.attachedRigidbody);
				if ((Object)(object)val2 == (Object)null || !val2.enabled || val2.isTrigger || (Object)(object)val3 == (Object)null || (Object)(object)((Component)val3).gameObject != (Object)(object)val.gameObject)
				{
					continue;
				}
				bool flag = false;
				Transform val4 = val.transform;
				while ((Object)(object)val4 != (Object)null)
				{
					string text = ((Object)val4).name.ToLowerInvariant();
					if (text.Contains("player") || text.Contains("beast") || text.Contains("ragdoll") || text.Contains("character"))
					{
						flag = true;
						break;
					}
					val4 = val4.parent;
				}
				if (!flag)
				{
					float num2 = (val3.isKinematic ? 0f : 10f) - Vector3.Distance(val.transform.position, _setupPosition) * 0.01f;
					if (!(num2 <= num))
					{
						num = num2;
						obj2 = obj3;
						layer = ((Component)val2).gameObject.layer;
					}
				}
			}
			if (obj2 != null)
			{
				MelonLogger.Msg("[Weapons] Grab template: " + ((Object)(Component)obj2).name + "; layer=" + LayerMask.LayerToName(layer) + "(" + layer + ")");
			}
			return obj2;
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("[Weapons] Grab-layer discovery: " + ex.Message);
			layer = -1;
			return null;
		}
	}

	private static bool PrepareData(InteractableObject io, GameObject go, Collider col, Rigidbody rb)
	{
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Invalid comparison between Unknown and I4
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Invalid comparison between Unknown and I4
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Invalid comparison between Unknown and I4
		try
		{
			Il2CppReferenceArray<Collider> val = new Il2CppReferenceArray<Collider>(1L);
			((Il2CppArrayBase<Collider>)(object)val)[0] = col;
			io.legacyPriorityModifier = (Priority)2;
			io.legacyGrabModifier = (Grab)2;
			io.legacyDamageModifier = (Damage)2;
			io.legacyPartOfRagdoll = false;
			io.legacyCachedTransform = go.transform;
			io.legacyCachedRigidbody = rb;
			io.legacyCachedColliders = val;
			io.legacyCheckVelocity = true;
			io.legacyAlwaysDrain = false;
			io.legacyMovingPlatform = false;
			io.legacyTriggerBudBud = false;
			InteractableObjectData val2 = io.interactableObjectData;
			if (val2 == null)
			{
				val2 = InteractableObjectData.CreateInstance(go, col, (Priority)2, (Grab)2, (Damage)2, false, go.transform, rb, val, true, false, false, false, (Actor)null, false, false, (BirdActor)null, (RatActor)null, (SharkActor)null, (FishActor)null);
				if (val2 == null)
				{
					throw new InvalidOperationException("InteractableObjectData.CreateInstance returned null.");
				}
				io.interactableObjectData = val2;
			}
			val2.gameObject = go;
			val2.mainCollider = col;
			val2.cachedTransform = go.transform;
			val2.cachedRigidbody = rb;
			val2.cachedColliders = val;
			val2.priorityModifier = (Priority)2;
			val2.grabModifier = (Grab)2;
			val2.damageModifier = (Damage)2;
			val2.partOfRagdoll = false;
			val2.checkVelocity = true;
			val2.alwaysDrain = false;
			val2.movingPlatform = false;
			val2.triggerBudBud = false;
			val2.isCritterTarget = false;
			val2.isTentacle = false;
			val2.IgnoreValidate = false;
			val2.IgnoreStageHazards = false;
			val2.actor = null;
			val2.birdActor = null;
			val2.ratActor = null;
			val2.sharkActor = null;
			val2.fishActor = null;
			InteractableObject val3 = io;
			if (val3.childInteractableObjectData == null)
			{
				List<InteractableObjectData> val4 = (val3.childInteractableObjectData = new List<InteractableObjectData>());
			}
			val3 = io;
			if (val3.connectedGrabEvents == null)
			{
				Il2CppReferenceArray<GrabEvent> val6 = (val3.connectedGrabEvents = new Il2CppReferenceArray<GrabEvent>(0L));
			}
			return (Object)(object)io.mainCollider == (Object)(object)col && (Object)(object)io.cachedRigidbody == (Object)(object)rb && (Object)(object)io.cachedTransform == (Object)(object)go.transform && (Object)(object)io.cachedGameObject == (Object)(object)go && (int)io.priorityModifier == 2 && (int)io.grabModifier == 2 && (int)io.damageModifier == 2;
		}
		catch (Exception ex)
		{
			MelonLogger.Error("[GrabSetup] Native data initialization failed for " + ((Object)go).name + ": " + ex);
			return false;
		}
	}

	public static void FinishSetup(GameObject go, Result result)
	{
		object interactable = result.Interactable;
		InteractableObject val = (InteractableObject)((interactable is InteractableObject) ? interactable : null);
		if (!((Object)(object)val == (Object)null))
		{
			result.Configured = PrepareData(val, go, (Collider)(object)result.Collider, result.Rigidbody);
			result.Data = val.interactableObjectData;
			ApplyContinuous(result.Rigidbody);
		}
	}

	public static bool EnsureRegistered(WeaponInstance w)
	{
		try
		{
			object interactable = w.Interactable;
			InteractableObject val = (InteractableObject)((interactable is InteractableObject) ? interactable : null);
			if ((Object)(object)val == (Object)null || !w.IsAlive || !MonoSingleton<InteractableObjectManager>.HasInstance())
			{
				return false;
			}
			InteractableObjectManager instance = MonoSingleton<InteractableObjectManager>.Instance;
			InteractableObjectData interactableObjectData = val.interactableObjectData;
			if (interactableObjectData == null || (Object)(object)instance == (Object)null)
			{
				return false;
			}
			if (w.NativeData != null && ((Il2CppObjectBase)w.NativeData).Pointer != ((Il2CppObjectBase)interactableObjectData).Pointer)
			{
				instance.UnregisterInteractableData(w.NativeData);
			}
			w.NativeData = interactableObjectData;
			bool flag = instance.AllInteractableObjects.Contains(interactableObjectData);
			bool flag2 = instance.GrabbableObjects.Contains(interactableObjectData);
			if (!flag || !flag2)
			{
				if (flag)
				{
					instance.UnRegisterInteractableObjectAndChildren(val);
				}
				instance.RegisterInteractableObjectAndChildren(val);
			}
			int num;
			if (instance.AllInteractableObjects.Contains(interactableObjectData))
			{
				num = (instance.GrabbableObjects.Contains(interactableObjectData) ? 1 : 0);
				if (num != 0)
				{
					MelonLogger.Msg("[GrabSetup] " + w.Type.ToString() + ": registered=True; present in native GrabbableObjects.");
				}
			}
			else
			{
				num = 0;
			}
			return (byte)num != 0;
		}
		catch (Exception ex)
		{
			MelonLogger.Error("[GrabSetup] Registry check failed: " + ex);
			return false;
		}
	}

	public static void Release(WeaponInstance w)
	{
		try
		{
			if (MonoSingleton<InteractableObjectManager>.HasInstance())
			{
				InteractableObjectManager instance = MonoSingleton<InteractableObjectManager>.Instance;
				object interactable = w.Interactable;
				InteractableObject val = (InteractableObject)((interactable is InteractableObject) ? interactable : null);
				if ((Object)(object)val != (Object)null)
				{
					instance.UnRegisterInteractableObjectAndChildren(val);
				}
				if (w.NativeData != null && instance.AllInteractableObjects.Contains(w.NativeData))
				{
					instance.UnregisterInteractableData(w.NativeData);
				}
			}
		}
		catch
		{
		}
		finally
		{
			w.NativeData = null;
			w.Registered = false;
		}
	}

	public static Result Setup(GameObject go, Bounds boxBounds)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: 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)
		Result result = new Result();
		_setupPosition = go.transform.position;
		FindTemplate(out var layer);
		if (LayerOverride >= 0 && LayerOverride < 32)
		{
			layer = LayerOverride;
		}
		if (layer < 0)
		{
			string[] array = new string[5] { "Interactable", "InteractableObject", "Grabbable", "PhysicsObject", "Props" };
			for (int i = 0; i < array.Length; i++)
			{
				layer = LayerMask.NameToLayer(array[i]);
				if (layer >= 0)
				{
					break;
				}
			}
			if (layer < 0)
			{
				layer = 0;
			}
		}
		go.layer = layer;
		BoxCollider val = go.AddComponent<BoxCollider>();
		val.center = ((Bounds)(ref boxBounds)).center;
		val.size = ((Bounds)(ref boxBounds)).size;
		((Collider)val).isTrigger = false;
		((Collider)val).enabled = true;
		result.Collider = val;
		Rigidbody val2 = go.GetComponent<Rigidbody>() ?? go.AddComponent<Rigidbody>();
		val2.mass = Mass;
		val2.drag = 0f;
		val2.angularDrag = 0.05f;
		val2.useGravity = true;
		val2.isKinematic = false;
		val2.interpolation = (RigidbodyInterpolation)1;
		ApplyContinuous(val2);
		val2.constraints = (RigidbodyConstraints)0;
		val2.detectCollisions = true;
		val2.maxAngularVelocity = 25f;
		result.Rigidbody = val2;
		if (AddNetworkIdentity)
		{
			AddOrGet(go, "NetworkIdentity");
		}
		if (AddSyncRouter)
		{
			object obj = AddOrGet(go, "RigidbodySyncRouter");
			if (obj != null)
			{
				SetMember(obj, "targetChild", go);
				SetMember(obj, "deltaThreshold", 0.023f);
			}
		}
		InteractableObject val3 = go.GetComponent<InteractableObject>() ?? go.AddComponent<InteractableObject>();
		if ((Object)(object)val3 == (Object)null)
		{
			MelonLogger.Error("[GrabSetup] Could not add native InteractableObject.");
			return result;
		}
		result.Interactable = val3;
		result.Configured = PrepareData(val3, go, (Collider)(object)val, val2);
		result.Data = val3.interactableObjectData;
		((Behaviour)val3).enabled = true;
		return result;
	}

	private static object AddOrGet(GameObject go, string className)
	{
		Type type = Il2CppTypeFinder.Find(className);
		if (type == null)
		{
			return null;
		}
		try
		{
			Type val = Il2CppType.From(type);
			Component val2 = go.GetComponent(val) ?? go.AddComponent(val);
			return ((Object)(object)val2 == (Object)null) ? null : Activator.CreateInstance(type, ((Il2CppObjectBase)val2).Pointer);
		}
		catch
		{
			return null;
		}
	}

	private static bool IsBaseType(Type t)
	{
		if (!(t == null) && !(t == typeof(object)) && !(t == typeof(Il2CppObjectBase)) && !(t == typeof(Object)) && !(t == typeof(Component)) && !(t == typeof(Behaviour)))
		{
			return t == typeof(MonoBehaviour);
		}
		return true;
	}

	internal static string Norm(string s)
	{
		if (s == null)
		{
			return "";
		}
		s = s.Trim();
		if (s.StartsWith("m_"))
		{
			s = s.Substring(2);
		}
		return s.TrimStart('_').Replace(" ", "").Replace("<", "")
			.Replace(">k__BackingField", "")
			.ToLowerInvariant();
	}

	public static bool SetMember(object target, string name, object value)
	{
		if (target == null)
		{
			return false;
		}
		string text = Norm(name);
		Type type = target.GetType();
		while (!IsBaseType(type))
		{
			PropertyInfo[] properties = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (Norm(propertyInfo.Name) != text || !propertyInfo.CanWrite || propertyInfo.GetIndexParameters().Length != 0)
				{
					continue;
				}
				try
				{
					object obj = Coerce(value, propertyInfo.PropertyType);
					if (obj != null)
					{
						propertyInfo.SetValue(target, obj);
						return true;
					}
				}
				catch
				{
				}
			}
			FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (Norm(fieldInfo.Name) != text || fieldInfo.IsInitOnly)
				{
					continue;
				}
				try
				{
					object obj3 = Coerce(value, fieldInfo.FieldType);
					if (obj3 != null)
					{
						fieldInfo.SetValue(target, obj3);
						return true;
					}
				}
				catch
				{
				}
			}
			type = type.BaseType;
		}
		return false;
	}

	private static object Coerce(object value, Type target)
	{
		if (value == null)
		{
			return null;
		}
		if (target.IsEnum)
		{
			string text = Norm((value as string) ?? value.ToString());
			string[] names = Enum.GetNames(target);
			foreach (string text2 in names)
			{
				if (Norm(text2) == text)
				{
					return Enum.Parse(target, text2);
				}
			}
			return null;
		}
		if (target.IsInstanceOfType(value))
		{
			return value;
		}
		GameObject val = (GameObject)((value is GameObject) ? value : null);
		if (val != null && target.IsInstanceOfType(val.transform))
		{
			return val.transform;
		}
		Component val2 = (Component)((value is Component) ? value : null);
		if (val2 != null && target.IsInstanceOfType(val2.gameObject))
		{
			return val2.gameObject;
		}
		if (value is IConvertible && (target.IsPrimitive || target == typeof(string)))
		{
			try
			{
				return Convert.ChangeType(value, target);
			}
			catch
			{
				return null;
			}
		}
		return null;
	}

	public static bool? IsGrabbed(object interactable)
	{
		if (interactable == null)
		{
			return null;
		}
		if (!_grabSearched)
		{
			_grabSearched = true;
			string[] array = new string[9] { "isgrabbed", "grabbed", "isheld", "held", "beinggrabbed", "isbeinggrabbed", "grabcount", "grabbercount", "numgrabbers" };
			List<MemberInfo> list = new List<MemberInfo>();
			Type type = interactable.GetType();
			while (!IsBaseType(type))
			{
				PropertyInfo[] properties = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (PropertyInfo propertyInfo in properties)
				{
					if (propertyInfo.CanRead && (propertyInfo.PropertyType == typeof(bool) || propertyInfo.PropertyType == typeof(int)))
					{
						list.Add(propertyInfo);
					}
				}
				FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (FieldInfo fieldInfo in fields)
				{
					if (fieldInfo.FieldType == typeof(bool) || fieldInfo.FieldType == typeof(int))
					{
						list.Add(fieldInfo);
					}
				}
				type = type.BaseType;
			}
			string[] array2 = array;
			foreach (string text in array2)
			{
				foreach (MemberInfo item in list)
				{
					if (Norm(item.Name) == text)
					{
						_grabMember = item;
						break;
					}
				}
				if (_grabMember != null)
				{
					break;
				}
			}
		}
		if (_grabMember == null)
		{
			return null;
		}
		try
		{
			object obj = ((_grabMember is PropertyInfo propertyInfo2) ? propertyInfo2.GetValue(interactable) : ((FieldInfo)_grabMember).GetValue(interactable));
			if (obj is bool value)
			{
				return value;
			}
			if (obj is int num)
			{
				return num > 0;
			}
		}
		catch
		{
		}
		return null;
	}
}
internal static class WeaponFactory
{
	public static float Scale = 1f;

	public static bool ForceUnlit;

	private static Mesh _akMesh;

	private static Mesh _shotgunMesh;

	private static Mesh _bombMesh;

	private static Mesh _rpgMesh;

	private static Mesh _rpgRocketMesh;

	private static Mesh _ringMesh;

	private static Bounds _akBox;

	private static Bounds _shotgunBox;

	private static Bounds _bombBox;

	private static Bounds _rpgBox;

	private static bool _refreshMaterials = true;

	private static Texture2D _palette;

	private static Material _material;

	private static Material _tracerMaterial;

	private static Material _smokeMaterial;

	public static readonly Vector3 AkMuzzle = new Vector3(0f, 0.005f, 0.73f);

	public static readonly Vector3 ShotgunMuzzle = new Vector3(0f, 0.015f, 0.72f);

	public static readonly Vector3 RpgMuzzle = new Vector3(0f, 0f, 0.42f);

	public static readonly Vector3 AkMainGrip = new Vector3(0f, -0.082f, -0.07f);

	public static readonly Vector3 AkForeGrip = new Vector3(0f, -0.012f, 0.305f);

	public static readonly Vector3 ShotgunMainGrip = new Vector3(0f, -0.038f, -0.128f);

	public static readonly Vector3 ShotgunForeGrip = new Vector3(0f, -0.026f, 0.31f);

	public static readonly Vector3 BombGrip = new Vector3(0f, 0.015f, -0.015f);

	public static readonly Vector3 RpgMainGrip = new Vector3(0f, -0.095f, 0.045f);

	public static readonly Vector3 RpgForeGrip = new Vector3(0f, -0.09f, -0.1f);

	public static bool Ready { get; private set; }

	public static Material WeaponMaterial => _material;

	public static Material TracerMaterial => _tracerMaterial;

	public static Material SmokeMaterial => _smokeMaterial;

	public static Mesh RpgRocketMesh => _rpgRocketMesh;

	public static Mesh ShockwaveRingMesh => _ringMesh;

	private static RenderPipelineAsset CurrentPipeline => GraphicsSettings.currentRenderPipeline ?? QualitySettings.renderPipeline ?? GraphicsSettings.renderPipelineAsset;

	public static void SceneChanged()
	{
		_refreshMaterials = true;
	}

	public static void Init()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: 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_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: 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)
		if (!Ready)
		{
			_palette = BuildPalette();
			_akMesh = BuildAk47();
			_shotgunMesh = BuildShotgun();
			_bombMesh = BuildBomb();
			_rpgMesh = BuildRpgLauncher();
			_rpgRocketMesh = BuildRpgRocket();
			_ringMesh = BuildShockwaveRing();
			_akBox = ComputeAlignedBoxBounds(_akMesh.bounds, WeaponType.AK47);
			_shotgunBox = ComputeAlignedBoxBounds(_shotgunMesh.bounds, WeaponType.Shotgun);
			_bombBox = ComputeAlignedBoxBounds(_bombMesh.bounds, WeaponType.Bomb);
			_rpgBox = ComputeAlignedBoxBounds(_rpgMesh.bounds, WeaponType.RPG);
			Ready = true;
		}
		if (_refreshMaterials || (Object)(object)_material == (Object)null || (Object)(object)_tracerMaterial == (Object)null || (Object)(object)_smokeMaterial == (Object)null)
		{
			Material val = BuildMaterial(_palette);
			if ((Object)(object)_material == (Object)null)
			{
				_material = val;
			}
			else
			{
				_material.shader = val.shader;
				_material.CopyPropertiesFromMaterial(val);
				Object.Destroy((Object)(object)val);
			}
			val = BuildTracerMaterial();
			if ((Object)(object)_tracerMaterial == (Object)null)
			{
				_tracerMaterial = val;
			}
			else
			{
				_tracerMaterial.shader = val.shader;
				_tracerMaterial.CopyPropertiesFromMaterial(val);
				Object.Destroy((Object)(object)val);
			}
			val = BuildSmokeMaterial();
			if ((Object)(object)_smokeMaterial == (Object)null)
			{
				_smokeMaterial = val;
			}
			else
			{
				_smokeMaterial.shader = val.shader;
				_smokeMaterial.CopyPropertiesFromMaterial(val);
				Object.Destroy((Object)(object)val);
			}
			_refreshMaterials = false;
		}
	}

	private static Bounds ComputeAlignedBoxBounds(Bounds vb, WeaponType type)
	{
		//IL_006c: 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_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)
		//IL_00c5: 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_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: 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_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		if (type == WeaponType.Bomb)
		{
			return new Bounds(((Bounds)(ref vb)).center, new Vector3(Mathf.Max(((Bounds)(ref vb)).size.x + 0.08f, 0.3f), Mathf.Max(((Bounds)(ref vb)).size.y + 0.07f, 0.34f), Mathf.Max(((Bounds)(ref vb)).size.z + 0.08f, 0.3f)));
		}
		return new Bounds(((Bounds)(ref vb)).center, new Vector3(Mathf.Max(((Bounds)(ref vb)).size.x + 0.11f, 0.18f), Mathf.Max(((Bounds)(ref vb)).size.y + 0.08f, 0.28f), Mathf.Max(((Bounds)(ref vb)).size.z + 0.08f, 0.25f)));
	}

	public static Bounds CollisionBounds(WeaponType type)
	{
		//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_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		return (Bounds)(type switch
		{
			WeaponType.AK47 => _akBox, 
			WeaponType.Shotgun => _shotgunBox, 
			WeaponType.RPG => _rpgBox, 
			_ => _bombBox, 
		});
	}

	private static Mesh BuildAk47()
	{
		//IL_0016: 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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: 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_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_028c: 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_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_0392: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: 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_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0487: Unknown result type (might be due to invalid IL or missing references)
		//IL_049b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0514: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_053f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_0570: Unknown result type (might be due to invalid IL or missing references)
		//IL_0584: Unknown result type (might be due to invalid IL or missing references)
		//IL_059f: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_060a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0625: Unknown result type (might be due to invalid IL or missing references)
		//IL_0639: Unknown result type (might be due to invalid IL or missing references)
		//IL_064d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0668: Unknown result type (might be due to invalid IL or missing references)
		//IL_067c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0690: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0702: Unknown result type (might be due to invalid IL or missing references)
		//IL_0716: Unknown result type (might be due to invalid IL or missing references)
		//IL_0731: Unknown result type (might be due to invalid IL or missing references)
		//IL_0745: Unknown result type (might be due to invalid IL or missing references)
		//IL_0760: Unknown result type (might be due to invalid IL or missing references)
		//IL_0774: Unknown result type (might be due to invalid IL or missing references)
		//IL_078f: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0801: Unknown result type (might be due to invalid IL or missing references)
		//IL_0815: Unknown result type (might be due to invalid IL or missing references)
		//IL_0829: Unknown result type (might be due to invalid IL or missing references)
		//IL_0844: Unknown result type (might be due to invalid IL or missing references)
		//IL_0858: Unknown result type (might be due to invalid IL or missing references)
		//IL_086c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0887: Unknown result type (might be due to invalid IL or missing references)
		//IL_089b: Unknown result type (might be due to invalid IL or missing references)
		//IL_08af: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_08cf: Unknown result type (might be due to invalid IL or missing references)
		MeshBuilder meshBuilder = new MeshBuilder();
		meshBuilder.AddBox(new Vector3(0f, -0.005f, 0.05f), new Vector3(0.052f, 0.068f, 0.31f), 0);
		meshBuilder.AddBox(new Vector3(0f, 0.032f, 0.045f), new Vector3(0.044f, 0.018f, 0.28f), 0);
		meshBuilder.AddCylinder(new Vector3(0f, 0.041f, 0.045f), Vector3.forward, 0.018f, 0.27f, 10, 0);
		for (int i = 0; i < 4; i++)
		{
			meshBuilder.AddBox(new Vector3(0f, 0.047f, -0.04f + (float)i * 0.055f), new Vector3(0.036f, 0.004f, 0.012f), 2);
		}
		meshBuilder.AddBox(new Vector3(-0.029f, 0.002f, 0.02f), new Vector3(0.007f, 0.022f, 0.14f), 2);
		meshBuilder.AddBox(new Vector3(0.029f, 0.002f, 0.02f), new Vector3(0.006f, 0.012f, 0.075f), new Vector3(6f, 0f, 0f), 2);
		meshBuilder.AddBox(new Vector3(0.026f, 0.018f, 0.095f), new Vector3(0.012f, 0.018f, 0.075f), 5);
		meshBuilder.AddBox(new Vector3(0.042f, 0.018f, 0.078f), new Vector3(0.028f, 0.01f, 0.014f), new Vector3(0f, -15f, 6f), 5);
		meshBuilder.AddCylinder(new Vector3(0.056f, 0.02f, 0.074f), Vector3.right, 0.007f, 0.016f, 8, 5);
		meshBuilder.AddCylinder(new Vector3(0f, -0.01f, 0.16f), Vector3.right, 0.004f, 0.056f, 6, 5);
		meshBuilder.AddCylinder(new Vector3(0f, -0.012f, -0.08f), Vector3.right, 0.004f, 0.056f, 6, 5);
		meshBuilder.AddBox(new Vector3(0f, 0.046f, 0.175f), new Vector3(0.026f, 0.02f, 0.055f), 0);
		meshBuilder.AddBox(new Vector3(0f, 0.059f, 0.165f), new Vector3(0.018f, 0.008f, 0.042f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.004f, 0.305f), new Vector3(0.056f, 0.046f, 0.195f), 1);
		meshBuilder.AddBox(new Vector3(0f, -0.024f, 0.305f), new Vector3(0.044f, 0.016f, 0.185f), 6);
		meshBuilder.AddBox(new Vector3(0f, 0.036f, 0.305f), new Vector3(0.04f, 0.028f, 0.165f), 1);
		meshBuilder.AddBox(new Vector3(0f, 0.016f, 0.21f), new Vector3(0.054f, 0.058f, 0.014f), 2);
		meshBuilder.AddBox(new Vector3(0f, 0.012f, 0.405f), new Vector3(0.052f, 0.054f, 0.014f), 2);
		meshBuilder.AddCylinder(new Vector3(0f, 0.042f, 0.33f), Vector3.forward, 0.013f, 0.24f, 12, 0);
		meshBuilder.AddBox(new Vector3(0f, 0.026f, 0.455f), new Vector3(0.024f, 0.048f, 0.034f), new Vector3(32f, 0f, 0f), 0);
		meshBuilder.AddCylinder(new Vector3(0f, 0.005f, 0.44f), Vector3.forward, 0.0115f, 0.5f, 14, 0);
		meshBuilder.AddCylinder(new Vector3(0f, -0.018f, 0.48f), Vector3.forward, 0.0045f, 0.38f, 8, 5);
		meshBuilder.AddBox(new Vector3(0f, -0.008f, 0.62f), new Vector3(0.022f, 0.032f, 0.02f), 2);
		meshBuilder.AddBox(new Vector3(0f, 0.026f, 0.635f), new Vector3(0.024f, 0.046f, 0.026f), 0);
		meshBuilder.AddBox(new Vector3(-0.01f, 0.055f, 0.635f), new Vector3(0.004f, 0.022f, 0.016f), 0);
		meshBuilder.AddBox(new Vector3(0.01f, 0.055f, 0.635f), new Vector3(0.004f, 0.022f, 0.016f), 0);
		meshBuilder.AddCylinder(new Vector3(0f, 0.053f, 0.635f), Vector3.up, 0.003f, 0.016f, 6, 4);
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0.005f, 0.705f), Vector3.forward, 0.015f, 0.013f, 0.052f, 12, 2);
		meshBuilder.AddBox(new Vector3(0f, -0.045f, 0.052f), new Vector3(0.016f, 0.022f, 0.016f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.072f, 0.095f), new Vector3(0.036f, 0.075f, 0.068f), new Vector3(8f, 0f, 0f), 7);
		meshBuilder.AddBox(new Vector3(0f, -0.135f, 0.112f), new Vector3(0.035f, 0.07f, 0.066f), new Vector3(20f, 0f, 0f), 7);
		meshBuilder.AddBox(new Vector3(0f, -0.19f, 0.14f), new Vector3(0.034f, 0.065f, 0.064f), new Vector3(32f, 0f, 0f), 7);
		meshBuilder.AddBox(new Vector3(0f, -0.22f, 0.16f), new Vector3(0.038f, 0.01f, 0.068f), new Vector3(34f, 0f, 0f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.078f, -0.068f), new Vector3(0.034f, 0.11f, 0.042f), new Vector3(-22f, 0f, 0f), 6);
		meshBuilder.AddBox(new Vector3(0f, -0.128f, -0.088f), new Vector3(0.036f, 0.012f, 0.046f), new Vector3(-22f, 0f, 0f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.062f, -0.01f), new Vector3(0.014f, 0.006f, 0.068f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.046f, 0.022f), new Vector3(0.014f, 0.034f, 0.006f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.046f, -0.006f), new Vector3(0.006f, 0.024f, 0.01f), new Vector3(16f, 0f, 0f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.006f, -0.12f), new Vector3(0.044f, 0.052f, 0.06f), 0);
		meshBuilder.AddBox(new Vector3(0f, -0.022f, -0.255f), new Vector3(0.042f, 0.078f, 0.25f), new Vector3(-7f, 0f, 0f), 1);
		meshBuilder.AddBox(new Vector3(0f, -0.005f, -0.25f), new Vector3(0.036f, 0.022f, 0.22f), new Vector3(-7f, 0f, 0f), 6);
		meshBuilder.AddBox(new Vector3(0f, -0.038f, -0.382f), new Vector3(0.044f, 0.095f, 0.014f), new Vector3(-7f, 0f, 0f), 2);
		meshBuilder.AddRing(new Vector3(0f, -0.08f, -0.335f), Vector3.right, 0.01f, 0.003f, 10, 6, 5);
		return meshBuilder.Build("Weapons_AK47");
	}

	private static Mesh BuildShotgun()
	{
		//IL_0016: 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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0188: 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)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: 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_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: 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_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0349: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: 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_03bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_045c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0470: Unknown result type (might be due to invalid IL or missing references)
		//IL_0484: Unknown result type (might be due to invalid IL or missing references)
		//IL_049f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_050a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0525: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		MeshBuilder meshBuilder = new MeshBuilder();
		meshBuilder.AddBox(new Vector3(0f, -0.004f, 0.01f), new Vector3(0.054f, 0.072f, 0.23f), 0);
		meshBuilder.AddBox(new Vector3(0f, 0.034f, 0.01f), new Vector3(0.042f, 0.012f, 0.21f), 0);
		meshBuilder.AddBox(new Vector3(0f, 0.042f, 0.01f), new Vector3(0.022f, 0.006f, 0.18f), 2);
		meshBuilder.AddBox(new Vector3(0.026f, 0.006f, 0.04f), new Vector3(0.008f, 0.022f, 0.075f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.042f, 0.03f), new Vector3(0.026f, 0.006f, 0.085f), 5);
		meshBuilder.AddBox(new Vector3(0.01f, -0.044f, 0.01f), new Vector3(0.01f, 0.006f, 0.028f), 8);
		meshBuilder.AddCylinder(new Vector3(0f, 0.015f, 0.41f), Vector3.forward, 0.0135f, 0.6f, 14, 0);
		meshBuilder.AddCylinder(new Vector3(0f, 0.015f, 0.7f), Vector3.forward, 0.0145f, 0.022f, 14, 2);
		meshBuilder.AddBox(new Vector3(0f, 0.034f, 0.41f), new Vector3(0.011f, 0.006f, 0.58f), 2);
		for (int i = 0; i < 7; i++)
		{
			meshBuilder.AddBox(new Vector3(0f, 0.029f, 0.16f + (float)i * 0.078f), new Vector3(0.009f, 0.008f, 0.016f), 0);
		}
		meshBuilder.AddCylinder(new Vector3(0f, 0.041f, 0.685f), Vector3.forward, 0.004f, 0.018f, 8, 4);
		meshBuilder.AddCylinder(new Vector3(0f, -0.024f, 0.36f), Vector3.forward, 0.0125f, 0.51f, 12, 0);
		meshBuilder.AddCylinder(new Vector3(0f, -0.024f, 0.618f), Vector3.forward, 0.0145f, 0.026f, 12, 2);
		meshBuilder.AddBox(new Vector3(0f, -0.004f, 0.57f), new Vector3(0.026f, 0.052f, 0.018f), 5);
		meshBuilder.AddCylinder(new Vector3(0f, -0.024f, 0.31f), Vector3.forward, 0.027f, 0.175f, 12, 1);
		for (int j = 0; j < 6; j++)
		{
			meshBuilder.AddCylinder(new Vector3(0f, -0.024f, 0.242f + (float)j * 0.027f), Vector3.forward, 0.0285f, 0.009f, 12, 6);
		}
		meshBuilder.AddBox(new Vector3(-0.018f, -0.015f, 0.16f), new Vector3(0.005f, 0.008f, 0.14f), 5);
		meshBuilder.AddBox(new Vector3(0.018f, -0.015f, 0.16f), new Vector3(0.005f, 0.008f, 0.14f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.056f, -0.04f), new Vector3(0.014f, 0.006f, 0.068f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.044f, -0.008f), new Vector3(0.014f, 0.028f, 0.006f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.042f, -0.036f), new Vector3(0.006f, 0.022f, 0.01f), new Vector3(14f, 0f, 0f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.036f, -0.14f), new Vector3(0.042f, 0.066f, 0.105f), new Vector3(-26f, 0f, 0f), 1);
		meshBuilder.AddBox(new Vector3(0f, -0.04f, -0.285f), new Vector3(0.046f, 0.092f, 0.245f), new Vector3(-8f, 0f, 0f), 1);
		meshBuilder.AddBox(new Vector3(0f, -0.018f, -0.275f), new Vector3(0.038f, 0.028f, 0.215f), new Vector3(-8f, 0f, 0f), 6);
		meshBuilder.AddBox(new Vector3(0f, -0.055f, -0.408f), new Vector3(0.048f, 0.102f, 0.02f), new Vector3(-8f, 0f, 0f), 2);
		meshBuilder.AddRing(new Vector3(0f, -0.098f, -0.355f), Vector3.right, 0.01f, 0.003f, 10, 6, 5);
		return meshBuilder.Build("Weapons_Shotgun");
	}

	private static Mesh BuildBomb()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_00cb: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: 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_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		MeshBuilder meshBuilder = new MeshBuilder();
		meshBuilder.AddSphere(Vector3.zero, 0.118f, 14, 18, 3);
		meshBuilder.AddCylinder(Vector3.zero, Vector3.up, 0.123f, 0.026f, 20, 2);
		meshBuilder.AddCylinder(new Vector3(0f, 0.048f, 0f), Vector3.up, 0.112f, 0.016f, 18, 3);
		meshBuilder.AddCylinder(new Vector3(0f, -0.048f, 0f), Vector3.up, 0.112f, 0.016f, 18, 3);
		meshBuilder.AddCylinder(new Vector3(0f, 0.118f, 0f), Vector3.up, 0.036f, 0.034f, 14, 0);
		meshBuilder.AddBox(new Vector3(0f, 0.146f, 0f), new Vector3(0.038f, 0.026f, 0.048f), 0);
		meshBuilder.AddBox(new Vector3(0f, 0.155f, -0.038f), new Vector3(0.02f, 0.01f, 0.055f), new Vector3(12f, 0f, 0f), 8);
		meshBuilder.AddBox(new Vector3(0f, 0.095f, -0.088f), new Vector3(0.02f, 0.13f, 0.008f), new Vector3(-24f, 0f, 0f), 8);
		meshBuilder.AddRing(new Vector3(0.038f, 0.146f, 0.01f), Vector3.forward, 0.022f, 0.0035f, 12, 6, 5);
		meshBuilder.AddCylinder(new Vector3(0f, 0.175f, 0.005f), Vector3.up, 0.008f, 0.048f, 8, 2);
		meshBuilder.AddSphere(new Vector3(0f, 0.2f, 0.005f), 0.015f, 8, 10, 4);
		return meshBuilder.Build("Weapons_Bomb");
	}

	private static Mesh BuildRpgLauncher()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: 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_02af: 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_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_037f: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: 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)
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_042c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0452: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_0481: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_050d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0512: Unknown result type (might be due to invalid IL or missing references)
		//IL_0539: Unknown result type (might be due to invalid IL or missing references)
		//IL_054d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0568: Unknown result type (might be due to invalid IL or missing references)
		//IL_057c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0597: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05da: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0609: Unknown result type (might be due to invalid IL or missing references)
		//IL_061d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0639: Unknown result type (might be due to invalid IL or missing references)
		//IL_064d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0668: Unknown result type (might be due to invalid IL or missing references)
		//IL_067c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0697: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06db: Unknown result type (might be due to invalid IL or missing references)
		MeshBuilder meshBuilder = new MeshBuilder();
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0f, -0.585f), Vector3.forward, 0.068f, 0.032f, 0.13f, 18, 2);
		meshBuilder.AddRing(new Vector3(0f, 0f, -0.648f), Vector3.forward, 0.066f, 0.006f, 18, 6, 2);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, -0.515f), Vector3.forward, 0.033f, 0.024f, 14, 0);
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0f, -0.43f), Vector3.forward, 0.03f, 0.034f, 0.15f, 16, 9);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, -0.352f), Vector3.forward, 0.036f, 0.014f, 14, 2);
		meshBuilder.AddBox(new Vector3(0f, 0.038f, -0.352f), new Vector3(0.01f, 0.014f, 0.012f), 5);
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0f, -0.29f), Vector3.forward, 0.036f, 0.048f, 0.11f, 16, 9);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, -0.205f), Vector3.forward, 0.048f, 0.065f, 16, 9);
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0f, -0.145f), Vector3.forward, 0.048f, 0.038f, 0.055f, 16, 9);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, -0.065f), Vector3.forward, 0.039f, 0.11f, 16, 2);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, 0.035f), Vector3.forward, 0.043f, 0.09f, 16, 0);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, 0.235f), Vector3.forward, 0.031f, 0.32f, 16, 2);
		for (int i = 0; i < 4; i++)
		{
			meshBuilder.AddCylinder(new Vector3(0f, 0f, 0.12f + (float)i * 0.055f), Vector3.forward, 0.033f, 0.012f, 14, 0);
		}
		meshBuilder.AddCylinder(new Vector3(0f, 0f, 0.395f), Vector3.forward, 0.035f, 0.042f, 16, 2);
		meshBuilder.AddBox(new Vector3(0f, 0.045f, -0.045f), new Vector3(0.022f, 0.024f, 0.048f), 2);
		meshBuilder.AddBox(new Vector3(-0.008f, 0.072f, -0.045f), new Vector3(0.005f, 0.042f, 0.014f), 2);
		meshBuilder.AddBox(new Vector3(0.008f, 0.072f, -0.045f), new Vector3(0.005f, 0.042f, 0.014f), 2);
		meshBuilder.AddBox(new Vector3(0f, 0.091f, -0.045f), new Vector3(0.021f, 0.006f, 0.014f), 2);
		meshBuilder.AddBox(new Vector3(0f, 0.038f, 0.305f), new Vector3(0.022f, 0.022f, 0.052f), 2);
		meshBuilder.AddBox(new Vector3(-0.008f, 0.068f, 0.312f), new Vector3(0.005f, 0.044f, 0.014f), 2);
		meshBuilder.AddBox(new Vector3(0.008f, 0.068f, 0.312f), new Vector3(0.005f, 0.044f, 0.014f), 2);
		meshBuilder.AddBox(new Vector3(0f, 0.088f, 0.312f), new Vector3(0.021f, 0.006f, 0.014f), 2);
		meshBuilder.AddCylinder(new Vector3(0f, 0.068f, 0.312f), Vector3.up, 0.003f, 0.022f, 6, 4);
		meshBuilder.AddBox(new Vector3(-0.038f, 0.01f, -0.065f), new Vector3(0.014f, 0.022f, 0.085f), 2);
		meshBuilder.AddBox(new Vector3(-0.042f, 0.045f, -0.055f), new Vector3(0.024f, 0.05f, 0.036f), 0);
		meshBuilder.AddCylinder(new Vector3(-0.042f, 0.078f, -0.055f), Vector3.forward, 0.018f, 0.085f, 12, 0);
		meshBuilder.AddTaperedCylinder(new Vector3(-0.042f, 0.078f, -0.105f), Vector3.forward, 0.021f, 0.016f, 0.024f, 12, 2);
		meshBuilder.AddCylinder(new Vector3(-0.042f, 0.1f, -0.055f), Vector3.up, 0.01f, 0.014f, 10, 2);
		meshBuilder.AddBox(new Vector3(0f, -0.052f, 0.045f), new Vector3(0.024f, 0.054f, 0.058f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.076f, 0.084f), new Vector3(0.014f, 0.006f, 0.032f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.058f, 0.098f), new Vector3(0.014f, 0.038f, 0.006f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.056f, 0.08f), new Vector3(0.006f, 0.024f, 0.008f), new Vector3(14f, 0f, 0f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.114f, 0.045f), new Vector3(0.024f, 0.082f, 0.034f), 9);
		meshBuilder.AddBox(new Vector3(0f, -0.114f, 0.045f), new Vector3(0.012f, 0.084f, 0.038f), 5);
		meshBuilder.AddBox(new Vector3(0f, -0.048f, -0.1f), new Vector3(0.024f, 0.032f, 0.032f), 2);
		meshBuilder.AddBox(new Vector3(0f, -0.102f, -0.1f), new Vector3(0.024f, 0.086f, 0.032f), 9);
		meshBuilder.AddBox(new Vector3(0f, -0.102f, -0.1f), new Vector3(0.01f, 0.088f, 0.035f), 2);
		return meshBuilder.Build("Weapons_RPG7");
	}

	private static Mesh BuildRpgRocket()
	{
		//IL_0015: 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)
		//IL_0041: 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_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_00d0: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		MeshBuilder meshBuilder = new MeshBuilder();
		meshBuilder.AddCylinder(new Vector3(0f, 0f, -0.13f), Vector3.forward, 0.015f, 0.24f, 12, 3);
		meshBuilder.AddBox(new Vector3(0f, 0f, -0.22f), new Vector3(0.004f, 0.07f, 0.05f), 3);
		meshBuilder.AddBox(new Vector3(0f, 0f, -0.22f), new Vector3(0.07f, 0.004f, 0.05f), 3);
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0f, 0.045f), Vector3.forward, 0.02f, 0.056f, 0.14f, 16, 3);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, 0.135f), Vector3.forward, 0.057f, 0.045f, 16, 3);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, 0.156f), Vector3.forward, 0.059f, 0.012f, 16, 2);
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0f, 0.26f), Vector3.forward, 0.056f, 0.019f, 0.195f, 16, 3);
		meshBuilder.AddCylinder(new Vector3(0f, 0f, 0.375f), Vector3.forward, 0.019f, 0.038f, 14, 3);
		meshBuilder.AddTaperedCylinder(new Vector3(0f, 0f, 0.415f), Vector3.forward, 0.019f, 0.015f, 0.045f, 14, 5);
		meshBuilder.AddSphere(new Vector3(0f, 0f, 0.436f), 0.014f, 8, 12, 5);
		return meshBuilder.Build("Weapons_PG7V_Rocket");
	}

	private static Mesh BuildShockwaveRing()
	{
		//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)
		MeshBuilder meshBuilder = new MeshBuilder();
		meshBuilder.AddRing(Vector3.zero, Vector3.up, 1f, 0.06f, 28, 8, 5);
		return meshBuilder.Build("Weapons_ShockwaveRing");
	}

	private static Texture2D BuildPalette()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Expected O, but got Unknown
		//IL_0040: 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_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: 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_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		int num = 640;
		int num2 = 64;
		Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false);
		Color32[] array = (Color32[])(object)new Color32[num * num2];
		Random random = new Random(1337);
		Color[] array2 = (Color[])(object)new Color[10]
		{
			new Color(0.24f, 0.25f, 0.28f),
			new Color(0.46f, 0.25f, 0.11f),
			new Color(0.07f, 0.07f, 0.08f),
			new Color(0.22f, 0.27f, 0.14f),
			new Color(0.9f, 0.14f, 0.08f),
			new Color(0.62f, 0.64f, 0.67f),
			new Color(0.3f, 0.15f, 0.06f),
			new Color(0.13f, 0.14f, 0.16f),
			new Color(0.72f, 0.56f, 0.2f),
			new Color(0.78f, 0.4f, 0.12f)
		};
		for (int i = 0; i < num2; i++)
		{
			for (int j = 0; j < num; j++)
			{
				int num3 = j / 64;
				Color val2 = array2[num3];
				float num4 = 1f + (float)(random.NextDouble() - 0.5) * 0.14f;
				if (num3 == 0 || num3 == 5)
				{
					num4 *= 1f + 0.06f * Mathf.Sin((float)i * 1.7f);
				}
				if (num3 == 1 || num3 == 6 || num3 == 9)
				{
					num4 *= 1f + 0.11f * Mathf.Sin((float)(j % 64) * 0.9f + (float)i * 0.15f);
				}
				array[i * num + j] = new Color32((byte)Mathf.Clamp(val2.r * num4 * 255f, 0f, 255f), (byte)Mathf.Clamp(val2.g * num4 * 255f, 0f, 255f), (byte)Mathf.Clamp(val2.b * num4 * 255f, 0f, 255f), byte.MaxValue);
			}
		}
		val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array));
		val.Apply();
		((Texture)val).filterMode = (FilterMode)1;
		((Texture)val).wrapMode = (TextureWrapMode)1;
		((Object)val).hideFlags = (HideFlags)32;
		return val;
	}

	private static bool CompatibleMaterial(Material material)
	{
		if ((Object)(object)material == (Object)null || (Object)(object)material.shader == (Object)null || !material.shader.isSupported || material.passCount == 0)
		{
			return false;
		}
		string tag = material.GetTag("RenderPipeline", false, "");
		string name = ((Object)material.shader).name;
		if ((Object)(object)CurrentPipeline != (Object)null)
		{
			if (!(tag == "UniversalPipeline") && !(tag == "UniversalRenderPipeline"))
			{
				return name.StartsWith("Universal Render Pipeline/", StringComparison.Ordinal);
			}
			return true;
		}
		if (string.IsNullOrEmpty(tag) && !name.StartsWith("Universal Render Pipeline/", StringComparison.Ordinal))
		{
			return !name.StartsWith("HDRP/", StringComparison.Ordinal);
		}
		return false;
	}

	private static Shader FindShader(params string[] names)
	{
		for (int i = 0; i < names.Length; i++)
		{
			Shader val = Shader.Find(names[i]);
			if ((Object)(object)val != (Object)null && val.isSupported)
			{
				return val;
			}
		}
		return null;
	}

	private static Material CloneGameMaterial()
	{
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Expected O, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Invalid comparison between Unknown and I4
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Material val = null;
			int num = int.MinValue;
			foreach (Object item in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<MeshRenderer>()))
			{
				MeshRenderer val2 = ((item == (Object)null) ? null : ((Il2CppObjectBase)item).TryCast<MeshRenderer>());
				if ((Object)(object)val2 == (Object)null || !((Renderer)val2).enabled || !((Component)val2).gameObject.activeInHierarchy || !((Renderer)val2).isVisible || ((Object)val2).name.StartsWith("Weapon") || (int)((Renderer)val2).shadowCastingMode == 3)
				{
					continue;
				}
				foreach (Material item2 in (Il2CppArrayBase<Material>)(object)((Renderer)val2).sharedMaterials)
				{
					if (!CompatibleMaterial(item2) || item2.renderQueue > 2500 || (!item2.HasProperty("_BaseMap") && !item2.HasProperty("_MainTex")))
					{
						continue;
					}
					string text = ((Object)item2.shader).name.ToLowerInvariant();
					if (!text.Contains("hidden/") && !text.Contains("shadow") && !text.Contains("depth") && !text.Contains("particle") && !text.Contains("sprite") && !text.Contains("ui/") && !text.Contains("decal") && !text.Contains("terrain") && !text.Contains("water") && !text.Contains("stencil") && (!item2.HasProperty("_Color") || !(item2.GetColor("_Color").a < 0.99f)) && (!item2.HasProperty("_BaseColor") || !(item2.GetColor("_BaseColor").a < 0.99f)))
					{
						int num2 = ((text == "universal render pipeline/lit") ? 50 : (text.Contains("simple lit") ? 40 : ((text == "standard") ? 30 : 10)));
						if (num2 > num)
						{
							num = num2;
							val = item2;
						}
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				return new Material(val);
			}
		}
		catch
		{
		}
		return null;
	}

	private static Material PipelineMaterial(bool unlit)
	{
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Expected O, but got Unknown
		string[] array = ((!((Object)(object)CurrentPipeline != (Object)null)) ? ((!unlit) ? new string[4] { "Standard", "Legacy Shaders/Diffuse", "Unlit/Texture", "Unlit/Color" } : new string[4] { "Unlit/Texture", "Unlit/Color", "Standard", "Legacy Shaders/Diffuse" }) : ((!unlit) ? new string[3] { "Universal Render Pipeline/Lit", "Universal Render Pipeline/Simple Lit", "Universal Render Pipeline/Unlit" } : new string[4] { "Universal Render Pipeline/Unlit", "Universal Render Pipeline/Particles/Unlit", "Universal Render Pipeline/Lit", "Universal Render Pipeline/Simple Lit" }));
		foreach (string text in array)
		{
			Shader val = FindShader(text);
			if (!((Object)(object)val == (Object)null))
			{
				Material val2 = new Material(val);
				if (CompatibleMaterial(val2))
				{
					return val2;
				}
				Object.Destroy((Object)(object)val2);
			}
		}
		return CloneGameMaterial() ?? throw new InvalidOperationException("No compatible shader for active render pipeline.");
	}

	private static void FloatIf(Material m, string name, float value)
	{
		if (m.HasProperty(name))
		{
			m.SetFloat(name, value);
		}
	}

	private static void Opaque(Material m)
	{
		string[] array = new string[5] { "_ALPHATEST_ON", "_ALPHABLEND_ON", "_ALPHAPREMULTIPLY_ON", "_SURFACE_TYPE_TRANSPARENT", "_ALPHAMODULATE_ON" };
		foreach (string text in array)
		{
			m.DisableKeyword(text);
		}
		FloatIf(m, "_Mode", 0f);
		FloatIf(m, "_Surface", 0f);
		FloatIf(m, "_SurfaceType", 0f);
		FloatIf(m, "_AlphaClip", 0f);
		FloatIf(m, "_Cutoff", 0f);
		FloatIf(m, "_SrcBlend", 1f);
		FloatIf(m, "_DstBlend", 0f);
		FloatIf(m, "_SrcBlendAlpha", 1f);
		FloatIf(m, "_DstBlendAlpha", 0f);
		FloatIf(m, "_ZWrite", 1f);
		FloatIf(m, "_Cull", 2f);
		FloatIf(m, "_ColorMask", 15f);
		m.SetOverrideTag("RenderType", "Opaque");
		m.renderQueue = 2000;
		array = new string[8] { "ForwardBase", "UniversalForward", "UniversalForwardOnly", "UniversalGBuffer", "SRPDefaultUnlit", "DepthOnly", "DepthNormals", "ShadowCaster" };
		foreach (string text2 in array)
		{
			m.SetShaderPassEnabled(text2, true);
		}
	}

	private static void ApplyTexture(Material m, Texture2D tex)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
		string[] array = new string[2] { "_BaseMap", "_MainTex" };
		foreach (string text in array)
		{
			if (m.HasProperty(text))
			{
				m.SetTexture(text, (Texture)(object)tex);
				m.SetTextureScale(text, Vector2.one);
				m.SetTextureOffset(text, Vector2.zero);
			}
		}
		if (m.HasProperty("_BaseColor"))
		{
			m.SetColor("_BaseColor", Color.white);
		}
		if (m.HasProperty("_Color"))
		{
			m.SetColor("_Color", Color.white);
		}
		FloatIf(m, "_Smoothness", 0.25f);
		FloatIf(m, "_Metallic", 0f);
		if (m.HasProperty("_EmissionColor"))
		{