Decompiled source of A3A Exotic 12 Gauge v1.0.2

A3A_Exotic_12_Gauge.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEditor;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
	public bool OnlyDeactivate;

	private void OnEnable()
	{
		((MonoBehaviour)this).StartCoroutine("CheckIfAlive");
	}

	private IEnumerator CheckIfAlive()
	{
		do
		{
			yield return (object)new WaitForSeconds(0.5f);
		}
		while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true));
		if (OnlyDeactivate)
		{
			((Component)this).gameObject.SetActive(false);
		}
		else
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
	public float duration = 1f;

	public float delay = 0f;

	public float finalIntensity = 0f;

	private float baseIntensity;

	public bool autodestruct;

	private float p_lifetime = 0f;

	private float p_delay;

	private void Start()
	{
		baseIntensity = ((Component)this).GetComponent<Light>().intensity;
	}

	private void OnEnable()
	{
		p_lifetime = 0f;
		p_delay = delay;
		if (delay > 0f)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = false;
		}
	}

	private void Update()
	{
		if (p_delay > 0f)
		{
			p_delay -= Time.deltaTime;
			if (p_delay <= 0f)
			{
				((Behaviour)((Component)this).GetComponent<Light>()).enabled = true;
			}
		}
		else if (p_lifetime / duration < 1f)
		{
			((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration);
			p_lifetime += Time.deltaTime;
		}
		else if (autodestruct)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(MeshFilter))]
public class WFX_BulletHoleDecal : MonoBehaviour
{
	private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4]
	{
		new Vector2(0f, 0f),
		new Vector2(0f, 1f),
		new Vector2(1f, 0f),
		new Vector2(1f, 1f)
	};

	public float lifetime = 10f;

	public float fadeoutpercent = 80f;

	public Vector2 frames;

	public bool randomRotation = false;

	public bool deactivate = false;

	private float life;

	private float fadeout;

	private Color color;

	private float orgAlpha;

	private void Awake()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor");
		orgAlpha = color.a;
	}

	private void OnEnable()
	{
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		int num = Random.Range(0, (int)(frames.x * frames.y));
		int num2 = (int)((float)num % frames.x);
		int num3 = (int)((float)num / frames.y);
		Vector2[] array = (Vector2[])(object)new Vector2[4];
		for (int i = 0; i < 4; i++)
		{
			array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x);
			array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y);
		}
		((Component)this).GetComponent<MeshFilter>().mesh.uv = array;
		if (randomRotation)
		{
			((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1);
		}
		life = lifetime;
		fadeout = life * (fadeoutpercent / 100f);
		color.a = orgAlpha;
		((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine("holeUpdate");
	}

	private IEnumerator holeUpdate()
	{
		while (life > 0f)
		{
			life -= Time.deltaTime;
			if (life <= fadeout)
			{
				color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout);
				((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
			}
			yield return null;
		}
	}
}
[RequireComponent(typeof(Light))]
public class WFX_LightFlicker : MonoBehaviour
{
	public float time = 0.05f;

	private float timer;

	private void Start()
	{
		timer = time;
		((MonoBehaviour)this).StartCoroutine("Flicker");
	}

	private IEnumerator Flicker()
	{
		while (true)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled;
			do
			{
				timer -= Time.deltaTime;
				yield return null;
			}
			while (timer > 0f);
			timer = time;
		}
	}
}
namespace Andr3a.A3A_Exotic_12_Gauge;

[BepInPlugin("Andr3a.A3A_Exotic_12_Gauge", "A3A_Exotic_12_Gauge", "1.0.2")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class A3A_Exotic_12_GaugePlugin : BaseUnityPlugin
{
	private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	internal static ManualLogSource Logger;

	private void Awake()
	{
		Logger = ((BaseUnityPlugin)this).Logger;
		LoadAssets();
	}

	private void LoadAssets()
	{
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Andr3a.A3A_Exotic_12_Gauge");
		OtherLoader.RegisterDirectLoad(BasePath, "Andr3a.A3A_Exotic_12_Gauge", "", "", "", "exotic12gau");
	}
}
public class MagazineGizmos : MonoBehaviour
{
	public float gizmoSize;

	public void OnDrawGizmos()
	{
		//IL_0001: 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)
		Gizmos.color = Color.yellow;
		Gizmos.DrawSphere(((Component)this).transform.position, gizmoSize);
	}
}
public class MagazineHelper : EditorWindow
{
	public FVRFireArmMagazine Magazine;

	public bool isCurved;

	public Transform magazineRadiusCenter;

	public GameObject firstCartridge;

	public int numberOfCartridges = 1;

	public bool mirrorX;

	public float cartridgeOffsetY = 0f;

	public float cartridgeOffsetZ = 0f;

	public float cartridgeAngleOffsetX;

	public bool generateFollowerPoints;

	public bool useFollowerOffsets = false;

	public bool invertFollowerOffsets = false;

	public GameObject follower;

	public float followerOffsetY = 0f;

	public float followerOffsetZ = 0f;

	public bool showGizmo = false;

	public float gizmoSize = 0.01f;

	private GameObject cartridge_root;

	private GameObject[] CartridgeObjectList;

	private MeshFilter[] CartridgeMeshFilterList;

	private MeshRenderer[] CartridgeMeshRendererList;

	private float cartridge_currentX;

	private float cartridge_currentY;

	private float cartridge_currentZ;

	private bool ready1 = true;

	private bool ready2 = true;

	private GameObject follower_root;

	private GameObject[] FollowerObjectList;

	private float follower_currentX;

	private float follower_currentY;

	private float follower_currentZ;

	private float cartridge_angleX;

	private float cartridge_angleY;

	private MagazineGizmos gizmo;

	[MenuItem("Window/Magazine Helper")]
	public static void ShowWindow()
	{
		EditorWindow.GetWindow(typeof(MagazineHelper));
	}

	private void OnGUI()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Expected O, but got Unknown
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Expected O, but got Unknown
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Expected O, but got Unknown
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Expected O, but got Unknown
		GUILayout.Label("Cartridge Settings", EditorStyles.boldLabel, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		EditorGUIUtility.labelWidth = 300f;
		Magazine = (FVRFireArmMagazine)EditorGUILayout.ObjectField("Magazine", (Object)(object)Magazine, typeof(FVRFireArmMagazine), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if ((Object)(object)Magazine == (Object)null)
		{
			EditorGUILayout.HelpBox("Please add Magazine!", (MessageType)3);
			ready1 = false;
		}
		isCurved = EditorGUILayout.Toggle("is curved", isCurved, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (isCurved)
		{
			magazineRadiusCenter = (Transform)EditorGUILayout.ObjectField("Magazine Radius Center", (Object)(object)magazineRadiusCenter, typeof(Transform), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			if ((Object)(object)magazineRadiusCenter == (Object)null)
			{
				EditorGUILayout.HelpBox("Please add Magazine Radius Center!", (MessageType)3);
				ready1 = false;
			}
			else
			{
				cartridgeAngleOffsetX = EditorGUILayout.Slider("Cartridge Angle Offset X", cartridgeAngleOffsetX, -10f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
				showGizmo = EditorGUILayout.Toggle("Show Curved Mag Gizmo", showGizmo, (GUILayoutOption[])(object)new GUILayoutOption[0]);
				gizmoSize = EditorGUILayout.FloatField("Gizmo Size", gizmoSize, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			}
		}
		else
		{
			showGizmo = false;
		}
		ShowGizmo(showGizmo);
		if (showGizmo)
		{
			gizmo.gizmoSize = gizmoSize;
		}
		firstCartridge = (GameObject)EditorGUILayout.ObjectField("First Cartridge", (Object)(object)firstCartridge, typeof(GameObject), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if ((Object)(object)firstCartridge == (Object)null)
		{
			EditorGUILayout.HelpBox("Please add Reference Cartridge!", (MessageType)3);
			ready1 = false;
		}
		numberOfCartridges = EditorGUILayout.IntField("Number of Cartridges", numberOfCartridges, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (numberOfCartridges <= 0)
		{
			numberOfCartridges = 1;
		}
		mirrorX = EditorGUILayout.Toggle("Is double stacked Magazine (mirror X axis)", mirrorX, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (!isCurved)
		{
			cartridgeOffsetY = EditorGUILayout.Slider("Cartridge Offset Y", cartridgeOffsetY, -0.1f, 0.1f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			cartridgeOffsetZ = EditorGUILayout.Slider("Cartridge Offset Z", cartridgeOffsetZ, -0.1f, 0.1f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		}
		generateFollowerPoints = EditorGUILayout.BeginToggleGroup("Generate Follower Points", generateFollowerPoints);
		follower = (GameObject)EditorGUILayout.ObjectField("Last Round Follower", (Object)(object)follower, typeof(GameObject), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if ((Object)(object)follower == (Object)null && generateFollowerPoints)
		{
			EditorGUILayout.HelpBox("Please add Follower!", (MessageType)3);
			ready2 = false;
		}
		followerOffsetY = cartridgeOffsetY;
		followerOffsetZ = cartridgeOffsetZ;
		EditorGUILayout.EndToggleGroup();
		if (ready1 && !generateFollowerPoints)
		{
			if (GUILayout.Button("Add Cartridges", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
			{
				AddCartridges();
			}
			if (GUILayout.Button("Clear Cartridges", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
			{
				ClearCartridges(all: true);
			}
		}
		else if (ready1 && ready2)
		{
			if (GUILayout.Button("Add Cartridges and FollowerPoints", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
			{
				AddCartridges();
				AddFollowerPoints();
			}
			if (GUILayout.Button("Clear Cartridges and FollowerPoints", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
			{
				ClearCartridges(all: true);
				ClearFollowerPoints(all: true);
			}
			if (GUILayout.Button("Remove FollowerPoint Visuals", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
			{
				RemoveFollowerPointVisuals();
			}
		}
		ready1 = true;
		ready2 = true;
	}

	private void AddCartridges()
	{
		//IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Expected O, but got Unknown
		//IL_0130: 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_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: 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_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: 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_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)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: 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_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		ClearCartridges();
		CartridgeObjectList = (GameObject[])(object)new GameObject[numberOfCartridges];
		CartridgeMeshFilterList = (MeshFilter[])(object)new MeshFilter[numberOfCartridges];
		CartridgeMeshRendererList = (MeshRenderer[])(object)new MeshRenderer[numberOfCartridges];
		CartridgeObjectList[0] = firstCartridge;
		CartridgeMeshFilterList[0] = firstCartridge.GetComponent<MeshFilter>();
		CartridgeMeshRendererList[0] = firstCartridge.GetComponent<MeshRenderer>();
		cartridge_currentX = firstCartridge.transform.position.x;
		cartridge_currentY = firstCartridge.transform.position.y;
		cartridge_currentZ = firstCartridge.transform.position.z;
		if ((Object)(object)cartridge_root == (Object)null)
		{
			cartridge_root = new GameObject();
			((Object)cartridge_root).name = "Cartridge Root";
			cartridge_root.transform.parent = firstCartridge.transform.parent;
			cartridge_root.transform.localPosition = new Vector3(0f, 0f, 0f);
			cartridge_root.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			cartridge_root.transform.localScale = new Vector3(1f, 1f, 1f);
		}
		Vector3 eulerAngles = default(Vector3);
		Vector3 val2 = default(Vector3);
		for (int i = 2; i <= numberOfCartridges; i++)
		{
			if (isCurved)
			{
				Vector3 val = CalculateNextCartridgePos(cartridgeAngleOffsetX * (float)(i - 1));
				cartridge_currentY = val.y;
				cartridge_currentZ = val.z;
			}
			else
			{
				cartridge_currentY += cartridgeOffsetY;
				cartridge_currentZ += cartridgeOffsetZ;
			}
			Quaternion localRotation = firstCartridge.transform.localRotation;
			if (isCurved)
			{
				Quaternion localRotation2 = firstCartridge.transform.localRotation;
				float num = ((Quaternion)(ref localRotation2)).eulerAngles.x - cartridgeAngleOffsetX * (float)(i - 1);
				Quaternion localRotation3 = firstCartridge.transform.localRotation;
				float y = ((Quaternion)(ref localRotation3)).eulerAngles.y;
				Quaternion localRotation4 = firstCartridge.transform.localRotation;
				((Vector3)(ref eulerAngles))..ctor(num, y, ((Quaternion)(ref localRotation4)).eulerAngles.z);
			}
			else
			{
				Quaternion localRotation5 = firstCartridge.transform.localRotation;
				float x = ((Quaternion)(ref localRotation5)).eulerAngles.x;
				Quaternion localRotation6 = firstCartridge.transform.localRotation;
				float y2 = ((Quaternion)(ref localRotation6)).eulerAngles.y;
				Quaternion localRotation7 = firstCartridge.transform.localRotation;
				((Vector3)(ref eulerAngles))..ctor(x, y2, ((Quaternion)(ref localRotation7)).eulerAngles.z);
			}
			((Quaternion)(ref localRotation)).eulerAngles = eulerAngles;
			((Vector3)(ref val2))..ctor(cartridge_currentX, cartridge_currentY, cartridge_currentZ);
			GameObject val3 = Object.Instantiate<GameObject>(firstCartridge, val2, localRotation, cartridge_root.transform);
			((Object)val3).name = ((Object)firstCartridge).name + " (" + i + ")";
			if (mirrorX && i % 2 == 0)
			{
				val3.transform.localPosition = new Vector3(0f - val3.transform.localPosition.x, val3.transform.localPosition.y, val3.transform.localPosition.z);
			}
			CartridgeObjectList[i - 1] = val3;
			CartridgeMeshFilterList[i - 1] = val3.GetComponent<MeshFilter>();
			CartridgeMeshRendererList[i - 1] = val3.GetComponent<MeshRenderer>();
		}
		Magazine.DisplayBullets = CartridgeObjectList;
		Magazine.DisplayMeshFilters = CartridgeMeshFilterList;
		Magazine.DisplayRenderers = (Renderer[])(object)CartridgeMeshRendererList;
	}

	private void ClearCartridges(bool all = false)
	{
		if ((Object)(object)cartridge_root != (Object)null)
		{
			int childCount = cartridge_root.transform.childCount;
			for (int num = childCount - 1; num >= 0; num--)
			{
				Object.DestroyImmediate((Object)(object)((Component)cartridge_root.transform.GetChild(num)).gameObject);
			}
			if (all)
			{
				Object.DestroyImmediate((Object)(object)cartridge_root);
			}
		}
	}

	private void AddFollowerPoints()
	{
		//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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Expected O, but got Unknown
		//IL_00e8: 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_0130: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: 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_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: 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_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: 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_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		ClearFollowerPoints();
		FollowerObjectList = (GameObject[])(object)new GameObject[numberOfCartridges];
		FollowerObjectList[0] = follower;
		follower_currentX = follower.transform.position.x;
		follower_currentY = follower.transform.position.y;
		follower_currentZ = follower.transform.position.z;
		if ((Object)(object)follower_root == (Object)null)
		{
			follower_root = new GameObject();
			((Object)follower_root).name = "Follower Root";
			follower_root.transform.parent = follower.transform.parent;
			follower_root.transform.localPosition = new Vector3(0f, 0f, 0f);
			follower_root.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			follower_root.transform.localScale = new Vector3(1f, 1f, 1f);
		}
		Vector3 val2 = default(Vector3);
		Vector3 eulerAngles = default(Vector3);
		for (int i = 2; i <= numberOfCartridges; i++)
		{
			if (isCurved)
			{
				Vector3 val = CalculateNextCartridgePos(cartridgeAngleOffsetX * (float)(i - 1));
				follower_currentY = val.y;
				follower_currentZ = val.z;
			}
			else
			{
				follower_currentY += followerOffsetY;
				follower_currentZ += followerOffsetZ;
			}
			((Vector3)(ref val2))..ctor(follower_currentX, follower_currentY, follower_currentZ);
			Quaternion localRotation = follower.transform.localRotation;
			if (isCurved)
			{
				Quaternion localRotation2 = follower.transform.localRotation;
				float num = ((Quaternion)(ref localRotation2)).eulerAngles.x - cartridgeAngleOffsetX * (float)(i - 1);
				Quaternion localRotation3 = follower.transform.localRotation;
				float y = ((Quaternion)(ref localRotation3)).eulerAngles.y;
				Quaternion localRotation4 = follower.transform.localRotation;
				((Vector3)(ref eulerAngles))..ctor(num, y, ((Quaternion)(ref localRotation4)).eulerAngles.z);
			}
			else
			{
				Quaternion localRotation5 = follower.transform.localRotation;
				float x = ((Quaternion)(ref localRotation5)).eulerAngles.x;
				Quaternion localRotation6 = follower.transform.localRotation;
				float y2 = ((Quaternion)(ref localRotation6)).eulerAngles.y;
				Quaternion localRotation7 = follower.transform.localRotation;
				((Vector3)(ref eulerAngles))..ctor(x, y2, ((Quaternion)(ref localRotation7)).eulerAngles.z);
			}
			((Quaternion)(ref localRotation)).eulerAngles = eulerAngles;
			GameObject val3 = Object.Instantiate<GameObject>(follower, val2, localRotation, follower_root.transform);
			((Object)val3).name = ((Object)follower).name + " (" + i + ")";
			FollowerObjectList[i - 1] = val3;
		}
	}

	private void ClearFollowerPoints(bool all = false)
	{
		if ((Object)(object)follower_root != (Object)null)
		{
			int childCount = follower_root.transform.childCount;
			for (int num = childCount - 1; num >= 0; num--)
			{
				Object.DestroyImmediate((Object)(object)((Component)follower_root.transform.GetChild(num)).gameObject);
			}
			if (all)
			{
				Object.DestroyImmediate((Object)(object)follower_root);
			}
		}
	}

	private void RemoveFollowerPointVisuals()
	{
		if ((Object)(object)follower_root == (Object)null)
		{
			return;
		}
		GameObject[] followerObjectList = FollowerObjectList;
		foreach (GameObject val in followerObjectList)
		{
			if ((Object)(object)val != (Object)(object)follower)
			{
				MeshRenderer val2 = val.GetComponent<MeshRenderer>();
				if ((Object)(object)val2 == (Object)null)
				{
					val2 = val.GetComponentInChildren<MeshRenderer>();
				}
				Object.DestroyImmediate((Object)(object)val2);
				MeshFilter val3 = val.GetComponent<MeshFilter>();
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = val.GetComponentInChildren<MeshFilter>();
				}
				Object.DestroyImmediate((Object)(object)val3);
			}
		}
	}

	private void ShowGizmo(bool on)
	{
		switch (on)
		{
		case false:
			if ((Object)(object)gizmo != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)gizmo);
			}
			break;
		case true:
			if ((Object)(object)gizmo == (Object)null)
			{
				gizmo = ((Component)magazineRadiusCenter).gameObject.AddComponent<MagazineGizmos>();
			}
			break;
		}
	}

	private Vector3 CalculateNextCartridgePos(float deltaA)
	{
		//IL_000c: 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_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_0032: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		deltaA *= (float)Math.PI / 180f;
		Vector3 result = default(Vector3);
		Vector3 val = firstCartridge.transform.position - magazineRadiusCenter.position;
		float num = Mathf.Sqrt(Mathf.Pow(val.y, 2f) + Mathf.Pow(val.z, 2f));
		float num2 = Mathf.Atan2(val.y, val.z);
		float num3 = Mathf.Sin(num2 + deltaA) * num + ((Component)magazineRadiusCenter).transform.position.y;
		float num4 = Mathf.Cos(num2 + deltaA) * num + ((Component)magazineRadiusCenter).transform.position.z;
		((Vector3)(ref result))..ctor(firstCartridge.transform.position.x, num3, num4);
		return result;
	}

	private void ClearConsole()
	{
		Assembly assembly = Assembly.GetAssembly(typeof(ActiveEditorTracker));
		Type type = assembly.GetType("UnityEditorInternal.LogEntries");
		MethodInfo method = type.GetMethod("Clear");
		method.Invoke(new object(), null);
	}

	private void OnDestroy()
	{
		Object.DestroyImmediate((Object)(object)gizmo);
	}
}