Decompiled source of StandaloneAncientScepter v1.1.33

AncientScepter.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter.ScepterSkillsMonster;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterUI;
using EntityStates;
using EntityStates.Bandit2.Weapon;
using EntityStates.Captain.Weapon;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Huntress;
using EntityStates.Huntress.Weapon;
using EntityStates.Loader;
using EntityStates.Mage;
using EntityStates.Mage.Weapon;
using EntityStates.Merc;
using EntityStates.Merc.Weapon;
using EntityStates.Railgunner.Backpack;
using EntityStates.Railgunner.Weapon;
using EntityStates.TitanMonster;
using EntityStates.Toolbot;
using EntityStates.Treebot.TreebotFlower;
using EntityStates.VoidSurvivor.CorruptMode;
using EntityStates.VoidSurvivor.Weapon;
using EntityStates.Vulture.Weapon;
using HG.Reflection;
using IL.EntityStates.Captain.Weapon;
using IL.EntityStates.Loader;
using IL.EntityStates.Mage.Weapon;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates;
using On.EntityStates.Bandit2.Weapon;
using On.EntityStates.Captain.Weapon;
using On.EntityStates.Commando.CommandoWeapon;
using On.EntityStates.Huntress;
using On.EntityStates.Huntress.Weapon;
using On.EntityStates.Loader;
using On.EntityStates.Mage;
using On.EntityStates.Merc;
using On.EntityStates.Railgunner.Backpack;
using On.EntityStates.Railgunner.Weapon;
using On.EntityStates.TitanMonster;
using On.EntityStates.Toolbot;
using On.EntityStates.Treebot.TreebotFlower;
using On.EntityStates.VoidSurvivor.CorruptMode;
using On.EntityStates.Vulture.Weapon;
using On.RoR2;
using On.RoR2.Orbs;
using On.RoR2.Projectile;
using On.RoR2.UI.MainMenu;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI.MainMenu;
using TILER2;
using ThinkInvisible.ClassicItems;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("AncientScepter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AncientScepter")]
[assembly: AssemblyTitle("AncientScepter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AncientScepter
{
	public abstract class ScepterSkill
	{
		public abstract SkillDef myDef { get; protected set; }

		public abstract string oldDescToken { get; protected set; }

		public abstract string newDescToken { get; protected set; }

		public abstract string overrideStr { get; }

		public abstract string targetBody { get; }

		public abstract SkillSlot targetSlot { get; }

		public abstract int targetVariantIndex { get; }

		internal abstract void SetupAttributes();

		internal virtual void LoadBehavior()
		{
		}

		internal virtual void UnloadBehavior()
		{
		}
	}
	public class AncientScepterItem : ItemBase<AncientScepterItem>
	{
		public enum StridesInteractionMode
		{
			HeresyTakesPrecedence,
			ScepterTakesPrecedence,
			ScepterRerolls
		}

		public enum RerollMode
		{
			Disabled,
			Random,
			Scrap
		}

		public enum UnusedMode
		{
			Keep,
			Reroll,
			Metamorphosis
		}

		private class ScepterReplacer
		{
			public string bodyName;

			public SkillSlot slotIndex;

			public int variantIndex;

			public SkillDef replDef;

			public SkillDef trgtDef;

			public int registryEpoch;
		}

		public static RerollMode rerollMode;

		public static UnusedMode unusedMode;

		public static bool enableMonsterSkills;

		public static StridesInteractionMode stridesInteractionMode;

		public static bool altModel;

		public static bool removeClassicItemsScepterFromPool;

		public static bool enableSOTVTransforms;

		public static bool artiFlamePerformanceMode;

		public static bool captainNukeFriendlyFire;

		public static bool engiTurretAdjustCooldown;

		public static bool engiWalkerAdjustCooldown;

		public static bool turretBlacklist;

		private GameObject itemModel;

		private GameObject itemDisplay;

		public static GameObject ItemBodyModelPrefab;

		public static GameObject ancientWispPrefab;

		public static Material purpleFireMaterial;

		internal List<ScepterSkill> skills = new List<ScepterSkill>();

		private bool handlingOverride = false;

		private readonly List<ScepterReplacer> scepterReplacers = new List<ScepterReplacer>();

		private readonly Dictionary<SkillSlot, SkillDef> heresyDefs = new Dictionary<SkillSlot, SkillDef>();

		private bool handlingInventory = false;

		public override string ItemName => "Ancient Scepter";

		public override string ItemLangTokenName => "ANCIENT_SCEPTER";

		public override string ItemPickupDesc => "Upgrades one of your skills.";

		public override string ItemFullDescription => "Upgrade one of your <style=cIsUtility>skills</style>. <style=cStack>(Unique per character)</style> <style=cStack>" + ((rerollMode != 0) ? "Extra/Unusable" : "Unusable (but NOT extra)") + " pickups will reroll into " + ((rerollMode == RerollMode.Scrap) ? "red scrap" : "other legendary items.") + "</style>";

		public override string ItemLore => "Perfected energies. <He> holds it before us. The crystal of foreign elements is not attached physically, yet it does not falter from the staff's structure.\n\nOverwhelming strength. We watch as <His> might splits the ground asunder with a single strike.\n\nWondrous possibilities. <His> knowledge unlocks further pathways of development. We are enlightened by <Him>.\n\nExcellent results. From <His> hands, [Nanga] takes hold. It is as <He> said: The weak are culled.\n\nRisking everything. The crystal destabilizies. [Nanga] is gone, and <He> is forced to wield it once again.\n\nPower comes at a cost. <He> is willing to pay.";

		public override ItemTier Tier => (ItemTier)2;

		public override ItemTag[] ItemTags => EvaluateItemTags();

		private string AssetName => altModel ? "AghanimScepter" : "AncientScepter";

		public override GameObject ItemModel
		{
			get
			{
				if ((Object)(object)itemModel == (Object)null)
				{
					itemModel = Assets.mainAssetBundle.LoadAsset<GameObject>("mdl" + AssetName + "Pickup");
				}
				return itemModel;
			}
		}

		public override GameObject ItemDisplay
		{
			get
			{
				if ((Object)(object)itemDisplay == (Object)null)
				{
					itemDisplay = Assets.mainAssetBundle.LoadAsset<GameObject>("mdl" + AssetName + "Display");
				}
				return itemDisplay;
			}
		}

		public override Sprite ItemIcon => Assets.mainAssetBundle.LoadAsset<Sprite>("tex" + AssetName + "Icon");

		public override bool TILER2_MimicBlacklisted => true;

		public override bool AIBlacklisted => true;

		public override void Init(ConfigFile config)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			ancientWispPrefab = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/AncientWispBody");
			RegisterSkills();
			CreateConfig(config);
			CreateLang();
			CreateItem();
			Hooks();
			Install();
			MainMenuController.Start += new hook_Start(MainMenuController_Start);
		}

		private void MainMenuController_Start(orig_Start orig, MainMenuController self)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			orig.Invoke(self);
			MainMenuController.Start -= new hook_Start(MainMenuController_Start);
		}

		private ItemTag[] EvaluateItemTags()
		{
			List<ItemTag> list = new List<ItemTag>
			{
				(ItemTag)3,
				(ItemTag)4
			};
			if (turretBlacklist)
			{
				list.Add((ItemTag)13);
			}
			return list.ToArray();
		}

		public override void CreateConfig(ConfigFile config)
		{
			string text = "Item: " + ItemName;
			engiTurretAdjustCooldown = config.Bind<bool>("Engineer", "TR12-C Gauss Compact Faster Recharge", false, "If true, TR12-C Gauss Compact will recharge faster to match the additional stock.").Value;
			engiWalkerAdjustCooldown = config.Bind<bool>("Engineer", "TR58-C Carbonizer Mini Faster Recharge", false, "If true, TR58-C Carbonizer Mini will recharge faster to match the additional stock.").Value;
			turretBlacklist = config.Bind<bool>("Engineer", "Blacklist Turrets", false, "If true, turrets will be blacklisted from getting the Ancient Scepter.\nIf false, they will get the scepter and will get rerolled depending on the reroll mode.").Value;
			artiFlamePerformanceMode = config.Bind<bool>("Artificer", "ArtiFlamePerformance", false, "If true, Dragon's Breath will use significantly lighter particle effects and no dynamic lighting.").Value;
			captainNukeFriendlyFire = config.Bind<bool>("Captain", "Captain Nuke Friendly Fire", false, "If true, then Captain's Scepter Nuke will also inflict blight on allies.").Value;
			rerollMode = config.Bind<RerollMode>(text, "Reroll on pickup mode", RerollMode.Random, "If \"Disabled\", additional stacks will not be rerolled\nIf \"Random\", any stacks picked up past the first will reroll to other red items.\nIf \"Scrap\", any stacks picked up past the first will reroll into red scrap.").Value;
			unusedMode = config.Bind<UnusedMode>(text, "Unused mode", UnusedMode.Metamorphosis, "If \"Keep\", Characters which cannot benefit from the item will still keep it.\nIf \"Reroll\", Characters without any scepter upgrades will reroll according to above pickup mode.\nIf \"Metamorphosis\", Characters without scepter upgrades will only reroll if Artifact of Metamorphosis is not active.").Value;
			stridesInteractionMode = config.Bind<StridesInteractionMode>(text, "Strides pickup mode", StridesInteractionMode.ScepterRerolls, "Changes what happens when a character whose skill is affected by Ancient Scepter has both Ancient Scepter and the corresponding heretic skill replacements (Visions/Hooks/Strides/Essence) at the same time.").Value;
			enableMonsterSkills = config.Bind<bool>(text, "Enable skills for monsters", true, "If true, certain monsters get the effects of the Ancient Scepter.").Value;
			altModel = config.Bind<bool>(text, "Alt Model", false, "Changes the model as a reference to a certain other scepter that upgrades abilities.").Value;
			removeClassicItemsScepterFromPool = config.Bind<bool>(text, "CLASSICITEMS: Remove Classic Items Ancient Scepter From Droplist If Installed", true, "If true, then the Ancient Scepter from Classic Items will be removed from the drop pool to prevent complications.").Value;
			ScepterSkill scepterSkill = skills.First((ScepterSkill x) => x is EngiTurret2);
			scepterSkill.myDef.baseRechargeInterval = EngiTurret2.oldDef.baseRechargeInterval * (engiTurretAdjustCooldown ? (2f / 3f) : 1f);
			SkillUtil.GlobalUpdateSkillDef(scepterSkill.myDef);
			ScepterSkill scepterSkill2 = skills.First((ScepterSkill x) => x is EngiWalker2);
			scepterSkill2.myDef.baseRechargeInterval = EngiWalker2.oldDef.baseRechargeInterval / (engiWalkerAdjustCooldown ? 2f : 1f);
			SkillUtil.GlobalUpdateSkillDef(scepterSkill2.myDef);
			if (Chainloader.PluginInfos.ContainsKey("com.ThinkInvisible.ClassicItems") && removeClassicItemsScepterFromPool)
			{
				Run.onRunStartGlobal += RemoveClassicItemsScepter;
			}
			enableSOTVTransforms = config.Bind<bool>(text, "Transformation Notification", true, "If true, then when scepters are re-rolled, then it will be accompanied by a transformation notification like other items.").Value;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void RemoveClassicItemsScepter(Run run)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			ItemDef itemDef = ((Item)Item<Scepter>.instance).itemDef;
			if (itemDef != null && (int)itemDef.itemIndex > -1)
			{
				Run.instance.DisableItemDrop(((Item)Item<Scepter>.instance).itemDef.itemIndex);
			}
		}

		public override ItemDisplayRuleDict CreateDisplayRules()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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_01c4: 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_01df: 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_01fa: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: 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_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0625: Unknown result type (might be due to invalid IL or missing references)
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0701: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_0747: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0760: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Unknown result type (might be due to invalid IL or missing references)
			//IL_0780: Unknown result type (might be due to invalid IL or missing references)
			//IL_07af: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Unknown result type (might be due to invalid IL or missing references)
			//IL_083a: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0855: Unknown result type (might be due to invalid IL or missing references)
			//IL_085a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0870: Unknown result type (might be due to invalid IL or missing references)
			//IL_0875: Unknown result type (might be due to invalid IL or missing references)
			//IL_087a: Unknown result type (might be due to invalid IL or missing references)
			//IL_087b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0896: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0900: Unknown result type (might be due to invalid IL or missing references)
			//IL_0905: Unknown result type (might be due to invalid IL or missing references)
			//IL_0906: Unknown result type (might be due to invalid IL or missing references)
			//IL_0921: Unknown result type (might be due to invalid IL or missing references)
			//IL_0950: Unknown result type (might be due to invalid IL or missing references)
			//IL_0955: Unknown result type (might be due to invalid IL or missing references)
			//IL_096b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0970: Unknown result type (might be due to invalid IL or missing references)
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_098b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0990: Unknown result type (might be due to invalid IL or missing references)
			//IL_0991: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_09db: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1c: Unknown result type (might be due to invalid IL or missing references)
			SetupMaterials(ItemModel);
			ItemDisplay val = ItemModel.AddComponent<ItemDisplay>();
			val.rendererInfos = Assets.SetupRendererInfos(ItemModel);
			ItemBase.displayPrefab = ItemDisplay;
			SetupMaterials(ItemBase.displayPrefab);
			val = ItemBase.displayPrefab.AddComponent<ItemDisplay>();
			val.rendererInfos = Assets.SetupRendererInfos(ItemBase.displayPrefab);
			ItemDisplayRuleDict val2 = new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "Pelvis",
					localPos = new Vector3(0.1473f, -0.073f, -0.0935f),
					localAngles = new Vector3(333.2843f, 198.8161f, 165.1177f),
					localScale = new Vector3(0.2235f, 0.2235f, 0.2235f)
				}
			});
			val2.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "Pelvis",
					localPos = new Vector3(0f, 0.0638f, 0.0973f),
					localAngles = new Vector3(76.6907f, 0f, 0f),
					localScale = new Vector3(0.2812f, 0.2812f, 0.2812f)
				}
			});
			val2.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "HandR",
					localPos = new Vector3(-0.0021f, 0.1183f, 0.063f),
					localAngles = new Vector3(0f, 34.1f, 90f),
					localScale = new Vector3(0.4416f, 0.4416f, 0.4416f)
				}
			});
			val2.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "CannonHeadR",
					localPos = new Vector3(0.0186f, 0.3435f, 0.2246f),
					localAngles = new Vector3(0f, 0f, 0f),
					localScale = new Vector3(0.5614f, 0.5614f, 0.5614f)
				}
			});
			val2.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "Pelvis",
					localPos = new Vector3(0.1712f, 0f, 0f),
					localAngles = new Vector3(69.8111f, 180f, 180f),
					localScale = new Vector3(0.2679f, 0.2679f, 0.2679f)
				}
			});
			val2.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "MechLowerArmR",
					localPos = new Vector3(0.0813f, 0.4165f, -0.0212f),
					localAngles = new Vector3(0f, 180f, 180f),
					localScale = new Vector3(0.4063f, 0.4063f, 0.4063f)
				}
			});
			val2.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "Chest",
					localPos = new Vector3(-0.0046f, 0.0099f, -0.286f),
					localAngles = new Vector3(10.4706f, 1.6895f, 24.8468f),
					localScale = new Vector3(0.4928f, 0.4928f, 0.4928f)
				}
			});
			val2.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "Chest",
					localPos = new Vector3(1.1191f, 0.358f, -1.6717f),
					localAngles = new Vector3(0f, 0f, 270f),
					localScale = new Vector3(2.4696f, 2.4696f, 2.4696f)
				}
			});
			val2.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "CalfFrontL",
					localPos = new Vector3(0f, 0.8376f, -0.1766f),
					localAngles = new Vector3(0f, 0f, 0f),
					localScale = new Vector3(0.8037f, 0.8037f, 0.8037f)
				}
			});
			val2.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "MouthMuzzle",
					localPos = new Vector3(0f, 2.1215f, 2.9939f),
					localAngles = new Vector3(0f, 0f, 270f),
					localScale = new Vector3(5.2969f, 5.2969f, 5.2969f)
				}
			});
			val2.Add("mdlBandit", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = ItemBase.displayPrefab,
					childName = "Pelvis",
					localPos = new Vector3(-0.1152f, -0.1278f, 0.2056f),
					localAngles = new Vector3(20f, 285f, 10f),
					localScale = new Vector3(0.2235f, 0.2235f, 0.2235f)
				}
			});
			val2.Add("mdlEnforcer", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { ItemHelpers.CreateDisplayRule(ItemBase.displayPrefab, "Pelvis", new Vector3(-0.08448f, 0.00357f, -0.35566f), new Vector3(43.57039f, 347.6845f, 69.64303f), new Vector3(0.31291f, 0.31291f, 0.31291f)) });
			val2.Add("mdlNemforcer", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { ItemHelpers.CreateDisplayRule(ItemBase.displayPrefab, "Minigun", new Vector3(0.00287f, -0.00305f, -0.03029f), new Vector3(358.9499f, 89.5545f, 180.8908f), new Vector3(0.00837f, 0.00837f, 0.00837f)) });
			val2.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					childName = "Hand",
					followerPrefab = ItemBase.displayPrefab,
					localPos = new Vector3(-0.02335f, 0.11837f, 0.11306f),
					localAngles = new Vector3(55.42191f, 299.1461f, 266.1845f),
					localScale = new Vector3(0.56092f, 0.56276f, 0.56092f)
				}
			});
			val2.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					childName = "ThighR",
					followerPrefab = ItemBase.displayPrefab,
					localPos = new Vector3(-0.11836f, 0.17205f, 0.0282f),
					localAngles = new Vector3(353.4687f, 184.4017f, 177.4758f),
					localScale = new Vector3(0.2235f, 0.2235f, 0.2235f)
				}
			});
			val2.Add("mdlNemmando", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					childName = "Sword",
					followerPrefab = ItemBase.displayPrefab,
					localPos = new Vector3(-5.576489E-05f, 0.001674413f, -2.617424E-05f),
					localAngles = new Vector3(1.114511f, 204.2958f, 177.8329f),
					localScale = new Vector3(0.0026f, 0.0026f, 0.0026f)
				}
			});
			val2.Add("mdlHeretic", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					childName = "ThighL",
					followerPrefab = ItemBase.displayPrefab,
					localPos = new Vector3(0.49264f, -0.16267f, -0.14486f),
					localAngles = new Vector3(9.97009f, 351.3801f, 100.2498f),
					localScale = new Vector3(0.5f, 0.5f, 0.5f)
				}
			});
			val2.Add("mdlBrother", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					childName = "HandL",
					followerPrefab = ItemBase.displayPrefab,
					localPos = new Vector3(-0.05066f, 0.13436f, 0.0282f),
					localAngles = new Vector3(79.95749f, 180f, 230.595f),
					localScale = new Vector3(0.4f, 0.4f, 0.4f)
				}
			});
			return val2;
		}

		protected override void SetupMaterials(GameObject modelPrefab)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			purpleFireMaterial = ((Renderer)((Component)ancientWispPrefab.transform.Find("Model Base?/mdlAncientWisp/AncientWispArmature/chest/Fire, Main")).GetComponent<ParticleSystemRenderer>()).material;
			modelPrefab.GetComponentInChildren<Renderer>().material = Assets.CreateMaterial("mat" + AssetName, 1f, Color.white, 1f);
			ParticleSystemRenderer[] componentsInChildren = modelPrefab.GetComponentsInChildren<ParticleSystemRenderer>();
			foreach (ParticleSystemRenderer val in componentsInChildren)
			{
				((Renderer)val).material = purpleFireMaterial;
			}
		}

		public AncientScepterItem()
		{
			skills.Add(new ArtificerFlamethrower2());
			skills.Add(new ArtificerFlyUp2());
			skills.Add(new Bandit2ResetRevolver2());
			skills.Add(new Bandit2SkullRevolver2());
			skills.Add(new CaptainAirstrike2());
			skills.Add(new CaptainAirstrikeAlt2());
			skills.Add(new CommandoBarrage2());
			skills.Add(new CommandoGrenade2());
			skills.Add(new CrocoDisease2());
			skills.Add(new EngiTurret2());
			skills.Add(new EngiWalker2());
			skills.Add(new HuntressBallista2());
			skills.Add(new HuntressRain2());
			skills.Add(new LoaderChargeFist2());
			skills.Add(new LoaderChargeZapFist2());
			skills.Add(new MercEvis2());
			skills.Add(new MercEvisProjectile2());
			skills.Add(new ToolbotDash2());
			skills.Add(new TreebotFlower2_2());
			skills.Add(new TreebotFireFruitSeed2());
			skills.Add(new RailgunnerSuper2());
			skills.Add(new RailgunnerCryo2());
			skills.Add(new VoidFiendCrush());
			if (enableMonsterSkills)
			{
				skills.Add(new AurelioniteEyeLaser2());
				skills.Add(new VultureWindblade2());
			}
		}

		public void RegisterSkills()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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)
			foreach (ScepterSkill skill in skills)
			{
				skill.SetupAttributes();
				RegisterScepterSkill(skill.myDef, skill.targetBody, skill.targetSlot, skill.targetVariantIndex);
			}
			RegisterScepterSkill(VoidFiendCrush.myCtxDef, "VoidSurvivorBody", VoidFiendCrush.dirtySkillDef);
			HereticNevermore2 hereticNevermore = new HereticNevermore2();
			hereticNevermore.SetupAttributes();
			RegisterScepterSkill(hereticNevermore.myDef, hereticNevermore.targetBody, Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Heretic/HereticDefaultAbility.asset").WaitForCompletion());
			skills.Add(hereticNevermore);
		}

		public void Install()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			CharacterBody.onBodyInventoryChangedGlobal += On_CBInventoryChangedGlobal;
			CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(On_CMGetDeployableSameSlotLimit);
			GenericSkill.UnsetSkillOverride += new hook_UnsetSkillOverride(On_GSUnsetSkillOverride);
			Run.onRunStartGlobal += On_RunStartGlobal;
			foreach (ScepterSkill skill in skills)
			{
				skill.LoadBehavior();
			}
			foreach (CharacterMaster item in MiscUtil.AliveList())
			{
				if (item.hasBody)
				{
					CharacterBody body = item.GetBody();
					HandleScepterSkill(body);
				}
			}
		}

		public void InstallLanguage()
		{
			foreach (ScepterSkill skill in skills)
			{
				if (skill.oldDescToken != null)
				{
					languageOverlays.Add(LanguageAPI.AddOverlay(skill.newDescToken, Language.GetString(skill.oldDescToken) + skill.overrideStr));
				}
			}
		}

		private void On_GSUnsetSkillOverride(orig_UnsetSkillOverride orig, GenericSkill self, object source, SkillDef skillDef, SkillOverridePriority priority)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, source, skillDef, priority);
			if (!handlingOverride && Object.op_Implicit((Object)(object)self.characterBody))
			{
				handlingOverride = true;
				CleanScepter(self.characterBody, self);
				HandleScepterSkill(self.characterBody);
				handlingOverride = false;
			}
		}

		private int On_CMGetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
		{
			//IL_0003: 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_000c: Invalid comparison between Unknown and I4
			int num = orig.Invoke(self, slot);
			if ((int)slot != 1)
			{
				return num;
			}
			CharacterBody body = self.GetBody();
			GenericSkill val = ((body == null) ? null : body.skillLocator?.special);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return num;
			}
			if ((Object)(object)val.skillDef == (Object)(object)skills.First((ScepterSkill x) => x is EngiTurret2).myDef)
			{
				return num + 1;
			}
			if ((Object)(object)val.skillDef == (Object)(object)skills.First((ScepterSkill x) => x is EngiWalker2).myDef)
			{
				return num + 2;
			}
			return num;
		}

		public bool RegisterScepterSkill(SkillDef replacingDef, string targetBodyName, SkillSlot targetSlot, int targetVariant)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if (targetVariant < 0)
			{
				AncientScepterMain._logger.LogError((object)"Can't register a scepter skill to negative variant index");
				return false;
			}
			ScepterReplacer scepterReplacer = scepterReplacers.FirstOrDefault((ScepterReplacer x) => x.bodyName == targetBodyName && x.slotIndex == targetSlot && x.variantIndex == targetVariant);
			if (scepterReplacer != null)
			{
				AncientScepterMain._logger.LogMessage((object)("Replacing scepter skill for \"" + targetBodyName + "\" (" + scepterReplacer.replDef.skillName + ") with (" + replacingDef.skillName + ")"));
				scepterReplacers.Remove(scepterReplacer);
				scepterReplacer = null;
			}
			scepterReplacer = scepterReplacers.FirstOrDefault((ScepterReplacer x) => x.bodyName == targetBodyName && (Object)(object)x.trgtDef != (Object)null);
			AncientScepterMain._logger.LogMessage((object)("Adding scepter skill for \"" + targetBodyName + "\" (" + replacingDef.skillName + ")"));
			scepterReplacers.Add(new ScepterReplacer
			{
				bodyName = targetBodyName,
				slotIndex = targetSlot,
				variantIndex = targetVariant,
				replDef = replacingDef,
				registryEpoch = ((scepterReplacer != null) ? (scepterReplacer.registryEpoch + 1) : 0)
			});
			return true;
		}

		public bool RegisterScepterSkill(SkillDef replacingDef, string targetBodyName, SkillDef targetDef)
		{
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			ScepterReplacer scepterReplacer = scepterReplacers.FirstOrDefault((ScepterReplacer x) => x.bodyName == targetBodyName && (Object)(object)x.trgtDef == (Object)(object)targetDef);
			if (scepterReplacer != null)
			{
				AncientScepterMain._logger.LogMessage((object)("Replacing scepter skill for \"" + targetBodyName + "\" (" + scepterReplacer.replDef.skillName + ") with (" + replacingDef.skillName + ")"));
				scepterReplacers.Remove(scepterReplacer);
				scepterReplacer = null;
			}
			scepterReplacer = scepterReplacers.FirstOrDefault((ScepterReplacer x) => x.bodyName == targetBodyName && (Object)(object)x.trgtDef == (Object)null);
			AncientScepterMain._logger.LogMessage((object)("Adding scepter skill for \"" + targetBodyName + "\" (" + replacingDef.skillName + ")"));
			scepterReplacers.Add(new ScepterReplacer
			{
				bodyName = targetBodyName,
				slotIndex = (SkillSlot)(-1),
				variantIndex = -1,
				replDef = replacingDef,
				trgtDef = targetDef,
				registryEpoch = ((scepterReplacer != null) ? (scepterReplacer.registryEpoch + 1) : 0)
			});
			return true;
		}

		private void On_RunStartGlobal(Run run)
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			heresyDefs.Add((SkillSlot)0, CommonAssets.lunarPrimaryReplacementSkillDef);
			heresyDefs.Add((SkillSlot)1, CommonAssets.lunarSecondaryReplacementSkillDef);
			heresyDefs.Add((SkillSlot)2, CommonAssets.lunarUtilityReplacementSkillDef);
			heresyDefs.Add((SkillSlot)3, CommonAssets.lunarSpecialReplacementSkillDef);
			foreach (ScepterReplacer repdef in scepterReplacers.Where((ScepterReplacer x) => (Object)(object)x.trgtDef == (Object)null).Reverse())
			{
				GameObject val = BodyCatalog.FindBodyPrefab(repdef.bodyName);
				SkillLocator val2 = ((val != null) ? val.GetComponent<SkillLocator>() : null);
				if (!Object.op_Implicit((Object)(object)val2) || (int)repdef.slotIndex == -1 || repdef.variantIndex < 0)
				{
					continue;
				}
				Variant[] variants = val2.GetSkill(repdef.slotIndex).skillFamily.variants;
				if (variants.Length <= repdef.variantIndex)
				{
					AncientScepterMain._logger.LogError((object)$"Invalid Scepter Replacement for body:{repdef.bodyName},slot:{repdef.slotIndex},with skill:{repdef.replDef.skillNameToken}");
					repdef.trgtDef = null;
					continue;
				}
				ScepterReplacer scepterReplacer = scepterReplacers.FirstOrDefault((ScepterReplacer x) => (Object)(object)x.trgtDef == (Object)(object)variants[repdef.variantIndex].skillDef && x.registryEpoch >= repdef.registryEpoch);
				if (scepterReplacer != null)
				{
					AncientScepterMain._logger.LogMessage((object)("Replacing scepter skill for \"" + repdef.bodyName + "\" (" + repdef.replDef.skillName + ") with (" + scepterReplacer.replDef.skillName + ")"));
					repdef.trgtDef = null;
				}
				else
				{
					repdef.trgtDef = variants[repdef.variantIndex].skillDef;
				}
			}
			Run.onRunStartGlobal -= On_RunStartGlobal;
		}

		private void On_CBInventoryChangedGlobal(CharacterBody body)
		{
			if (handlingInventory)
			{
				return;
			}
			handlingInventory = true;
			if (!HandleScepterSkill(body) && RerollUnused())
			{
				if (GetCount(body) > 0)
				{
					Reroll(body, GetCount(body));
				}
			}
			else if (GetCount(body) > 1 && rerollMode != 0)
			{
				Reroll(body, GetCount(body) - 1);
			}
			handlingInventory = false;
		}

		private bool RerollUnused()
		{
			return unusedMode switch
			{
				UnusedMode.Keep => false, 
				UnusedMode.Metamorphosis => !RunArtifactManager.instance.IsArtifactEnabled(Artifacts.randomSurvivorOnRespawnArtifactDef), 
				_ => true, 
			};
		}

		private void Reroll(CharacterBody self, int count)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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)
			if (count <= 0)
			{
				return;
			}
			switch (rerollMode)
			{
			case RerollMode.Disabled:
				break;
			case RerollMode.Random:
			{
				List<PickupIndex> list = Run.instance.availableTier3DropList.Except((IEnumerable<PickupIndex>)(object)new PickupIndex[1] { PickupCatalog.FindPickupIndex(base.ItemDef.itemIndex) }).ToList();
				List<ItemIndex> list2 = new List<ItemIndex>();
				for (int j = 0; j < count; j++)
				{
					self.inventory.RemoveItem(base.ItemDef, 1);
					ItemIndex itemIndex = PickupCatalog.GetPickupDef(list[Random.Range(0, list.Count)]).itemIndex;
					self.inventory.GiveItem(itemIndex, 1);
					list2.Add(itemIndex);
				}
				if (!enableSOTVTransforms)
				{
					break;
				}
				{
					foreach (ItemIndex item in list2.Distinct())
					{
						CharacterMasterNotificationQueue.SendTransformNotification(self.master, base.ItemDef.itemIndex, item, (TransformationType)0);
					}
					break;
				}
			}
			case RerollMode.Scrap:
			{
				for (int i = 0; i < count; i++)
				{
					self.inventory.RemoveItem(base.ItemDef, 1);
					self.inventory.GiveItem(Items.ScrapRed, 1);
				}
				if (enableSOTVTransforms)
				{
					CharacterMasterNotificationQueue.SendTransformNotification(self.master, base.ItemDef.itemIndex, Items.ScrapRed.itemIndex, (TransformationType)0);
				}
				break;
			}
			}
		}

		private void CleanScepter(CharacterBody self, GenericSkill slot = null, bool force = false)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			string bodyName = BodyCatalog.GetBodyName(self.bodyIndex);
			List<ScepterReplacer> source = scepterReplacers.FindAll((ScepterReplacer x) => x.bodyName == bodyName);
			if (Object.op_Implicit((Object)(object)slot))
			{
				if (source.Any((ScepterReplacer r) => (Object)(object)r.replDef == (Object)(object)slot.skillDef && (force || ((Object)(object)slot.baseSkill != (Object)(object)r.trgtDef && !slot.skillOverrides.Any((SkillOverride s) => (Object)(object)r.trgtDef == (Object)(object)s.skillDef)))))
				{
					slot.UnsetSkillOverride((object)self, slot.skillDef, (SkillOverridePriority)2);
				}
				return;
			}
			GenericSkill[] allSkills = self.skillLocator.allSkills;
			foreach (GenericSkill val in allSkills)
			{
				if (source.Any((ScepterReplacer r) => (Object)(object)r.replDef == (Object)(object)slot.skillDef && (force || ((Object)(object)slot.baseSkill != (Object)(object)r.trgtDef && !slot.skillOverrides.Any((SkillOverride s) => (Object)(object)r.trgtDef == (Object)(object)s.skillDef)))))
				{
					val.UnsetSkillOverride((object)self, val.skillDef, (SkillOverridePriority)2);
				}
			}
		}

		private bool HandleScepterSkill(CharacterBody self, bool forceOff = false)
		{
			//IL_005f: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Invalid comparison between Unknown and I4
			//IL_0217: 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_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: 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_03bd: Unknown result type (might be due to invalid IL or missing references)
			ScepterReplacer replVar;
			if (Object.op_Implicit((Object)(object)self.skillLocator) && self.master?.loadout != null)
			{
				string bodyName = BodyCatalog.GetBodyName(self.bodyIndex);
				List<ScepterReplacer> list = scepterReplacers.FindAll((ScepterReplacer x) => x.bodyName == bodyName);
				if (list.Count > 0)
				{
					if (list.Select((ScepterReplacer x) => x.replDef).Intersect(self.skillLocator.allSkills.Select((GenericSkill x) => x.skillDef)).Any() && GetCount(self) > 0)
					{
						return true;
					}
					GenericSkill val = null;
					SkillSlot val2 = (SkillSlot)(-1);
					replVar = null;
					bool flag = false;
					foreach (ScepterReplacer replacement in list)
					{
						foreach (GenericSkill item in self.skillLocator.allSkills.Reverse().ToList().FindAll((GenericSkill s) => (Object)(object)s.skillDef == (Object)(object)replacement.trgtDef || (Object)(object)s.baseSkill == (Object)(object)replacement.trgtDef))
						{
							val = item;
							val2 = (((int)replacement.slotIndex == -1) ? self.skillLocator.FindSkillSlot(val) : replacement.slotIndex);
							if ((stridesInteractionMode != StridesInteractionMode.ScepterTakesPrecedence || bodyName == "HereticBody") && hasHeresyForSlot(val2) && (Object)(object)replacement.trgtDef != (Object)(object)heresyDefs[val2])
							{
								flag = true;
								continue;
							}
							replVar = replacement;
							break;
						}
						if (replVar != null && Object.op_Implicit((Object)(object)val) && (Object)(object)replVar.trgtDef == (Object)(object)val.skillDef)
						{
							break;
						}
					}
					if (replVar == null)
					{
						return flag && stridesInteractionMode != StridesInteractionMode.ScepterRerolls;
					}
					bool flag2 = handlingOverride;
					handlingOverride = true;
					if (!forceOff && GetCount(self) > 0)
					{
						if (stridesInteractionMode == StridesInteractionMode.ScepterTakesPrecedence && hasHeresyForSlot(val2))
						{
							self.skillLocator.GetSkill(val2).UnsetSkillOverride((object)self, heresyDefs[val2], (SkillOverridePriority)3);
						}
						val.SetSkillOverride((object)self, replVar.replDef, (SkillOverridePriority)2);
						val.onSkillChanged += UnsetOverrideLater;
					}
					else
					{
						val.UnsetSkillOverride((object)self, replVar.replDef, (SkillOverridePriority)2);
						if (stridesInteractionMode == StridesInteractionMode.ScepterTakesPrecedence && hasHeresyForSlot(val2))
						{
							self.skillLocator.GetSkill(val2).SetSkillOverride((object)self, heresyDefs[val2], (SkillOverridePriority)3);
						}
					}
					handlingOverride = flag2;
					return true;
				}
			}
			return false;
			void UnsetOverrideLater(GenericSkill skill)
			{
				skill.onSkillChanged -= UnsetOverrideLater;
				skill.UnsetSkillOverride((object)self, replVar.replDef, (SkillOverridePriority)2);
			}
			bool hasHeresyForSlot(SkillSlot skillSlot)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected I4, but got Unknown
				return (int)skillSlot switch
				{
					0 => self.inventory.GetItemCount(Items.LunarPrimaryReplacement) > 0, 
					1 => self.inventory.GetItemCount(Items.LunarSecondaryReplacement) > 0, 
					2 => self.inventory.GetItemCount(Items.LunarUtilityReplacement) > 0, 
					3 => self.inventory.GetItemCount(Items.LunarSpecialReplacement) > 0, 
					_ => false, 
				};
			}
		}
	}
	[BepInPlugin("com.DestroyedClone.AncientScepter", "StandaloneAncientScepter", "1.1.33")]
	[BepInDependency("com.bepis.r2api", "5.0.2")]
	[BepInDependency("com.bepis.r2api.items", "1.0.1")]
	[BepInDependency("com.bepis.r2api.prefab", "1.0.1")]
	[BepInDependency("com.bepis.r2api.language", "1.0.0")]
	[BepInDependency("com.bepis.r2api.damagetype", "1.0.0")]
	[BepInDependency("com.bepis.r2api.orb", "1.0.0")]
	[BepInDependency("com.bepis.r2api.content_management", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AncientScepterMain : BaseUnityPlugin
	{
		public const string ModVer = "1.1.33";

		public const string ModName = "StandaloneAncientScepter";

		public const string ModGuid = "com.DestroyedClone.AncientScepter";

		internal static ManualLogSource _logger = null;

		public List<ItemBase> Items = new List<ItemBase>();

		public static Dictionary<ItemBase, bool> ItemStatusDictionary = new Dictionary<ItemBase, bool>();

		protected readonly List<LanguageOverlay> languageOverlays = new List<LanguageOverlay>();

		public static BuffDef perishSongDebuff;

		public void Awake()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			_logger = ((BaseUnityPlugin)this).Logger;
			ModCompat.Init();
			CustomDamageTypes.SetupDamageTypes();
			SetupBuffs();
			Assets.PopulateAssets();
			Assets.SpriteAssets.InitializeAssets();
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
				select type;
			foreach (Type item in enumerable)
			{
				ItemBase itemBase = (ItemBase)Activator.CreateInstance(item);
				if (ValidateItem(itemBase, Items))
				{
					itemBase.Init(((BaseUnityPlugin)this).Config);
				}
			}
			Run.onRunStartGlobal += Run_onRunStartGlobal;
			MainMenuController.Start += new hook_Start(MainMenuController_Start);
			Language.onCurrentLanguageChanged += Language_onCurrentLanguageChanged;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void doBetterUI()
		{
			Buffs.RegisterBuffInfo(perishSongDebuff, "STANDALONEANCIENTSCEPTER_BUFF_PERISHSONG_NAME", "STANDALONEANCIENTSCEPTER_BUFF_PERISHSONG_DESC");
			LanguageAPI.Add("STANDALONEANCIENTSCEPTER_BUFF_PERISHSONG_NAME", "Perish Song");
			LanguageAPI.Add("STANDALONEANCIENTSCEPTER_BUFF_PERISHSONG_DESC", "After 30 seconds, take 5000% damage from the Heretic that inflicted you.");
		}

		public static void SetupBuffs()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			perishSongDebuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)perishSongDebuff).name = "Perish Song";
			perishSongDebuff.iconSprite = Resources.Load<Sprite>("textures/difficultyicons/texDifficultyHardIcon");
			perishSongDebuff.buffColor = Color.red;
			perishSongDebuff.canStack = true;
			perishSongDebuff.isHidden = false;
			perishSongDebuff.isDebuff = false;
			perishSongDebuff.isCooldown = false;
			if (!ContentAddition.AddBuffDef(perishSongDebuff))
			{
				_logger.LogWarning((object)"Buff 'perishSongDebuff' failed to be added.");
			}
			if (ModCompat.compatBetterUI)
			{
				doBetterUI();
			}
		}

		private void Language_onCurrentLanguageChanged()
		{
			InstallLanguage();
		}

		private void MainMenuController_Start(orig_Start orig, MainMenuController self)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			orig.Invoke(self);
			InstallLanguage();
			MainMenuController.Start -= new hook_Start(MainMenuController_Start);
		}

		private void Run_onRunStartGlobal(Run run)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				Xoroshiro128Plus val = new Xoroshiro128Plus(run.seed);
				ItemBase<AncientScepterItem>.instance.rng = new Xoroshiro128Plus(val.nextUlong);
			}
		}

		public void InstallLanguage()
		{
			foreach (ScepterSkill skill in ItemBase<AncientScepterItem>.instance.skills)
			{
				if (skill.oldDescToken != null)
				{
					LanguageOverlay item = LanguageAPI.AddOverlay(skill.newDescToken, Language.GetString(skill.oldDescToken) + skill.overrideStr, Language.currentLanguageName ?? "en");
					languageOverlays.Add(item);
				}
			}
		}

		public bool ValidateItem(ItemBase item, List<ItemBase> itemList)
		{
			bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Item: " + item.ItemName, "Blacklist Item from AI Use?", false, "Should the AI not be able to obtain this item?").Value;
			ItemStatusDictionary.Add(item, ((Behaviour)this).enabled);
			itemList.Add(item);
			if (value)
			{
				item.AIBlacklisted = true;
			}
			return ((Behaviour)this).enabled;
		}

		public static void AddBuffAndDot(BuffDef buff, float duration, int stackCount, CharacterBody body)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			DotIndex val = (DotIndex)Array.FindIndex(DotController.dotDefs, (DotDef dotDef) => (Object)(object)dotDef.associatedBuff == (Object)(object)buff);
			for (int i = 0; i < stackCount; i++)
			{
				if ((int)val != -1)
				{
					DotController.InflictDot(((Component)body).gameObject, ((Component)body).gameObject, val, duration, 0.25f, (uint?)null);
				}
				else
				{
					body.AddTimedBuffAuthority(buff.buffIndex, duration);
				}
			}
		}
	}
	public static class Assets
	{
		public static class SpriteAssets
		{
			public static Sprite ArtificerFlameThrower2;

			public static Sprite ArtificerFlyUp2;

			public static Sprite Bandit2ResetRevolver2;

			public static Sprite Bandit2SkullRevolver2;

			public static Sprite CaptainAirstrike2;

			public static Sprite CaptainAirstrikeAlt2;

			public static Sprite CommandoBarrage2;

			public static Sprite CommandoGrenade2;

			public static Sprite CrocoDisease2;

			public static Sprite EngiTurret2;

			public static Sprite EngiWalker2;

			public static Sprite HereticNevermore2;

			public static Sprite HuntressBallista2;

			public static Sprite HuntressRain2;

			public static Sprite LoaderChargeFist2;

			public static Sprite LoaderChargeZapFist2;

			public static Sprite MercEvis2;

			public static Sprite MercEvis2Projectile;

			public static Sprite ToolbotDash2;

			public static Sprite TreebotFireFruitSeed2;

			public static Sprite TreebotFlower2_2;

			public static Sprite RailgunnerSupercharge2;

			public static Sprite RailgunnerFireSupercharge2;

			public static Sprite RailgunnerCryocharge2;

			public static Sprite RailgunnerFireCryocharge2;

			public static Sprite VoidFiendSuppress2;

			public static Sprite VoidFiendCorruptedSuppress2;

			public static void InitializeAssets()
			{
				ArtificerFlameThrower2 = mainAssetBundle.LoadAsset<Sprite>("texArtiR1");
				ArtificerFlyUp2 = mainAssetBundle.LoadAsset<Sprite>("texArtiR2");
				Bandit2ResetRevolver2 = mainAssetBundle.LoadAsset<Sprite>("texBanditR1");
				Bandit2SkullRevolver2 = mainAssetBundle.LoadAsset<Sprite>("texBanditR2");
				CaptainAirstrike2 = mainAssetBundle.LoadAsset<Sprite>("texCapU1");
				CaptainAirstrikeAlt2 = mainAssetBundle.LoadAsset<Sprite>("texCapU2");
				CommandoBarrage2 = mainAssetBundle.LoadAsset<Sprite>("texCommandoR1");
				CommandoGrenade2 = mainAssetBundle.LoadAsset<Sprite>("texCommandoR2");
				CrocoDisease2 = mainAssetBundle.LoadAsset<Sprite>("texAcridR1");
				EngiTurret2 = mainAssetBundle.LoadAsset<Sprite>("texEngiR1");
				EngiWalker2 = mainAssetBundle.LoadAsset<Sprite>("texEngiR2");
				HereticNevermore2 = mainAssetBundle.LoadAsset<Sprite>("texHereticR2");
				HuntressBallista2 = mainAssetBundle.LoadAsset<Sprite>("texHuntressR2");
				HuntressRain2 = mainAssetBundle.LoadAsset<Sprite>("texHuntressR1");
				LoaderChargeFist2 = mainAssetBundle.LoadAsset<Sprite>("texLoaderU1");
				LoaderChargeZapFist2 = mainAssetBundle.LoadAsset<Sprite>("texLoaderU2");
				MercEvis2 = mainAssetBundle.LoadAsset<Sprite>("texMercR1");
				MercEvis2Projectile = mainAssetBundle.LoadAsset<Sprite>("texMercR2");
				ToolbotDash2 = mainAssetBundle.LoadAsset<Sprite>("texMultU1");
				TreebotFireFruitSeed2 = mainAssetBundle.LoadAsset<Sprite>("texRexR2");
				TreebotFlower2_2 = mainAssetBundle.LoadAsset<Sprite>("texRexR1");
				RailgunnerSupercharge2 = mainAssetBundle.LoadAsset<Sprite>("texRailgunnerR1");
				RailgunnerFireSupercharge2 = mainAssetBundle.LoadAsset<Sprite>("texRailgunnerP1");
				RailgunnerCryocharge2 = mainAssetBundle.LoadAsset<Sprite>("texRailgunnerR2");
				RailgunnerFireCryocharge2 = mainAssetBundle.LoadAsset<Sprite>("texRailgunnerP2");
				VoidFiendSuppress2 = mainAssetBundle.LoadAsset<Sprite>("texVoidFiendR1");
				VoidFiendCorruptedSuppress2 = mainAssetBundle.LoadAsset<Sprite>("texVoidFiendR1C");
			}
		}

		internal static AssetBundle mainAssetBundle;

		public static Shader hotpoo = Resources.Load<Shader>("Shaders/Deferred/HGStandard");

		public static Material commandoMat;

		public static void PopulateAssets()
		{
			if ((Object)(object)mainAssetBundle == (Object)null)
			{
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AncientScepter.ancientscepter"))
				{
					mainAssetBundle = AssetBundle.LoadFromStream(stream);
				}
			}
		}

		public static Material CreateMaterial(string materialName, float emission, Color emissionColor, float normalStrength)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)commandoMat))
			{
				commandoMat = Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial;
			}
			Material val = Object.Instantiate<Material>(commandoMat);
			Material val2 = mainAssetBundle.LoadAsset<Material>(materialName);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return commandoMat;
			}
			((Object)val).name = materialName;
			val.SetColor("_Color", val2.GetColor("_Color"));
			val.SetTexture("_MainTex", val2.GetTexture("_MainTex"));
			val.SetColor("_EmColor", emissionColor);
			val.SetFloat("_EmPower", emission);
			val.SetTexture("_EmTex", val2.GetTexture("_EmissionMap"));
			val.SetFloat("_NormalStrength", normalStrength);
			return val;
		}

		public static Material CreateMaterial(string materialName)
		{
			return CreateMaterial(materialName, 0f);
		}

		public static Material CreateMaterial(string materialName, float emission)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return CreateMaterial(materialName, emission, Color.black);
		}

		public static Material CreateMaterial(string materialName, float emission, Color emissionColor)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return CreateMaterial(materialName, emission, emissionColor, 0f);
		}

		public static RendererInfo[] SetupRendererInfos(GameObject obj)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>();
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				array[i] = new RendererInfo
				{
					defaultMaterial = componentsInChildren[i].material,
					renderer = componentsInChildren[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}
	}
	public class BanditRicochetOrb : Orb
	{
		public delegate void HitCallback(BanditRicochetOrb orb);

		public int bouncesRemaining;

		public bool resetBouncedObjects;

		public float damageValue;

		public GameObject attacker;

		public CharacterBody attackerBody;

		public GameObject inflictor;

		public List<HealthComponent> bouncedObjects;

		public TeamIndex teamIndex;

		public bool isCrit;

		public ProcChainMask procChainMask;

		public float procCoefficient = 1f;

		public DamageColorIndex damageColorIndex;

		public float range = 30f;

		public DamageType damageType;

		private BullseyeSearch search;

		public GameObject hitEffectPrefab;

		public GameObject tracerEffectPrefab;

		public string hitSoundString;

		public HitCallback hitCallback;

		public override void OnArrival()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00e3: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			((Orb)this).OnArrival();
			if (Object.op_Implicit((Object)(object)base.target))
			{
				range *= Bandit2SkullRevolver2.reductionPerBounceMultiplier;
				damageValue *= Bandit2SkullRevolver2.reductionPerBounceMultiplier;
				if (Object.op_Implicit((Object)(object)tracerEffectPrefab))
				{
					EffectData val = new EffectData
					{
						origin = ((Component)base.target).transform.position,
						start = base.origin
					};
					EffectManager.SpawnEffect(tracerEffectPrefab, val, true);
				}
				if (damageValue > 0f)
				{
					HealthComponent healthComponent = base.target.healthComponent;
					if (Object.op_Implicit((Object)(object)healthComponent))
					{
						DamageInfo val2 = new DamageInfo
						{
							damage = damageValue,
							attacker = attacker,
							inflictor = inflictor,
							force = Vector3.zero,
							crit = isCrit,
							procChainMask = procChainMask,
							procCoefficient = procCoefficient,
							position = ((Component)base.target).transform.position,
							damageColorIndex = damageColorIndex,
							damageType = damageType
						};
						DamageAPI.AddModdedDamageType(val2, CustomDamageTypes.ScepterBandit2SkullDT);
						healthComponent.TakeDamage(val2);
						GlobalEventManager.instance.OnHitEnemy(val2, ((Component)healthComponent).gameObject);
						GlobalEventManager.instance.OnHitAll(val2, ((Component)healthComponent).gameObject);
					}
				}
				hitCallback?.Invoke(this);
				if (bouncesRemaining > 0)
				{
					if (!Bandit2SkullRevolver2.GetRicochetChance(attackerBody))
					{
						bouncesRemaining = 1;
					}
					if (resetBouncedObjects)
					{
						bouncedObjects.Clear();
						bouncedObjects.Add(base.target.healthComponent);
					}
					HurtBox val3 = PickNextTarget(((Component)base.target).transform.position);
					if (Object.op_Implicit((Object)(object)val3))
					{
						BanditRicochetOrb obj = new BanditRicochetOrb
						{
							search = search,
							origin = ((Component)base.target).transform.position,
							target = val3,
							attacker = attacker,
							attackerBody = attackerBody,
							inflictor = inflictor,
							teamIndex = teamIndex,
							damageValue = damageValue,
							isCrit = attackerBody.RollCrit(),
							bouncesRemaining = bouncesRemaining - 1,
							bouncedObjects = bouncedObjects,
							resetBouncedObjects = resetBouncedObjects,
							procChainMask = procChainMask,
							procCoefficient = procCoefficient,
							damageColorIndex = damageColorIndex
						};
						((Orb)obj).duration = ((Orb)this).duration;
						obj.range = range;
						obj.damageType = damageType;
						obj.tracerEffectPrefab = tracerEffectPrefab;
						obj.hitEffectPrefab = hitEffectPrefab;
						obj.hitSoundString = hitSoundString;
						obj.hitCallback = hitCallback;
						BanditRicochetOrb banditRicochetOrb = obj;
						OrbManager.instance.AddOrb((Orb)(object)banditRicochetOrb);
						return;
					}
				}
			}
			bouncedObjects.Clear();
		}

		public HurtBox PickNextTarget(Vector3 position)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			if (search == null)
			{
				search = new BullseyeSearch();
			}
			search.searchOrigin = position;
			search.searchDirection = Vector3.zero;
			search.teamMaskFilter = TeamMask.allButNeutral;
			((TeamMask)(ref search.teamMaskFilter)).RemoveTeam(teamIndex);
			search.filterByLoS = true;
			search.sortMode = (SortMode)1;
			search.maxDistanceFilter = range;
			search.RefreshCandidates();
			HurtBox val = (from v in search.GetResults()
				where !bouncedObjects.Contains(v.healthComponent)
				select v).FirstOrDefault();
			if (Object.op_Implicit((Object)(object)val))
			{
				bouncedObjects.Add(val.healthComponent);
			}
			return val;
		}
	}
	public static class CustomDamageTypes
	{
		internal static ModdedDamageType ScepterFruitDT;

		internal static ModdedDamageType ScepterCaptainNukeDT;

		internal static ModdedDamageType ScepterBandit2SkullDT;

		internal static ModdedDamageType ScepterDestroy10ArmorDT;

		internal static ModdedDamageType ScepterSlow80For30DT;

		internal static void SetupDamageTypes()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			ScepterFruitDT = DamageAPI.ReserveDamageType();
			ScepterCaptainNukeDT = DamageAPI.ReserveDamageType();
			ScepterBandit2SkullDT = DamageAPI.ReserveDamageType();
			ScepterDestroy10ArmorDT = DamageAPI.ReserveDamageType();
			ScepterSlow80For30DT = DamageAPI.ReserveDamageType();
		}
	}
	public abstract class ItemBase<T> : ItemBase where T : ItemBase<T>
	{
		public static T instance { get; private set; }

		public ItemBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBoilerplate/Item was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class ItemBase
	{
		public static GameObject displayPrefab;

		protected readonly List<LanguageOverlay> languageOverlays = new List<LanguageOverlay>();

		protected readonly Dictionary<string, string> genericLanguageTokens = new Dictionary<string, string>();

		protected readonly Dictionary<string, Dictionary<string, string>> specificLanguageTokens = new Dictionary<string, Dictionary<string, string>>();

		public abstract string ItemName { get; }

		public abstract string ItemLangTokenName { get; }

		public abstract string ItemPickupDesc { get; }

		public abstract string ItemFullDescription { get; }

		public abstract string ItemLore { get; }

		public abstract ItemTier Tier { get; }

		public virtual ItemTag[] ItemTags { get; set; } = (ItemTag[])(object)new ItemTag[0];


		public abstract GameObject ItemModel { get; }

		public abstract Sprite ItemIcon { get; }

		public abstract GameObject ItemDisplay { get; }

		public ItemDef ItemDef { get; set; }

		public virtual bool CanRemove { get; } = true;


		public virtual bool AIBlacklisted { get; set; } = false;


		public virtual bool TILER2_MimicBlacklisted { get; set; } = false;


		public Xoroshiro128Plus rng { get; internal set; }

		public bool languageInstalled { get; private set; } = false;


		public abstract void Init(ConfigFile config);

		public virtual void CreateConfig(ConfigFile config)
		{
		}

		protected void CreateLang()
		{
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_NAME", ItemName);
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_PICKUP", ItemPickupDesc);
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_DESCRIPTION", ItemFullDescription);
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore);
		}

		public virtual ItemDisplayRuleDict CreateDisplayRules()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			return new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[0]);
		}

		protected void CreateItem()
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			if (AIBlacklisted)
			{
				ItemTags = new List<ItemTag>(ItemTags) { (ItemTag)4 }.ToArray();
			}
			ItemDef = ScriptableObject.CreateInstance<ItemDef>();
			((Object)ItemDef).name = "ITEM_" + ItemLangTokenName;
			ItemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME";
			ItemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP";
			ItemDef.descriptionToken = "ITEM_" + ItemLangTokenName + "_DESCRIPTION";
			ItemDef.loreToken = "ITEM_" + ItemLangTokenName + "_LORE";
			ItemDef.pickupModelPrefab = ItemModel;
			ItemDef.pickupIconSprite = ItemIcon;
			ItemDef.hidden = false;
			ItemDef.tags = ItemTags;
			ItemDef.canRemove = CanRemove;
			ItemDef.deprecatedTier = Tier;
			if (ItemTags.Length != 0)
			{
				ItemDef.tags = ItemTags;
			}
			if (TILER2_MimicBlacklisted && Chainloader.PluginInfos.ContainsKey("com.ThinkInvisible.TILER2"))
			{
				TILER2_BlacklistItem(ItemDef);
			}
			ItemAPI.Add(new CustomItem(ItemDef, CreateDisplayRules()));
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void TILER2_BlacklistItem(ItemDef itemDef)
		{
			FakeInventory.blacklist.Add(itemDef);
		}

		public virtual void Hooks()
		{
		}

		protected virtual void SetupMaterials(GameObject modelPrefab)
		{
			Renderer[] componentsInChildren = modelPrefab.GetComponentsInChildren<Renderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].material.shader = Assets.hotpoo;
			}
		}

		public int GetCount(CharacterBody body)
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
			{
				return 0;
			}
			return body.inventory.GetItemCount(ItemDef);
		}

		public int GetCount(CharacterMaster master)
		{
			if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory))
			{
				return 0;
			}
			return master.inventory.GetItemCount(ItemDef);
		}

		public int GetCountSpecific(CharacterBody body, ItemDef itemDef)
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
			{
				return 0;
			}
			return body.inventory.GetItemCount(itemDef);
		}
	}
	internal class ItemHelpers
	{
		public static RendererInfo[] ItemDisplaySetup(GameObject obj)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				array[i] = new RendererInfo
				{
					defaultMaterial = ((Renderer)componentsInChildren[i]).material,
					renderer = (Renderer)(object)componentsInChildren[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}

		public static KeyAssetRuleGroup CreateGenericDisplayRuleGroup(Object keyAsset_, GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			ItemDisplayRule val = CreateDisplayRule(itemPrefab, childName, position, rotation, scale);
			return CreateDisplayRuleGroupWithRules(keyAsset_, val);
		}

		public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			ItemDisplayRule result = default(ItemDisplayRule);
			result.ruleType = (ItemDisplayRuleType)0;
			result.childName = childName;
			result.followerPrefab = itemPrefab;
			result.limbMask = (LimbFlags)0;
			result.localPos = position;
			result.localAngles = rotation;
			result.localScale = scale;
			return result;
		}

		public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules)
		{
			//IL_0003: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			KeyAssetRuleGroup result = default(KeyAssetRuleGroup);
			result.keyAsset = keyAsset_;
			result.displayRuleGroup = new DisplayRuleGroup
			{
				rules = rules
			};
			return result;
		}

		public static string OrderManifestLoreFormatter(string deviceName, string estimatedDelivery, string sentTo, string trackingNumber, string devicePickupDesc, string shippingMethod, string orderDetails)
		{
			string[] value = new string[19]
			{
				"<align=left>Estimated Delivery:<indent=70%>Sent To:</indent></align>",
				"<align=left>" + estimatedDelivery + "<indent=70%>" + sentTo + "</indent></align>",
				"",
				"<indent=1%><style=cIsDamage><size=125%><u>  Shipping Details:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0</u></size></style></indent>",
				"",
				"<indent=2%>-Order: <style=cIsUtility>" + deviceName + "</style></indent>",
				"<indent=4%><style=cStack>Tracking Number:  " + trackingNumber + "</style></indent>",
				"",
				"<indent=2%>-Order Description: " + devicePickupDesc + "</indent>",
				"",
				"<indent=2%>-Shipping Method: <style=cIsHealth>" + shippingMethod + "</style></indent>",
				"",
				"",
				"",
				"<indent=2%>-Order Details: " + orderDetails + "</indent>",
				"",
				"",
				"",
				"<style=cStack>Delivery being brought to you by the brand new </style><style=cIsUtility>Orbital Drop-Crate System (TM)</style>. <style=cStack><u>No refunds.</u></style>"
			};
			return string.Join("\n", value);
		}
	}
	public static class MiscUtil
	{
		public class FilingDictionary<T> : IEnumerable<T>, IEnumerable
		{
			private readonly Dictionary<Type, T> _dict = new Dictionary<Type, T>();

			public int Count => _dict.Count;

			public void Add(T inst)
			{
				_dict.Add(inst.GetType(), inst);
			}

			public void Add<subT>(subT inst) where subT : T
			{
				_dict.Add(typeof(subT), (T)(object)inst);
			}

			public void Set<subT>(subT inst) where subT : T
			{
				_dict[typeof(subT)] = (T)(object)inst;
			}

			public subT Get<subT>() where subT : T
			{
				return (subT)(object)_dict[typeof(subT)];
			}

			public void Remove(T inst)
			{
				_dict.Remove(inst.GetType());
			}

			public void RemoveWhere(Func<T, bool> predicate)
			{
				foreach (T item in _dict.Values.Where(predicate).ToList())
				{
					_dict.Remove(item.GetType());
				}
			}

			public IEnumerator<T> GetEnumerator()
			{
				return _dict.Values.GetEnumerator();
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return GetEnumerator();
			}

			public ReadOnlyFilingDictionary<T> AsReadOnly()
			{
				return new ReadOnlyFilingDictionary<T>(this);
			}
		}

		public class ReadOnlyFilingDictionary<T> : IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
		{
			private readonly FilingDictionary<T> baseCollection;

			public int Count => baseCollection.Count;

			public ReadOnlyFilingDictionary(FilingDictionary<T> baseCollection)
			{
				this.baseCollection = baseCollection;
			}

			public IEnumerator<T> GetEnumerator()
			{
				return baseCollection.GetEnumerator();
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return baseCollection.GetEnumerator();
			}
		}

		public static List<CharacterMaster> AliveList(bool playersOnly = false)
		{
			if (playersOnly)
			{
				return (from x in PlayerCharacterMasterController.instances
					where x.isConnected && Object.op_Implicit((Object)(object)x.master) && x.master.hasBody && x.master.GetBody().healthComponent.alive
					select x.master).ToList();
			}
			return CharacterMaster.readOnlyInstancesList.Where((CharacterMaster x) => x.hasBody && x.GetBody().healthComponent.alive).ToList();
		}

		public static void SpawnItemFromBody(CharacterBody src, int tier, Xoroshiro128Plus rng)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			List<PickupIndex> list = tier switch
			{
				1 => Run.instance.availableTier2DropList, 
				2 => Run.instance.availableTier3DropList, 
				3 => Run.instance.availableLunarItemDropList, 
				4 => Run.instance.availableEquipmentDropList, 
				5 => Run.instance.availableLunarEquipmentDropList, 
				0 => Run.instance.availableTier1DropList, 
				_ => throw new ArgumentOutOfRangeException("tier", tier, "spawnItemFromBody: Item tier must be between 0 and 5 inclusive"), 
			};
			PickupDropletController.CreatePickupDroplet(list[rng.RangeInt(0, list.Count)], src.transform.position, new Vector3(Random.Range(-5f, 5f), 20f, Random.Range(-5f, 5f)));
		}
	}
	public class ModCompat
	{
		internal static bool compatBetterUI;

		public static void Init()
		{
			if (Chainloader.PluginInfos.ContainsKey("com.xoxfaby.BetterUI"))
			{
				BetterUICompatInit();
			}
		}

		public static void BetterUICompatInit()
		{
			compatBetterUI = true;
		}
	}
	public class ArtificerFlamethrower2 : ScepterSkill
	{
		private GameObject projCloud;

		public override SkillDef myDef { get; protected set; }

		public override string oldDescToken { get; protected set; }

		public override string newDescToken { get; protected set; }

		public override string overrideStr => "\n<color=#d299ff>SCEPTER: Hits leave behind a lingering fire cloud.</color>";

		public override string targetBody => "MageBody";

		public override SkillSlot targetSlot => (SkillSlot)3;

		public override int targetVariantIndex => 0;

		internal override void SetupAttributes()
		{
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: 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_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: 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_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: 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_035a: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = LegacyResourcesAPI.Load<SkillDef>("SkillDefs/MageBody/MageBodyFlamethrower");
			myDef = SkillUtil.CloneSkillDef(val);
			string text = "ANCIENTSCEPTER_MAGE_FLAMETHROWERNAME";
			newDescToken = "ANCIENTSCEPTER_MAGE_FLAMETHROWERDESC";
			oldDescToken = val.skillDescriptionToken;
			string text2 = "Dragon's Breath";
			LanguageAPI.Add(text, text2);
			myDef.skillName = val.skillName + "Scepter";
			((Object)myDef).name = myDef.skillName;
			myDef.skillNameToken = text;
			myDef.skillDescriptionToken = newDescToken;
			myDef.icon = Assets.SpriteAssets.ArtificerFlameThrower2;
			ContentAddition.AddSkillDef(myDef);
			projCloud = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/BeetleQueenAcid"), "AncientScepterMageFlamethrowerCloud");
			ProjectileDotZone component = projCloud.GetComponent<ProjectileDotZone>();
			component.lifetime = 10f;
			component.impactEffect = null;
			component.fireFrequency = 2f;
			Transform val2 = projCloud.transform.Find("FX");
			((Component)val2.Find("Spittle")).gameObject.SetActive(false);
			((Component)val2.Find("Decal")).gameObject.SetActive(false);
			((Component)val2.Find("Gas")).gameObject.SetActive(false);
			AnimateShaderAlpha[] components = ((Component)val2).GetComponents<AnimateShaderAlpha>();
			foreach (AnimateShaderAlpha val3 in components)
			{
				((Behaviour)val3).enabled = false;
			}
			GameObject val4 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("prefabs/FireTrail").GetComponent<DamageTrail>().segmentPrefab, ((Component)val2).transform);
			MainModule main = val4.GetComponent<ParticleSystem>().main;
			((MainModule)(ref main)).duration = 10f;
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.05f);
			MinMaxCurve startSizeX = ((MainModule)(ref main)).startSizeX;
			((MinMaxCurve)(ref startSizeX)).constantMin = ((MinMaxCurve)(ref startSizeX)).constantMin * 0.75f;
			((MinMaxCurve)(ref startSizeX)).constantMax = ((MinMaxCurve)(ref startSizeX)).constantMax * 0.75f;
			MinMaxCurve startSizeY = ((MainModule)(ref main)).startSizeY;
			((MinMaxCurve)(ref startSizeY)).constantMin = ((MinMaxCurve)(ref startSizeY)).constantMin * 0.75f;
			((MinMaxCurve)(ref startSizeY)).constantMax = ((MinMaxCurve)(ref startSizeY)).constantMax * 0.75f;
			MinMaxCurve startSizeZ = ((MainModule)(ref main)).startSizeZ;
			((MinMaxCurve)(ref startSizeZ)).constantMin = ((MinMaxCurve)(ref startSizeZ)).constantMin * 0.75f;
			((MinMaxCurve)(ref startSizeZ)).constantMax = ((MinMaxCurve)(ref startSizeZ)).constantMax * 0.75f;
			MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
			((MinMaxCurve)(ref startLifetime)).constantMin = 0.75f;
			((MinMaxCurve)(ref startLifetime)).constantMax = 1.5f;
			((Behaviour)val4.GetComponent<DestroyOnTimer>()).enabled = false;
			val4.transform.localPosition = Vector3.zero;
			val4.transform.localScale = Vector3.one;
			ShapeModule shape = val4.GetComponent<ParticleSystem>().shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).scale = Vector3.one * 1.5f;
			EmissionModule emission = val4.GetComponent<ParticleSystem>().emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(AncientScepterItem.artiFlamePerformanceMode ? 4f : 20f);
			GameObject gameObject = ((Component)val2.Find("Point Light")).gameObject;
			if (AncientScepterItem.artiFlamePerformanceMode)
			{
				Object.Destroy((Object)(object)gameObject);
			}
			else
			{
				Light component2 = gameObject.GetComponent<Light>();
				component2.color = new Color(1f, 0.5f, 0.2f);
				component2.intensity = 3.5f;
				component2.range = 5f;
			}
			ContentAddition.AddProjectile(projCloud);
			if (ModCompat.compatBetterUI)
			{
				doBetterUI();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal void doBetterUI()
		{
			ProcCoefficientCatalog.AddSkill(myDef.skillName, ProcCoefficientCatalog.GetProcCoefficientInfo("MageBodyFlamethrower"));
			ProcCoefficientCatalog.AddToSkill(myDef.skillName, "Fire Cloud", 0f);
		}

		internal override void LoadBehavior()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Flamethrower.FireGauntlet += new Manipulator(IL_FlamethrowerFireGauntlet);
		}

		internal override void UnloadBehavior()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Flamethrower.FireGauntlet -= new Manipulator(IL_FlamethrowerFireGauntlet);
		}

		private void IL_FlamethrowerFireGauntlet(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)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<BulletAttack>(x, "Fire")
			}))
			{
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<BulletAttack, Flamethrower, BulletAttack>>((Func<BulletAttack, Flamethrower, BulletAttack>)delegate(BulletAttack origAttack, Flamethrower state)
			{
				//IL_0039: 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_0084: Expected O, but got Unknown
				CharacterBody characterBody = ((EntityState)state).outer.commonComponents.characterBody;
				object obj;
				if (characterBody == null)
				{
					obj = null;
				}
				else
				{
					SkillLocator skillLocator = characterBody.skillLocator;
					obj = ((skillLocator != null) ? skillLocator.GetSkill(targetSlot) : null);
				}
				GenericSkill val2 = (GenericSkill)obj;
				if (!Object.op_Implicit((Object)(object)val2) || (Object)(object)val2.skillDef != (Object)(object)myDef)
				{
					return origAttack;
				}
				origAttack.hitCallback = (HitCallback)delegate(BulletAttack self, ref BulletHit h)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0062: Unknown result type (might be due to invalid IL or missing references)
					//IL_0067: Unknown result type (might be due to invalid IL or missing references)
					//IL_0074: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					//IL_0098: Unknown result type (might be due to invalid IL or missing references)
					ProjectileManager.instance.FireProjectile(new FireProjectileInfo
					{
						crit = false,
						damage = origAttack.damage,
						damageColorIndex = (DamageColorIndex)0,
						damageTypeOverride = (DamageType)8192,
						force = 0f,
						owner = origAttack.owner,
						position = h.point,
						procChainMask = origAttack.procChainMask,
						projectilePrefab = projCloud,
						target = null
					});
					return BulletAttack.defaultHitCallback.Invoke(origAttack, ref h);
				};
				return origAttack;
			});
		}
	}
	public class ArtificerFlyUp2 : ScepterSkill
	{
		public override SkillDef myDef { get; protected set; }

		public override string oldDescToken { get; protected set; }

		public override string newDescToken { get; protected set; }

		public override string overrideStr => "\n<color=#d299ff>SCEPTER: Double damage, quadruple radius.</color>";

		public override string targetBody => "MageBody";

		public override SkillSlot targetSlot => (SkillSlot)3;

		public override int targetVariantIndex => 1;

		internal override void SetupAttributes()
		{
			SkillDef val = LegacyResourcesAPI.Load<SkillDef>("SkillDefs/MageBody/MageBodyFlyUp");
			myDef = SkillUtil.CloneSkillDef(val);
			string text = "ANCIENTSCEPTER_MAGE_FLYUPNAME";
			newDescToken = "ANCIENTSCEPTER_MAGE_FLYUPDESC";
			oldDescToken = val.skillDescriptionToken;
			string text2 = "Antimatter Surge";
			LanguageAPI.Add(text, text2);
			myDef.skillName = val.skillName + "Scepter";
			((Object)myDef).name = myDef.skillName;
			myDef.skillNameToken = text;
			myDef.skillDescriptionToken = newDescToken;
			myDef.icon = Assets.SpriteAssets.ArtificerFlyUp2;
			ContentAddition.AddSkillDef(myDef);
			if (ModCompat.compatBetterUI)
			{
				doBetterUI();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal void doBetterUI()
		{
			ProcCoefficientCatalog.AddSkill(myDef.skillName, ProcCoefficientCatalog.GetProcCoefficientInfo("MageBodyFlyUp"));
		}

		internal override void LoadBehavior()
		{
			//IL_0008: Unknown result type (might be due t