Decompiled source of Zarkow Assault Pack v0.1.70

plugins\ZarkowAssaultPack.dll

Decompiled 9 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using SimpleJson;
using UnityEngine;
using ZarkowAssaultPack.Models;
using ZarkowAssaultPack.Services;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ZarkowAssaultPack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZarkowAssaultPack")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace ZarkowAssaultPack
{
	[BepInPlugin("com.digitalsoftware.zarkowassaultpack", "Zarkow's Assault Pack", "0.1.70")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	internal class ZAssaultPack : BaseUnityPlugin
	{
		public const string PluginGUID = "com.digitalsoftware.zarkowassaultpack";

		public const string PluginName = "Zarkow's Assault Pack";

		public const string PluginVersion = "0.1.70";

		public static ConfigEntry<int> AssaultPackVolume;

		private readonly Harmony _harmony = new Harmony("com.digitalsoftware.zarkowassaultpack");

		private readonly Dictionary<string, AssetBundle> _assetBundles = new Dictionary<string, AssetBundle>();

		public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			AssaultPackVolume = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Assault Pack Volume", 100, new ConfigDescription("Custom Volume", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			LoadAssetBundles();
			AddAssetPackItem();
			UnloadAssetBundles();
			_harmony.PatchAll();
			Logger.LogInfo((object)"### ALPHA 0.1.70 ### Zarkow's Assault Pack Loaded.");
		}

		private void LoadAssetBundles()
		{
			_assetBundles.Add("assaultpack", AssetUtils.LoadAssetBundleFromResources("assaultpack"));
		}

		private void UnloadAssetBundles()
		{
			foreach (KeyValuePair<string, AssetBundle> assetBundle in _assetBundles)
			{
				assetBundle.Value.Unload(false);
			}
		}

		private void AddAssetPackItem()
		{
			List<AssaultPackItemConfig> list = new List<AssaultPackItemConfig>();
			list.AddRange(AssaultPackConfigManager.LoadAssetPackItemConfigJsonFromResource("ZarkowAssaultPack.Assets.Configs.assaultpackconfigs.json"));
			list.ForEach(delegate(AssaultPackItemConfig assaultPackItemConfig)
			{
				if (assaultPackItemConfig.enabled)
				{
					Logger.LogDebug((object)("### Get AssetBundle for '" + assaultPackItemConfig.bundleName + "'"));
					AssetBundle val = _assetBundles[assaultPackItemConfig.bundleName];
					if ((Object)(object)val == (Object)null)
					{
						Logger.LogWarning((object)"### AssetBundle is null");
					}
					else
					{
						Logger.LogDebug((object)("### Read asset from " + assaultPackItemConfig.prefabPath));
						GameObject val2 = val.LoadAsset<GameObject>(assaultPackItemConfig.prefabPath);
						Logger.LogDebug((object)("### Convert " + ((Object)val2).name + " To Item"));
						CustomItem val3 = AssaultPackItemConfig.ConvertToItem(val2, assaultPackItemConfig, val);
						Logger.LogDebug((object)("### Add item " + assaultPackItemConfig.name + " to ItemManager"));
						ItemManager.Instance.AddItem(val3);
						Logger.LogDebug((object)"### --- AssaultPackItem Added ---");
					}
				}
			});
		}
	}
}
namespace ZarkowAssaultPack.Services
{
	internal class AssaultPackConfigManager
	{
		public static List<AssaultPackItemConfig> LoadAssetPackItemConfigJsonFromResource(string resourceName)
		{
			string text;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
			{
				using StreamReader streamReader = new StreamReader(stream);
				text = streamReader.ReadToEnd();
			}
			return SimpleJson.DeserializeObject<List<AssaultPackItemConfig>>(text);
		}
	}
}
namespace ZarkowAssaultPack.Scripts
{
	public class Barrel
	{
		public GameObject ThisBarrelGameObject;

		public GameObject LaunchEffectGameObject;

		public GameObject LaunchAudioGameObject;

		public Barrel(GameObject thisGameObject, GameObject launchEffectGameObject, GameObject launchAudioGameObject)
		{
			ThisBarrelGameObject = thisGameObject;
			LaunchEffectGameObject = launchEffectGameObject;
			LaunchAudioGameObject = launchAudioGameObject;
		}
	}
	public class DegreesSpecifier
	{
		public float DegreesY { get; set; }

		public float DegreesX { get; set; }

		public float Distance { get; set; }
	}
	public static class HelperLib
	{
		public static GameObject GetChildGameObject(GameObject fromGameObject, string withName)
		{
			Transform[] componentsInChildren = ((Component)fromGameObject.transform).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)((Component)val).gameObject).name == withName)
				{
					return ((Component)val).gameObject;
				}
			}
			return null;
		}

		public static void PrintOutObjectHierarchy(GameObject fromGameObject)
		{
			Logger.LogDebug((object)"### Assault Pack Item: --------------------------------------------------------------------------");
			Logger.LogDebug((object)$"### Assault Pack Item: >> Print hierarchy info for: {((Object)fromGameObject).name}, {((Object)fromGameObject).GetInstanceID()}");
			Transform[] componentsInChildren = ((Component)fromGameObject.transform).GetComponentsInChildren<Transform>(true);
			Transform[] array = componentsInChildren;
			foreach (Transform val in array)
			{
				Logger.LogDebug((object)$"### Assault Pack Item: >> {((Object)val).name} - Active: {((Component)val).gameObject.activeInHierarchy}");
			}
			Logger.LogDebug((object)$"### Assault Pack Item: >> Sum parts: {componentsInChildren.Length} --------------------------------------------------");
		}

		public static void PrintOutGameObjectInfo(GameObject fromGameObject)
		{
			//IL_002b: 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_0069: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogDebug((object)$"### Assault Pack Item: >> Print info for: {((Object)fromGameObject).name}, {((Object)fromGameObject).GetInstanceID()}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> position: {fromGameObject.transform.position}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> localPosition: {fromGameObject.transform.localPosition}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> rotation: {fromGameObject.transform.eulerAngles}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> localRotation: {fromGameObject.transform.localEulerAngles}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> lossyScale: {fromGameObject.transform.lossyScale}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> localScale: {fromGameObject.transform.localScale}");
			Logger.LogDebug((object)"### Assault Pack Item: >> ------------------------------------------------------------------------");
		}

		public static void PrintOutAimResult(DegreesSpecifier aimResult)
		{
			Logger.LogDebug((object)$"### Assault Pack Item: >> Print info for aimResult: {aimResult.GetHashCode()}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> DegreesX: {aimResult.DegreesX}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> DegreesY: {aimResult.DegreesY}");
			Logger.LogDebug((object)$"### Assault Pack Item: >> Distance: {aimResult.Distance}");
		}

		public static void PrintAllReflectionOfCharacter(Character character)
		{
			Logger.LogDebug((object)$"### Assault Pack Item: >> Print info for Character: {character.m_name}, {((Object)character).GetInstanceID()}");
			PropertyInfo[] properties = ((object)character).GetType().GetProperties();
			Logger.LogDebug((object)$"### Assault Pack Item: >> Properties: {properties.Length}");
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				object value = propertyInfo.GetValue(character, null);
				Logger.LogDebug((object)("### Assault Pack Item:  --- >> : " + propertyInfo.Name + ", value: " + value));
			}
			FieldInfo[] fields = ((object)character).GetType().GetFields();
			Logger.LogDebug((object)$"### Assault Pack Item: >> Fields: {fields.Length}");
			FieldInfo[] array2 = fields;
			foreach (FieldInfo fieldInfo in array2)
			{
				object value2 = fieldInfo.GetValue(character);
				Logger.LogDebug((object)("### Assault Pack Item:  --- >> : " + fieldInfo.Name + ", value: " + value2));
			}
			MemberInfo[] members = ((object)character).GetType().GetMembers();
			Logger.LogDebug((object)$"### Assault Pack Item: >> Members: {members.Length}");
			MemberInfo[] array3 = members;
			foreach (MemberInfo memberInfo in array3)
			{
				Logger.LogDebug((object)$"### Assault Pack Item:  --- >> : {memberInfo.Name}, value: {memberInfo}");
			}
			Logger.LogDebug((object)"### Assault Pack Item: >> ------------------------------------------------------------------------");
		}

		public static void PrintAllReflectionOfObject(object yourObject)
		{
			Logger.LogDebug((object)$"### Assault Pack Item: >> Print info for Object: {yourObject}, {yourObject.GetHashCode()}");
			PropertyInfo[] properties = yourObject.GetType().GetProperties();
			Logger.LogDebug((object)$"### Assault Pack Item: >> Properties: {properties.Length}");
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				object value = propertyInfo.GetValue(yourObject, null);
				Logger.LogDebug((object)("### Assault Pack Item:  --- >> : " + propertyInfo.Name + ", value: " + value));
			}
			FieldInfo[] fields = yourObject.GetType().GetFields();
			Logger.LogDebug((object)$"### Assault Pack Item: >> Fields: {fields.Length}");
			FieldInfo[] array2 = fields;
			foreach (FieldInfo fieldInfo in array2)
			{
				object value2 = fieldInfo.GetValue(yourObject);
				Logger.LogDebug((object)("### Assault Pack Item:  --- >> : " + fieldInfo.Name + ", value: " + value2));
			}
			MemberInfo[] members = yourObject.GetType().GetMembers();
			Logger.LogDebug((object)$"### Assault Pack Item: >> Members: {members.Length}");
			MemberInfo[] array3 = members;
			foreach (MemberInfo memberInfo in array3)
			{
				Logger.LogDebug((object)$"### Assault Pack Item:  --- >> : {memberInfo.Name}, value: {memberInfo}");
			}
			Logger.LogDebug((object)"### Assault Pack Item: >> ------------------------------------------------------------------------");
		}
	}
	public static class MathHelper
	{
		public static double NthRoot(double A, int N)
		{
			return Math.Pow(A, 1.0 / (double)N);
		}

		public static void GetDegreesBetweenAimAndTarget(DegreesSpecifier aimResult, Transform aimTransform, Vector3 targetLocation, Transform debug)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_009f: 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)
			Quaternion rotation = aimTransform.rotation;
			aimTransform.LookAt(targetLocation, Vector3.up);
			Quaternion localRotation = aimTransform.localRotation;
			float num = ((Quaternion)(ref localRotation)).eulerAngles.y;
			if (num > 180f)
			{
				num -= 360f;
			}
			if (num < -180f)
			{
				num += 360f;
			}
			aimResult.DegreesY = num;
			localRotation = aimTransform.localRotation;
			float num2 = ((Quaternion)(ref localRotation)).eulerAngles.x;
			if (num2 > 180f)
			{
				num2 -= 360f;
			}
			if (num2 < -180f)
			{
				num2 += 360f;
			}
			aimResult.DegreesX = num2;
			if ((Object)(object)debug != (Object)null)
			{
				debug.rotation = aimTransform.rotation;
			}
			aimTransform.rotation = rotation;
		}

		public static Vector3 FirstOrderIntercept(Vector3 shooterPosition, Vector3 shooterVelocity, float shotSpeed, Vector3 targetPosition, Vector3 targetVelocity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0013: 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_001d: 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)
			Vector3 targetRelativePosition = targetPosition - shooterPosition;
			Vector3 val = targetVelocity - shooterVelocity;
			float num = FirstOrderInterceptTime(shotSpeed, targetRelativePosition, val);
			return targetPosition + num * val;
		}

		public static float FirstOrderInterceptTime(float shotSpeed, Vector3 targetRelativePosition, Vector3 targetRelativeVelocity)
		{
			//IL_004f: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			float sqrMagnitude = ((Vector3)(ref targetRelativeVelocity)).sqrMagnitude;
			if (sqrMagnitude < 0.001f)
			{
				return 0f;
			}
			float num = sqrMagnitude - shotSpeed * shotSpeed;
			if (Mathf.Abs(num) < 0.001f)
			{
				return Mathf.Max((0f - ((Vector3)(ref targetRelativePosition)).sqrMagnitude) / (2f * Vector3.Dot(targetRelativeVelocity, targetRelativePosition)), 0f);
			}
			float num2 = 2f * Vector3.Dot(targetRelativeVelocity, targetRelativePosition);
			float sqrMagnitude2 = ((Vector3)(ref targetRelativePosition)).sqrMagnitude;
			float num3 = num2 * num2 - 4f * num * sqrMagnitude2;
			if (num3 > 0f)
			{
				float num4 = (0f - num2 + Mathf.Sqrt(num3)) / (2f * num);
				float num5 = (0f - num2 - Mathf.Sqrt(num3)) / (2f * num);
				if (num4 > 0f)
				{
					if (num5 > 0f)
					{
						return Mathf.Min(num4, num5);
					}
					return num4;
				}
				return Mathf.Max(num5, 0f);
			}
			if (num3 < 0f)
			{
				return 0f;
			}
			return Mathf.Max((0f - num2) / (2f * num), 0f);
		}

		public static Rect GetBoundingBoxOnScreen(Bounds bounds, Camera camera)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_003d: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00b2: 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_00c1: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_0107: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: 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_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: 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_0291: 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_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: 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_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: 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)
			//IL_02e1: 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_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: 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_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: 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)
			Vector3 center = ((Bounds)(ref bounds)).center;
			Vector3 size = ((Bounds)(ref bounds)).size;
			Vector3[] array = (Vector3[])(object)new Vector3[8]
			{
				center + Vector3.right * size.x / 2f + Vector3.up * size.y / 2f + Vector3.forward * size.z / 2f,
				center + Vector3.right * size.x / 2f + Vector3.up * size.y / 2f - Vector3.forward * size.z / 2f,
				center + Vector3.right * size.x / 2f - Vector3.up * size.y / 2f + Vector3.forward * size.z / 2f,
				center + Vector3.right * size.x / 2f - Vector3.up * size.y / 2f - Vector3.forward * size.z / 2f,
				center - Vector3.right * size.x / 2f + Vector3.up * size.y / 2f + Vector3.forward * size.z / 2f,
				center - Vector3.right * size.x / 2f + Vector3.up * size.y / 2f - Vector3.forward * size.z / 2f,
				center - Vector3.right * size.x / 2f - Vector3.up * size.y / 2f + Vector3.forward * size.z / 2f,
				center - Vector3.right * size.x / 2f - Vector3.up * size.y / 2f - Vector3.forward * size.z / 2f
			};
			Rect result = Rect.MinMaxRect(float.MaxValue, float.MaxValue, float.MinValue, float.MinValue);
			for (int i = 0; i < array.Length; i++)
			{
				Vector3 val = camera.WorldToScreenPoint(array[i]);
				if (val.x < ((Rect)(ref result)).xMin)
				{
					((Rect)(ref result)).xMin = val.x;
				}
				if (val.y < ((Rect)(ref result)).yMin)
				{
					((Rect)(ref result)).yMin = val.y;
				}
				if (val.x > ((Rect)(ref result)).xMax)
				{
					((Rect)(ref result)).xMax = val.x;
				}
				if (val.y > ((Rect)(ref result)).yMax)
				{
					((Rect)(ref result)).yMax = val.y;
				}
			}
			return result;
		}
	}
}
namespace ZarkowAssaultPack.Models
{
	[Serializable]
	public class AssaultPackItemConfigRequirement
	{
		public string item;

		public int amount;

		public int amountPerLevel;

		public static RequirementConfig Convert(AssaultPackItemConfigRequirement assaultPackItemConfigRequirement)
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			return new RequirementConfig
			{
				Amount = assaultPackItemConfigRequirement.amount,
				Item = assaultPackItemConfigRequirement.item,
				AmountPerLevel = assaultPackItemConfigRequirement.amountPerLevel,
				Recover = false
			};
		}
	}
	[Serializable]
	public class AssaultPackItemConfigIcon
	{
		public string iconPath;

		public static string Convert(AssaultPackItemConfigIcon assaultPackItemConfigIcon)
		{
			return assaultPackItemConfigIcon.iconPath;
		}
	}
	[Serializable]
	public class AssaultPackItemConfig
	{
		public string name;

		public string bundleName;

		public string prefabPath;

		public string description;

		public string craftingStation;

		public int minStationLevel = 1;

		public bool enabled;

		public string type;

		public List<AssaultPackItemConfigRequirement> resources;

		public List<AssaultPackItemConfigIcon> icons;

		public static CustomItem ConvertToItem(GameObject prefab, AssaultPackItemConfig assaultPackItemConfig, AssetBundle assetBundle)
		{
			//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_0024: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			ItemConfig val = new ItemConfig
			{
				Amount = 1,
				MinStationLevel = ((assaultPackItemConfig.minStationLevel <= 1) ? 1 : assaultPackItemConfig.minStationLevel),
				Name = assaultPackItemConfig.name,
				Description = assaultPackItemConfig.description,
				Enabled = assaultPackItemConfig.enabled,
				CraftingStation = assaultPackItemConfig.craftingStation,
				Requirements = assaultPackItemConfig.resources.Select(AssaultPackItemConfigRequirement.Convert).ToArray()
			};
			Sprite[] array = TurnIconPathsToIcons(assaultPackItemConfig.icons?.Select(AssaultPackItemConfigIcon.Convert).ToArray(), assetBundle);
			if (array.Length != 0)
			{
				val.Icons = array;
			}
			return new CustomItem(prefab, false, val);
		}

		public static Sprite[] TurnIconPathsToIcons(string[] iconPaths, AssetBundle assetBundle)
		{
			Logger.LogDebug((object)$"### TurnIconPathsToIcons(), {iconPaths}, {assetBundle}");
			List<Sprite> list = new List<Sprite>();
			if (iconPaths == null)
			{
				Logger.LogDebug((object)"### TurnIconPathsToIcons(), no icons defined, skip all");
				return list.ToArray();
			}
			foreach (string text in iconPaths)
			{
				if (string.IsNullOrWhiteSpace(text))
				{
					Logger.LogDebug((object)"### TurnIconPathsToIcons(), icons resolve to null or blank, skip");
					continue;
				}
				Logger.LogDebug((object)("### TurnIconPathsToIcons(), icon: " + text));
				Sprite val = assetBundle.LoadAsset<Sprite>(text);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogDebug((object)"### TurnIconPathsToIcons(), icons resolve from asset bundle to null, skip");
				}
				else
				{
					list.Add(val);
				}
			}
			return list.ToArray();
		}
	}
}