Decompiled source of TinkersSatchel v5.1.1

TinkersSatchel.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
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 AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Bandit2;
using EntityStates.Captain.Weapon;
using EntityStates.CaptainSupplyDrop;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Croco;
using EntityStates.Drone;
using EntityStates.Engi.EngiBubbleShield;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.Engi.EngiWeapon;
using EntityStates.GlobalSkills.LunarNeedle;
using EntityStates.GolemMonster;
using EntityStates.Gup;
using EntityStates.Headstompers;
using EntityStates.Huntress;
using EntityStates.Huntress.HuntressWeapon;
using EntityStates.LaserTurbine;
using EntityStates.Loader;
using EntityStates.Mage.Weapon;
using EntityStates.Merc;
using EntityStates.SiphonItem;
using EntityStates.Toolbot;
using EntityStates.Treebot;
using EntityStates.Treebot.Weapon;
using EntityStates.VoidSurvivor.Vent;
using EntityStates.VoidSurvivor.Weapon;
using HG;
using IL.EntityStates.Drone;
using IL.RoR2;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.Bandit2;
using On.EntityStates.Captain.Weapon;
using On.EntityStates.Commando;
using On.EntityStates.Croco;
using On.EntityStates.Drone;
using On.EntityStates.Engi.EngiBubbleShield;
using On.EntityStates.Engi.EngiMissilePainter;
using On.EntityStates.Engi.EngiWeapon;
using On.EntityStates.Headstompers;
using On.EntityStates.Huntress;
using On.EntityStates.Huntress.HuntressWeapon;
using On.EntityStates.LaserTurbine;
using On.EntityStates.Loader;
using On.EntityStates.Mage.Weapon;
using On.EntityStates.Merc;
using On.EntityStates.SiphonItem;
using On.EntityStates.Toolbot;
using On.EntityStates.Treebot;
using On.EntityStates.Treebot.Weapon;
using On.EntityStates.VoidSurvivor.Vent;
using On.EntityStates.VoidSurvivor.Weapon;
using On.RoR2;
using On.RoR2.CharacterAI;
using On.RoR2.Orbs;
using On.RoR2.Projectile;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.Achievements;
using RoR2.CharacterAI;
using RoR2.EntitlementManagement;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using TILER2;
using TMPro;
using ThinkInvisible.Dronemeld;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("TinkersSatchel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TinkersSatchel")]
[assembly: AssemblyTitle("TinkersSatchel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ThinkInvisible.TinkersSatchel
{
	public class AntiAir : Artifact<AntiAir>
	{
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public float hurtMod { get; private set; } = 5f;


		public AntiAir()
		{
			((CatalogBoilerplate)this).iconResource = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/antiair_on.png");
			((Artifact)this).iconResourceDisabled = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/antiair_off.png");
		}

		public override void Install()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((Artifact)this).Install();
			HealthComponent.TakeDamage += new hook_TakeDamage(On_HCTakeDamage);
		}

		public override void Uninstall()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((Artifact)this).Uninstall();
			HealthComponent.TakeDamage -= new hook_TakeDamage(On_HCTakeDamage);
		}

		private void On_HCTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			if (((Artifact)this).IsActiveAndEnabled() && (Object)(object)self.body != (Object)null && (Object)(object)self.body.teamComponent != (Object)null && (int)self.body.teamComponent.teamIndex == 1 && (Object)(object)self.body.characterMotor != (Object)null && !self.body.characterMotor.isGrounded)
			{
				damageInfo.damage *= hurtMod;
			}
			orig.Invoke(self, damageInfo);
		}
	}
	public class Butterknife : Artifact<Butterknife>
	{
		private readonly MethodInfo cbDamageSetter;

		private readonly MethodInfo cbAttackSetter;

		public Butterknife()
		{
			((CatalogBoilerplate)this).iconResource = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/butterknife_on.png");
			((Artifact)this).iconResourceDisabled = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/butterknife_off.png");
			cbDamageSetter = Reflection.GetPropertyCached(typeof(CharacterBody), "damage").GetSetMethod(nonPublic: true);
			cbAttackSetter = Reflection.GetPropertyCached(typeof(CharacterBody), "attackSpeed").GetSetMethod(nonPublic: true);
		}

		public override void Install()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((Artifact)this).Install();
			CharacterBody.RecalculateStats += new hook_RecalculateStats(On_CBRecalcStats);
		}

		public override void Uninstall()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((Artifact)this).Uninstall();
			CharacterBody.RecalculateStats -= new hook_RecalculateStats(On_CBRecalcStats);
		}

		private void On_CBRecalcStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (((Artifact)this).IsActiveAndEnabled())
			{
				cbDamageSetter.Invoke(self, new object[1] { self.damage / 20f });
				cbAttackSetter.Invoke(self, new object[1] { self.attackSpeed * 10f });
			}
		}
	}
	public class Danger : Artifact<Danger>
	{
		public Danger()
		{
			((CatalogBoilerplate)this).iconResource = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/danger_on.png");
			((Artifact)this).iconResourceDisabled = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/danger_off.png");
		}

		public override void Install()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((Artifact)this).Install();
			CharacterBody.RecalculateStats += new Manipulator(IL_CBRecalcStats);
		}

		public override void Uninstall()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((Artifact)this).Uninstall();
			CharacterBody.RecalculateStats -= new Manipulator(IL_CBRecalcStats);
		}

		private void IL_CBRecalcStats(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "set_hasOneShotProtection")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<bool, CharacterBody, bool>>((Func<bool, CharacterBody, bool>)((bool origSet, CharacterBody body) => body.isPlayerControlled && !((Artifact)this).IsActiveAndEnabled()));
			}
			else
			{
				TinkersSatchelPlugin._logger.LogError((object)"failed to apply IL patch (Artifact of Danger, set OHP flag)! Artifact will not prevent OHP while enabled.");
			}
		}
	}
	public class DelayLoot : Artifact<DelayLoot>
	{
		public enum AnnounceItemsMode
		{
			Nothing,
			Vague,
			ItemTier,
			ItemName
		}

		public enum AnnounceDropMode
		{
			Nothing,
			TotalItemCount
		}

		private bool shouldDeferDrops = true;

		private Vector3 lootShowerLoc = Vector3.zero;

		private float lootShowerTimer;

		private readonly List<GameObject> deferredDrops = new List<GameObject>();

		private List<Vector3> launchVelocities = new List<Vector3>();

		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public AnnounceItemsMode announceItems { get; private set; } = AnnounceItemsMode.ItemName;


		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public AnnounceDropMode announceDrop { get; private set; } = AnnounceDropMode.TotalItemCount;


		public DelayLoot()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((CatalogBoilerplate)this).iconResource = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/delayitems_on.png");
			((Artifact)this).iconResourceDisabled = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/delayitems_off.png");
		}

		public override void Install()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			((Artifact)this).Install();
			Stage.onServerStageBegin += Stage_onServerStageBegin;
			PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += new Manipulator(PickupDropletController_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3);
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
			Run.FixedUpdate += new hook_FixedUpdate(Run_FixedUpdate);
		}

		public override void Uninstall()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			((Artifact)this).Uninstall();
			Stage.onServerStageBegin -= Stage_onServerStageBegin;
			PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new Manipulator(PickupDropletController_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3);
			GlobalEventManager.onCharacterDeathGlobal -= GlobalEventManager_onCharacterDeathGlobal;
			Run.FixedUpdate -= new hook_FixedUpdate(Run_FixedUpdate);
		}

		private void Run_FixedUpdate(orig_FixedUpdate orig, Run self)
		{
			//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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!NetworkServer.active || !((Artifact)this).IsActiveAndEnabled() || shouldDeferDrops || deferredDrops.Count <= 0)
			{
				return;
			}
			lootShowerTimer -= Time.fixedDeltaTime;
			if (!(lootShowerTimer <= 0f))
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)deferredDrops[0]))
			{
				deferredDrops.RemoveAt(0);
				return;
			}
			Vector3 val = launchVelocities[0];
			launchVelocities.RemoveAt(0);
			launchVelocities.Add(val);
			Rigidbody component = deferredDrops[0].GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.velocity = val;
				component.drag = 0f;
			}
			((Behaviour)deferredDrops[0].GetComponent<ConstantForce>()).enabled = false;
			deferredDrops[0].transform.position = lootShowerLoc;
			deferredDrops[0].SetActive(true);
			deferredDrops.RemoveAt(0);
			lootShowerTimer = 0.125f;
		}

		private void Stage_onServerStageBegin(Stage obj)
		{
			shouldDeferDrops = true;
		}

		private void GlobalEventManager_onCharacterDeathGlobal(DamageReport report)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01d7: Unknown result type (might be due to invalid IL or missing references)
			if (!((Artifact)this).IsActiveAndEnabled() || !report.victimIsBoss || !Object.op_Implicit((Object)(object)TeleporterInteraction.instance) || TeleporterInteraction.instance.bossGroup.combatSquad.memberCount > 1)
			{
				return;
			}
			shouldDeferDrops = false;
			lootShowerLoc = ((Component)report.victim).transform.position + Vector3.up * 3f;
			NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph((GraphType)0);
			launchVelocities = MiscUtil.CollectNearestNodeLaunchVelocities(nodeGraph, deferredDrops.Count, 10f, 1000f, lootShowerLoc, 5f, 0.625f, 3f, 10, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)1, (HullMask)1);
			if (launchVelocities.Count < deferredDrops.Count)
			{
				Vector3 val = ((Component)TeleporterInteraction.instance).transform.position + Vector3.up * 3f;
				List<Vector3> list = MiscUtil.CollectNearestNodeLaunchVelocities(nodeGraph, deferredDrops.Count, 10f, 1000f, val, 5f, 0.625f, 3f, 10, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)1, (HullMask)1);
				if (launchVelocities.Count == 0 && list.Count == 0)
				{
					TinkersSatchelPlugin._logger.LogWarning((object)"DelayLoot: found no free navnodes to drop items at, using fallback circle");
					lootShowerLoc = val;
					for (int i = 0; i < deferredDrops.Count; i++)
					{
						float num = (float)i / (float)deferredDrops.Count * MathF.PI * 2f;
						launchVelocities.Add(new Vector3(Mathf.Cos(num) * 10f, 20f, Mathf.Sin(num) * 10f));
					}
				}
				else if (list.Count > launchVelocities.Count)
				{
					TinkersSatchelPlugin._logger.LogWarning((object)"DelayLoot: couldn't find enough free navnodes to drop items at from boss, falling back to TP");
					launchVelocities = list;
					lootShowerLoc = val;
				}
				if (launchVelocities.Count < deferredDrops.Count)
				{
					TinkersSatchelPlugin._logger.LogWarning((object)"DelayLoot: couldn't find enough free navnodes to drop items at from any source, some items will stack");
				}
			}
			if (announceDrop == AnnounceDropMode.TotalItemCount && deferredDrops.Count > 0)
			{
				SimpleChatMessage val2 = new SimpleChatMessage();
				val2.paramTokens = new string[1] { deferredDrops.Count.ToString() };
				val2.baseToken = "TKSAT_DELAYLOOT_MSG_KILL";
				Chat.SendBroadcastChat((ChatMessageBase)(object)val2);
			}
		}

		private void PickupDropletController_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<NetworkServer>(x, "Spawn")
			}))
			{
				val.Emit(OpCodes.Dup);
				val.EmitDelegate<Action<GameObject>>((Action<GameObject>)delegate(GameObject obj)
				{
					if (((Artifact)this).IsActiveAndEnabled() && shouldDeferDrops && Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
					{
						DeferDroplet(obj);
					}
				});
			}
			else
			{
				TinkersSatchelPlugin._logger.LogError((object)"DelayLoot failed to apply IL hook (PickupDropletController_CreatePickupDroplet): couldn't find target instructions");
			}
		}

		private void DeferDroplet(GameObject droplet)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_007f: 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)
			if (!Object.op_Implicit((Object)(object)droplet))
			{
				return;
			}
			deferredDrops.Add(droplet);
			droplet.SetActive(false);
			PickupDropletController component = droplet.GetComponent<PickupDropletController>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(component.pickupIndex);
			if (pickupDef != null && announceItems != 0)
			{
				string text = Language.GetString((announceItems == AnnounceItemsMode.ItemName) ? pickupDef.nameToken : "TKSAT_DELAYLOOT_MSG_DELAY_VAGUE");
				if (announceItems != AnnounceItemsMode.Vague)
				{
					text = "<color=#" + Util.RGBToHex(Color32.op_Implicit(pickupDef.baseColor)) + ">" + text + "</color>";
				}
				SimpleChatMessage val = new SimpleChatMessage();
				val.paramTokens = new string[1] { text };
				val.baseToken = "TKSAT_DELAYLOOT_MSG_DELAY";
				Chat.SendBroadcastChat((ChatMessageBase)(object)val);
			}
		}
	}
	public class DisposableEquip : Artifact<DisposableEquip>
	{
		[AutoConfigRoOIntSlider("{0:N0}", 0, 10, null, null)]
		[AutoConfigUpdateActions(/*Could not decode attribute arguments.*/)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public int rucksackCount { get; private set; } = 2;


		[AutoConfigRoOIntSlider("{0:N0}", 0, 10, null, null)]
		[AutoConfigUpdateActions(/*Could not decode attribute arguments.*/)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public int extraEquipmentSpawnCount { get; private set; } = 3;


		[AutoConfigRoOSlider("{0:P0}", 0f, 1f, null, null)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public float multishopChance { get; private set; } = 0.2f;


		protected override string[] GetDescStringArgs(string langID = null)
		{
			return new string[1] { (rucksackCount + 1).ToString("N0") };
		}

		public DisposableEquip()
		{
			((CatalogBoilerplate)this).iconResource = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/DisposableEquip_on.png");
			((Artifact)this).iconResourceDisabled = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/DisposableEquip_off.png");
		}

		public override void Install()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			((Artifact)this).Install();
			Run.onPlayerFirstCreatedServer += Run_onPlayerFirstCreatedServer;
			EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction);
			SceneDirector.PopulateScene += new hook_PopulateScene(SceneDirector_PopulateScene);
		}

		public override void Uninstall()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			((Artifact)this).Uninstall();
			Run.onPlayerFirstCreatedServer -= Run_onPlayerFirstCreatedServer;
			EquipmentSlot.PerformEquipmentAction -= new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction);
			SceneDirector.PopulateScene -= new hook_PopulateScene(SceneDirector_PopulateScene);
		}

		private void SceneDirector_PopulateScene(orig_PopulateScene orig, SceneDirector self)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)Run.instance) || !((Artifact)this).IsActiveAndEnabled())
			{
				return;
			}
			DirectorPlacementRule val = new DirectorPlacementRule
			{
				placementMode = (PlacementMode)4
			};
			InteractableSpawnCard val2 = LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscEquipmentBarrel");
			InteractableSpawnCard val3 = LegacyResourcesAPI.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscTripleShopEquipment");
			int participatingPlayerCount = Run.instance.participatingPlayerCount;
			PurchaseInteraction val5 = default(PurchaseInteraction);
			for (int i = 0; i < participatingPlayerCount * extraEquipmentSpawnCount; i++)
			{
				for (int j = 0; j < 10; j++)
				{
					GameObject val4 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)((self.rng.nextNormalizedFloat > multishopChance) ? val2 : val3), val, self.rng));
					if (Object.op_Implicit((Object)(object)val4))
					{
						if (val4.TryGetComponent<PurchaseInteraction>(ref val5) && (int)val5.costType == 1)
						{
							val5.Networkcost = Run.instance.GetDifficultyScaledCost(val5.cost);
						}
						break;
					}
				}
			}
		}

		private void Run_onPlayerFirstCreatedServer(Run run, PlayerCharacterMasterController pcmc)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (((Artifact)this).IsActiveAndEnabled() && Object.op_Implicit((Object)(object)pcmc) && Object.op_Implicit((Object)(object)pcmc.master))
			{
				pcmc.master.inventory.GiveItem(((Item)Item<ExtraEquipment>.instance).catalogIndex, rucksackCount);
			}
		}

		private bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
		{
			//IL_001a: 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)
			bool num = orig.Invoke(self, equipmentDef);
			if (num && ((Artifact)this).IsActiveAndEnabled())
			{
				self.inventory.SetEquipment(new EquipmentState((EquipmentIndex)(-1), FixedTimeStamp.now, (byte)0, false), (uint)self.inventory.activeEquipmentSlot);
			}
			return num;
		}
	}
	public class PackTactics : Artifact<PackTactics>
	{
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public float baseRadius { get; private set; } = 25f;


		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public float speedMod { get; private set; } = 0.05f;


		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public float damageMod { get; private set; } = 0.1f;


		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public float armorMod { get; private set; } = 15f;


		public BuffDef tacticsBuff { get; private set; }

		public GameObject tacticsWardPrefab { get; private set; }

		public PackTactics()
		{
			((CatalogBoilerplate)this).iconResource = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/tactics_on.png");
			((Artifact)this).iconResourceDisabled = TinkersSatchelPlugin.resources.LoadAsset<Sprite>("Assets/TinkersSatchel/Textures/ArtifactIcons/tactics_off.png");
		}

		public override void SetupConfig()
		{
			((Artifact)this).SetupConfig();
			((AutoConfigContainer)this).ConfigEntryChanged += delegate(object sender, AutoConfigUpdateActionEventArgs args)
			{
				if (args.target.boundProperty.Name == "baseRadius" && NetworkServer.active)
				{
					foreach (TacticsWard instance in TacticsWard.instances)
					{
						((Component)instance).GetComponent<BuffWard>().Networkradius = (float)args.newValue;
					}
				}
			};
		}

		public override void SetupAttributes()
		{
			//IL_0017: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			((Artifact)this).SetupAttributes();
			tacticsBuff = ScriptableObject.CreateInstance<BuffDef>();
			tacticsBuff.buffColor = Color.white;
			tacticsBuff.canStack = true;
			tacticsBuff.isDebuff = false;
			((Object)tacticsBuff).name = ((T2Module)this).modInfo.shortIdentifier + "TacticsBuff";
			tacticsBuff.iconSprite = ((CatalogBoilerplate)this).iconResource;
			ContentAddition.AddBuffDef(tacticsBuff);
			GameObject val = new GameObject("TacticsAuraPrefabPrefab");
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<TeamFilter>();
			val.AddComponent<NetworkedBodyAttachment>().forceHostAuthority = true;
			val.AddComponent<TacticsWard>();
			BuffWard obj = val.AddComponent<BuffWard>();
			obj.invertTeamFilter = false;
			obj.expires = false;
			obj.animateRadius = false;
			obj.radius = baseRadius;
			obj.rangeIndicator = null;
			obj.Networkradius = baseRadius;
			obj.buffDuration = 1f;
			obj.interval = 1f;
			obj.buffDef = tacticsBuff;
			tacticsWardPrefab = PrefabAPI.InstantiateClone(val, "TacticsAuraPrefab", true);
			Object.Destroy((Object)(object)val);
		}

		public override void Install()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			((Artifact)this).Install();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Evt_TILER2GetStatCoefficients);
			if (((Artifact)this).IsActiveAndEnabled())
			{
				foreach (CharacterMaster item in MiscUtil.AliveList(false))
				{
					if (item.hasBody)
					{
						AddWard(item.GetBody());
					}
				}
			}
			CharacterMaster.OnBodyStart += new hook_OnBodyStart(On_CMOnBodyStart);
		}

		public override void Uninstall()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			((Artifact)this).Uninstall();
			CharacterMaster.OnBodyStart -= new hook_OnBodyStart(On_CMOnBodyStart);
			foreach (TacticsWard instance in TacticsWard.instances)
			{
				Object.Destroy((Object)(object)((Component)instance).gameObject);
			}
			RecalculateStatsAPI.GetStatCoefficients -= new StatHookEventHandler(Evt_TILER2GetStatCoefficients);
		}

		private void Evt_TILER2GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender))
			{
				int num = Mathf.Max(sender.GetBuffCount(tacticsBuff) - 1, 0);
				args.moveSpeedMultAdd += (float)num * speedMod;
				args.baseDamageAdd += (float)num * damageMod;
				args.armorAdd += (float)num * armorMod;
			}
		}

		private void On_CMOnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
		{
			orig.Invoke(self, body);
			if (NetworkServer.active && ((Artifact)this).IsActiveAndEnabled())
			{
				AddWard(body);
			}
		}

		private void AddWard(CharacterBody body)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)body))
			{
				TacticsWard componentInChildren = ((Component)body).GetComponentInChildren<TacticsWard>();
				if (!Object.op_Implicit((Object)(object)componentInChildren) || !Object.op_Implicit((Object)(object)((Component)componentInChildren).gameObject))
				{
					GameObject obj = Object.Instantiate<GameObject>(tacticsWardPrefab);
					obj.GetComponent<TeamFilter>().teamIndex = body.teamComponent.teamIndex;
					obj.GetComponent<NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(((Component)body).gameObject, (string)null);
				}
			}
		}
	}
	internal class TacticsWard : MonoBehaviour
	{
		internal static List<TacticsWard> instances = new List<TacticsWard>();

		private void Awake()
		{
			instances.Add(this);
		}

		private void OnDestroy()
		{
			instances.Remove(this);
		}
	}
	public class BulwarkDrone : T2Module<BulwarkDrone>
	{
		public GameObject bulwarkDroneInteractablePrefab { get; private set; }

		public GameObject bulwarkDroneBodyPrefab { get; private set; }

		public GameObject bulwarkDroneMasterPrefab { get; private set; }

		public InteractableSpawnCard bulwarkDroneSpawnCard { get; private set; }

		public DirectorCard bulwarkDroneDirectorCard { get; private set; }

		public DirectorCardHolder bulwarkDroneDCH { get; private set; }

		internal CommonCode.ConditionalDirectorCardHolder bulwarkDroneCDCH { get; private set; }

		public override void SetupAttributes()
		{
			((T2Module)this).SetupAttributes();
			bulwarkDroneBodyPrefab = TinkersSatchelPlugin.resources.LoadAsset<GameObject>("Assets/TinkersSatchel/Prefabs/Characters/BulwarkDrone/BulwarkDroneBody.prefab");
			ModifyBodyPrefabWithVanillaAssets();
			bulwarkDroneMasterPrefab = TinkersSatchelPlugin.resources.LoadAsset<GameObject>("Assets/TinkersSatchel/Prefabs/Characters/BulwarkDrone/BulwarkDroneMaster.prefab");
			bulwarkDroneInteractablePrefab = TinkersSatchelPlugin.resources.LoadAsset<GameObject>("Assets/TinkersSatchel/Prefabs/Characters/BulwarkDrone/BulwarkDroneBroken.prefab");
			ModifyInteractablePrefabWithVanillaAssets();
			SetupSpawnCard();
			ContentAddition.AddBody(bulwarkDroneBodyPrefab);
			ContentAddition.AddMaster(bulwarkDroneMasterPrefab);
			ContentAddition.AddNetworkedObject(bulwarkDroneInteractablePrefab);
		}

		public override void SetupBehavior()
		{
			((T2Module)this).SetupBehavior();
		}

		public override void SetupConfig()
		{
			((T2Module)this).SetupConfig();
		}

		public override void Install()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((T2Module)this).Install();
			DeathState.OnImpactServer += new hook_OnImpactServer(DeathState_OnImpactServer);
			CommonCode.dchList.Add(bulwarkDroneCDCH);
			if (Object.op_Implicit((Object)(object)ClassicStageInfo.instance))
			{
				Helpers.TryApplyChangesNow();
			}
		}

		public override void Uninstall()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((T2Module)this).Uninstall();
			DeathState.OnImpactServer -= new hook_OnImpactServer(DeathState_OnImpactServer);
			CommonCode.dchList.Remove(bulwarkDroneCDCH);
			if (Object.op_Implicit((Object)(object)ClassicStageInfo.instance))
			{
				Helpers.TryApplyChangesNow();
			}
		}

		private void ModifyBodyPrefabWithVanillaAssets()
		{
			//IL_0026: 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_0049: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_018c: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: 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_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/EquipmentDroneBody"), "TkSatTempSetupPrefab2", false);
			bulwarkDroneBodyPrefab.GetComponent<CameraTargetParams>().cameraParams = Addressables.LoadAssetAsync<CharacterCameraParams>((object)"RoR2/Base/Common/ccpStandard.asset").WaitForCompletion();
			((Collider)bulwarkDroneBodyPrefab.GetComponent<BoxCollider>()).material = Addressables.LoadAssetAsync<PhysicMaterial>((object)"RoR2/Base/Common/physmatItems.physicMaterial").WaitForCompletion();
			AkEvent[] components = val.GetComponents<AkEvent>();
			foreach (AkEvent val2 in components)
			{
				AkEvent obj = bulwarkDroneBodyPrefab.AddComponent<AkEvent>();
				((AkTriggerHandler)obj).triggerList = ((AkTriggerHandler)val2).triggerList.ToArray().ToList();
				((AkTriggerHandler)obj).useOtherObject = ((AkTriggerHandler)val2).useOtherObject;
				obj.actionOnEventType = val2.actionOnEventType;
				obj.curveInterpolation = val2.curveInterpolation;
				obj.enableActionOnEvent = val2.enableActionOnEvent;
				obj.data = val2.data;
				obj.useCallbacks = val2.useCallbacks;
				obj.Callbacks = val2.Callbacks.ToArray().ToList();
				obj.playingId = val2.playingId;
				obj.soundEmitterObject = bulwarkDroneBodyPrefab;
				obj.transitionDuration = val2.transitionDuration;
			}
			Material val3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/TrimSheets/matTrimSheetConstructionBlue.mat").WaitForCompletion();
			CharacterModel component = ((Component)bulwarkDroneBodyPrefab.transform.Find("Model Base/BulwarkDrone")).GetComponent<CharacterModel>();
			component.itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/DroneWeapons/DroneWeaponsDisplay1.asset").WaitForCompletion(), new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponLauncher.prefab").WaitForCompletion(),
						childName = "BulwarkDroneModel",
						localPos = new Vector3(0f, 0.78087f, 0.72665f),
						localAngles = new Vector3(356.5202f, 0f, 0f),
						localScale = new Vector3(1f, 1f, 1f)
					},
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponRobotArm.prefab").WaitForCompletion(),
						childName = "BulwarkDroneModel",
						localPos = new Vector3(0.48613f, 0f, 0.41692f),
						localAngles = new Vector3(82.44529f, 86.80688f, 0.00014f),
						localScale = new Vector3(1.5f, 1.5f, 1.5f)
					}
				}
			});
			component.itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/DroneWeapons/DroneWeaponsDisplay2.asset").WaitForCompletion(), new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponMinigun.prefab").WaitForCompletion(),
						childName = "BulwarkDroneModel",
						localPos = new Vector3(0f, 0.37601f, 0f),
						localAngles = new Vector3(-1E-05f, 180f, 180f),
						localScale = new Vector3(1f, 1f, 1f)
					},
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponLauncher.prefab").WaitForCompletion(),
						childName = "BulwarkDroneModel",
						localPos = new Vector3(0f, 0.78087f, 0.72665f),
						localAngles = new Vector3(356.5202f, 0f, 0f),
						localScale = new Vector3(1f, 1f, 1f)
					}
				}
			});
			component.baseRendererInfos[0].defaultMaterial = val3;
			component.baseRendererInfos[0].renderer.material = val3;
			Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matOpaqueDustLargeDirectional.mat").WaitForCompletion();
			((Renderer)((Component)bulwarkDroneBodyPrefab.transform.Find("Model Base/BulwarkDrone/ThrusterExhaust")).GetComponent<ParticleSystemRenderer>()).material = material;
			Object.Destroy((Object)(object)val);
		}

		private void ModifyInteractablePrefabWithVanillaAssets()
		{
			//IL_0005: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Drones/matDroneBrokenGeneric.mat").WaitForCompletion();
			((Renderer)((Component)bulwarkDroneInteractablePrefab.transform.Find("Model Base/BulwarkDrone")).GetComponent<MeshRenderer>()).material = material;
			Sprite visual = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texDroneIconOutlined.png").WaitForCompletion();
			bulwarkDroneInteractablePrefab.GetComponent<GenericInspectInfoProvider>().InspectInfo.Info.Visual = visual;
		}

		private void SetupSpawnCard()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0035: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0049: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			bulwarkDroneSpawnCard = TinkersSatchelPlugin.resources.LoadAsset<InteractableSpawnCard>("Assets/TinkersSatchel/Prefabs/Characters/BulwarkDrone/iscTkSatBulwarkDrone.asset");
			bulwarkDroneDirectorCard = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)bulwarkDroneSpawnCard,
				minimumStageCompletions = 0,
				preventOverhead = false,
				selectionWeight = 2,
				spawnDistance = (MonsterSpawnDistance)0
			};
			bulwarkDroneDCH = new DirectorCardHolder
			{
				Card = bulwarkDroneDirectorCard,
				InteractableCategory = (InteractableCategory)5,
				MonsterCategory = (MonsterCategory)0
			};
			bulwarkDroneCDCH = new CommonCode.ConditionalDirectorCardHolder(bulwarkDroneDCH, CommonCode.expansionDef);
		}

		private void DeathState_OnImpactServer(orig_OnImpactServer orig, DeathState self, Vector3 contactPoint)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_005e: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Invalid comparison between Unknown and I4
			orig.Invoke(self, contactPoint);
			if (!Object.op_Implicit((Object)(object)((EntityState)self).characterBody) || !((Object)(object)BodyCatalog.GetBodyPrefab(((EntityState)self).characterBody.bodyIndex) == (Object)(object)bulwarkDroneBodyPrefab))
			{
				return;
			}
			GameObject val = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)bulwarkDroneSpawnCard, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)0,
				position = contactPoint
			}, ((T2Module)this).rng));
			if (Object.op_Implicit((Object)(object)val))
			{
				PurchaseInteraction component = val.GetComponent<PurchaseInteraction>();
				if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1)
				{
					component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost);
				}
			}
		}
	}
	[RequireComponent(typeof(TeamComponent), typeof(CharacterBody))]
	public class TauntNearbyBehaviour : MonoBehaviour
	{
		public float range = 100f;

		public float tauntChancePerTargetPerInterval = 0.25f;

		public float scanInterval = 5f;

		public HurtBox hurtbox;

		private TeamComponent teamcpt;

		private CharacterBody body;

		private float stopwatch;

		private void Awake()
		{
			teamcpt = ((Component)this).GetComponent<TeamComponent>();
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private void FixedUpdate()
		{
			if (!NetworkServer.active)
			{
				return;
			}
			stopwatch -= Time.fixedDeltaTime;
			if (!(stopwatch <= 0f))
			{
				return;
			}
			float rangeSq = range * range;
			stopwatch = scanInterval;
			IEnumerable<BaseAI> source = from x in CharacterBody.readOnlyInstancesList.Where(delegate(CharacterBody x)
				{
					//IL_0006: 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_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					//IL_0043: 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_0060: Unknown result type (might be due to invalid IL or missing references)
					//IL_0066: Invalid comparison between Unknown and I4
					Vector3 val = x.transform.position - ((Component)this).transform.position;
					return ((Vector3)(ref val)).sqrMagnitude < rangeSq && Object.op_Implicit((Object)(object)x.master) && x.teamComponent.teamIndex != teamcpt.teamIndex && (int)x.teamComponent.teamIndex > 0;
				})
				select ((Component)x.master).GetComponent<BaseAI>() into x
				where Object.op_Implicit((Object)(object)x)
				select x;
			int num = (Object.op_Implicit((Object)(object)body.master) ? Compat_Dronemeld.SafeGetStackCount(body.master.inventory) : 0);
			float num2 = 1f - Mathf.Pow(1f - tauntChancePerTargetPerInterval, (float)(num + 1));
			source = source.OrderBy((BaseAI t) => ((T2Module)T2Module<BulwarkDrone>.instance).rng.nextNormalizedFloat).Take(Mathf.RoundToInt((float)source.Count() * num2));
			foreach (BaseAI item in source)
			{
				TauntDebuffController.ApplyTaunt(item, body, scanInterval);
			}
		}
	}
	public class ItemDrone : T2Module<ItemDrone>
	{
		[AutoConfigRoOString(null, null)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public string itemNameBlacklist { get; private set; } = "ScrapWhite, ScrapGreen, ScrapRed, ScrapYellow, ScrapWhiteSuppressed, ScrapGreenSuppressed, ScrapRedSuppressed, RegeneratingScrap, RegeneratingScrapConsumed, ExtraLifeConsumed, ExtraLifeVoidConsumed, FragileDamageBonusConsumed, HealingPotionConsumed, BeetleGland, RoboBallBuddy, MinorConstructOnKill, TitanGoldDuringTP";


		[AutoConfigRoOString(null, null)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public string itemTierNameBlacklist { get; private set; } = "LunarTierDef, VoidTier1Def, VoidTier2Def, VoidTier3Def, VoidBossDef";


		[AutoConfigRoOCheckbox(null, null)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public bool dropItemsOnDeath { get; private set; } = true;


		[AutoConfigRoOCheckbox(null, null)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public bool forceNoCommand { get; private set; } = true;


		[AutoConfigRoOSlider("{0:N0} m", 10f, 1000f, null, null)]
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public float range { get; private set; } = 1000f;


		public GameObject itemDroneInteractablePrefab { get; private set; }

		public GameObject itemDroneBodyPrefab { get; private set; }

		public GameObject itemDroneMasterPrefab { get; private set; }

		public InteractableSpawnCard itemDroneSpawnCard { get; private set; }

		public DirectorCard itemDroneDirectorCard { get; private set; }

		public GameObject itemDronePanelPrefab { get; private set; }

		public DirectorCardHolder itemDroneDCH { get; private set; }

		public HashSet<ItemDef> blacklistedItems { get; private set; } = new HashSet<ItemDef>();


		internal CommonCode.ConditionalDirectorCardHolder itemDroneCDCH { get; private set; }

		public override void SetupAttributes()
		{
			((T2Module)this).SetupAttributes();
			LoadBodyPrefab();
			ModifyBodyPrefabWithVanillaAssets();
			itemDroneMasterPrefab = TinkersSatchelPlugin.resources.LoadAsset<GameObject>("Assets/TinkersSatchel/Prefabs/Characters/ItemDrone/ItemDroneMaster.prefab");
			CreatePanelPrefab();
			LoadInteractablePrefab();
			ModifyInteractablePrefabWithVanillaAssets();
			ContentAddition.AddBody(itemDroneBodyPrefab);
			ContentAddition.AddMaster(itemDroneMasterPrefab);
			ContentAddition.AddNetworkedObject(itemDroneInteractablePrefab);
			SetupSpawnCard();
			((ResourceAvailability)(ref ItemTierCatalog.availability)).CallWhenAvailable((Action)delegate
			{
				((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)SetupCatalogReady);
			});
		}

		public override void SetupBehavior()
		{
			((T2Module)this).SetupBehavior();
		}

		public override void SetupConfig()
		{
			((T2Module)this).SetupConfig();
			((AutoConfigContainer)this).ConfigEntryChanged += delegate(object nv, AutoConfigUpdateActionEventArgs args)
			{
				if (args.target.boundProperty.Name == "itemTierNameBlacklist" || args.target.boundProperty.Name == "itemNameBlacklist")
				{
					UpdateValidItems();
				}
			};
		}

		public void SetupCatalogReady()
		{
			UpdateValidItems();
		}

		public override void Install()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((T2Module)this).Install();
			CharacterBody.GetDisplayName += new hook_GetDisplayName(CharacterBody_GetDisplayName);
			CommonCode.dchList.Add(itemDroneCDCH);
			if (Object.op_Implicit((Object)(object)ClassicStageInfo.instance))
			{
				Helpers.TryApplyChangesNow();
			}
		}

		public override void Uninstall()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((T2Module)this).Uninstall();
			CharacterBody.GetDisplayName -= new hook_GetDisplayName(CharacterBody_GetDisplayName);
			CommonCode.dchList.Remove(itemDroneCDCH);
			if (Object.op_Implicit((Object)(object)ClassicStageInfo.instance))
			{
				Helpers.TryApplyChangesNow();
			}
		}

		private void UpdateValidItems()
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (!((ResourceAvailability)(ref ItemCatalog.availability)).available || !((ResourceAvailability)(ref ItemTierCatalog.availability)).available)
			{
				return;
			}
			IEnumerable<string> names = from x in itemNameBlacklist.Split(',')
				select x.Trim();
			IEnumerable<string> tierNames = from x in itemTierNameBlacklist.Split(',')
				select x.Trim();
			blacklistedItems.Clear();
			blacklistedItems.UnionWith(((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where(delegate(ItemDef idef)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				if (names.Contains(((Object)idef).name))
				{
					return true;
				}
				ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(idef.tier);
				return (Object.op_Implicit((Object)(object)itemTierDef) && tierNames.Contains(((Object)itemTierDef).name)) ? true : false;
			}));
			blacklistedItems.UnionWith(FakeInventory.blacklist);
		}

		private void LoadBodyPrefab()
		{
			itemDroneBodyPrefab = TinkersSatchelPlugin.resources.LoadAsset<GameObject>("Assets/TinkersSatchel/Prefabs/Characters/ItemDrone/ItemDroneBody.prefab");
		}

		private void ModifyBodyPrefabWithVanillaAssets()
		{
			//IL_0026: 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_0049: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//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_017e: 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_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/EquipmentDroneBody"), "TkSatTempSetupPrefab2", false);
			itemDroneBodyPrefab.GetComponent<CameraTargetParams>().cameraParams = Addressables.LoadAssetAsync<CharacterCameraParams>((object)"RoR2/Base/Common/ccpStandard.asset").WaitForCompletion();
			((Collider)itemDroneBodyPrefab.GetComponent<CapsuleCollider>()).material = Addressables.LoadAssetAsync<PhysicMaterial>((object)"RoR2/Base/Common/physmatItems.physicMaterial").WaitForCompletion();
			AkEvent[] components = val.GetComponents<AkEvent>();
			foreach (AkEvent val2 in components)
			{
				AkEvent obj = itemDroneBodyPrefab.AddComponent<AkEvent>();
				((AkTriggerHandler)obj).triggerList = ((AkTriggerHandler)val2).triggerList.ToArray().ToList();
				((AkTriggerHandler)obj).useOtherObject = ((AkTriggerHandler)val2).useOtherObject;
				obj.actionOnEventType = val2.actionOnEventType;
				obj.curveInterpolation = val2.curveInterpolation;
				obj.enableActionOnEvent = val2.enableActionOnEvent;
				obj.data = val2.data;
				obj.useCallbacks = val2.useCallbacks;
				obj.Callbacks = val2.Callbacks.ToArray().ToList();
				obj.playingId = val2.playingId;
				obj.soundEmitterObject = itemDroneBodyPrefab;
				obj.transitionDuration = val2.transitionDuration;
			}
			Material val3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/TrimSheets/matTrimSheetConstructionBlue.mat").WaitForCompletion();
			Material val4 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Drones/matDroneBrokenGeneric.mat").WaitForCompletion();
			CharacterModel component = ((Component)itemDroneBodyPrefab.transform.Find("Model Base/ItemDroneArmature")).GetComponent<CharacterModel>();
			component.itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/DroneWeapons/DroneWeaponsDisplay1.asset").WaitForCompletion(), new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponLauncher.prefab").WaitForCompletion(),
						childName = "ItemDrone",
						localPos = new Vector3(-0.22377f, 0.42059f, 0.29719f),
						localAngles = new Vector3(342.3488f, 335.3234f, 0.31212f),
						localScale = new Vector3(0.75f, 0.75f, 0.75f)
					},
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponRobotArm.prefab").WaitForCompletion(),
						childName = "ItemDrone",
						localPos = new Vector3(0.85892f, -0.34884f, 0f),
						localAngles = new Vector3(49.09578f, 44.96024f, 293.9472f),
						localScale = new Vector3(1.5f, 1.5f, 1.5f)
					}
				}
			});
			component.itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/DroneWeapons/DroneWeaponsDisplay2.asset").WaitForCompletion(), new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponMinigun.prefab").WaitForCompletion(),
						childName = "ItemDrone",
						localPos = new Vector3(-1.53903f, 0.13204f, -0.02679f),
						localAngles = new Vector3(0f, 140.274f, 0f),
						localScale = new Vector3(1f, 1f, 1f)
					},
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/DroneWeapons/DisplayDroneWeaponLauncher.prefab").WaitForCompletion(),
						childName = "ItemDrone",
						localPos = new Vector3(-0.22377f, 0.42059f, 0.29719f),
						localAngles = new Vector3(342.3488f, 335.3234f, 0.31212f),
						localScale = new Vector3(0.75f, 0.75f, 0.75f)
					}
				}
			});
			component.baseRendererInfos[0].defaultMaterial = val3;
			component.baseRendererInfos[0].renderer.material = val3;
			for (int j = 1; j <= 3; j++)
			{
				component.baseRendererInfos[j].defaultMaterial = val4;
				component.baseRendererInfos[j].renderer.material = val4;
			}
			Object.Destroy((Object)(object)val);
			MeshRenderer component2 = ((Component)itemDroneBodyPrefab.transform.Find("WardRangeScale/WardRangeInd")).gameObject.GetComponent<MeshRenderer>();
			((Renderer)component2).material = ((Renderer)((Component)ItemWard.stockIndicatorPrefab.transform.Find("IndicatorSphere")).gameObject.GetComponent<MeshRenderer>()).material;
			((Renderer)component2).material.SetTexture("_RemapTex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampDefault.png").WaitForCompletion());
			((Renderer)component2).material.SetFloat("_AlphaBoost", 0.475f);
			((Renderer)component2).material.SetColor("_CutoffScroll", new Color(0.8f, 0.8f, 0.85f));
			((Renderer)component2).material.SetColor("_RimColor", new Color(0.8f, 0.8f, 0.85f));
		}

		private void CreatePanelPrefab()
		{
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/UI/ScrapperPickerPanel"), "TkSatTempSetupPrefab", false);
			((TMP_Text)((Component)val.transform.Find("MainPanel/Juice/Label")).GetComponent<HGTextMeshProUGUI>()).text = "<b>Item Drone</b>\r\n<i>Pick an item to insert...</i>";
			((Component)val.transform.Find("MainPanel/Juice/Label")).GetComponent<LanguageTextMeshController>().token = "TKSAT_ITEMDRONE_POPUP_TEXT";
			itemDronePanelPrefab = PrefabAPI.InstantiateClone(val, "TkSatItemDronePanel", false);
			Object.Destroy((Object)(object)val);
		}

		private void LoadInteractablePrefab()
		{
			itemDroneInteractablePrefab = TinkersSatchelPlugin.resources.LoadAsset<GameObject>("Assets/TinkersSatchel/Prefabs/Characters/ItemDrone/ItemDroneBroken.prefab");
			PickupPickerController component = itemDroneInteractablePrefab.GetComponent<PickupPickerController>();
			component.available = true;
			component.panelPrefab = itemDronePanelPrefab;
		}

		private void ModifyInteractablePrefabWithVanillaAssets()
		{
			//IL_0005: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Drones/matDroneBrokenGeneric.mat").WaitForCompletion();
			((Renderer)((Component)itemDroneInteractablePrefab.transform.Find("Model Base/mdlItemDrone/Root/ItemDrone")).GetComponent<MeshRenderer>()).material = material;
			((Renderer)((Component)itemDroneInteractablePrefab.transform.Find("Model Base/mdlItemDrone/Root/Prop1/Prop1 1")).GetComponent<MeshRenderer>()).material = material;
			((Renderer)((Component)itemDroneInteractablePrefab.transform.Find("Model Base/mdlItemDrone/Root/Prop2/Prop2 1")).GetComponent<MeshRenderer>()).material = material;
			((Renderer)((Component)itemDroneInteractablePrefab.transform.Find("Model Base/mdlItemDrone/Root/Prop3/Prop3 1")).GetComponent<MeshRenderer>()).material = material;
			Sprite visual = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texDroneIconOutlined.png").WaitForCompletion();
			itemDroneInteractablePrefab.GetComponent<GenericInspectInfoProvider>().InspectInfo.Info.Visual = visual;
		}

		private void SetupSpawnCard()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0035: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0049: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			itemDroneSpawnCard = TinkersSatchelPlugin.resources.LoadAsset<InteractableSpawnCard>("Assets/TinkersSatchel/Prefabs/Characters/ItemDrone/iscTkSatItemDrone.asset");
			itemDroneDirectorCard = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)itemDroneSpawnCard,
				minimumStageCompletions = 0,
				preventOverhead = false,
				selectionWeight = 2,
				spawnDistance = (MonsterSpawnDistance)0
			};
			itemDroneDCH = new DirectorCardHolder
			{
				Card = itemDroneDirectorCard,
				InteractableCategory = (InteractableCategory)5,
				MonsterCategory = (MonsterCategory)0
			};
			itemDroneCDCH = new CommonCode.ConditionalDirectorCardHolder(itemDroneDCH, CommonCode.expansionDef);
		}

		private string CharacterBody_GetDisplayName(orig_GetDisplayName orig, CharacterBody self)
		{
			//IL_0156: 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_018b: Unknown result type (might be due to invalid IL or missing references)
			string text = orig.Invoke(self);
			if (((Object)self).name == "ItemDroneBody(Clone)")
			{
				ItemWard component = ((Component)self).GetComponent<ItemWard>();
				if (!Object.op_Implicit((Object)(object)component) || component.itemcounts.Count == 0)
				{
					return text;
				}
				if (component.itemcounts.Count > 1)
				{
					IEnumerable<string> values = from kvp in component.itemcounts
						select (ItemCatalog.GetItemDef(kvp.Key), kvp.Value) into tDbC
						where (Object)(object)tDbC.itemDef != (Object)null
						group tDbC by tDbC.itemDef.tier into tDbC_gTier
						select (tDbC_gTier.Key, tDbC_gTier.Sum(((ItemDef itemDef, int count) tDbC) => tDbC.count)) into tTbC
						where tTbC.count > 0
						select $"<color=#{ColorCatalog.GetColorHexString(ItemTierCatalog.GetItemTierDef(tTbC.itemTier).colorIndex)}>{tTbC.count}</color>";
					return text + " (" + string.Join(", ", values) + ")";
				}
				ItemDef itemDef = ItemCatalog.GetItemDef(component.itemcounts.First().Key);
				if ((Object)(object)itemDef == (Object)null)
				{
					return text;
				}
				string text2 = "FFFFFF";
				ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier);
				if (Object.op_Implicit((Object)(object)itemTierDef))
				{
					text2 = ColorCatalog.GetColorHexString(itemTierDef.colorIndex);
				}
				return text + " (<color=#" + text2 + ">" + Language.GetString(itemDef.nameToken) + "</color>)";
			}
			return text;
		}
	}
	public class ItemDronePurchaseController : NetworkBehaviour
	{
		private Interactor currentInteractor;

		public void SetInteractor(Interactor interactor)
		{
			currentInteractor = interactor;
		}

		public void HandlePurchase(int pind)
		{
			//IL_0016: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Invalid comparison between Unknown and I4
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Invalid comparison between Unknown and I4
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Invalid comparison between Unknown and I4
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Invalid comparison between Unknown and I4
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected I4, but got Unknown
			//IL_0189: Expected O, but got Unknown
			ItemDef val = default(ItemDef);
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)currentInteractor) || !CatalogUtil.TryGetItemDef(new PickupIndex(pind), ref val))
			{
				return;
			}
			CharacterBody component = ((Component)currentInteractor).GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory))
			{
				return;
			}
			int itemCount = component.inventory.GetItemCount(val.itemIndex);
			if (itemCount <= 0)
			{
				return;
			}
			ItemTier tier = val.tier;
			if ((int)tier <= 1)
			{
				if ((int)tier == 0)
				{
					goto IL_0082;
				}
				if ((int)tier == 1)
				{
					goto IL_0087;
				}
			}
			else
			{
				if ((int)tier == 6)
				{
					goto IL_0082;
				}
				if ((int)tier == 7)
				{
					goto IL_0087;
				}
			}
			int num = 1;
			goto IL_008f;
			IL_008f:
			int num2 = num;
			num2 = Mathf.Min(itemCount, num2);
			CharacterMaster val2;
			GameObject bodyObject;
			if (Compat_Dronemeld.enabled && (Object)(object)(val2 = Compat_Dronemeld.TryApply(component.master, "ItemDroneMaster")) != (Object)null)
			{
				ItemDroneWardPersist component2 = ((Component)val2).GetComponent<ItemDroneWardPersist>();
				if (!Object.op_Implicit((Object)(object)component2))
				{
					return;
				}
				component2.AddItems(val.itemIndex, num2);
				bodyObject = val2.GetBodyObject();
			}
			else
			{
				SummonMasterBehavior component3 = ((Component)this).GetComponent<SummonMasterBehavior>();
				CharacterMaster val3 = component3.OpenSummonReturnMaster(currentInteractor);
				ItemDroneWardPersist component4 = ((Component)val3).GetComponent<ItemDroneWardPersist>();
				if (!Object.op_Implicit((Object)(object)component3) || !Object.op_Implicit((Object)(object)component4))
				{
					return;
				}
				component.inventory.RemoveItem(val.itemIndex, num2);
				component4.AddItems(val.itemIndex, num2);
				bodyObject = val3.GetBodyObject();
			}
			if (Object.op_Implicit((Object)(object)bodyObject))
			{
				for (int i = 0; i < num2; i++)
				{
					EffectData val4 = new EffectData
					{
						origin = component.corePosition,
						genericFloat = Mathf.Lerp(1.5f, 2.5f, (float)i / (float)num2),
						genericUInt = (uint)(val.itemIndex + 1)
					};
					val4.SetNetworkedObjectReference(bodyObject);
					EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OrbEffects/ItemTakenOrbEffect"), val4, true);
				}
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
			IL_0082:
			num = 5;
			goto IL_008f;
			IL_0087:
			num = 3;
			goto IL_008f;
		}
	}
	[RequireComponent(typeof(CharacterBody))]
	public class ItemDroneDropOnDeath : MonoBehaviour, IOnKilledServerReceiver
	{
		private CharacterBody body;

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		public void OnKilledServer(DamageReport damageReport)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (!T2Module<ItemDrone>.instance.dropItemsOnDeath || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || !body.master.IsDeadAndOutOfLivesServer())
			{
				return;
			}
			ItemDroneWardPersist component = ((Component)body.master).GetComponent<ItemDroneWardPersist>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			int num = component.stacks.Sum();
			if (num <= 0)
			{
				return;
			}
			float num2 = 360f / (float)num;
			float num3 = 0f;
			for (int i = 0; i < component.stacks.Length; i++)
			{
				for (int j = 0; j < component.stacks[i]; j++)
				{
					Vector3 val = Quaternion.AngleAxis((float)i * num3, Vector3.up) * new Vector3(5f, 5f);
					PickupIndex val2 = PickupCatalog.FindPickupIndex((ItemIndex)i);
					if (T2Module<ItemDrone>.instance.forceNoCommand)
					{
						CreatePickupInfo val3 = default(CreatePickupInfo);
						val3.rotation = Quaternion.identity;
						val3.position = ((Component)this).transform.position + val / 2f;
						((CreatePickupInfo)(ref val3)).pickupIndex = val2;
						GenericPickupController.CreatePickup(ref val3);
					}
					else
					{
						PickupDropletController.CreatePickupDroplet(val2, ((Component)this).transform.position, val);
					}
					num3 += num2;
				}
			}
			Object.Destroy((Object)(object)this);
		}
	}
	[RequireComponent(typeof(CharacterMaster))]
	public class ItemDroneWardPersist : MonoBehaviour
	{
		[Obsolete("Replaced by stacks and AddItems.")]
		public ItemIndex index;

		[Obsolete("Replaced by stacks and AddItems.")]
		public int count;

		private CharacterMaster master;

		public int[] stacks { get; private set; }

		private void Awake()
		{
			master = ((Component)this).GetComponent<CharacterMaster>();
			stacks = ItemCatalog.RequestItemStackArray();
			if (Object.op_Implicit((Object)(object)master))
			{
				master.onBodyStart += Master_onBodyStart;
			}
		}

		private void OnDestroy()
		{
			ItemCatalog.ReturnItemStackArray(stacks);
			stacks = null;
			if (Object.op_Implicit((Object)(object)master))
			{
				master.onBodyStart -= Master_onBodyStart;
			}
		}

		private void Master_onBodyStart(CharacterBody obj)
		{
			GameObject bodyObject = master.GetBodyObject();
			if (!Object.op_Implicit((Object)(object)bodyObject))
			{
				return;
			}
			ItemWard component = bodyObject.GetComponent<ItemWard>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (component.radius != T2Module<ItemDrone>.instance.range)
				{
					component.radius = T2Module<ItemDrone>.instance.range;
					component.displayRadiusFracH = 0.005f * (100f / component.radius);
				}
				for (int i = 0; i < stacks.Length; i++)
				{
					CheckItemCount((ItemIndex)i);
				}
			}
		}

		public void AddItems(ItemIndex ind, int count)
		{
			//IL_0006: 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)
			stacks[ind] += count;
			CheckItemCount(ind);
		}

		private void CheckItemCount(ItemIndex ind)
		{
			//IL_0025: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (!master.hasBody)
			{
				return;
			}
			ItemWard component = master.GetBodyObject().GetComponent<ItemWard>();
			component.itemcounts.TryGetValue(ind, out var value);
			int num = stacks[ind];
			int num2 = Mathf.Abs(value - num);
			if (value < num)
			{
				for (int i = 0; i < num2; i++)
				{
					component.ServerAddItem(ind);
				}
			}
			else if (value > num)
			{
				for (int j = 0; j < num2; j++)
				{
					component.ServerRemoveItem(ind);
				}
			}
		}
	}
	[RequireComponent(typeof(PickupPickerController))]
	public class PickupPickerControllerFilteredSelector : MonoBehaviour
	{
		[Obsolete]
		public HashSet<ItemDef> blacklistedItems = new HashSet<ItemDef>();

		private PickupPickerController ppc;

		private void Awake()
		{
			ppc = ((Component)this).GetComponent<PickupPickerController>();
		}

		public void SetOptionsFromInteractor(Interactor activator)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Invalid comparison between Unknown and I4
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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)
			if (!Object.op_Implicit((Object)(object)activator))
			{
				return;
			}
			CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory))
			{
				return;
			}
			List<Option> list = new List<Option>();
			for (int i = 0; i < component.inventory.itemAcquisitionOrder.Count; i++)
			{
				ItemIndex val = component.inventory.itemAcquisitionOrder[i];
				ItemDef itemDef = ItemCatalog.GetItemDef(val);
				PickupIndex val2 = PickupCatalog.FindPickupIndex(val);
				if (Object.op_Implicit((Object)(object)itemDef) && val2 != PickupIndex.none && itemDef.canRemove && !itemDef.hidden && (int)itemDef.tier != 5 && !T2Module<ItemDrone>.instance.blacklistedItems.Contains(itemDef))
				{
					list.Add(new Option
					{
						available = true,
						pickupIndex = val2
					});
				}
			}
			ppc.SetOptionsServer(list.ToArray());
		}
	}
	public class CommonCode : T2Module<CommonCode>
	{
		internal class ConditionalDirectorCardHolder
		{
			public DirectorCardHolder directorCardHolder;

			public ExpansionDef[] requiredExpansions;

			public ConditionalDirectorCardHolder(DirectorCardHolder dch, params ExpansionDef[] exps)
			{
				directorCardHolder = dch;
				requiredExpansions = exps;
			}
		}

		public static ExpansionDef expansionDef;

		public static ExpansionDef voidExpansionDef;

		public static DirectorCardCategorySelection globalInteractablesDccs;

		private static GameObject _worldSpaceWeaponDummy = null;

		internal static HashSet<ConditionalDirectorCardHolder> dchList = new HashSet<ConditionalDirectorCardHolder>();

		public override bool managedEnable => false;

		[Obsolete("Replaced by TimedSkillDisableModule.disabledSkillDef.")]
		public static SkillDef disabledSkillDef => TimedSkillDisableModule.disabledSkillDef;

		[Obsolete("Replaced by TauntDebuffModule.tauntDebuff.")]
		public static BuffDef tauntDebuff => TauntDebuffModule.tauntDebuff;

		public static GameObject worldSpaceWeaponDummy
		{
			get
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)_worldSpaceWeaponDummy))
				{
					_worldSpaceWeaponDummy = new GameObject("Workaround for an Inconvenient Quirk of BulletAttack");
				}
				return _worldSpaceWeaponDummy;
			}
		}

		private void _SetupExpansions()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			expansionDef = TinkersSatchelPlugin.resources.LoadAsset<ExpansionDef>("Assets/TinkersSatchel/TinkersSatchelExpansion.asset");
			voidExpansionDef = TinkersSatchelPlugin.resources.LoadAsset<ExpansionDef>("Assets/TinkersSatchel/TinkersSatchelVoidExpansion.asset");
			Sprite disabledIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texUnlockIcon.png").WaitForCompletion();
			expansionDef.disabledIconSprite = disabledIconSprite;
			voidExpansionDef.disabledIconSprite = disabledIconSprite;
			voidExpansionDef.requiredEntitlement = Addressables.LoadAssetAsync<EntitlementDef>((object)"RoR2/DLC1/Common/entitlementDLC1.asset").WaitForCompletion();
			ContentAddition.AddExpansionDef(expansionDef);
			ContentAddition.AddExpansionDef(voidExpansionDef);
		}

		private void _SetupInteractablesCategory()
		{
			globalInteractablesDccs = TinkersSatchelPlugin.resources.LoadAsset<DirectorCardCategorySelection>("Assets/TinkersSatchel/dccsTkSatGlobalInteractables.asset");
			DirectorAPI.InteractableActions += DirectorAPI_InteractableActions;
		}

		private void DirectorAPI_InteractableActions(DccsPool arg1, StageInfo arg2)
		{
			IEnumerable<ConditionalDirectorCardHolder> enumerable = dchList.Where((ConditionalDirectorCardHolder dch) => dch.requiredExpansions.All((ExpansionDef ed) => Run.instance.IsExpansionEnabled(ed)));
			Category[] poolCategories = arg1.poolCategories;
			foreach (Category val in poolCategories)
			{
				PoolEntry[] alwaysIncluded = val.alwaysIncluded;
				foreach (PoolEntry val2 in alwaysIncluded)
				{
					foreach (ConditionalDirectorCardHolder item in enumerable)
					{
						DirectorAPI.AddCard(val2.dccs, item.directorCardHolder);
					}
				}
				ConditionalPoolEntry[] includedIfConditionsMet = val.includedIfConditionsMet;
				foreach (ConditionalPoolEntry val3 in includedIfConditionsMet)
				{
					foreach (ConditionalDirectorCardHolder item2 in enumerable)
					{
						DirectorAPI.AddCard(((PoolEntry)val3).dccs, item2.directorCardHolder);
					}
				}
				alwaysIncluded = val.includedIfNoConditionsMet;
				foreach (PoolEntry val4 in alwaysIncluded)
				{
					foreach (ConditionalDirectorCardHolder item3 in enumerable)
					{
						DirectorAPI.AddCard(val4.dccs, item3.directorCardHolder);
					}
				}
			}
		}

		public override void SetupAttributes()
		{
			((T2Module)this).SetupAttributes();
			_SetupExpansions();
			_SetupInteractablesCategory();
		}

		public override void SetupBehavior()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((T2Module)this).SetupBehavior();
			BulletAttack.FireSingle += new hook_FireSingle(BulletAttack_FireSingle);
		}

		private void BulletAttack_FireSingle(orig_FireSingle orig, BulletAttack self, Vector3 normal, int muzzleIndex)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)self.weapon == (Object)(object)worldSpaceWeaponDummy)
			{
				self.weapon = null;
			}
			orig.Invoke(self, normal, muzzleIndex);
		}

		internal static void RetrieveDefaultMaterials(ItemDisplay disp)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < disp.rendererInfos.Length; i++)
			{
				RendererInfo val = disp.rendererInfos[i];
				val.defaultMaterial = val.renderer.material;
				disp.rendererInfos[i] = val;
			}
		}

		internal static GameObject FindNearestInteractable(GameObject senderObj, HashSet<string> validObjectNames, Ray aim, float maxAngle, float maxDistance, bool requireLoS)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_000d: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c4: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			aim = CameraRigController.ModifyAimRayIfApplicable(aim, senderObj, ref num);
			Collider[] array = Physics.OverlapSphere(((Ray)(ref aim)).origin, maxDistance + num, -1, (QueryTriggerInteraction)2);
			float num2 = Mathf.Cos(Mathf.Clamp(maxAngle, 0f, 180f) * MathF.PI / 180f);
			GameObject result = null;
			float num3 = float.MaxValue;
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Component)val).gameObject))
				{
					continue;
				}
				GameObject rootWithLocators = MiscUtil.GetRootWithLocators(((Component)val).gameObject, 5);
				if (!validObjectNames.Contains(((Object)rootWithLocators).name.Replace("(Clone)", "")))
				{
					continue;
				}
				Vector3 direction = ((Ray)(ref aim)).direction;
				Vector3 val2 = rootWithLocators.transform.position - ((Ray)(ref aim)).origin;
				float num4 = Vector3.Dot(direction, ((Vector3)(ref val2)).normalized);
				if (!(num4 < num2) && (!requireLoS || Physics.Linecast(((Ray)(ref aim)).origin, rootWithLocators.transform.position, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))))
				{
					float num5 = num4 * Vector3.Distance(rootWithLocators.transform.position, ((Ray)(ref aim)).origin);
					if (num5 < num3)
					{
						num3 = num5;
						result = rootWithLocators;
					}
				}
			}
			return result;
		}

		public static bool PickupIndexIsAISafe(PickupIndex pind)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			ItemDef val = default(ItemDef);
			if (CatalogUtil.TryGetItemDef(pind, ref val))
			{
				return !val.ContainsTag((ItemTag)4);
			}
			return false;
		}

		public static PickupIndex GenerateAISafePickup(Xoroshiro128Plus rng, List<PickupIndex> selection)
		{
			//IL_004f: 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)
			IEnumerable<PickupIndex> source = selection.Where((PickupIndex pind) => PickupIndexIsAISafe(pind));
			if (source.Count() == 0)
			{
				TinkersSatchelPlugin._logger.LogError((object)"GenerateAISafePickup (single uniform list): selection contained 0 valid items");
				return PickupIndex.none;
			}
			return rng.NextElementUniform<PickupIndex>(source.ToArray());
		}

		public static PickupIndex GenerateAISafePickup(Xoroshiro128Plus rng, WeightedSelection<List<PickupIndex>> selection)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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)
			WeightedSelection<PickupIndex> val = new WeightedSelection<PickupIndex>(8);
			ChoiceInfo<List<PickupIndex>>[] choices = selection.choices;
			for (int i = 0; i < choices.Length; i++)
			{
				ChoiceInfo<List<PickupIndex>> val2 = choices[i];
				foreach (PickupIndex item in val2.value)
				{
					if (PickupIndexIsAISafe(item))
					{
						val.AddChoice(item, val2.weight);
					}
				}
			}
			if (val.choices.Length == 0)
			{
				TinkersSatchelPlugin._logger.LogError((object)"GenerateAISafePickup (single selection): selection contained 0 valid items");
				return PickupIndex.none;
			}
			return val.Evaluate(rng.nextNormalizedFloat);
		}

		public static PickupIndex GenerateAISafePickup(Xoroshiro128Plus rng, PickupDropTable dropTable, WeightedSelection<List<PickupIndex>> fallback)
		{
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			WeightedSelection<PickupIndex> val = new WeightedSelection<PickupIndex>(8);
			BasicPickupDropTable val2 = (BasicPickupDropTable)(object)((dropTable is BasicPickupDropTable) ? dropTable : null);
			if (val2 != null)
			{
				foreach (ChoiceInfo<PickupIndex> item in val2.selector.choices.Where((ChoiceInfo<PickupIndex> c) => PickupIndexIsAISafe(c.value)))
				{
					val.AddChoice(item);
				}
			}
			else
			{
				ExplicitPickupDropTable val3 = (ExplicitPickupDropTable)(object)((dropTable is ExplicitPickupDropTable) ? dropTable : null);
				if (val3 != null)
				{
					foreach (ChoiceInfo<PickupIndex> item2 in val3.weightedSelection.choices.Where((ChoiceInfo<PickupIndex> c) => PickupIndexIsAISafe(c.value)))
					{
						val.AddChoice(item2);
					}
				}
			}
			if (val.choices.Length == 0)
			{
				ChoiceInfo<List<PickupIndex>>[] choices = fallback.choices;
				for (int i = 0; i < choices.Length; i++)
				{
					ChoiceInfo<List<PickupIndex>> val4 = choices[i];
					foreach (PickupIndex item3 in val4.value)
					{
						if (PickupIndexIsAISafe(item3))
						{
							val.AddChoice(item3, val4.weight);
						}
					}
				}
			}
			if (val.choices.Length == 0)
			{
				TinkersSatchelPlugin._logger.LogError((object)"GenerateAISafePickup (droptable and weighted fallback): both normal and fallback selections contained 0 valid items");
				return PickupIndex.none;
			}
			return val.Evaluate(rng.nextNormalizedFloat);
		}

		public static PickupIndex GenerateAISafePickup(Xoroshiro1