Decompiled source of TinkersSatchelKR v4.1.10

TinkersSatchel.dll

Decompiled 3 weeks 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 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 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.ClassicItems;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("TinkersSatchel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a930d7c8a05e72bc3b7ef092adde069485a31397")]
[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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			((Artifact)this).Install();
			HealthComponent.TakeDamage += new hook_TakeDamage(On_HCTakeDamage);
		}

		public override void Uninstall()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			((Artifact)this).Install();
			CharacterBody.RecalculateStats += new hook_RecalculateStats(On_CBRecalcStats);
		}

		public override void Uninstall()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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>
	{
		[AutoConfig(/*Could not decode attribute arguments.*/)]
		public bool preventCurseWhileOff { get; private set; } = false;


		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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			((Artifact)this).Install();
			CharacterBody.RecalculateStats += new Manipulator(IL_CBRecalcStats);
		}

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

		private void IL_CBRecalcStats(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			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.");
			}
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Mathf>(x, "Max"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "set_oneShotProtectionFraction")
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<float, CharacterBody, float>>((Func<float, CharacterBody, float>)((float origFrac, CharacterBody body) => preventCurseWhileOff ? body.oneShotProtectionFraction : origFrac));
			}
			else
			{
				TinkersSatchelPlugin._logger.LogError((object)"failed to apply IL patch (Artifact of Danger, set OHP fraction)! Artifact's PreventCurseWhileOff config will not work.");
			}
		}
	}
	public class DelayLoot : Artifact<DelayLoot>
	{
		public enum AnnounceItemsMode
		{
			Nothing,
			Vague,
			ItemTier,
			ItemName
		}

		public enum AnnounceDropMode
		{
			Nothing,
			TotalItemCount,
			ItemTierCounts
		}

		private bool shouldDeferDrops = true;

		private Vector3 lootShowerLoc = Vector3.zero;

		private float lootShowerTimer = 0f;

		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.ItemTierCounts;


		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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_0055: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Invalid comparison between Unknown and I4
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Invalid comparison between Unknown and I4
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Invalid comparison between Unknown and I4
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: 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)
			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.ItemTierCounts)
			{
				Dictionary<ItemTier, int> dictionary = new Dictionary<ItemTier, int>();
				int num2 = 0;
				int num3 = 0;
				int num4 = 0;
				PickupDropletController val2 = default(PickupDropletController);
				foreach (GameObject deferredDrop in deferredDrops)
				{
					if (Object.op_Implicit((Object)(object)deferredDrop) && deferredDrop.TryGetComponent<PickupDropletController>(ref val2))
					{
						PickupDef pickupDef = PickupCatalog.GetPickupDef(val2.pickupIndex);
						if (pickupDef != null)
						{
							if ((int)pickupDef.itemIndex != -1 && (int)pickupDef.itemTier != 5)
							{
								if (!dictionary.ContainsKey(pickupDef.itemTier))
								{
									dictionary[pickupDef.itemTier] = 0;
								}
								dictionary[pickupDef.itemTier]++;
							}
							else if ((int)pickupDef.equipmentIndex != -1)
							{
								if (pickupDef.isLunar)
								{
									num3++;
								}
								else
								{
									num2++;
								}
							}
							else
							{
								num4++;
							}
						}
						else
						{
							num4++;
						}
					}
					else
					{
						num4++;
					}
				}
				List<string> list2 = new List<string>();
				if (dictionary.ContainsKey((ItemTier)0))
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)1)}>{dictionary[(ItemTier)0]} tier-1 item{MiscUtil.NPlur((float)dictionary[(ItemTier)0], 0u)}</color>");
				}
				if (dictionary.ContainsKey((ItemTier)1))
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)2)}>{dictionary[(ItemTier)1]} tier-2 item{MiscUtil.NPlur((float)dictionary[(ItemTier)1], 0u)}</color>");
				}
				if (dictionary.ContainsKey((ItemTier)2))
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)3)}>{dictionary[(ItemTier)2]} tier-3 item{MiscUtil.NPlur((float)dictionary[(ItemTier)2], 0u)}</color>");
				}
				if (dictionary.ContainsKey((ItemTier)3))
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)4)}>{dictionary[(ItemTier)3]} lunar item{MiscUtil.NPlur((float)dictionary[(ItemTier)3], 0u)}</color>");
				}
				if (dictionary.ContainsKey((ItemTier)4))
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)13)}>{dictionary[(ItemTier)4]} boss item{MiscUtil.NPlur((float)dictionary[(ItemTier)4], 0u)}</color>");
				}
				if (num2 > 0)
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)5)}>{num2} equipment{MiscUtil.NPlur((float)num2, 0u)}</color>");
				}
				if (num3 > 0)
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)4)}>{num3} lunar equipment{MiscUtil.NPlur((float)num3, 0u)}</color>");
				}
				int num5 = 0;
				if (dictionary.ContainsKey((ItemTier)6))
				{
					num5 += dictionary[(ItemTier)6];
				}
				if (dictionary.ContainsKey((ItemTier)7))
				{
					num5 += dictionary[(ItemTier)7];
				}
				if (dictionary.ContainsKey((ItemTier)8))
				{
					num5 += dictionary[(ItemTier)8];
				}
				if (dictionary.ContainsKey((ItemTier)9))
				{
					num5 += dictionary[(ItemTier)9];
				}
				if (num5 > 0)
				{
					list2.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)25)}>{num5} void item{MiscUtil.NPlur((float)num5, 0u)}</color>");
				}
				if (num4 > 0)
				{
					list2.Add($"{num4} other drop{MiscUtil.NPlur((float)num4, 0u)}");
				}
				if (list2.Count != 0)
				{
					if (list2.Count == 1)
					{
						NetUtil.ServerSendGlobalChatMsg("The boss's hoard of " + list2[0] + " is yours.");
						return;
					}
					if (list2.Count == 2)
					{
						NetUtil.ServerSendGlobalChatMsg("The boss's hoard of " + string.Join(" and ", list2) + " is yours.");
						return;
					}
					list2[list2.Count - 1] = "and " + list2[list2.Count - 1];
					NetUtil.ServerSendGlobalChatMsg("The boss's hoard of " + string.Join(", ", list2) + " is yours.");
				}
			}
			else if (announceDrop == AnnounceDropMode.TotalItemCount && deferredDrops.Count > 0)
			{
				NetUtil.ServerSendGlobalChatMsg($"The boss's hoard of {deferredDrops.Count} drop{MiscUtil.NPlur((float)deferredDrops.Count, 0u)} is yours.");
			}
		}

		private void PickupDropletController_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Invalid comparison between Unknown and I4
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Invalid comparison between Unknown and I4
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Invalid comparison between Unknown and I4
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Invalid comparison between Unknown and I4
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Invalid comparison between Unknown and I4
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Invalid comparison between Unknown and I4
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Invalid comparison between Unknown and I4
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Invalid comparison between Unknown and I4
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Invalid comparison between Unknown and I4
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Invalid comparison between Unknown and I4
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			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 == AnnounceItemsMode.Nothing)
			{
				return;
			}
			string text = "Something";
			if (announceItems == AnnounceItemsMode.ItemName)
			{
				text = "<color=#" + Util.RGBToHex(Color32.op_Implicit(pickupDef.baseColor)) + ">" + Language.GetString(pickupDef.nameToken) + "</color>";
			}
			else if (announceItems == AnnounceItemsMode.ItemTier)
			{
				string text2 = "Something strange";
				if ((int)pickupDef.itemTier == 0)
				{
					text2 = "A tier-1 item";
				}
				if ((int)pickupDef.itemTier == 1)
				{
					text2 = "A tier-2 item";
				}
				if ((int)pickupDef.itemTier == 2)
				{
					text2 = "A tier-3 item";
				}
				if ((int)pickupDef.itemTier == 3)
				{
					text2 = "A lunar item";
				}
				if ((int)pickupDef.itemTier == 4)
				{
					text2 = "A boss item";
				}
				if ((int)pickupDef.itemTier == 6 || (int)pickupDef.itemTier == 7 || (int)pickupDef.itemTier == 8 || (int)pickupDef.itemTier == 9)
				{
					text2 = "A void item";
				}
				if ((int)pickupDef.equipmentIndex != -1)
				{
					text2 = (pickupDef.isLunar ? "A lunar equipment" : "An equipment");
				}
				text = "<color=#" + Util.RGBToHex(Color32.op_Implicit(pickupDef.baseColor)) + ">" + text2 + "</color>";
			}
			NetUtil.ServerSendGlobalChatMsg(text + " has been taken for safekeeping.");
		}
	}
	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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_0033: 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_0021: 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)
			bool flag = orig.Invoke(self, equipmentDef);
			if (flag && ((Artifact)this).IsActiveAndEnabled())
			{
				self.inventory.SetEquipment(new EquipmentState((EquipmentIndex)(-1), FixedTimeStamp.now, (byte)0), (uint)self.inventory.activeEquipmentSlot);
			}
			return flag;
		}
	}
	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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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 val2 = val.AddComponent<BuffWard>();
			val2.invertTeamFilter = false;
			val2.expires = false;
			val2.animateRadius = false;
			val2.radius = baseRadius;
			val2.rangeIndicator = null;
			val2.Networkradius = baseRadius;
			val2.buffDuration = 1f;
			val2.interval = 1f;
			val2.buffDef = tacticsBuff;
			tacticsWardPrefab = PrefabAPI.InstantiateClone(val, "TacticsAuraPrefab", true);
			Object.Destroy((Object)(object)val);
		}

		public override void Install()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_004d: 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 val = Object.Instantiate<GameObject>(tacticsWardPrefab);
					val.GetComponent<TeamFilter>().teamIndex = body.teamComponent.teamIndex;
					val.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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			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 val3 = bulwarkDroneBodyPrefab.AddComponent<AkEvent>();
				((AkTriggerHandler)val3).triggerList = ((AkTriggerHandler)val2).triggerList.ToArray().ToList();
				((AkTriggerHandler)val3).useOtherObject = ((AkTriggerHandler)val2).useOtherObject;
				val3.actionOnEventType = val2.actionOnEventType;
				val3.curveInterpolation = val2.curveInterpolation;
				val3.enableActionOnEvent = val2.enableActionOnEvent;
				val3.data = val2.data;
				val3.useCallbacks = val2.useCallbacks;
				val3.Callbacks = val2.Callbacks.ToArray().ToList();
				val3.playingId = val2.playingId;
				val3.soundEmitterObject = bulwarkDroneBodyPrefab;
				val3.transitionDuration = val2.transitionDuration;
			}
			Material val4 = 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 = val4;
			component.baseRendererInfos[0].renderer.material = val4;
			Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matOpaqueDustLargeDirectional.mat").WaitForCompletion();
			ParticleSystemRenderer component2 = ((Component)bulwarkDroneBodyPrefab.transform.Find("Model Base/BulwarkDrone/ThrusterExhaust")).GetComponent<ParticleSystemRenderer>();
			((Renderer)component2).material = material;
			Object.Destroy((Object)(object)val);
		}

		private void ModifyInteractablePrefabWithVanillaAssets()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Drones/matDroneBrokenGeneric.mat").WaitForCompletion();
			((Renderer)((Component)bulwarkDroneInteractablePrefab.transform.Find("Model Base/BulwarkDrone")).GetComponent<MeshRenderer>()).material = material;
		}

		private void SetupSpawnCard()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0037: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0070: 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 = 4,
				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_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0063: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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 = 0f;

		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 Object.FindObjectsOfType<CharacterBody>().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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_00be: 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(new char[1] { ',' })
				select x.Trim();
			IEnumerable<string> tierNames = from x in itemTierNameBlacklist.Split(new char[1] { ',' })
				select x.Trim();
			blacklistedItems.Clear();
			blacklistedItems.UnionWith(((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where(delegate(ItemDef idef)
			{
				//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: 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_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_050c: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: 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 val3 = itemDroneBodyPrefab.AddComponent<AkEvent>();
				((AkTriggerHandler)val3).triggerList = ((AkTriggerHandler)val2).triggerList.ToArray().ToList();
				((AkTriggerHandler)val3).useOtherObject = ((AkTriggerHandler)val2).useOtherObject;
				val3.actionOnEventType = val2.actionOnEventType;
				val3.curveInterpolation = val2.curveInterpolation;
				val3.enableActionOnEvent = val2.enableActionOnEvent;
				val3.data = val2.data;
				val3.useCallbacks = val2.useCallbacks;
				val3.Callbacks = val2.Callbacks.ToArray().ToList();
				val3.playingId = val2.playingId;
				val3.soundEmitterObject = itemDroneBodyPrefab;
				val3.transitionDuration = val2.transitionDuration;
			}
			Material val4 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/TrimSheets/matTrimSheetConstructionBlue.mat").WaitForCompletion();
			Material val5 = 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 = val4;
			component.baseRendererInfos[0].renderer.material = val4;
			for (int j = 1; j <= 3; j++)
			{
				component.baseRendererInfos[j].defaultMaterial = val5;
				component.baseRendererInfos[j].renderer.material = val5;
			}
			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);
			HGTextMeshProUGUI component = ((Component)val.transform.Find("MainPanel/Juice/Label")).GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component).text = "<b>Item Drone</b>\r\n<i>Pick an item to insert...</i>";
			LanguageTextMeshController component2 = ((Component)val.transform.Find("MainPanel/Juice/Label")).GetComponent<LanguageTextMeshController>();
			component2.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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			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;
		}

		private void SetupSpawnCard()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0037: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0070: 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 = 4,
				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_0178: 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_01bb: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Invalid comparison between Unknown and I4
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Invalid comparison between Unknown and I4
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Invalid comparison between Unknown and I4
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Invalid comparison between Unknown and I4
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected I4, but got Unknown
			//IL_01ff: 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 (1 == 0)
			{
			}
			if ((int)tier <= 1)
			{
				if ((int)tier == 0)
				{
					goto IL_00bf;
				}
				if ((int)tier == 1)
				{
					goto IL_00c4;
				}
			}
			else
			{
				if ((int)tier == 6)
				{
					goto IL_00bf;
				}
				if ((int)tier == 7)
				{
					goto IL_00c4;
				}
			}
			int num = 1;
			goto IL_00ce;
			IL_00c4:
			num = 3;
			goto IL_00ce;
			IL_00ce:
			if (1 == 0)
			{
			}
			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_00bf:
			num = 5;
			goto IL_00ce;
		}
	}
	[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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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; } = null;


		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_0007: 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)
			stacks[ind] += count;
			CheckItemCount(ind);
		}

		private void CheckItemCount(ItemIndex ind)
		{
			//IL_0031: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Invalid comparison between Unknown and I4
			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_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			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);
					}
				}
				PoolEntry[] includedIfNoConditionsMet = val.includedIfNoConditionsMet;
				foreach (PoolEntry val4 in includedIfNoConditionsMet)
				{
					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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_001e: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or miss