Decompiled source of CollectiveRewiring v1.1.2

CollectiveRewiring.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CollectiveRewiring.Utils;
using CollectiveRewiring.Utils.Assets;
using CollectiveRewiring.Utils.Components;
using EntityStates;
using EntityStates.Drone;
using EntityStates.Drone.Command;
using EntityStates.DroneTech.Weapon;
using HG;
using HG.Reflection;
using IL.EntityStates.Drone;
using IL.EntityStates.Drone.Command;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On;
using On.EntityStates.Drone;
using On.EntityStates.Drone.Command;
using On.EntityStates.DroneTech.Weapon;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.Orbs;
using On.RoR2.Skills;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using Rebindables;
using Rewired;
using RoR2;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.EntitlementManagement;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.SolusWingGrid;
using RoR2.UI;
using RoR2BepInExPack.Utilities;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.Audio;
using UnityEngine.Networking;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CollectiveRewiring")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+200b3bd4357b095b71dd3bf0c17b327be3985e48")]
[assembly: AssemblyProduct("CollectiveRewiring")]
[assembly: AssemblyTitle("CollectiveRewiring")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CollectiveRewiring
{
	[BepInPlugin("pseudopulse.CollectiveRewiring", "CollectiveRewiring", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class CollectiveRewiring : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_LoadAllTokensFromFolder <>9__7_0;

			internal void <Awake>b__7_0(orig_LoadAllTokensFromFolder orig, string self, List<KeyValuePair<string, string>> output)
			{
				orig.Invoke(self, output);
				for (int i = 0; i < output.Count; i++)
				{
					KeyValuePair<string, string> keyValuePair = output[i];
					if (LanguageLoadMap.ContainsKey(keyValuePair.Key))
					{
						output[i] = new KeyValuePair<string, string>(keyValuePair.Key, LanguageLoadMap[keyValuePair.Key](keyValuePair.Value));
					}
				}
			}
		}

		public const string PluginGUID = "pseudopulse.CollectiveRewiring";

		public const string PluginAuthor = "pseudopulse";

		public const string PluginName = "CollectiveRewiring";

		public const string PluginVersion = "1.1.0";

		public static CollectiveRewiring instance;

		public static ManualLogSource ModLogger;

		internal static Dictionary<string, Func<string, string>> LanguageLoadMap = new Dictionary<string, Func<string, string>>();

		public void Awake()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			ModLogger = ((BaseUnityPlugin)this).Logger;
			instance = this;
			ConfigManager.HandleConfigAttributes(typeof(CollectiveRewiring).Assembly, ((BaseUnityPlugin)this).Config);
			Operator.Initialize();
			SolusHeart.Initialize();
			WanderingChef.Initialize();
			NeutroniumWeight.Initialize();
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				hook_LoadAllTokensFromFolder val = delegate(orig_LoadAllTokensFromFolder orig, string self, List<KeyValuePair<string, string>> output)
				{
					orig.Invoke(self, output);
					for (int i = 0; i < output.Count; i++)
					{
						KeyValuePair<string, string> keyValuePair = output[i];
						if (LanguageLoadMap.ContainsKey(keyValuePair.Key))
						{
							output[i] = new KeyValuePair<string, string>(keyValuePair.Key, LanguageLoadMap[keyValuePair.Key](keyValuePair.Value));
						}
					}
				};
				<>c.<>9__7_0 = val;
				obj = (object)val;
			}
			Language.LoadAllTokensFromFolder += (hook_LoadAllTokensFromFolder)obj;
		}

		public static void RunCoro(IEnumerator coro)
		{
			((MonoBehaviour)instance).StartCoroutine(coro);
		}

		public static void Replace(string token, string match, string replace)
		{
			LanguageLoadMap.Add(token, (string x) => x.Replace(match, replace));
		}

		private void GenerateMap()
		{
			//IL_0056: 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)
			string[] array = File.ReadAllLines(Assembly.GetExecutingAssembly().Location.Replace("CollectiveRewiring.dll", "addressables.txt"));
			string path = Assembly.GetExecutingAssembly().Location.Replace("CollectiveRewiring.dll", "Assets.cs");
			Dictionary<Type, List<Dictionary<string, string>>> dictionary = new Dictionary<Type, List<Dictionary<string, string>>>();
			string[] array2 = array;
			foreach (string text in array2)
			{
				Object val = Addressables.LoadAssetAsync<Object>((object)text).WaitForCompletion();
				if (Object.op_Implicit(val))
				{
					Type type = ((object)val).GetType();
					if (!type.IsAbstract)
					{
						if (!dictionary.ContainsKey(type))
						{
							ModLogger.LogError((object)type.ToString());
							dictionary.Add(type, new List<Dictionary<string, string>>());
						}
						string name = val.name;
						dictionary[type].Add(new Dictionary<string, string> { { text, name } });
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("no obj for key: " + text.ToString()));
				}
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("using UnityEngine;");
			stringBuilder.AppendLine("using RoR2;");
			stringBuilder.AppendLine("using RoR2.Skills;");
			stringBuilder.AppendLine("using UnityEngine.AddressableAssets;");
			stringBuilder.AppendLine("using UnityEngine.Rendering.PostProcessing;");
			stringBuilder.AppendLine("");
			stringBuilder.AppendLine("namespace SecondStrike.Utils {");
			Regex regex = new Regex("[^a-zA-Z0-9]");
			Dictionary<Type, List<string>> dictionary2 = new Dictionary<Type, List<string>>();
			foreach (KeyValuePair<Type, List<Dictionary<string, string>>> item in dictionary)
			{
				stringBuilder.AppendLine("    public static class " + item.Key.Name + " {");
				if (!dictionary2.ContainsKey(item.Key))
				{
					dictionary2.Add(item.Key, new List<string>());
				}
				foreach (Dictionary<string, string> item2 in item.Value)
				{
					foreach (KeyValuePair<string, string> item3 in item2)
					{
						string value = item3.Value;
						value = regex.Replace(value, "");
						if (char.IsDigit(value[0]))
						{
							value = "_" + value;
						}
						if (!dictionary2[item.Key].Contains(value))
						{
							dictionary2[item.Key].Add(value);
							stringBuilder.AppendLine("       public static " + item.Key.ToString() + " " + value + " => Addressables.LoadAssetAsync<" + item.Key.ToString() + ">(\"" + item3.Key + "\").WaitForCompletion();");
						}
					}
				}
				stringBuilder.AppendLine("    }");
			}
			stringBuilder.AppendLine("}");
			File.WriteAllText(path, stringBuilder.ToString());
		}
	}
	[ConfigSection("Tweaks :: Neutronium Weight")]
	public static class NeutroniumWeight
	{
		private class WeightInfo
		{
			public CharacterBody owner;

			public int stack;
		}

		public class NeutroniumWeightHolder : MonoBehaviour
		{
			public CharacterBody owner;

			public int stacks;

			public CharacterMaster master;

			public void Start()
			{
				master = ((Component)this).GetComponent<CharacterMaster>();
				HeldWeights.Add(this);
			}

			public void OnDestroy()
			{
				HeldWeights.Remove(this);
			}
		}

		public class ItemTransferOrbDamaging : ItemTransferOrbDroppable, IOrbFixedUpdateBehavior
		{
			public DamageInfo damage;

			public Inventory source;

			public CharacterBody srcBody;

			private WeightInfo info;

			private float speed = 60f;

			private Vector3 targetPos;

			public ItemTransferOrbDamaging(Vector3 targetStartingCorePosition)
				: base(targetStartingCorePosition)
			{
			}//IL_000c: Unknown result type (might be due to invalid IL or missing references)


			public override void Begin()
			{
				//IL_0003: 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_003c: 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)
				((Orb)this).arrivalTime = Vector3.Distance(((Orb)this).origin, ((Component)((Orb)this).target).transform.position) / speed;
				((ItemTransferOrbDroppable)this).Begin();
				targetPos = ((Component)((Orb)this).target).transform.position;
				if (Object.op_Implicit((Object)(object)srcBody))
				{
					info = new WeightInfo
					{
						owner = srcBody,
						stack = ((ItemTransferOrb)this).stack
					};
					InFlightWeights.Add(info);
				}
			}

			public void FixedUpdate()
			{
				//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)
				if (Object.op_Implicit((Object)(object)((Orb)this).target))
				{
					targetPos = ((Component)((Orb)this).target).transform.position;
				}
			}

			public override void OnArrival()
			{
				//IL_007d: 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_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_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0189: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: Unknown result type (might be due to invalid IL or missing references)
				((ItemTransferOrbDroppable)this).OnArrival();
				if (info != null)
				{
					InFlightWeights.Remove(info);
				}
				if (Object.op_Implicit((Object)(object)((Orb)this).target) && Object.op_Implicit((Object)(object)((Orb)this).target.healthComponent) && ((Orb)this).target.healthComponent.alive)
				{
					if (damage != null)
					{
						DamageInfo val = damage;
						val.damageColorIndex = (DamageColorIndex)16;
						val.damageType |= DamageTypeCombo.op_Implicit((DamageType)4194304);
						((Orb)this).target.healthComponent.TakeDamage(damage);
						GlobalEventManager.instance.OnHitAll(damage, ((Component)((Orb)this).target.healthComponent).gameObject);
						GlobalEventManager.instance.OnHitEnemy(damage, ((Component)((Orb)this).target.healthComponent).gameObject);
					}
					if (Object.op_Implicit((Object)(object)((Orb)this).target.healthComponent.body.master))
					{
						NeutroniumWeightHolder orAddComponent = NeutroniumWeight.GetOrAddComponent<NeutroniumWeightHolder>((Component)(object)((Orb)this).target.healthComponent.body.master);
						orAddComponent.owner = srcBody;
						orAddComponent.stacks = ((ItemTransferOrb)this).stack;
					}
				}
				else if (Object.op_Implicit((Object)(object)source) && Object.op_Implicit((Object)(object)srcBody))
				{
					ItemTransferOrbDamaging itemTransferOrbDamaging = new ItemTransferOrbDamaging(srcBody.corePosition)
					{
						origin = targetPos,
						target = srcBody.mainHurtBox,
						itemIndex = Items.TransferDebuffOnHit.itemIndex,
						stack = ((ItemTransferOrb)this).stack,
						inventoryToGrantTo = source,
						damage = null
					};
					OrbManager.instance.AddOrb((Orb)(object)itemTransferOrbDamaging);
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnArrival <0>__DontDrop;

			public static hook_FireProjectile <1>__RedirectToOrb;

			public static hook_Begin <2>__ReplaceOrbEffect;

			public static Manipulator <3>__OhMyGodGearbox;

			public static hook_AdvanceStage <4>__OnStageExit;

			public static Manipulator <5>__OverrideHitLogic;
		}

		[ConfigField("Always Returns", "Makes Neutronium Weight always return to you without fail instead of dropping on the ground occassionally.", true)]
		private static bool AlwaysReturns;

		[ConfigField("Holder Damage Boost", "Hits that transfer the Neutronium Weight deal a percentage of bonus damage when the weight lands. Vanilla is 0. Requires Always Returns to be enabled.", 100f)]
		private static float HolderDamageBoost;

		[ConfigField("Holder Damage Stack", "Hits that transfer the Neutronium Weight deal a percentage of bonus damage when the weight lands, stacking value. Vanilla is 0. Requires Always Returns to be enabled.", 50f)]
		private static float HolderDamageBoostStack;

		private static GameObject TransferDebuffOrbEffect;

		private static List<WeightInfo> InFlightWeights = new List<WeightInfo>();

		private static List<NeutroniumWeightHolder> HeldWeights = new List<NeutroniumWeightHolder>();

		public static void Initialize()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//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_004a: Expected O, but got Unknown
			//IL_0060: 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_006b: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00a2: 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_00ad: Expected O, but got Unknown
			//IL_01aa: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			if (!AlwaysReturns)
			{
				return;
			}
			object obj = <>O.<0>__DontDrop;
			if (obj == null)
			{
				hook_OnArrival val = DontDrop;
				<>O.<0>__DontDrop = val;
				obj = (object)val;
			}
			ItemTransferOrbDroppable.OnArrival += (hook_OnArrival)obj;
			object obj2 = <>O.<1>__RedirectToOrb;
			if (obj2 == null)
			{
				hook_FireProjectile val2 = RedirectToOrb;
				<>O.<1>__RedirectToOrb = val2;
				obj2 = (object)val2;
			}
			TransferDebuffOnHitUtils.FireProjectile += (hook_FireProjectile)obj2;
			object obj3 = <>O.<2>__ReplaceOrbEffect;
			if (obj3 == null)
			{
				hook_Begin val3 = ReplaceOrbEffect;
				<>O.<2>__ReplaceOrbEffect = val3;
				obj3 = (object)val3;
			}
			ItemTransferOrbDroppable.Begin += (hook_Begin)obj3;
			object obj4 = <>O.<3>__OhMyGodGearbox;
			if (obj4 == null)
			{
				Manipulator val4 = OhMyGodGearbox;
				<>O.<3>__OhMyGodGearbox = val4;
				obj4 = (object)val4;
			}
			GlobalEventManager.OnCharacterDeath += (Manipulator)obj4;
			object obj5 = <>O.<4>__OnStageExit;
			if (obj5 == null)
			{
				hook_AdvanceStage val5 = OnStageExit;
				<>O.<4>__OnStageExit = val5;
				obj5 = (object)val5;
			}
			Run.AdvanceStage += (hook_AdvanceStage)obj5;
			List<ItemTag> list = ItemDef.TransferDebuffOnHit.tags.ToList();
			list.Add((ItemTag)4);
			ItemDef.TransferDebuffOnHit.tags = list.ToArray();
			if (HolderDamageBoost > 0f)
			{
				object obj6 = <>O.<5>__OverrideHitLogic;
				if (obj6 == null)
				{
					Manipulator val6 = OverrideHitLogic;
					<>O.<5>__OverrideHitLogic = val6;
					obj6 = (object)val6;
				}
				GlobalEventManager.ProcessHitEnemy += (Manipulator)obj6;
				CollectiveRewiring.Replace(ItemDef.TransferDebuffOnHit.descriptionToken, "on hit.", $"on hit, dealing <style=cIsDamage>{HolderDamageBoost}%</style> <style=cStack>(+{HolderDamageBoostStack}% per stack)</style> <style=cIsDamage>TOTAL damage</style> when it lands.");
			}
			TransferDebuffOrbEffect = PrefabAPI.InstantiateClone(GameObject.ItemTransferOrbEffect, "TransferDebuffOrbEffect");
			Transform val7 = TransferDebuffOrbEffect.transform.Find("BillboardBase");
			((Component)val7).gameObject.SetActive(false);
			GameObject val8 = Object.Instantiate<GameObject>(GameObject.TransferDebuffOnHitProjectileGhost, TransferDebuffOrbEffect.transform);
			val8.RemoveComponent<ProjectileGhostController>();
			val8.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
			((Component)TransferDebuffOrbEffect.transform.Find("Trail Parent")).gameObject.SetActive(false);
			ContentAddition.AddEffect(TransferDebuffOrbEffect);
		}

		private static void OnStageExit(orig_AdvanceStage orig, Run self, SceneDef destinationStage)
		{
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				CharacterMaster master = instance.master;
				CharacterBody body = master.GetBody();
				foreach (WeightInfo inFlightWeight in InFlightWeights)
				{
					if ((Object)(object)inFlightWeight.owner == (Object)(object)body)
					{
						master.inventory.GiveItemPermanent(Items.TransferDebuffOnHit, inFlightWeight.stack);
					}
				}
				foreach (NeutroniumWeightHolder heldWeight in HeldWeights)
				{
					if ((Object)(object)heldWeight.owner == (Object)(object)body)
					{
						master.inventory.GiveItemPermanent(Items.TransferDebuffOnHit, heldWeight.stacks);
					}
				}
			}
			orig.Invoke(self, destinationStage);
		}

		private static void OhMyGodGearbox(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3),
				(Instruction x) => ILPatternMatchingExt.MatchLdnull(x),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(TransferDebuffOnHitUtils), "FireProjectile")
			});
			int index = val.Index;
			val.Index = index - 1;
			val.Remove();
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Action<CharacterBody, GameObject, DamageReport>>((Action<CharacterBody, GameObject, DamageReport>)delegate(CharacterBody cb, GameObject junk, DamageReport report)
			{
				if (Object.op_Implicit((Object)(object)report.attacker) && Object.op_Implicit((Object)(object)cb))
				{
					TransferItemDamaging(((Component)cb).gameObject, report.attacker);
				}
			});
		}

		private static void ReplaceOrbEffect(orig_Begin orig, ItemTransferOrbDroppable self)
		{
			//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_0035: 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_004c: 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_0058: Expected I4, but got Unknown
			//IL_005e: Expected O, but got Unknown
			((Orb)self).duration = ((ItemTransferOrb)self).travelDuration;
			if (Object.op_Implicit((Object)(object)((Orb)self).target) || Object.op_Implicit((Object)(object)((ItemTransferOrb)self).orbEffectTargetObjectOverride))
			{
				EffectData val = new EffectData
				{
					origin = ((Orb)self).origin,
					genericFloat = ((Orb)self).duration,
					genericUInt = Util.IntToUintPlusOne((int)((ItemTransferOrb)self).itemIndex)
				};
				if (Object.op_Implicit((Object)(object)((ItemTransferOrb)self).orbEffectTargetObjectOverride))
				{
					val.SetNetworkedObjectReference(((Component)((ItemTransferOrb)self).orbEffectTargetObjectOverride).gameObject);
				}
				else
				{
					val.SetHurtBoxReference(((Orb)self).target);
				}
				EffectManager.SpawnEffect(TransferDebuffOrbEffect, val, true);
			}
		}

		private static void OverrideHitLogic(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(TransferDebuffOnHitUtils), "FireProjectile")
			});
			val.Remove();
			val.Emit(OpCodes.Ldarg, 1);
			val.EmitDelegate<Action<CharacterBody, GameObject, DamageInfo>>((Action<CharacterBody, GameObject, DamageInfo>)delegate(CharacterBody cb, GameObject target, DamageInfo info)
			{
				CharacterBody val2 = default(CharacterBody);
				if (target.TryGetComponent<CharacterBody>(ref val2) && (cb.isPlayerControlled || val2.isPlayerControlled))
				{
					TransferItemDamaging(Object.op_Implicit((Object)(object)cb) ? ((Component)cb).gameObject : null, target, info);
				}
			});
		}

		private static void DontDrop(orig_OnArrival orig, ItemTransferOrbDroppable self)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Orb)self).target) && Object.op_Implicit((Object)(object)((Orb)self).target.healthComponent) && Object.op_Implicit((Object)(object)((Orb)self).target.healthComponent.body.inventory))
			{
				((Orb)self).target.healthComponent.body.inventory.GiveItemPermanent(((ItemTransferOrb)self).itemIndex, ((ItemTransferOrb)self).stack);
			}
		}

		private static void RedirectToOrb(orig_FireProjectile orig, CharacterBody sourceBody, GameObject target)
		{
			if (Object.op_Implicit((Object)(object)target))
			{
				TransferItemDamaging(((Component)sourceBody).gameObject, target);
			}
			else
			{
				orig.Invoke(sourceBody, target);
			}
		}

		private static void TransferItemDamaging(GameObject source, GameObject destination, DamageInfo info = null)
		{
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)source) || !Object.op_Implicit((Object)(object)destination))
			{
				return;
			}
			CharacterBody component = source.GetComponent<CharacterBody>();
			CharacterBody val = destination.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			CharacterMaster master = component.master;
			CharacterMaster master2 = val.master;
			if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master2))
			{
				return;
			}
			Inventory inventory = master.inventory;
			Inventory inventory2 = master2.inventory;
			int itemCountEffective = inventory.GetItemCountEffective(Items.TransferDebuffOnHit);
			int stack = itemCountEffective;
			NeutroniumWeightHolder component2 = ((Component)master).GetComponent<NeutroniumWeightHolder>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				if ((Object)(object)component2.owner == (Object)(object)val)
				{
					stack = component2.stacks;
				}
				else if (Object.op_Implicit((Object)(object)component2.owner))
				{
					val = component2.owner;
					master2 = component2.owner.master;
					inventory2 = component2.owner.inventory;
					stack = component2.stacks;
				}
			}
			if (itemCountEffective > 0)
			{
				HealthComponent healthComponent = val.healthComponent;
				if ((Object)(object)healthComponent != (Object)null && healthComponent.alive)
				{
					ItemTransferOrbDamaging itemTransferOrbDamaging = new ItemTransferOrbDamaging(val.corePosition)
					{
						origin = component.corePosition,
						target = val.mainHurtBox,
						itemIndex = Items.TransferDebuffOnHit.itemIndex,
						stack = stack,
						inventoryToGrantTo = inventory2,
						damage = info,
						source = inventory,
						srcBody = component
					};
					OrbManager.instance.AddOrb((Orb)(object)itemTransferOrbDamaging);
					inventory.RemoveItemPermanent(Items.TransferDebuffOnHit, itemCountEffective);
				}
			}
		}

		private static T GetOrAddComponent<T>(Component comp) where T : Component
		{
			T component = comp.GetComponent<T>();
			return Object.op_Implicit((Object)(object)component) ? component : comp.AddComponent<T>();
		}
	}
	[ConfigSection("Tweaks :: Operator")]
	public static class Operator
	{
		private class CopyOwnerInventory : MonoBehaviour
		{
			public Inventory ownerInventory;

			public CharacterMaster self;

			private ItemTag[] blacklistedTags;

			public void Start()
			{
				self = ((Component)this).GetComponent<CharacterMaster>();
			}

			public void FixedUpdate()
			{
				if (!Object.op_Implicit((Object)(object)ownerInventory) && Object.op_Implicit((Object)(object)self.minionOwnership) && Object.op_Implicit((Object)(object)self.minionOwnership.ownerMaster))
				{
					ownerInventory = self.minionOwnership.ownerMaster.inventory;
					ownerInventory.onInventoryChanged += MirrorInventory;
					MirrorInventory();
				}
			}

			private void MirrorInventory()
			{
				self.inventory.CopyItemsFrom(ownerInventory, (Func<ItemIndex, bool>)ItemFilter);
			}

			private bool ItemFilter(ItemIndex index)
			{
				//IL_0001: 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_000f: Invalid comparison between Unknown and I4
				//IL_002a: 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)
				ItemDef itemDef = ItemCatalog.GetItemDef(index);
				if ((int)itemDef.tier == 5)
				{
					return false;
				}
				ItemTag[] array = blacklistedTags;
				foreach (ItemTag val in array)
				{
					if (itemDef.ContainsTag(val))
					{
						return false;
					}
				}
				return true;
			}

			public CopyOwnerInventory()
			{
				ItemTag[] array = new ItemTag[9];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				blacklistedTags = (ItemTag[])(object)array;
				((MonoBehaviour)this)..ctor();
			}
		}

		private class RicochetSound : MonoBehaviour
		{
			public void OnEnable()
			{
				AkSoundEngine.PostEvent(Events.Play_bandit2_R_alt_kill, ((Component)this).gameObject);
				AkSoundEngine.PostEvent(Events.Play_item_proc_moveSpeedOnKill, ((Component)this).gameObject);
				AkSoundEngine.PostEvent(Events.Play_item_proc_ghostOnKill, ((Component)this).gameObject);
			}
		}

		private class HealNovaAssumePosition : CommandAssumePosition
		{
			public override void OnEnter()
			{
				base.TargetHeadroom = 3.5f;
				((CommandAssumePosition)this).OnEnter();
			}

			public override EntityState InstantiateNextState()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				return (EntityState)new CommandHealNovaPulse();
			}
		}

		private class DroneSkillData
		{
			public DroneTechController controller;

			public float cooldown = 25f;

			public float finalRecharge = 1f;

			public void Setup(GameObject obj)
			{
				if (!Object.op_Implicit((Object)(object)controller))
				{
					controller = obj.GetComponent<DroneTechController>();
				}
			}
		}

		private class FollowData
		{
			public float stopwatch;

			public CharacterBody target;

			public CharacterBody drone;

			private bool setup = false;

			public void Setup(CharacterBody body, CharacterBody droneBody)
			{
				if (!setup)
				{
					setup = true;
					target = body;
					drone = droneBody;
					if (((NetworkBehaviour)target).hasAuthority)
					{
						target.onSkillActivatedAuthority += OnSkillActivated;
					}
					else if (NetworkServer.active)
					{
						target.onSkillActivatedServer += OnSkillActivated;
					}
				}
			}

			private void OnSkillActivated(GenericSkill skill)
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				if (skill.skillDef.skillNameToken == "DRONETECH_SECONDARY_NAME")
				{
					stopwatch = 5f;
					drone.inputBank.aimDirection = target.inputBank.aimDirection;
				}
			}
		}

		public class OperatorTracker : HurtboxTracker
		{
			private bool inputTaken = false;

			private DroneTechController tech;

			public override void Start()
			{
				targetingIndicatorPrefab = GameObject.DroneTechTrackingIndicator;
				maxSearchAngle = 35f;
				maxSearchDistance = 90f;
				targetType = TargetType.Friendly;
				searchDelay = 0.2f;
				base.Start();
				tech = ((Component)this).GetComponent<DroneTechController>();
			}

			public override Transform SearchForTarget()
			{
				if (NoGrab)
				{
					return null;
				}
				return base.SearchForTarget();
			}

			public override bool Filter(HurtBox box)
			{
				int result;
				if (Object.op_Implicit((Object)(object)box))
				{
					DroneCommandReceiver component = ((Component)box.healthComponent).GetComponent<DroneCommandReceiver>();
					if (component != null && component.IsReady())
					{
						result = (((Object)(object)box.healthComponent.body.GetOwnerBody() == (Object)(object)body) ? 1 : 0);
						goto IL_0040;
					}
				}
				result = 0;
				goto IL_0040;
				IL_0040:
				return (byte)result != 0;
			}

			public override void FixedUpdate()
			{
				//IL_0020: 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)
				base.FixedUpdate();
				if (Object.op_Implicit((Object)(object)inputBank) && !InputBankExtensions.GetButtonState(inputBank, DroneCycle).down)
				{
					inputTaken = false;
				}
				if (!Object.op_Implicit((Object)(object)body) || !((NetworkBehaviour)body).hasAuthority || !InputBankExtensions.GetButtonState(inputBank, DroneCycle).down || inputTaken)
				{
					return;
				}
				inputTaken = true;
				if (Object.op_Implicit((Object)(object)targetBody) && !NoGrab)
				{
					tech.DroneQueue.RemoveAll((DroneInfo x) => x.characterBody.bodyIndex == targetBody.bodyIndex);
					IEnumerable<DroneInfo> enumerable = tech.AllDrones.Where((DroneInfo x) => x.characterBody.bodyIndex == targetBody.bodyIndex && (Object)(object)x.characterBody != (Object)(object)targetBody);
					foreach (DroneInfo item2 in enumerable)
					{
						tech.DroneQueue.Insert(0, item2);
					}
					tech.DroneQueue.Insert(0, tech.AllDrones.First((DroneInfo x) => (Object)(object)x.characterBody == (Object)(object)targetBody));
					tech.dronesDirty = true;
				}
				else if (tech.DroneQueue.Count > 0)
				{
					DroneInfo item = tech.DroneQueue.ElementAt(0);
					tech.DroneQueue.RemoveAt(0);
					tech.DroneQueue.Add(item);
					tech.dronesDirty = true;
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_IsReady <0>__IsReady;

			public static hook_IsReady <1>__InternalCD;

			public static hook_FixedUpdate <2>__Recharge;

			public static hook_OnEnter <3>__OnDroneCommand;

			public static hook_FillSecondaryQueue <4>__UpdateIcons;

			public static hook_FixedUpdate <5>__DroneTechUpdate;

			public static hook_DoTargetInfoSearch <6>__AllowAllyTarget;

			public static hook_Awake <7>__AllowAllyGrab;

			public static Manipulator <8>__ReduceNanoBugDamage;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_FixedUpdate <>9__16_0;

			public static Func<Instruction, bool> <>9__16_8;

			public static Func<Instruction, bool> <>9__16_9;

			public static Func<Instruction, bool> <>9__16_10;

			public static Func<Instruction, bool> <>9__16_11;

			public static Func<Instruction, bool> <>9__16_12;

			public static Func<Instruction, bool> <>9__16_13;

			public static Func<Instruction, bool> <>9__16_14;

			public static Func<Instruction, bool> <>9__16_15;

			public static Func<Instruction, bool> <>9__16_16;

			public static Func<Instruction, bool> <>9__16_17;

			public static Func<Instruction, bool> <>9__16_18;

			public static Func<Instruction, bool> <>9__16_19;

			public static Action<Follow> <>9__16_20;

			public static Manipulator <>9__16_1;

			public static hook_Start <>9__16_2;

			public static hook_OnEnter <>9__16_21;

			public static hook_FireOrb <>9__16_3;

			public static Func<Instruction, bool> <>9__16_22;

			public static Manipulator <>9__16_4;

			public static hook_OnEnter <>9__16_5;

			public static hook_ModifyBullet <>9__16_6;

			public static hook_Start <>9__16_7;

			public static Func<Instruction, bool> <>9__19_0;

			public static Func<Instruction, bool> <>9__19_1;

			public static Func<Instruction, bool> <>9__19_2;

			public static Func<float, float> <>9__19_3;

			internal void <Initialize>b__16_0(orig_FixedUpdate orig, Follow self)
			{
				orig.Invoke(self);
				if (((EntityState)self).inputBank.skill1.down)
				{
					GenericSkill primary = ((EntityState)self).skillLocator.primary;
					if (primary != null)
					{
						primary.ExecuteIfReady();
					}
				}
				if (((EntityState)self).inputBank.skill2.down)
				{
					GenericSkill secondary = ((EntityState)self).skillLocator.secondary;
					if (secondary != null)
					{
						secondary.ExecuteIfReady();
					}
				}
				if (((EntityState)self).inputBank.skill3.down)
				{
					GenericSkill utility = ((EntityState)self).skillLocator.utility;
					if (utility != null)
					{
						utility.ExecuteIfReady();
					}
				}
				if (((EntityState)self).inputBank.skill4.down)
				{
					GenericSkill special = ((EntityState)self).skillLocator.special;
					if (special != null)
					{
						special.ExecuteIfReady();
					}
				}
			}

			internal void <Initialize>b__16_1(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_00a9: 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_0244: Unknown result type (might be due to invalid IL or missing references)
				//IL_0273: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				MethodReference val9 = default(MethodReference);
				MethodReference val8 = default(MethodReference);
				val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val9),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val8)
				});
				for (int i = 0; i < 4; i++)
				{
					val.Next.OpCode = OpCodes.Nop;
					int index = val.Index;
					val.Index = index + 1;
				}
				MethodReference val7 = default(MethodReference);
				MethodReference val6 = default(MethodReference);
				val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val7),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 9),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val6)
				});
				for (int j = 0; j < 4; j++)
				{
					val.Next.OpCode = OpCodes.Nop;
					int index = val.Index;
					val.Index = index + 1;
				}
				MethodReference val5 = default(MethodReference);
				MethodReference val4 = default(MethodReference);
				val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val5),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val4)
				});
				for (int k = 0; k < 4; k++)
				{
					val.Next.OpCode = OpCodes.Nop;
					int index = val.Index;
					val.Index = index + 1;
				}
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<Follow>>((Action<Follow>)delegate(Follow self)
				{
					//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_009b: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c8: 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_0081: 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_00f2: 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_00f7: 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_01a4: 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)
					//IL_01c8: 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_018c: 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_019e: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
					FollowData orCreateValue = FollowMap.GetOrCreateValue(self);
					orCreateValue.Setup(self.targetBody, ((EntityState)self).characterBody);
					if (orCreateValue.stopwatch >= 0f)
					{
						orCreateValue.stopwatch -= Time.deltaTime;
					}
					Vector3 val2 = (self.followAim ? self.targetBody.inputBank.aimDirection : (Object.op_Implicit((Object)(object)self.targetBody.characterDirection) ? self.targetBody.characterDirection.forward : self.targetBody.transform.forward));
					val2.y = Mathf.Clamp(val2.y, -0.1f, 0.1f);
					val2 = ((Vector3)(ref val2)).normalized;
					Vector3 aimDirection = ((EntityState)self).inputBank.aimDirection;
					Vector3 normalized = ((Vector3)(ref aimDirection)).normalized;
					Vector3 val3 = (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection) ? ((EntityState)self).characterDirection.forward : ((EntityState)self).transform.forward);
					CharacterMaster master = ((EntityState)self).characterBody.master;
					if (master != null && master.aiComponents?.Length > 0)
					{
						CharacterMaster master2 = ((EntityState)self).characterBody.master;
						object obj;
						if (master2 == null)
						{
							obj = null;
						}
						else
						{
							BaseAI obj2 = master2.aiComponents[0];
							obj = ((obj2 != null) ? obj2.currentEnemy.gameObject : null);
						}
						if (Object.op_Implicit((Object)obj) && orCreateValue.stopwatch != 0f)
						{
							val3 = Vector3.SmoothDamp(val3, normalized, ref self.velocityAim, self.aimDampTime);
							goto IL_01d4;
						}
					}
					val3 = Vector3.SmoothDamp(val3, val2, ref self.velocityAim, self.aimDampTime);
					((EntityState)self).inputBank.aimDirection = self.targetBody.inputBank.aimDirection;
					goto IL_01d4;
					IL_01d4:
					if (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection))
					{
						((EntityState)self).characterDirection.forward = val3;
					}
					else
					{
						((EntityState)self).transform.forward = val3;
					}
				});
			}

			internal bool <Initialize>b__16_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <Initialize>b__16_9(Instruction x)
			{
				MethodReference val = default(MethodReference);
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
			}

			internal bool <Initialize>b__16_10(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, 3);
			}

			internal bool <Initialize>b__16_11(Instruction x)
			{
				MethodReference val = default(MethodReference);
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
			}

			internal bool <Initialize>b__16_12(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <Initialize>b__16_13(Instruction x)
			{
				MethodReference val = default(MethodReference);
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
			}

			internal bool <Initialize>b__16_14(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, 9);
			}

			internal bool <Initialize>b__16_15(Instruction x)
			{
				MethodReference val = default(MethodReference);
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
			}

			internal bool <Initialize>b__16_16(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <Initialize>b__16_17(Instruction x)
			{
				MethodReference val = default(MethodReference);
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
			}

			internal bool <Initialize>b__16_18(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, 0);
			}

			internal bool <Initialize>b__16_19(Instruction x)
			{
				MethodReference val = default(MethodReference);
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
			}

			internal void <Initialize>b__16_20(Follow self)
			{
				//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_009b: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: 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_0081: 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_00f2: 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_00f7: 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_01a4: 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)
				//IL_01c8: 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_018c: 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_019e: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
				FollowData orCreateValue = FollowMap.GetOrCreateValue(self);
				orCreateValue.Setup(self.targetBody, ((EntityState)self).characterBody);
				if (orCreateValue.stopwatch >= 0f)
				{
					orCreateValue.stopwatch -= Time.deltaTime;
				}
				Vector3 val = (self.followAim ? self.targetBody.inputBank.aimDirection : (Object.op_Implicit((Object)(object)self.targetBody.characterDirection) ? self.targetBody.characterDirection.forward : self.targetBody.transform.forward));
				val.y = Mathf.Clamp(val.y, -0.1f, 0.1f);
				val = ((Vector3)(ref val)).normalized;
				Vector3 aimDirection = ((EntityState)self).inputBank.aimDirection;
				Vector3 normalized = ((Vector3)(ref aimDirection)).normalized;
				Vector3 val2 = (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection) ? ((EntityState)self).characterDirection.forward : ((EntityState)self).transform.forward);
				CharacterMaster master = ((EntityState)self).characterBody.master;
				if (master != null && master.aiComponents?.Length > 0)
				{
					CharacterMaster master2 = ((EntityState)self).characterBody.master;
					object obj;
					if (master2 == null)
					{
						obj = null;
					}
					else
					{
						BaseAI obj2 = master2.aiComponents[0];
						obj = ((obj2 != null) ? obj2.currentEnemy.gameObject : null);
					}
					if (Object.op_Implicit((Object)obj) && orCreateValue.stopwatch != 0f)
					{
						val2 = Vector3.SmoothDamp(val2, normalized, ref self.velocityAim, self.aimDampTime);
						goto IL_01d4;
					}
				}
				val2 = Vector3.SmoothDamp(val2, val, ref self.velocityAim, self.aimDampTime);
				((EntityState)self).inputBank.aimDirection = self.targetBody.inputBank.aimDirection;
				goto IL_01d4;
				IL_01d4:
				if (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection))
				{
					((EntityState)self).characterDirection.forward = val2;
				}
				else
				{
					((EntityState)self).transform.forward = val2;
				}
			}

			internal void <Initialize>b__16_2(orig_Start orig, DroneTechController self)
			{
				orig.Invoke(self);
				if (self.hasAuthority)
				{
					((Component)(object)self).AddComponent<OperatorTracker>();
				}
			}

			internal void <Initialize>b__16_21(orig_OnEnter orig, CommandHealNovaPulse self)
			{
				orig.Invoke(self);
				CommandHealNovaPulse.radius = 18f;
			}

			internal void <Initialize>b__16_3(orig_FireOrb orig, CommandStimShot self)
			{
				((CommandHealShot)self).healAmount = DOCBarrier * 0.01f;
				orig.Invoke(self);
			}

			internal void <Initialize>b__16_4(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 4f)
				});
				val.Next.Operand = DOCShotDur;
			}

			internal bool <Initialize>b__16_22(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 4f);
			}

			internal void <Initialize>b__16_5(orig_OnEnter orig, CommandFireTurret self)
			{
				if (!self.shouldBounce)
				{
					self.damageCoefficient = GDDamage * 0.01f;
				}
				orig.Invoke(self);
			}

			internal void <Initialize>b__16_6(orig_ModifyBullet orig, FireNanoPistol self, BulletAttack x)
			{
				self.maxDamageCoefficient = NanoPistolDamage * 0.01f;
				orig.Invoke(self, x);
			}

			internal void <Initialize>b__16_7(orig_Start orig, DroneRepairMaster self)
			{
				orig.Invoke(self);
				if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<CopyOwnerInventory>()))
				{
					((Component)(object)self).AddComponent<CopyOwnerInventory>();
				}
			}

			internal bool <ReduceNanoBugDamage>b__19_0(Instruction x)
			{
				FieldReference val = default(FieldReference);
				return ILPatternMatchingExt.MatchLdfld(x, ref val);
			}

			internal bool <ReduceNanoBugDamage>b__19_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 2);
			}

			internal bool <ReduceNanoBugDamage>b__19_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld(x, typeof(DamageInfo), "damage");
			}

			internal float <ReduceNanoBugDamage>b__19_3(float damage)
			{
				return damage * (NanoBugDamage * 0.01f);
			}
		}

		public static Sprite BackdropSprite;

		[ConfigField("Follower Attacks Enemies", "Allows the currently selected drone to still attack enemies.", true)]
		private static bool FollowerAttacks;

		[ConfigField("Allow Drone Cycling", "Lets you target select a drone via a rebindable key or cycle the queue without activating anything.", true)]
		private static bool AllowDroneCycling;

		[ConfigField("No Drone Grab", "If Allow Drone Cycling is on, disables the functionality of targeting a drone.", false)]
		private static bool NoGrab;

		[ConfigField("Drone Command ICD", "Adds a per-drone cooldown to commands. Drones on cooldown will not be valid in the queue and cannot be target grabbed. Cooldown is equal to your M2 cd. Recommended for balance when using target grabbing.", true)]
		private static bool UseDroneICD;

		[ConfigField("Better Queue UI", "Improves the Drone Queue UI.", true)]
		private static bool BetterQueueUI;

		[ConfigField("Ally Targeting", "Allows supportive drones to target allies.", true)]
		private static bool AllyTargeting;

		[ConfigField("DOC Stim Shot Duration", "The duration of the stat buff from DOC's stim shot. Vanilla is 4", 8f)]
		private static float DOCShotDur;

		[ConfigField("DOC Stim Shot Barrier", "The barrier gain from DOC's stim shot. Vanilla is 25.", 40)]
		private static float DOCBarrier;

		[ConfigField("Gunner Drone Barrage Damage", "The damage of Gunner Drone target barrages. Vanilla is 85. This does not apply to CROSSHAIRS.", 150)]
		private static float GDDamage;

		[ConfigField("Extra Ricochet Sound", "Adds an extra sound when you land a kill with M1.", true)]
		private static bool KillSound;

		[ConfigField("M2 Requires Press", "Makes default M2 not magdump in half a second when you hold the button down.", true)]
		private static bool RequirePress;

		[ConfigField("OCR Damage", "The damage of Operator's M1 shot. Vanilla is 600", 1000)]
		private static float NanoPistolDamage;

		[ConfigField("Nanobugged Damage Increase", "The damage increase against Nanobugged enemies. Vanilla is 100", 50)]
		private static float NanoBugDamage;

		[ConfigField("Unique Drones Copy Items", "Makes Operator's unique drones copy most items.", true)]
		private static bool CopyItems;

		public static ModKeybind DroneCycle = RebindAPI.RegisterModKeybind(new ModKeybind("OPERATOR_CYCLE".Add("Drone Queue Cycle (Operator)"), (KeyCode)102, 10, (string)null, (InputActionType)1, (AxisRange)0));

		private static FixedConditionalWeakTable<Follow, FollowData> FollowMap = new FixedConditionalWeakTable<Follow, FollowData>();

		private static FixedConditionalWeakTable<GameObject, DroneSkillData> SkillMap = new FixedConditionalWeakTable<GameObject, DroneSkillData>();

		public static void Initialize()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//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_007f: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//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_0133: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_0149: 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: Expected O, but got Unknown
			//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_00cf: Expected O, but got Unknown
			//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_00f0: Expected O, but got Unknown
			//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_0248: Expected O, but got Unknown
			//IL_0177: 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_0182: Expected O, but got Unknown
			//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_0111: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_0287: 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_0292: Expected O, but got Unknown
			//IL_0217: 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_0222: Expected O, but got Unknown
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Expected O, but got Unknown
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Expected O, but got Unknown
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Expected O, but got Unknown
			if (FollowerAttacks)
			{
				object obj = <>c.<>9__16_0;
				if (obj == null)
				{
					hook_FixedUpdate val = delegate(orig_FixedUpdate orig, Follow self)
					{
						orig.Invoke(self);
						if (((EntityState)self).inputBank.skill1.down)
						{
							GenericSkill primary = ((EntityState)self).skillLocator.primary;
							if (primary != null)
							{
								primary.ExecuteIfReady();
							}
						}
						if (((EntityState)self).inputBank.skill2.down)
						{
							GenericSkill secondary = ((EntityState)self).skillLocator.secondary;
							if (secondary != null)
							{
								secondary.ExecuteIfReady();
							}
						}
						if (((EntityState)self).inputBank.skill3.down)
						{
							GenericSkill utility = ((EntityState)self).skillLocator.utility;
							if (utility != null)
							{
								utility.ExecuteIfReady();
							}
						}
						if (((EntityState)self).inputBank.skill4.down)
						{
							GenericSkill special = ((EntityState)self).skillLocator.special;
							if (special != null)
							{
								special.ExecuteIfReady();
							}
						}
					};
					<>c.<>9__16_0 = val;
					obj = (object)val;
				}
				Follow.FixedUpdate += (hook_FixedUpdate)obj;
				object obj2 = <>c.<>9__16_1;
				if (obj2 == null)
				{
					Manipulator val2 = delegate(ILContext il)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0008: Expected O, but got Unknown
						//IL_00a9: 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_0244: Unknown result type (might be due to invalid IL or missing references)
						//IL_0273: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val21 = new ILCursor(il);
						MethodReference val29 = default(MethodReference);
						MethodReference val28 = default(MethodReference);
						val21.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val29),
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val28)
						});
						for (int i = 0; i < 4; i++)
						{
							val21.Next.OpCode = OpCodes.Nop;
							int index = val21.Index;
							val21.Index = index + 1;
						}
						MethodReference val27 = default(MethodReference);
						MethodReference val26 = default(MethodReference);
						val21.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val27),
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 9),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val26)
						});
						for (int j = 0; j < 4; j++)
						{
							val21.Next.OpCode = OpCodes.Nop;
							int index = val21.Index;
							val21.Index = index + 1;
						}
						MethodReference val25 = default(MethodReference);
						MethodReference val24 = default(MethodReference);
						val21.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val25),
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val24)
						});
						for (int k = 0; k < 4; k++)
						{
							val21.Next.OpCode = OpCodes.Nop;
							int index = val21.Index;
							val21.Index = index + 1;
						}
						val21.Emit(OpCodes.Ldarg_0);
						val21.EmitDelegate<Action<Follow>>((Action<Follow>)delegate(Follow self)
						{
							//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_009b: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
							//IL_00c8: 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_0081: 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_00f2: 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_00f7: 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_01a4: 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)
							//IL_01c8: 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_018c: 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_019e: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
							FollowData orCreateValue = FollowMap.GetOrCreateValue(self);
							orCreateValue.Setup(self.targetBody, ((EntityState)self).characterBody);
							if (orCreateValue.stopwatch >= 0f)
							{
								orCreateValue.stopwatch -= Time.deltaTime;
							}
							Vector3 val22 = (self.followAim ? self.targetBody.inputBank.aimDirection : (Object.op_Implicit((Object)(object)self.targetBody.characterDirection) ? self.targetBody.characterDirection.forward : self.targetBody.transform.forward));
							val22.y = Mathf.Clamp(val22.y, -0.1f, 0.1f);
							val22 = ((Vector3)(ref val22)).normalized;
							Vector3 aimDirection = ((EntityState)self).inputBank.aimDirection;
							Vector3 normalized = ((Vector3)(ref aimDirection)).normalized;
							Vector3 val23 = (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection) ? ((EntityState)self).characterDirection.forward : ((EntityState)self).transform.forward);
							CharacterMaster master = ((EntityState)self).characterBody.master;
							if (master != null && master.aiComponents?.Length > 0)
							{
								CharacterMaster master2 = ((EntityState)self).characterBody.master;
								object obj19;
								if (master2 == null)
								{
									obj19 = null;
								}
								else
								{
									BaseAI obj20 = master2.aiComponents[0];
									obj19 = ((obj20 != null) ? obj20.currentEnemy.gameObject : null);
								}
								if (Object.op_Implicit((Object)obj19) && orCreateValue.stopwatch != 0f)
								{
									val23 = Vector3.SmoothDamp(val23, normalized, ref self.velocityAim, self.aimDampTime);
									goto IL_01d4;
								}
							}
							val23 = Vector3.SmoothDamp(val23, val22, ref self.velocityAim, self.aimDampTime);
							((EntityState)self).inputBank.aimDirection = self.targetBody.inputBank.aimDirection;
							goto IL_01d4;
							IL_01d4:
							if (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection))
							{
								((EntityState)self).characterDirection.forward = val23;
							}
							else
							{
								((EntityState)self).transform.forward = val23;
							}
						});
					};
					<>c.<>9__16_1 = val2;
					obj2 = (object)val2;
				}
				Follow.Update += (Manipulator)obj2;
			}
			if (AllowDroneCycling)
			{
				object obj3 = <>c.<>9__16_2;
				if (obj3 == null)
				{
					hook_Start val3 = delegate(orig_Start orig, DroneTechController self)
					{
						orig.Invoke(self);
						if (self.hasAuthority)
						{
							((Component)(object)self).AddComponent<OperatorTracker>();
						}
					};
					<>c.<>9__16_2 = val3;
					obj3 = (object)val3;
				}
				DroneTechController.Start += (hook_Start)obj3;
			}
			if (UseDroneICD)
			{
				object obj4 = <>O.<0>__IsReady;
				if (obj4 == null)
				{
					hook_IsReady val4 = IsReady;
					<>O.<0>__IsReady = val4;
					obj4 = (object)val4;
				}
				DroneTechDroneSkillDef.IsReady += (hook_IsReady)obj4;
				object obj5 = <>O.<1>__InternalCD;
				if (obj5 == null)
				{
					hook_IsReady val5 = InternalCD;
					<>O.<1>__InternalCD = val5;
					obj5 = (object)val5;
				}
				DroneCommandReceiver.IsReady += (hook_IsReady)obj5;
				object obj6 = <>O.<2>__Recharge;
				if (obj6 == null)
				{
					hook_FixedUpdate val6 = Recharge;
					<>O.<2>__Recharge = val6;
					obj6 = (object)val6;
				}
				DroneCommandReceiver.FixedUpdate += (hook_FixedUpdate)obj6;
				object obj7 = <>O.<3>__OnDroneCommand;
				if (obj7 == null)
				{
					hook_OnEnter val7 = OnDroneCommand;
					<>O.<3>__OnDroneCommand = val7;
					obj7 = (object)val7;
				}
				Activate.OnEnter += (hook_OnEnter)obj7;
			}
			object obj8 = <>O.<4>__UpdateIcons;
			if (obj8 == null)
			{
				hook_FillSecondaryQueue val8 = UpdateIcons;
				<>O.<4>__UpdateIcons = val8;
				obj8 = (object)val8;
			}
			DroneTechSurvivorUIController.FillSecondaryQueue += (hook_FillSecondaryQueue)obj8;
			object obj9 = <>O.<5>__DroneTechUpdate;
			if (obj9 == null)
			{
				hook_FixedUpdate val9 = DroneTechUpdate;
				<>O.<5>__DroneTechUpdate = val9;
				obj9 = (object)val9;
			}
			DroneTechController.FixedUpdate += (hook_FixedUpdate)obj9;
			if (AllyTargeting)
			{
				object obj10 = <>O.<6>__AllowAllyTarget;
				if (obj10 == null)
				{
					hook_DoTargetInfoSearch val10 = AllowAllyTarget;
					<>O.<6>__AllowAllyTarget = val10;
					obj10 = (object)val10;
				}
				DroneCommandReceiver.DoTargetInfoSearch += (hook_DoTargetInfoSearch)obj10;
				object obj11 = <>O.<7>__AllowAllyGrab;
				if (obj11 == null)
				{
					hook_Awake val11 = AllowAllyGrab;
					<>O.<7>__AllowAllyGrab = val11;
					obj11 = (object)val11;
				}
				DroneCommandReceiver.Awake += (hook_Awake)obj11;
				SkillDef.CommandHealNova.activationState = new SerializableEntityStateType(typeof(HealNovaAssumePosition));
				SkillDef.CommandHealNova.activationStateMachineName = "Body";
				bool flag = default(bool);
				ContentAddition.AddEntityState<HealNovaAssumePosition>(ref flag);
				EntityStateConfiguration val12 = Object.Instantiate<EntityStateConfiguration>(EntityStateConfiguration.BombardmentAssumePositionEntityState);
				val12.targetType = (SerializableSystemType)typeof(HealNovaAssumePosition);
				ContentAddition.AddEntityStateConfiguration(val12);
				object obj12 = <>c.<>9__16_21;
				if (obj12 == null)
				{
					hook_OnEnter val13 = delegate(orig_OnEnter orig, CommandHealNovaPulse self)
					{
						orig.Invoke(self);
						CommandHealNovaPulse.radius = 18f;
					};
					<>c.<>9__16_21 = val13;
					obj12 = (object)val13;
				}
				CommandHealNovaPulse.OnEnter += (hook_OnEnter)obj12;
			}
			object obj13 = <>c.<>9__16_3;
			if (obj13 == null)
			{
				hook_FireOrb val14 = delegate(orig_FireOrb orig, CommandStimShot self)
				{
					((CommandHealShot)self).healAmount = DOCBarrier * 0.01f;
					orig.Invoke(self);
				};
				<>c.<>9__16_3 = val14;
				obj13 = (object)val14;
			}
			CommandStimShot.FireOrb += (hook_FireOrb)obj13;
			object obj14 = <>c.<>9__16_4;
			if (obj14 == null)
			{
				Manipulator val15 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val20 = new ILCursor(il);
					val20.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 4f)
					});
					val20.Next.Operand = DOCShotDur;
				};
				<>c.<>9__16_4 = val15;
				obj14 = (object)val15;
			}
			StimShotOrb.OnArrival += (Manipulator)obj14;
			object obj15 = <>c.<>9__16_5;
			if (obj15 == null)
			{
				hook_OnEnter val16 = delegate(orig_OnEnter orig, CommandFireTurret self)
				{
					if (!self.shouldBounce)
					{
						self.damageCoefficient = GDDamage * 0.01f;
					}
					orig.Invoke(self);
				};
				<>c.<>9__16_5 = val16;
				obj15 = (object)val16;
			}
			CommandFireTurret.OnEnter += (hook_OnEnter)obj15;
			Replace(SkillDef.CommandFireTurretSkillDef, "85%", $"{GDDamage}%");
			if (KillSound)
			{
				GameObject.NanoPistolKillEffect.AddComponent<RicochetSound>();
			}
			if (RequirePress)
			{
				((SkillDef)DroneTechDroneSkillDef.Command).mustKeyPress = true;
			}
			Replace(SkillDef.FireNanoPistol, "600%", $"{NanoPistolDamage}%");
			object obj16 = <>c.<>9__16_6;
			if (obj16 == null)
			{
				hook_ModifyBullet val17 = delegate(orig_ModifyBullet orig, FireNanoPistol self, BulletAttack x)
				{
					self.maxDamageCoefficient = NanoPistolDamage * 0.01f;
					orig.Invoke(self, x);
				};
				<>c.<>9__16_6 = val17;
				obj16 = (object)val17;
			}
			FireNanoPistol.ModifyBullet += (hook_ModifyBullet)obj16;
			object obj17 = <>O.<8>__ReduceNanoBugDamage;
			if (obj17 == null)
			{
				Manipulator val18 = ReduceNanoBugDamage;
				<>O.<8>__ReduceNanoBugDamage = val18;
				obj17 = (object)val18;
			}
			NanoBugDebuffController.OnVictimDamaged += (Manipulator)obj17;
			Replace(SkillDef.NanoBomb.keywordTokens[0], "100%", $"{NanoBugDamage}%");
			if (!CopyItems)
			{
				return;
			}
			object obj18 = <>c.<>9__16_7;
			if (obj18 == null)
			{
				hook_Start val19 = delegate(orig_Start orig, DroneRepairMaster self)
				{
					orig.Invoke(self);
					if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<CopyOwnerInventory>()))
					{
						((Component)(object)self).AddComponent<CopyOwnerInventory>();
					}
				};
				<>c.<>9__16_7 = val19;
				obj18 = (object)val19;
			}
			DroneRepairMaster.Start += (hook_Start)obj18;
			Replace("DRONETECH_PASSIVE_DESCRIPTION", "companions.", "companions that <style=cIsUtility>inherit your items.</style>");
		}

		private static void OnDroneCommand(orig_OnEnter orig, Activate self)
		{
			orig.Invoke(self);
			if (self.drone != null && Object.op_Implicit((Object)(object)self.drone.characterBody))
			{
				DroneSkillData orCreateValue = SkillMap.GetOrCreateValue(((Component)self.drone.characterBody).gameObject);
				orCreateValue.cooldown = 0f;
				orCreateValue.finalRecharge = ((EntityState)self).skillLocator.secondary.finalRechargeInterval;
			}
		}

		private static void ReduceNanoBugDamage(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			FieldReference val2 = default(FieldReference);
			val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(DamageInfo), "damage")
			});
			val.EmitDelegate<Func<float, float>>((Func<float, float>)((float damage) => damage * (NanoBugDamage * 0.01f)));
		}

		private static void Replace(SkillDef skill, string match, string replace)
		{
			CollectiveRewiring.LanguageLoadMap.Add(skill.skillDescriptionToken, (string x) => x.Replace(match, replace));
		}

		private static void Replace(string token, string match, string replace)
		{
			CollectiveRewiring.LanguageLoadMap.Add(token, (string x) => x.Replace(match, replace));
		}

		private static void DroneTechUpdate(orig_FixedUpdate orig, DroneTechController self)
		{
			orig.Invoke(self);
			self.dronesDirty = true;
		}

		private static void Recharge(orig_FixedUpdate orig, DroneCommandReceiver self)
		{
			orig.Invoke(self);
			DroneSkillData orCreateValue = SkillMap.GetOrCreateValue(((Component)self).gameObject);
			orCreateValue.cooldown += Time.fixedDeltaTime;
			orCreateValue.cooldown = Mathf.Clamp(orCreateValue.cooldown, 0f, orCreateValue.finalRecharge);
		}

		private static bool InternalCD(orig_IsReady orig, DroneCommandReceiver self)
		{
			DroneSkillData orCreateValue = SkillMap.GetOrCreateValue(((Component)self).gameObject);
			return orig.Invoke(self) && orCreateValue.cooldown >= orCreateValue.finalRecharge;
		}

		private static void UpdateIcons(orig_FillSecondaryQueue orig, DroneTechSurvivorUIController self, List<DroneInfo> ReadyDrones, List<DroneInfo> UnReadyDrones)
		{
			//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_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected I4, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, ReadyDrones, UnReadyDrones);
			ChildLocator component = ((Component)self.overlayInstanceChildLocator.FindChild("Secondary Queue")).GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			int num = 0;
			for (int i = 0; i < 3; i++)
			{
				ChildLocator component2 = ((Component)component.FindChild("Drone " + (i + 1))).GetComponent<ChildLocator>();
				if (!Object.op_Implicit((Object)(object)component2))
				{
					continue;
				}
				RawImage component3 = ((Component)component2.FindChild("Type")).GetComponent<RawImage>();
				RawImage component4 = ((Component)component2.FindChild("Icon")).GetComponent<RawImage>();
				if ((Object)(object)BackdropSprite == (Object)null)
				{
					BackdropSprite = ((Component)component2.FindChild("NoDrone")).GetComponent<Image>().sprite;
				}
				DroneInfo val = null;
				if (i < ReadyDrones.Count)
				{
					val = ReadyDrones[i];
				}
				else if (num < UnReadyDrones.Count)
				{
					val = UnReadyDrones[num];
					num++;
				}
				if (val == null)
				{
					continue;
				}
				if (UseDroneICD)
				{
					Image component5 = ((Component)component2).GetComponent<Image>();
					Image val2 = component5;
					DroneType type = val.type;
					if (1 == 0)
					{
					}
					Color color = (Color)((int)type switch
					{
						0 => self.HealingColor, 
						1 => self.DamageColor, 
						2 => self.UtilityColor, 
						_ => self.HealingColor, 
					});
					if (1 == 0)
					{
					}
					((Graphic)val2).color = color;
					((Graphic)component5).color = Color.Lerp(((Graphic)component5).color, Color.black, 0.35f);
					component5.type = (Type)3;
					component5.fillMethod = (FillMethod)0;
					component5.sprite = BackdropSprite;
					if (Object.op_Implicit((Object)(object)val.characterBody))
					{
						DroneSkillData orCreateValue = SkillMap.GetOrCreateValue(((Component)val.characterBody).gameObject);
						component5.fillAmount = Mathf.Clamp01(orCreateValue.cooldown / orCreateValue.finalRecharge);
					}
					else
					{
						component5.fillAmount = 1f;
					}
				}
				if (BetterQueueUI)
				{
					((Transform)((Graphic)component3).rectTransform).localScale = new Vector3(0.8f, 0.8f, 1f);
					((Transform)((Graphic)component3).rectTransform).localPosition = new Vector3(160f, 0f, 0f);
					((Transform)((Graphic)component4).rectTransform).localScale = new Vector3(1.3f, 1.3f, 1f);
					((Transform)((Graphic)component4).rectTransform).localPosition = new Vector3(-86f, 5f, 0f);
				}
			}
		}

		private static bool IsReady(orig_IsReady orig, DroneTechDroneSkillDef self, GenericSkill skillSlot)
		{
			DroneSkillData orCreateValue = SkillMap.GetOrCreateValue(((Component)skillSlot).gameObject);
			orCreateValue.Setup(((Component)skillSlot).gameObject);
			if (Object.op_Implicit((Object)(object)orCreateValue.controller) && orCreateValue.controller.CurrentDrone != null && Object.op_Implicit((Object)(object)orCreateValue.controller.CurrentDrone.characterBody))
			{
				DroneSkillData orCreateValue2 = SkillMap.GetOrCreateValue(((Component)orCreateValue.controller.CurrentDrone.characterBody).gameObject);
				return orig.Invoke(self, skillSlot) && orCreateValue2.cooldown >= orCreateValue2.finalRecharge;
			}
			return orig.Invoke(self, skillSlot);
		}

		private static void OnDroneCommand(orig_CommandActivate orig, DroneCommandReceiver self)
		{
			orig.Invoke(self);
			DroneSkillData orCreateValue = SkillMap.GetOrCreateValue(((Component)self).gameObject);
			orCreateValue.cooldown = 0f;
			if (Object.op_Implicit((Object)(object)self.leaderBody))
			{
				orCreateValue.finalRecharge = self.leaderBody.skillLocator.secondary.finalRechargeInterval;
			}
		}

		private static void AllowAllyGrab(orig_Awake orig, DroneCommandReceiver self)
		{
			//IL_000a: 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_0026: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (((Enum)self.targetType).HasFlag((Enum)(object)(TargetType)8))
			{
				self.targetType = (TargetType)(self.targetType | 2);
			}
			if (((Enum)self.targetType).HasFlag((Enum)(object)(TargetType)16))
			{
				self.targetDistance = 60f;
			}
		}

		private static TargetInfo AllowAllyTarget(orig_DoTargetInfoSearch orig, DroneCommandReceiver self, Ray aimRay)
		{
			//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_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_0033: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_005a: 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_0053: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			TargetType targetType = self.targetType;
			bool flag = false;
			if (((Enum)targetType).HasFlag((Enum)(object)(TargetType)16))
			{
				self.targetType = (TargetType)2;
				flag = true;
			}
			TargetInfo val = orig.Invoke(self, aimRay);
			self.targetType = targetType;
			if (flag && Object.op_Implicit((Object)(object)val.hurtBox))
			{
				return val;
			}
			return orig.Invoke(self, aimRay);
		}
	}
	[ConfigSection("Tweaks :: Solus Heart")]
	public static class SolusHeart
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_TakeDamageProcess <0>__OnTakeDamage;
		}

		[ConfigField("Prevent Accidental Ending Skip", "Only allows the downed Solus Heart to take damage from player skills and only from players close to it.", true)]
		private static bool AvoidAccidentalSkip;

		private static LazyIndex SolusHeartDowned = new LazyIndex("SolusHeartBody_Offering");

		public static void Initialize()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__OnTakeDamage;
			if (obj == null)
			{
				hook_TakeDamageProcess val = OnTakeDamage;
				<>O.<0>__OnTakeDamage = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamageProcess += (hook_TakeDamageProcess)obj;
		}

		private static void OnTakeDamage(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_001b: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//IL_0098: 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)
			if (AvoidAccidentalSkip && Object.op_Implicit((Object)(object)self.body) && self.body.bodyIndex == (BodyIndex)SolusHeartDowned)
			{
				CharacterBody val = default(CharacterBody);
				if ((int)damageInfo.damageType.damageSource == 0 || !Object.op_Implicit((Object)(object)damageInfo.attacker) || !Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>()) || !damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) || !val.isPlayerControlled || Vector3.Distance(((Component)self).transform.position, val.transform.position) >= 30f)
				{
				}
				damageInfo.rejected = true;
			}
			orig.Invoke(self, damageInfo);
		}
	}
	[ConfigSection("Tweaks :: Wandering Chef")]
	public static class WanderingChef
	{
		[ConfigField("Spawn On Ending Stages", "Makes the Wandering Chef spawn on Prime Meridian, Commencement, and Void Locus. Requires Alloyed Collective to be enabled.", true)]
		private static bool SpawnOnEndingStages;

		public static void Initialize()
		{
			if (SpawnOnEndingStages)
			{
				SceneManager.activeSceneChanged += SceneChange;
			}
		}

		private static void SceneChange(Scene arg0, Scene arg1)
		{
			//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_000c: 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_0013: 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_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_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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_01f8: 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_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: 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_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			Vector3 zero2 = Vector3.zero;
			Vector3 zero3 = Vector3.zero;
			Vector3 zero4 = Vector3.zero;
			Material material = null;
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "moon2")
			{
				((Vector3)(ref zero))..ctor(-370f, -134f, -225f);
				((Vector3)(ref zero2))..ctor(-370f, -135.3f, -225f);
				((Vector3)(ref zero4))..ctor(270f, 90f, 0f);
				material = Material.matMoonBoulder;
			}
			activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "meridian")
			{
				((Vector3)(ref zero))..ctor(125f, 26.1f, -23f);
				((Vector3)(ref zero3))..ctor(0f, 315f, 0f);
				((Vector3)(ref zero2))..ctor(125.5f, 25.1f, -22.3f);
				((Vector3)(ref zero4))..ctor(270f, 35f, 0f);
				material = Material.matPMTerrainPlayZoneWall;
			}
			activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "voidstage")
			{
				((Vector3)(ref zero))..ctor(-37f, -5.9f, 14f);
				((Vector3)(ref zero3))..ctor(0f, 270f, 0f);
				((Vector3)(ref zero2))..ctor(-37f, -7.35f, 14f);
				((Vector3)(ref zero4))..ctor(270f, 0f, 0f);
				material = Material.matVoidCoralPlatformMagenta;
			}
			if (zero != Vector3.zero && Run.instance.IsExpansionEnabled(ExpansionDef.DLC3))
			{
				if (NetworkServer.active)
				{
					GameObject val = Object.Instantiate<GameObject>(GameObject.MealPrep, zero, Quaternion.Euler(zero3));
					NetworkServer.Spawn(val);
				}
				GameObject val2 = Object.Instantiate<GameObject>(GameObject.BazaarLunarTable, zero2, Quaternion.Euler(zero4));
				val2.transform.localScale = Vector3.one * 0.889f;
				val2.transform.position = zero2;
				val2.transform.rotation = Quaternion.Euler(zero4);
				((Renderer)val2.GetComponent<MeshRenderer>()).material = material;
				GameObject val3 = Object.Instantiate<GameObject>(GameObject.DisplaySteakFlat, val2.transform);
				val3.transform.localPosition = new Vector3(-1.5f, -1.35f, 1.3f);
				val3.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
				GameObject val4 = Object.Instantiate<GameObject>(GameObject.DisplaySteakFlat, val2.transform);
				val4.transform.localPosition = new Vector3(-2f, -0.3f, 1.35f);
				val4.transform.localRotation = Quaternion.Euler(0f, 0f, 295f);
				GameObject val5 = Object.Instantiate<GameObject>(GameObject.DisplaySteakFlat, val2.transform);
				val5.transform.localPosition = new Vector3(-1.8f, -0.3f, 1.5f);
				val5.transform.localRotation = Quaternion.Euler(0f, 0f, 70f);
			}
		}
	}
	[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
	public class ConfigFieldAttribute : SearchableAttribute
	{
		public string name;

		public string desc;

		public object defaultValue;

		public ConfigFieldAttribute(string name, string desc, object defaultValue)
		{
			this.name = name;
			this.desc = desc;
			this.defaultValue = defaultValue;
		}
	}
	[AttributeUsage(AttributeTargets.Class)]
	public class ConfigSectionAttribute : Attribute
	{
		public string name;

		public ConfigSectionAttribute(string name)
		{
			this.name = name;
		}
	}
	public class ConfigManager
	{
		public static void HandleConfigAttributes(Assembly assembly, ConfigFile config)
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			Type[] types = assembly.GetTypes();
			foreach (Type type in types)
			{
				TypeInfo typeInfo = type.GetTypeInfo();
				ConfigSectionAttribute customAttribute = typeInfo.GetCustomAttribute<ConfigSectionAttribute>();
				if (customAttribute == null)
				{
					continue;
				}
				FieldInfo[] fields = typeInfo.GetFields((BindingFlags)(-1));
				foreach (FieldInfo fieldInfo in fields)
				{
					if (!fieldInfo.IsStatic)
					{
						continue;
					}
					Type fieldType = fieldInfo.FieldType;
					ConfigFieldAttribute customAttribute2 = ((MemberInfo)fieldInfo).GetCustomAttribute<ConfigFieldAttribute>();
					if (customAttribute2 != null)
					{
						MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods()
							where x.Name == "Bind"
							select x).First();
						methodInfo = methodInfo.MakeGenericMethod(fieldType);
						ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, new object[3]
						{
							(object)new ConfigDefinition(customAttribute.name, customAttribute2.name),
							customAttribute2.defaultValue,
							(object)new ConfigDescription(customAttribute2.desc, (AcceptableValueBase)null, Array.Empty<object>())
						});
						fieldInfo.SetValue(null, val.BoxedValue);
					}
				}
			}
		}
	}
}
namespace CollectiveRewiring.Utils
{
	public class BasicLaserBeam
	{
		public float DamageCoefficient;

		public CharacterBody Owner;

		public Transform TargetMuzzle;

		private LineRenderer lr;

		public GameObject effectInstance;

		private bool firing = false;

		private float stopwatch = 0f;

		private float growthStopwatch = 0f;

		private float delay;

		private BasicLaserInfo info;

		private Transform origin;

		private Transform end;

		private Vector3 targetEndpoint;

		private float origWidth = 0f;

		public bool Active => firing;

		public BasicLaserBeam(CharacterBody owner, Transform muzzle, BasicLaserInfo info)
		{
			//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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			this.info = info;
			delay = 1f / info.TickRate;
			TargetMuzzle = muzzle;
			DamageCoefficient = info.DamageCoefficient * delay;
			effectInstance = Object.Instantiate<GameObject>(info.EffectPrefab, ((Component)muzzle).transform.position, Quaternion.identity);
			growthStopwatch = info.ChargeDelay;
			origin = (info.OriginIsBase ? effectInstance.transform : effectInstance.GetComponent<ChildLocator>().FindChild(info.OriginName));
			end = effectInstance.GetComponent<ChildLocator>().FindChild(info.EndpointName);
			lr = effectInstance.GetComponent<DetachLineRendererAndFade>().line;
			origWidth = lr.widthMultiplier;
			Owner = owner;
			targetEndpoint = GetEndpoint(out var _);
			((Component)end).transform.position = targetEndpoint;
			((Component)origin).transform.position = ((Component)TargetMuzzle).transform.position;
		}

		public void Fire()
		{
			if (Object.op_Implicit((Object)(object)info.FiringMaterial))
			{
				((Renderer)lr).material = info.FiringMaterial;
			}
			lr.widthMultiplier = origWidth * info.FiringWidthMultiplier;
			firing = true;
			stopwatch = 0f;
		}

		public void UpdateVisual(float deltaTime)
		{
			//IL_0017: 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_003e: 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)
			((Component)origin).transform.position = ((Component)TargetMuzzle).transform.position;
			((Component)end).transform.position = Vector3.MoveTowards(((Component)end).transform.position, targetEndpoint, 250f * deltaTime);
		}

		public void Update(float deltaTime)
		{
			//IL_002c: 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_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_008e: 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_00a6: Expected O, but got Unknown
			stopwatch += deltaTime;
			if (stopwatch >= delay)
			{
				targetEndpoint = GetEndpoint(out var unmodified);
				stopwatch = 0f;
				if (firing && ((NetworkBehaviour)Owner).hasAuthority)
				{
					GetBulletAttack().Fire();
					if (Object.op_Implicit((Object)(object)info.ImpactEffect))
					{
						EffectManager.SpawnEffect(info.ImpactEffect, new EffectData
						{
							origin = unmodified,
							scale = 1f
						}, false);
					}
				}
			}
			if (!firing)
			{
				growthStopwatch -= deltaTime;
				lr.widthMultiplier = Mathf.Max(0f, growthStopwatch / info.ChargeDelay);
			}
		}

		public Vector3 GetEndpoint(out Vector3 unmodified)
		{
			//IL_0026: 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_002b: 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_003f: 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_0057: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0074: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c4: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((info.FiringMode == LaserFiringMode.TrackAim) ? Owner.inputBank.aimDirection : TargetMuzzle.forward);
			Vector3 val2 = ((info.FiringMode == LaserFiringMode.TrackAim) ? Owner.inputBank.aimOrigin : TargetMuzzle.position);
			Ray val3 = new Ray(val2, val);
			Vector3 point = ((Ray)(ref val3)).GetPoint(info.MaxRange);
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val2, val, ref val4, info.MaxRange, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
			{
				point = ((RaycastHit)(ref val4)).point;
			}
			unmodified = point;
			return point + val * 5f;
		}

		public BulletAttack GetBulletAttack()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_005c: 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_0061: 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_007d: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			BulletAttack val = new BulletAttack();
			val.radius = lr.startWidth * 0.75f;
			val.damage = Owner.damage * DamageCoefficient;
			val.origin = ((info.FiringMode == LaserFiringMode.TrackAim) ? Owner.inputBank.aimOrigin : TargetMuzzle.position);
			Vector3 val2 = ((Component)end).transform.position - TargetMuzzle.position;
			val.aimVector = ((Vecto