Decompiled source of HappyHappyHappy v1.7.1

dll/Admiral.dll.old

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Captain.Weapon;
using EntityStates.CaptainSupplyDrop;
using IL.RoR2;
using KinematicCharacterController;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.Captain.Weapon;
using On.RoR2;
using On.RoR2.Orbs;
using On.RoR2.Projectile;
using On.RoR2.Skills;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.Hologram;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using TILER2;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Admiral")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Admiral")]
[assembly: AssemblyTitle("Admiral")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ThinkInvisible.Admiral;

[BepInDependency("com.bepis.r2api", "4.3.21")]
[BepInDependency("com.ThinkInvisible.TILER2", "7.1.0")]
[BepInPlugin("com.ThinkInvisible.Admiral", "Admiral", "2.5.1")]
[R2APISubmoduleDependency(new string[] { "LanguageAPI", "PrefabAPI", "LoadoutAPI", "NetworkingAPI", "UnlockableAPI" })]
public class AdmiralPlugin : BaseUnityPlugin
{
	public const string ModVer = "2.5.1";

	public const string ModName = "Admiral";

	public const string ModGuid = "com.ThinkInvisible.Admiral";

	internal static ManualLogSource logger;

	internal static AssetBundle resources;

	internal static ConfigFile cfgFile;

	private FilingDictionary<T2Module> allModules;

	public void Awake()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		logger = ((BaseUnityPlugin)this).Logger;
		cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "com.ThinkInvisible.Admiral.cfg"), true);
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Admiral.admiral_assets"))
		{
			resources = AssetBundle.LoadFromStream(stream);
		}
		allModules = T2Module.InitModules(new ModInfo
		{
			displayName = "Admiral",
			longIdentifier = "Admiral",
			shortIdentifier = "ADML",
			mainConfigFile = cfgFile
		});
		T2Module.SetupAll_PluginAwake((IEnumerable<T2Module>)allModules);
	}

	public void Start()
	{
		T2Module.SetupAll_PluginStart((IEnumerable<T2Module>)allModules, false);
	}
}
public class CaptainBeaconDecayer : MonoBehaviour
{
	public float lifetime = 15f;

	public bool silent;

	private float stopwatch;

	private GenericEnergyComponent energyCpt;

	public static float lifetimeDropAdjust { get; internal set; } = 4f;


	private void Awake()
	{
		energyCpt = ((Component)this).gameObject.GetComponent<GenericEnergyComponent>();
	}

	private void FixedUpdate()
	{
		//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_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Expected O, but got Unknown
		stopwatch += Time.fixedDeltaTime;
		if (Object.op_Implicit((Object)(object)energyCpt))
		{
			energyCpt.capacity = lifetime;
			energyCpt.energy = lifetime - stopwatch + lifetimeDropAdjust;
		}
		if (stopwatch >= lifetime + lifetimeDropAdjust)
		{
			if (!silent)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/omnieffect/OmniExplosionVFXEngiTurretDeath"), new EffectData
				{
					origin = ((Component)this).transform.position,
					scale = 5f
				}, true);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class BeaconRebalance : T2Module<BeaconRebalance>
{
	internal GameObject muzzleFlashPrefab;

	private bool isNormalRechargeRunning;

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


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


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


	public override string enabledConfigDescription => "Changes all Beacon skills to have cooldown and lifetime, and replaces some variants which are incompatible with this model.";

	public override AutoConfigUpdateActionTypes enabledConfigUpdateActionTypes => (AutoConfigUpdateActionTypes)1;

	public override AutoConfigFlags enabledConfigFlags => (AutoConfigFlags)66;

	public override void SetupAttributes()
	{
		((T2Module)this).SetupAttributes();
		muzzleFlashPrefab = LegacyResourcesAPI.Load<GameObject>("prefabs/effects/muzzleflashes/MuzzleflashSupplyDrop, Healing");
	}

	public override void InstallLanguage()
	{
		((T2Module)this).InstallLanguage();
		((T2Module)this).languageOverlays.Add(LanguageAPI.AddOverlay("CAPTAIN_SPECIAL_DESCRIPTION", "呼叫两个<style=cIsUtility>临时</style>补给信标中的一个。两个信标都有<style=cIsUtility>独立的冷却时间</style>。"));
	}

	public override void Install()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		((T2Module)this).Install();
		CaptainSupplyDropController.UpdateSkillOverrides += new Manipulator(IL_CSDCUpdateSkillOverrides);
		CaptainSupplyDropController.SetSkillOverride += new hook_SetSkillOverride(On_CSDCSetSkillOverride);
		GenericSkill.CalculateFinalRechargeInterval += new hook_CalculateFinalRechargeInterval(On_GSCalculateFinalRechargeInterval);
		GenericSkill.RecalculateMaxStock += new hook_RecalculateMaxStock(On_GSRecalculateMaxStock);
		GenericSkill.AddOneStock += new hook_AddOneStock(On_GSAddOneStock);
		GenericSkill.RunRecharge += new hook_RunRecharge(On_GSRunRecharge);
		GenericSkill.FixedUpdate += new hook_FixedUpdate(On_GSFixedUpdate);
		((T2Module)T2Module<EquipBeacon>.instance).Install();
		((T2Module)T2Module<HackBeacon>.instance).Install();
		((T2Module)T2Module<HealBeacon>.instance).Install();
		((T2Module)T2Module<ShockBeacon>.instance).Install();
		((T2Module)T2Module<StasisBeacon>.instance).Install();
	}

	public override void Uninstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		((T2Module)this).Uninstall();
		CaptainSupplyDropController.UpdateSkillOverrides -= new Manipulator(IL_CSDCUpdateSkillOverrides);
		CaptainSupplyDropController.SetSkillOverride -= new hook_SetSkillOverride(On_CSDCSetSkillOverride);
		GenericSkill.CalculateFinalRechargeInterval -= new hook_CalculateFinalRechargeInterval(On_GSCalculateFinalRechargeInterval);
		GenericSkill.RecalculateMaxStock -= new hook_RecalculateMaxStock(On_GSRecalculateMaxStock);
		GenericSkill.AddOneStock -= new hook_AddOneStock(On_GSAddOneStock);
		GenericSkill.RunRecharge -= new hook_RunRecharge(On_GSRunRecharge);
		GenericSkill.FixedUpdate -= new hook_FixedUpdate(On_GSFixedUpdate);
		((T2Module)T2Module<EquipBeacon>.instance).Uninstall();
		((T2Module)T2Module<HackBeacon>.instance).Uninstall();
		((T2Module)T2Module<HealBeacon>.instance).Uninstall();
		((T2Module)T2Module<ShockBeacon>.instance).Uninstall();
		((T2Module)T2Module<StasisBeacon>.instance).Uninstall();
	}

	private bool SkillIsTemporaryBeacon(SkillDef skillDef)
	{
		if (!((Object)(object)skillDef == (Object)(object)T2Module<EquipBeacon>.instance.skillDef) && !((Object)(object)skillDef == (Object)(object)T2Module<HackBeacon>.instance.skillDef) && !((Object)(object)skillDef == (Object)(object)T2Module<HealBeacon>.instance.skillDef) && !((Object)(object)skillDef == (Object)(object)T2Module<ShockBeacon>.instance.skillDef))
		{
			return (Object)(object)skillDef == (Object)(object)T2Module<StasisBeacon>.instance.skillDef;
		}
		return true;
	}

	private bool SkillIsTemporaryBeacon(GenericSkill skill)
	{
		return SkillIsTemporaryBeacon(skill.skillDef);
	}

	private void On_GSFixedUpdate(orig_FixedUpdate orig, GenericSkill self)
	{
		isNormalRechargeRunning = true;
		orig.Invoke(self);
		isNormalRechargeRunning = false;
	}

	private void On_GSRunRecharge(orig_RunRecharge orig, GenericSkill self, float dt)
	{
		if (SkillIsTemporaryBeacon(self) && !isNormalRechargeRunning)
		{
			dt *= beaconCDRInfluence;
		}
		orig.Invoke(self, dt);
	}

	private void On_GSAddOneStock(orig_AddOneStock orig, GenericSkill self)
	{
		if (SkillIsTemporaryBeacon(self))
		{
			self.rechargeStopwatch += self.finalRechargeInterval * beaconRestockInfluence;
		}
		else
		{
			orig.Invoke(self);
		}
	}

	private void On_GSRecalculateMaxStock(orig_RecalculateMaxStock orig, GenericSkill self)
	{
		orig.Invoke(self);
		if (SkillIsTemporaryBeacon(self))
		{
			self.maxStock = 1;
		}
	}

	private float On_GSCalculateFinalRechargeInterval(orig_CalculateFinalRechargeInterval orig, GenericSkill self)
	{
		float num = orig.Invoke(self);
		if (SkillIsTemporaryBeacon(self))
		{
			return self.baseRechargeInterval * (1f - beaconCDRInfluence) + num * beaconCDRInfluence;
		}
		return num;
	}

	private void On_CSDCSetSkillOverride(orig_SetSkillOverride orig, CaptainSupplyDropController self, ref SkillDef currentSkillDef, SkillDef newSkillDef, GenericSkill component)
	{
		if (!SkillIsTemporaryBeacon(currentSkillDef))
		{
			orig.Invoke(self, ref currentSkillDef, newSkillDef, component);
		}
	}

	private void IL_CSDCUpdateSkillOverrides(ILContext il)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		ILCursor val = new ILCursor(il);
		int maskLocIndex = -1;
		int num = default(int);
		ILLabel val2 = default(ILLabel);
		if (val.TryGotoNext(new Func<Instruction, bool>[5]
		{
			(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref maskLocIndex),
			(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, maskLocIndex),
			(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num),
			(Instruction x) => ILPatternMatchingExt.MatchLdfld<CaptainSupplyDropController>(x, "authorityEnabledSkillsMask"),
			(Instruction x) => ILPatternMatchingExt.MatchBeq(x, ref val2)
		}))
		{
			val.Index = 0;
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, maskLocIndex)
			});
			val.EmitDelegate<Func<byte, byte>>((Func<byte, byte>)((byte orig) => 3));
		}
		else
		{
			AdmiralPlugin.logger.LogError((object)"BeaconRebalance/CSDCUpdateSkillOverrides: Failed to apply IL patch (target instructions not found)");
		}
	}
}
public class CancelOrbitalSkills : T2Module<CancelOrbitalSkills>
{
	public override string enabledConfigDescription => "Allows orbital skills to be cancelled by reactivating the skill.";

	public override void Install()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		((T2Module)this).Install();
		GenericSkill.ExecuteIfReady += new hook_ExecuteIfReady(GenericSkill_ExecuteIfReady);
	}

	public override void Uninstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		((T2Module)this).Uninstall();
		GenericSkill.ExecuteIfReady -= new hook_ExecuteIfReady(GenericSkill_ExecuteIfReady);
	}

	private bool GenericSkill_ExecuteIfReady(orig_ExecuteIfReady orig, GenericSkill self)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		bool flag = orig.Invoke(self);
		if (flag || !Object.op_Implicit((Object)(object)self.stateMachine) || self.stateMachine.HasPendingState())
		{
			return flag;
		}
		Type type = ((object)self.stateMachine.state).GetType();
		SerializableEntityStateType activationState = self.activationState;
		if (type == ((SerializableEntityStateType)(ref activationState)).stateType && (self.stateMachine.state is SetupAirstrike || self.stateMachine.state is SetupSupplyDrop))
		{
			self.stateMachine.SetNextStateToMain();
		}
		return false;
	}
}
public class CatalyzerDartSkill : T2Module<CatalyzerDartSkill>
{
	public class MalevolentCleanseOnHit : MonoBehaviour
	{
	}

	internal UnlockableDef unlockable;

	internal SkillDef skillDef;

	internal GameObject projectilePrefab;

	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillRecharge { get; private set; } = 8f;


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


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


	public override string enabledConfigDescription => "Adds the Catalyzer Dart secondary skill variant.";

	public override AutoConfigFlags enabledConfigFlags => (AutoConfigFlags)72;

	public override void SetupAttributes()
	{
		//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_0094: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
		((T2Module)this).SetupAttributes();
		bool flag = default(bool);
		SerializableEntityStateType activationState = ContentAddition.AddEntityState<EntStateFireCatalyzer>(ref flag);
		projectilePrefab = MiscUtil.ModifyVanillaPrefab("RoR2/Base/Captain/CaptainTazer.prefab", "CaptainCatalyzerProjectile", true, (Func<GameObject, GameObject>)delegate(GameObject projPfbPfb)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			projPfbPfb.GetComponent<ProjectileDamage>().damageType = (DamageType)0;
			((ProjectileExplosion)projPfbPfb.GetComponent<ProjectileImpactExplosion>()).blastRadius = 1f;
			projPfbPfb.AddComponent<MalevolentCleanseOnHit>();
			return projPfbPfb;
		});
		ContentAddition.AddProjectile(projectilePrefab);
		string text = "ADMIRAL_CATALYZER_SKILL_NAME";
		string text2 = "ADMIRAL_CATALYZER_SKILL_DESC";
		string text3 = "Catalyzer Dart";
		LanguageAPI.Add(text, text3);
		LanguageAPI.Add(text2, "Fire a fast dart which <style=cIsHealing>catalyzes all debuffs</style>, converting them to <style=cIsDamage>damage</style>: <style=cIsDamage>300%</style> of the remaining total for DoTs, <style=cIsDamage>1x500%</style> otherwise.");
		skillDef = ScriptableObject.CreateInstance<SkillDef>();
		skillDef.activationStateMachineName = "Weapon";
		skillDef.activationState = activationState;
		skillDef.interruptPriority = (InterruptPriority)1;
		skillDef.baseRechargeInterval = skillRecharge;
		skillDef.baseMaxStock = 1;
		skillDef.rechargeStock = 1;
		skillDef.beginSkillCooldownOnSkillEnd = false;
		skillDef.requiredStock = 1;
		skillDef.stockToConsume = 1;
		skillDef.isCombatSkill = true;
		skillDef.cancelSprintingOnActivation = true;
		skillDef.canceledFromSprinting = false;
		skillDef.mustKeyPress = false;
		skillDef.fullRestockOnAssign = true;
		skillDef.dontAllowPastMaxStocks = false;
		skillDef.skillName = text3;
		skillDef.skillNameToken = text;
		skillDef.skillDescriptionToken = text2;
		skillDef.icon = AdmiralPlugin.resources.LoadAsset<Sprite>("Assets/Admiral/Textures/Icons/icon_AdmiralCatalyzerSkill.png");
		ContentAddition.AddSkillDef(skillDef);
		string text4 = "ACHIEVEMENT_ADMIRAL_" + ((T2Module)this).name.ToUpper(CultureInfo.InvariantCulture) + "_NAME";
		string text5 = "ACHIEVEMENT_ADMIRAL_" + ((T2Module)this).name.ToUpper(CultureInfo.InvariantCulture) + "_DESCRIPTION";
		unlockable = ScriptableObject.CreateInstance<UnlockableDef>();
		unlockable.cachedName = "Admiral_" + ((T2Module)this).name + "Unlockable";
		unlockable.sortScore = 200;
		unlockable.achievementIcon = AdmiralPlugin.resources.LoadAsset<Sprite>("Assets/Admiral/Textures/Icons/icon_AdmiralCatalyzerSkill.png");
		ContentAddition.AddUnlockableDef(unlockable);
		LanguageAPI.Add(text4, "Captain: Hoist By Their Own Petard");
		LanguageAPI.Add(text5, "As Captain, kill 6 other enemies by Shocking the same one.");
	}

	public override void Install()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		((T2Module)this).Install();
		SkillUtil.AddVariant(LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSecondarySkillFamily"), skillDef, unlockable);
		GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
		FireTazer.Fire += new hook_Fire(FireTazer_Fire);
	}

	public override void Uninstall()
	{
		((T2Module)this).Uninstall();
		SkillUtil.RemoveVariant(LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSecondarySkillFamily"), skillDef);
	}

	private void FireTazer_Fire(orig_Fire orig, FireTazer self)
	{
		if (!(self is EntStateFireCatalyzer))
		{
			orig.Invoke(self);
			return;
		}
		GameObject val = FireTazer.projectilePrefab;
		FireTazer.projectilePrefab = projectilePrefab;
		orig.Invoke(self);
		FireTazer.projectilePrefab = val;
	}

	private void GlobalEventManager_onServerDamageDealt(DamageReport obj)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Invalid comparison between Unknown and I4
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: 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_019d: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)obj.victimBody) || !Object.op_Implicit((Object)(object)obj.damageInfo.inflictor) || !Object.op_Implicit((Object)(object)obj.damageInfo.inflictor.GetComponent<MalevolentCleanseOnHit>()))
		{
			return;
		}
		int num = 0;
		for (BuffIndex val = (BuffIndex)0; (int)val < BuffCatalog.buffCount; val = (BuffIndex)(val + 1))
		{
			BuffDef buffDef = BuffCatalog.GetBuffDef(val);
			if (buffDef.isDebuff)
			{
				num += obj.victimBody.GetBuffCount(val);
			}
		}
		EntityStateMachine val2 = ((Component)obj.victimBody).GetComponent<SetStateOnHurt>()?.targetStateMachine;
		if (Object.op_Implicit((Object)(object)val2) && (val2.state is FrozenState || val2.state is StunState || val2.state is ShockState))
		{
			num++;
		}
		float num2 = 0f;
		if (DotController.dotControllerLocator.TryGetValue(((Object)((Component)obj.victimBody).gameObject).GetInstanceID(), out var value))
		{
			List<DotStack> dotStackList = value.dotStackList;
			foreach (DotStack item in dotStackList)
			{
				num2 += item.damage * Mathf.Ceil(item.timer / item.dotDef.interval);
			}
		}
		obj.victimBody.healthComponent.TakeDamage(new DamageInfo
		{
			attacker = obj.attacker,
			crit = false,
			damage = (float)num * obj.attackerBody.damage * evilCleanseNonDoTDamage + num2 * evilCleanseDoTDamage,
			damageType = (DamageType)0,
			procCoefficient = 0f
		});
		Util.CleanseBody(obj.victimBody, true, false, true, true, false, false);
	}
}
[RegisterAchievement("Admiral_CatalyzerDartSkill", "Admiral_CatalyzerDartSkillUnlockable", "CompleteMainEnding", null)]
public class AdmiralCatalyzerAchievement : BaseAchievement
{
	public override bool wantsBodyCallbacks => true;

	public override BodyIndex LookUpRequiredBodyIndex()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return BodyCatalog.FindBodyIndex("CaptainBody");
	}

	public override void OnInstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		((BaseAchievement)this).OnInstall();
		LightningOrb.OnArrival += new hook_OnArrival(LightningOrb_OnArrival);
	}

	public override void OnUninstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		((BaseAchievement)this).OnUninstall();
		LightningOrb.OnArrival -= new hook_OnArrival(LightningOrb_OnArrival);
	}

	private void LightningOrb_OnArrival(orig_OnArrival orig, LightningOrb self)
	{
		orig.Invoke(self);
		if (!(self is ShockedOrb shockedOrb) || self.failedToKill || !Object.op_Implicit((Object)(object)shockedOrb.shockVictim))
		{
			return;
		}
		ShockHelper component = shockedOrb.shockVictim.GetComponent<ShockHelper>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.shockKills++;
			if (component.shockKills >= 6)
			{
				((BaseAchievement)this).Grant();
			}
		}
	}
}
public class EntStateFireCatalyzer : FireTazer
{
}
public class EquipBeacon : T2Module<EquipBeacon>
{
	public class EntStateCallSupplyDropRejuvenator : CallSupplyDropEquipmentRestock
	{
		public override void OnEnter()
		{
			((CallSupplyDropBase)this).supplyDropPrefab = T2Module<EquipBeacon>.instance.beaconPrefab;
			((CallSupplyDropBase)this).muzzleflashEffect = T2Module<BeaconRebalance>.instance.muzzleFlashPrefab;
			((CallSupplyDropBase)this).OnEnter();
		}
	}

	public class EntStateRejuvenatorMainState : EquipmentRestockMainState
	{
		public override bool shouldShowEnergy
		{
			get
			{
				if (T2Module<EquipBeacon>.instance.useInteractable)
				{
					return T2Module<EquipBeacon>.instance.interactableLimited;
				}
				return false;
			}
		}

		public override void OnEnter()
		{
			//IL_0034: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			((BaseCaptainSupplyDropState)this).OnEnter();
			if (NetworkServer.active && !T2Module<EquipBeacon>.instance.useInteractable)
			{
				GameObject val = Object.Instantiate<GameObject>(T2Module<EquipBeacon>.instance.rejuvWardPrefab, ((EntityState)this).outer.commonComponents.transform.position, ((EntityState)this).outer.commonComponents.transform.rotation);
				val.GetComponent<TeamFilter>().teamIndex = ((BaseCaptainSupplyDropState)this).teamFilter.teamIndex;
				NetworkServer.Spawn(val);
			}
		}

		public override void OnInteractionBegin(Interactor activator)
		{
			if (!Object.op_Implicit((Object)(object)activator))
			{
				return;
			}
			CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)component) && !component.HasBuff(T2Module<EquipBeacon>.instance.stimmedBuff))
			{
				if (T2Module<EquipBeacon>.instance.interactableLimited)
				{
					((BaseCaptainSupplyDropState)this).energyComponent.TakeEnergy(base.activationCost);
				}
				component.AddTimedBuff(T2Module<EquipBeacon>.instance.stimmedBuff, T2Module<EquipBeacon>.instance.skillLifetime);
			}
		}

		public override Interactability GetInteractability(Interactor activator)
		{
			if (T2Module<EquipBeacon>.instance.useInteractable)
			{
				if (Object.op_Implicit((Object)(object)activator))
				{
					CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						if (T2Module<EquipBeacon>.instance.interactableLimited && base.activationCost >= ((BaseCaptainSupplyDropState)this).energyComponent.energy)
						{
							return (Interactability)1;
						}
						if (!component.HasBuff(T2Module<EquipBeacon>.instance.stimmedBuff))
						{
							return (Interactability)2;
						}
						return (Interactability)1;
					}
					return (Interactability)0;
				}
				return (Interactability)0;
			}
			return (Interactability)0;
		}

		public override string GetContextString(Interactor activator)
		{
			return Language.GetString("ADMIRAL_SUPPLY_REJUVENATOR_CONTEXT");
		}
	}

	private GameObject rejuvWardPrefab;

	private SkillFamily skillFamily1;

	private SkillFamily skillFamily2;

	private SkillDef origSkillDef;

	internal SkillDef skillDef;

	internal GameObject beaconPrefab;

	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillLifetime { get; private set; } = 20f;


	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillRecharge { get; private set; } = 50f;


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


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


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

	public override string enabledConfigDescription => "Contains config for the T.Beacon: Resupply submodule of Modules.BeaconRebalance. Replaces Beacon: Equipment.";

	public override bool managedEnable => false;

	public BuffDef stimmedBuff { get; private set; }

	public override void SetupAttributes()
	{
		//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_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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		((T2Module)this).SetupAttributes();
		bool flag = default(bool);
		SerializableEntityStateType activationState = ContentAddition.AddEntityState<EntStateCallSupplyDropRejuvenator>(ref flag);
		SerializableEntityStateType mainStateType = ContentAddition.AddEntityState<EntStateRejuvenatorMainState>(ref flag);
		skillFamily1 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop1SkillFamily");
		skillFamily2 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop2SkillFamily");
		origSkillDef = LegacyResourcesAPI.Load<SkillDef>("skilldefs/captainbody/CallSupplyDropEquipmentRestock");
		skillDef = SkillUtil.CloneSkillDef(origSkillDef);
		skillDef.rechargeStock = 1;
		skillDef.baseRechargeInterval = skillRecharge;
		skillDef.skillName = "AdmiralSupplyDropRejuvenator";
		skillDef.skillNameToken = "ADMIRAL_SUPPLY_REJUVENATOR_NAME";
		skillDef.skillDescriptionToken = "ADMIRAL_SUPPLY_REJUVENATOR_DESCRIPTION";
		skillDef.activationState = activationState;
		LanguageAPI.Add(skillDef.skillNameToken, "T.Beacon: Rejuvenator");
		LanguageAPI.Add(skillDef.skillDescriptionToken, "<style=cIsUtility>Temporary beacon</style>. <style=cIsUtility>Buff</style> all nearby allies with <style=cIsUtility>+50% skill recharge rate</style>.");
		ContentAddition.AddSkillDef(skillDef);
		stimmedBuff = ScriptableObject.CreateInstance<BuffDef>();
		((Object)stimmedBuff).name = "Stimmed";
		stimmedBuff.iconSprite = LegacyResourcesAPI.Load<Sprite>("textures/itemicons/texSyringeIcon");
		stimmedBuff.buffColor = Color.red;
		stimmedBuff.canStack = false;
		stimmedBuff.isDebuff = false;
		ContentAddition.AddBuffDef(stimmedBuff);
		LanguageAPI.Add("ADMIRAL_SUPPLY_REJUVENATOR_CONTEXT", "Take stim charge");
		GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/networkedobjects/captainsupplydrops/CaptainSupplyDrop, EquipmentRestock"), "TempSetup, BeaconPrefabPrefab", false);
		CaptainBeaconDecayer captainBeaconDecayer = val.AddComponent<CaptainBeaconDecayer>();
		captainBeaconDecayer.lifetime = skillLifetime;
		if (!useInteractable)
		{
			((Behaviour)val.GetComponent<ProxyInteraction>()).enabled = false;
			((Behaviour)val.GetComponent<GenericEnergyComponent>()).enabled = true;
		}
		val.GetComponent<EntityStateMachine>().mainStateType = mainStateType;
		beaconPrefab = PrefabAPI.InstantiateClone(val, "AdmiralSupplyDrop, Rejuvenator", true);
		Object.Destroy((Object)(object)val);
		GameObject val2 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("prefabs/networkedobjects/captainsupplydrops/CaptainHealingWard"));
		((Behaviour)val2.GetComponent<HealingWard>()).enabled = false;
		Transform val3 = val2.transform.Find("Indicator");
		CaptainBeaconDecayer captainBeaconDecayer2 = val2.AddComponent<CaptainBeaconDecayer>();
		captainBeaconDecayer2.lifetime = skillLifetime - CaptainBeaconDecayer.lifetimeDropAdjust;
		captainBeaconDecayer2.silent = true;
		BuffWard val4 = val2.AddComponent<BuffWard>();
		val4.buffDef = stimmedBuff;
		val4.buffDuration = 1f;
		val4.radius = 10f;
		val4.interval = 1f;
		val4.rangeIndicator = val3;
		((Renderer)((Component)val3.Find("IndicatorRing")).GetComponent<MeshRenderer>()).material.SetColor("_TintColor", new Color(1f, 0.5f, 0f, 1f));
		ParticleSystemRenderer component = ((Component)val3.Find("HealingSymbols")).GetComponent<ParticleSystemRenderer>();
		((Renderer)component).material.SetTexture("_MainTex", LegacyResourcesAPI.Load<Texture>("textures/bufficons/texBuffTeslaIcon"));
		((Renderer)component).material.SetColor("_TintColor", new Color(2f, 0.05f, 0f, 1f));
		component.trailMaterial.SetColor("_TintColor", new Color(2f, 0.05f, 0f, 1f));
		MainModule main = ((Component)val3.Find("Flashes")).GetComponent<ParticleSystem>().main;
		((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.5f, 0.25f, 0f, 1f));
		rejuvWardPrefab = PrefabAPI.InstantiateClone(val2, "CaptainRejuvWard", true);
		Object.Destroy((Object)(object)val2);
	}

	public override void Install()
	{
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		((T2Module)this).Install();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, origSkillDef, skillDef);
			SkillUtil.ReplaceVariant(skillFamily2, origSkillDef, skillDef);
		}
		else
		{
			SkillUtil.AddVariant(skillFamily1, skillDef, (UnlockableDef)null);
			SkillUtil.AddVariant(skillFamily2, skillDef, (UnlockableDef)null);
		}
		SkillDef.OnFixedUpdate += new hook_OnFixedUpdate(On_SkillDefFixedUpdate);
	}

	public override void Uninstall()
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		((T2Module)this).Uninstall();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, skillDef, origSkillDef);
			SkillUtil.ReplaceVariant(skillFamily2, skillDef, origSkillDef);
		}
		else
		{
			SkillUtil.RemoveVariant(skillFamily1, skillDef);
			SkillUtil.RemoveVariant(skillFamily2, skillDef);
		}
		SkillDef.OnFixedUpdate -= new hook_OnFixedUpdate(On_SkillDefFixedUpdate);
	}

	private void On_SkillDefFixedUpdate(orig_OnFixedUpdate orig, SkillDef self, GenericSkill skillSlot)
	{
		if (skillSlot.characterBody.HasBuff(stimmedBuff))
		{
			skillSlot.RunRecharge(Time.fixedDeltaTime * rechargeRate);
		}
		orig.Invoke(self, skillSlot);
	}
}
public class HackBeacon : T2Module<HackBeacon>
{
	public class EntStateCallSupplyDropSpecialOrder : CallSupplyDropHacking
	{
		public override void OnEnter()
		{
			((CallSupplyDropBase)this).supplyDropPrefab = T2Module<HackBeacon>.instance.beaconPrefab;
			((CallSupplyDropBase)this).muzzleflashEffect = T2Module<BeaconRebalance>.instance.muzzleFlashPrefab;
			((CallSupplyDropBase)this).OnEnter();
		}
	}

	public class EntStateSpecialOrderMainState : HackingMainState
	{
		public override bool shouldShowEnergy => true;

		public override void OnEnter()
		{
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			((HackingMainState)this).OnEnter();
			if (!NetworkServer.active)
			{
				return;
			}
			ItemWard component = ((Component)((EntityState)this).outer).gameObject.GetComponent<ItemWard>();
			List<ItemDef> list = (from x in Run.instance.availableTier1DropList
				select ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(x).itemIndex) into x
				where !FakeInventory.blacklist.Contains(x)
				select x).ToList();
			List<ItemDef> list2 = (from x in Run.instance.availableTier2DropList
				select ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(x).itemIndex) into x
				where !FakeInventory.blacklist.Contains(x)
				select x).ToList();
			List<ItemDef> list3 = (from x in Run.instance.availableTier3DropList
				select ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(x).itemIndex) into x
				where !FakeInventory.blacklist.Contains(x)
				select x).ToList();
			if (T2Module<HackBeacon>.instance.splitDHU)
			{
				WeightedSelection<List<ItemDef>> val = new WeightedSelection<List<ItemDef>>(8);
				val.AddChoice(list.Where((ItemDef x) => x.ContainsTag((ItemTag)1)).ToList(), T2Module<HackBeacon>.instance.itemTier1Chance);
				val.AddChoice(list2.Where((ItemDef x) => x.ContainsTag((ItemTag)1)).ToList(), T2Module<HackBeacon>.instance.itemTier2Chance);
				val.AddChoice(list3.Where((ItemDef x) => x.ContainsTag((ItemTag)1)).ToList(), T2Module<HackBeacon>.instance.itemTier3Chance);
				WeightedSelection<List<ItemDef>> val2 = new WeightedSelection<List<ItemDef>>(8);
				val2.AddChoice(list.Where((ItemDef x) => x.ContainsTag((ItemTag)2)).ToList(), T2Module<HackBeacon>.instance.itemTier1Chance);
				val2.AddChoice(list2.Where((ItemDef x) => x.ContainsTag((ItemTag)2)).ToList(), T2Module<HackBeacon>.instance.itemTier2Chance);
				val2.AddChoice(list3.Where((ItemDef x) => x.ContainsTag((ItemTag)2)).ToList(), T2Module<HackBeacon>.instance.itemTier3Chance);
				WeightedSelection<List<ItemDef>> val3 = new WeightedSelection<List<ItemDef>>(8);
				val3.AddChoice(list.Where((ItemDef x) => x.DoesNotContainTag((ItemTag)1) && x.DoesNotContainTag((ItemTag)2)).ToList(), T2Module<HackBeacon>.instance.itemTier1Chance);
				val3.AddChoice(list2.Where((ItemDef x) => x.DoesNotContainTag((ItemTag)1) && x.DoesNotContainTag((ItemTag)2)).ToList(), T2Module<HackBeacon>.instance.itemTier2Chance);
				val3.AddChoice(list3.Where((ItemDef x) => x.DoesNotContainTag((ItemTag)1) && x.DoesNotContainTag((ItemTag)2)).ToList(), T2Module<HackBeacon>.instance.itemTier3Chance);
				int num = ((T2Module)T2Module<HackBeacon>.instance).rng.RangeInt(0, 3);
				for (int i = 0; i < T2Module<HackBeacon>.instance.baseItems + T2Module<HackBeacon>.instance.itemsPerStage * Run.instance.stageClearCount; i++)
				{
					List<ItemDef> list4 = ((WeightedSelection<List<ItemDef>>)(((i + num) % 3) switch
					{
						0 => val, 
						1 => val2, 
						_ => val3, 
					})).Evaluate(Run.instance.treasureRng.nextNormalizedFloat);
					ItemDef val4 = Run.instance.treasureRng.NextElementUniform<ItemDef>(list4);
					component.ServerAddItem(val4.itemIndex);
				}
			}
			else
			{
				WeightedSelection<List<ItemDef>> val5 = new WeightedSelection<List<ItemDef>>(8);
				val5.AddChoice(list, T2Module<HackBeacon>.instance.itemTier1Chance);
				val5.AddChoice(list2, T2Module<HackBeacon>.instance.itemTier2Chance);
				val5.AddChoice(list3, T2Module<HackBeacon>.instance.itemTier3Chance);
				for (int j = 0; j < T2Module<HackBeacon>.instance.baseItems + T2Module<HackBeacon>.instance.itemsPerStage * Run.instance.stageClearCount; j++)
				{
					List<ItemDef> list5 = val5.Evaluate(Run.instance.treasureRng.nextNormalizedFloat);
					ItemDef val6 = Run.instance.treasureRng.NextElementUniform<ItemDef>(list5);
					component.ServerAddItem(val6.itemIndex);
				}
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).fixedAge = ((EntityState)this).fixedAge + Time.fixedDeltaTime;
		}
	}

	private SkillFamily skillFamily1;

	private SkillFamily skillFamily2;

	private SkillDef origSkillDef;

	internal SkillDef skillDef;

	internal GameObject beaconPrefab;

	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillLifetime { get; private set; } = 20f;


	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillRecharge { get; private set; } = 40f;


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


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


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


	[AutoConfigRoOSlider("{0:N3}", 0f, 2f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float itemTier1Chance { get; private set; } = 0.8f;


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


	[AutoConfigRoOSlider("{0:N3}", 0f, 2f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float itemTier3Chance { get; private set; } = 0.01f;


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


	public override string enabledConfigDescription => "Contains config for the T.Beacon: Special Order submodule of Modules.BeaconRebalance. Replaces Beacon: Hacking.";

	public override bool managedEnable => false;

	public override void SetupAttributes()
	{
		//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_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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		((T2Module)this).SetupAttributes();
		bool flag = default(bool);
		SerializableEntityStateType activationState = ContentAddition.AddEntityState<EntStateCallSupplyDropSpecialOrder>(ref flag);
		SerializableEntityStateType mainStateType = ContentAddition.AddEntityState<EntStateSpecialOrderMainState>(ref flag);
		skillFamily1 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop1SkillFamily");
		skillFamily2 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop2SkillFamily");
		origSkillDef = LegacyResourcesAPI.Load<SkillDef>("skilldefs/captainbody/CallSupplyDropHacking");
		skillDef = SkillUtil.CloneSkillDef(origSkillDef);
		skillDef.rechargeStock = 1;
		skillDef.baseRechargeInterval = skillRecharge;
		skillDef.skillName = "AdmiralSupplyDropSpecialOrder";
		skillDef.skillNameToken = "ADMIRAL_SUPPLY_SPECIALORDER_NAME";
		skillDef.skillDescriptionToken = "ADMIRAL_SUPPLY_SPECIALORDER_DESCRIPTION";
		skillDef.activationState = activationState;
		skillDef.icon = origSkillDef.icon;
		LanguageAPI.Add(skillDef.skillNameToken, "T.Beacon: Special Order");
		LanguageAPI.Add(skillDef.skillDescriptionToken, "<style=cIsUtility>Temporary beacon</style>. Requisition a pack of <style=cIsUtility>random, disposable items</style> from your trusty quartermaster. All allies standing near the beacon receive these items until it runs out of energy.");
		ContentAddition.AddSkillDef(skillDef);
		GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/networkedobjects/captainsupplydrops/CaptainSupplyDrop, Hacking"), "TempSetup, BeaconPrefabPrefab", false);
		((Behaviour)val.GetComponent<GenericEnergyComponent>()).enabled = true;
		CaptainBeaconDecayer captainBeaconDecayer = val.AddComponent<CaptainBeaconDecayer>();
		captainBeaconDecayer.lifetime = skillLifetime;
		val.GetComponent<EntityStateMachine>().mainStateType = mainStateType;
		val.AddComponent<Inventory>();
		ItemWard val2 = val.AddComponent<ItemWard>();
		val2.radius = wardRadius;
		Transform val3 = val.transform.Find("ModelBase").Find("captain supply drop").Find("Indicator");
		((Behaviour)((Component)val3).gameObject.GetComponent<ObjectScaleCurve>()).enabled = false;
		Transform child = val3.GetChild(0);
		child.localScale /= 1.5f;
		val2.rangeIndicator = val3;
		beaconPrefab = PrefabAPI.InstantiateClone(val, "AdmiralSupplyDrop, SpecialOrder", true);
		Object.Destroy((Object)(object)val);
	}

	public override void Install()
	{
		((T2Module)this).Install();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, origSkillDef, skillDef);
			SkillUtil.ReplaceVariant(skillFamily2, origSkillDef, skillDef);
		}
		else
		{
			SkillUtil.AddVariant(skillFamily1, skillDef, (UnlockableDef)null);
			SkillUtil.AddVariant(skillFamily2, skillDef, (UnlockableDef)null);
		}
	}

	public override void Uninstall()
	{
		((T2Module)this).Uninstall();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, skillDef, origSkillDef);
			SkillUtil.ReplaceVariant(skillFamily2, skillDef, origSkillDef);
		}
		else
		{
			SkillUtil.RemoveVariant(skillFamily1, skillDef);
			SkillUtil.RemoveVariant(skillFamily2, skillDef);
		}
	}
}
public class HealBeacon : T2Module<HealBeacon>
{
	public class EntStateCallSupplyDropHealing : CallSupplyDropHealing
	{
		public override void OnEnter()
		{
			((CallSupplyDropBase)this).supplyDropPrefab = T2Module<HealBeacon>.instance.beaconPrefab;
			((CallSupplyDropBase)this).muzzleflashEffect = T2Module<BeaconRebalance>.instance.muzzleFlashPrefab;
			((CallSupplyDropBase)this).OnEnter();
		}
	}

	public class EntStateHealingMainState : HealZoneMainState
	{
		public override bool shouldShowEnergy => true;
	}

	private SkillFamily skillFamily1;

	private SkillFamily skillFamily2;

	private SkillDef origSkillDef;

	internal SkillDef skillDef;

	internal GameObject beaconPrefab;

	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillLifetime { get; private set; } = 20f;


	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillRecharge { get; private set; } = 40f;


	public override string enabledConfigDescription => "Contains config for the T.Beacon: Healing submodule of Modules.BeaconRebalance. Replaces Beacon: Healing.";

	public override bool managedEnable => false;

	public override void SetupAttributes()
	{
		//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_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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		((T2Module)this).SetupAttributes();
		bool flag = default(bool);
		SerializableEntityStateType activationState = ContentAddition.AddEntityState<EntStateCallSupplyDropHealing>(ref flag);
		SerializableEntityStateType mainStateType = ContentAddition.AddEntityState<EntStateHealingMainState>(ref flag);
		skillFamily1 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop1SkillFamily");
		skillFamily2 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop2SkillFamily");
		origSkillDef = LegacyResourcesAPI.Load<SkillDef>("skilldefs/captainbody/CallSupplyDropHealing");
		skillDef = SkillUtil.CloneSkillDef(origSkillDef);
		skillDef.rechargeStock = 1;
		skillDef.baseRechargeInterval = skillRecharge;
		skillDef.skillName = "AdmiralSupplyDropHealing";
		skillDef.skillNameToken = "ADMIRAL_SUPPLY_HEALING_NAME";
		skillDef.skillDescriptionToken = "ADMIRAL_SUPPLY_HEALING_DESCRIPTION";
		skillDef.activationState = activationState;
		LanguageAPI.Add(skillDef.skillNameToken, "T.Beacon: Healing");
		LanguageAPI.Add(skillDef.skillDescriptionToken, "<style=cIsUtility>Temporary beacon</style>. <style=cIsHealing>Heal</style> all nearby allies for <style=cIsHealing>10%</style> of their <style=cIsHealing>maximum health</style> every second.");
		ContentAddition.AddSkillDef(skillDef);
		GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/networkedobjects/captainsupplydrops/CaptainSupplyDrop, Healing"), "TempSetup, BeaconPrefabPrefab", false);
		((Behaviour)val.GetComponent<GenericEnergyComponent>()).enabled = true;
		CaptainBeaconDecayer captainBeaconDecayer = val.AddComponent<CaptainBeaconDecayer>();
		captainBeaconDecayer.lifetime = skillLifetime;
		val.GetComponent<EntityStateMachine>().mainStateType = mainStateType;
		beaconPrefab = PrefabAPI.InstantiateClone(val, "AdmiralSupplyDrop, Healing", true);
		Object.Destroy((Object)(object)val);
	}

	public override void Install()
	{
		((T2Module)this).Install();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, origSkillDef, skillDef);
			SkillUtil.ReplaceVariant(skillFamily2, origSkillDef, skillDef);
		}
		else
		{
			SkillUtil.AddVariant(skillFamily1, skillDef, (UnlockableDef)null);
			SkillUtil.AddVariant(skillFamily2, skillDef, (UnlockableDef)null);
		}
	}

	public override void Uninstall()
	{
		((T2Module)this).Uninstall();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, skillDef, origSkillDef);
			SkillUtil.ReplaceVariant(skillFamily2, skillDef, origSkillDef);
		}
		else
		{
			SkillUtil.RemoveVariant(skillFamily1, skillDef);
			SkillUtil.RemoveVariant(skillFamily2, skillDef);
		}
	}
}
public class EntStateCallJumpPad : BaseSkillState
{
	public override void OnEnter()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		((BaseState)this).OnEnter();
		if (((EntityState)this).isAuthority)
		{
			switch (((BaseSkillState)this).activatorSkillSlot.stock)
			{
			case 0:
			{
				CallAirstrike2 val2 = new CallAirstrike2();
				((AimThrowableBase)val2).projectilePrefab = T2Module<OrbitalJumpPadSkill>.instance.jumpPadPrefabProj2;
				((AimThrowableBase)val2).maxDistance = 100f;
				((EntityState)this).outer.SetNextState((EntityState)(object)val2);
				break;
			}
			case 1:
			{
				CallAirstrike1 val = new CallAirstrike1();
				((AimThrowableBase)val).projectilePrefab = T2Module<OrbitalJumpPadSkill>.instance.jumpPadPrefabProj1;
				((AimThrowableBase)val).maxDistance = 100f;
				((EntityState)this).outer.SetNextState((EntityState)(object)val);
				break;
			}
			default:
				AdmiralPlugin.logger.LogError((object)"Jump pad skill has invalid stock count!");
				break;
			}
		}
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)2;
	}
}
public class EntStateSetupJumpPad : SetupAirstrike
{
	public override void OnEnter()
	{
		SkillDef primarySkillDef = SetupAirstrike.primarySkillDef;
		SetupAirstrike.primarySkillDef = T2Module<OrbitalJumpPadSkill>.instance.callSkillDef;
		((SetupAirstrike)this).OnEnter();
		SetupAirstrike.primarySkillDef = primarySkillDef;
	}

	public override void OnExit()
	{
		SkillDef primarySkillDef = SetupAirstrike.primarySkillDef;
		SetupAirstrike.primarySkillDef = T2Module<OrbitalJumpPadSkill>.instance.callSkillDef;
		((SetupAirstrike)this).OnExit();
		SetupAirstrike.primarySkillDef = primarySkillDef;
	}
}
public class OrbitalJumpPadSkill : T2Module<OrbitalJumpPadSkill>
{
	private struct MsgSetJumpPadTarget : INetMessage, ISerializableObject
	{
		private GameObject _targetJumpPad;

		private Vector3 _velocity;

		private Vector3 _targetPos;

		public void Serialize(NetworkWriter writer)
		{
			//IL_000e: 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)
			writer.Write(_targetJumpPad);
			writer.Write(_velocity);
			writer.Write(_targetPos);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			_targetJumpPad = reader.ReadGameObject();
			_velocity = reader.ReadVector3();
			_targetPos = reader.ReadVector3();
		}

		public void OnReceived()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_targetJumpPad))
			{
				GameObject gameObject = ((Component)_targetJumpPad.transform.Find("mdlHumanFan").Find("JumpVolume")).gameObject;
				gameObject.GetComponent<JumpVolume>().jumpVelocity = _velocity;
				LineRenderer component = gameObject.GetComponent<LineRenderer>();
				if (T2Module<OrbitalJumpPadSkill>.instance.showArcs)
				{
					component.SetPositions(CalculateJumpPadPoints(gameObject.transform.position, _targetPos, 5f, 32));
				}
				else
				{
					((Renderer)component).enabled = false;
				}
			}
		}

		public MsgSetJumpPadTarget(GameObject targetJumpPad, Vector3 velocity, Vector3 targetPos)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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)
			_targetJumpPad = targetJumpPad;
			_velocity = velocity;
			_targetPos = targetPos;
		}
	}

	internal SkillDef setupSkillDef;

	internal SkillDef callSkillDef;

	internal UnlockableDef unlockable;

	internal GameObject jumpPadPrefabBase;

	internal GameObject jumpPadPrefabProj1;

	internal GameObject jumpPadPrefabProj2;

	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillLifetime { get; private set; } = 20f;


	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillRecharge { get; private set; } = 50f;


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


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


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


	public override string enabledConfigDescription => "Adds the Orbital Jump Pad utility skill variant.";

	public override AutoConfigFlags enabledConfigFlags => (AutoConfigFlags)72;

	public override void SetupAttributes()
	{
		//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_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_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: 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_02c8: Unknown result type (might be due to invalid IL or missing references)
		((T2Module)this).SetupAttributes();
		bool flag = default(bool);
		SerializableEntityStateType activationState = ContentAddition.AddEntityState<EntStateCallJumpPad>(ref flag);
		SerializableEntityStateType activationState2 = ContentAddition.AddEntityState<EntStateSetupJumpPad>(ref flag);
		NetworkingAPI.RegisterMessageType<MsgSetJumpPadTarget>();
		string text = "ACHIEVEMENT_ADMIRAL_" + ((T2Module)this).name.ToUpper(CultureInfo.InvariantCulture) + "_NAME";
		string text2 = "ACHIEVEMENT_ADMIRAL_" + ((T2Module)this).name.ToUpper(CultureInfo.InvariantCulture) + "_DESCRIPTION";
		unlockable = ScriptableObject.CreateInstance<UnlockableDef>();
		unlockable.cachedName = "Admiral_" + ((T2Module)this).name + "Unlockable";
		unlockable.sortScore = 200;
		unlockable.achievementIcon = AdmiralPlugin.resources.LoadAsset<Sprite>("Assets/Admiral/Textures/Icons/icon_AdmiralJumpPadSkill.png");
		ContentAddition.AddUnlockableDef(unlockable);
		LanguageAPI.Add(text, "Captain: Damn The Torpedoes");
		LanguageAPI.Add(text2, "As Captain, nail a very speedy target with an Orbital Probe.");
		jumpPadPrefabBase = MiscUtil.ModifyVanillaPrefab("RoR2/Base/frozenwall/HumanFan.prefab", "CaptainJumpPad", true, (Func<GameObject, GameObject>)ModifyJumpPadPrefab);
		jumpPadPrefabProj1 = MiscUtil.ModifyVanillaPrefab("RoR2/Base/Captain/CaptainAirstrikeProjectile1.prefab", "CaptainJumpPadProjectile1", true, (Func<GameObject, GameObject>)ModifyAirstrike1Prefab);
		ContentAddition.AddProjectile(jumpPadPrefabProj1);
		jumpPadPrefabProj2 = MiscUtil.ModifyVanillaPrefab("RoR2/Base/Captain/CaptainAirstrikeProjectile1.prefab", "CaptainJumpPadProjectile2", true, (Func<GameObject, GameObject>)ModifyAirstrike2Prefab);
		ContentAddition.AddProjectile(jumpPadPrefabProj2);
		string text3 = "ADMIRAL_JUMPPAD_SKILL_NAME";
		string text4 = "ADMIRAL_JUMPPAD_SKILL_DESC";
		string text5 = "Orbital Jump Pad";
		LanguageAPI.Add(text3, text5);
		LanguageAPI.Add(text4, "Request an Orbital Jump Pad from the <style=cIsUtility>UES Safe Travels</style>. Fire once to set the jump pad, then again to set its target (both within <style=cIsUtility>80 m</style>).");
		setupSkillDef = ScriptableObject.CreateInstance<SkillDef>();
		setupSkillDef.activationStateMachineName = "Skillswap";
		setupSkillDef.activationState = activationState2;
		setupSkillDef.interruptPriority = (InterruptPriority)1;
		setupSkillDef.baseRechargeInterval = skillRecharge;
		setupSkillDef.baseMaxStock = ((!doubleStock) ? 1 : 2);
		setupSkillDef.rechargeStock = ((!doubleStock) ? 1 : 2);
		setupSkillDef.beginSkillCooldownOnSkillEnd = true;
		setupSkillDef.requiredStock = 1;
		setupSkillDef.stockToConsume = 1;
		setupSkillDef.isCombatSkill = false;
		setupSkillDef.cancelSprintingOnActivation = true;
		setupSkillDef.canceledFromSprinting = true;
		setupSkillDef.mustKeyPress = true;
		setupSkillDef.fullRestockOnAssign = true;
		setupSkillDef.skillName = text5;
		setupSkillDef.skillNameToken = text3;
		setupSkillDef.skillDescriptionToken = text4;
		setupSkillDef.icon = AdmiralPlugin.resources.LoadAsset<Sprite>("Assets/Admiral/Textures/Icons/icon_AdmiralJumpPadSkill.png");
		ContentAddition.AddSkillDef(setupSkillDef);
		callSkillDef = ScriptableObject.CreateInstance<SkillDef>();
		callSkillDef.activationStateMachineName = "Weapon";
		callSkillDef.activationState = activationState;
		callSkillDef.interruptPriority = (InterruptPriority)2;
		callSkillDef.baseRechargeInterval = 0f;
		callSkillDef.baseMaxStock = 2;
		callSkillDef.rechargeStock = 0;
		callSkillDef.beginSkillCooldownOnSkillEnd = true;
		callSkillDef.requiredStock = 1;
		callSkillDef.stockToConsume = 1;
		callSkillDef.isCombatSkill = false;
		callSkillDef.cancelSprintingOnActivation = true;
		callSkillDef.canceledFromSprinting = true;
		callSkillDef.mustKeyPress = true;
		callSkillDef.fullRestockOnAssign = true;
		callSkillDef.dontAllowPastMaxStocks = true;
		callSkillDef.skillName = text5;
		callSkillDef.skillNameToken = text3;
		callSkillDef.skillDescriptionToken = text4;
		callSkillDef.icon = AdmiralPlugin.resources.LoadAsset<Sprite>("Assets/Admiral/Textures/Icons/icon_AdmiralJumpPadSkill.png");
		ContentAddition.AddSkillDef(callSkillDef);
	}

	private void ProjectileExplosion_DetonateServer(orig_DetonateServer orig, ProjectileExplosion self)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: 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)
		orig.Invoke(self);
		if (!NetworkServer.active)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<OrbitalJumpPad1ImpactEventFlag>()))
		{
			GameObject owner = ((Component)self).GetComponent<ProjectileController>().owner;
			if (Object.op_Implicit((Object)(object)owner))
			{
				OrbitalJumpPadDeployTracker orbitalJumpPadDeployTracker = owner.GetComponent<OrbitalJumpPadDeployTracker>();
				if (!Object.op_Implicit((Object)(object)orbitalJumpPadDeployTracker))
				{
					orbitalJumpPadDeployTracker = owner.AddComponent<OrbitalJumpPadDeployTracker>();
				}
				GameObject val = Object.Instantiate<GameObject>(jumpPadPrefabBase, ((Component)self).transform.position, ((Component)self).transform.rotation);
				if (Object.op_Implicit((Object)(object)orbitalJumpPadDeployTracker.prevPadBase))
				{
					Object.Destroy((Object)(object)orbitalJumpPadDeployTracker.prevPadBase);
				}
				orbitalJumpPadDeployTracker.prevPadBase = orbitalJumpPadDeployTracker.lastPadBase;
				orbitalJumpPadDeployTracker.lastPadBase = val;
				NetworkServer.Spawn(val);
			}
		}
		else
		{
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<OrbitalJumpPad2ImpactEventFlag>()))
			{
				return;
			}
			GameObject owner2 = ((Component)self).GetComponent<ProjectileController>().owner;
			if (!Object.op_Implicit((Object)(object)owner2))
			{
				return;
			}
			OrbitalJumpPadDeployTracker component = owner2.GetComponent<OrbitalJumpPadDeployTracker>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.lastPadBase))
			{
				(Vector3, float) tuple = CalculateJumpPadTrajectory(component.lastPadBase.transform.position, ((Component)self).transform.position, 5f);
				if (!float.IsNaN(tuple.Item1.y))
				{
					NetMessageExtensions.Send((INetMessage)(object)new MsgSetJumpPadTarget(component.lastPadBase, tuple.Item1, ((Component)self).transform.position), (NetworkDestination)1);
					component.lastPadBase.GetComponent<ChestBehavior>().Open();
				}
				else
				{
					Object.Destroy((Object)(object)component.lastPadBase);
				}
			}
		}
	}

	public override void Install()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		((T2Module)this).Install();
		JumpVolume.OnTriggerStay += new hook_OnTriggerStay(JumpVolume_OnTriggerStay);
		ProjectileExplosion.DetonateServer += new hook_DetonateServer(ProjectileExplosion_DetonateServer);
		SkillFamily val = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainUtilitySkillFamily");
		SkillUtil.AddVariant(val, setupSkillDef, unlockable);
	}

	public override void Uninstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		((T2Module)this).Uninstall();
		JumpVolume.OnTriggerStay -= new hook_OnTriggerStay(JumpVolume_OnTriggerStay);
		ProjectileExplosion.DetonateServer -= new hook_DetonateServer(ProjectileExplosion_DetonateServer);
		SkillFamily val = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainUtilitySkillFamily");
		SkillUtil.RemoveVariant(val, setupSkillDef);
	}

	public static (Vector3, float) CalculateJumpPadTrajectory(Vector3 source, Vector3 target, float extraPeakHeight)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = target - source;
		float y = val.y;
		float num = Mathf.Max(new float[3]
		{
			Mathf.Max(y, 0f) + extraPeakHeight,
			y,
			0f
		});
		float num2 = 0f - Physics.gravity.y;
		float num3 = Mathf.Sqrt(2f * num2 * num);
		float num4 = Mathf.Sqrt(2f) / num2 * (Mathf.Sqrt(num2 * (num - y)) + Mathf.Sqrt(num2 * num));
		float num5 = val.x / num4;
		float num6 = val.z / num4;
		return (new Vector3(num5, num3, num6), num4);
	}

	public static Vector3[] CalculateJumpPadPoints(Vector3 source, Vector3 target, float extraPeakHeight, int displayPointsToGenerate)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = target - source;
		float y = val.y;
		float num = Mathf.Max(new float[3]
		{
			Mathf.Max(y, 0f) + extraPeakHeight,
			y,
			0f
		});
		float num2 = 0f - Physics.gravity.y;
		float num3 = Mathf.Sqrt(2f * num2 * num);
		float num4 = Mathf.Sqrt(2f) / num2 * (Mathf.Sqrt(num2 * (num - y)) + Mathf.Sqrt(num2 * num));
		float num5 = val.x / num4;
		float num6 = val.z / num4;
		Vector3 val2 = default(Vector3);
		((Vector3)(ref val2))..ctor(num5, num3, num6);
		Vector3[] array = (Vector3[])(object)new Vector3[displayPointsToGenerate];
		float num7 = num4 / ((float)displayPointsToGenerate - 1f);
		for (int i = 0; i < displayPointsToGenerate; i++)
		{
			array[i] = Trajectory.CalculatePositionAtTime(source, val2, num7 * (float)i);
		}
		return array;
	}

	private GameObject ModifyJumpPadPrefab(GameObject origPrefab)
	{
		//IL_0015: 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_0075: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Expected O, but got Unknown
		origPrefab.transform.localScale = new Vector3(0.75f, 0.125f, 0.75f);
		Transform val = origPrefab.transform.Find("mdlHumanFan").Find("JumpVolume");
		Transform val2 = val.Find("LoopParticles").Find("Particle System");
		val2.localScale = new Vector3(0.25f, 0.25f, 0.25f);
		MainModule main = ((Component)val2).gameObject.GetComponent<ParticleSystem>().main;
		((MainModule)(ref main)).startSpeed = new MinMaxCurve(6f);
		Transform val3 = val.Find("LoopParticles").Find("ForwardDust");
		val3.localScale = new Vector3(0.25f, 0.25f, 0.25f);
		MainModule main2 = ((Component)val3).gameObject.GetComponent<ParticleSystem>().main;
		((MainModule)(ref main2)).startSpeed = new MinMaxCurve(0.5f, 12f);
		Transform val4 = val.Find("ActivateParticles").Find("ForwardDust");
		val4.localScale = new Vector3(0.3f, 0.3f, 0.3f);
		MainModule main3 = ((Component)val4).gameObject.GetComponent<ParticleSystem>().main;
		((MainModule)(ref main3)).startSpeed = new MinMaxCurve(0.75f, 15f);
		Transform val5 = val.Find("ActivateParticles").Find("Circle");
		val5.localScale = new Vector3(0.25f, 0.25f, 0.125f);
		LineRenderer val6 = ((Component)val).gameObject.AddComponent<LineRenderer>();
		((Renderer)val6).material = Object.Instantiate<Material>(LegacyResourcesAPI.Load<Material>("materials/matBlueprintsOk"));
		((Renderer)val6).material.SetColor("_TintColor", new Color(2f, 0.2f, 10f, 3f));
		val6.positionCount = 32;
		List<Keyframe> list = new List<Keyframe>();
		for (int i = 0; i < val6.positionCount; i++)
		{
			list.Add(new Keyframe((float)i / 32f, (1f - MiscUtil.Wrap((float)i / 8f, 0f, 1f)) * 0.875f));
		}
		val6.widthCurve = new AnimationCurve
		{
			keys = list.ToArray()
		};
		((Behaviour)origPrefab.GetComponent<PurchaseInteraction>()).enabled = false;
		((Behaviour)origPrefab.GetComponent<HologramProjector>()).enabled = false;
		((Behaviour)origPrefab.GetComponent<OccupyNearbyNodes>()).enabled = false;
		((Component)val).gameObject.AddComponent<TemporaryFallProtectionProvider>();
		CaptainBeaconDecayer captainBeaconDecayer = origPrefab.AddComponent<CaptainBeaconDecayer>();
		captainBeaconDecayer.lifetime = skillLifetime;
		return origPrefab;
	}

	private GameObject ModifyAirstrike1Prefab(GameObject origPrefab)
	{
		ProjectileImpactExplosion component = origPrefab.GetComponent<ProjectileImpactExplosion>();
		((ProjectileExplosion)component).blastDamageCoefficient = 0.1f;
		((ProjectileExplosion)component).blastRadius = 5f;
		component.lifetime = 0.5f;
		origPrefab.AddComponent<OrbitalJumpPad1ImpactEventFlag>();
		return origPrefab;
	}

	private GameObject ModifyAirstrike2Prefab(GameObject origPrefab)
	{
		ProjectileImpactExplosion component = origPrefab.GetComponent<ProjectileImpactExplosion>();
		((ProjectileExplosion)component).blastDamageCoefficient = 0.05f;
		((ProjectileExplosion)component).blastRadius = 2.5f;
		component.lifetime = 0.5f;
		origPrefab.AddComponent<OrbitalJumpPad2ImpactEventFlag>();
		return origPrefab;
	}

	private void JumpVolume_OnTriggerStay(orig_OnTriggerStay orig, JumpVolume self, Collider other)
	{
		orig.Invoke(self, other);
		TemporaryFallProtectionProvider component = ((Component)self).GetComponent<TemporaryFallProtectionProvider>();
		CharacterBody component2 = ((Component)other).GetComponent<CharacterBody>();
		if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.characterMotor))
		{
			TemporaryFallDamageProtection temporaryFallDamageProtection = ((Component)other).GetComponent<TemporaryFallDamageProtection>();
			if (!Object.op_Implicit((Object)(object)temporaryFallDamageProtection))
			{
				temporaryFallDamageProtection = ((Component)other).gameObject.AddComponent<TemporaryFallDamageProtection>();
			}
			temporaryFallDamageProtection.Apply();
		}
	}
}
public class TemporaryFallDamageProtection : NetworkBehaviour
{
	private CharacterBody attachedBody;

	private bool hasProtection;

	private bool disableNextFrame;

	private bool disableN2f;

	private void FixedUpdate()
	{
		//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_003c: Unknown result type (might be due to invalid IL or missing references)
		if (disableN2f)
		{
			disableN2f = false;
			disableNextFrame = true;
		}
		else if (disableNextFrame)
		{
			disableNextFrame = false;
			hasProtection = false;
			CharacterBody obj = attachedBody;
			obj.bodyFlags = (BodyFlags)(obj.bodyFlags & -2);
		}
		else if (hasProtection && ((BaseCharacterController)attachedBody.characterMotor).Motor.GroundingStatus.IsStableOnGround && !((BaseCharacterController)attachedBody.characterMotor).Motor.LastGroundingStatus.IsStableOnGround)
		{
			disableN2f = true;
		}
	}

	private void Awake()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		attachedBody = ((Component)this).GetComponent<CharacterBody>();
		attachedBody.characterMotor.onMovementHit += new MovementHitDelegate(CharacterMotor_onMovementHit);
	}

	public void Apply()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		hasProtection = true;
		CharacterBody obj = attachedBody;
		obj.bodyFlags = (BodyFlags)(obj.bodyFlags | 1);
	}

	private void CharacterMotor_onMovementHit(ref MovementHitInfo movementHitInfo)
	{
		if (hasProtection && !disableN2f && !disableNextFrame)
		{
			disableN2f = true;
		}
	}
}
public class TemporaryFallProtectionProvider : MonoBehaviour
{
}
public class OrbitalJumpPadDeployTracker : MonoBehaviour
{
	public GameObject lastPadBase;

	public GameObject prevPadBase;
}
public class OrbitalJumpPad1ImpactEventFlag : MonoBehaviour
{
}
public class OrbitalJumpPad2ImpactEventFlag : MonoBehaviour
{
}
[RegisterAchievement("Admiral_OrbitalJumpPadSkill", "Admiral_OrbitalJumpPadSkillUnlockable", "CompleteMainEnding", null)]
public class AdmiralJumpPadAchievement : BaseAchievement
{
	private int projTestInd1 = -1;

	private int projTestInd2 = -1;

	private int projTestInd3 = -1;

	public override bool wantsBodyCallbacks => true;

	public override BodyIndex LookUpRequiredBodyIndex()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return BodyCatalog.FindBodyIndex("CaptainBody");
	}

	public override void OnInstall()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		((BaseAchievement)this).OnInstall();
		GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
		CharacterBody.Awake += new hook_Awake(CharacterBody_Awake);
		projTestInd1 = ProjectileCatalog.FindProjectileIndex("CaptainAirstrikeProjectile1");
		projTestInd2 = ProjectileCatalog.FindProjectileIndex("CaptainAirstrikeProjectile2");
		projTestInd3 = ProjectileCatalog.FindProjectileIndex("CaptainAirstrikeProjectile3");
	}

	public override void OnUninstall()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		((BaseAchievement)this).OnUninstall();
		GlobalEventManager.onServerDamageDealt -= GlobalEventManager_onServerDamageDealt;
		CharacterBody.Awake -= new hook_Awake(CharacterBody_Awake);
	}

	private void CharacterBody_Awake(orig_Awake orig, CharacterBody self)
	{
		orig.Invoke(self);
		((Component)self).gameObject.AddComponent<AverageSpeedTracker>();
	}

	private void GlobalEventManager_onServerDamageDealt(DamageReport obj)
	{
		//IL_00c4: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
		if (!((BaseAchievement)this).meetsBodyRequirement || !Object.op_Implicit((Object)(object)obj.victimBody) || !Object.op_Implicit((Object)(object)obj.damageInfo.attacker) || !Object.op_Implicit((Object)(object)obj.damageInfo.inflictor) || NetworkUser.readOnlyLocalPlayersList.Count == 0)
		{
			return;
		}
		GameObject attacker = obj.damageInfo.attacker;
		CharacterBody currentBody = NetworkUser.readOnlyLocalPlayersList[0].GetCurrentBody();
		if ((Object)(object)attacker != (Object)(object)((currentBody != null) ? ((Component)currentBody).gameObject : null))
		{
			return;
		}
		int projectileIndex = ProjectileCatalog.GetProjectileIndex(obj.damageInfo.inflictor);
		if (projectileIndex != projTestInd1 && projectileIndex != projTestInd2 && projectileIndex != projTestInd3)
		{
			return;
		}
		AverageSpeedTracker component = ((Component)obj.victimBody).GetComponent<AverageSpeedTracker>();
		if (Object.op_Implicit((Object)(object)component))
		{
			float num = component.QuerySpeed();
			Vector3 val = obj.damageInfo.position - obj.damageInfo.inflictor.transform.position;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (num > 20f && magnitude < 4f)
			{
				((BaseAchievement)this).Grant();
			}
		}
	}
}
public class AverageSpeedTracker : MonoBehaviour
{
	private readonly List<Vector3> positions = new List<Vector3>();

	private readonly List<float> deltas = new List<float>();

	public float pollingRate = 0.2f;

	private uint _history = 5u;

	private float stopwatch;

	public uint history
	{
		get
		{
			return _history;
		}
		set
		{
			positions.Clear();
			deltas.Clear();
			_history = value;
		}
	}

	private void FixedUpdate()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch > pollingRate)
		{
			positions.Add(((Component)this).transform.position);
			deltas.Add(stopwatch);
			if (positions.Count >= _history)
			{
				positions.RemoveAt(0);
				deltas.RemoveAt(0);
			}
			stopwatch = 0f;
		}
	}

	public float QuerySpeed()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: 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)
		float num = 0f;
		for (int i = 0; i < positions.Count - 1; i++)
		{
			float num2 = num;
			Vector3 val = positions[i + 1] - positions[i];
			num = num2 + ((Vector3)(ref val)).magnitude / deltas[i + 1];
		}
		return num;
	}
}
public class OrbitalSkillsAnywhere : T2Module<OrbitalSkillsAnywhere>
{
	private Hook CUOSHook;

	public override string enabledConfigDescription => "Allows orbital skills to be used anywhere except Bazaar.";

	public override void SetupBehavior()
	{
		//IL_0035: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		((T2Module)this).SetupBehavior();
		MethodInfo methodCached = Reflection.GetMethodCached(typeof(CaptainOrbitalSkillDef), "get_isAvailable");
		MethodInfo methodCached2 = Reflection.GetMethodCached(typeof(OrbitalSkillsAnywhere), "Hook_Get_IsAvailable");
		CUOSHook = new Hook((MethodBase)methodCached, methodCached2, new HookConfig
		{
			ManualApply = true
		});
	}

	public override void Install()
	{
		((T2Module)this).Install();
		CUOSHook.Apply();
	}

	public override void Uninstall()
	{
		((T2Module)this).Uninstall();
		CUOSHook.Undo();
	}

	private static bool Hook_Get_IsAvailable(CaptainOrbitalSkillDef self)
	{
		return SceneCatalog.mostRecentSceneDef.baseSceneName != "bazaar";
	}
}
public class ShockBeacon : T2Module<ShockBeacon>
{
	public class EntStateCallSupplyDropShocking : CallSupplyDropShocking
	{
		public override void OnEnter()
		{
			((CallSupplyDropBase)this).supplyDropPrefab = T2Module<ShockBeacon>.instance.beaconPrefab;
			((CallSupplyDropBase)this).muzzleflashEffect = T2Module<BeaconRebalance>.instance.muzzleFlashPrefab;
			((CallSupplyDropBase)this).OnEnter();
		}
	}

	public class EntStateShockingMainState : ShockZoneMainState
	{
		public override bool shouldShowEnergy => true;

		public override void FixedUpdate()
		{
			((EntityState)this).fixedAge = ((EntityState)this).fixedAge + Time.fixedDeltaTime;
			base.shockTimer += Time.fixedDeltaTime;
			if (base.shockTimer > T2Module<ShockBeacon>.instance.shockRate)
			{
				base.shockTimer -= T2Module<ShockBeacon>.instance.shockRate;
				((ShockZoneMainState)this).Shock();
			}
		}
	}

	private SkillFamily skillFamily1;

	private SkillFamily skillFamily2;

	private SkillDef origSkillDef;

	internal SkillDef skillDef;

	internal GameObject beaconPrefab;

	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillLifetime { get; private set; } = 8f;


	[AutoConfigRoOSlider("{0:N0} s", 0f, 120f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float skillRecharge { get; private set; } = 24f;


	[AutoConfigRoOSlider("{0:N2} s", 0f, 30f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float shockRate { get; private set; } = 0.95f;


	public override string enabledConfigDescription => "Contains config for the T.Beacon: Shocking submodule of Modules.BeaconRebalance. Replaces Beacon: Shocking.";

	public override bool managedEnable => false;

	public override void SetupAttributes()
	{
		//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_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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		((T2Module)this).SetupAttributes();
		bool flag = default(bool);
		SerializableEntityStateType activationState = ContentAddition.AddEntityState<EntStateCallSupplyDropShocking>(ref flag);
		SerializableEntityStateType mainStateType = ContentAddition.AddEntityState<EntStateShockingMainState>(ref flag);
		skillFamily1 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop1SkillFamily");
		skillFamily2 = LegacyResourcesAPI.Load<SkillFamily>("skilldefs/captainbody/CaptainSupplyDrop2SkillFamily");
		origSkillDef = LegacyResourcesAPI.Load<SkillDef>("skilldefs/captainbody/CallSupplyDropShocking");
		skillDef = SkillUtil.CloneSkillDef(origSkillDef);
		skillDef.rechargeStock = 1;
		skillDef.baseRechargeInterval = skillRecharge;
		skillDef.skillName = "AdmiralSupplyDropShocking";
		skillDef.skillNameToken = "ADMIRAL_SUPPLY_SHOCKING_NAME";
		skillDef.skillDescriptionToken = "ADMIRAL_SUPPLY_SHOCKING_DESCRIPTION";
		skillDef.activationState = activationState;
		LanguageAPI.Add(skillDef.skillNameToken, "T.Beacon: Shocking");
		LanguageAPI.Add(skillDef.skillDescriptionToken, "<style=cIsUtility>Temporary beacon</style>. <style=cIsDamage>Shock</style> all nearby enemies rapidly for a short time.");
		ContentAddition.AddSkillDef(skillDef);
		GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/networkedobjects/captainsupplydrops/CaptainSupplyDrop, Shocking"), "TempSetup, BeaconPrefabPrefab", false);
		((Behaviour)val.GetComponent<GenericEnergyComponent>()).enabled = true;
		CaptainBeaconDecayer captainBeaconDecayer = val.AddComponent<CaptainBeaconDecayer>();
		captainBeaconDecayer.lifetime = skillLifetime;
		val.GetComponent<EntityStateMachine>().mainStateType = mainStateType;
		beaconPrefab = PrefabAPI.InstantiateClone(val, "AdmiralSupplyDrop, Shocking", true);
		Object.Destroy((Object)(object)val);
	}

	public override void Install()
	{
		((T2Module)this).Install();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, origSkillDef, skillDef);
			SkillUtil.ReplaceVariant(skillFamily2, origSkillDef, skillDef);
		}
		else
		{
			SkillUtil.AddVariant(skillFamily1, skillDef, (UnlockableDef)null);
			SkillUtil.AddVariant(skillFamily2, skillDef, (UnlockableDef)null);
		}
	}

	public override void Uninstall()
	{
		((T2Module)this).Uninstall();
		if (T2Module<BeaconRebalance>.instance.removeOriginals)
		{
			SkillUtil.ReplaceVariant(skillFamily1, skillDef, origSkillDef);
			SkillUtil.ReplaceVariant(skillFamily2, skillDef, origSkillDef);
		}
		else
		{
			SkillUtil.RemoveVariant(skillFamily1, skillDef);
			SkillUtil.RemoveVariant(skillFamily2, skillDef);
		}
	}
}
internal class ShockedOrb : LightningOrb
{
	public GameObject shockVictim;
}
public class ShockStatusTweaks : T2Module<ShockStatusTweaks>
{
	[AutoConfigRoOSlider("{0:P2}", 0f, 1f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float shockChance { get; private set; } = 0.033f;


	[AutoConfigRoOSlider("{0:P1}", 0f, 2f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float shockDamageFrac { get; private set; } = 0.02f;


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


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


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


	public override string enabledConfigDescription => "Removes the health threshold from the Shocked status and causes it to deal AoE damage based on victim max health.";

	public override AutoConfigUpdateActionTypes enabledConfigUpdateActionTypes => (AutoConfigUpdateActionTypes)1;

	public override void InstallLanguage()
	{
		((T2Module)this).InstallLanguage();
		((T2Module)this).languageOverlays.Add(LanguageAPI.AddOverlay("KEYWORD_SHOCKING", "<style=cKeywordName>震荡</style><style=cSub>打断敌人并暂时眩晕他们。受到震荡的敌人每秒会对附近<style=cIsDamage>它们的盟友</style>造成伤害,伤害量仅为其最大生命值的一小部分。"));
	}

	public override void Install()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		((T2Module)this).Install();
		ShockState.OnEnter += new hook_OnEnter(On_ShockStateOnEnter);
		ShockState.FixedUpdate += new hook_FixedUpdate(On_ShockStateFixedUpdate);
		SetStateOnHurt.OnTakeDamageServer += new Manipulator(IL_SSOHTakeDamageServer);
	}

	public override void Uninstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		((T2Module)this).Uninstall();
		ShockState.OnEnter -= new hook_OnEnter(On_ShockStateOnEnter);
		ShockState.FixedUpdate -= new hook_FixedUpdate(On_ShockStateFixedUpdate);
		SetStateOnHurt.OnTakeDamageServer -= new Manipulator(IL_SSOHTakeDamageServer);
	}

	private void IL_SSOHTakeDamageServer(ILContext il)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
		{
			(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<SetStateOnHurt>(x, "SetShock")
		});
		val.Emit(OpCodes.Ldarg_0);
		val.Emit(OpCodes.Ldarg_1);
		val.EmitDelegate<Action<SetStateOnHurt, DamageReport>>((Action<SetStateOnHurt, DamageReport>)delegate(SetStateOnHurt ssoh, DamageReport dr)
		{
			ShockHelper shockHelper = ((Component)ssoh.targetStateMachine).gameObject.GetComponent<ShockHelper>();
			if (!Object.op_Implicit((Object)(object)shockHelper))
			{
				shockHelper = ((Component)ssoh.targetStateMachine).gameObject.AddComponent<ShockHelper>();
			}
			shockHelper.currentAttacker = dr.attacker;
		});
	}

	private void On_ShockStateOnEnter(orig_OnEnter orig, ShockState self)
	{
		orig.Invoke(self);
		if (doThresholdTweak)
		{
			ShockState.healthFractionToForceExit = 100f;
		}
	}

	private void On_ShockStateFixedUpdate(orig_FixedUpdate orig, ShockState self)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Invalid comparison between Unknown and I4
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Invalid comparison between Unknown and I4
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self);
		if (!NetworkServer.active || !(((T2Module)this).rng.nextNormalizedFloat < shockChance))
		{
			return;
		}
		TeamComponent teamComponent = ((EntityState)self).outer.commonComponents.teamComponent;
		List<TeamComponent> list = new List<TeamComponent>();
		bool flag = (int)FriendlyFireManager.friendlyFireMode > 0;
		if (flag || (int)teamComponent.teamIndex == 2)
		{
			list.AddRange(TeamComponent.GetTeamMembers((TeamIndex)2));
		}
		if (flag || (int)teamComponent.teamIndex == 0)
		{
			list.AddRange(TeamComponent.GetTeamMembers((TeamIndex)0));
		}
		if (flag || (int)teamComponent.teamIndex == 1)
		{
			list.AddRange(TeamComponent.GetTeamMembers((TeamIndex)1));
		}
		float sqrad = shockRadius * shockRadius;
		Vector3 tpos = ((EntityState)self).outer.commonComponents.characterBody.transform.position;
		list.Remove(teamComponent);
		list.RemoveAll(delegate(TeamComponent x)
		{
			//IL_0006: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val2 = ((Component)x).transform.position - tpos;
			return ((Vector3)(ref val2)).sqrMagnitude > sqrad || !Object.op_Implicit((Object)(object)x.body) || !Object.op_Implicit((Object)(object)x.body.mainHurtBox) || !((Behaviour)x.body).isActiveAndEnabled;
		});
		if (list.Count != 0)
		{
			TeamComponent val = ((T2Module)this).rng.NextElementUniform<TeamComponent>(list);
			GameObject attacker = null;
			ShockHelper component = ((EntityState)self).GetComponent<ShockHelper>();
			if (Object.op_Implicit((Object)(object)component))
			{
				attacker = component.currentAttacker;
			}
			OrbManager.instance.AddOrb((Orb)(object)new ShockedOrb
			{
				attacker = attacker,
				bouncesRemaining = 0,
				damageColorIndex = (DamageColorIndex)0,
				damageType = (DamageType)131072,
				damageValue = ((EntityState)self).outer.commonComponents.characterBody.maxHealth * shockDamageFrac,
				isCrit = false,
				lightningType = (LightningType)1,
				origin = tpos,
				procChainMask = default(ProcChainMask),
				procCoefficient = shockProcCoef,
				target = val.body.mainHurtBox,
				teamIndex = (TeamIndex)(-1),
				shockVictim = ((EntityState)self).gameObject
			});
		}
	}
}
public class ShockHelper : MonoBehaviour
{
	public GameObject currentAttacker;

	public int shockKills;
}
public class ShotgunAutofire : T2Module<ShotgunAutofire>
{
	[AutoConfigRoOSlider("{0:N2} s", 0f, 10f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float fireDelayDynamic { get; private set; } = 0.2f;


	[AutoConfigRoOSlider("{0:N2} s", 0f, 10f, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public float fireDelayFixed { get; private set; }

	public override bool managedEnable => true;

	public override string enabledConfigDescription => "Causes Vulcan Shotgun to autofire. Client-side.";

	public override AutoConfigFlags enabledConfigFlags => (AutoConfigFlags)0;

	public override void Install()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		((T2Module)this).Install();
		ChargeCaptainShotgun.FixedUpdate += new hook_FixedUpdate(On_CapChargeShotgunFixedUpdate);
	}

	public override void Uninstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		((T2Module)this).Uninstall();
		ChargeCaptainShotgun.FixedUpdate -= new hook_FixedUpdate(On_CapChargeShotgunFixedUpdate);
	}

	private void On_CapChargeShotgunFixedUpdate(orig_FixedUpdate orig, ChargeCaptainShotgun self)
	{
		if (Util.HasEffectiveAuthority(((EntityState)self).outer.networkIdentity) && ((EntityState)self).fixedAge / self.chargeDuration > fireDelayDynamic + 1f && ((EntityState)self).fixedAge - self.chargeDuration > fireDelayFixed)
		{
			self.released = true;
		}
		orig.Invoke(self);
	}
}
public class ShotgunRebalance : T2Module<ShotgunRebalance>
{
	[AutoConfigRoOIntSlider("{0:N0}", 1, 30, null, null)]
	[AutoConfig(/*Could not decode attribute arguments.*/)]
	public int pelletCount { get; private set; } = 6;


	public override bool managedEnable => true;

	public override string enabledConfigDescription => "Reduces Vulcan Shotgun pellet count.";

	public override AutoConfigUpdateActionTypes enabledConfigUpdateActionTypes => (AutoConfigUpdateActionTypes)1;

	public override void InstallLanguage()
	{
		((T2Module)this).genericLanguageTokens["CAPTAIN_PRIMARY_DESCRIPTION"] = "喷射一大团弹丸,造成<style=cIsDamage>6x120%伤害</style>,且不会衰减。蓄力攻击可缩小<style=cIsUtility>扩散范围</style>。";
		((T2Module)this).InstallLanguage();
	}

	public override void Install()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		((T2Module)this).Install();
		FireCaptainShotgun.ModifyBullet += new hook_ModifyBullet(On_FCSModifyBullet);
		FireCaptainShotgun.ctor += new hook_ctor(On_FireCaptainShotgunCtor);
	}

	public override void Uninstall()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		((T2Module)this).Uninstall();
		FireCaptainShotgun.ModifyBullet -= new hook_ModifyBullet(On_FCSModifyBullet);
		FireCaptainShotgun.ctor -= new hook_ctor(On_FireCaptainShotgunCtor);
	}

	private void On_FCSModifyBullet(orig_ModifyBullet orig, FireCaptainShotgun self, BulletAttack bulletAttack)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self, bulletAttack);
		bulletAttack.falloffModel = (FalloffModel)0;
	}

	private void On_FireCaptainShotgunCtor(orig_ctor orig, FireCaptainShotgun self)
	{
		orig.Invoke(self);
		((GenericBulletBaseState)self).bulletCount = pelletCount;
	}
}
public class EntStateChargeSKGun : ChargeCaptainShotgun
{
	public override void OnEnter()
	{
		((ChargeCaptainShotgun)this).OnEnter();
		base.chargeDuration = Mathf.Max(base.chargeDuration, T2Module<SKGunSkill>.instance.minChargeTime);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).fixedAge = ((EntityState)this).fixedAge + Time.fixedDeltaTime;
		((EntityState)this).characterBody.SetAimTimer(1f);
		((EntityState)this).characterBody.isSprinting = false;
		if (((EntityState)this).fixedAge >= base.chargeDuration)
		{
			if (Object.op_Implicit((Object)(object)base.chargeupVfxGameObject))
			{
				EntityState.Destroy((Object)(object)base.chargeupVfxGameObject);
				base.chargeupVfxGameObject = null;
			}
			if (!Object.op_Implicit((Object)(object)base.holdChargeVfxGameObject) && Object.op_Implicit((Object)(object)base.muzzleTransform))
			{
				base.holdChargeVfxGameObject = Object.Instantiate<GameObject>(ChargeCaptainShotgun.holdChargeVfxPrefab, base.muzzleTransform);
			}
		}
		if (!((EntityState)this).isAuthority)
		{
			return;
		}
		if (!base.released)
		{
			InputBankTest inputBank = ((EntityState)this).inputBank;
			if (inputBank == null || !inputBank.skill1.down)
			{
				base.released = true;
			}
		}
		if (base.released)
		{
			((EntityState)this).outer.SetNextState((EntityState)(object)new EntStateFireSKGun());
		}
	}
}
public class EntStateFireSKGun : BaseState
{
	private float duration;

	private float firingDelay;

	private bool isCharged;

	private bool usedAllAmmo;

	private bool hasFired;

	public override void OnEnter()
	{
		//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)
		isCharged = ((EntityState)this).characterBody.spreadBloomAngle <= 2f;
		((BaseState)this).OnEnter();
		if (isCharged || ((EntityState)this).skillLocator.primary.stock == 0)
		{
			usedAllAmmo = true;
			((EntityState)this).skillLocator.primary.stock = 0;
			((EntityState)this).skillLocator.primary.rechargeStopwatch = 0.5f - 1.25f / base.attackSpeedStat;
			duration = 1.25f / base.attackSpeedStat;
			firingDelay = (isCharged ? 0.35f : 0.2f) / base.attackSpeedStat;
			((EntityState)this).outer.commonComponents.characterBody.AddTimedBuff(T2Module<SKGunSkill>.instance.slowSkillDebuff, duration);
		}
		else
		{
			((EntityState)this).skillLocator.primary.rechargeStopwatch 

dll/AncientScepter.dll.old

Decompiled 3 days 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>权杖:击中后会留下一团挥之不去的火烧云。</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>权杖:伤害加倍,半径扩大4倍。</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 (mi

dll/ArtificerExtended.dll.old

Decompiled 3 days ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using AncientScepter;
using ArtificerExtended.Components;
using ArtificerExtended.CoreModules;
using ArtificerExtended.EntityState;
using ArtificerExtended.Helpers;
using ArtificerExtended.Passive;
using ArtificerExtended.Properties;
using ArtificerExtended.Skills;
using ArtificerExtended.Unlocks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ChillRework;
using EntityStates;
using EntityStates.Huntress;
using EntityStates.Mage;
using EntityStates.Mage.Weapon;
using EntityStates.Toolbot;
using EntityStates.Treebot.Weapon;
using HG;
using IL.RoR2.UI;
using JetBrains.Annotations;
using KinematicCharacterController;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Mage;
using On.EntityStates.Mage.Weapon;
using On.RoR2;
using On.RoR2.Skills;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RiskyMod.Survivors.Mage.Components;
using RoR2;
using RoR2.Achievements;
using RoR2.ContentManagement;
using RoR2.EntityLogic;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using ThreeEyedGames;
using UnityEngine;
using UnityEngine.Networking;
using VRAPI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ArtificerExtended")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtificerExtended")]
[assembly: AssemblyTitle("ArtificerExtended")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace ArtificerExtended
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[R2APISubmoduleDependency(new string[] { "UnlockableAPI", "LanguageAPI", "LoadoutAPI", "PrefabAPI", "DamageAPI" })]
	[BepInPlugin("com.Borbo.ArtificerExtended", "ArtificerExtended", "3.6.5")]
	public class ArtificerExtendedPlugin : BaseUnityPlugin
	{
		public delegate TCheese GiveCheese<TCheese>();

		private struct FreezeInfo
		{
			public GameObject frozenBy;

			public Vector3 frozenAt;

			public FreezeInfo(GameObject frozenBy, Vector3 frozenAt)
			{
				//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)
				this.frozenAt = frozenAt;
				this.frozenBy = frozenBy;
			}
		}

		private class FlamethrowerContext
		{
			public AltArtiPassive passive;

			public float timer;

			public FlamethrowerContext(AltArtiPassive passive)
			{
				this.passive = passive;
				timer = 0f;
			}
		}

		private class PrepWallContext
		{
			public AltArtiPassive passive;

			public AltArtiPassive.BatchHandle handle;

			public PrepWallContext(AltArtiPassive passive, AltArtiPassive.BatchHandle handle)
			{
				this.passive = passive;
				this.handle = handle;
			}
		}

		private class NanoBombContext
		{
			public AltArtiPassive passive;

			public AltArtiPassive.BatchHandle handle;

			public float timer;

			public NanoBombContext(AltArtiPassive passive, AltArtiPassive.BatchHandle handle)
			{
				this.passive = passive;
				this.handle = handle;
				timer = 0f;
			}
		}

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

			public static hook_FromSkillSlot <>9__41_0;

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

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

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

			public static Action<List<StripDisplayData>, StripDisplayData, GenericSkill> <>9__41_4;

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

			public static Func<Row, Row> <>9__41_11;

			public static Manipulator <>9__41_2;

			public static Func<Type, bool> <>9__49_0;

			public static Func<Type, bool> <>9__54_0;

			public static Func<Type, bool> <>9__55_0;

			internal object <CreateMagePassiveSlot>b__41_0(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyI, int slotI, GenericSkill slot)
			{
				//IL_0003: 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_0013: Expected O, but got Unknown
				Row val = (Row)orig.Invoke(owner, bodyI, slotI, slot);
				if (((Object)slot.skillFamily).name.Contains("Passive"))
				{
					Transform val2 = ((Transform)val.rowPanelTransform).Find("SlotLabel") ?? ((Transform)val.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
					if (Object.op_Implicit((Object)(object)val2))
					{
						((Component)val2).GetComponent<LanguageTextMeshController>().token = "其他";
					}
				}
				return val;
			}

			internal bool <CreateMagePassiveSlot>b__41_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld(x, typeof(GenericSkill).GetField("hideInCharacterSelect"));
			}

			internal bool <CreateMagePassiveSlot>b__41_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld(x, typeof(Variant).GetField("skillDef"));
			}

			internal bool <CreateMagePassiveSlot>b__41_10(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List<StripDisplayData>).GetMethod("Add"));
			}

			internal void <CreateMagePassiveSlot>b__41_4(List<StripDisplayData> list, StripDisplayData disp, GenericSkill skill)
			{
				//IL_0029: 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)
				if (((Object)skill.skillFamily).name == "MageBodyPassive")
				{
					list.Insert(0, disp);
				}
				else
				{
					list.Add(disp);
				}
			}

			internal void <CreateMagePassiveSlot>b__41_2(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot", (BindingFlags)(-1)))
				}))
				{
					return;
				}
				val.EmitDelegate<Func<Row, Row>>((Func<Row, Row>)delegate(Row orig)
				{
					Transform val2 = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
					if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).GetComponent<LanguageTextMeshController>().token == "其他")
					{
						((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
					}
					return orig;
				});
			}

			internal bool <CreateMagePassiveSlot>b__41_12(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot", (BindingFlags)(-1)));
			}

			internal Row <CreateMagePassiveSlot>b__41_11(Row orig)
			{
				Transform val = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
				if (Object.op_Implicit((Object)(object)val) && ((Component)val).GetComponent<LanguageTextMeshController>().token == "其他")
				{
					((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
				}
				return orig;
			}

			internal bool <InitializeUnlocks>b__49_0(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(UnlockBase));
			}

			internal bool <InitializeSkills>b__54_0(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(SkillBase));
			}

			internal bool <InitializeScepterSkills>b__55_0(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(ScepterSkillBase));
			}
		}

		public const string guid = "com.Borbo.ArtificerExtended";

		public const string modName = "ArtificerExtended";

		public const string version = "3.6.5";

		public static AssetBundle iconBundle = Tools.LoadAssetBundle(Resources.artiskillicons);

		public static string iconsPath = "Assets/AESkillIcons/";

		public static string TokenName = "ARTIFICEREXTENDED_";

		public static bool isScepterLoaded = Tools.isLoaded("com.DestroyedClone.AncientScepter");

		public static bool autosprintLoaded = Tools.isLoaded("com.johnedwa.RTAutoSprintEx");

		public static bool is2r4rLoaded = Tools.isLoaded("com.HouseOfFruits.RiskierRain");

		public static bool isRiskyModLoaded = Tools.isLoaded("com.RiskyLives.RiskyMod");

		public static GameObject mageObject;

		public static CharacterBody mageBody;

		public static SkillLocator mageSkillLocator;

		public static GenericSkill magePassive;

		public static SkillFamily magePassiveFamily;

		public static SkillFamily magePrimary;

		public static SkillFamily mageSecondary;

		public static SkillFamily mageUtility;

		public static SkillFamily mageSpecial;

		public static float artiBoltDamage = 2.8f;

		public static float artiNanoDamage = 20f;

		public static float artiUtilCooldown = 12f;

		public static float meleeRangeChannel = 21f;

		public static float meleeRangeSingle = meleeRangeChannel + 4f;

		public static Dictionary<UnlockBase, UnlockableDef> UnlockBaseDictionary = new Dictionary<UnlockBase, UnlockableDef>();

		public static List<Type> entityStates = new List<Type>();

		public static List<SkillBase> Skills = new List<SkillBase>();

		public static List<ScepterSkillBase> ScepterSkills = new List<ScepterSkillBase>();

		public static Dictionary<SkillBase, bool> SkillStatusDictionary = new Dictionary<SkillBase, bool>();

		private readonly Dictionary<GameObject, GameObject> frozenBy = new Dictionary<GameObject, GameObject>();

		private readonly Dictionary<Flamethrower, FlamethrowerContext> flamethrowerContext = new Dictionary<Flamethrower, FlamethrowerContext>();

		private readonly Dictionary<PrepWall, PrepWallContext> prepWallContext = new Dictionary<PrepWall, PrepWallContext>();

		private readonly Dictionary<BaseChargeBombState, NanoBombContext> nanoBombContext = new Dictionary<BaseChargeBombState, NanoBombContext>();

		internal static ConfigFile CustomConfigFile { get; set; }

		public static ConfigEntry<bool> AllowBrokenSFX { get; set; }

		public static ConfigEntry<bool> RecolorMeteor { get; set; }

		public static ConfigEntry<bool> SurgeRework { get; set; }

		private void Awake()
		{
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			mageObject = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/MageBody");
			mageObject.AddComponent<ElementCounter>();
			mageBody = mageObject.GetComponent<CharacterBody>();
			mageSkillLocator = mageObject.GetComponent<SkillLocator>();
			if (Object.op_Implicit((Object)(object)mageObject) && Object.op_Implicit((Object)(object)mageBody) && Object.op_Implicit((Object)(object)mageSkillLocator))
			{
				Debug.Log((object)"ARTIFICEREXTENDED setup succeeded!");
			}
			magePassive = CreateMagePassiveSlot(mageObject, mageSkillLocator);
			magePassiveFamily = magePassive.skillFamily;
			magePrimary = mageSkillLocator.primary.skillFamily;
			mageSecondary = mageSkillLocator.secondary.skillFamily;
			mageUtility = mageSkillLocator.utility.skillFamily;
			mageSpecial = mageSkillLocator.special.skillFamily;
			InitializeConfig();
			InitializeUnlocks();
			Debug.Log((object)"ArtificerExtended setup succeeded!");
			CreateMagePassives(magePassiveFamily);
			SkillCatalog.Init += new hook_Init(ReplaceSkillDefs);
			SkillCatalog.Init += new hook_Init(ReplaceScepterSkillDefs);
			if (is2r4rLoaded)
			{
				artiNanoDamage = 12f;
				artiUtilCooldown = 8f;
			}
			AddHooks();
			Assets.CreateZapDamageType();
			Buffs.CreateBuffs();
			Projectiles.CreateLightningSwords();
			Effects.DoEffects();
			ArtiChanges();
			InitializeSkills();
			if (isScepterLoaded)
			{
				InitializeScepterSkills();
			}
			CharacterMaster.OnBodyStart += new hook_OnBodyStart(AddAEBodyFX);
			new ContentPacks().Initialize();
			VRStuff.SetupVR();
		}

		private GenericSkill CreateMagePassiveSlot(GameObject body, SkillLocator skillLocator)
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			GenericSkill[] components = body.GetComponents<GenericSkill>();
			foreach (GenericSkill val in components)
			{
				if (((Object)val.skillFamily).name.ToLower().Contains("passive"))
				{
					return val;
				}
			}
			SkillFamily passiveFamily = ScriptableObject.CreateInstance<SkillFamily>();
			passiveFamily.variants = (Variant[])(object)new Variant[1];
			GenericSkill val2 = body.gameObject.AddComponent<GenericSkill>();
			val2._skillFamily = passiveFamily;
			((Object)val2.skillFamily).name = "MageBodyPassive";
			ContentPacks.skillFamilies.Add(passiveFamily);
			skillLocator.passiveSkill.enabled = false;
			EntityStateMachine[] components2 = body.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val3 in components2)
			{
				if (val3.customName == "Body")
				{
					val3.mainStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));
				}
			}
			object obj = <>c.<>9__41_0;
			if (obj == null)
			{
				hook_FromSkillSlot val4 = delegate(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyI, int slotI, GenericSkill slot)
				{
					//IL_0003: 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_0013: Expected O, but got Unknown
					Row val9 = (Row)orig.Invoke(owner, bodyI, slotI, slot);
					if (((Object)slot.skillFamily).name.Contains("Passive"))
					{
						Transform val10 = ((Transform)val9.rowPanelTransform).Find("SlotLabel") ?? ((Transform)val9.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
						if (Object.op_Implicit((Object)(object)val10))
						{
							((Component)val10).GetComponent<LanguageTextMeshController>().token = "其他";
						}
					}
					return val9;
				};
				<>c.<>9__41_0 = val4;
				obj = (object)val4;
			}
			Row.FromSkillSlot += (hook_FromSkillSlot)obj;
			CharacterSelectController.BuildSkillStripDisplayData += (Manipulator)delegate(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_00c9: 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_014f: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val8 = new ILCursor(il);
				int skillIndex = -1;
				int defIndex = -1;
				ILLabel label = val8.DefineLabel();
				if (val8.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref skillIndex),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(GenericSkill).GetField("hideInCharacterSelect")),
					(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref label)
				}) && skillIndex != -1 && val8.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(Variant).GetField("skillDef")),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref defIndex)
				}))
				{
					val8.Emit(OpCodes.Ldloc, defIndex);
					val8.EmitDelegate<Func<SkillDef, bool>>((Func<SkillDef, bool>)((SkillDef def) => (Object)(object)def == (Object)(object)passiveFamily.variants[0].skillDef));
					val8.Emit(OpCodes.Brtrue, (object)label);
					if (val8.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List<StripDisplayData>).GetMethod("Add"))
					}))
					{
						val8.Remove();
						val8.Emit(OpCodes.Ldloc, skillIndex);
						val8.EmitDelegate<Action<List<StripDisplayData>, StripDisplayData, GenericSkill>>((Action<List<StripDisplayData>, StripDisplayData, GenericSkill>)delegate(List<StripDisplayData> list, StripDisplayData disp, GenericSkill skill)
						{
							//IL_0029: 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)
							if (((Object)skill.skillFamily).name == "MageBodyPassive")
							{
								list.Insert(0, disp);
							}
							else
							{
								list.Add(disp);
							}
						});
					}
				}
			};
			object obj2 = <>c.<>9__41_2;
			if (obj2 == null)
			{
				Manipulator val5 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val6 = new ILCursor(il);
					if (val6.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot", (BindingFlags)(-1)))
					}))
					{
						val6.EmitDelegate<Func<Row, Row>>((Func<Row, Row>)delegate(Row orig)
						{
							Transform val7 = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
							if (Object.op_Implicit((Object)(object)val7) && ((Component)val7).GetComponent<LanguageTextMeshController>().token == "其他")
							{
								((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
							}
							return orig;
						});
					}
				};
				<>c.<>9__41_2 = val5;
				obj2 = (object)val5;
			}
			LoadoutPanelController.Rebuild += (Manipulator)obj2;
			return val2;
		}

		public void CreateMagePassives(SkillFamily passiveFamily)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Expected O, but got Unknown
			//IL_02cd: 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)
			PassiveSkillDef passiveSkillDef = ScriptableObject.CreateInstance<PassiveSkillDef>();
			((SkillDef)passiveSkillDef).skillNameToken = mageSkillLocator.passiveSkill.skillNameToken;
			((Object)passiveSkillDef).name = mageSkillLocator.passiveSkill.skillNameToken;
			((SkillDef)passiveSkillDef).skillDescriptionToken = mageSkillLocator.passiveSkill.skillDescriptionToken;
			((SkillDef)passiveSkillDef).icon = mageSkillLocator.passiveSkill.icon;
			((SkillDef)passiveSkillDef).canceledFromSprinting = false;
			((SkillDef)passiveSkillDef).cancelSprintingOnActivation = false;
			passiveSkillDef.stateMachineDefaults = new PassiveSkillDef.StateMachineDefaults[1]
			{
				new PassiveSkillDef.StateMachineDefaults
				{
					machineName = "Body",
					initalState = new SerializableEntityStateType(typeof(MageCharacterMain)),
					mainState = new SerializableEntityStateType(typeof(MageCharacterMain)),
					defaultInitalState = new SerializableEntityStateType(typeof(GenericCharacterMain)),
					defaultMainState = new SerializableEntityStateType(typeof(GenericCharacterMain))
				}
			};
			LanguageAPI.Add("MAGE_PASSIVE_ENERGY_NAME", "Energetic Resonance");
			LanguageAPI.Add("MAGE_PASSIVE_ENERGY_DESC", "- <style=cIsUtility>Incinerate</style> increases in intensity for each <style=cIsDamage>FIRE</style> skill.\n- <style=cIsUtility>Arctic Blasts</style> increase in power for each <style=cIsDamage>ICE</style> skill.\n- <style=cIsUtility>Lightning Bolts</style> are created for each <style=cIsDamage>LIGHTNING</style> skill.");
			LanguageAPI.Add("ARTIFICEREXTENDED_KEYWORD_MELT", "<style=cKeywordName>Incinerate</style><style=cSub><style=cIsUtility>On ANY Cast:</style> Gain a buff that temporarily increases the <style=cIsDamage>burn damage</style> from Ignite by <style=cIsDamage>" + Tools.ConvertDecimal(AltArtiPassive.burnDamageMult) + " per stack.</style>");
			LanguageAPI.Add("ARTIFICEREXTENDED_KEYWORD_ARCTICBLAST", "<style=cKeywordName>Arctic Blast</style><style=cSub><style=cIsUtility>Applying 10 stacks</style> of Chill or <style=cIsUtility>killing Chilled enemies</style> causes an <style=cIsUtility>Arctic Blast,</style> clearing the effect and <style=cIsDamage>Freezing nearby enemies.</style></style>");
			LanguageAPI.Add("ARTIFICEREXTENDED_KEYWORD_BOLTS", "<style=cKeywordName>Lightning Bolts</style><style=cSub><style=cIsUtility>On ANY Cast:</style> Summon spears of energy that <style=cIsUtility>seek out enemies in front of you</style> for <style=cIsDamage>" + Tools.ConvertDecimal(AltArtiPassive.lightningDamageMult) + " damage.</style>");
			PassiveSkillDef passiveSkillDef2 = ScriptableObject.CreateInstance<PassiveSkillDef>();
			((SkillDef)passiveSkillDef2).skillNameToken = "MAGE_PASSIVE_ENERGY_NAME";
			((SkillDef)passiveSkillDef2).skillDescriptionToken = "MAGE_PASSIVE_ENERGY_DESC";
			((SkillDef)passiveSkillDef2).icon = iconBundle.LoadAsset<Sprite>(iconsPath + "ElementalIntensity.png");
			((SkillDef)passiveSkillDef2).canceledFromSprinting = false;
			((SkillDef)passiveSkillDef2).cancelSprintingOnActivation = false;
			passiveSkillDef2.stateMachineDefaults = new PassiveSkillDef.StateMachineDefaults[1]
			{
				new PassiveSkillDef.StateMachineDefaults
				{
					machineName = "Jet",
					initalState = new SerializableEntityStateType(typeof(AltArtiPassive)),
					mainState = new SerializableEntityStateType(typeof(AltArtiPassive)),
					defaultInitalState = new SerializableEntityStateType(typeof(Idle)),
					defaultMainState = new SerializableEntityStateType(typeof(Idle))
				}
			};
			((SkillDef)passiveSkillDef2).keywordTokens = new string[3] { "ARTIFICEREXTENDED_KEYWORD_MELT", "ARTIFICEREXTENDED_KEYWORD_ARCTICBLAST", "ARTIFICEREXTENDED_KEYWORD_BOLTS" };
			Variant[] array = new Variant[2];
			Variant val = new Variant
			{
				skillDef = (SkillDef)(object)passiveSkillDef,
				unlockableName = ""
			};
			((Variant)(ref val)).viewableNode = new Node(((SkillDef)passiveSkillDef).skillNameToken, false, (Node)null);
			array[0] = val;
			val = new Variant
			{
				skillDef = (SkillDef)(object)passiveSkillDef2,
				unlockableDef = passiveSkillDef2.GetUnlockDef(typeof(ArtificerEnergyPassiveUnlock))
			};
			((Variant)(ref val)).viewableNode = new Node(((SkillDef)passiveSkillDef2).skillNameToken, false, (Node)null);
			array[1] = val;
			passiveFamily.variants = (Variant[])(object)array;
			ContentPacks.skillDefs.Add((SkillDef)(object)passiveSkillDef);
			ContentPacks.skillDefs.Add((SkillDef)(object)passiveSkillDef2);
		}

		private void ReplaceSkillDefs(orig_Init orig)
		{
			//IL_00c6: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke();
			SkillDef val = LegacyResourcesAPI.Load<SkillDef>("skilldefs/magebody/MageBodyFlyUp");
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)"Changing ion surge");
				if (SurgeRework.Value)
				{
					SkillBase.RegisterEntityState(typeof(AlternateIonSurge));
					LanguageAPI.Add(SkillBase.Token + "ALTIONSURGE_DESC", "Burst forward up to 3 times. <style=cIsDamage>Can attack while dashing.</style> Trigger again to cancel early.");
					val.activationState = new SerializableEntityStateType(typeof(AlternateIonSurge));
					val.baseRechargeInterval = 6f;
					val.skillDescriptionToken = SkillBase.Token + "ALTIONSURGE_DESC";
					val.keywordTokens = new string[0];
				}
				else
				{
					SkillBase.RegisterEntityState(typeof(VanillaIonSurge));
					val.activationState = new SerializableEntityStateType(typeof(VanillaIonSurge));
				}
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void ReplaceScepterSkillDefs(orig_Init orig)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke();
			SkillDef val = LegacyResourcesAPI.Load<SkillDef>("skilldefs/magebody/MageBodyFlyUp");
			if (SurgeRework.Value && (Object)(object)val != (Object)null)
			{
				SkillDef skillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName(val.skillName + "Scepter"));
				if ((Object)(object)skillDef != (Object)null)
				{
					SkillBase.RegisterEntityState(typeof(AlternateIonSurge2));
					LanguageAPI.Add(SkillBase.Token + "ALTANTISURGE_LIGHTNING", "Antimatter Surge");
					LanguageAPI.Add(SkillBase.Token + "ALTANTISURGE_DESC", "Burst forward up to 3 times. <style=cIsDamage>Can attack while dashing.</style> Trigger again to cancel early.\n<color=#d299ff>SCEPTER: Each burst reduces ALL cooldowns.</color>");
					skillDef.activationState = new SerializableEntityStateType(typeof(AlternateIonSurge2));
					skillDef.baseRechargeInterval = 6f;
					skillDef.skillDescriptionToken = SkillBase.Token + "ALTANTISURGE_DESC";
					skillDef.skillNameToken = SkillBase.Token + "ALTANTISURGE_LIGHTNING";
					skillDef.keywordTokens = new string[0];
				}
			}
			else
			{
				Debug.LogError((object)"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nArtificerExtended could not replace Ancient Scepter's Antimatter Surge. Antimatter Surge WILL break Artificer Extended's alt passives. \nEither turn on ArtificerExtended's Ion Surge rework to use ArtificerExtended's Antimatter Surge, avoid using Antimatter Surge with ArtificerExtended's alt passive, or tell the Ancient Scepter developers to get in contact to fix Antimatter Surge. \nThis is NOT an error that can be fixed on the ArtificerExtended side.\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
			}
		}

		private void AddAEBodyFX(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
		{
			orig.Invoke(self, body);
			AEBodyEffects aEBodyEffects = ((Component)body).gameObject.AddComponent<AEBodyEffects>();
			aEBodyEffects.body = body;
		}

		private void InitializeConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\ArtificerExtended.cfg", true);
			AllowBrokenSFX = CustomConfigFile.Bind<bool>("Cosmetic", "Allow Broken SFX", false, "Some SFX (the snapfreeze cast sound, specifically) create an unstoppable droning/ringing sound. \nThey are disabled by default, but if you would like to have SFX and dont mind the bug, then you may enable them.");
			SurgeRework = CustomConfigFile.Bind<bool>("Ion Surge", "Enable Rework", true, "Determines whether Ion Surge gets reworked. Note that vanilla Ion Surge is INCOMPATIBLE with ALL alt-passives. Use at your own risk.");
		}

		private void ArtiChanges()
		{
			LanguageAPI.Add("MAGE_OUTRO_FLAVOR", "..and so she left, her heart fixed on new horizons.");
			GameObject val = LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/MageIcewallPillarProjectile");
			ProjectileImpactExplosion componentInChildren = val.GetComponentInChildren<ProjectileImpactExplosion>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.destroyOnEnemy = false;
			}
			LanguageAPI.Add("MAGE_UTILITY_ICE_DESCRIPTION", "<style=cIsUtility>Freezing</style>. Create a barrier that hurts enemies for up to <style=cIsDamage>12x100% damage</style>.");
			SkillDef skillDef = mageSpecial.variants[0].skillDef;
			if ((Object)(object)skillDef != (Object)null)
			{
				skillDef.mustKeyPress = true;
			}
		}

		private void InitializeUnlocks()
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(UnlockBase))
				select type;
			MethodInfo method = typeof(UnlockableAPI).GetMethod("AddUnlockable", new Type[1] { typeof(bool) });
			Debug.Log((object)"ARTIFICEREXTENDED Initializing unlocks!:");
			foreach (Type item in enumerable)
			{
				UnlockBase unlockBase = (UnlockBase)Activator.CreateInstance(item);
				Debug.Log((object)item);
				if (!unlockBase.HideUnlock)
				{
					unlockBase.Init(CustomConfigFile);
					UnlockableDef value = (UnlockableDef)method.MakeGenericMethod(item).Invoke(null, new object[1] { true });
					bool flag = unlockBase.ForceDisable;
					if (!flag)
					{
						flag = CustomConfigFile.Bind<bool>("Config: UNLOCKS", "Force Unlock Achievement: " + unlockBase.UnlockName, false, "Force this achievement to unlock: " + unlockBase.UnlockName + "?").Value;
					}
					if (!flag)
					{
						UnlockBaseDictionary.Add(unlockBase, value);
					}
					else
					{
						UnlockBaseDictionary.Add(unlockBase, ScriptableObject.CreateInstance<UnlockableDef>());
					}
				}
			}
		}

		private void InitializeSkills()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(SkillBase))
				select type;
			foreach (Type item in enumerable)
			{
				SkillBase skillBase = (SkillBase)Activator.CreateInstance(item);
				if (ValidateSkill(skillBase))
				{
					skillBase.Init(CustomConfigFile);
				}
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void InitializeScepterSkills()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ScepterSkillBase))
				select type;
			foreach (Type item in enumerable)
			{
				ScepterSkillBase scepterSkillBase = (ScepterSkillBase)Activator.CreateInstance(item);
				if (ValidateScepterSkill(scepterSkillBase))
				{
					scepterSkillBase.Init(CustomConfigFile);
				}
			}
		}

		private bool ValidateSkill(SkillBase item)
		{
			bool flag = true;
			if (flag)
			{
				Skills.Add(item);
			}
			SkillStatusDictionary.Add(item, flag);
			return flag;
		}

		private bool ValidateScepterSkill(ScepterSkillBase item)
		{
			bool flag = isScepterLoaded;
			if (flag)
			{
				ScepterSkills.Add(item);
			}
			return flag;
		}

		public static SkillDef CloneSkillDef(SkillDef oldDef)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.skillName = oldDef.skillName;
			val.skillNameToken = oldDef.skillNameToken;
			val.skillDescriptionToken = oldDef.skillDescriptionToken;
			val.icon = oldDef.icon;
			val.activationStateMachineName = oldDef.activationStateMachineName;
			val.activationState = oldDef.activationState;
			val.interruptPriority = oldDef.interruptPriority;
			val.baseRechargeInterval = oldDef.baseRechargeInterval;
			val.baseMaxStock = oldDef.baseMaxStock;
			val.rechargeStock = oldDef.rechargeStock;
			val.requiredStock = oldDef.requiredStock;
			val.stockToConsume = oldDef.stockToConsume;
			val.beginSkillCooldownOnSkillEnd = oldDef.beginSkillCooldownOnSkillEnd;
			val.fullRestockOnAssign = oldDef.fullRestockOnAssign;
			val.dontAllowPastMaxStocks = oldDef.dontAllowPastMaxStocks;
			val.resetCooldownTimerOnUse = oldDef.resetCooldownTimerOnUse;
			val.isCombatSkill = oldDef.isCombatSkill;
			val.cancelSprintingOnActivation = oldDef.cancelSprintingOnActivation;
			val.canceledFromSprinting = oldDef.canceledFromSprinting;
			val.forceSprintDuringState = oldDef.forceSprintDuringState;
			val.mustKeyPress = oldDef.mustKeyPress;
			val.keywordTokens = oldDef.keywordTokens;
			return val;
		}

		public void DoHooks()
		{
			AddHooks();
		}

		private void RemoveHooks()
		{
		}

		private void AddHooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//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
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			FireFireBolt.FireGauntlet += new hook_FireGauntlet(FireFireBolt_FireGauntlet);
			BaseChargeBombState.OnEnter += new hook_OnEnter(BaseChargeBombState_OnEnter);
			BaseChargeBombState.FixedUpdate += new hook_FixedUpdate(BaseChargeBombState_FixedUpdate);
			BaseChargeBombState.OnExit += new hook_OnExit(BaseChargeBombState_OnExit);
			PrepWall.OnEnter += new hook_OnEnter(PrepWall_OnEnter);
			PrepWall.OnExit += new hook_OnExit(PrepWall_OnExit);
			Flamethrower.OnEnter += new hook_OnEnter(Flamethrower_OnEnter);
			Flamethrower.FixedUpdate += new hook_FixedUpdate(Flamethrower_FixedUpdate);
			Flamethrower.OnExit += new hook_OnExit(Flamethrower_OnExit);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_OnCharacterDeath;
			CharacterMaster.OnBodyStart += new hook_OnBodyStart(CharacterMaster_OnBodyStart);
			ChillRework.OnMaxChill += FrostNovaOnMaxChill;
		}

		private void CharacterMaster_OnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
		{
			ElementCounter component = ((Component)body).GetComponent<ElementCounter>();
			if ((Object)(object)component != (Object)null)
			{
				component.GetPowers(body.skillLocator);
			}
			orig.Invoke(self, body);
		}

		private void GlobalEventManager_OnCharacterDeath(DamageReport damageReport)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			CharacterBody attackerBody = damageReport.attackerBody;
			if (damageReport != null && Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)damageReport.victimBody.healthComponent))
			{
				ElementCounter.Power icePowerLevelFromBody = ElementCounter.GetIcePowerLevelFromBody(attackerBody);
				int num = damageReport.victimBody.GetBuffCount(Buffs.Slow80);
				if (num == 0 && (((Enum)damageReport.damageInfo.damageType).HasFlag((Enum)(object)(DamageType)256) || ((Enum)damageReport.damageInfo.damageType).HasFlag((Enum)(object)(DamageType)8)))
				{
					num++;
				}
				if (num > 0 && icePowerLevelFromBody > ElementCounter.Power.None)
				{
					AltArtiPassive.DoNova(attackerBody, icePowerLevelFromBody, ((Component)damageReport.victim).transform.position, num);
				}
			}
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0002: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			if (((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)256))
			{
				frozenBy[((Component)self).gameObject] = damageInfo.attacker;
			}
			orig.Invoke(self, damageInfo);
			if ((damageInfo.dotIndex != Buffs.burnDot && damageInfo.dotIndex != Buffs.strongBurnDot) || !Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			int buffCount = component.GetBuffCount(Buffs.meltBuff);
			if (buffCount >= 0)
			{
				damageInfo.damage *= 1f + AltArtiPassive.burnDamageMult * (float)buffCount;
				if (Util.CheckRoll((float)(buffCount / 15 * 100), component.master))
				{
					EffectManager.SimpleImpactEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/MagmaOrbExplosion"), damageInfo.position, Vector3.up, true);
				}
			}
		}

		private void FrostNovaOnMaxChill(DamageInfo damageInfo, CharacterBody vBody)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = null;
			if ((Object)(object)damageInfo.attacker != (Object)null)
			{
				val = damageInfo.attacker.GetComponent<CharacterBody>();
			}
			if ((Object)(object)val != (Object)null)
			{
				ElementCounter.Power icePowerLevelFromBody = ElementCounter.GetIcePowerLevelFromBody(val);
				if (icePowerLevelFromBody > ElementCounter.Power.None)
				{
					vBody.ClearTimedBuffs(Buffs.Slow80);
					AltArtiPassive.DoNova(val, icePowerLevelFromBody, damageInfo.position);
				}
			}
		}

		private void Flamethrower_OnEnter(orig_OnEnter orig, Flamethrower self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.ContainsKey(gameObject))
			{
				AltArtiPassive altArtiPassive = AltArtiPassive.instanceLookup[gameObject];
				FlamethrowerContext value = new FlamethrowerContext(altArtiPassive);
				altArtiPassive.SkillCast();
				flamethrowerContext[self] = value;
			}
		}

		private void Flamethrower_FixedUpdate(orig_FixedUpdate orig, Flamethrower self)
		{
			orig.Invoke(self);
			if (this.flamethrowerContext.ContainsKey(self))
			{
				FlamethrowerContext flamethrowerContext = this.flamethrowerContext[self];
				flamethrowerContext.timer += Time.fixedDeltaTime * flamethrowerContext.passive.ext_attackSpeedStat;
				int num = 0;
				while (flamethrowerContext.timer >= flamethrowerContext.passive.ext_flamethrowerInterval && num <= flamethrowerContext.passive.ext_flamethrowerMaxPerTick)
				{
					flamethrowerContext.passive.SkillCast();
					num++;
					flamethrowerContext.timer -= flamethrowerContext.passive.ext_flamethrowerInterval;
				}
			}
		}

		private void Flamethrower_OnExit(orig_OnExit orig, Flamethrower self)
		{
			orig.Invoke(self);
			if (this.flamethrowerContext.ContainsKey(self))
			{
				FlamethrowerContext flamethrowerContext = this.flamethrowerContext[self];
				flamethrowerContext.passive.SkillCast();
				this.flamethrowerContext.Remove(self);
			}
		}

		private void PrepWall_OnEnter(orig_OnEnter orig, PrepWall self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.ContainsKey(gameObject))
			{
				AltArtiPassive altArtiPassive = AltArtiPassive.instanceLookup[gameObject];
				AltArtiPassive.BatchHandle handle = new AltArtiPassive.BatchHandle();
				altArtiPassive.SkillCast(handle);
				PrepWallContext value = new PrepWallContext(altArtiPassive, handle);
				prepWallContext[self] = value;
			}
		}

		private void PrepWall_OnExit(orig_OnExit orig, PrepWall self)
		{
			orig.Invoke(self);
			if (this.prepWallContext.ContainsKey(self))
			{
				PrepWallContext prepWallContext = this.prepWallContext[self];
				prepWallContext.handle.Fire(prepWallContext.passive.ext_prepWallMinDelay, prepWallContext.passive.ext_prepWallMaxDelay);
				this.prepWallContext.Remove(self);
			}
		}

		private void BaseChargeBombState_OnEnter(orig_OnEnter orig, BaseChargeBombState self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.ContainsKey(gameObject))
			{
				AltArtiPassive altArtiPassive = AltArtiPassive.instanceLookup[gameObject];
				AltArtiPassive.BatchHandle handle = new AltArtiPassive.BatchHandle();
				NanoBombContext value = new NanoBombContext(altArtiPassive, handle);
				nanoBombContext[self] = value;
				altArtiPassive.SkillCast(handle);
			}
		}

		private void BaseChargeBombState_FixedUpdate(orig_FixedUpdate orig, BaseChargeBombState self)
		{
			orig.Invoke(self);
			if (this.nanoBombContext.ContainsKey(self))
			{
				NanoBombContext nanoBombContext = this.nanoBombContext[self];
				nanoBombContext.timer += Time.fixedDeltaTime * nanoBombContext.passive.ext_attackSpeedStat;
				int num = 0;
				while (nanoBombContext.timer >= nanoBombContext.passive.ext_nanoBombInterval && num <= nanoBombContext.passive.ext_nanoBombMaxPerTick)
				{
					num++;
					nanoBombContext.passive.SkillCast(nanoBombContext.handle);
					nanoBombContext.timer -= nanoBombContext.passive.ext_nanoBombInterval;
				}
			}
		}

		private void BaseChargeBombState_OnExit(orig_OnExit orig, BaseChargeBombState self)
		{
			orig.Invoke(self);
			if (this.nanoBombContext.ContainsKey(self))
			{
				NanoBombContext nanoBombContext = this.nanoBombContext[self];
				int num = 0;
				while (nanoBombContext.timer >= nanoBombContext.passive.ext_nanoBombInterval && num <= nanoBombContext.passive.ext_nanoBombMaxPerTick)
				{
					num++;
					nanoBombContext.passive.SkillCast(nanoBombContext.handle);
					nanoBombContext.timer -= nanoBombContext.passive.ext_nanoBombInterval;
				}
				nanoBombContext.handle.Fire(nanoBombContext.passive.ext_nanoBombMinDelay, nanoBombContext.passive.ext_nanoBombMaxDelay);
				this.nanoBombContext.Remove(self);
			}
		}

		private void FireFireBolt_FireGauntlet(orig_FireGauntlet orig, FireFireBolt self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.TryGetValue(gameObject, out var value))
			{
				value.SkillCast();
			}
		}
	}
	public class AEBodyEffects : MonoBehaviour
	{
		public CharacterBody body;

		private TemporaryVisualEffect blizzardArmorTempEffect;

		private void Update()
		{
			UpdateSingleTemporaryVisualEffect(ref blizzardArmorTempEffect, _1FrostbiteSkill.blizzardArmorVFX, body.radius * 0.5f, body.GetBuffCount(_1FrostbiteSkill.artiIceShield) + body.GetBuffCount(FrostbiteSkill2.artiIceShield));
		}

		private void UpdateSingleTemporaryVisualEffect(ref TemporaryVisualEffect tempEffect, GameObject obj, float effectRadius, int count, string childLocatorOverride = "")
		{
			//IL_0151: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			bool flag = (Object)(object)tempEffect != (Object)null;
			if (flag == count > 0)
			{
				return;
			}
			if (count > 0)
			{
				if (flag)
				{
					return;
				}
				GameObject val = Object.Instantiate<GameObject>(obj, body.corePosition, Quaternion.identity);
				tempEffect = val.GetComponent<TemporaryVisualEffect>();
				tempEffect.parentTransform = body.coreTransform;
				tempEffect.visualState = (VisualState)0;
				tempEffect.healthComponent = body.healthComponent;
				tempEffect.radius = effectRadius;
				LocalCameraEffect component = val.GetComponent<LocalCameraEffect>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.targetCharacter = ((Component)this).gameObject;
				}
				if (string.IsNullOrEmpty(childLocatorOverride))
				{
					return;
				}
				ModelLocator modelLocator = body.modelLocator;
				ChildLocator val2;
				if ((Object)(object)modelLocator == (Object)null)
				{
					val2 = null;
				}
				else
				{
					Transform modelTransform = modelLocator.modelTransform;
					val2 = (((Object)(object)modelTransform != (Object)null) ? ((Component)modelTransform).GetComponent<ChildLocator>() : null);
				}
				ChildLocator val3 = val2;
				if (Object.op_Implicit((Object)(object)val3))
				{
					Transform val4 = val3.FindChild(childLocatorOverride);
					if (Object.op_Implicit((Object)(object)val4))
					{
						tempEffect.parentTransform = val4;
					}
				}
			}
			else if (Object.op_Implicit((Object)(object)tempEffect))
			{
				tempEffect.visualState = (VisualState)1;
			}
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<SkillDef> skillDefs = new List<SkillDef>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<GameObject> networkedObjectPrefabs = new List<GameObject>();

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		internal ContentPack contentPack = new ContentPack();

		public string identifier => "ArtificerExtended";

		public void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			contentPack.buffDefs.Add(buffDefs.ToArray());
			contentPack.effectDefs.Add(effectDefs.ToArray());
			contentPack.entityStateTypes.Add(ArtificerExtendedPlugin.entityStates.ToArray());
			contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.skillFamilies.Add(skillFamilies.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public static class Tools
	{
		public static string modPrefix = string.Format("@{0}+{1}", "ArtificerExtended", "artiskillicons");

		public static AssetBundle LoadAssetBundle(byte[] resourceBytes)
		{
			if (resourceBytes == null)
			{
				throw new ArgumentNullException("resourceBytes");
			}
			return AssetBundle.LoadFromMemory(resourceBytes);
		}

		public static string GetModPrefix(this BaseUnityPlugin plugin, string bundleName)
		{
			return $"@{plugin.Info.Metadata.Name}+{bundleName}";
		}

		public static string ConvertDecimal(float f)
		{
			return f * 100f + "%";
		}

		internal static bool isLoaded(string modguid)
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				string key = pluginInfo.Key;
				PluginInfo value = pluginInfo.Value;
				if (key == modguid)
				{
					return true;
				}
			}
			return false;
		}

		internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Renderer val2 = val;
				if (string.Equals(((Object)val).name, childObject))
				{
					if (color == Color.clear)
					{
						Object.Destroy((Object)(object)val);
						break;
					}
					if ((Object)(object)material == (Object)null)
					{
						material = new Material(val.material);
						material.mainTexture = val.material.mainTexture;
						material.shader = val.material.shader;
						material.color = color;
					}
					val.material = material;
					Transform transform = ((Component)val).transform;
					transform.localScale *= scaleMultiplier;
					if (!replaceAll)
					{
						break;
					}
				}
			}
		}

		internal static void DebugMaterial(GameObject model)
		{
			Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Renderer val2 = val;
				Debug.Log((object)("Material: " + ((Object)val2).name.ToString()));
			}
		}

		internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				ParticleSystem val2 = val;
				MainModule main = val2.main;
				ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
				ColorBySpeedModule colorBySpeed = val2.colorBySpeed;
				if (string.Equals(((Object)val2).name, childObject))
				{
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
					((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier;
					((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color);
					((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color);
					if (!replaceAll)
					{
						break;
					}
				}
			}
		}

		internal static void DebugParticleSystem(GameObject model)
		{
			ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				ParticleSystem val2 = val;
				Debug.Log((object)("Particle: " + ((Object)val2).name.ToString()));
			}
		}

		internal static void GetLight(GameObject model, string childObject, Color color, bool replaceAll = false)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Light[] componentsInChildren = model.GetComponentsInChildren<Light>();
			Light[] array = componentsInChildren;
			foreach (Light val in array)
			{
				Light val2 = val;
				if (string.Equals(((Object)val2).name, childObject))
				{
					val2.color = color;
					if (!replaceAll)
					{
						break;
					}
				}
			}
		}

		internal static void DebugLight(GameObject model)
		{
			Light[] componentsInChildren = model.GetComponentsInChildren<Light>();
			Light[] array = componentsInChildren;
			foreach (Light val in array)
			{
				Light val2 = val;
				Debug.Log((object)("Light: " + ((Object)val2).name.ToString()));
			}
		}
	}
	public static class VRStuff
	{
		public static bool VRInstalled;

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void SetupVR()
		{
			if (Chainloader.PluginInfos.ContainsKey("com.DrBibop.VRAPI"))
			{
				VRInstalled = VR.enabled && MotionControls.enabled;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static Ray GetVRHandAimRay(bool dominant)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			return dominant ? MotionControls.dominantHand.aimRay : MotionControls.nonDominantHand.aimRay;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AnimateVRHand(bool dominant, string triggerName)
		{
			HandController val = (dominant ? MotionControls.dominantHand : MotionControls.nonDominantHand);
			val.animator.SetTrigger(triggerName);
		}
	}
}
namespace ArtificerExtended.Unlocks
{
	internal class ArtificerColdFusionUnlock : UnlockBase
	{
		public ulong killRequirementTotal = 5uL;

		public StatDef postmortemKillCounter = UnlockBase.GetCareerStatTotal("artificerKillsPostMortem");

		public override string UnlockLangTokenName => "COLDFUSION";

		public override string UnlockName => "When Icicles Die...";

		public override string AchievementName => "When Icicles Die...";

		public override string AchievementDesc => $"kill {killRequirementTotal} enemies post-mortem.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("ColdFusion");

		public override bool HideUnlock => true;

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ColdFusionKillCounter(DamageReport damageReport)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			BodyIndex attackerBodyIndex = damageReport.attackerBodyIndex;
			CharacterMaster attackerMaster = damageReport.attackerMaster;
			string? text = ((object)(BodyIndex)(ref attackerBodyIndex)).ToString();
			BodyIndex val = ((BaseAchievement)this).LookUpRequiredBodyIndex();
			Debug.Log((object)(text + " + " + ((object)(BodyIndex)(ref val)).ToString()));
			if (!Object.op_Implicit((Object)(object)attackerMaster) || (attackerBodyIndex != ((BaseAchievement)this).LookUpRequiredBodyIndex() && (int)attackerBodyIndex != -1))
			{
				return;
			}
			CharacterBody attackerBody = damageReport.attackerBody;
			if ((Object)(object)attackerBody == (Object)null || !attackerBody.healthComponent.alive)
			{
				StatSheet currentStats = attackerMaster.playerStatsComponent.currentStats;
				currentStats.PushStatValue(postmortemKillCounter, 1uL);
				ulong statValueULong = ((BaseAchievement)this).userProfile.statSheet.GetStatValueULong(postmortemKillCounter);
				Debug.Log((object)statValueULong);
				if (statValueULong >= killRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerEnergyPassiveUnlock : UnlockBase
	{
		public override string UnlockLangTokenName => "ENERGYPASSIVE";

		public override string UnlockName => "Elemental Intensity";

		public override string AchievementName => "Elemental Intensity";

		public override string AchievementDesc => "equip 4 abilities of a single element at once.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("ElementalIntensity");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			MageCharacterMain.OnEnter += new hook_OnEnter(PowerCheck);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			MageCharacterMain.OnEnter -= new hook_OnEnter(PowerCheck);
			((ModdedUnlockable)this).OnUninstall();
		}

		private void PowerCheck(orig_OnEnter orig, MageCharacterMain self)
		{
			orig.Invoke(self);
			CharacterBody characterBody = ((EntityState)self).characterBody;
			ElementCounter elementCounter = ((characterBody != null) ? ((Component)characterBody).GetComponent<ElementCounter>() : null);
			if ((Object)(object)elementCounter != (Object)null && (elementCounter.firePower >= ElementCounter.Power.Extreme || elementCounter.icePower >= ElementCounter.Power.Extreme || elementCounter.lightningPower >= ElementCounter.Power.Extreme))
			{
				((BaseAchievement)this).Grant();
			}
		}
	}
	internal class ArtificerExtendedSkinUnlock : UnlockBase
	{
		private static readonly int requirement = 10;

		private List<SceneDef> visitedScenes;

		public override bool HideUnlock => true;

		public override bool ForceDisable => true;

		public override string UnlockLangTokenName => "ARTIEXTENDED";

		public override string UnlockName => "...To Explore";

		public override string AchievementName => "...To Explore";

		public override string AchievementDesc => "visit all but 2 stages in a single run, and win.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnBodyRequirementMet()
		{
			((ModdedUnlockable)this).OnBodyRequirementMet();
			visitedScenes = CollectionPool<SceneDef, List<SceneDef>>.RentCollection();
			SceneCatalog.onMostRecentSceneDefChanged += HandleMostRecentSceneDefChanged;
		}

		public override void OnBodyRequirementBroken()
		{
			SceneCatalog.onMostRecentSceneDefChanged -= HandleMostRecentSceneDefChanged;
			visitedScenes = CollectionPool<SceneDef, List<SceneDef>>.ReturnCollection(visitedScenes);
			((ModdedUnlockable)this).OnBodyRequirementBroken();
		}

		private void HandleMostRecentSceneDefChanged(SceneDef newSceneDef)
		{
			if (!visitedScenes.Contains(newSceneDef))
			{
				visitedScenes.Add(newSceneDef);
			}
		}

		public void ClearCheck(Run run, RunReport runReport)
		{
		}

		public override void OnInstall()
		{
			((ModdedUnlockable)this).OnInstall();
			Run.onClientGameOverGlobal += ClearCheck;
		}

		public override void OnUninstall()
		{
			((ModdedUnlockable)this).OnUninstall();
			Run.onClientGameOverGlobal -= ClearCheck;
		}
	}
	internal class ArtificerFlameBurstUnlock : UnlockBase
	{
		public int burnRequirementTotal = 15;

		public int burnCounter = 0;

		public override string UnlockLangTokenName => "FLAMEBURST";

		public override string UnlockName => "To Fight Fire";

		public override string AchievementName => "To Fight Fire";

		public override string AchievementDesc => $"kill {burnRequirementTotal} Blazing Elites with burn damage in a single run.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("Fireskill2icon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			GlobalEventManager.onCharacterDeathGlobal += AddBurnCounter;
			Run.onRunStartGlobal += ResetBurnCounter;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			GlobalEventManager.onCharacterDeathGlobal -= AddBurnCounter;
			Run.onRunStartGlobal -= ResetBurnCounter;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ResetBurnCounter(Run obj)
		{
			burnCounter = 0;
		}

		private void AddBurnCounter(DamageReport obj)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Invalid comparison between Unknown and I4
			CharacterBody attackerBody = obj.attackerBody;
			CharacterBody victimBody = obj.victimBody;
			if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)victimBody) || attackerBody.bodyIndex != ((BaseAchievement)this).LookUpRequiredBodyIndex() || !victimBody.HasBuff(Buffs.AffixRed))
			{
				return;
			}
			DamageInfo damageInfo = obj.damageInfo;
			bool flag = ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)128) || ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)8192);
			bool flag2 = (int)damageInfo.dotIndex == 1 || (int)damageInfo.dotIndex == 3 || (int)damageInfo.dotIndex == 7;
			if (flag || flag2)
			{
				burnCounter++;
				if (burnCounter >= burnRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerFrostbiteUnlock : UnlockBase
	{
		public override string UnlockLangTokenName => "FROSTBITE";

		public override string UnlockName => "Absolute Zero";

		public override string AchievementName => "Absolute Zero";

		public override string AchievementDesc => "freeze and execute the King of Nothing.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("frostbitesketch1");

		private void ExecuteMithrixCheck(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//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_0011: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00a1: 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)
			bool flag = false;
			CharacterBody body = self.body;
			BodyIndex bodyIndex = body.bodyIndex;
			if ((bodyIndex == BodyCatalog.FindBodyIndex("BrotherBody") || bodyIndex == BodyCatalog.FindBodyIndex("BrotherGlassBody") || bodyIndex == BodyCatalog.FindBodyIndex("BrotherHauntBody") || bodyIndex == BodyCatalog.FindBodyIndex("BrotherHurtBody")) && self.isInFrozenState)
			{
				flag = true;
			}
			orig.Invoke(self, damageInfo);
			if (!flag || self.alive)
			{
				return;
			}
			GameObject attacker = damageInfo.attacker;
			CharacterBody val = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null);
			if ((Object)(object)val != (Object)null)
			{
				BodyIndex bodyIndex2 = val.bodyIndex;
				if (bodyIndex2 == ((BaseAchievement)this).LookUpRequiredBodyIndex())
				{
					((BaseAchievement)this).Grant();
				}
			}
		}

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage += new hook_TakeDamage(ExecuteMithrixCheck);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage -= new hook_TakeDamage(ExecuteMithrixCheck);
			((ModdedUnlockable)this).OnUninstall();
		}
	}
	internal class ArtificerIceShardsUnlock : UnlockBase
	{
		public static float timeRequirement = 600f;

		public override bool ForceDisable => false;

		public override string UnlockLangTokenName => "ICESHARDS";

		public override string UnlockName => "Flawless Execution";

		public override string AchievementName => "Flawless Execution";

		public override string AchievementDesc => "fully charge the third teleporter before the timer reaches 10 minutes.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("IceShardsIcon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			((ModdedUnlockable)this).OnUninstall();
		}

		private void OnTeleporterChargedGlobal(TeleporterInteraction teleporterInteraction)
		{
			if (Run.instance.GetRunStopwatch() < timeRequirement && Run.instance.stageClearCount == 2 && ((BaseAchievement)this).isUserAlive)
			{
				((BaseAchievement)this).Grant();
			}
		}

		public override void OnBodyRequirementMet()
		{
			TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterChargedGlobal;
			((ModdedUnlockable)this).OnBodyRequirementMet();
		}

		public override void OnBodyRequirementBroken()
		{
			TeleporterInteraction.onTeleporterChargedGlobal -= OnTeleporterChargedGlobal;
			((ModdedUnlockable)this).OnBodyRequirementBroken();
		}
	}
	internal class ArtificerLaserUnlock : UnlockBase
	{
		public ulong stunRequirementTotal = 100uL;

		public StatDef stunCounter = UnlockBase.GetCareerStatTotal("artificerTotalEnemiesStunned");

		public override string UnlockLangTokenName => "LASERBOLTCAREER";

		public override string UnlockName => "Stunning Precision";

		public override string AchievementName => "Stunning Precision";

		public override string AchievementDesc => $"stun {stunRequirementTotal} enemies.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("LaserboltIcon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer += new hook_OnTakeDamageServer(AddStunCounter);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer -= new hook_OnTakeDamageServer(AddStunCounter);
			((ModdedUnlockable)this).OnUninstall();
		}

		private void AddStunCounter(orig_OnTakeDamageServer orig, SetStateOnHurt self, DamageReport damageReport)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo damageInfo = damageReport.damageInfo;
			if (damageInfo.procCoefficient > 0f && damageReport.attackerBodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				HealthComponent val = self.targetStateMachine?.commonComponents.healthComponent;
				bool flag = false;
				if ((Object)(object)val != (Object)null && val.isInFrozenState)
				{
					flag = true;
				}
				if (self.canBeStunned && !flag && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)32))
				{
					StatSheet val2 = damageReport.attackerMaster.playerStatsComponent?.currentStats;
					if (val2 != null)
					{
						val2.PushStatValue(stunCounter, 1uL);
						if (((BaseAchievement)this).userProfile.statSheet.GetStatValueULong(stunCounter) >= stunRequirementTotal)
						{
							((BaseAchievement)this).Grant();
						}
					}
				}
			}
			orig.Invoke(self, damageReport);
		}
	}
	internal class ArtificerMeteorUnlock : UnlockBase
	{
		private GameObject meteorGameObject = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/MeteorStorm");

		public override string UnlockLangTokenName => "METEOR";

		public override string UnlockName => "Cloudy, With A Chance Of...";

		public override string AchievementName => "Cloudy, With A Chance Of...";

		public override string AchievementDesc => "kill yourself with a Glowing Meteorite.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("meteoricon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			GlobalEventManager.onCharacterDeathGlobal += MeteorCheck;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			GlobalEventManager.onCharacterDeathGlobal -= MeteorCheck;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void MeteorCheck(DamageReport obj)
		{
			//IL_0019: 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)
			CharacterBody attackerBody = obj.attackerBody;
			CharacterBody victimBody = obj.victimBody;
			if ((Object)(object)attackerBody == (Object)(object)victimBody && attackerBody.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				GameObject inflictor = obj.damageInfo.inflictor;
				MeteorStormController component = inflictor.GetComponent<MeteorStormController>();
				if ((Object)(object)component != (Object)null)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerNapalmUnlock : UnlockBase
	{
		public int burnRequirementTotal = 25;

		public override string UnlockLangTokenName => "NAPALM";

		public override string UnlockName => "Meltdown";

		public override string AchievementName => "Meltdown";

		public override string AchievementDesc => $"apply {burnRequirementTotal} stacks of burn to a single target.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("napalmicon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(CountBurn);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GlobalEventManager.OnHitEnemy -= new hook_OnHitEnemy(CountBurn);
			((ModdedUnlockable)this).OnUninstall();
		}

		private void CountBurn(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (damageInfo.procCoefficient == 0f || damageInfo.rejected || !NetworkServer.active)
			{
				return;
			}
			CharacterBody component = victim.GetComponent<CharacterBody>();
			CharacterBody val = null;
			if ((Object)(object)damageInfo.attacker != (Object)null)
			{
				val = damageInfo.attacker.GetComponent<CharacterBody>();
			}
			if ((Object)(object)component != (Object)null && (Object)(object)val != (Object)null && val.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				int num = component.GetBuffCount(Buffs.OnFire) + component.GetBuffCount(Buffs.StrongerBurn) + 1;
				if (num >= burnRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
			orig.Invoke(self, damageInfo, victim);
		}
	}
	internal class ArtificerShockwaveUnlock : UnlockBase
	{
		private float overkillAmount = 1f;

		public override string UnlockLangTokenName => "SHOCKWAVE";

		public override string UnlockName => "Nuked!";

		public override string AchievementName => "Nuked!";

		public override string AchievementDesc => $"overkill an Overloading Elite enemy by more than {overkillAmount * 100f}% of it's Combined Maximum Health.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("shockwaveicon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage += new hook_TakeDamage(OverkillCheck);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage -= new hook_TakeDamage(OverkillCheck);
			((ModdedUnlockable)this).OnUninstall();
		}

		private void OverkillCheck(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody body = self.body;
			bool flag = body.HasBuff(Buffs.AffixBlue);
			float combinedHealth = self.combinedHealth;
			float fullHealth = self.fullHealth;
			orig.Invoke(self, damageInfo);
			if (!(!self.alive && flag))
			{
				return;
			}
			CharacterBody val = null;
			if ((Object)(object)damageInfo.attacker != (Object)null)
			{
				val = damageInfo.attacker.GetComponent<CharacterBody>();
			}
			if ((Object)(object)val != (Object)null && val.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				float num = damageInfo.damage - combinedHealth;
				if (num > fullHealth * overkillAmount)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerSnowballUnlock : UnlockBase
	{
		public int freezeRequirementTotal = 20;

		public int freezeCounter = 0;

		public override string UnlockLangTokenName => "SNOWBALL";

		public override string UnlockName => "Freeze Tag!";

		public override string AchievementName => "Freeze Tag!";

		public override string AchievementDesc => $"freeze Glacial Elites {freezeRequirementTotal} times in a single run.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("SnowballIcon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer += new hook_OnTakeDamageServer(AddFreezeCounter);
			Run.onRunStartGlobal += ResetFreezeCounter;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer -= new hook_OnTakeDamageServer(AddFreezeCounter);
			Run.onRunStartGlobal -= ResetFreezeCounter;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ResetFreezeCounter(Run obj)
		{
			freezeCounter = 0;
		}

		private void AddFreezeCounter(orig_OnTakeDamageServer orig, SetStateOnHurt self, DamageReport damageReport)
		{
			//IL_0009: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			DamageInfo damageInfo = damageReport.damageInfo;
			if (damageReport.attackerBodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex() && damageReport.victimBody.HasBuff(Buffs.AffixWhite) && damageInfo.procCoefficient > 0f && self.canBeFrozen && (damageInfo.damageType & 0x100) > 0)
			{
				freezeCounter++;
				if (freezeCounter >= freezeRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
			orig.Invoke(self, damageReport);
		}
	}
	internal class ArtificerTempDropUnlock : UnlockBase
	{
		public int freezeRequirementTotal = 4;

		private static BuffDef AvalancheBuff;

		public override string UnlockLangTokenName => "TEMPDROP";

		public override string UnlockName => "Avalanche!";

		public override string AchievementName => "Avalanche!";

		public override string AchievementDesc => $"have {freezeRequirementTotal} monsters frozen at once.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("AvalancheIcon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		private static void CreateBuff(orig_Init orig)
		{
			//IL_0036: 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)
			orig.Invoke();
			AvalancheBuff = Buffs.OnFire;
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = "avalancheUnlockTracker";
			val.iconSprite = LegacyResourcesAPI.Load<Sprite>("textures/bufficons/texBuffGenericShield");
			val.buffColor = Color.red;
			val.canStack = true;
			val.isDebuff = false;
		}

		private void AddFreezeCounter(orig_OnTakeDamageServer orig, SetStateOnHurt self, DamageReport damageReport)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (damageReport != null && Object.op_Implicit((Object)(object)self.targetStateMachine) && self.spawnedOverNetwork)
			{
				DamageInfo damageInfo = damageReport.damageInfo;
				if (damageReport.attackerBodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
				{
					HealthComponent val = self.targetStateMachine?.commonComponents.healthComponent;
					bool flag = false;
					if ((Object)(object)val != (Object)null)
					{
						flag = val.isInFrozenState;
					}
					if (damageInfo.procCoefficient > 0f && self.canBeFrozen && !flag && (damageInfo.damageType & 0x100) != 0 && (Object)(object)damageReport.attackerBody != (Object)null)
					{
						Debug.Log((object)((Object)damageReport.attackerBody).name);
						damageReport.attackerBody.AddTimedBuffAuthority(Buffs.OnFire.buffIndex, 2f * damageInfo.procCoefficient);
						int buffCount = damageReport.attackerBody.GetBuffCount(Buffs.OnFire);
						if (buffCount >= freezeRequirementTotal)
						{
							((BaseAchievement)this).Grant();
						}
					}
				}
			}
			orig.Invoke(self, damageReport);
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BuffCatalog.Init += new hook_Init(CreateBuff);
			SetStateOnHurt.OnTakeDamageServer += new hook_OnTakeDamageServer(AddFreezeCounter);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BuffCatalog.Init -= new hook_Init(CreateBuff);
			SetStateOnHurt.OnTakeDamageServer -= new hook_OnTakeDamageServer(AddFreezeCounter);
			((ModdedUnlockable)this).OnUninstall();
		}
	}
	internal class ArtificerThunderUnlock : UnlockBase
	{
		public override string UnlockLangTokenName => "THUNDER";

		public override string UnlockName => "Ugorn’s Music";

		public override string AchievementName => "Ugorn’s Music";

		public override string AchievementDesc => "land the killing blow on an Imp Overlord with a powerful lightning strike.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("thundericon");

		public override void Init(ConfigFile config)
		{
			CreateLang();
		}

		public override void OnInstall()
		{
			GlobalEventManager.onCharacterDeathGlobal += ImpBossSmiteCheck;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			GlobalEventManager.onCharacterDeathGlobal -= ImpBossSmiteCheck;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ImpBossSmiteCheck(DamageReport obj)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody attackerBody = obj.attackerBody;
			CharacterBody victimBody = obj.victimBody;
			DamageInfo damageInfo = obj.damageInfo;
			if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody) && damageInfo != null)
			{
				bool flag = victimBody.bodyIndex == BodyCatalog.FindBodyIndex("ImpBossBody");
				if (attackerBody.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex() && flag && (damageInfo.force == Vector3.down * 1500f || (damageInfo.force == Vector3.down * 3000f && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)32))) && (Object)(object)damageInfo.inflictor == (Object)null)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	public abstract class UnlockBase<T> : UnlockBase where T : UnlockBase<T>
	{
		public static T instance { get; private set; }

		public UnlockBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting UnlockBase was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class UnlockBase : ModdedUnlockable
	{
		public static string Token = ArtificerExtendedPlugin.TokenName + "UNLOCK_";

		public abstract string UnlockLangTokenName { get; }

		public abstract string UnlockName { get; }

		public abstract string AchievementName { get; }

		public abstract string AchievementDesc { get; }

		public virtual bool ForceDisable => false;

		public override string AchievementIdentifier => Token + UnlockLangTokenName + "_ACHIEVEMENT_ID";

		public override string UnlockableIdentifier => Token + UnlockLangTokenName + "_REWARD_ID";

		public override string AchievementNameToken => Token + UnlockLangTokenName + "_ACHIEVEMENT_NAME";

		public override string AchievementDescToken => Token + UnlockLangTokenName + "_ACHIEVEMENT_DESC";

		public override string UnlockableNameToken => Token + UnlockLangTokenName + "_UNLOCKABLE_NAME";

		public virtual bool HideUnlock => false;

		public override Func<string> GetHowToUnlock => () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2]
		{
			Language.GetString(((ModdedUnlockable)this).AchievementNameToken),
			Language.GetString(((ModdedUnlockable)this).AchievementDescToken)
		});

		public override Func<string> GetUnlocked => () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2]
		{
			Language.GetString(((ModdedUnlockable)this).AchievementNameToken),
			Language.GetString(((ModdedUnlockable)this).AchievementDescToken)
		});

		internal Sprite GetSpriteProvider(string iconName)
		{
			return ArtificerExtendedPlugin.iconBundle.LoadAsset<Sprite>(ArtificerExtendedPlugin.iconsPath + iconName + ".png");
		}

		public override BodyIndex LookUpRequiredBodyIndex()
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			return BodyCatalog.FindBodyIndex("MageBody");
		}

		public abstract void Init(ConfigFile config);

		protected void CreateLang()
		{
			LanguageAPI.Add(((ModdedUnlockable)this).AchievementNameToken, "Artificer: " + AchievementName);
			LanguageAPI.Add(((ModdedUnlockable)this).AchievementDescToken, "As Artificer, " + AchievementDesc);
			LanguageAPI.Add(((ModdedUnlockable)this).UnlockableNameToken, "Artificer: " + UnlockName);
		}

		public static StatDef GetCareerStatTotal(string name)
		{
			StatDef val = StatDef.Find(name);
			if (val == null)
			{
				val = StatDef.Register(name, (StatRecordType)0, (StatDataType)0, 0.0, (DisplayValueFormatterDelegate)null);
			}
			return val;
		}
	}
}
namespace ArtificerExtended.Skills
{
	internal class _1IceShardsSkill : SkillBase
	{
		public static GameObject tracerShotgun;

		public static GameObject tracerBuckshot;

		private float totalShards = FireIceShard.bulletCountBuckshot + FireIceShard.bulletCountPoint + FireIceShard.bulletCountSpread;

		public override string SkillName => "Ice Shards";

		public override string SkillDescription => "Fire a blast of ice shards for " + $"<style=cIsDamage>up to {totalShards}x{Tools.ConvertDecimal(FireIceShard.damageCoefficient / totalShards)} damage</style> total, " + "which <style=cIsUtility>Chills</style> enemies. Hold up to 4.";

		public override string SkillLangTokenName => "ICESHARDS";

		public override UnlockableDef UnlockDef => GetUnlockDef(typeof(ArtificerIceShardsUnlock));

		public override string IconName => "IceShardsIcon";

		public override MageElement Element => (MageElement)2;

		public override Type ActivationState => typeof(FireIceShard);

		public override SkillFamily SkillSlot => ArtificerExtendedPlugin.magePrimary;

		public override SimpleSkillData SkillData => new SimpleSkillData(4, 1.3f, beginSkillCooldownOnSkillEnd: false, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, (!ArtificerExtendedPlugin.isRiskyModLoaded) ? 1 : 0);

		public override bool useSteppedDef { get; set; } = true;


		public override void Hooks()
		{
		}

		private void CreateTracerEffects()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			tracerShotgun = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/tracers/TracerCommandoShotgun"), "tracerMageIceShard", false);
			Tracer component = tracerShotgun.GetComponent<Tracer>();
			component.speed = 100f;
			component.length = 3f;
			component.beamDensity = 5f;
			VFXAttributes val = tracerShotgun.AddComponent<VFXAttributes>();
			val.vfxPriority = (VFXPriority)1;
			val.vfxIntensity = (VFXIntensity)1;
			tracerBuckshot = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/tracers/TracerCommandoShotgun"), "tracerMageIceShardBuckshot", false);
			Tracer component2 = tracerBuckshot.GetComponent<Tracer>();
			component2.speed = 60f;
			component2.length = 2f;
			component2.beamDensity = 3f;
			VFXAttributes val2 = tracerBuckshot.AddComponent<VFXAttributes>();
			val2.vfxPriority = (VFXPriority)1;
			val2.vfxIntensity = (VFXIntensity)1;
			Effects.CreateEffect(tracerShotgun);
			Effects.CreateEffect(tracerBuckshot);
		}

		public override void Init(ConfigFile config)
		{
			FireIceShard.maxRange = config.Bind<float>("Skills Config: " + SkillName, "Max Range", FireIceShard.maxRange, "Determines the cutoff radius for Ice Shards bullets. Damage falloff still applies.").Value;
			FireIceShard.damageCoefficient = config.Bind<float>("Skills Config: " + SkillName, "Damage Per Pellet", FireIceShard.damageCoefficient / totalShards, "Determines the max damage coefficient per Ice Shards pellet. Damage falloff still applies.").Value * totalShards;
			KeywordTokens = new string[1] { "2R4R_KEYWORD_CHILL" };
			CreateTracerEffects();
			CreateLang();
			CreateSkill();
		}
	}
	internal class _2FireSkill2Skill : SkillBase
	{
		public static GameObject outerFireball;

		public static GameObject innerFireball;

		public override string SkillName => "Flame Burst";

		public override string SkillDescription => "Ignite. Charge a spread of 3 fireballs for <style=cIsDamage>" + Tools.ConvertDecimal(ChargeFireBlast.minDamageCoefficient) + "-" + Tools.ConvertDecimal(ChargeFireBlast.maxDamageCoefficient) + " damage each</style> that converge on a point in front of you.";

		public override string SkillLangTokenName => "FIREBALLS";

		public override UnlockableDef UnlockDef => GetUnlockDef(typeof(ArtificerFlameBurstUnlock));

		public override string IconName => "Fireskill2icon";

		public override MageElement Element => (MageElement)1;

		public override Type ActivationState => typeof(ChargeFireBlast);

		public override SkillFamily SkillSlot => ArtificerExtendedPlugin.magePrimary;

		public override SimpleSkillData SkillData => new SimpleSkillData(1, 2f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0);

		public override void Hooks()
		{
		}

		public override void Init(ConfigFile config)
		{
			ChargeFireBlast.minDamageCoefficient = config.Bind<float>("Skills Config: " + SkillName, "Minimum Damage Coefficient", ChargeFireBlast.minDamageCoefficient, "Determines the minimum damage of Fire Blast.").Value;
			ChargeFireBlast.maxDamageCoefficient = config.Bind<float>("Skills Config: " + SkillName, "Max Damage Coefficient", ChargeFireBlast.maxDamageCoefficient, "Determines the max damage of Fire Blast. ").Value;
			KeywordTokens = new string[1] { "KEYWORD_IGNITE" };
			CreateProjectiles();
			CreateLang();
			CreateSkill();
		}

		private void CreateProjectiles()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			float blastRadius = 4f;
			float num = 0.5f;
			outerFireball = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/MageFireBombProjectile"), "mageFireballOuter", true);
			outerFireball.transform.localScale = Vector3.one * num;
			ProjectileSimple component = outerFireball.GetComponent<ProjectileSimple>();
			component.desiredForwardSpeed = 80f;
			component.lifetime = 0.3f;
			component.updateAfterFiring = true;
			component.oscillate = true;
			component.oscillateSpeed = 25f;
			component.oscillateMagnitude = 60f;
			ProjectileImpactExplosion component2 = outerFireball.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component2).blastRadius = blastRadius;
			((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)component2).bonusBlastForce = Vector3.zero;
			component2.lifetime = 0.275f;
			innerFireball = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/MageFireBombProjectile"), "mageFireballInner", true);
			innerFireball.transform.localScale = Vector3.one * num;
			ProjectileSimple component3 = innerFireball.GetComponent<ProjectileSimple>();
			component3.desiredForwardSpeed = component.desiredForwardSpeed;
			component3.lifetime = component.lifetime + 0.05f;
			component3.updateAfterFiring = component.updateAfterFiring;
			ProjectileImpactExplosion component4 = innerFireball.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component4).blastRadius = blastRadius;
			((ProjectileExplosion)component4).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)component4).bonusBlastForce = Vector3.zero;
			component4.lifetime = component2.lifetime + 0.05f;
			ContentPacks.projectilePrefabs.Add(outerFireball);
			ContentPacks.projectilePrefabs.Add(innerFireball);
		}
	}
	internal class _3LaserBoltsSkill : SkillBase
	{
		public static GameObject tracerLaser;

		private int maxStock = 4;

		public override string SkillName => "Laserbolts";

		public override string SkillDescription => "Fire a long-range laser for <style=cIsDamage>" + Tools.ConvertDecimal(FireLaserbolts.damageCoefficient) + " damage</style>. Hold up to 4, recharging all at once.";

		public override string SkillLangTokenName => "LASERS";

		public override UnlockableDef UnlockDef => GetUnlockDef(typeof(ArtificerLaserUnlock));

		public override string IconName => "LaserboltIcon";

		public override MageElement Element => (MageElement)3;

		public override Type ActivationState => typeof(FireLaserbolts);

		public override SkillFamily SkillSlot => ArtificerExtendedPlugin.magePrimary;

		public override SimpleSkillData SkillData => new SimpleSkillData(maxStock, 2f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, maxStock, 1, resetCooldownTimerOnUse: true);

		public override bool useSteppedDef { get; set; } = true;


		public override void Hooks()
		{
		}

		public override void Init(ConfigFile config)
		{
			FireLaserbolts.maxRange = config.Bind<float>("Skills Config:

dll/BubbetsItems.dll.old

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using Aetherium;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BubbetsItems.Behaviours;
using BubbetsItems.Components;
using BubbetsItems.Helpers;
using BubbetsItems.ItemBehaviors;
using BubbetsItems.Items;
using BubbetsItems.Items.BarrierItems;
using BubbetsItems.Items.VoidLunar;
using EntityStates;
using EntityStates.Interactables.MSObelisk;
using EntityStates.Merc;
using HG;
using HG.Reflection;
using HarmonyLib;
using InLobbyConfig;
using InLobbyConfig.Fields;
using ItemStats;
using JetBrains.Annotations;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using NCalc;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.EntityLogic;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Networking;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2.UI.LogBook;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.UI;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ZedMod
{
	[ExecuteAlways]
	public class PrefabLoader : MonoBehaviour
	{
		public string prefabAddress;

		private string _loadedPrefab;

		private bool _loading;

		private GameObject _instance;

		private void Start()
		{
			LoadPrefab();
		}

		private void OnValidate()
		{
			LoadPrefab();
		}

		private void LoadPrefab()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrEmpty(prefabAddress) && !_loading)
			{
				_loading = true;
				AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)prefabAddress);
				val.Completed += PrefabLoaded;
			}
		}

		private void PrefabLoaded(AsyncOperationHandle<GameObject> obj)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected I4, but got Unknown
			AsyncOperationStatus status = obj.Status;
			switch ((int)status)
			{
			case 1:
				if (!(_loadedPrefab == prefabAddress))
				{
					if ((Object)(object)_instance != (Object)null)
					{
						Object.DestroyImmediate((Object)(object)_instance);
					}
					GameObject result = obj.Result;
					_instance = Object.Instantiate<GameObject>(result, ((Component)this).gameObject.transform, false);
					SetRecursiveFlags(_instance.transform);
					_loadedPrefab = prefabAddress;
					_loading = false;
				}
				break;
			case 2:
				if ((Object)(object)_instance != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)_instance);
				}
				Debug.LogError((object)"Prefab load failed.");
				_loading = false;
				break;
			case 0:
				break;
			}
		}

		private static void SetRecursiveFlags(Transform transform)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			GameObject gameObject = ((Component)transform).gameObject;
			((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x34);
			foreach (Transform item in transform)
			{
				SetRecursiveFlags(item);
			}
		}
	}
}
namespace MaterialHud
{
	[ExecuteAlways]
	public class FieldLoader : MonoBehaviour
	{
		public string addressablePath = "";

		public string targetFieldName = "";

		public Component target;

		private static readonly MethodInfo? LoadAssetAsyncInfo = typeof(Addressables).GetMethod("LoadAssetAsync", new Type[1] { typeof(string) });

		private const BindingFlags Flags = BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private void LoadAsset(bool dontSave = false)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			Type type = ((object)target).GetType();
			FieldInfo field = type.GetField(targetFieldName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			PropertyInfo propertyInfo = null;
			if (field == null)
			{
				propertyInfo = type.GetProperty(targetFieldName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (propertyInfo == null)
				{
					return;
				}
			}
			object obj = (LoadAssetAsyncInfo?.MakeGenericMethod(field?.FieldType ?? propertyInfo.PropertyType))?.Invoke(null, new object[1] { addressablePath });
			object obj2 = (obj?.GetType().GetMethod("WaitForCompletion", BindingFlags.Instance | BindingFlags.Public))?.Invoke(obj, null);
			Object val = (Object)((obj2 is Object) ? obj2 : null);
			if (!(val == (Object)null))
			{
				if (dontSave)
				{
					val.hideFlags = (HideFlags)(val.hideFlags | 0x34);
				}
				field?.SetValue(target, obj2);
				propertyInfo?.SetValue(target, obj2);
			}
		}

		private IEnumerator WaitAndLoadAsset()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => Addressables.InternalIdTransformFunc != null));
			LoadAsset(dontSave: true);
		}

		private void Start()
		{
			LoadAsset();
		}

		private void OnValidate()
		{
			if (((Component)this).gameObject.activeInHierarchy)
			{
				((MonoBehaviour)this).StartCoroutine(WaitAndLoadAsset());
			}
		}
	}
	[ExecuteAlways]
	public class ParticleSystemMaterialLoader : MonoBehaviour
	{
		public string addressablePath;

		public ParticleSystem target;

		[FormerlySerializedAs("Tint")]
		public Color tint;

		private void LoadAsset(bool dontSave = false)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystemRenderer component = ((Component)target).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).material = Addressables.LoadAssetAsync<Material>((object)addressablePath).WaitForCompletion();
			if (tint != default(Color))
			{
				((Renderer)component).material.SetColor("_TintColor", tint);
			}
		}

		private IEnumerator WaitAndLoadAsset()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => Addressables.InternalIdTransformFunc != null));
			LoadAsset(dontSave: true);
		}

		private void Start()
		{
			LoadAsset();
		}

		private void OnValidate()
		{
			if (((Component)this).gameObject.activeInHierarchy)
			{
				((MonoBehaviour)this).StartCoroutine(WaitAndLoadAsset());
			}
		}
	}
	[ExecuteAlways]
	public class PrefabChildLoader : MonoBehaviour
	{
		public string prefabAddress = "";

		public int childIndex;

		private bool _loading;

		private GameObject? _instance;

		private int _loadedIndex = -1;

		public UnityEvent finished = new UnityEvent();

		private void Start()
		{
			LoadPrefab();
		}

		private void OnValidate()
		{
			LoadPrefab();
		}

		private void LoadPrefab()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (_loadedIndex != childIndex)
			{
				_loadedIndex = -1;
				if ((Object)(object)_instance != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)_instance);
				}
			}
			if (!string.IsNullOrEmpty(prefabAddress) && !_loading)
			{
				_loading = true;
				AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)prefabAddress);
				val.Completed += PrefabLoaded;
			}
		}

		private void PrefabLoaded(AsyncOperationHandle<GameObject> obj)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected I4, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationStatus status = obj.Status;
			switch ((int)status)
			{
			case 1:
				if (_loadedIndex != childIndex)
				{
					if ((Object)(object)_instance != (Object)null)
					{
						Object.DestroyImmediate((Object)(object)_instance);
					}
					GameObject val = Object.Instantiate<GameObject>(obj.Result);
					_instance = ((val.transform.childCount > 0) ? ((Component)val.transform.GetChild(Math.Min(childIndex, val.transform.childCount - 1))).gameObject : val);
					Transform transform = _instance.transform;
					SetRecursiveFlags(transform);
					transform.eulerAngles = Vector3.zero;
					transform.position = Vector3.zero;
					transform.localScale = Vector3.one;
					transform.SetParent(((Component)this).gameObject.transform, false);
					if (val.transform.childCount > 0)
					{
						Object.DestroyImmediate((Object)(object)val);
					}
					_loadedIndex = childIndex;
					_loading = false;
					finished.Invoke();
				}
				break;
			case 2:
				if ((Object)(object)_instance != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)_instance);
				}
				Debug.LogError((object)"Prefab load failed.");
				_loading = false;
				break;
			case 0:
				break;
			}
		}

		private static void SetRecursiveFlags(Transform transform)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			GameObject gameObject = ((Component)transform).gameObject;
			((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x34);
			foreach (Transform item in transform)
			{
				SetRecursiveFlags(item);
			}
		}
	}
	[ExecuteAlways]
	public class ShaderLoader : MonoBehaviour
	{
		public string addressablePath = "";

		public Renderer target;

		[ContextMenu("Fill In Editor")]
		[ExecuteAlways]
		public void Start()
		{
			//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_004b: Unknown result type (might be due to invalid IL or missing references)
			Shader shader = Addressables.LoadAssetAsync<Shader>((object)addressablePath).WaitForCompletion();
			target.material.shader = shader;
			target.sharedMaterial.shader = shader;
			for (int i = 0; i < target.sharedMaterial.shader.GetPropertyCount(); i++)
			{
				Debug.Log((object)target.sharedMaterial.shader.GetPropertyFlags(i));
			}
		}
	}
}
namespace BubbetsItems
{
	[HarmonyPatch]
	public abstract class EquipmentBase : SharedBase
	{
		public enum EquipmentActivationState
		{
			ConsumeStock,
			DontConsume,
			DidNothing
		}

		public EquipmentDef EquipmentDef;

		private static IEnumerable<EquipmentBase>? _equipments;

		internal ConfigEntry<float> Cooldown;

		public static IEnumerable<EquipmentBase> Equipments => _equipments ?? (_equipments = SharedBase.Instances.OfType<EquipmentBase>());

		protected override void MakeConfigs()
		{
			string name = GetType().Name;
			Enabled = sharedInfo.ConfigFile.Bind<bool>("Disable Equipments", name, true, "Should this equipment be enabled.");
			Cooldown = sharedInfo.ConfigFile.Bind(ConfigCategoriesEnum.EquipmentCooldowns, name, Object.op_Implicit((Object)(object)EquipmentDef) ? EquipmentDef.cooldown : 15f, "Cooldown for this equipment.", 0f);
			Cooldown.SettingChanged += CooldownChanged;
		}

		[SystemInitializer(new Type[] { typeof(EquipmentCatalog) })]
		public static void ApplyPostEquipments()
		{
			foreach (EquipmentBase equipment in Equipments)
			{
				equipment.PostEquipmentDef();
			}
		}

		private void CooldownChanged(object sender, EventArgs e)
		{
			EquipmentDef.cooldown = Cooldown.Value;
		}

		public override void MakeRiskOfOptions()
		{
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			base.MakeRiskOfOptions();
			SliderConfig val = new SliderConfig
			{
				min = 0f,
				max = 80f
			};
			ModSettingsManager.AddOption((BaseOption)new SliderOption(Cooldown, val));
		}

		public virtual void AuthorityEquipmentPress(EquipmentSlot equipmentSlot)
		{
		}

		public virtual void PerformClientAction(EquipmentSlot equipmentSlot, EquipmentActivationState state)
		{
		}

		public virtual EquipmentActivationState PerformEquipment(EquipmentSlot equipmentSlot)
		{
			return EquipmentActivationState.DidNothing;
		}

		public virtual void OnUnEquip(Inventory inventory, EquipmentState newEquipmentState)
		{
		}

		public virtual void OnEquip(Inventory inventory, EquipmentState? oldEquipmentState)
		{
		}

		public virtual bool UpdateTargets(EquipmentSlot equipmentSlot)
		{
			return false;
		}

		protected virtual void PostEquipmentDef()
		{
			EquipmentDef.cooldown = Cooldown.Value;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(EquipmentSlot), "InvokeRpcRpcOnClientEquipmentActivationRecieved")]
		public static bool NetReceive(NetworkBehaviour obj, NetworkReader reader)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			EquipmentActivationState state = EquipmentActivationState.ConsumeStock;
			try
			{
				state = (EquipmentActivationState)reader.ReadByte();
			}
			catch (IndexOutOfRangeException)
			{
			}
			EquipmentSlot val = (EquipmentSlot)obj;
			EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val.equipmentIndex);
			EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)equipmentDef);
			if (equipmentBase != null)
			{
				equipmentBase.PerformClientAction(val, state);
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(EquipmentSlot), "CallCmdExecuteIfReady")]
		public static void PerformEquipmentActionClient(EquipmentSlot __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.characterBody.hasEffectiveAuthority && !NetworkServer.active && (int)__instance.equipmentIndex != -1 && __instance.stock > 0)
			{
				EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(__instance.equipmentIndex);
				Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)equipmentDef)?.AuthorityEquipmentPress(__instance);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(EquipmentSlot), "PerformEquipmentAction")]
		public static bool PerformEquipmentAction(EquipmentSlot __instance, EquipmentDef equipmentDef, ref bool __result)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			EquipmentDef equipmentDef2 = equipmentDef;
			EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)equipmentDef2);
			if (equipmentBase == null)
			{
				return true;
			}
			try
			{
				EquipmentActivationState equipmentActivationState = equipmentBase.PerformEquipment(__instance);
				__result = equipmentActivationState == EquipmentActivationState.ConsumeStock;
				if (equipmentActivationState != 0 && NetworkServer.active)
				{
					NetworkWriter val = new NetworkWriter();
					val.StartMessage((short)2);
					val.WritePackedUInt32((uint)EquipmentSlot.kRpcRpcOnClientEquipmentActivationRecieved);
					val.Write(((Component)__instance).GetComponent<NetworkIdentity>().netId);
					val.Write((byte)equipmentActivationState);
					((NetworkBehaviour)__instance).SendRPCInternal(val, 0, "RpcOnClientEquipmentActivationRecieved");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logger = equipmentBase.sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogError((object)ex);
				}
			}
			return false;
		}

		[HarmonyILManipulator]
		[HarmonyPatch(typeof(EquipmentSlot), "UpdateTargets")]
		public static void UpdateTargetsIL(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int activeFlag = -1;
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<EquipmentSlot>(x, "targetIndicator"),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref activeFlag)
			});
			int index = val.Index;
			val.Index = index - 1;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<EquipmentSlot, bool>>((Func<EquipmentSlot, bool>)UpdateTargetsHook);
			val.Emit(OpCodes.Ldloc, activeFlag);
			val.Emit(OpCodes.Or);
			val.Emit(OpCodes.Stloc, activeFlag);
		}

		public static bool UpdateTargetsHook(EquipmentSlot __instance)
		{
			EquipmentSlot __instance2 = __instance;
			EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => x.EquipmentDef.equipmentIndex == __instance2.equipmentIndex);
			if (equipmentBase == null)
			{
				return false;
			}
			try
			{
				return equipmentBase.UpdateTargets(__instance2);
			}
			catch (Exception ex)
			{
				ManualLogSource logger = equipmentBase.sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogError((object)ex);
				}
			}
			return false;
		}

		public override string GetFormattedDescription(Inventory? inventory = null, string? token = null, bool forceHideExtended = false)
		{
			return Language.GetString(token ?? EquipmentDef.descriptionToken);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Inventory), "SetEquipmentInternal")]
		public static void OnEquipmentSwap(Inventory __instance, EquipmentState equipmentState, uint slot)
		{
			//IL_0030: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			EquipmentState? val = null;
			if (__instance.equipmentStateSlots.Length > slot)
			{
				val = __instance.equipmentStateSlots[slot];
			}
			if (val.Equals(equipmentState) || val?.equipmentIndex == (EquipmentIndex?)equipmentState.equipmentIndex)
			{
				return;
			}
			EquipmentDef oldDef = val?.equipmentDef;
			EquipmentDef newDef = equipmentState.equipmentDef;
			EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)oldDef);
			EquipmentBase equipmentBase2 = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)newDef);
			try
			{
				equipmentBase?.OnUnEquip(__instance, equipmentState);
			}
			catch (Exception ex)
			{
				equipmentBase.sharedInfo.Logger.LogError((object)ex);
			}
			try
			{
				equipmentBase2?.OnEquip(__instance, val);
			}
			catch (Exception ex2)
			{
				if (equipmentBase2 != null)
				{
					equipmentBase2.sharedInfo.Logger.LogError((object)ex2);
				}
			}
		}

		public override void AddDisplayRules(VanillaIDRS which, ItemDisplayRule[] displayRules)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which);
			if (ruleSet != null)
			{
				ruleSet.keyAssetRuleGroups = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)ruleSet.keyAssetRuleGroups, new KeyAssetRuleGroup
				{
					displayRuleGroup = new DisplayRuleGroup
					{
						rules = displayRules
					},
					keyAsset = (Object)(object)EquipmentDef
				}).ToArray();
			}
		}

		public override void AddDisplayRules(ModdedIDRS which, ItemDisplayRule[] displayRules)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which);
			if (ruleSet != null)
			{
				ruleSet.keyAssetRuleGroups = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)ruleSet.keyAssetRuleGroups, new KeyAssetRuleGroup
				{
					displayRuleGroup = new DisplayRuleGroup
					{
						rules = displayRules
					},
					keyAsset = (Object)(object)EquipmentDef
				}).ToArray();
			}
		}

		protected override void FillDefsFromSerializableCP(SerializableContentPack serializableContentPack)
		{
			base.FillDefsFromSerializableCP(serializableContentPack);
			string name = GetType().Name;
			EquipmentDef[] equipmentDefs = serializableContentPack.equipmentDefs;
			foreach (EquipmentDef val in equipmentDefs)
			{
				if (val != null && SharedBase.MatchName(((Object)val).name, name))
				{
					EquipmentDef = val;
				}
			}
			if ((Object)(object)EquipmentDef == (Object)null)
			{
				ManualLogSource logger = sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)$"Could not find EquipmentDef for item {this} in serializableContentPack, class/equipmentdef name are probably mismatched. This will throw an exception later.");
				}
			}
		}

		protected override void FillDefsFromContentPack()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			foreach (ContentPack contentPack in SharedBase.ContentPacks)
			{
				if ((Object)(object)EquipmentDef != (Object)null)
				{
					continue;
				}
				string name = GetType().Name;
				AssetEnumerator<EquipmentDef> enumerator2 = contentPack.equipmentDefs.GetEnumerator();
				try
				{
					while (enumerator2.MoveNext())
					{
						EquipmentDef current2 = enumerator2.Current;
						if (SharedBase.MatchName(((Object)current2).name, name))
						{
							EquipmentDef = current2;
						}
					}
				}
				finally
				{
					((IDisposable)enumerator2).Dispose();
				}
			}
			if ((Object)(object)EquipmentDef == (Object)null)
			{
				ManualLogSource logger = sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)$"Could not find EquipmentDef for item {this}, class/equipmentdef name are probably mismatched. This will throw an exception later.");
				}
			}
		}

		protected override void FillPickupIndex()
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PickupIndex key = (PickupIndex = PickupCatalog.FindPickupIndex(EquipmentDef.equipmentIndex));
				SharedBase.PickupIndexes.Add(key, this);
			}
			catch (NullReferenceException ex)
			{
				ManualLogSource logger = sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogError((object)("Equipment " + GetType().Name + " threw a NRE when filling pickup indexes, this could mean its not defined in your content pack:\n" + ex));
				}
			}
		}

		protected override void FillRequiredExpansions()
		{
			if (RequiresSotv)
			{
				EquipmentDef.requiredExpansion = (Object.op_Implicit((Object)(object)sharedInfo.SotVExpansion) ? sharedInfo.SotVExpansion : SharedBase.SotvExpansion);
			}
			else
			{
				EquipmentDef.requiredExpansion = sharedInfo.Expansion;
			}
		}
	}
	[HarmonyPatch]
	public abstract class ItemBase : SharedBase
	{
		public class ScalingInfo
		{
			private readonly string _description;

			private readonly ConfigEntry<string> _configEntry;

			private Func<ExpressionContext, float> _function;

			private string _oldValue;

			public readonly string _name;

			private readonly ExpressionContext _defaultContext;

			public readonly ExpressionContext WorkingContext;

			private string _defaultValue;

			private bool _madeRiskOfOptions;

			public string Value
			{
				get
				{
					return _configEntry.Value;
				}
				set
				{
					_configEntry.Value = value;
				}
			}

			public bool IsDefault => _configEntry.Value.Trim() == _defaultValue.Trim();

			public ScalingInfo(ConfigFile configFile, string defaultValue, string name, Type callingType, string? desc = null, string? oldDefault = null)
			{
				//IL_00bb: 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)
				_description = desc ?? "[a] = item count";
				_name = name;
				WorkingContext = new ExpressionContext();
				_configEntry = configFile.Bind(ConfigCategoriesEnum.BalancingFunctions, callingType.Name + "_" + name, defaultValue, callingType.Name + "; " + _name + "; Scaling function for item. ;" + _description, oldDefault);
				_defaultValue = defaultValue;
				_oldValue = _configEntry.Value;
				try
				{
					_function = new Expression(_oldValue).ToLambda<ExpressionContext, float>();
				}
				catch (EvaluationException)
				{
					_function = new Expression(_defaultValue).ToLambda<ExpressionContext, float>();
				}
				_configEntry.SettingChanged += EntryChanged;
			}

			public float ScalingFunction(ExpressionContext? context = null)
			{
				return _function(context ?? _defaultContext);
			}

			public float ScalingFunction(int? itemCount)
			{
				WorkingContext.a = itemCount.GetValueOrDefault(1);
				return ScalingFunction(WorkingContext);
			}

			public override string ToString()
			{
				return _oldValue + "\n(" + _name + ": " + _description + ")";
			}

			public void MakeInLobbyConfig(List<object> modConfigEntryObj)
			{
				modConfigEntryObj.Add(ConfigFieldUtilities.CreateFromBepInExConfigEntry<string>(_configEntry));
			}

			public void MakeRiskOfOptions()
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				if (!_madeRiskOfOptions)
				{
					ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_configEntry));
					_madeRiskOfOptions = true;
				}
			}

			private void EntryChanged(object sender, EventArgs e)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				if (_configEntry.Value == _oldValue)
				{
					return;
				}
				try
				{
					_function = new Expression(_configEntry.Value).ToLambda<ExpressionContext, float>();
					_oldValue = _configEntry.Value;
				}
				catch (EvaluationException)
				{
				}
			}
		}

		public class VoidPairing
		{
			public static string ValidEntries = string.Join(" ", ItemCatalog.itemNames);

			private ConfigEntry<string> _configEntry;

			private ItemBase _parent;

			public ItemDef[] ItemDefs;

			private string _default;

			private string? _oldDefault;

			private bool _setup;

			private bool _madeRiskOfOptions;

			public bool IsDefault => _default.Trim() == _configEntry.Value.Trim();

			public VoidPairing(string defaultValue, ItemBase parent, string? oldDefault = null)
			{
				_parent = parent;
				_default = defaultValue;
				_oldDefault = oldDefault;
			}

			public void SettingChangedOld()
			{
				IEnumerable<Pair> first = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem].Where((Pair x) => (Object)(object)x.itemDef2 != (Object)(object)_parent.ItemDef);
				ItemDefs = (from str in _configEntry.Value.Split(new char[1] { ' ' })
					select ItemCatalog.FindItemIndex(str) into index
					where (int)index != -1
					select ItemCatalog.GetItemDef(index)).ToArray();
				IEnumerable<Pair> second = ItemDefs.Select(delegate(ItemDef def)
				{
					//IL_0002: 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)
					Pair result = default(Pair);
					result.itemDef1 = def;
					result.itemDef2 = _parent.ItemDef;
					return result;
				});
				ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = first.Union(second).ToArray();
			}

			public void PostItemCatalog()
			{
				if (string.IsNullOrWhiteSpace(ValidEntries))
				{
					ValidEntries = string.Join(" ", ItemCatalog.itemNames);
				}
				_configEntry = _parent.sharedInfo.ConfigFile.Bind(ConfigCategoriesEnum.VoidConversions, _parent.GetType().Name, _default, "Valid values: " + ValidEntries, _oldDefault);
				_configEntry.SettingChanged += delegate
				{
					SettingChanged();
				};
				SettingChanged();
			}

			public void SettingChanged()
			{
				ItemDef[] itemDefs = ItemDefs;
				SettingChangedOld();
				if (_setup && !itemDefs.SequenceEqual(ItemDefs))
				{
					ContagiousItemManager.InitTransformationTable();
				}
				_setup = true;
			}

			public void MakeRiskOfOptions()
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				if (!_madeRiskOfOptions)
				{
					ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_configEntry));
					_madeRiskOfOptions = true;
				}
			}
		}

		public class ExpressionContext
		{
			public float a;

			public float b;

			public float c;

			public float d;

			public float e;

			public float f;

			public float g;

			public float h;

			public float i;

			public float j;

			public float k;

			public float l;

			public float m;

			public float n;

			public float o;

			public float p;

			public float q;

			public float r;

			public float s;

			public float t;

			public float u;

			public float v;

			public float w;

			public float x;

			public float y;

			public float z;

			public float Epsilon = Mathf.Epsilon;

			public float Infinity = float.PositiveInfinity;

			public float Deg2Rad = MathF.PI / 180f;

			public float NegativeInfinity = float.NegativeInfinity;

			public float PI = MathF.PI;

			public float Rad2Deg = 57.29578f;

			public float Abs(float x)
			{
				return Mathf.Abs(x);
			}

			public float Acos(float x)
			{
				return Mathf.Acos(x);
			}

			public float Asin(float x)
			{
				return Mathf.Asin(x);
			}

			public float Atan(float x)
			{
				return Mathf.Atan(x);
			}

			public float Atan2(float x, float y)
			{
				return Mathf.Atan2(x, y);
			}

			public float Ceil(float x)
			{
				return Mathf.Ceil(x);
			}

			public float Clamp(float a, float x, float y)
			{
				return Mathf.Clamp(a, x, y);
			}

			public float Clamp01(float x)
			{
				return Mathf.Clamp01(x);
			}

			public float Cos(float x)
			{
				return Mathf.Cos(x);
			}

			public float Exp(float x)
			{
				return Mathf.Exp(x);
			}

			public float Floor(float x)
			{
				return Mathf.Floor(x);
			}

			public float Gamma(float x, float y, float z)
			{
				return Mathf.Gamma(x, y, z);
			}

			public float Lerp(float x, float y, float z)
			{
				return Mathf.Lerp(x, y, z);
			}

			public double Log(double x, double y)
			{
				return Mathf.Log((float)x, (float)y);
			}

			public float Max(float x, float y)
			{
				return Mathf.Max(x, y);
			}

			public float Min(float x, float y)
			{
				return Mathf.Min(x, y);
			}

			public float Pow(float x, float y)
			{
				return Mathf.Pow(x, y);
			}

			public float Repeat(float x, float y)
			{
				return Mathf.Repeat(x, y);
			}

			public float Round(float x)
			{
				return Mathf.Round(x);
			}

			public float Sign(float x)
			{
				return Mathf.Sign(x);
			}

			public float Sin(float x)
			{
				return Mathf.Sin(x);
			}

			public float Sqrt(float x)
			{
				return Mathf.Sqrt(x);
			}

			public float Tan(float x)
			{
				return Mathf.Tan(x);
			}

			public float DeltaAngle(float x, float y)
			{
				return Mathf.DeltaAngle(x, y);
			}

			public float InverseLerp(float x, float y, float z)
			{
				return Mathf.InverseLerp(x, y, z);
			}

			public float LerpAngle(float x, float y, float z)
			{
				return Mathf.LerpAngle(x, y, z);
			}

			public float LerpUnclamped(float x, float y, float z)
			{
				return Mathf.LerpUnclamped(x, y, z);
			}

			public float MoveTowards(float x, float y, float z)
			{
				return Mathf.MoveTowards(x, y, z);
			}

			public float PerlinNoise(float x, float y)
			{
				return Mathf.PerlinNoise(x, y);
			}

			public float PingPong(float x, float y)
			{
				return Mathf.PingPong(x, y);
			}

			public float SmoothStep(float x, float y, float z)
			{
				return Mathf.SmoothStep(x, y, z);
			}

			public float MoveTowardsAngle(float x, float y, float z)
			{
				return Mathf.MoveTowardsAngle(x, y, z);
			}

			public float GammaToLinearSpace(float x)
			{
				return Mathf.GammaToLinearSpace(x);
			}

			public float LinearToGammaSpace(float x)
			{
				return Mathf.LinearToGammaSpace(x);
			}
		}

		public ItemDef ItemDef;

		private static IEnumerable<ItemBase>? _items;

		public ScalingInfoIndexer ScalingInfos = new ScalingInfoIndexer();

		public VoidPairing? voidPairing;

		protected string SimpleDescriptionToken;

		private static List<string> _alreadyPlural = new List<string>
		{
			"400 Tickets", "Balls", "Gummy Vitamins", "Booster Boots", "Life Savings", "Predatory Instincts", "Fueling Bellows", "Sharpened Chopsticks", "Hardlight Shields", "Steroids",
			"Charging Nanobots", "Experimental Jets", "Prototype Jet Boots", "Low Quality Speakers", "Stargazer's Records", "Baby's Toys", "Defensive Microbots", "Death's Regards", "Spare Drone Parts", "Brainstalks",
			"Sorcerer's Pills", "Shifted Quartz", "Clasping Claws", "Enhancement Vials", "<style=cIsVoid>Corrupts all Shatterspleens.</style>", "Orbs of Falsity", "Visions of Heresy", "Hooks of Heresy", "Strides of Heresy", "Essence of Heresy",
			"Beads of Fealty", "Prescriptions"
		};

		private static Dictionary<string, string> rules = new Dictionary<string, string>
		{
			{ "rounds$", "rounds" },
			{ "tooth$", "teeth" },
			{ "fungus$", "fungi" },
			{ "(a|e|i|o|u)o$", "$1os" },
			{ "o$", "oes" },
			{ "(a|e|i|o|u)y$", "$1ys" },
			{ "y$", "ies" },
			{ "ff$", "s" },
			{ "fe?$", "ves" },
			{ "es$", "es" },
			{ "(ch|sh|x|z|s)$", "$1es" },
			{ "s?$", "s" }
		};

		private static Regex formatArgParams = new Regex("({\\d:?.*?})+", RegexOptions.Compiled);

		public static IEnumerable<ItemBase> Items => _items ?? (_items = SharedBase.Instances.OfType<ItemBase>());

		public override bool RequiresSotv => voidPairing != null;

		protected override void MakeConfigs()
		{
			string name = GetType().Name;
			Enabled = sharedInfo.ConfigFile.Bind<bool>("Disable Items", name, true, "Should this item be enabled.");
			List<Pair> pairs = new List<Pair>();
			FillVoidConversions(pairs);
		}

		protected void AddScalingFunction(string defaultValue, string name, string? desc = null, string? oldDefault = null)
		{
			ScalingInfos.Add(new ScalingInfo(sharedInfo.ConfigFile, defaultValue, name, new StackFrame(1).GetMethod().DeclaringType, desc, oldDefault));
		}

		public static string GetPlural(string str)
		{
			if (_alreadyPlural.Contains(str))
			{
				return str;
			}
			if (str == "Silence Between Two Strikes")
			{
				return "Silences Between Two Strikes";
			}
			Match match = Regex.Match(str, "(.+) of (.+)", RegexOptions.IgnoreCase);
			if (match.Success)
			{
				return GetPlural(match.Groups[1].Value) + " of " + match.Groups[2].Value;
			}
			match = Regex.Match(str, "^the (.+)", RegexOptions.IgnoreCase);
			if (match.Success)
			{
				return GetPlural(match.Groups[1].Value);
			}
			foreach (string key in rules.Keys)
			{
				if (Regex.Match(str, key, RegexOptions.IgnoreCase).Success)
				{
					return Regex.Replace(str, key, rules[key], RegexOptions.IgnoreCase);
				}
			}
			return str;
		}

		public override string GetFormattedDescription(Inventory? inventory, string? token = null, bool forceHideExtended = false)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			Inventory inventory2 = inventory;
			if (ScalingInfos.Count <= 0)
			{
				return Language.GetString(ItemDef.descriptionToken);
			}
			object[] array = ScalingInfos.Select(delegate(ScalingInfo info)
			{
				Inventory obj = inventory2;
				return info.ScalingFunction((obj != null) ? new int?(obj.GetItemCount(ItemDef)) : null);
			}).Cast<object>().ToArray();
			string text = "";
			if (voidPairing != null)
			{
				if (!voidPairing.IsDefault)
				{
					text = Language.GetStringFormatted("BUB_DEFAULT_CONVERT", new object[1] { string.Join(", ", voidPairing.ItemDefs.Select(delegate(ItemDef x)
					{
						string text3 = Language.GetString(x.nameToken);
						if (Language.currentLanguage == Language.english)
						{
							text3 = GetPlural(text3);
						}
						return text3;
					})) });
					text = text.Style((ItemDef.tier == BubbetsItemsPlugin.VoidLunarTier.tier) ? StyleEnum.VoidLunar : StyleEnum.Void);
				}
				else
				{
					text = Language.GetString(ItemDef.nameToken.Sub(0, -"_NAME".Length) + "_CONVERT");
				}
			}
			if (sharedInfo.UseSimpleDescIfApplicable.Value && ScalingInfos.All((ScalingInfo x) => x.IsDefault) && !string.IsNullOrEmpty(SimpleDescriptionToken))
			{
				string @string = Language.GetString(sharedInfo.TokenPrefix + SimpleDescriptionToken);
				if (sharedInfo.ItemStatsInSimpleDesc.Value && !forceHideExtended)
				{
					List<string> list = new List<string>();
					@string += text;
					@string += "\n";
					foreach (Match item in formatArgParams.Matches(Language.GetString(token ?? ItemDef.descriptionToken)))
					{
						string value = item.Value;
						if (!string.IsNullOrEmpty(value))
						{
							list.Add(value);
						}
					}
					list = list.OrderBy((string x) => x[1]).ToList();
					foreach (string item2 in list)
					{
						if (int.TryParse(item2[1].ToString(), out var result))
						{
							@string = @string + "\n" + ScalingInfos[result]._name + ": " + item2;
						}
					}
					return string.Format(@string, array);
				}
				return @string + text;
			}
			string text2 = Language.GetStringFormatted(token ?? ItemDef.descriptionToken, array) + text;
			if (sharedInfo.ExpandedTooltips.Value && !forceHideExtended)
			{
				text2 = text2 + "\n\nTooltip updates automatically with these fully configurable Scaling Functions:\n" + string.Join("\n", ScalingInfos.Select((ScalingInfo info) => info.ToString()));
			}
			return text2;
		}

		public override void MakeInLobbyConfig(Dictionary<ConfigCategoriesEnum, List<object>> scalingFunctions)
		{
			base.MakeInLobbyConfig(scalingFunctions);
			foreach (ScalingInfo scalingInfo in ScalingInfos)
			{
				scalingInfo.MakeInLobbyConfig(scalingFunctions[ConfigCategoriesEnum.BalancingFunctions]);
			}
		}

		public override void MakeRiskOfOptions()
		{
			base.MakeRiskOfOptions();
			foreach (ScalingInfo scalingInfo in ScalingInfos)
			{
				scalingInfo.MakeRiskOfOptions();
			}
		}

		protected override void FillDefsFromSerializableCP(SerializableContentPack serializableContentPack)
		{
			base.FillDefsFromSerializableCP(serializableContentPack);
			string name = GetType().Name;
			ItemDef[] itemDefs = serializableContentPack.itemDefs;
			foreach (ItemDef val in itemDefs)
			{
				if (SharedBase.MatchName(((Object)val).name, name))
				{
					ItemDef = val;
				}
			}
			if ((Object)(object)ItemDef == (Object)null)
			{
				ManualLogSource logger = sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)$"Could not find ItemDef for item {this} in serializableContentPack, class/itemdef name are probably mismatched. This will throw an exception later.");
				}
			}
		}

		public override void AddDisplayRules(VanillaIDRS which, ItemDisplayRule[] displayRules)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0046: Unknown result type (might be due to invalid IL or missing references)
			ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which);
			KeyAssetRuleGroup[] array = ruleSet?.keyAssetRuleGroups;
			if (array != null)
			{
				array = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)array, new KeyAssetRuleGroup
				{
					displayRuleGroup = new DisplayRuleGroup
					{
						rules = displayRules
					},
					keyAsset = (Object)(object)ItemDef
				}).ToArray();
				ruleSet.keyAssetRuleGroups = array;
			}
		}

		public override void AddDisplayRules(ModdedIDRS which, ItemDisplayRule[] displayRules)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0046: Unknown result type (might be due to invalid IL or missing references)
			ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which);
			KeyAssetRuleGroup[] array = ruleSet?.keyAssetRuleGroups;
			if (array != null)
			{
				array = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)array, new KeyAssetRuleGroup
				{
					displayRuleGroup = new DisplayRuleGroup
					{
						rules = displayRules
					},
					keyAsset = (Object)(object)ItemDef
				}).ToArray();
				ruleSet.keyAssetRuleGroups = array;
			}
		}

		protected override void FillDefsFromContentPack()
		{
			//IL_0037: 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)
			foreach (ContentPack contentPack in SharedBase.ContentPacks)
			{
				if ((Object)(object)ItemDef != (Object)null)
				{
					break;
				}
				string name = GetType().Name;
				AssetEnumerator<ItemDef> enumerator2 = contentPack.itemDefs.GetEnumerator();
				try
				{
					while (enumerator2.MoveNext())
					{
						ItemDef current2 = enumerator2.Current;
						if (SharedBase.MatchName(((Object)current2).name, name))
						{
							ItemDef = current2;
						}
					}
				}
				finally
				{
					((IDisposable)enumerator2).Dispose();
				}
			}
			if ((Object)(object)ItemDef == (Object)null)
			{
				ManualLogSource logger = sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)$"Could not find ItemDef for item {this}, class/itemdef name are probably mismatched. This will throw an exception later.");
				}
			}
		}

		protected override void FillPickupIndex()
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PickupIndex key = (PickupIndex = PickupCatalog.FindPickupIndex(ItemDef.itemIndex));
				SharedBase.PickupIndexes.Add(key, this);
			}
			catch (NullReferenceException ex)
			{
				ManualLogSource logger = sharedInfo.Logger;
				if (logger != null)
				{
					logger.LogError((object)("Equipment " + GetType().Name + " threw a NRE when filling pickup indexes, this could mean its not defined in your content pack:\n" + ex));
				}
			}
		}

		protected override void FillRequiredExpansions()
		{
			if (RequiresSotv)
			{
				ItemDef.requiredExpansion = (Object.op_Implicit((Object)(object)sharedInfo.SotVExpansion) ? sharedInfo.SotVExpansion : SharedBase.SotvExpansion);
			}
			else
			{
				ItemDef.requiredExpansion = sharedInfo.Expansion;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ContagiousItemManager), "Init")]
		public static void FillVoidItems()
		{
			List<Pair> list = new List<Pair>();
			bool flag = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			foreach (ItemBase item in Items)
			{
				item.voidPairing?.PostItemCatalog();
				if (flag)
				{
					item.voidPairing?.MakeRiskOfOptions();
				}
			}
			ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = CollectionExtensions.AddRangeToArray<Pair>(ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem], list.ToArray());
		}

		protected virtual void FillVoidConversions(List<Pair> pairs)
		{
		}

		public static void CheatForAllItems()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			foreach (ItemBase item in Items)
			{
				item.CheatForItem(Random.onUnitSphere);
			}
		}

		public void AddVoidPairing(string defaultValue, string? oldDefault = null)
		{
			voidPairing = new VoidPairing(defaultValue, this, oldDefault);
		}
	}
	public abstract class SharedBase
	{
		public class SharedInfo
		{
			public ConfigEntry<bool> ExpandedTooltips;

			public ConfigEntry<bool> DescInPickup;

			public ConfigEntry<bool> ForceHideScalingInfoInPickup;

			public ConfigEntry<bool> UseSimpleDescIfApplicable;

			public ConfigEntry<bool> ItemStatsInSimpleDesc;

			public ConfigFile ConfigFile;

			public Harmony? Harmony;

			public readonly ManualLogSource Logger;

			public readonly string TokenPrefix;

			private bool _riskOfOptionsMade;

			public ExpansionDef? Expansion;

			public ExpansionDef? SotVExpansion;

			public List<SharedBase> Instances = new List<SharedBase>();

			private bool _zioRiskOfOptionsMade;

			public SharedInfo(ManualLogSource manualLogSource, ConfigFile configFile, Harmony? harmony, string tokenPrefix)
			{
				Logger = manualLogSource;
				ConfigFile = configFile;
				Harmony = harmony;
				TokenPrefix = tokenPrefix;
			}

			public void MakeRiskOfOptions()
			{
				if (!_riskOfOptionsMade)
				{
					_riskOfOptionsMade = true;
				}
			}

			public void MakeZioOptions(ConfigFile configFile)
			{
				ExpandedTooltips = configFile.Bind(ConfigCategoriesEnum.General, "Expanded Tooltips", defaultValue: true, "Enables the scaling function in the tooltip.", oldDefault: false, networked: false);
				DescInPickup = configFile.Bind(ConfigCategoriesEnum.General, "Description In Pickup", defaultValue: true, "Used the description in the pickup for my items.", oldDefault: false, networked: false);
				ForceHideScalingInfoInPickup = configFile.Bind(ConfigCategoriesEnum.General, "Disable Scaling Info In Pickup", defaultValue: true, "Should the scaling infos be hidden from pickups.", oldDefault: false, networked: false);
				UseSimpleDescIfApplicable = configFile.Bind(ConfigCategoriesEnum.General, "Use Simple Descriptions If Applicable", defaultValue: true, "Should the description be closer to vanilla if you haven't changed the scaling function.", oldDefault: false, networked: false);
				ItemStatsInSimpleDesc = configFile.Bind(ConfigCategoriesEnum.General, "Show Item Stats For Simple Desc", defaultValue: true, "Display the solved value under the simple description.", oldDefault: false, networked: false);
				foreach (SharedBase instance in Instances)
				{
					instance.MakeZioOptions();
				}
				if (Chainloader.PluginInfos.ContainsKey("bubbet.zioriskofoptions"))
				{
					MakeZioRiskOfOptions();
				}
			}

			public void MakeZioRiskOfOptions()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: 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
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Expected O, but got Unknown
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Expected O, but got Unknown
				if (_zioRiskOfOptionsMade)
				{
					return;
				}
				_zioRiskOfOptionsMade = true;
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ExpandedTooltips));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DescInPickup));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ForceHideScalingInfoInPickup));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UseSimpleDescIfApplicable));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ItemStatsInSimpleDesc));
				foreach (SharedBase instance in Instances)
				{
					instance.MakeZioRiskOfOptions();
				}
			}
		}

		public static readonly MethodInfo? MemberwiseCloneRef = typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic);

		public ConfigEntry<bool>? Enabled;

		public static readonly List<SharedBase> Instances = new List<SharedBase>();

		public static readonly Dictionary<PickupIndex, SharedBase> PickupIndexes = new Dictionary<PickupIndex, SharedBase>();

		private static readonly Dictionary<Type, SharedBase> InstanceDict = new Dictionary<Type, SharedBase>();

		private static List<SharedInfo> SharedInfos = new List<SharedInfo>();

		public PickupIndex PickupIndex;

		protected PatchClassProcessor? PatchProcessor;

		protected static readonly List<ContentPack> ContentPacks = new List<ContentPack>();

		public SharedInfo sharedInfo;

		private static ExpansionDef? _sotvExpansion;

		public static ExpansionDef? SotvExpansion => _sotvExpansion ?? (_sotvExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion());

		public virtual bool RequiresSotv => false;

		protected virtual void MakeConfigs()
		{
		}

		protected virtual void MakeTokens()
		{
		}

		protected virtual void MakeBehaviours()
		{
		}

		protected virtual void DestroyBehaviours()
		{
		}

		public virtual void MakeInLobbyConfig(Dictionary<ConfigCategoriesEnum, List<object>> dict)
		{
		}

		public virtual void MakeRiskOfOptions()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			sharedInfo.MakeRiskOfOptions();
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Enabled, true));
		}

		public virtual string GetFormattedDescription(Inventory? inventory = null, string? token = null, bool forceHideExtended = false)
		{
			return "Not Implemented";
		}

		public static void Initialize(ManualLogSource manualLogSource, ConfigFile configFile, out SharedInfo info, SerializableContentPack? serializableContentPack = null, Harmony? harmony = null, string tokenPrefix = "")
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			SharedInfo sharedInfo = (info = new SharedInfo(manualLogSource, configFile, harmony, tokenPrefix));
			SharedInfos.Add(sharedInfo);
			Type[] types = Assembly.GetCallingAssembly().GetTypes();
			foreach (Type type in types)
			{
				if (!typeof(SharedBase).IsAssignableFrom(type) || type.IsAbstract)
				{
					continue;
				}
				if (!(Activator.CreateInstance(type) is SharedBase sharedBase))
				{
					manualLogSource.LogError((object)$"Failed to make instance of {type}");
					continue;
				}
				sharedBase.sharedInfo = sharedInfo;
				sharedBase.MakeConfigs();
				ConfigEntry<bool>? enabled = sharedBase.Enabled;
				if (enabled != null && !enabled.Value)
				{
					continue;
				}
				sharedBase.MakeBehaviours();
				if (harmony != null)
				{
					sharedBase.PatchProcessor = new PatchClassProcessor(harmony, sharedBase.GetType());
					try
					{
						sharedBase.PatchProcessor.Patch();
					}
					catch (Exception ex)
					{
						sharedInfo.Logger.LogError((object)ex);
					}
				}
				sharedInfo.Instances.Add(sharedBase);
				Instances.Add(sharedBase);
				InstanceDict[type] = sharedBase;
				if (Object.op_Implicit((Object)(object)serializableContentPack))
				{
					sharedBase.FillDefsFromSerializableCP(serializableContentPack);
				}
			}
			if (!Object.op_Implicit((Object)(object)serializableContentPack))
			{
				return;
			}
			serializableContentPack.itemDefs = serializableContentPack.itemDefs.Where((ItemDef x) => ItemBase.Items.Any((ItemBase y) => MatchName(((Object)x).name, y.GetType().Name))).ToArray();
			IEnumerable<EquipmentDef> second = serializableContentPack.eliteDefs.Select((EliteDef x) => x.eliteEquipmentDef);
			serializableContentPack.equipmentDefs = serializableContentPack.equipmentDefs.Where((EquipmentDef x) => EquipmentBase.Equipments.Any((EquipmentBase y) => x != null && MatchName(((Object)x).name, y.GetType().Name))).Union(second).ToArray();
		}

		public static T GetInstance<T>() where T : SharedBase
		{
			InstanceDict.TryGetValue(typeof(T), out SharedBase value);
			return value as T;
		}

		public static void ResetConfigs()
		{
			foreach (SharedInfo sharedInfo in SharedInfos)
			{
				sharedInfo.ConfigFile.Clear();
				sharedInfo.ConfigFile.Save();
			}
			foreach (SharedBase instance in Instances)
			{
				instance.MakeConfigs();
			}
		}

		[SystemInitializer(new Type[]
		{
			typeof(EquipmentCatalog),
			typeof(PickupCatalog)
		})]
		public static void InitializePickups()
		{
			foreach (SharedBase instance in Instances)
			{
				instance.FillDefsFromContentPack();
			}
			foreach (SharedBase instance2 in Instances)
			{
				instance2.FillPickupIndex();
			}
		}

		protected static bool MatchName(string scriptableObject, string sharedBase)
		{
			if (!scriptableObject.StartsWith(sharedBase) && !scriptableObject.StartsWith("ItemDef" + sharedBase))
			{
				return scriptableObject.StartsWith("EquipmentDef" + sharedBase);
			}
			return true;
		}

		public static void AddContentPack(ContentPack contentPack)
		{
			if (!ContentPacks.Contains(contentPack))
			{
				ContentPacks.Add(contentPack);
			}
		}

		~SharedBase()
		{
			DestroyBehaviours();
		}

		public void CheatForItem(Vector3? rotationUniform = null)
		{
			//IL_0012: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			CharacterMaster master = PlayerCharacterMasterController.instances[0].master;
			PickupDropletController.CreatePickupDroplet(PickupIndex, master.GetBody().corePosition + Vector3.up * 1.5f, (Vector3)(((??)rotationUniform) ?? (Vector3.one * 25f)));
		}

		[SystemInitializer(new Type[] { })]
		public static void FillAllExpansionDefs()
		{
			foreach (SharedBase instance in Instances)
			{
				try
				{
					instance.FillRequiredExpansions();
				}
				catch (Exception ex)
				{
					instance.sharedInfo.Logger.LogError((object)ex);
				}
			}
		}

		[SystemInitializer(new Type[] { typeof(BodyCatalog) })]
		public static void FillIDRS()
		{
		}

		protected virtual void FillItemDisplayRules()
		{
		}

		[SystemInitializer(new Type[]
		{
			typeof(ItemCatalog),
			typeof(EquipmentCatalog)
		})]
		public static void MakeAllTokens()
		{
			foreach (SharedBase instance in Instances)
			{
				try
				{
					ManualLogSource logger = instance.sharedInfo.Logger;
					if (logger != null)
					{
						logger.LogMessage((object)$"Making tokens for {instance}.");
					}
					instance.MakeTokens();
				}
				catch (Exception ex)
				{
					ManualLogSource logger2 = instance.sharedInfo.Logger;
					if (logger2 != null)
					{
						logger2.LogError((object)ex);
					}
				}
			}
		}

		protected void AddToken(string key, string value)
		{
			Language.currentLanguage.SetStringByToken(sharedInfo.TokenPrefix + key, value);
		}

		protected virtual void FillDefsFromSerializableCP(SerializableContentPack serializableContentPack)
		{
		}

		protected abstract void FillDefsFromContentPack();

		protected abstract void FillPickupIndex();

		protected abstract void FillRequiredExpansions();

		public virtual void MakeZioOptions()
		{
		}

		public virtual void MakeZioRiskOfOptions()
		{
		}

		public abstract void AddDisplayRules(ModdedIDRS which, ItemDisplayRule[] displayRules);

		public abstract void AddDisplayRules(VanillaIDRS which, ItemDisplayRule[] displayRules);

		public virtual void AddDisplayRules(ModdedIDRS which, ItemDisplayRule displayRule)
		{
			//IL_008e: 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)
			GameObject val = ((!Object.op_Implicit((Object)(object)((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab)) ? ((this as EquipmentBase)?.EquipmentDef as BubEquipmentDef)?.displayModelPrefab : ((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab);
			if (Object.op_Implicit((Object)(object)val))
			{
				displayRule.followerPrefab = val;
				AddDisplayRules(which, (ItemDisplayRule[])(object)new ItemDisplayRule[1] { displayRule });
			}
		}

		public virtual void AddDisplayRules(VanillaIDRS which, ItemDisplayRule displayRule)
		{
			//IL_008e: 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)
			GameObject val = ((!Object.op_Implicit((Object)(object)((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab)) ? ((this as EquipmentBase)?.EquipmentDef as BubEquipmentDef)?.displayModelPrefab : ((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab);
			if (Object.op_Implicit((Object)(object)val))
			{
				displayRule.followerPrefab = val;
				AddDisplayRules(which, (ItemDisplayRule[])(object)new ItemDisplayRule[1] { displayRule });
			}
		}
	}
	public class AmmoPickupOrb : GenericDamageOrb
	{
		public override void OnArrival()
		{
			((Component)((Orb)this).target.healthComponent).GetComponent<SkillLocator>().ApplyAmmoPack();
		}

		public override GameObject GetOrbEffect()
		{
			return BubbetsItemsPlugin.AssetBundle.LoadAsset<GameObject>("AmmoPickupOrb");
		}
	}
	public class AmmoPickupOrbBehavior : MonoBehaviour
	{
		private TrailRenderer _trail;

		private float _localTime;

		private Vector3 _startPos;

		private Vector3 _initialVelocity;

		public Transform? TargetTransform { get; set; }

		public float TravelTime { get; set; } = 1f;


		private void Awake()
		{
			_trail = ((Component)this).GetComponent<TrailRenderer>();
		}

		private void Start()
		{
			//IL_0012: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			_localTime = 0f;
			_startPos = ((Component)this).transform.position;
			_initialVelocity = Vector3.up * 4f + Random.insideUnitSphere * 1f;
			_trail.startWidth = 0.05f;
		}

		private void Update()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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)
			_localTime += Time.deltaTime;
			if ((Object)(object)TargetTransform == (Object)null || !Object.op_Implicit((Object)(object)TargetTransform))
			{
				EffectData effectData = ((Component)this).GetComponent<EffectComponent>().effectData;
				object targetTransform;
				if (effectData == null)
				{
					targetTransform = null;
				}
				else
				{
					GameObject obj = effectData.ResolveHurtBoxReference();
					targetTransform = ((obj != null) ? obj.transform : null);
				}
				TargetTransform = (Transform?)targetTransform;
				if (effectData != null)
				{
					TravelTime = effectData.genericFloat;
				}
				if ((Object)(object)TargetTransform == (Object)null || !Object.op_Implicit((Object)(object)TargetTransform))
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
			}
			float num = Mathf.Clamp01(_localTime / TravelTime);
			((Component)this).transform.position = CalculatePosition(_startPos, _initialVelocity, TargetTransform.position, num);
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private static Vector3 CalculatePosition(Vector3 startPos, Vector3 initialVelocity, Vector3 targetPos, float t)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_0013: 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)
			Vector3 val = startPos + initialVelocity * t;
			float num = t * t * t;
			return Vector3.LerpUnclamped(val, targetPos, num);
		}
	}
	public class BrokenClockHandBehaviour : MonoBehaviour
	{
		public Transform hourHand;

		public Transform minuteHand;

		private float _ratio = 2f;

		private float _nextMinuteY;

		private float _nextHourY;

		public void Update()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0077: 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)
			_ratio += Time.deltaTime;
			if (_ratio > 1f)
			{
				_ratio = 0f;
				_nextHourY = Random.value * 2f - 1f;
				_nextMinuteY = Random.value * 2f - 1f;
			}
			Quaternion rotation = hourHand.rotation;
			_ = ((Quaternion)(ref rotation)).eulerAngles;
			rotation = minuteHand.rotation;
			_ = ((Quaternion)(ref rotation)).eulerAngles;
			hourHand.Rotate(0f, 0f, _nextHourY);
			minuteHand.Rotate(0f, 0f, _nextMinuteY);
		}
	}
	public class HourGlassWobble : MonoBehaviour
	{
		private Renderer _rend;

		private Vector3 _lastPos;

		private Vector3 _velocity;

		private Vector3 _lastRot;

		private Vector3 _angularVelocity;

		[FormerlySerializedAs("MaxWobble")]
		public float maxWobble = 0.03f;

		[FormerlySerializedAs("WobbleSpeed")]
		public float wobbleSpeed = 1f;

		[FormerlySerializedAs("Recovery")]
		public float recovery = 1f;

		private float _wobbleAmountX;

		private float _wobbleAmountZ;

		private float _wobbleAmountToAddX;

		private float _wobbleAmountToAddZ;

		private float _pulse;

		private float _time = 0.5f;

		private Material _material;

		private static readonly int WobbleX = Shader.PropertyToID("_WobbleX");

		private static readonly int WobbleZ = Shader.PropertyToID("_WobbleZ");

		private void Start()
		{
			_rend = ((Component)this).GetComponent<Renderer>();
			_material = _rend.materials.First((Material x) => ((Object)x.shader).name.Contains("Pain"));
			_wobbleAmountX = 10f;
		}

		private void Update()
		{
			//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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			_time += Time.deltaTime;
			_wobbleAmountToAddX = Mathf.Lerp(_wobbleAmountToAddX, 0f, Time.deltaTime * recovery);
			_wobbleAmountToAddZ = Mathf.Lerp(_wobbleAmountToAddZ, 0f, Time.deltaTime * recovery);
			_pulse = MathF.PI * 2f * wobbleSpeed;
			_wobbleAmountX = _wobbleAmountToAddX * Mathf.Sin(_pulse * _time);
			_wobbleAmountZ = _wobbleAmountToAddZ * Mathf.Sin(_pulse * _time);
			_material.SetFloat(WobbleX, _wobbleAmountX);
			_material.SetFloat(WobbleZ, _wobbleAmountZ);
			Transform transform = ((Component)this).transform;
			Vector3 position = transform.position;
			_velocity = (_lastPos - position) / Time.deltaTime;
			Quaternion rotation = transform.rotation;
			_angularVelocity = ((Quaternion)(ref rotation)).eulerAngles - _lastRot;
			_wobbleAmountToAddX += Mathf.Clamp((_velocity.x + _angularVelocity.z * 0.2f) * maxWobble, 0f - maxWobble, maxWobble);
			_wobbleAmountToAddZ += Mathf.Clamp((_velocity.z + _angularVelocity.x * 0.2f) * maxWobble, 0f - maxWobble, maxWobble);
			_lastPos = position;
			_lastRot = ((Quaternion)(ref rotation)).eulerAngles;
		}
	}
	public class VoidSlugController : MonoBehaviour
	{
		private Animator _animator;

		private CharacterModel _characterModel;

		private bool _lastInDanger;

		private static readonly int InCombat = Animator.StringToHash("inCombat");

		private void Start()
		{
			_animator = ((Component)this).GetComponent<Animator>();
			_characterModel = ((Component)this).GetComponentInParent<CharacterModel>();
		}

		private void FixedUpdate()
		{
			if (Object.op_Implicit((Object)(object)_characterModel) && Object.op_Implicit((Object)(object)_characterModel.body) && Object.op_Implicit((Object)(object)_animator))
			{
				bool flag = !_characterModel.body.outOfDanger;
				if (flag && _lastInDanger)
				{
					_animator.SetBool(InCombat, true);
				}
				else if (!flag && _lastInDanger)
				{
					_animator.SetBool(InCombat, false);
				}
				_lastInDanger = flag;
			}
		}
	}
	[BepInPlugin("bubbet.bubbetsitems", "Bubbets Items", "1.8.11.16")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BubbetsItemsPlugin : BaseUnityPlugin
	{
		public static class Conf
		{
			public static ConfigEntry<bool> AmmoPickupAsOrbEnabled;

			public static ConfigEntry<bool> VoidCoinShareOnPickup;

			public static ConfigEntry<float> VoidCoinDropChanceStart;

			public static ConfigEntry<float> VoidCoinDropChanceMult;

			public static ConfigEntry<bool> VoidCoinBarrelDrop;

			public static ConfigEntry<bool> VoidCoinVoidFields;

			public static ConfigEntry<float> EffectVolume;

			internal static void Init(ConfigFile configFile)
			{
				AmmoPickupAsOrbEnabled = configFile.Bind(ConfigCategoriesEnum.DisableModParts, "Ammo Pickup As Orb", defaultValue: true, "Should the Ammo Pickup as an orb be enabled.", oldDefault: false);
				VoidCoinShareOnPickup = configFile.Bind(ConfigCategoriesEnum.General, "Share Void Coin On Pickup", defaultValue: false, "Should void coins share on pickup.", oldDefault: false);
				VoidCoinDropChanceStart = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop Chance", 10f, "Not used if using Released from the void. Starting drop chance of void coins from void guys.", 0f);
				VoidCoinDropChanceMult = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop Chance Mult", 0.5f, "Not used if using Released from the void. Drop chance multiplier to chance upon getting coin.", 0f);
				VoidCoinBarrelDrop = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop From Void Barrel", defaultValue: true, "Not used if using Released from the void. Should the void coin drop from barrels.", oldDefault: false);
				VoidCoinVoidFields = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop From Void Fields", defaultValue: true, "Should the void coin drop from void fields.", oldDefault: false);
			}

			internal static void InitZio(ConfigFile configFile)
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				EffectVolume = configFile.Bind(ConfigCategoriesEnum.General, "Effect Volume", 50f, "Volume of the sound effects in my mod.", 0f, networked: false);
				EffectVolume.SettingChanged += delegate
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					AkSoundEngine.SetRTPCValue("Volume_Effects", EffectVolume.Value);
				};
				AkSoundEngine.SetRTPCValue("Volume_Effects", EffectVolume.Value);
				Instance._sharedInfo.MakeZioOptions(configFile);
			}

			internal static void MakeRiskOfOptions()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Expected O, but got Unknown
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: 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_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Expected O, but got Unknown
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected O, but got Unknown
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Expected O, but got Unknown
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Expected O, but got Unknown
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(VoidCoinShareOnPickup));
				ModSettingsManager.AddOption((BaseOption)new SliderOption(VoidCoinDropChanceStart));
				ModSettingsManager.AddOption((BaseOption)new SliderOption(VoidCoinDropChanceMult, new SliderConfig
				{
					min = 0f,
					max = 1f,
					formatString = "{0:0.##%}"
				}));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(VoidCoinBarrelDrop, true));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(VoidCoinVoidFields));
			}

			internal static void MakeRiskOfOptionsZio()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Expected O, but got Unknown
				ModSettingsManager.AddOption((BaseOption)new SliderOption(EffectVolume));
			}
		}

		private class ContentPackProvider : IContentPackProvider
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static CollectContentPackProvidersDelegate <0>__AddCustomContent;
			}

			private static ContentPack _contentPack;

			private static string _identifier;

			private static SharedBase.SharedInfo _info;

			public string identifier => _identifier;

			public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
			{
				args.ReportProgress(1f);
				yield break;
			}

			public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
			{
				ContentPack.Copy(_contentPack, args.output);
				args.ReportProgress(1f);
				yield break;
			}

			public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
			{
				args.ReportProgress(1f);
				Log.LogInfo((object)"Contentpack finished");
				_info.Expansion = BubExpansion;
				_info.SotVExpansion = BubSotvExpansion;
				yield break;
			}

			internal static void Initialize(string identifier, ContentPack pack, SharedBase.SharedInfo sharedInfo)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				_identifier = identifier;
				_contentPack = pack;
				_info = sharedInfo;
				object obj = <>O.<0>__AddCustomContent;
				if (obj == null)
				{
					CollectContentPackProvidersDelegate val = AddCustomContent;
					<>O.<0>__AddCustomContent = val;
					obj = (object)val;
				}
				ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
			}

			private static void AddCustomContent(AddContentPackProviderDelegate addContentPackProvider)
			{
				addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentPackProvider());
			}
		}

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

			public static Func<ItemDef, bool> <>9__7_0;

			public static Func<ItemDef, PickupIndex> <>9__7_1;

			public static Func<ExpansionDef, bool> <>9__13_0;

			public static Func<ExpansionDef, bool> <>9__15_0;

			public static Action<List<string>> <>9__16_0;

			public static UnityAction <>9__19_0;

			public static UnityAction <>9__19_1;

			public static UnityAction <>9__19_2;

			internal bool <get_VoidLunarItems>b__7_0(ItemDef x)
			{
				//IL_0001: 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)
				return x.tier == VoidLunarTier.tier;
			}

			internal PickupIndex <get_VoidLunarItems>b__7_1(ItemDef x)
			{
				//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)
				return PickupCatalog.FindPickupIndex(x.itemIndex);
			}

			internal bool <get_BubExpansion>b__13_0(ExpansionDef x)
			{
				return x.nameToken == "BUB_EXPANSION";
			}

			internal bool <get_BubSotvExpansion>b__15_0(ExpansionDef x)
			{
				return x.nameToken == "BUB_EXPANSION_VOID";
			}

			internal void <Awake>b__16_0(List<string> list)
			{
				string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Language";
				if (File.Exists(text))
				{
					list.Add(text);
				}
			}

			internal void <MakeRiskOfOptions>b__19_0()
			{
				Application.OpenURL("https://github.com/Bubbet/Risk-Of-Rain-Mods/issues/new");
			}

			internal void <MakeRiskOfOptions>b__19_1()
			{
				Application.OpenURL("https://ko-fi.com/bubbet");
			}

			internal void <MakeRiskOfOptions>b__19_2()
			{
				Application.OpenURL("https://ko-fi.com/snakeygemo/gallery");
			}
		}

		private const string AssetBundleName = "MainAssetBundle";

		public static ContentPack ContentPack;

		public static AssetBundle AssetBundle;

		public const string Version = "1.8.11.16";

		public static BubbetsItemsPlugin Instance;

		public static ManualLogSource Log;

		private static ExpansionDef? _bubExpansion;

		private static ExpansionDef? _bubSotvExpansion;

		private static uint _bankID;

		public static ItemTierDef VoidLunarTier;

		private static PickupIndex[]? _voidLunarItems;

		private SharedBase.SharedInfo _sharedInfo;

		public static bool RiskOfOptionsEnabled;

		public List<SharedBase> ForwardTest => SharedBase.Instances;

		public static PickupIndex[] VoidLunarItems => _voidLunarItems ?? (_voidLunarItems = (from x in (IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs
			where x.tier == VoidLunarTier.tier
			select PickupCatalog.FindPickupIndex(x.itemIndex)).ToArray());

		public static ExpansionDef BubExpansion
		{
			get
			{
				if (_bubExpansion == null)
				{
					_bubExpansion = ((IEnumerable<ExpansionDef>)ContentPack.expansionDefs).First((ExpansionDef x) => x.nameToken == "BUB_EXPANSION");
					_bubExpansion.disabledIconSprite = BubSotvExpansion.disabledIconSprite;
				}
				return _bubExpansion;
			}
		}

		public static ExpansionDef BubSotvExpansion
		{
			get
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				if (_bubSotvExpansion == null)
				{
					_bubSotvExpansion = ((IEnumerable<ExpansionDef>)ContentPack.expansionDefs).First((ExpansionDef x) => x.nameToken == "BUB_EXPANSION_VOID");
					ExpansionDef val = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
					_bubSotvExpansion.requiredEntitlement = val.requiredEntitlement;
					_bubSotvExpansion.disabledIconSprite = val.disabledIconSprite;
				}
				return _bubSotvExpansion;
			}
		}

		public void Awake()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			Conf.Init(((BaseUnityPlugin)this).Config);
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				MakeRiskOfOptions();
			}
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			RoR2Application.isModded = true;
			Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			LoadContentPack(val);
			VoidLunarShopController.Init();
			InLobbyConfigCompat.Init();
			RiskOfOptionsCompat.Init();
			new PatchClassProcessor(val, typeof(CommonBodyPatches)).Patch();
			new PatchClassProcessor(val, typeof(HarmonyPatches)).Patch();
			new PatchClassProcessor(val, typeof(PickupTooltipFormat)).Patch();
			new PatchClassProcessor(val, typeof(LogBookPageScalingGraph)).Patch();
			new PatchClassProcessor(val, typeof(ModdedDamageColors)).Patch();
			new PatchClassProcessor(val, typeof(CustomItemTierDefs)).Patch();
			new PatchClassProcessor(val, typeof(ColorCatalogPatches)).Patch();
			ColorCatalogPatches.AddNewColors();
			new PatchClassProcessor(val, typeof(EquipmentBase)).Patch();
			new PatchClassProcessor(val, typeof(ItemBase)).Patch();
			new PatchClassProcessor(val, typeof(VoidLunarShopController)).Patch();
			new PatchClassProcessor(val, typeof(ExtraHealthBarSegments)).Patch();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(onLoad));
			Language.collectLanguageRootFolders += delegate(List<string> list)
			{
				string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Language";
				if (File.Exists(text))
				{
					list.Add(text);
				}
			};
			ItemStatsCompat.Init();
		}

		private void onLoad()
		{
			if (Chainloader.PluginInfos.ContainsKey("bubbet.zioconfigfile"))
			{
				ZioConfigSetup();
				if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
				{
					Conf.MakeRiskOfOptionsZio();
				}
			}
			ConfigCategories.Init();
		}

		private void ZioConfigSetup()
		{
			Conf.InitZio(((BaseUnityPlugin)this).Config);
		}

		private void MakeRiskOfOptions()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_006b: 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_0076: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			RiskOfOptionsEnabled = true;
			object obj = <>c.<>9__19_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					Application.OpenURL("https://github.com/Bubbet/Risk-Of-Rain-Mods/issues/new");
				};
				<>c.<>9__19_0 = val;
				obj = (object)val;
			}
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Report An Issue", "General", "If you find a bug in the mod, reporting an issue is the best way to ensure it gets fixed.", "Open Link", (UnityAction)obj));
			object obj2 = <>c.<>9__19_1;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					Application.OpenURL("https://ko-fi.com/bubbet");
				};
				<>c.<>9__19_1 = val2;
				obj2 = (object)val2;
			}
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Donate to Bubbet", "General", "Donate to the programmer of bubbet's items.", "Open Link", (UnityAction)obj2));
			object obj3 = <>c.<>9__19_2;
			if (obj3 == null)
			{
				UnityAction val3 = delegate
				{
					Application.OpenURL("https://ko-fi.com/snakeygemo/gallery");
				};
				<>c.<>9__19_2 = val3;
				obj3 = (object)val3;
			}
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Donate to GEMO", "General", "Donate to the modeller of bubbet's items.", "Open Link", (UnityAction)obj3));
			Conf.MakeRiskOfOptions();
		}

		public static void LoadSoundBank()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			if (Application.isBatchMode)
			{
				return;
			}
			try
			{
				AkSoundEngine.AddBasePath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
				AKRESULT val = AkSoundEngine.LoadBank("BubbetsItems.bnk", ref _bankID);
				if ((int)val != 1)
				{
					Debug.LogError((object)("[Bubbets Items] SoundBank Load Failed: " + ((object)(AKRESULT)(ref val)).ToString()));
				}
			}
			catch (Exception ex)
			{
				Log.LogError((object)ex);
			}
		}

		[SystemInitializer(new Type[] { })]
		public static void ExtraTokens()
		{
			Language.english.SetStringByToken("BUB_HOLD_TOOLTIP", "Hold Capslock for more.");
			Language.english.SetStringByToken("BUB_EXPANSION", "Bubbet's Content");
			Language.english.SetStringByToken("BUB_EXPANSION_DESC", "Adds content from 'Bubbets Items' to the game.");
			Language.english.SetStringByToken("BUB_EXPANSION_VOID", "Bubbet's Void Content");
			Language.english.SetStringByToken("BUB_EXPANSION_VOID_DESC", "Adds the void content from 'Bubbets Items' and requires 'Survivors of the Void'.");
			Language.english.SetStringByToken("BUB_DEFAULT_CONVERT", "Corrupts all {0}.");
		}

		private void LoadContentPack(Harmony harmony)
		{
			//IL_006c: 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_0118: Expected O, but got Unknown
			AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "MainAssetBundle"));
			BubsItemsContentPackProvider bubsItemsContentPackProvider = AssetBundle.LoadAsset<BubsItemsContentPackProvider>("MainContentPack");
			CustomItemTierDefs.Init(bubsItemsContentPackProvider);
			List<SerializableEntityStateType> list = new List<SerializableEntityStateType>();
			Type[] types = Assembly.GetCallingAssembly().GetTypes();
			foreach (Type type in types)
			{
				if (typeof(EntityState).IsAssignableFrom(type))
				{
					list.Add(new SerializableEntityStateType(type));
				}
			}
			((SerializableContentPack)bubsItemsContentPackProvider).entityStateTypes = list.ToArray();
			SharedBase.Initialize(((BaseUnityPlugin)this).Logger, ((BaseUnityPlugin)this).Config, out _sharedInfo, (SerializableContentPack?)(object)bubsItemsContentPackProvider, harmony, "BUB_");
			ContentPack = ((SerializableContentPack)bubsItemsContentPackProvider).CreateContentPack();
			SharedBase.AddContentPack(ContentPack);
			ContentPackProvider.Initialize(((BaseUnityPlugin)this).Info.Metadata.GUID, ContentPack, _sharedInfo);
			if (Conf.AmmoPickupAsOrbEnabled.Value)
			{
				GameObject val = AssetBundle.LoadAsset<GameObject>("AmmoPickupOrb");
				ContentPack.effectDefs.Add((EffectDef[])(object)new EffectDef[1]
				{
					new EffectDef(val)
				});
			}
		}
	}
	public class BubPickupDisplayCustom : MonoBehaviour
	{
		private static GameObject _voidLunarSystem;

		private static GameObject _pickup;

		private PickupDisplay _display;

		private bool _set;

		[SystemInitializer(new Type[] { typeof(GenericPickupController) })]
		public static void ModifyGenericPickup()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			_pickup = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/GenericPickup.prefab").WaitForCompletion();
			((Component)_pickup.transform.Find("PickupDisplay")).gameObject.AddComponent<BubPickupDisplayCustom>();
			Transform obj = _pickup.transform.Find("VoidSystem");
			Transform obj2 = obj.Find("Loops");
			Transform val = _pickup.transform.Find("LunarSystem");
			Transform obj3 = val.Find("Loops");
			_voidLunarSystem = new GameObject("VoidLunarSystem");
			_voidLunarSystem.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)_voidLunarSystem);
			GameObject val2 = new GameObject("Loops");
			val2.transform.SetParent(_voidLunarSystem.transform);
			MainModule main = Object.Instantiate<GameObject>(((Component)obj3.Find("Swirls")).gameObject, val2.transform).GetComponent<ParticleSystem>().main;
			((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(ColorCatalogPatches.VoidLunarColor));
			Object.Instantiate<GameObject>(((Component)obj2.Find("DistantSoftGlow")).gameObject, val2.transform);
			Object.Instantiate<GameObject>(((Component)obj2.Find("Glowies")).gameObject, val2.transform);
			Object.Instantiate<GameObject>(((Component)obj2.Find("Point Light")).gameObject, val2.transform).GetComponent<Light>().color = Color32.op_Implicit(ColorCatalogPatches.VoidLunarColor);
			((Object)Object.Instantiate<GameObject>(((Component)val.Find("Burst")).gameObject, _voidLunarSystem.transform)).name = "LunarBurst";
			((Object)Object.Instantiate<GameObject>(((Component)obj.Find("Burst")).gameObject, _voidLunarSystem.transform)).name = "VoidBurst";
		}

		private void Awake()
		{
			_display = ((Component)this).GetComponent<PickupDisplay>();
		}

		public void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between I4 and Unknown
			PickupDef pickupDef = PickupCatalog.GetPickupDef(_display.pickupIndex);
			if (pickupDef != null && !_set)
			{
				_set = true;
				ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
				if (((itemDef == null) ? 5 : ((int)itemDef.tier)) == (int)BubbetsItemsPlugin.VoidLunarTier.tier)
				{
					Object.Instantiate<GameObject>(_voidLunarSystem, ((Component)this).transform.parent).SetActive(true);
				}
			}
		}
	}
	[HarmonyPatch]
	public static class ColorCatalogPatches
	{
		public static FieldInfo? indexToColor32 = typeof(ColorCatalog).GetField("indexToColor32", BindingFlags.Static | BindingFlags.NonPublic);

		public static FieldInfo? indexToHexString = typeof(ColorCatalog).GetField("indexToHexString", BindingFlags.Static | BindingFlags.NonPublic);

		public static Color32 VoidLunarColor = new Color32((byte)134, (byte)0, (byte)203, byte.MaxValue);

		public static void AddNewColors()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			int num = ColorCatalog.indexToColor32.Length;
			BubbetsItemsPlugin.VoidLunarTier.colorIndex = (ColorIndex)num;
			BubbetsItemsPlugin.VoidLunarTier.darkColorIndex = (ColorIndex)(num + 1);
			Color32 val = default(Color32);
			((Color32)(ref val))..ctor((byte)83, (byte)0, (byte)126, byte.MaxValue);
			indexToColor32?.SetValue(null, CollectionExtensions.AddItem<Color32>(CollectionExtensions.AddItem<Color32>((IEnumerable<Color32>)ColorCatalog.indexToColor32, VoidLunarColor), val).ToArray());
			indexToHexString?.SetValue(null, CollectionExtensions.AddItem<string>(CollectionExtensions.AddItem<string>((IEnumerable<string>)ColorCatalog.indexToHexString, Util.RGBToHex(VoidLunarColor)), Util.RGBToHex(val)).ToArray());
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ColorCatalog), "GetColor")]
		public static bool PatchGetColor(ColorIndex colorIndex, ref Color32 __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Expected I4, but got Unknown
			//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)
			int num = (int)colorIndex;
			if (num >= ColorCatalog.indexToColor32.Length)
			{
				return true;
			}
			__result = ColorCatalog.indexToColor32[num];
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ColorCatalog), "GetColorHexString")]
		public static bool GetColorHexString(ColorIndex colorIndex, ref string __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Expected I4, but got Unknown
			int num = (int)colorIndex;
			if (num >= ColorCatalog.indexToHexString.Length)
			{
				return true;
			}
			__result = ColorCatalog.indexToHexString[num];
			return false;
		}
	}
	[HarmonyPatch]
	public static class CustomItemTierDefs
	{
		public delegate void RefAction(ref object obj);

		public static List<ItemTierDef> recyclerTiers = new List<ItemTierDef>();

		public static List<ItemTierDef> voidTiers = new List<ItemTierDef>();

		[HarmonyILManipulator]
		[HarmonyPatch(typeof(PickupTransmutationManager), "RebuildPickupGroups")]
		public static void RebuildCustomTierRecycler(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			MethodReference val2 = default(MethodReference);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchStsfld(x, typeof(PickupTransmutationManager), "pickupGroups")
			});
			val.Emit(OpCodes.Dup);
			val.EmitDelegate<Action<List<PickupIndex[]>>>((Action<List<PickupIndex[]>>)delegate(List<PickupIndex[]> groups)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				foreach (ItemTierDef recyclerTier in recyclerTiers)
				{
					AddItemTierGroup(recyclerTier.tier, ref groups);
				}
			});
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(VoidSurvivorController), "OnInventoryChanged")]
		public static void AddExtraTiersToVoidSurvivor(VoidSurvivorController __instance)
		{
			Inventory inv = __instance.characterBody.inventory;
			if (Object.op_Implicit((Object)(object)inv))
			{
				__instance.voidItemCount += voidTiers.Sum((ItemTierDef x) => inv.GetTotalItemCountOfTier(x.tier));
			}
		}

		public static PickupIndex[] AddItemTierGroup(ItemTier tier, ref List<PickupIndex[]> groups)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknow

dll/CommandQueue.dll.old

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.UI;
using RoR2;
using RoR2.Artifacts;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CommandQueue")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CommandQueue")]
[assembly: AssemblyTitle("CommandQueue")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CommandQueue;

[BepInPlugin("com.kuberoot.commandqueue", "CommandQueue", "1.5.0")]
public class CommandQueue : BaseUnityPlugin
{
	public static bool IsLoaded;

	private static GameObject commandUIPrefab;

	private bool isFakeReloading;

	public static event Action PluginUnloaded;

	public void Awake()
	{
		ModConfig.InitConfig(((BaseUnityPlugin)this).Config);
		ModConfig.enabledTabs.SettingChanged += delegate
		{
			FakeReload();
		};
		ModConfig.bigItemButtonContainer.SettingChanged += delegate
		{
			FakeReload();
		};
		ModConfig.bigItemButtonScale.SettingChanged += delegate
		{
			FakeReload();
		};
	}

	private void FakeReload()
	{
		if (!isFakeReloading)
		{
			isFakeReloading = true;
			((MonoBehaviour)this).StartCoroutine(doFakeReload());
		}
		IEnumerator doFakeReload()
		{
			yield return 0;
			OnDisable();
			yield return 0;
			OnEnable();
			isFakeReloading = false;
		}
	}

	public void OnEnable()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		GameObject commandCubePrefab = CommandArtifactManager.commandCubePrefab;
		commandUIPrefab = ((commandCubePrefab != null) ? commandCubePrefab.GetComponent<PickupPickerController>().panelPrefab : null);
		IsLoaded = true;
		PickupPickerController.OnDisplayBegin += new hook_OnDisplayBegin(HandleCommandDisplayBegin);
		ScoreboardController.Awake += new hook_Awake(ScoreboardController_Awake);
		CommandArtifactManager.Init += new hook_Init(CommandArtifactManager_Init);
		QueueManager.Enable();
		HUD[] array = Object.FindObjectsOfType<HUD>();
		for (int i = 0; i < array.Length; i++)
		{
			array[i].scoreboardPanel.AddComponent<UIManager>();
		}
	}

	public void OnDisable()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		IsLoaded = false;
		CommandQueue.PluginUnloaded?.Invoke();
		PickupPickerController.OnDisplayBegin -= new hook_OnDisplayBegin(HandleCommandDisplayBegin);
		ScoreboardController.Awake -= new hook_Awake(ScoreboardController_Awake);
		CommandArtifactManager.Init -= new hook_Init(CommandArtifactManager_Init);
		QueueManager.Disable();
	}

	private void CommandArtifactManager_Init(orig_Init orig)
	{
		orig.Invoke();
		GameObject commandCubePrefab = CommandArtifactManager.commandCubePrefab;
		commandUIPrefab = ((commandCubePrefab != null) ? commandCubePrefab.GetComponent<PickupPickerController>().panelPrefab : null);
	}

	private void HandleCommandDisplayBegin(orig_OnDisplayBegin orig, PickupPickerController self, NetworkUIPromptController networkUIPromptController, LocalUser localUser, CameraRigController cameraRigController)
	{
		//IL_003e: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)self.panelPrefab == (Object)(object)commandUIPrefab)
		{
			foreach (var (tier, val) in QueueManager.PeekAll())
			{
				if (!self.IsChoiceAvailable(val))
				{
					continue;
				}
				QueueManager.Pop(tier);
				Option[] options = self.options;
				int i;
				for (i = 0; i < options.Length; i++)
				{
					if (options[i].pickupIndex == val && options[i].available)
					{
						((MonoBehaviour)self).StartCoroutine(submitChoiceNextFrame());
						break;
					}
				}
				return;
				IEnumerator submitChoiceNextFrame()
				{
					yield return 0;
					self.SubmitChoice(i);
				}
			}
		}
		orig.Invoke(self, networkUIPromptController, localUser, cameraRigController);
	}

	private void ScoreboardController_Awake(orig_Awake orig, ScoreboardController self)
	{
		((Component)self).gameObject.AddComponent<UIManager>();
		orig.Invoke(self);
	}
}
public static class ModConfig
{
	public class ItemTierSet : SortedSet<ItemTier>
	{
		public static string Serialize(ItemTierSet self)
		{
			return string.Join(", ", self.Select((ItemTier x) => ((object)(ItemTier)(ref x)).ToString()));
		}

		public static ItemTierSet Deserialize(string src)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			ItemTierSet itemTierSet = new ItemTierSet();
			foreach (string item in from s in src.Split(new char[1] { ',' })
				select s.Trim())
			{
				int result2;
				if (Enum.TryParse<ItemTier>(item, out ItemTier result))
				{
					itemTierSet.Add(result);
				}
				else if (int.TryParse(item, out result2))
				{
					itemTierSet.Add((ItemTier)result2);
				}
			}
			return itemTierSet;
		}

		public override string ToString()
		{
			return Serialize(this);
		}
	}

	private static ConfigFile config;

	public static ConfigEntry<ItemTierSet> enabledTabs;

	public static ConfigEntry<bool> bigItemButtonContainer;

	public static ConfigEntry<float> bigItemButtonScale;

	public static ConfigEntry<bool> rightClickRemovesStack;

	internal static void InitConfig(ConfigFile _config)
	{
		//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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		//IL_0074: 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_00c9: Expected O, but got Unknown
		//IL_00c9: Expected O, but got Unknown
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Expected O, but got Unknown
		//IL_00f8: Expected O, but got Unknown
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Expected O, but got Unknown
		//IL_012b: Expected O, but got Unknown
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Expected O, but got Unknown
		//IL_015a: Expected O, but got Unknown
		config = _config;
		TomlTypeConverter.AddConverter(typeof(ItemTierSet), new TypeConverter
		{
			ConvertToObject = (string str, Type type) => ItemTierSet.Deserialize(str),
			ConvertToString = (object obj, Type type) => obj.ToString()
		});
		enabledTabs = config.Bind<ItemTierSet>(new ConfigDefinition("General", "EnabledQueues"), new ItemTierSet
		{
			(ItemTier)0,
			(ItemTier)1,
			(ItemTier)2
		}, new ConfigDescription("Which item tiers should have queues?\nValid values: " + string.Join(", ", Enum.GetNames(typeof(ItemTier))), (AcceptableValueBase)null, Array.Empty<object>()));
		bigItemButtonContainer = config.Bind<bool>(new ConfigDefinition("General", "BigItemSelectionContainer"), true, new ConfigDescription("false: Default command button layout\ntrue: Increase the space for buttons, helps avoid overflow with modded items", (AcceptableValueBase)null, Array.Empty<object>()));
		bigItemButtonScale = config.Bind<float>(new ConfigDefinition("General", "BigItemSelectionScale"), 1f, new ConfigDescription("Scale applied to item buttons in the menu - decrease it if your buttons don't fit\nApplies only if BigItemSelectionContainer is true", (AcceptableValueBase)null, Array.Empty<object>()));
		rightClickRemovesStack = config.Bind<bool>(new ConfigDefinition("General", "RightClickRemovesStack"), true, new ConfigDescription("Should right-clicking an item in the queue remove the whole stack?", (AcceptableValueBase)null, Array.Empty<object>()));
	}
}
internal class QueueDisplay : MonoBehaviour
{
	public class QueueItemBehavior : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler, IPointerClickHandler
	{
		private GameObject m_DraggingIcon;

		private QueueDisplay m_Queue;

		private ItemIcon m_ItemIcon;

		public void Init(QueueDisplay queue)
		{
			m_Queue = queue;
			m_ItemIcon = ((Component)this).GetComponent<ItemIcon>();
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			InputButton button = eventData.button;
			if ((int)button <= 1)
			{
				m_DraggingIcon = new GameObject("QueueItemDragIcon");
				m_DraggingIcon.transform.SetParent(((Component)m_Queue).transform, false);
				m_DraggingIcon.transform.SetAsLastSibling();
				RawImage obj = m_DraggingIcon.AddComponent<RawImage>();
				obj.texture = m_ItemIcon.image.texture;
				RectTransform rectTransform = ((Graphic)obj).rectTransform;
				Rect rect = ((Graphic)m_ItemIcon.image).rectTransform.rect;
				float height = ((Rect)(ref rect)).height;
				rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
				rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
				rectTransform.sizeDelta = new Vector2(height, height);
				((Transform)rectTransform).localScale = ((Transform)m_ItemIcon.rectTransform).localScale;
				((Graphic)obj).color = new Color(1f, 1f, 1f, 0.6f);
				SetDraggedPosition(eventData);
				((AbstractEventData)eventData).Use();
			}
		}

		public void OnDrag(PointerEventData eventData)
		{
			if (Object.op_Implicit((Object)(object)m_DraggingIcon))
			{
				SetDraggedPosition(eventData);
				((AbstractEventData)eventData).Use();
			}
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			//IL_0025: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)m_DraggingIcon))
			{
				return;
			}
			Object.Destroy((Object)(object)m_DraggingIcon);
			Vector2 val = default(Vector2);
			if (RectTransformUtility.ScreenPointToLocalPointInRectangle(m_Queue.rectTransform, eventData.position, eventData.pressEventCamera, ref val))
			{
				int newIndex = Mathf.RoundToInt(val.x / (m_Queue.iconScale * (m_Queue.itemIconPrefabWidth + 5f)));
				int num = m_Queue.icons.FindIndex((ItemIcon icon) => (Object)(object)((Component)icon).gameObject == (Object)(object)((Component)this).gameObject);
				List<QueueManager.QueueEntry> queue = m_Queue.queue;
				if (num < 0 || num > queue.Count)
				{
					return;
				}
				int num2 = m_Queue.queue[num].count;
				if ((int)eventData.button == 1 && num2 > 1)
				{
					num2 /= 2;
				}
				QueueManager.Move(m_Queue.tier, num, newIndex, num2);
			}
			((AbstractEventData)eventData).Use();
		}

		private void SetDraggedPosition(PointerEventData data)
		{
			//IL_0018: 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)
			RectTransform component = m_DraggingIcon.GetComponent<RectTransform>();
			Vector3 position = default(Vector3);
			if (RectTransformUtility.ScreenPointToWorldPointInRectangle(m_Queue.rectTransform, data.position, data.pressEventCamera, ref position))
			{
				((Transform)component).position = position;
			}
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0056: 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)
			if ((int)eventData.button != 1 || !ModConfig.rightClickRemovesStack.Value)
			{
				return;
			}
			List<ItemIcon> icons = m_Queue.icons;
			for (int i = 0; i < icons.Count; i++)
			{
				if ((Object)(object)((Component)icons[i]).gameObject == (Object)(object)((Component)this).gameObject)
				{
					QueueManager.QueueEntry queueEntry = m_Queue.queue[i];
					QueueManager.Remove(m_Queue.tier, i, queueEntry.count);
					break;
				}
			}
			((AbstractEventData)eventData).Use();
		}
	}

	public GameObject itemIconPrefab;

	public float itemIconPrefabWidth = 64f;

	public ItemTier tier;

	private float iconScale = 1f;

	private RectTransform rectTransform;

	private readonly List<ItemIcon> icons = new List<ItemIcon>();

	private List<QueueManager.QueueEntry> queue;

	public void Awake()
	{
		ref RectTransform reference = ref rectTransform;
		Transform transform = ((Component)this).transform;
		reference = (RectTransform)(object)((transform is RectTransform) ? transform : null);
	}

	public void Start()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		Rect rect = rectTransform.rect;
		iconScale = (((Rect)(ref rect)).height - 10f) / itemIconPrefabWidth;
		LayoutIcons();
	}

	public void LayoutIcon(int index, RectTransform transform)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		transform.anchoredPosition = new Vector2((float)index * iconScale * (itemIconPrefabWidth + 5f), 5f);
		((Transform)transform).localScale = new Vector3(iconScale, iconScale, 1f);
	}

	public void LayoutIcons(int first = 0)
	{
		for (int i = first; i < icons.Count; i++)
		{
			LayoutIcon(i, icons[i].rectTransform);
		}
	}

	public ItemIcon AllocateIcon(int index)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_005f: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		ItemIcon icon = Object.Instantiate<GameObject>(itemIconPrefab, (Transform)(object)rectTransform, false).GetComponent<ItemIcon>();
		RectTransform val = icon.rectTransform;
		Button obj = ((Component)icon).gameObject.AddComponent<Button>();
		((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < icons.Count; i++)
			{
				if ((Object)(object)icons[i] == (Object)(object)icon)
				{
					QueueManager.Remove(tier, i);
					break;
				}
			}
		});
		Navigation navigation = default(Navigation);
		((Navigation)(ref navigation)).mode = (Mode)0;
		((Selectable)obj).navigation = navigation;
		val.anchorMin = new Vector2(0f, 1f);
		val.anchorMax = new Vector2(0f, 1f);
		LayoutIcon(index, val);
		((Component)icon).gameObject.AddComponent<QueueItemBehavior>().Init(this);
		icons.Insert(index, icon);
		return icon;
	}

	public void AllocateIcons(int count, Action<int, ItemIcon> action = null)
	{
		for (int num = icons.Count - 1; num >= count; num--)
		{
			Object.Destroy((Object)(object)((Component)icons[num]).gameObject);
			icons.RemoveAt(num);
		}
		for (int i = icons.Count; i < count; i++)
		{
			ItemIcon arg = AllocateIcon(i);
			action?.Invoke(i, arg);
		}
	}

	public void DestroyUI()
	{
		foreach (ItemIcon icon in icons)
		{
			Object.Destroy((Object)(object)((Component)icon).gameObject);
		}
		icons.Clear();
	}

	public void UpdateUI()
	{
		AllocateIcons(queue.Count);
		UpdateIcons();
	}

	private void UpdateIcon(int i)
	{
		//IL_001a: 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)
		ItemIcon obj = icons[i];
		QueueManager.QueueEntry queueEntry = queue[i];
		obj.SetItemIndex(PickupCatalog.GetPickupDef(queueEntry.pickupIndex).itemIndex, queueEntry.count);
	}

	private void UpdateIcons()
	{
		for (int i = 0; i < icons.Count; i++)
		{
			UpdateIcon(i);
		}
	}

	private void HandleQueueChange(QueueManager.QueueChange change, ItemTier tier, int index)
	{
		//IL_000e: 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)
		if (Object.op_Implicit((Object)(object)itemIconPrefab) && tier == this.tier)
		{
			switch (change)
			{
			case QueueManager.QueueChange.Changed:
				UpdateIcon(index);
				break;
			case QueueManager.QueueChange.Added:
				AllocateIcon(index);
				UpdateIcon(index);
				break;
			case QueueManager.QueueChange.Removed:
				Object.Destroy((Object)(object)((Component)icons[index]).gameObject);
				icons.RemoveAt(index);
				LayoutIcons(index);
				break;
			case QueueManager.QueueChange.Moved:
				UpdateUI();
				break;
			}
		}
	}

	public void OnEnable()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)itemIconPrefab))
		{
			queue = QueueManager.mainQueues[tier];
			UpdateUI();
			QueueManager.OnQueueChanged += HandleQueueChange;
		}
	}

	public void OnDisable()
	{
		QueueManager.OnQueueChanged -= HandleQueueChange;
	}
}
public static class QueueManager
{
	public struct QueueEntry
	{
		public PickupIndex pickupIndex;

		public int count;
	}

	public enum QueueChange
	{
		Removed,
		Added,
		Changed,
		Moved
	}

	public static Dictionary<ItemTier, List<QueueEntry>> mainQueues = new Dictionary<ItemTier, List<QueueEntry>>
	{
		{
			(ItemTier)0,
			new List<QueueEntry>()
		},
		{
			(ItemTier)1,
			new List<QueueEntry>()
		},
		{
			(ItemTier)2,
			new List<QueueEntry>()
		}
	};

	public static Dictionary<ItemTier, bool> queueRepeat = new Dictionary<ItemTier, bool>();

	public static event Action<Run> OnRunQueueInit;

	public static event Action<QueueChange, ItemTier, int> OnQueueChanged;

	internal static void Enable()
	{
		Run.onRunStartGlobal += InitQueues;
		UpdateQueueAvailability();
	}

	internal static void Disable()
	{
		Run.onRunStartGlobal -= InitQueues;
	}

	public static void UpdateQueueAvailability()
	{
		//IL_0022: 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_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		ModConfig.ItemTierSet value = ModConfig.enabledTabs.Value;
		ItemTier[] array = mainQueues.Keys.ToArray();
		foreach (ItemTier val in array)
		{
			if (!value.Contains(val))
			{
				mainQueues.Remove(val);
			}
		}
		foreach (ItemTier item in value)
		{
			if (!mainQueues.ContainsKey(item))
			{
				mainQueues.Add(item, new List<QueueEntry>());
			}
		}
	}

	private static void InitQueues(Run run)
	{
		mainQueues.Clear();
		UpdateQueueAvailability();
		QueueManager.OnRunQueueInit?.Invoke(run);
	}

	public static bool DoesRepeat(ItemTier tier)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		bool value;
		return queueRepeat.TryGetValue(tier, out value) && value;
	}

	public static void ToggleRepeat(ItemTier tier)
	{
		//IL_0005: 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)
		queueRepeat[tier] = !DoesRepeat(tier);
	}

	public static void Enqueue(PickupIndex pickupIndex)
	{
		//IL_0000: 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_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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		ItemTier tier = ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(pickupIndex).itemIndex).tier;
		List<QueueEntry> list = mainQueues[tier];
		if (list.Count > 0)
		{
			QueueEntry value = list[list.Count - 1];
			if (value.pickupIndex == pickupIndex)
			{
				value.count++;
				list[list.Count - 1] = value;
				QueueManager.OnQueueChanged?.Invoke(QueueChange.Changed, tier, list.Count - 1);
				return;
			}
		}
		QueueEntry queueEntry = default(QueueEntry);
		queueEntry.pickupIndex = pickupIndex;
		queueEntry.count = 1;
		QueueEntry item = queueEntry;
		list.Add(item);
		QueueManager.OnQueueChanged?.Invoke(QueueChange.Added, tier, list.Count - 1);
	}

	public static PickupIndex Peek(ItemTier tier)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		List<QueueEntry> list = mainQueues[tier];
		if (list.Count == 0)
		{
			return PickupIndex.none;
		}
		return list[0].pickupIndex;
	}

	public static PickupIndex Pop(ItemTier tier)
	{
		//IL_0000: 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_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		PickupIndex val = Remove(tier, 0);
		if (DoesRepeat(tier))
		{
			Enqueue(val);
		}
		return val;
	}

	public static PickupIndex Remove(ItemTier tier, int index, int count = 1)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		List<QueueEntry> list = mainQueues[tier];
		QueueEntry value = list[index];
		value.count -= count;
		if (value.count <= 0)
		{
			list.RemoveAt(index);
			QueueManager.OnQueueChanged?.Invoke(QueueChange.Removed, tier, index);
			if (TryMerge(tier, index - 1, index))
			{
				QueueManager.OnQueueChanged?.Invoke(QueueChange.Removed, tier, index);
				QueueManager.OnQueueChanged?.Invoke(QueueChange.Changed, tier, index - 1);
			}
		}
		else
		{
			list[index] = value;
			QueueManager.OnQueueChanged?.Invoke(QueueChange.Changed, tier, index);
		}
		return value.pickupIndex;
	}

	private static bool TryMerge(ItemTier tier, int into, int from)
	{
		//IL_0005: 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)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		List<QueueEntry> list = mainQueues[tier];
		if (into < 0 || into >= list.Count || from < 0 || from >= list.Count)
		{
			return false;
		}
		QueueEntry value = list[into];
		QueueEntry queueEntry = list[from];
		if (value.pickupIndex != queueEntry.pickupIndex)
		{
			return false;
		}
		value.count += queueEntry.count;
		list[into] = value;
		list.RemoveAt(from);
		return true;
	}

	public static void Move(ItemTier tier, int oldIndex, int newIndex, int count = 1)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		List<QueueEntry> list = mainQueues[tier];
		newIndex = Math.Max(0, Math.Min(list.Count, newIndex));
		if (newIndex == oldIndex)
		{
			return;
		}
		QueueEntry item = list[oldIndex];
		if (item.count < count)
		{
			return;
		}
		if (item.count == count)
		{
			list.RemoveAt(oldIndex);
			if (newIndex > oldIndex)
			{
				newIndex--;
			}
		}
		else
		{
			QueueEntry value = list[oldIndex];
			value.count -= count;
			list[oldIndex] = value;
		}
		item.count = count;
		if (TryMerge(tier, oldIndex - 1, oldIndex) && newIndex > oldIndex)
		{
			newIndex--;
		}
		list.Insert(newIndex, item);
		TryMerge(tier, newIndex - 1, newIndex);
		TryMerge(tier, newIndex, newIndex + 1);
		QueueManager.OnQueueChanged?.Invoke(QueueChange.Moved, tier, -1);
	}

	public static IEnumerable<(ItemTier, PickupIndex)> PeekAll()
	{
		return from entry in mainQueues
			where entry.Value.Count > 0
			select (entry.Key, entry.Value.First().pickupIndex);
	}
}
internal class UIManager : MonoBehaviour
{
	private struct ButtonWrapper
	{
		public HGButton hgButton { get; private set; }

		public TextMeshProUGUI textComponent { get; private set; }

		public RectTransform rectTransform { get; private set; }

		public LanguageTextMeshController languageTextMeshController { get; private set; }

		public ButtonClickedEvent _onClick => ((Button)hgButton).onClick;

		public string text
		{
			get
			{
				return languageTextMeshController.token;
			}
			set
			{
				languageTextMeshController.token = value;
			}
		}

		public string directText
		{
			get
			{
				TextMeshProUGUI obj = textComponent;
				if (obj == null)
				{
					return null;
				}
				return ((TMP_Text)obj).text;
			}
			set
			{
				((TMP_Text)textComponent).text = value;
			}
		}

		public event UnityAction onClick
		{
			add
			{
				((UnityEvent)_onClick).AddListener(value);
			}
			remove
			{
				((UnityEvent)_onClick).RemoveListener(value);
			}
		}

		public ButtonWrapper(HGButton button)
		{
			hgButton = button;
			textComponent = ((Component)button).GetComponentInChildren<TextMeshProUGUI>();
			rectTransform = ((Component)button).GetComponent<RectTransform>();
			languageTextMeshController = ((Component)button).GetComponent<LanguageTextMeshController>();
		}
	}

	private static readonly GameObject commandUIPrefab;

	private static readonly GameObject commandCancelButton;

	private static readonly PickupPickerPanel prefabPickupPickerPanel;

	private static readonly GameObject commandItemButton;

	private static readonly GameObject commandItemContainer;

	private static Texture2D repeatIconTexture;

	private static readonly MethodInfo PickupPickerController_GetOptionsFromPickupIndex;

	private static readonly Color selectedColorMult;

	private Sprite missingUnlockIcon;

	private GameObject itemIconPrefab;

	private ItemInventoryDisplay itemInventoryDisplayPrefab;

	private ScoreboardController scoreboard;

	private HUD hud;

	private GameObject container;

	private GameObject origContainer;

	private ColorBlock origButtonColors;

	private ColorBlock selectedButtonColors;

	private ButtonWrapper scoreboardButton;

	private ButtonWrapper queueButton;

	private GameObject queueContainer;

	private readonly Dictionary<ItemTier, GameObject> queueDisplays = new Dictionary<ItemTier, GameObject>();

	private readonly Dictionary<ItemTier, ButtonWrapper> queueButtons = new Dictionary<ItemTier, ButtonWrapper>();

	private bool displayingQueues;

	private ItemTier selectedQueue;

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

	private bool DisplayingQueues
	{
		get
		{
			return displayingQueues;
		}
		set
		{
			if (displayingQueues == value)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)origContainer) && Object.op_Implicit((Object)(object)queueContainer))
			{
				if (value)
				{
					container.SetActive(false);
					queueContainer.SetActive(true);
				}
				else
				{
					container.SetActive(true);
					queueContainer.SetActive(false);
				}
			}
			displayingQueues = value;
			UpdateButtonColors();
		}
	}

	private ItemTier SelectedQueue
	{
		get
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return selectedQueue;
		}
		set
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (selectedQueue != value)
			{
				queueDisplays[selectedQueue].SetActive(false);
				queueDisplays[value].SetActive(true);
				TransitionEnabledButton(queueButtons[selectedQueue], queueButtons[value]);
				selectedQueue = value;
			}
		}
	}

	static UIManager()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		PickupPickerController_GetOptionsFromPickupIndex = typeof(PickupPickerController).GetMethod("GetOptionsFromPickupIndex", BindingFlags.Static | BindingFlags.NonPublic);
		selectedColorMult = new Color(0.3f, 0.3f, 0.3f);
		commandUIPrefab = CommandArtifactManager.commandCubePrefab.GetComponent<PickupPickerController>().panelPrefab;
		commandCancelButton = ((Component)commandUIPrefab.GetComponentsInChildren<HGButton>().First((HGButton a) => ((Object)a).name == "CancelButton")).gameObject;
		prefabPickupPickerPanel = commandUIPrefab.GetComponent<PickupPickerPanel>();
		commandItemButton = prefabPickupPickerPanel.buttonPrefab;
		commandItemContainer = ((Component)prefabPickupPickerPanel.buttonContainer).gameObject;
	}

	private static void CopyRectTransform(RectTransform dest, RectTransform source)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		dest.anchorMin = source.anchorMin;
		dest.anchorMax = source.anchorMax;
		dest.anchoredPosition = source.anchoredPosition;
		((Transform)dest).position = ((Transform)source).position;
		dest.sizeDelta = source.sizeDelta;
	}

	private static void ReparentChildren(Transform dest, Transform source, bool keepWorldPos = false, Action<Transform> additionalAction = null)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		List<Transform> list = new List<Transform>();
		foreach (Transform item in source)
		{
			Transform val = item;
			if ((Object)(object)val != (Object)(object)dest)
			{
				list.Add(val);
			}
		}
		foreach (Transform item2 in list)
		{
			item2.SetParent(dest, keepWorldPos);
			additionalAction?.Invoke(item2);
		}
	}

	private static IEnumerator ExecuteNextFrameInner(Action action)
	{
		yield return 0;
		action();
	}

	private void ExecuteNextFrame(Action action)
	{
		((MonoBehaviour)this).StartCoroutine(ExecuteNextFrameInner(action));
	}

	private ButtonWrapper CreateButton(GameObject parent = null, UnityAction onClick = null, string text = null)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		GameObject val = Object.Instantiate<GameObject>(commandCancelButton, (parent != null) ? parent.transform : null);
		uiElements.Add(val);
		HGButton component = val.GetComponent<HGButton>();
		((MPButton)component).onSelect = new UnityEvent();
		((MPButton)component).onDeselect = new UnityEvent();
		((Button)component).onClick = new ButtonClickedEvent();
		ButtonWrapper result = new ButtonWrapper(component);
		if (text != null)
		{
			result.text = text;
		}
		if (onClick != null)
		{
			result.onClick += onClick;
		}
		return result;
	}

	private void MarkButton(ButtonWrapper button, bool state)
	{
		//IL_0013: 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_0033: 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)
		((Selectable)button.hgButton).colors = (state ? selectedButtonColors : origButtonColors);
		((Graphic)button.hgButton.imageOnHover).color = (state ? selectedColorMult : Color.white);
	}

	private void TransitionEnabledButton(ButtonWrapper from, ButtonWrapper to)
	{
		MarkButton(from, state: false);
		MarkButton(to, state: true);
	}

	private void UpdateButtonColors()
	{
		if (Object.op_Implicit((Object)(object)queueButton.hgButton) && Object.op_Implicit((Object)(object)scoreboardButton.hgButton))
		{
			ButtonWrapper to;
			ButtonWrapper from;
			if (DisplayingQueues)
			{
				to = queueButton;
				from = scoreboardButton;
			}
			else
			{
				to = scoreboardButton;
				from = queueButton;
			}
			TransitionEnabledButton(from, to);
		}
	}

	private void PrintObject(GameObject obj, bool components = false, int depth = 0)
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Expected O, but got Unknown
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.Append(' ', depth * 2);
		stringBuilder.Append(((object)obj).ToString());
		Debug.Log((object)stringBuilder.ToString());
		if (components)
		{
			Component[] components2 = obj.GetComponents<Component>();
			foreach (Component val in components2)
			{
				stringBuilder.Clear();
				stringBuilder.Append(' ', depth * 2);
				stringBuilder.Append('-');
				stringBuilder.Append(((object)val).ToString());
				Debug.Log((object)stringBuilder.ToString());
			}
		}
		foreach (Transform item in obj.transform)
		{
			Transform val2 = item;
			PrintObject(((Component)val2).gameObject, components, depth + 1);
		}
	}

	private PickupIndex GetPickupIndexOfItemTier(ItemTier itemTier)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected I4, but got Unknown
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		List<PickupIndex> list = null;
		switch ((int)itemTier)
		{
		case 0:
			list = Run.instance.availableTier1DropList;
			break;
		case 1:
			list = Run.instance.availableTier2DropList;
			break;
		case 2:
			list = Run.instance.availableTier3DropList;
			break;
		case 4:
			list = Run.instance.availableBossDropList;
			break;
		case 3:
			list = Run.instance.availableLunarItemDropList;
			break;
		case 6:
			list = Run.instance.availableVoidTier1DropList;
			break;
		case 7:
			list = Run.instance.availableVoidTier2DropList;
			break;
		case 8:
			list = Run.instance.availableVoidTier3DropList;
			break;
		case 9:
			list = Run.instance.availableVoidBossDropList;
			break;
		}
		return list?.FirstOrDefault() ?? PickupIndex.none;
	}

	private RectTransform CreateQueueContainer(ItemTier itemTier, RectTransform parent, Action<PickupIndex> callback)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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_0049: Expected O, but got Unknown
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Expected O, but got Unknown
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: 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_03d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_040b: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0349: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: 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_043b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0440: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject($"{itemTier}QueueContainer", new Type[1] { typeof(RectTransform) });
		Transform transform = val.transform;
		RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
		((Transform)val2).SetParent((Transform)(object)parent, false);
		GameObject val3 = Object.Instantiate<GameObject>(((Component)itemInventoryDisplayPrefab).gameObject, (Transform)(object)val2, false);
		Object.DestroyImmediate((Object)(object)val3.GetComponent<ItemInventoryDisplay>());
		Object.DestroyImmediate((Object)(object)val3.GetComponent<LayoutElement>());
		Transform transform2 = val3.transform;
		Transform obj = ((transform2 is RectTransform) ? transform2 : null);
		((RectTransform)obj).anchorMin = new Vector2(0f, 1f);
		((RectTransform)obj).anchorMax = new Vector2(1f, 1f);
		((RectTransform)obj).sizeDelta = new Vector2(-60f, 50f);
		((RectTransform)obj).anchoredPosition = new Vector2(0f, -5f);
		((RectTransform)obj).pivot = new Vector2(0f, 1f);
		ButtonWrapper repeatButton = default(ButtonWrapper);
		repeatButton = CreateButton(val, (UnityAction)delegate
		{
			//IL_0001: 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)
			QueueManager.ToggleRepeat(itemTier);
			MarkButton(repeatButton, QueueManager.DoesRepeat(itemTier));
		}, "");
		RectTransform rectTransform = repeatButton.rectTransform;
		rectTransform.anchorMin = new Vector2(1f, 1f);
		rectTransform.anchorMax = new Vector2(1f, 1f);
		rectTransform.sizeDelta = new Vector2(55f, 55f);
		rectTransform.anchoredPosition = new Vector2(0f, -2.5f);
		rectTransform.pivot = new Vector2(1f, 1f);
		GameObject val4 = new GameObject($"{itemTier}RepeatButtonImageHolder", new Type[1] { typeof(RectTransform) });
		Transform transform3 = val4.transform;
		Transform obj2 = ((transform3 is RectTransform) ? transform3 : null);
		obj2.SetParent((Transform)(object)rectTransform, false);
		((RectTransform)obj2).anchorMin = new Vector2(0f, 0f);
		((RectTransform)obj2).anchorMax = new Vector2(1f, 1f);
		((RectTransform)obj2).sizeDelta = new Vector2(-15f, -15f);
		val4.AddComponent<RawImage>().texture = (Texture)(object)repeatIconTexture;
		MarkButton(repeatButton, QueueManager.DoesRepeat(itemTier));
		QueueDisplay queueDisplay = val3.AddComponent<QueueDisplay>();
		queueDisplay.itemIconPrefab = itemIconPrefab;
		queueDisplay.itemIconPrefabWidth = itemInventoryDisplayPrefab.itemIconPrefabWidth;
		queueDisplay.tier = itemTier;
		GameObject val5 = Object.Instantiate<GameObject>(commandItemContainer, (Transform)(object)val2, false);
		RectTransform itemButtonsTransform = default(RectTransform);
		ref RectTransform reference = ref itemButtonsTransform;
		Transform transform4 = val5.transform;
		reference = (RectTransform)(object)((transform4 is RectTransform) ? transform4 : null);
		GridLayoutGroup component = val5.GetComponent<GridLayoutGroup>();
		UIElementAllocator<MPButton> val6 = new UIElementAllocator<MPButton>(itemButtonsTransform, commandItemButton, true, false);
		if (ModConfig.bigItemButtonContainer.Value)
		{
			Object.Destroy((Object)(object)val5.GetComponent<RawImage>());
			component.constraint = (Constraint)0;
			component.startCorner = (Corner)0;
			component.startAxis = (Axis)0;
			((LayoutGroup)component).childAlignment = (TextAnchor)1;
			component.cellSize *= ModConfig.bigItemButtonScale.Value;
			itemButtonsTransform.anchoredPosition = new Vector2(0f, 0f);
			itemButtonsTransform.anchorMin = new Vector2(0f, 0f);
			itemButtonsTransform.anchorMax = new Vector2(1f, 1f);
			itemButtonsTransform.sizeDelta = new Vector2(0f, -55f);
			itemButtonsTransform.pivot = new Vector2(0.5f, 0f);
		}
		else
		{
			component.constraint = (Constraint)1;
			component.constraintCount = prefabPickupPickerPanel.maxColumnCount;
			((LayoutGroup)component).childAlignment = (TextAnchor)1;
			itemButtonsTransform.anchorMin = new Vector2(0.5f, 1f);
			itemButtonsTransform.anchorMax = new Vector2(0.5f, 1f);
			itemButtonsTransform.anchoredPosition = new Vector2(0f, -55f);
			itemButtonsTransform.pivot = new Vector2(0f, 1f);
			itemButtonsTransform.sizeDelta = default(Vector2);
		}
		Option[] itemOptions = (Option[])PickupPickerController_GetOptionsFromPickupIndex.Invoke(null, new object[1] { GetPickupIndexOfItemTier(itemTier) });
		if (itemOptions != null)
		{
			val6.onCreateElement = delegate(int index, MPButton button)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: 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)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Expected O, but got Unknown
				Option val7 = itemOptions[index];
				PickupDef pickupDef = PickupCatalog.GetPickupDef(val7.pickupIndex);
				Image component2 = ((Component)((Component)button).GetComponent<ChildLocator>().FindChild("Icon")).GetComponent<Image>();
				if (val7.available && pickupDef != null)
				{
					((Graphic)component2).color = Color.white;
					component2.sprite = pickupDef.iconSprite;
					((Selectable)button).interactable = true;
					PickupIndex pickupIndex = pickupDef.pickupIndex;
					((UnityEvent)((Button)button).onClick).AddListener((UnityAction)delegate
					{
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						callback(pickupIndex);
						LayoutRebuilder.MarkLayoutForRebuild(itemButtonsTransform);
					});
				}
				else
				{
					((Graphic)component2).color = Color.gray;
					component2.sprite = missingUnlockIcon;
					((Selectable)button).interactable = false;
				}
			};
			val6.AllocateElements(itemOptions.Length);
		}
		return val2;
	}

	private void DestroyUI()
	{
		foreach (GameObject uiElement in uiElements)
		{
			Object.Destroy((Object)(object)uiElement);
		}
		uiElements.Clear();
		if ((Object)(object)container != (Object)null)
		{
			RectTransform component = container.GetComponent<RectTransform>();
			ReparentChildren((Transform)(object)origContainer.GetComponent<RectTransform>(), (Transform)(object)component);
			Object.Destroy((Object)(object)container);
			Object.Destroy((Object)(object)queueContainer);
			container = null;
		}
	}

	private void RebuildUI()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Expected O, but got Unknown
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Expected O, but got Unknown
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0370: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0410: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Expected O, but got Unknown
		//IL_0470: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_0492: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ec: Expected O, but got Unknown
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Expected O, but got Unknown
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: 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_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: 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_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: 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_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		DestroyUI();
		origButtonColors = ((Selectable)commandCancelButton.GetComponent<HGButton>()).colors;
		ColorBlock val = origButtonColors;
		((ColorBlock)(ref val)).disabledColor = ((ColorBlock)(ref val)).disabledColor * selectedColorMult;
		((ColorBlock)(ref val)).pressedColor = ((ColorBlock)(ref val)).pressedColor * selectedColorMult;
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.7f, 0.55f, 0.1f, 1f);
		((ColorBlock)(ref val)).normalColor = val2;
		((ColorBlock)(ref val)).highlightedColor = val2;
		selectedButtonColors = val;
		container = new GameObject("CommandQueueScoreboardWrapper", new Type[1] { typeof(RectTransform) });
		RectTransform component = container.GetComponent<RectTransform>();
		origContainer = ((Component)scoreboard).gameObject;
		RectTransform component2 = origContainer.GetComponent<RectTransform>();
		((Transform)component).SetParent((Transform)(object)component2, false);
		component.sizeDelta = new Vector2(0f, 0f);
		component.anchorMin = new Vector2(0f, 0f);
		component.anchorMax = new Vector2(1f, 0.9f);
		ReparentChildren((Transform)(object)component, (Transform)(object)component2);
		queueContainer = new GameObject("CommandQueueContainer", new Type[1] { typeof(RectTransform) });
		Transform transform = queueContainer.transform;
		RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
		((Transform)val3).SetParent((Transform)(object)component2, false);
		CopyRectTransform(val3, component);
		Dictionary<ItemTier, string> dictionary = new Dictionary<ItemTier, string>
		{
			{
				(ItemTier)0,
				"白色"
			},
			{
				(ItemTier)1,
				"绿色"
			},
			{
				(ItemTier)2,
				"红色"
			}
		};
		ModConfig.ItemTierSet value = ModConfig.enabledTabs.Value;
		int num = 0;
		foreach (ItemTier item in value)
		{
			ItemTier tier = item;
			string text = (dictionary.ContainsKey(tier) ? dictionary[tier] : ((object)(ItemTier)(ref tier)).ToString());
			string text2 = text;
			ButtonWrapper value2 = CreateButton(queueContainer, (UnityAction)delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				SelectedQueue = tier;
			}, text2);
			value2.rectTransform.anchorMin = new Vector2((float)num / (float)value.Count, 8f / 9f);
			value2.rectTransform.anchorMax = new Vector2((float)(num + 1) / (float)value.Count, 1f);
			value2.rectTransform.anchoredPosition = default(Vector2);
			value2.rectTransform.sizeDelta = default(Vector2);
			RectTransform val4 = CreateQueueContainer(tier, val3, delegate(PickupIndex index)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				QueueManager.Enqueue(index);
			});
			val4.anchorMin = new Vector2(0f, 0f);
			val4.anchorMax = new Vector2(1f, 8f / 9f);
			val4.sizeDelta = default(Vector2);
			val4.anchoredPosition = default(Vector2);
			((Component)val4).gameObject.SetActive(false);
			queueDisplays[tier] = ((Component)val4).gameObject;
			queueButtons[tier] = value2;
			num++;
		}
		selectedQueue = value.First();
		queueDisplays[selectedQueue].SetActive(true);
		ExecuteNextFrame(delegate
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			MarkButton(queueButtons[selectedQueue], state: true);
		});
		queueContainer.SetActive(false);
		scoreboardButton = CreateButton(origContainer, null, "物品");
		scoreboardButton.rectTransform.anchoredPosition = default(Vector2);
		scoreboardButton.rectTransform.anchorMin = new Vector2(0f, 0.9f);
		scoreboardButton.rectTransform.anchorMax = new Vector2(0.333f, 1f);
		scoreboardButton.rectTransform.sizeDelta = default(Vector2);
		scoreboardButton.onClick += (UnityAction)delegate
		{
			DisplayingQueues = false;
		};
		queueButton = CreateButton(origContainer, null, "统率");
		queueButton.rectTransform.anchoredPosition = default(Vector2);
		queueButton.rectTransform.anchorMin = new Vector2(0.333f, 0.9f);
		queueButton.rectTransform.anchorMax = new Vector2(0.667f, 1f);
		queueButton.rectTransform.sizeDelta = default(Vector2);
		queueButton.onClick += (UnityAction)delegate
		{
			DisplayingQueues = true;
		};
		ExecuteNextFrame(delegate
		{
			UpdateButtonColors();
		});
	}

	public void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		if (!CommandQueue.IsLoaded)
		{
			Object.Destroy((Object)(object)this);
			return;
		}
		repeatIconTexture = new Texture2D(0, 0);
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CommandQueue.repeat-solid.png"))
		{
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			byte[] array = memoryStream.ToArray();
			ImageConversion.LoadImage(repeatIconTexture, array);
		}
		scoreboard = ((Component)this).GetComponent<ScoreboardController>();
		hud = ((Component)this).GetComponentInParent<HUD>();
		missingUnlockIcon = Resources.Load<Sprite>("Textures/MiscIcons/texUnlockIcon");
		itemInventoryDisplayPrefab = scoreboard.stripPrefab.GetComponent<ScoreboardStrip>().itemInventoryDisplay;
		itemIconPrefab = itemInventoryDisplayPrefab.itemIconPrefab;
		CommandQueue.PluginUnloaded += delegate
		{
			Object.DestroyImmediate((Object)(object)this);
		};
	}

	private void OnDestroy()
	{
		DestroyUI();
		Object.Destroy((Object)(object)repeatIconTexture);
	}

	private void OnEnable()
	{
		if ((Object)(object)container == (Object)null)
		{
			RebuildUI();
		}
	}
}

dll/LookingGlass.dll.old

Decompiled 3 days 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 System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using LeTai.Asset.TranslucentImage;
using LookingGlass.AutoSortItems;
using LookingGlass.Base;
using LookingGlass.BuffDescriptions;
using LookingGlass.BuffTimers;
using LookingGlass.CommandItemCount;
using LookingGlass.CommandWindowBlur;
using LookingGlass.DPSMeterStuff;
using LookingGlass.EquipTimerFix;
using LookingGlass.EscapeToCloseMenu;
using LookingGlass.HiddenItems;
using LookingGlass.HidePickupNotifs;
using LookingGlass.ItemCounters;
using LookingGlass.ItemStatsNameSpace;
using LookingGlass.LookingGlassLanguage;
using LookingGlass.PickupNotifsDuration;
using LookingGlass.ResizeCommandWindow;
using LookingGlass.StatsDisplay;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using RiskOfOptions;
using RiskOfOptions.Components.Options;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Items;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("DropPod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.8.5.0")]
[assembly: AssemblyInformationalVersion("1.8.5+35929566f7a6036e8e6dd5c073de73a80501d386")]
[assembly: AssemblyProduct("LookingGlass")]
[assembly: AssemblyTitle("LookingGlass")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Wet-Boys/LookingGlass")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LookingGlass
{
	[BepInPlugin("droppod.lookingglass", "LookingGlass", "1.8.5")]
	public class BasePlugin : BaseUnityPlugin
	{
		internal static BasePlugin instance;

		internal AutoSortItemsClass autoSortItems;

		internal NoWindowBlur noWindowBlur;

		internal ButtonsToCloseMenu buttonsToCloseMenu;

		internal HidePickupNotifications hidePickupNotifications;

		internal ItemStats itemStats;

		internal CommandItemCountClass commandItemCountClass;

		internal ModifyCommandWindow resizeCommandWindowClass;

		internal StatsDisplayClass statsDisplayClass;

		internal DPSMeter dpsMeter;

		internal ItemCounter itemCounter;

		internal BuffTimersClass buffTimers;

		internal CooldownFixer equipFixer;

		internal UnHiddenItems unHiddenItems;

		internal BuffDescriptionsClass buffDescriptions;

		internal PickupNotifDurationClass pickupNotifDurationClass;

		public static byte[] logo;

		public static Sprite logo2;

		public void Awake()
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			Log.Init(((BaseUnityPlugin)this).Logger);
			instance = this;
			try
			{
				string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icons");
				int num = Random.Range(0, Directory.GetFiles(path).Length);
				int num2 = 0;
				string[] files = Directory.GetFiles(path);
				foreach (string path2 in files)
				{
					if (num2 == num)
					{
						logo = File.ReadAllBytes(path2);
					}
					num2++;
				}
				Texture2D val = LoadTexture(logo, 256, 256);
				logo2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f), 100f, 1u, (SpriteMeshType)1, new Vector4(0f, 0f, 0f, 0f), true);
				ModSettingsManager.SetModIcon(logo2);
			}
			catch (Exception)
			{
			}
			autoSortItems = new AutoSortItemsClass();
			noWindowBlur = new NoWindowBlur();
			buttonsToCloseMenu = new ButtonsToCloseMenu();
			hidePickupNotifications = new HidePickupNotifications();
			commandItemCountClass = new CommandItemCountClass();
			resizeCommandWindowClass = new ModifyCommandWindow();
			statsDisplayClass = new StatsDisplayClass();
			buffTimers = new BuffTimersClass();
			dpsMeter = new DPSMeter();
			itemCounter = new ItemCounter();
			equipFixer = new CooldownFixer();
			unHiddenItems = new UnHiddenItems();
			buffDescriptions = new BuffDescriptionsClass();
			pickupNotifDurationClass = new PickupNotifDurationClass();
			((MonoBehaviour)this).StartCoroutine(CheckPlayerStats());
			((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)delegate
			{
				itemStats = new ItemStats();
			});
		}

		private void Update()
		{
			if (ButtonsToCloseMenu.buttonsToClickOnMove.Count != 0 && Input.anyKeyDown && !Input.GetMouseButtonDown(0))
			{
				ButtonsToCloseMenu.CloseMenuAfterFrame();
			}
			dpsMeter.Update();
		}

		private IEnumerator CheckPlayerStats()
		{
			yield return (object)new WaitForSeconds(StatsDisplayClass.statsDisplayUpdateInterval.Value);
			statsDisplayClass.CalculateStuff();
			((MonoBehaviour)this).StartCoroutine(CheckPlayerStats());
		}

		public static Texture2D LoadTexture(byte[] bytes, int width, int height)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			Texture2D val = new Texture2D(width, height, (TextureFormat)5, false, false);
			ImageConversion.LoadImage(val, bytes);
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	internal class Utils
	{
		public static float CalculateChanceWithNullableMaster(float baseChance, CharacterMaster master)
		{
			if (Object.op_Implicit((Object)(object)master))
			{
				return CalculateChanceWithLuck(baseChance, master.luck);
			}
			return baseChance;
		}

		public static float CalculateChanceWithLuck(float baseChance, float luckIn)
		{
			if (ItemStats.capChancePercentage.Value)
			{
				baseChance = Mathf.Min(baseChance, 1f);
			}
			float num = Mathf.Floor(baseChance);
			float num2 = baseChance % 1f;
			int num3 = Mathf.CeilToInt(luckIn);
			if (num3 > 0)
			{
				return num + (1f - Mathf.Pow(1f - num2, (float)(num3 + 1)));
			}
			if (num3 < 0)
			{
				return num + Mathf.Pow(num2, (float)(Mathf.Abs(num3) + 1));
			}
			return baseChance;
		}

		public static float GetLuckFromCachedUserBody(CharacterBody cachedUserBody)
		{
			if (Object.op_Implicit((Object)(object)cachedUserBody) && Object.op_Implicit((Object)(object)cachedUserBody.master))
			{
				return cachedUserBody.master.luck;
			}
			return cachedUserBody.inventory.GetItemCount(Items.Clover) - cachedUserBody.inventory.GetItemCount(Items.LunarBadLuck);
		}

		public static float GetExponentialRechargeTime(float baseCooldown, float extraPercent, int count)
		{
			return baseCooldown * Mathf.Pow(1f - extraPercent, (float)(count - 1));
		}

		public static float GetExponentialStacking(float basePercent, float extraPercent, int count)
		{
			return 1f - (1f - basePercent) * Mathf.Pow(1f - extraPercent, (float)(count - 1));
		}

		public static float GetHyperbolicStacking(float basePercent, float extraPercent, int count)
		{
			return 1f - 1f / (1f + basePercent + extraPercent * (float)(count - 1));
		}

		public static float GetBandolierStacking(int count)
		{
			return 1f - 1f / Mathf.Pow(1f + (float)count, 0.33f);
		}

		public static string DictToString<TKey, TValue>(Dictionary<TKey, TValue> dict)
		{
			string text = "{\n";
			foreach (KeyValuePair<TKey, TValue> item in dict)
			{
				text += $"[{item.Key}] = {item.Value}\n";
			}
			return text + "}";
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "droppod.lookingglass";

		public const string PLUGIN_NAME = "LookingGlass";

		public const string PLUGIN_VERSION = "1.8.5";
	}
}
namespace LookingGlass.StatsDisplay
{
	internal class StatsDisplayClass : BaseThing
	{
		public static ConfigEntry<bool> statsDisplay;

		public static ConfigEntry<bool> useSecondaryStatsDisplay;

		public static ConfigEntry<string> secondaryStatsDisplayString;

		public static ConfigEntry<string> statsDisplayString;

		public static ConfigEntry<float> statsDisplaySize;

		public static ConfigEntry<float> statsDisplayUpdateInterval;

		public static ConfigEntry<bool> builtInColors;

		public static ConfigEntry<bool> statsDisplayOverrideHeight;

		public static ConfigEntry<int> statsDisplayOverrideHeightValue;

		public static ConfigEntry<int> floatPrecision;

		public static Dictionary<string, Func<CharacterBody, string>> statDictionary = new Dictionary<string, Func<CharacterBody, string>>();

		internal static CharacterBody cachedUserBody = null;

		private Transform statTracker;

		private TextMeshProUGUI textComponent;

		private GameObject textComponentGameObject;

		private LayoutElement layoutElement;

		private Image cachedImage;

		private static Hook overrideHook;

		private static Hook overrideHook2;

		private bool scoreBoardOpen;

		private const string syntaxList = " \n luck \n baseDamage \n crit \n attackSpeed \n armor \n armorDamageReduction \n regen \n speed \n availableJumps \n maxJumps \n killCount \n mountainShrines \n experience \n level \n maxHealth \n maxBarrier \n barrierDecayRate \n maxShield \n acceleration \n jumpPower \n maxJumpHeight \n damage \n critMultiplier \n bleedChance \n visionDistance \n critHeal \n cursePenalty \n hasOneShotProtection \n isGlass \n canPerformBackstab \n canReceiveBackstab \n healthPercentage \n goldPortal \n msPortal \n shopPortal \n dps \n currentCombatDamage \n remainingComboDuration \n maxCombo \n maxComboThisRun \n currentCombatKills \n maxKillCombo \n maxKillComboThisRun \n critWithLuck \n bleedChanceWithLuck \n velocity \n teddyBearBlockChance \n saferSpacesCD \n instaKillChance \n voidPortal \n difficultyCoefficient \n stage";

		private bool isRiskUI;

		private float originalFontSize = -1f;

		private VerticalLayoutGroup layoutGroup;

		public StatsDisplayClass()
		{
			Setup();
			SetupRiskOfOptions();
		}

		public void Setup()
		{
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			statsDisplay = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "StatsDisplay", true, "Enables Stats Display");
			statsDisplayString = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<string>("Stats Display", "Stats Display String", "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [damage]\nCrit Chance: [critWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nDPS: [dps]\nCombo: [currentCombatDamage]\nCombo Timer: [remainingComboDuration]\nMax Combo: [maxCombo]", "String for the stats display. You can customize this with Unity Rich Text if you want, see \n https://docs.unity3d.com/Packages/[email protected]/manual/RichText.html for more info. \nAvailable syntax for the [] stuff is: \n luck \n baseDamage \n crit \n attackSpeed \n armor \n armorDamageReduction \n regen \n speed \n availableJumps \n maxJumps \n killCount \n mountainShrines \n experience \n level \n maxHealth \n maxBarrier \n barrierDecayRate \n maxShield \n acceleration \n jumpPower \n maxJumpHeight \n damage \n critMultiplier \n bleedChance \n visionDistance \n critHeal \n cursePenalty \n hasOneShotProtection \n isGlass \n canPerformBackstab \n canReceiveBackstab \n healthPercentage \n goldPortal \n msPortal \n shopPortal \n dps \n currentCombatDamage \n remainingComboDuration \n maxCombo \n maxComboThisRun \n currentCombatKills \n maxKillCombo \n maxKillComboThisRun \n critWithLuck \n bleedChanceWithLuck \n velocity \n teddyBearBlockChance \n saferSpacesCD \n instaKillChance \n voidPortal \n difficultyCoefficient \n stage");
			statsDisplaySize = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<float>("Stats Display", "StatsDisplay font size", -1f, "General font size of the stats display menu. If set to -1, will copy the font size from the objective panel");
			statsDisplayUpdateInterval = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<float>("Stats Display", "StatsDisplay update interval", 0.33f, "The interval at which stats display updates, in seconds. Lower values will increase responsiveness, but may potentially affect performance");
			builtInColors = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "Use default colors", true, "Uses the default styling for stats display syntax items.");
			builtInColors.SettingChanged += BuiltInColors_SettingChanged;
			statsDisplayOverrideHeight = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "Override Stats Display Height", false, "Sets a user-specified height for Stats Display (may be necessary if you get particularly creative with formatting)");
			statsDisplayOverrideHeightValue = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<int>("Stats Display", "Stats Display Height Value", 7, "Height, in lines of full-size text, for the Stats Display panel");
			floatPrecision = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<int>("Stats Display", "StatsDisplay Float Precision", 2, "How many decimal points will be used in floating point values");
			floatPrecision.SettingChanged += BuiltInColors_SettingChanged;
			useSecondaryStatsDisplay = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "Use Secondary StatsDisplay", false, "Will enable the use of the secondary stats display string. This will overwrite the stats display string whenever the scoreboard is held open.");
			secondaryStatsDisplayString = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<string>("Stats Display", "Secondary Stats Display String", "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [damage]\nCrit Chance: [critWithLuck]\nBleed Chance: [bleedChanceWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nMax Combo: [maxCombo]\n<size=120%>Portals:</size> \n<size=50%>Gold:[goldPortal] Shop:[shopPortal] Celestial:[msPortal] Void:[voidPortal]</size>", "Secondary string for the stats display. You can customize this with Unity Rich Text if you want, see \n https://docs.unity3d.com/Packages/[email protected]/manual/RichText.html for more info. \nAvailable syntax for the [] stuff is:  \n luck \n baseDamage \n crit \n attackSpeed \n armor \n armorDamageReduction \n regen \n speed \n availableJumps \n maxJumps \n killCount \n mountainShrines \n experience \n level \n maxHealth \n maxBarrier \n barrierDecayRate \n maxShield \n acceleration \n jumpPower \n maxJumpHeight \n damage \n critMultiplier \n bleedChance \n visionDistance \n critHeal \n cursePenalty \n hasOneShotProtection \n isGlass \n canPerformBackstab \n canReceiveBackstab \n healthPercentage \n goldPortal \n msPortal \n shopPortal \n dps \n currentCombatDamage \n remainingComboDuration \n maxCombo \n maxComboThisRun \n currentCombatKills \n maxKillCombo \n maxKillComboThisRun \n critWithLuck \n bleedChanceWithLuck \n velocity \n teddyBearBlockChance \n saferSpacesCD \n instaKillChance \n voidPortal \n difficultyCoefficient \n stage");
			StatsDisplayDefinitions.SetupDefs();
			MethodInfo? method = typeof(ScoreboardController).GetMethod("OnEnable", BindingFlags.Instance | BindingFlags.NonPublic);
			MethodInfo method2 = typeof(StatsDisplayClass).GetMethod("OnEnable", BindingFlags.Instance | BindingFlags.NonPublic);
			overrideHook = new Hook((MethodBase)method, method2, (object)this);
			MethodInfo? method3 = typeof(ScoreboardController).GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.NonPublic);
			method2 = typeof(StatsDisplayClass).GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.NonPublic);
			overrideHook2 = new Hook((MethodBase)method3, method2, (object)this);
		}

		private void OnEnable(Action<ScoreboardController> orig, ScoreboardController self)
		{
			scoreBoardOpen = true;
			CalculateStuff();
			orig(self);
		}

		private void OnDisable(Action<ScoreboardController> orig, ScoreboardController self)
		{
			scoreBoardOpen = false;
			CalculateStuff();
			orig(self);
		}

		private void BuiltInColors_SettingChanged(object sender, EventArgs e)
		{
			StatsDisplayDefinitions.SetupDefs();
		}

		public void SetupRiskOfOptions()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_0113: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(statsDisplay, new CheckBoxConfig
			{
				restartRequired = false
			}));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(statsDisplayString, new InputFieldConfig
			{
				restartRequired = false,
				lineType = (LineType)2,
				submitOn = (SubmitEnum)4,
				richText = false
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(statsDisplaySize, new SliderConfig
			{
				restartRequired = false,
				min = -1f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(builtInColors, new CheckBoxConfig
			{
				restartRequired = false
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(statsDisplayUpdateInterval, new SliderConfig
			{
				restartRequired = false,
				min = 0.01f,
				max = 1f,
				formatString = "{0:F2}s"
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(statsDisplayOverrideHeight, new CheckBoxConfig
			{
				restartRequired = false
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(statsDisplayOverrideHeightValue, new IntSliderConfig
			{
				restartRequired = false,
				min = 0,
				max = 100
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(floatPrecision, new IntSliderConfig
			{
				restartRequired = false,
				min = 0,
				max = 5
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(useSecondaryStatsDisplay, new CheckBoxConfig
			{
				restartRequired = false
			}));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(secondaryStatsDisplayString, new InputFieldConfig
			{
				restartRequired = false,
				lineType = (LineType)2,
				submitOn = (SubmitEnum)4,
				richText = false
			}));
		}

		public void CalculateStuff()
		{
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: 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_0319: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)cachedUserBody))
			{
				try
				{
					cachedUserBody = LocalUserManager.GetFirstLocalUser().cachedBody;
				}
				catch (Exception)
				{
				}
			}
			if (!statsDisplay.Value || !Object.op_Implicit((Object)(object)cachedUserBody))
			{
				return;
			}
			string text = ((useSecondaryStatsDisplay.Value && scoreBoardOpen) ? secondaryStatsDisplayString.Value : statsDisplayString.Value);
			foreach (string key in statDictionary.Keys)
			{
				text = Regex.Replace(text, "(?<!\\\\)\\[" + key + "\\]", statDictionary[key](cachedUserBody));
			}
			if (!Object.op_Implicit((Object)(object)statTracker))
			{
				VerticalLayoutGroup[] componentsInChildren = Run.instance.uiInstance.GetComponentsInChildren<VerticalLayoutGroup>();
				foreach (VerticalLayoutGroup val in componentsInChildren)
				{
					if (!(((Object)((Component)val).gameObject).name == "RightInfoBar"))
					{
						continue;
					}
					Transform val2 = ((Component)val).transform.Find("ObjectivePanel");
					GameObject val3 = (Object.op_Implicit((Object)(object)val2.Find("Label")) ? ((Component)val2.Find("Label")).gameObject : null);
					bool active = false;
					if (Object.op_Implicit((Object)(object)val3))
					{
						active = val3.activeSelf;
						val3.SetActive(true);
					}
					GameObject val4 = Object.Instantiate<GameObject>(((Component)val2).gameObject);
					val4.transform.parent = ((Component)val2.parent).transform;
					((Object)val4).name = "PlayerStats";
					if (Object.op_Implicit((Object)(object)val3))
					{
						val3.SetActive(active);
					}
					if (Object.op_Implicit((Object)(object)val4.transform.Find("StripContainer")))
					{
						Object.Destroy((Object)(object)((Component)val4.transform.Find("StripContainer")).gameObject);
					}
					if (Object.op_Implicit((Object)(object)val4.transform.Find("Minimap")))
					{
						Object.DestroyImmediate((Object)(object)((Component)val4.transform.Find("Minimap")).gameObject);
					}
					if (Object.op_Implicit((Object)(object)val4.GetComponent<HudObjectiveTargetSetter>()))
					{
						Object.Destroy((Object)(object)val4.GetComponent<HudObjectiveTargetSetter>());
					}
					if (Object.op_Implicit((Object)(object)val4.GetComponent<ObjectivePanelController>()))
					{
						Object.Destroy((Object)(object)val4.GetComponent<ObjectivePanelController>());
					}
					RectTransform component = val4.GetComponent<RectTransform>();
					layoutGroup = val4.GetComponent<VerticalLayoutGroup>();
					textComponent = val4.GetComponentInChildren<TextMeshProUGUI>();
					layoutElement = val4.GetComponentInChildren<LayoutElement>();
					if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)layoutGroup) || !Object.op_Implicit((Object)(object)textComponent) || !Object.op_Implicit((Object)(object)layoutElement))
					{
						layoutGroup = null;
						textComponent = null;
						layoutElement = null;
						Object.DestroyImmediate((Object)(object)val4);
						break;
					}
					((Transform)component).localPosition = Vector3.zero;
					((Transform)component).localEulerAngles = Vector3.zero;
					((Transform)component).localScale = Vector3.one;
					((Behaviour)layoutGroup).enabled = false;
					((Behaviour)layoutGroup).enabled = true;
					((TMP_Text)textComponent).alignment = (TextAlignmentOptions)257;
					((Graphic)textComponent).color = Color.white;
					textComponentGameObject = ((Component)textComponent).gameObject;
					if (Object.op_Implicit((Object)(object)val4.transform.Find("Seperator")))
					{
						isRiskUI = true;
						VerticalLayoutGroup component2 = ((Component)val4.transform.Find("Seperator")).GetComponent<VerticalLayoutGroup>();
						((LayoutGroup)component2).padding.top = 0;
						((LayoutGroup)component2).childAlignment = (TextAnchor)0;
					}
					statTracker = val4.transform;
					break;
				}
			}
			if (Object.op_Implicit((Object)(object)textComponentGameObject))
			{
				textComponentGameObject.SetActive(true);
			}
			if (Object.op_Implicit((Object)(object)textComponent) && Object.op_Implicit((Object)(object)layoutElement))
			{
				((TMP_Text)textComponent).text = text;
				int num = (statsDisplayOverrideHeight.Value ? statsDisplayOverrideHeightValue.Value : text.Split(new char[1] { '\n' }).Length);
				if (originalFontSize == -1f)
				{
					originalFontSize = ((TMP_Text)textComponent).fontSize;
				}
				((TMP_Text)textComponent).fontSize = ((statsDisplaySize.Value == -1f) ? originalFontSize : statsDisplaySize.Value);
				((MonoBehaviour)Run.instance).StartCoroutine(FixScaleAfterFrame(num));
				if (!Object.op_Implicit((Object)(object)cachedImage))
				{
					cachedImage = ((Component)((Component)layoutElement).transform.parent).GetComponent<Image>();
				}
				if (Object.op_Implicit((Object)(object)cachedImage))
				{
					((Behaviour)cachedImage).enabled = num != 0;
				}
				if (isRiskUI && Object.op_Implicit((Object)(object)layoutGroup))
				{
					((LayoutGroup)layoutGroup).padding.bottom = (int)((float)num / 16f * 50f);
				}
			}
			else
			{
				layoutGroup = null;
				textComponent = null;
				layoutElement = null;
				if (Object.op_Implicit((Object)(object)statTracker))
				{
					Log.Debug("Somehow statTracker [" + ((Object)((Component)statTracker).gameObject).name + "] got set but other items didn't attempting to delete it and try again.");
					Object.DestroyImmediate((Object)(object)((Component)statTracker).gameObject);
				}
			}
		}

		private IEnumerator FixScaleAfterFrame(int nlines)
		{
			yield return (object)new WaitForEndOfFrame();
			float preferredHeight = (statsDisplayOverrideHeight.Value ? (((TMP_Text)textComponent).fontSize * (float)(nlines + 1)) : ((TMP_Text)textComponent).renderedHeight);
			layoutElement.preferredHeight = preferredHeight;
		}
	}
	internal class StatsDisplayDefinitions
	{
		internal static string floatPrecision;

		internal static void SetupDefs()
		{
			string utilityString = (StatsDisplayClass.builtInColors.Value ? "<style=\"cIsUtility>" : "");
			string damageString = (StatsDisplayClass.builtInColors.Value ? "<style=\"cIsDamage>" : "");
			string healingString = (StatsDisplayClass.builtInColors.Value ? "<style=\"cIsHealing>" : "");
			string healthString = (StatsDisplayClass.builtInColors.Value ? "<style=\"cIsHealth>" : "");
			string voidString = (StatsDisplayClass.builtInColors.Value ? "<style=\"cIsVoid>" : "");
			string styleString = (StatsDisplayClass.builtInColors.Value ? "</style>" : "");
			floatPrecision = "0." + new string('#', StatsDisplayClass.floatPrecision.Value);
			StatsDisplayClass.statDictionary.Clear();
			StatsDisplayClass.statDictionary.Add("luck", (CharacterBody cachedUserBody) => utilityString + Utils.GetLuckFromCachedUserBody(cachedUserBody).ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("baseDamage", (CharacterBody cachedUserBody) => damageString + cachedUserBody.baseDamage.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("crit", (CharacterBody cachedUserBody) => damageString + cachedUserBody.crit.ToString(floatPrecision) + "%" + styleString);
			StatsDisplayClass.statDictionary.Add("attackSpeed", (CharacterBody cachedUserBody) => damageString + cachedUserBody.attackSpeed.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("armor", (CharacterBody cachedUserBody) => healingString + cachedUserBody.armor.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("armorDamageReduction", (CharacterBody cachedUserBody) => healingString + (100f - 100f * (100f / (100f + cachedUserBody.armor))).ToString(floatPrecision) + "%" + styleString);
			StatsDisplayClass.statDictionary.Add("regen", (CharacterBody cachedUserBody) => healingString + cachedUserBody.regen.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("speed", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.moveSpeed.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("availableJumps", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.characterMotor)) ? (utilityString + "N/A" + styleString) : $"{utilityString}{cachedUserBody.maxJumpCount - cachedUserBody.characterMotor.jumpCount}{styleString}");
			StatsDisplayClass.statDictionary.Add("maxJumps", (CharacterBody cachedUserBody) => $"{utilityString}{cachedUserBody.maxJumpCount}{styleString}");
			StatsDisplayClass.statDictionary.Add("killCount", (CharacterBody cachedUserBody) => $"{healthString}{cachedUserBody.killCountServer}{styleString}");
			StatsDisplayClass.statDictionary.Add("mountainShrines", (CharacterBody cachedUserBody) => string.Format("{0}{1}{2}", utilityString, (TeleporterInteraction.instance != null) ? ((object)TeleporterInteraction.instance.shrineBonusStacks) : "N/A", styleString));
			StatsDisplayClass.statDictionary.Add("experience", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.experience.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("level", (CharacterBody cachedUserBody) => $"{utilityString}{cachedUserBody.level}{styleString}");
			StatsDisplayClass.statDictionary.Add("maxHealth", (CharacterBody cachedUserBody) => $"{healthString}{cachedUserBody.maxHealth}{styleString}");
			StatsDisplayClass.statDictionary.Add("maxBarrier", (CharacterBody cachedUserBody) => $"{utilityString}{cachedUserBody.maxBarrier}{styleString}");
			StatsDisplayClass.statDictionary.Add("barrierDecayRate", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.barrierDecayRate.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("maxShield", (CharacterBody cachedUserBody) => $"{utilityString}{cachedUserBody.maxShield}{styleString}");
			StatsDisplayClass.statDictionary.Add("acceleration", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.acceleration.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("jumpPower", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.jumpPower.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("maxJumpHeight", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.maxJumpHeight.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("damage", (CharacterBody cachedUserBody) => damageString + cachedUserBody.damage.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("critMultiplier", (CharacterBody cachedUserBody) => damageString + cachedUserBody.critMultiplier.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("bleedChance", (CharacterBody cachedUserBody) => damageString + cachedUserBody.bleedChance.ToString(floatPrecision) + "%" + styleString);
			StatsDisplayClass.statDictionary.Add("visionDistance", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.visionDistance.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("critHeal", (CharacterBody cachedUserBody) => healingString + cachedUserBody.critHeal.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("cursePenalty", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.cursePenalty.ToString(floatPrecision) + styleString);
			StatsDisplayClass.statDictionary.Add("hasOneShotProtection", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.healthComponent)) ? (utilityString + "N/A" + styleString) : $"{utilityString}{cachedUserBody.oneShotProtectionFraction * cachedUserBody.healthComponent.fullCombinedHealth - cachedUserBody.healthComponent.missingCombinedHealth >= 0f}{styleString}");
			StatsDisplayClass.statDictionary.Add("isGlass", (CharacterBody cachedUserBody) => $"{utilityString}{cachedUserBody.isGlass}{styleString}");
			StatsDisplayClass.statDictionary.Add("canPerformBackstab", (CharacterBody cachedUserBody) => $"{damageString}{cachedUserBody.canPerformBackstab}{styleString}");
			StatsDisplayClass.statDictionary.Add("canReceiveBackstab", (CharacterBody cachedUserBody) => $"{damageString}{cachedUserBody.canReceiveBackstab}{styleString}");
			StatsDisplayClass.statDictionary.Add("healthPercentage", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.healthComponent)) ? (healthString + "N/A" + styleString) : (healthString + (cachedUserBody.healthComponent.combinedHealthFraction * 100f).ToString(floatPrecision) + styleString));
			StatsDisplayClass.statDictionary.Add("goldPortal", (CharacterBody cachedUserBody) => damageString + ((TeleporterInteraction.instance != null) ? TeleporterInteraction.instance.shouldAttemptToSpawnGoldshoresPortal.ToString() : "N/A") + styleString);
			StatsDisplayClass.statDictionary.Add("msPortal", (CharacterBody cachedUserBody) => utilityString + ((TeleporterInteraction.instance != null) ? TeleporterInteraction.instance.shouldAttemptToSpawnMSPortal.ToString() : "N/A") + styleString);
			StatsDisplayClass.statDictionary.Add("shopPortal", (CharacterBody cachedUserBody) => utilityString + ((TeleporterInteraction.instance != null) ? TeleporterInteraction.instance.shouldAttemptToSpawnShopPortal.ToString() : "N/A") + styleString);
			StatsDisplayClass.statDictionary.Add("voidPortal", delegate
			{
				if (TeleporterInteraction.instance == null)
				{
					return voidString + "N/A" + styleString;
				}
				PortalSpawner[] portalSpawners = TeleporterInteraction.instance.portalSpawners;
				foreach (PortalSpawner val in portalSpawners)
				{
					if (((Object)val.portalSpawnCard).name == "iscVoidPortal" && val.NetworkwillSpawn)
					{
						return voidString + "True" + styleString;
					}
				}
				return voidString + "False" + styleString;
			});
			StatsDisplayClass.statDictionary.Add("dps", (CharacterBody cachedUserBody) => $"{damageString}{(float)BasePlugin.instance.dpsMeter.damageDealtSincePeriod / 5f}{styleString}");
			StatsDisplayClass.statDictionary.Add("currentCombatDamage", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.currentCombatDamage}{styleString}");
			StatsDisplayClass.statDictionary.Add("remainingComboDuration", (CharacterBody cachedUserBody) => $"{utilityString}{(int)BasePlugin.instance.dpsMeter.timer + 1}{styleString}");
			StatsDisplayClass.statDictionary.Add("maxCombo", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.maxCombo}{styleString}");
			StatsDisplayClass.statDictionary.Add("maxComboThisRun", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.maxRunCombo}{styleString}");
			StatsDisplayClass.statDictionary.Add("currentCombatKills", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.currentCombatDamage}{styleString}");
			StatsDisplayClass.statDictionary.Add("maxKillCombo", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.maxCombo}{styleString}");
			StatsDisplayClass.statDictionary.Add("maxKillComboThisRun", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.maxRunCombo}{styleString}");
			StatsDisplayClass.statDictionary.Add("critWithLuck", delegate(CharacterBody cachedUserBody)
			{
				float num3 = Utils.CalculateChanceWithLuck(cachedUserBody.crit / 100f, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * 100f;
				return damageString + num3.ToString(floatPrecision) + "%" + styleString;
			});
			StatsDisplayClass.statDictionary.Add("bleedChanceWithLuck", delegate(CharacterBody cachedUserBody)
			{
				float num2 = Utils.CalculateChanceWithLuck(cachedUserBody.bleedChance / 100f, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * 100f;
				return damageString + num2.ToString(floatPrecision) + "%" + styleString;
			});
			StatsDisplayClass.statDictionary.Add("velocity", delegate(CharacterBody cachedUserBody)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Rigidbody component = ((Component)cachedUserBody).GetComponent<Rigidbody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					string text = utilityString;
					Vector3 velocity = component.velocity;
					return text + ((Vector3)(ref velocity)).magnitude.ToString(floatPrecision) + styleString;
				}
				return utilityString + "N/A" + styleString;
			});
			StatsDisplayClass.statDictionary.Add("teddyBearBlockChance", delegate(CharacterBody cachedUserBody)
			{
				int itemCount3 = cachedUserBody.inventory.GetItemCount(Items.Bear);
				return utilityString + (0.15f * (float)itemCount3 / (0.15f * (float)itemCount3 + 1f) * 100f).ToString(floatPrecision) + "%" + styleString;
			});
			StatsDisplayClass.statDictionary.Add("saferSpacesCD", delegate(CharacterBody cachedUserBody)
			{
				int itemCount2 = cachedUserBody.inventory.GetItemCount(Items.BearVoid);
				return (itemCount2 == 0) ? (utilityString + "N/A" + styleString) : (utilityString + (15f * Mathf.Pow(0.9f, (float)itemCount2)).ToString(floatPrecision) + styleString);
			});
			StatsDisplayClass.statDictionary.Add("instaKillChance", delegate(CharacterBody cachedUserBody)
			{
				int itemCount = cachedUserBody.inventory.GetItemCount(Items.CritGlassesVoid);
				float num = Utils.CalculateChanceWithLuck(0.005f * (float)itemCount, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * 100f;
				return damageString + num.ToString(floatPrecision) + "%" + styleString;
			});
			StatsDisplayClass.statDictionary.Add("difficultyCoefficient", (CharacterBody cachedUserBody) => $"{utilityString}{Run.instance.difficultyCoefficient}{styleString}");
			StatsDisplayClass.statDictionary.Add("stage", (CharacterBody cachedUserBody) => utilityString + Language.GetString(Stage.instance.sceneDef.nameToken) + styleString);
		}
	}
}
namespace LookingGlass.ResizeCommandWindow
{
	internal class ModifyCommandWindow : BaseThing
	{
		public static ConfigEntry<bool> resize;

		public static ConfigEntry<float> opacity;

		public ModifyCommandWindow()
		{
			Setup();
		}

		public void Setup()
		{
			resize = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Command Settings", "Resize Command Window", true, "Resizes the command window to fit modded items");
			opacity = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<float>("Command Settings", "Command Window Opacity", 50f, "Changes the Opacity of the regular command window");
			SetupRiskOfOptions();
		}

		public void SetupRiskOfOptions()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(resize, new CheckBoxConfig
			{
				restartRequired = false
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(opacity, new SliderConfig
			{
				restartRequired = false
			}));
		}

		internal void ResizeWindow(PickupPickerController controller)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0049: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			Transform val = controller.panelInstance.transform.Find("MainPanel");
			if (val != null)
			{
				Transform val2 = val.Find("Juice/BG");
				if (val2 != null)
				{
					Color color = ((Graphic)((Component)val2).GetComponent<Image>()).color;
					((Graphic)((Component)val2).GetComponent<Image>()).color = new Color(color.r, color.g, color.b, opacity.Value / 100f);
				}
			}
			if (resize.Value && ((Object)controller).name.StartsWith("CommandCube"))
			{
				GridLayoutGroup componentInChildren = ((Component)controller.panelInstance.transform).GetComponentInChildren<GridLayoutGroup>();
				int num = ((Component)componentInChildren).transform.childCount - 1;
				componentInChildren.constraint = (Constraint)2;
				if (val != null)
				{
					RectTransform component = ((Component)val).GetComponent<RectTransform>();
					int num2 = 12;
					int num3 = Mathf.CeilToInt(Mathf.Sqrt((float)num) + 2f);
					componentInChildren.constraintCount = Mathf.Min(num2, num3) - 2;
					float num4 = (float)Mathf.Min(num3, num2) * (component.sizeDelta.x / 8f);
					num3 = ((num3 <= num2) ? num3 : (num3 + 1 + num3 - num2));
					float num5 = (float)num3 * (component.sizeDelta.x / 8f);
					component.sizeDelta = new Vector2(num5, num4);
					((MonoBehaviour)Run.instance).StartCoroutine(FixColumnCountAndStuff(componentInChildren, controller));
				}
			}
		}

		public static IEnumerator FixColumnCountAndStuff(GridLayoutGroup gridLayoutGroup, PickupPickerController panel)
		{
			yield return (object)new WaitForEndOfFrame();
			int num = 1;
			float y = ((Component)((Component)gridLayoutGroup).transform.GetChild(1)).GetComponent<RectTransform>().anchoredPosition.y;
			for (int i = 2; i < ((Component)gridLayoutGroup).transform.childCount; i++)
			{
				if (((Component)((Component)gridLayoutGroup).transform.GetChild(i)).GetComponent<RectTransform>().anchoredPosition.y == y)
				{
					num++;
				}
			}
			panel.panelInstanceController.maxColumnCount = num;
			panel.panelInstanceController.SetPickupOptions(panel.options);
		}
	}
}
namespace LookingGlass.PickupNotifsDuration
{
	internal class PickupNotifDurationClass : BaseThing
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static IsDisabledDelegate <0>__NotificationsDisabled;
		}

		private static Hook overrideHook;

		public static ConfigEntry<float> notificationDuration;

		public PickupNotifDurationClass()
		{
			Setup();
			SetupRiskOfOptions();
		}

		public void Setup()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			MethodInfo? method = typeof(CharacterMasterNotificationQueue).GetMethod("PushNotification", BindingFlags.Instance | BindingFlags.NonPublic);
			MethodInfo method2 = typeof(PickupNotifDurationClass).GetMethod("PushNotification", BindingFlags.Instance | BindingFlags.NonPublic);
			overrideHook = new Hook((MethodBase)method, method2, (object)this);
			notificationDuration = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<float>("Misc", "Pickup Notifications Duration", 6f, "Duration of pickup notifications. 6s is the vanilla duration");
		}

		public void SetupRiskOfOptions()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0058: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			ConfigEntry<float> obj = notificationDuration;
			SliderConfig val = new SliderConfig
			{
				restartRequired = false,
				min = 0.01f,
				max = 24f,
				formatString = "{0:F1}s"
			};
			object obj2 = <>O.<0>__NotificationsDisabled;
			if (obj2 == null)
			{
				IsDisabledDelegate val2 = NotificationsDisabled;
				<>O.<0>__NotificationsDisabled = val2;
				obj2 = (object)val2;
			}
			((BaseOptionConfig)val).checkIfDisabled = (IsDisabledDelegate)obj2;
			ModSettingsManager.AddOption((BaseOption)new SliderOption(obj, val));
		}

		private static bool NotificationsDisabled()
		{
			return HidePickupNotifications.disablePickupNotifications.Value;
		}

		private void PushNotification(Action<CharacterMasterNotificationQueue, NotificationInfo, float> orig, CharacterMasterNotificationQueue self, NotificationInfo info, float duration)
		{
			duration = notificationDuration.Value;
			orig(self, info, duration);
		}
	}
}
namespace LookingGlass.LookingGlassLanguage
{
	public static class LookingGlassLanguageAPI
	{
		public static void SetupToken(Language language, string token, string value)
		{
			language.stringsByToken["LG_TOKEN_" + token] = value;
		}
	}
}
namespace LookingGlass.ItemStatsNameSpace
{
	internal class ItemCooldownReduction
	{
		private static readonly Dictionary<int, int> SkillCooldownReduction;

		private static readonly Dictionary<int, int> SkillReductionValueIndex;

		public static int GetItemTargetSkill(int itemIndex)
		{
			if (!SkillCooldownReduction.TryGetValue(itemIndex, out var value))
			{
				return 0;
			}
			return value;
		}

		public static int GetReductionValueIndex(int itemIndex)
		{
			if (!SkillReductionValueIndex.TryGetValue(itemIndex, out var value))
			{
				return 0;
			}
			return value;
		}

		public static bool hasSkillCooldown(int itemIndex)
		{
			return SkillCooldownReduction.ContainsKey(itemIndex);
		}

		static ItemCooldownReduction()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected I4, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected I4, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected I4, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected I4, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected I4, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected I4, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected I4, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected I4, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected I4, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected I4, but got Unknown
			SkillCooldownReduction = new Dictionary<int, int>();
			SkillReductionValueIndex = new Dictionary<int, int>();
			SkillCooldownReduction.Add((int)Items.AlienHead.itemIndex, -1);
			SkillReductionValueIndex.Add((int)Items.AlienHead.itemIndex, 0);
			SkillCooldownReduction.Add((int)Items.UtilitySkillMagazine.itemIndex, 2);
			SkillReductionValueIndex.Add((int)Items.UtilitySkillMagazine.itemIndex, -1);
			SkillCooldownReduction.Add((int)Items.HalfAttackSpeedHalfCooldowns.itemIndex, -1);
			SkillReductionValueIndex.Add((int)Items.HalfAttackSpeedHalfCooldowns.itemIndex, 0);
			SkillCooldownReduction.Add((int)Items.LunarBadLuck.itemIndex, -1);
			SkillReductionValueIndex.Add((int)Items.LunarBadLuck.itemIndex, 0);
			SkillCooldownReduction.Add((int)Items.EquipmentMagazineVoid.itemIndex, 3);
			SkillReductionValueIndex.Add((int)Items.EquipmentMagazineVoid.itemIndex, -1);
		}
	}
	public class ItemDefinitions
	{
		public static Dictionary<int, ItemStatsDef> allItemDefinitions = new Dictionary<int, ItemStatsDef>();

		public static void RegisterItemStatsDef(ItemStatsDef itemStatsDef, ItemIndex itemIndex)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected I4, but got Unknown
			allItemDefinitions.Add((int)itemIndex, itemStatsDef);
		}

		internal static void RegisterAll()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected I4, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected I4, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected I4, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected I4, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected I4, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Expected I4, but got Unknown
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Expected I4, but got Unknown
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Expected I4, but got Unknown
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Expected I4, but got Unknown
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Expected I4, but got Unknown
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Expected I4, but got Unknown
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Expected I4, but got Unknown
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Expected I4, but got Unknown
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Expected I4, but got Unknown
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Expected I4, but got Unknown
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_0720: Expected I4, but got Unknown
			//IL_077e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Expected I4, but got Unknown
			//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Expected I4, but got Unknown
			//IL_084e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0859: Expected I4, but got Unknown
			//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c1: Expected I4, but got Unknown
			//IL_091f: Unknown result type (might be due to invalid IL or missing references)
			//IL_092a: Expected I4, but got Unknown
			//IL_0988: Unknown result type (might be due to invalid IL or missing references)
			//IL_0993: Expected I4, but got Unknown
			//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fb: Expected I4, but got Unknown
			//IL_0a58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Expected I4, but got Unknown
			//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad2: Expected I4, but got Unknown
			//IL_0b3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b48: Expected I4, but got Unknown
			//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb0: Expected I4, but got Unknown
			//IL_0c14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1f: Expected I4, but got Unknown
			//IL_0c7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c87: Expected I4, but got Unknown
			//IL_0d1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d25: Expected I4, but got Unknown
			//IL_0d82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d8d: Expected I4, but got Unknown
			//IL_0dea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df5: Expected I4, but got Unknown
			//IL_0e52: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5d: Expected I4, but got Unknown
			//IL_0eba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec5: Expected I4, but got Unknown
			//IL_0f4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f55: Expected I4, but got Unknown
			//IL_0fb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbd: Expected I4, but got Unknown
			//IL_101a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1025: Expected I4, but got Unknown
			//IL_1082: Unknown result type (might be due to invalid IL or missing references)
			//IL_108d: Expected I4, but got Unknown
			//IL_10ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f5: Expected I4, but got Unknown
			//IL_1152: Unknown result type (might be due to invalid IL or missing references)
			//IL_115d: Expected I4, but got Unknown
			//IL_11e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ed: Expected I4, but got Unknown
			//IL_124a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1255: Expected I4, but got Unknown
			//IL_12b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_12bd: Expected I4, but got Unknown
			//IL_131a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1325: Expected I4, but got Unknown
			//IL_1382: Unknown result type (might be due to invalid IL or missing references)
			//IL_138d: Expected I4, but got Unknown
			//IL_13ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_13f5: Expected I4, but got Unknown
			//IL_1452: Unknown result type (might be due to invalid IL or missing references)
			//IL_145d: Expected I4, but got Unknown
			//IL_14e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_14ed: Expected I4, but got Unknown
			//IL_154a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1555: Expected I4, but got Unknown
			//IL_15b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_15bd: Expected I4, but got Unknown
			//IL_161b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1626: Expected I4, but got Unknown
			//IL_16ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_16b6: Expected I4, but got Unknown
			//IL_1763: Unknown result type (might be due to invalid IL or missing references)
			//IL_176e: Expected I4, but got Unknown
			//IL_17f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_17fe: Expected I4, but got Unknown
			//IL_185b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1866: Expected I4, but got Unknown
			//IL_1921: Unknown result type (might be due to invalid IL or missing references)
			//IL_192c: Expected I4, but got Unknown
			//IL_1989: Unknown result type (might be due to invalid IL or missing references)
			//IL_1994: Expected I4, but got Unknown
			//IL_19f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_19fc: Expected I4, but got Unknown
			//IL_1a81: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a8c: Expected I4, but got Unknown
			//IL_1ae9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1af4: Expected I4, but got Unknown
			//IL_1b51: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b5c: Expected I4, but got Unknown
			//IL_1bb9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bc4: Expected I4, but got Unknown
			//IL_1c21: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c2c: Expected I4, but got Unknown
			//IL_1c89: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c94: Expected I4, but got Unknown
			//IL_1cf1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cfc: Expected I4, but got Unknown
			//IL_1d59: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d64: Expected I4, but got Unknown
			//IL_1dc1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1dcc: Expected I4, but got Unknown
			//IL_1e29: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e34: Expected I4, but got Unknown
			//IL_1e91: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e9c: Expected I4, but got Unknown
			//IL_1ef9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f04: Expected I4, but got Unknown
			//IL_1f61: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f6c: Expected I4, but got Unknown
			//IL_1ff1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ffc: Expected I4, but got Unknown
			//IL_2059: Unknown result type (might be due to invalid IL or missing references)
			//IL_2064: Expected I4, but got Unknown
			//IL_20c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_20cc: Expected I4, but got Unknown
			//IL_2129: Unknown result type (might be due to invalid IL or missing references)
			//IL_2134: Expected I4, but got Unknown
			//IL_2191: Unknown result type (might be due to invalid IL or missing references)
			//IL_219c: Expected I4, but got Unknown
			//IL_21f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_2204: Expected I4, but got Unknown
			//IL_2261: Unknown result type (might be due to invalid IL or missing references)
			//IL_226c: Expected I4, but got Unknown
			//IL_22f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_22fc: Expected I4, but got Unknown
			//IL_2388: Unknown result type (might be due to invalid IL or missing references)
			//IL_2393: Expected I4, but got Unknown
			//IL_23f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_23fb: Expected I4, but got Unknown
			//IL_2458: Unknown result type (might be due to invalid IL or missing references)
			//IL_2463: Expected I4, but got Unknown
			//IL_24c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_24cb: Expected I4, but got Unknown
			//IL_2528: Unknown result type (might be due to invalid IL or missing references)
			//IL_2533: Expected I4, but got Unknown
			//IL_2590: Unknown result type (might be due to invalid IL or missing references)
			//IL_259b: Expected I4, but got Unknown
			//IL_25f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_2603: Expected I4, but got Unknown
			//IL_2696: Unknown result type (might be due to invalid IL or missing references)
			//IL_26a1: Expected I4, but got Unknown
			//IL_26fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_2709: Expected I4, but got Unknown
			//IL_2766: Unknown result type (might be due to invalid IL or missing references)
			//IL_2771: Expected I4, but got Unknown
			//IL_27ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_27d9: Expected I4, but got Unknown
			//IL_285e: Unknown result type (might be due to invalid IL or missing references)
			//IL_2869: Expected I4, but got Unknown
			//IL_28c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_28d1: Expected I4, but got Unknown
			//IL_292e: Unknown result type (might be due to invalid IL or missing references)
			//IL_2939: Expected I4, but got Unknown
			//IL_2996: Unknown result type (might be due to invalid IL or missing references)
			//IL_29a1: Expected I4, but got Unknown
			//IL_2a34: Unknown result type (might be due to invalid IL or missing references)
			//IL_2a3f: Expected I4, but got Unknown
			//IL_2a9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2aa7: Expected I4, but got Unknown
			//IL_2b04: Unknown result type (might be due to invalid IL or missing references)
			//IL_2b0f: Expected I4, but got Unknown
			//IL_2b6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2b77: Expected I4, but got Unknown
			//IL_2bfc: Unknown result type (might be due to invalid IL or missing references)
			//IL_2c07: Expected I4, but got Unknown
			//IL_2c8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2c97: Expected I4, but got Unknown
			//IL_2cf4: Unknown result type (might be due to invalid IL or missing references)
			//IL_2cff: Expected I4, but got Unknown
			//IL_2d85: Unknown result type (might be due to invalid IL or missing references)
			//IL_2d90: Expected I4, but got Unknown
			//IL_2e15: Unknown result type (might be due to invalid IL or missing references)
			//IL_2e20: Expected I4, but got Unknown
			//IL_2e7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_2e88: Expected I4, but got Unknown
			//IL_2f0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_2f18: Expected I4, but got Unknown
			//IL_2f9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_2fa8: Expected I4, but got Unknown
			//IL_3005: Unknown result type (might be due to invalid IL or missing references)
			//IL_3010: Expected I4, but got Unknown
			//IL_3095: Unknown result type (might be due to invalid IL or missing references)
			//IL_30a0: Expected I4, but got Unknown
			//IL_30fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_3108: Expected I4, but got Unknown
			//IL_318d: Unknown result type (might be due to invalid IL or missing references)
			//IL_3198: Expected I4, but got Unknown
			//IL_321d: Unknown result type (might be due to invalid IL or missing references)
			//IL_3228: Expected I4, but got Unknown
			//IL_3285: Unknown result type (might be due to invalid IL or missing references)
			//IL_3290: Expected I4, but got Unknown
			//IL_3316: Unknown result type (might be due to invalid IL or missing references)
			//IL_3321: Expected I4, but got Unknown
			//IL_33a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_33b1: Expected I4, but got Unknown
			//IL_3436: Unknown result type (might be due to invalid IL or missing references)
			//IL_3441: Expected I4, but got Unknown
			//IL_34c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_34d1: Expected I4, but got Unknown
			//IL_352e: Unknown result type (might be due to invalid IL or missing references)
			//IL_3539: Expected I4, but got Unknown
			//IL_35be: Unknown result type (might be due to invalid IL or missing references)
			//IL_35c9: Expected I4, but got Unknown
			//IL_3626: Unknown result type (might be due to invalid IL or missing references)
			//IL_3631: Expected I4, but got Unknown
			//IL_368e: Unknown result type (might be due to invalid IL or missing references)
			//IL_3699: Expected I4, but got Unknown
			//IL_36fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_3708: Expected I4, but got Unknown
			//IL_3765: Unknown result type (might be due to invalid IL or missing references)
			//IL_3770: Expected I4, but got Unknown
			//IL_37d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_37df: Expected I4, but got Unknown
			//IL_3864: Unknown result type (might be due to invalid IL or missing references)
			//IL_386f: Expected I4, but got Unknown
			//IL_38cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_38d7: Expected I4, but got Unknown
			//IL_3934: Unknown result type (might be due to invalid IL or missing references)
			//IL_393f: Expected I4, but got Unknown
			//IL_39d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_39dd: Expected I4, but got Unknown
			//IL_3a41: Unknown result type (might be due to invalid IL or missing references)
			//IL_3a4c: Expected I4, but got Unknown
			//IL_3aa9: Unknown result type (might be due to invalid IL or missing references)
			//IL_3ab4: Expected I4, but got Unknown
			//IL_3b47: Unknown result type (might be due to invalid IL or missing references)
			//IL_3b52: Expected I4, but got Unknown
			//IL_3bd7: Unknown result type (might be due to invalid IL or missing references)
			//IL_3be2: Expected I4, but got Unknown
			//IL_3c3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_3c4a: Expected I4, but got Unknown
			ItemStatsDef itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("阻挡几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.GetHyperbolicStacking(0.15f, 0.15f, stackCount) };
			allItemDefinitions.Add((int)Items.Bear.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.2f * (float)stackCount };
			allItemDefinitions.Add((int)Items.BossDamageBonus.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("技能充能:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.SecondarySkillMagazine.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外生命值:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Health);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.FlatHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 25 * stackCount };
			allItemDefinitions.Add((int)Items.FlatHealth.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("烟花:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 4 + 4 * stackCount };
			allItemDefinitions.Add((int)Items.Firework.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("治疗:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.PercentHealing);
			itemStatsDef.descriptions.Add("半径:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				0.0225f + 0.0225f * (float)stackCount,
				1.5f + 1.5f * (float)stackCount
			};
			allItemDefinitions.Add((int)Items.Mushroom.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("治疗:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.FlatHealing);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 3f * (float)stackCount };
			allItemDefinitions.Add((int)Items.HealWhileSafe.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.75f * (float)stackCount };
			allItemDefinitions.Add((int)Items.Crowbar.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.2f * (float)stackCount };
			allItemDefinitions.Add((int)Items.FragileDamageBonus.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外冲刺:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.25f * (float)stackCount };
			allItemDefinitions.Add((int)Items.SprintBonus.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.2f * (float)stackCount };
			allItemDefinitions.Add((int)Items.NearbyDamageBonus.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("总伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.descriptions.Add("燃烧持续:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.descriptions.Add("半径:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				2.25f + 0.75f * (float)stackCount,
				1.5f + 1.5f * (float)stackCount,
				8f + 4f * (float)stackCount
			};
			allItemDefinitions.Add((int)Items.IgniteOnKill.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("暴击率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.CalculateChanceWithLuck(0.1f * (float)stackCount, luck) };
			allItemDefinitions.Add((int)Items.CritGlasses.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("治疗:<style=cIsHealing>20</style> + ");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.PercentHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.05f * (float)stackCount };
			allItemDefinitions.Add((int)Items.Medkit.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("攻速:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.descriptions.Add("移速:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				0.075f * (float)stackCount,
				0.07f * (float)stackCount
			};
			allItemDefinitions.Add((int)Items.AttackSpeedAndMoveSpeed.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("治疗:<style=cIsHealing>8</style> + ");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.PercentHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.02f * (float)stackCount };
			allItemDefinitions.Add((int)Items.Tooth.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外护甲:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Armor);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 100f * (float)stackCount };
			allItemDefinitions.Add((int)Items.OutOfCombatArmor.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("移速:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.14f * (float)stackCount };
			allItemDefinitions.Add((int)Items.Hoof.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("护盾强度:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.PercentHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.08f * (float)stackCount };
			allItemDefinitions.Add((int)Items.PersonalShield.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("充能:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.HealingPotion.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("伤害减免:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Armor);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 5 * stackCount };
			allItemDefinitions.Add((int)Items.ArmorPlate.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("金币:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Gold);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { (float)(3 * stackCount) * Run.instance.difficultyCoefficient };
			allItemDefinitions.Add((int)Items.GoldOnHurt.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("充能:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.TreasureCache.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("攻速:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.15f * (float)stackCount };
			allItemDefinitions.Add((int)Items.Syringe.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("导弹几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.hasChance = true;
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.CalculateChanceWithLuck(0.05f * (float)stackCount * procChance, luck) };
			allItemDefinitions.Add((int)Items.StickyBomb.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("眩晕几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.hasChance = true;
			itemStatsDef.chanceScaling = ItemStatsDef.ChanceScaling.Hyperbolic;
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.CalculateChanceWithLuck(Utils.GetHyperbolicStacking(0.05f, 0.05f, stackCount) * procChance, luck) };
			allItemDefinitions.Add((int)Items.StunChanceOnHit.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("击杀屏障:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.FlatHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 15 * stackCount };
			allItemDefinitions.Add((int)Items.BarrierOnKill.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("流血几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.hasChance = true;
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.CalculateChanceWithLuck(0.1f * (float)stackCount * procChance, luck) };
			allItemDefinitions.Add((int)Items.BleedOnHit.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("效果半径:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 8 + 8 * stackCount };
			allItemDefinitions.Add((int)Items.WardOnLevel.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("点燃几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.descriptions.Add("伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.hasChance = true;
			itemStatsDef.chanceScaling = ItemStatsDef.ChanceScaling.DoesNotScale;
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				Utils.CalculateChanceWithLuck(0.1f * procChance, luck),
				3f * (float)stackCount
			};
			allItemDefinitions.Add((int)Items.Missile.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("掉率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.GetBandolierStacking(stackCount) };
			allItemDefinitions.Add((int)Items.Bandolier.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("增益持续:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Seconds);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 2 + 4 * stackCount };
			allItemDefinitions.Add((int)Items.WarCryOnMultiKill.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("减缓持续:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Seconds);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 2 * stackCount };
			allItemDefinitions.Add((int)Items.SlowOnHit.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("标记持续:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Seconds);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 7 * stackCount };
			allItemDefinitions.Add((int)Items.DeathMark.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外充能:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.descriptions.Add("冷却减少:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				stackCount,
				Utils.GetExponentialStacking(0.15f, 0.15f, stackCount)
			};
			allItemDefinitions.Add((int)Items.EquipmentMagazine.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("掉率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.CalculateChanceWithLuck(0.04f * (float)stackCount, luck) };
			allItemDefinitions.Add((int)Items.BonusGoldPackOnKill.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("治疗:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.FlatHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 4 + 4 * stackCount };
			allItemDefinitions.Add((int)Items.HealOnCrit.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外跳跃:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.Feather.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("增益持续:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Seconds);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.5f + 0.5f * (float)stackCount };
			allItemDefinitions.Add((int)Items.MoveSpeedOnKill.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 3 * stackCount };
			allItemDefinitions.Add((int)Items.StrengthenBurn.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("击杀时生命值:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Health);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.FlatHealth);
			itemStatsDef.descriptions.Add("最大生命值:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Health);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.FlatHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				stackCount,
				100 * stackCount
			};
			allItemDefinitions.Add((int)Items.Infusion.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("总伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 3 * stackCount };
			allItemDefinitions.Add((int)Items.FireRing.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("攻击时治疗:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.FlatHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.Seed.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("治疗新星:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.TPHealingNova.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("临界值:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Health);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.PercentHealth);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.GetHyperbolicStacking(0.13f, 0.13f, stackCount) };
			allItemDefinitions.Add((int)Items.ExecuteLowHealthElite.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("充能时间:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Seconds);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { Utils.GetExponentialRechargeTime(30f, 0.5f, stackCount) };
			allItemDefinitions.Add((int)Items.Phasing.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("最大攻速:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.12f + 0.24f * (float)stackCount };
			allItemDefinitions.Add((int)Items.AttackSpeedOnCrit.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("目标:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.descriptions.Add("半径:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				3 + 2 * stackCount,
				15 + 10 * stackCount
			};
			allItemDefinitions.Add((int)Items.Thorns.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外速度:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 0.3f * (float)stackCount };
			allItemDefinitions.Add((int)Items.SprintOutOfCombat.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("充能:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)ItemCatalog.FindItemIndex("废料再生"), itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("额外护甲:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Armor);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 30 * stackCount };
			allItemDefinitions.Add((int)Items.SprintArmor.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("减缓持续:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Seconds);
			itemStatsDef.descriptions.Add("总伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				(float)stackCount * 3f,
				(float)stackCount * 2.5f
			};
			allItemDefinitions.Add((int)Items.IceRing.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("白装几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.descriptions.Add("绿装几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Healing);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.descriptions.Add("红装几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = delegate(float luck, int stackCount, float procChance)
			{
				List<float> list = new List<float>();
				float num = 0.79f;
				float num2 = 0.2f * (float)stackCount;
				float num3 = 0.01f * Mathf.Pow((float)stackCount, 2f);
				float num4 = num + num2 + num3;
				list.Add(num / num4);
				list.Add(num2 / num4);
				list.Add(num3 / num4);
				return list;
			};
			allItemDefinitions.Add((int)Items.FreeChest.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.descriptions.Add("最大手里剑:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				3 + stackCount,
				2 + stackCount
			};
			allItemDefinitions.Add((int)Items.PrimarySkillShuriken.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("攻速:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.Squid.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("触发几率:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.descriptions.Add("最大目标:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.descriptions.Add("锁链距离:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.hasChance = true;
			itemStatsDef.chanceScaling = ItemStatsDef.ChanceScaling.DoesNotScale;
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				Utils.CalculateChanceWithLuck(0.25f * procChance, luck),
				1 + 2 * stackCount,
				18 + 2 * stackCount
			};
			allItemDefinitions.Add((int)Items.ChainLightning.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("增益持续:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Seconds);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 4 + 4 * stackCount };
			allItemDefinitions.Add((int)Items.EnergizedOnEquipmentUse.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("跳跃高度:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { 10 * stackCount };
			allItemDefinitions.Add((int)Items.JumpBoost.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("半径:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Meters);
			itemStatsDef.descriptions.Add("柱子伤害:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Damage);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Percentage);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float>
			{
				9.6f + 2.4f * (float)stackCount,
				0.7f + 2.8f * (float)stackCount
			};
			allItemDefinitions.Add((int)Items.ExplodeOnDeath.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStatsDef();
			itemStatsDef.descriptions.Add("幸运:");
			itemStatsDef.valueTypes.Add(ItemStatsDef.ValueType.Utility);
			itemStatsDef.measurementUnits.Add(ItemStatsDef.MeasurementUnits.Number);
			itemStatsDef.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { stackCount };
			allItemDefinitions.Add((int)Items.Clover.itemIndex, itemStatsDef);
			itemStatsDef = new ItemStat

dll/MercBuff.dll.old

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MercBuff
{
	[BepInPlugin("com.Nuxlar.MercBuff", "MercBuff", "1.0.1")]
	public class MercBuff : BaseUnityPlugin
	{
		private GameObject merc = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercBody.prefab").WaitForCompletion();

		public void Awake()
		{
			ChangeEntityStateValue("RoR2/Base/Merc/EntityStates.Merc.Evis.asset", "伤害系数", "2.3");
			ChangeEntityStateValue("RoR2/Base/Merc/EntityStates.Merc.Assaulter2.asset", "伤害系数", "4");
			SkillLocator component = merc.GetComponent<SkillLocator>();
			component.utility.skillFamily.variants[0].skillDef.skillDescriptionToken = "<style=cIsDamage>眩晕</style>。向前冲锋并造成<style=cIsDamage>400%的伤害</style>。只要命中敌人,<style=cIsDamage>就可以再次发起冲锋</style>,最多<style=cIsDamage>3</style>次。";
			component.special.skillFamily.variants[0].skillDef.skillDescriptionToken = "瞄准距离最近的敌人,攻击被瞄准的敌人可对其重复造成<style=cIsDamage>230%的伤害</style>。<style=cIsUtility>过程中无法被攻击</style>。";
		}

		private void ChangeEntityStateValue(string entityStateConfiguration, string fieldName, string newValue)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)entityStateConfiguration).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = newValue;
				}
			}
		}
	}
}

dll/NemesisSpikestrip.dll.old

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GrooveSaladSpikestripContent;
using GrooveSaladSpikestripContent.Content;
using GrooveUnsharedUtils;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using NemesisSpikestrip.Changes;
using On.RoR2;
using On.RoR2.UI;
using PlasmaCoreSpikestripContent.Content.Elites;
using R2API;
using RoR2;
using TPDespair.ZetAspects;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NemesisSpikestrip
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("prodzpod.NemesisSpikestrip", "NemesisSpikestrip", "1.0.3")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "prodzpod.NemesisSpikestrip";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "NemesisSpikestrip";

		public const string PluginVersion = "1.0.3";

		public static ManualLogSource Log;

		public static PluginInfo pluginInfo;

		public static Harmony Harmony;

		public static ConfigFile Config;

		public static Dictionary<string, string> SuperOverrides = new Dictionary<string, string>();

		public void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("prodzpod.NemesisSpikestrip");
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.NemesisSpikestrip.cfg"), true);
			Plated.Init();
			Warped.Init();
			Veiled.Init();
			Aragonite.Init();
			if (Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetAspects"))
			{
				Log.LogDebug((object)"ZetAspect compat loaded :3");
				Harmony.PatchAll(typeof(PatchSuperOverrides));
			}
		}

		public static bool IsEnabled(SpikestripContentBase initialContent)
		{
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.groovesalad.GrooveSaladSpikestripContent"].Instance;
			Base val = (Base)(object)((instance is Base) ? instance : null);
			bool flag = initialContent.IsEnabled && ((((object)initialContent).GetType().Assembly == typeof(Base).Assembly) ? Main.SpikestripContentLegacyConfig.Bind<bool>("Legacy " + val.SafeForConfig(initialContent.ConfigSection), "Enable " + val.SafeForConfig(initialContent.ConfigName), false, "Enable/Disable : " + val.SafeForConfig(initialContent.ConfigName)).Value : Base.SpikestripContentConfig.Bind<bool>(val.SafeForConfig(initialContent.ConfigSection), "Enable " + val.SafeForConfig(initialContent.ConfigName), true, "Enable/Disable : " + val.SafeForConfig(initialContent.ConfigName)).Value);
			Log.LogDebug((object)(((object)initialContent).GetType().Name + ": " + (flag ? "Loaded" : "Disabled")));
			return flag;
		}
	}
	[HarmonyPatch(typeof(Language), "TextFragment")]
	public class PatchSuperOverrides
	{
		public static bool Prefix(string key, ref string __result)
		{
			if (Main.SuperOverrides.ContainsKey(key))
			{
				__result = Main.SuperOverrides[key];
				return false;
			}
			return true;
		}
	}
}
namespace NemesisSpikestrip.Changes
{
	public class Aragonite
	{
		[HarmonyPatch(typeof(RageAffixBuffBehaviourServer), "OnTakeDamageServer")]
		public class PatchIgnoreDrone
		{
			public static bool Prefix(DamageReport damageReport)
			{
				object obj;
				if (damageReport == null)
				{
					obj = null;
				}
				else
				{
					DamageInfo damageInfo = damageReport.damageInfo;
					if (damageInfo == null)
					{
						obj = null;
					}
					else
					{
						GameObject attacker = damageInfo.attacker;
						if (attacker == null)
						{
							obj = null;
						}
						else
						{
							CharacterBody component = attacker.GetComponent<CharacterBody>();
							if (component == null)
							{
								obj = null;
							}
							else
							{
								CharacterMaster master = component.master;
								if (master == null)
								{
									obj = null;
								}
								else
								{
									MinionOwnership minionOwnership = master.minionOwnership;
									obj = ((minionOwnership != null) ? minionOwnership.ownerMaster : null);
								}
							}
						}
					}
				}
				CharacterMaster val = (CharacterMaster)obj;
				return val == null || !Object.op_Implicit((Object)(object)val);
			}
		}

		[HarmonyPatch(typeof(RageAffixBuffBehaviourServer), "OnKilledServer")]
		public class PatchIgnoreDrone2
		{
			public static bool Prefix(DamageReport damageReport)
			{
				CharacterMaster attackerMaster = damageReport.attackerMaster;
				object obj;
				if (attackerMaster == null)
				{
					obj = null;
				}
				else
				{
					MinionOwnership minionOwnership = attackerMaster.minionOwnership;
					obj = ((minionOwnership != null) ? minionOwnership.ownerMaster : null);
				}
				CharacterMaster val = (CharacterMaster)obj;
				if (val != null && Object.op_Implicit((Object)(object)val))
				{
					return false;
				}
				return true;
			}
		}

		public static bool enabled;

		public static ConfigEntry<bool> IgnoreDrone;

		public static void Init()
		{
			enabled = Main.Config.Bind<bool>("Aragonite", "Enabled", true, "").Value;
			IgnoreDrone = Main.Config.Bind<bool>("Aragonite", "Ignore Followers", true, "Hitting followers such as drones does not trigger the special attack");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Aragonite".ToUpper() + "_DESCRIPTION", "命中时,释放出一股<style=cIsDamage>致命波浪</style>,造成<style=cIsDamage>500%</style>基础伤害。");
			if (enabled && Main.IsEnabled((SpikestripContentBase)(object)SpikestripContentBase<RagingElite>.instance))
			{
				LanguageAPI.AddOverlay("EQUIPMENT_AFFIXARAGONITE_NAME", "沉默的怒火");
				Main.SuperOverrides.Add("AFFIX_ARAGONITE_NAME", "沉默的怒火");
				if (IgnoreDrone.Value)
				{
					Main.Harmony.PatchAll(typeof(PatchIgnoreDrone));
					Main.Harmony.PatchAll(typeof(PatchIgnoreDrone2));
				}
			}
		}
	}
	public class Plated
	{
		[HarmonyPatch(typeof(PlatedAffixBuffBehaviour), "OnTakeDamageServer")]
		public class PatchHits
		{
			public static bool Prefix()
			{
				return false;
			}
		}

		[HarmonyPatch(typeof(PlatedAffixBuffBehaviour), "OnIncomingDamageServer")]
		public class PatchHits2
		{
			public static bool Prefix()
			{
				return false;
			}
		}

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

			public static hook_TakeDamage <>9__9_0;

			public static StatHookEventHandler <>9__9_1;

			public static hook_OnCharacterDeath <>9__9_2;

			public static StatHookEventHandler <>9__9_3;

			internal void <Init>b__9_0(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: 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_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Expected O, but got Unknown
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody val = self?.body;
				if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && (Object)(object)val != (Object)null && val.HasBuff(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
				{
					if (val.HasBuff(Stack))
					{
						damageInfo.rejected = true;
						EffectData val2 = new EffectData
						{
							origin = damageInfo.position,
							rotation = Util.QuaternionSafeLookRotation((damageInfo.force != Vector3.zero) ? damageInfo.force : Random.onUnitSphere)
						};
						EffectManager.SpawnEffect(newPlatedBlockEffectPrefab, val2, true);
						val.AddBuff(Stack);
						if (val.GetBuffCount(Stack) >= Hits.Value)
						{
							val.SetBuffCount(Stack.buffIndex, 0);
						}
					}
					else
					{
						val.AddBuff(Stack);
					}
				}
				orig.Invoke(self, damageInfo);
			}

			internal void <Init>b__9_1(CharacterBody self, StatHookEventArgs args)
			{
				if (self.HasBuff(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
				{
					args.healthMultAdd += MaxHPPenalty.Value - 1f;
				}
			}

			internal void <Init>b__9_2(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Expected O, but got Unknown
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass9_0 CS$<>8__locals0 = new <>c__DisplayClass9_0
				{
					damageReport = damageReport
				};
				orig.Invoke(self, CS$<>8__locals0.damageReport);
				CharacterBody victimBody = CS$<>8__locals0.damageReport.victimBody;
				if (victimBody == null || !victimBody.HasBuff(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
				{
					return;
				}
				SphereSearch val = new SphereSearch
				{
					radius = OnDeathRange.Value + CS$<>8__locals0.damageReport.victimBody.radius,
					queryTriggerInteraction = (QueryTriggerInteraction)1,
					mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
					origin = CS$<>8__locals0.damageReport.victimBody.corePosition
				};
				val.RefreshCandidates();
				val.FilterCandidatesByDistinctHurtBoxEntities();
				TeamMask val2 = default(TeamMask);
				((TeamMask)(ref val2)).AddTeam(CS$<>8__locals0.damageReport.victimBody.teamComponent.teamIndex);
				val.FilterCandidatesByHurtBoxTeam(val2);
				CollectionExtensions.Do<HurtBox>((IEnumerable<HurtBox>)val.GetHurtBoxes(), (Action<HurtBox>)delegate(HurtBox hurtBox)
				{
					if ((Object)(object)hurtBox?.healthComponent?.body != (Object)(object)CS$<>8__locals0.damageReport.victimBody && hurtBox != null)
					{
						HealthComponent healthComponent = hurtBox.healthComponent;
						if (healthComponent != null)
						{
							CharacterBody body = healthComponent.body;
							if (body != null)
							{
								body.AddBuff(OnDeath);
							}
						}
					}
				});
			}

			internal void <Init>b__9_3(CharacterBody self, StatHookEventArgs args)
			{
				if (self.HasBuff(OnDeath))
				{
					args.armorAdd += OnDeathArmor.Value;
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass9_0
		{
			public DamageReport damageReport;

			internal void <Init>b__4(HurtBox hurtBox)
			{
				if (!((Object)(object)hurtBox?.healthComponent?.body != (Object)(object)damageReport.victimBody) || hurtBox == null)
				{
					return;
				}
				HealthComponent healthComponent = hurtBox.healthComponent;
				if (healthComponent != null)
				{
					CharacterBody body = healthComponent.body;
					if (body != null)
					{
						body.AddBuff(OnDeath);
					}
				}
			}
		}

		public static bool enabled;

		public static BuffDef Stack;

		public static BuffDef OnDeath;

		public static ConfigEntry<int> Hits;

		public static ConfigEntry<float> MaxHPPenalty;

		public static ConfigEntry<float> OnDeathRange;

		public static ConfigEntry<float> OnDeathArmor;

		public static ConfigEntry<float> OnDeathDuration;

		public static GameObject newPlatedBlockEffectPrefab;

		public static void Init()
		{
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Expected O, but got Unknown
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Expected O, but got Unknown
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Expected O, but got Unknown
			enabled = Main.Config.Bind<bool>("Plated", "Enabled", true, "").Value;
			Hits = Main.Config.Bind<int>("Plated", "Hits", 6, "Every n hit goes through immunity");
			MaxHPPenalty = Main.Config.Bind<float>("Plated", "HP Penalty", 0.2f, "multiplied to max hp");
			OnDeathRange = Main.Config.Bind<float>("Plated", "On Death Range", 13f, "in meters");
			OnDeathArmor = Main.Config.Bind<float>("Plated", "On Death Armor", 30f, "default: 1 ruckler");
			OnDeathDuration = Main.Config.Bind<float>("Plated", "On Death Duration", 8f, "in seconds");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Plated".ToUpper() + "_DESCRIPTION", enabled ? $"除了每{Hits.Value}次命中外,其他所有命中均会减轻。攻击<style=cIsUtility>抑制</style>敌人<style=cIsUtility>8秒</style>,每层伤害减少<style=cIsUtility>100%</style>基础伤害。" : "获得防御装甲,以减轻重伤。攻击命中时<style=cIsUtility>抑制</style>敌人,持续<style=cIsUtility>8秒</style>,每层可减少其造成的<style=cIsUtility>100%</style>基础伤害。");
			if (!enabled || !Main.IsEnabled((SpikestripContentBase)(object)SpikestripContentBase<PlatedElite>.instance))
			{
				return;
			}
			if (Hits.Value > 0)
			{
				Main.SuperOverrides.Add("PASSIVE_DEFENSE_PLATING", $"除了每{Hits.Value}次命中外,其他所有命中均会减轻。");
				Stack = ScriptableObject.CreateInstance<BuffDef>();
				Stack.canStack = true;
				Stack.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffGenericShield.tif").WaitForCompletion();
				Stack.buffColor = new Color(31f / 51f, 48f / 85f, 0.47843137f);
				ContentAddition.AddBuffDef(Stack);
				Main.Harmony.PatchAll(typeof(PatchHits));
				Main.Harmony.PatchAll(typeof(PatchHits2));
				HealthBar.UpdateHealthbar -= new hook_UpdateHealthbar(SpikestripContentBase<PlatedElite>.instance.HealthBar_UpdateHealthbar);
				newPlatedBlockEffectPrefab = PrefabAPI.InstantiateClone(PlatedElite.platedBlockEffectPrefab, "PlatingBlockEffect 2");
				newPlatedBlockEffectPrefab.GetComponent<EffectComponent>().soundName = "Play_item_proc_crowbar";
				SpikestripContentBase.effectDefContent.Add(new EffectDef(newPlatedBlockEffectPrefab));
				object obj = <>c.<>9__9_0;
				if (obj == null)
				{
					hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
					{
						//IL_0061: Unknown result type (might be due to invalid IL or missing references)
						//IL_0066: Unknown result type (might be due to invalid IL or missing references)
						//IL_0068: Unknown result type (might be due to invalid IL or missing references)
						//IL_0073: Unknown result type (might be due to invalid IL or missing references)
						//IL_0075: 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_008e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0086: Unknown result type (might be due to invalid IL or missing references)
						//IL_0093: Unknown result type (might be due to invalid IL or missing references)
						//IL_0098: Unknown result type (might be due to invalid IL or missing references)
						//IL_009e: Expected O, but got Unknown
						//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
						CharacterBody val7 = self?.body;
						if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && (Object)(object)val7 != (Object)null && val7.HasBuff(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
						{
							if (val7.HasBuff(Stack))
							{
								damageInfo.rejected = true;
								EffectData val8 = new EffectData
								{
									origin = damageInfo.position,
									rotation = Util.QuaternionSafeLookRotation((damageInfo.force != Vector3.zero) ? damageInfo.force : Random.onUnitSphere)
								};
								EffectManager.SpawnEffect(newPlatedBlockEffectPrefab, val8, true);
								val7.AddBuff(Stack);
								if (val7.GetBuffCount(Stack) >= Hits.Value)
								{
									val7.SetBuffCount(Stack.buffIndex, 0);
								}
							}
							else
							{
								val7.AddBuff(Stack);
							}
						}
						orig.Invoke(self, damageInfo);
					};
					<>c.<>9__9_0 = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamage += (hook_TakeDamage)obj;
			}
			if (MaxHPPenalty.Value != 1f)
			{
				object obj2 = <>c.<>9__9_1;
				if (obj2 == null)
				{
					StatHookEventHandler val2 = delegate(CharacterBody self, StatHookEventArgs args)
					{
						if (self.HasBuff(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
						{
							args.healthMultAdd += MaxHPPenalty.Value - 1f;
						}
					};
					<>c.<>9__9_1 = val2;
					obj2 = (object)val2;
				}
				RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
			}
			if (!(OnDeathRange.Value > 0f))
			{
				return;
			}
			OnDeath = ScriptableObject.CreateInstance<BuffDef>();
			OnDeath.canStack = false;
			OnDeath.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Junk/Common/texBuffBodyArmorIcon.tif").WaitForCompletion();
			OnDeath.buffColor = new Color(31f / 51f, 48f / 85f, 0.47843137f);
			ContentAddition.AddBuffDef(OnDeath);
			object obj3 = <>c.<>9__9_2;
			if (obj3 == null)
			{
				hook_OnCharacterDeath val3 = delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_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: Unknown result type (might be due to invalid IL or missing references)
					//IL_007d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0082: Unknown result type (might be due to invalid IL or missing references)
					//IL_008e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0093: Unknown result type (might be due to invalid IL or missing references)
					//IL_0099: Expected O, but got Unknown
					//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, damageReport);
					CharacterBody victimBody = damageReport.victimBody;
					if (victimBody != null && victimBody.HasBuff(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
					{
						SphereSearch val5 = new SphereSearch
						{
							radius = OnDeathRange.Value + damageReport.victimBody.radius,
							queryTriggerInteraction = (QueryTriggerInteraction)1,
							mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
							origin = damageReport.victimBody.corePosition
						};
						val5.RefreshCandidates();
						val5.FilterCandidatesByDistinctHurtBoxEntities();
						TeamMask val6 = default(TeamMask);
						((TeamMask)(ref val6)).AddTeam(damageReport.victimBody.teamComponent.teamIndex);
						val5.FilterCandidatesByHurtBoxTeam(val6);
						CollectionExtensions.Do<HurtBox>((IEnumerable<HurtBox>)val5.GetHurtBoxes(), (Action<HurtBox>)delegate(HurtBox hurtBox)
						{
							if ((Object)(object)hurtBox?.healthComponent?.body != (Object)(object)damageReport.victimBody && hurtBox != null)
							{
								HealthComponent healthComponent = hurtBox.healthComponent;
								if (healthComponent != null)
								{
									CharacterBody body = healthComponent.body;
									if (body != null)
									{
										body.AddBuff(OnDeath);
									}
								}
							}
						});
					}
				};
				<>c.<>9__9_2 = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj3;
			object obj4 = <>c.<>9__9_3;
			if (obj4 == null)
			{
				StatHookEventHandler val4 = delegate(CharacterBody self, StatHookEventArgs args)
				{
					if (self.HasBuff(OnDeath))
					{
						args.armorAdd += OnDeathArmor.Value;
					}
				};
				<>c.<>9__9_3 = val4;
				obj4 = (object)val4;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj4;
		}
	}
	public class Veiled
	{
		[HarmonyPatch(typeof(CharacterModel), "UpdateRendererMaterials")]
		public class PatchVisibility
		{
			public static void ILManipulator(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld<CharacterModel>(x, "cloakedMaterial")
				});
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<Material, CharacterModel, Material>>((Func<Material, CharacterModel, Material>)((Material mat, CharacterModel self) => self.body.HasBuff(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<CloakedElite>.instance).AffixBuff) ? fakeCloakedMaterial : mat));
			}
		}

		[HarmonyPatch(typeof(CloakedElite), "GlobalEventManager_OnHitEnemy")]
		public class PatchCloak
		{
			public static bool Prefix(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
			{
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Expected O, but got Unknown
				orig.Invoke(self, damageInfo, victim);
				if (damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)damageInfo.attacker))
				{
					CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && !component.HasBuff(Buffs.Cloak) && component.HasBuff(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<CloakedElite>.instance).AffixBuff))
					{
						component.AddBuff(Buffs.Cloak);
						EffectManager.SpawnEffect(CloakedElite.SmokebombEffect, new EffectData
						{
							origin = damageInfo.attacker.transform.position,
							rotation = damageInfo.attacker.transform.rotation,
							scale = component.bestFitRadius * 0.2f
						}, true);
					}
				}
				return false;
			}
		}

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

			public static Action<PoolEntry> <>9__6_7;

			public static Action<DccsPool, List<DirectorCardHolder>, StageInfo> <>9__6_0;

			public static hook_CanSelect <>9__6_1;

			public static hook_CalcHighestEliteCostMultiplier <>9__6_2;

			public static Func<EliteDef, bool> <>9__6_8;

			public static hook_ResetEliteType <>9__6_3;

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

			public static Func<EliteDef, bool> <>9__6_11;

			public static Func<EliteDef, CombatDirector, EliteDef> <>9__6_10;

			public static Manipulator <>9__6_4;

			public static hook_OnHitEnemy <>9__6_5;

			public static hook_RemoveBuff_BuffIndex <>9__6_6;

			internal void <Init>b__6_0(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
			{
				if (!Object.op_Implicit((Object)(object)dccsPool))
				{
					return;
				}
				Helpers.ForEachPoolEntryInDccsPool(dccsPool, (Action<PoolEntry>)delegate(PoolEntry poolEntry)
				{
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0050: Unknown result type (might be due to invalid IL or missing references)
					//IL_005a: Unknown result type (might be due to invalid IL or missing references)
					Category[] categories = poolEntry.dccs.categories;
					foreach (Category val in categories)
					{
						DirectorCard[] cards = val.cards;
						foreach (DirectorCard val2 in cards)
						{
							if (((Object)val2.spawnCard).name.Contains("Assassin2"))
							{
								((SpawnCard)(CharacterSpawnCard)val2.spawnCard).eliteRules = (EliteRules)339001;
							}
						}
					}
				});
			}

			internal void <Init>b__6_7(PoolEntry poolEntry)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				Category[] categories = poolEntry.dccs.categories;
				foreach (Category val in categories)
				{
					DirectorCard[] cards = val.cards;
					foreach (DirectorCard val2 in cards)
					{
						if (((Object)val2.spawnCard).name.Contains("Assassin2"))
						{
							((SpawnCard)(CharacterSpawnCard)val2.spawnCard).eliteRules = (EliteRules)339001;
						}
					}
				}
			}

			internal bool <Init>b__6_1(orig_CanSelect orig, EliteTierDef self, EliteRules rules)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				if ((int)rules == 339001)
				{
					return orig.Invoke(self, (EliteRules)0);
				}
				return orig.Invoke(self, rules);
			}

			internal float <Init>b__6_2(orig_CalcHighestEliteCostMultiplier orig, EliteRules rules)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				if ((int)rules == 339001)
				{
					return orig.Invoke((EliteRules)0);
				}
				return orig.Invoke(rules);
			}

			internal void <Init>b__6_3(orig_ResetEliteType orig, CombatDirector self)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Invalid comparison between Unknown and I4
				orig.Invoke(self);
				if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
				{
					self.currentActiveEliteDef = self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => (Object)(object)x != (Object)null && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList());
				}
			}

			internal bool <Init>b__6_8(EliteDef x)
			{
				return (Object)(object)x != (Object)null && x.IsAvailable() && !((Object)x).name.Contains("Cloaked");
			}

			internal void <Init>b__6_4(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef")
				});
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<EliteDef, CombatDirector, EliteDef>>((Func<EliteDef, CombatDirector, EliteDef>)((EliteDef orig, CombatDirector self) => ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001) ? self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => (Object)(object)x != (Object)null && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList()) : orig));
			}

			internal bool <Init>b__6_9(Instruction x)
			{
				return ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef");
			}

			internal EliteDef <Init>b__6_10(EliteDef orig, CombatDirector self)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Invalid comparison between Unknown and I4
				if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
				{
					return self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => (Object)(object)x != (Object)null && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList());
				}
				return orig;
			}

			internal bool <Init>b__6_11(EliteDef x)
			{
				return (Object)(object)x != (Object)null && x.IsAvailable() && !((Object)x).name.Contains("Cloaked");
			}

			internal void <Init>b__6_5(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject _victim)
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = _victim.GetComponent<CharacterBody>();
				if ((Object)(object)component != (Object)null && component.HasBuff(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<CloakedElite>.instance).AffixBuff) && component.HasBuff(Buffs.Cloak))
				{
					component.SetBuffCount(Buffs.Cloak.buffIndex, 0);
					component.AddTimedBuff(Cooldown, VisibleTime.Value);
				}
				orig.Invoke(self, damageInfo, _victim);
			}

			internal void <Init>b__6_6(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex idx)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Expected O, but got Unknown
				if (NetworkServer.active && idx == Cooldown.buffIndex)
				{
					self.AddBuff(Buffs.Cloak);
					EffectManager.SpawnEffect(CloakedElite.SmokebombEffect, new EffectData
					{
						origin = self.transform.position,
						rotation = self.transform.rotation,
						scale = self.bestFitRadius * 0.2f
					}, true);
				}
				orig.Invoke(self, idx);
			}
		}

		public static bool enabled;

		public static Material fakeCloakedMaterial;

		public static BuffDef Cooldown;

		public static ConfigEntry<bool> BetterVisibility;

		public static ConfigEntry<bool> HitToShow;

		public static ConfigEntry<float> VisibleTime;

		public static void Init()
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//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_0141: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Expected O, but got Unknown
			enabled = Main.Config.Bind<bool>("Veiled", "Enabled", true, "").Value;
			BetterVisibility = Main.Config.Bind<bool>("Veiled", "Better Visibility", true, "make cloaked enemies easier to spot");
			HitToShow = Main.Config.Bind<bool>("Veiled", "Hit to Show Enemy", true, "hit enemy to make it visible");
			VisibleTime = Main.Config.Bind<float>("Veiled", "Duration", 4f, "in seconds");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Veiled".ToUpper() + "_DESCRIPTION", enabled ? "你已<style=cIsUtility>隐形</style>。受到攻击将使你脱离隐形。" : "攻击会使你<style=cIsUtility>隐形</style>。");
			if (!enabled || !Main.IsEnabled((SpikestripContentBase)(object)SpikestripContentBase<CloakedElite>.instance))
			{
				return;
			}
			DirectorAPI.MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
			{
				if (Object.op_Implicit((Object)(object)dccsPool))
				{
					Helpers.ForEachPoolEntryInDccsPool(dccsPool, (Action<PoolEntry>)delegate(PoolEntry poolEntry)
					{
						//IL_0014: Unknown result type (might be due to invalid IL or missing references)
						//IL_0019: Unknown result type (might be due to invalid IL or missing references)
						//IL_001b: Unknown result type (might be due to invalid IL or missing references)
						//IL_0050: Unknown result type (might be due to invalid IL or missing references)
						//IL_005a: Unknown result type (might be due to invalid IL or missing references)
						Category[] categories = poolEntry.dccs.categories;
						foreach (Category val8 in categories)
						{
							DirectorCard[] cards = val8.cards;
							foreach (DirectorCard val9 in cards)
							{
								if (((Object)val9.spawnCard).name.Contains("Assassin2"))
								{
									((SpawnCard)(CharacterSpawnCard)val9.spawnCard).eliteRules = (EliteRules)339001;
								}
							}
						}
					});
				}
			};
			object obj = <>c.<>9__6_1;
			if (obj == null)
			{
				hook_CanSelect val = (orig_CanSelect orig, EliteTierDef self, EliteRules rules) => ((int)rules == 339001) ? orig.Invoke(self, (EliteRules)0) : orig.Invoke(self, rules);
				<>c.<>9__6_1 = val;
				obj = (object)val;
			}
			EliteTierDef.CanSelect += (hook_CanSelect)obj;
			object obj2 = <>c.<>9__6_2;
			if (obj2 == null)
			{
				hook_CalcHighestEliteCostMultiplier val2 = (orig_CalcHighestEliteCostMultiplier orig, EliteRules rules) => ((int)rules == 339001) ? orig.Invoke((EliteRules)0) : orig.Invoke(rules);
				<>c.<>9__6_2 = val2;
				obj2 = (object)val2;
			}
			CombatDirector.CalcHighestEliteCostMultiplier += (hook_CalcHighestEliteCostMultiplier)obj2;
			object obj3 = <>c.<>9__6_3;
			if (obj3 == null)
			{
				hook_ResetEliteType val3 = delegate(orig_ResetEliteType orig, CombatDirector self)
				{
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_001e: Invalid comparison between Unknown and I4
					orig.Invoke(self);
					if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
					{
						self.currentActiveEliteDef = self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => (Object)(object)x != (Object)null && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList());
					}
				};
				<>c.<>9__6_3 = val3;
				obj3 = (object)val3;
			}
			CombatDirector.ResetEliteType += (hook_ResetEliteType)obj3;
			object obj4 = <>c.<>9__6_4;
			if (obj4 == null)
			{
				Manipulator val4 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val7 = new ILCursor(il);
					val7.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef")
					});
					val7.Emit(OpCodes.Ldarg_0);
					val7.EmitDelegate<Func<EliteDef, CombatDirector, EliteDef>>((Func<EliteDef, CombatDirector, EliteDef>)((EliteDef orig, CombatDirector self) => ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001) ? self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => (Object)(object)x != (Object)null && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList()) : orig));
				};
				<>c.<>9__6_4 = val4;
				obj4 = (object)val4;
			}
			CombatDirector.PrepareNewMonsterWave += (Manipulator)obj4;
			if (BetterVisibility.Value)
			{
				fakeCloakedMaterial = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matCloakedEffect.mat").WaitForCompletion());
				fakeCloakedMaterial.SetFloat("_Magnitude", 2.5f);
				Main.Harmony.PatchAll(typeof(PatchVisibility));
			}
			if (!HitToShow.Value)
			{
				return;
			}
			Cooldown = ScriptableObject.CreateInstance<BuffDef>();
			Cooldown.isCooldown = true;
			Cooldown.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffCloakIcon.tif").WaitForCompletion();
			Cooldown.buffColor = Color.gray;
			ContentAddition.AddBuffDef(Cooldown);
			object obj5 = <>c.<>9__6_5;
			if (obj5 == null)
			{
				hook_OnHitEnemy val5 = delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject _victim)
				{
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = _victim.GetComponent<CharacterBody>();
					if ((Object)(object)component != (Object)null && component.HasBuff(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<CloakedElite>.instance).AffixBuff) && component.HasBuff(Buffs.Cloak))
					{
						component.SetBuffCount(Buffs.Cloak.buffIndex, 0);
						component.AddTimedBuff(Cooldown, VisibleTime.Value);
					}
					orig.Invoke(self, damageInfo, _victim);
				};
				<>c.<>9__6_5 = val5;
				obj5 = (object)val5;
			}
			GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj5;
			object obj6 = <>c.<>9__6_6;
			if (obj6 == null)
			{
				hook_RemoveBuff_BuffIndex val6 = delegate(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex idx)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0033: Unknown result type (might be due to invalid IL or missing references)
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0051: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_006e: Expected O, but got Unknown
					if (NetworkServer.active && idx == Cooldown.buffIndex)
					{
						self.AddBuff(Buffs.Cloak);
						EffectManager.SpawnEffect(CloakedElite.SmokebombEffect, new EffectData
						{
							origin = self.transform.position,
							rotation = self.transform.rotation,
							scale = self.bestFitRadius * 0.2f
						}, true);
					}
					orig.Invoke(self, idx);
				};
				<>c.<>9__6_6 = val6;
				obj6 = (object)val6;
			}
			CharacterBody.RemoveBuff_BuffIndex += (hook_RemoveBuff_BuffIndex)obj6;
			Main.Harmony.PatchAll(typeof(PatchCloak));
		}
	}
	public class Warped
	{
		[HarmonyPatch(typeof(WarpedElite), "OnHitEnemyServer")]
		public class PatchDuration
		{
			public static void ILManipulator(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 4f)
				});
				val.Emit(OpCodes.Pop);
				val.EmitDelegate<Func<float>>((Func<float>)(() => Duration.Value));
			}
		}

		[HarmonyPatch(typeof(GravityBuffBehaviour), "ServerFixedUpdate")]
		public class PatchBreakout
		{
			public static void Postfix(GravityBuffBehaviour __instance)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: 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_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				HealthComponent healthComponent = ((ItemBehavior)__instance).body.healthComponent;
				if (healthComponent != null)
				{
					healthComponent.TakeDamageForce(Vector3.up * Time.fixedDeltaTime * (0f - ((ItemBehavior)__instance).body.corePosition.y), false, false);
				}
				Vector3 val = ((ItemBehavior)__instance).body.characterMotor?.velocity ?? Vector3.zero;
				TimedBuff val2 = ((ItemBehavior)__instance).body.timedBuffs.Find((TimedBuff x) => x.buffIndex == WarpedElite.gravityBuff.buffIndex);
				if (val2 != null && val2.timer > 0f)
				{
					val2.timer -= Time.fixedDeltaTime * BreakoutCoefficient.Value / Mathf.Sqrt(val.x * val.x + val.z * val.z + 1f);
					if (val2.timer < 0f)
					{
						((ItemBehavior)__instance).body.timedBuffs.Remove(val2);
						((ItemBehavior)__instance).body.RemoveBuff(WarpedElite.gravityBuff);
					}
				}
			}
		}

		public static bool enabled;

		public static ConfigEntry<float> Duration;

		public static ConfigEntry<float> BreakoutCoefficient;

		public static void Init()
		{
			enabled = Main.Config.Bind<bool>("Warped", "Enabled", true, "").Value;
			Duration = Main.Config.Bind<float>("Warped", "Duration", 4f, "in seconds");
			BreakoutCoefficient = Main.Config.Bind<float>("Warped", "Breakout Coefficient", 5f, "1 = 100% faster when standing completely still, hyperbolic");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Warped".ToUpper() + "_DESCRIPTION", enabled ? $"攻击命中时<style=cIsUtility>悬浮</style>敌人,持续<style=cIsUtility>{Duration.Value / BreakoutCoefficient.Value}秒</style>或更长时间。" : "攻击命中时<style=cIs Utility>悬浮</style>敌人,持续<style=dIsUtility>4秒</style>。");
			if (enabled && Main.IsEnabled((SpikestripContentBase)(object)SpikestripContentBase<WarpedElite>.instance))
			{
				if (Duration.Value != 4f)
				{
					Main.Harmony.PatchAll(typeof(PatchDuration));
				}
				if (BreakoutCoefficient.Value > 0f)
				{
					Main.Harmony.PatchAll(typeof(PatchBreakout));
				}
			}
		}
	}
}

dll/Parry.dll.old

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Merc;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Parry
{
	[BepInPlugin("com.Nuxlar.Parry", "Parry", "1.3.0")]
	public class Parry : BaseUnityPlugin
	{
		private AssetBundle parryAssets;

		private Sprite parryIcon;

		private Sprite parryBuffIcon;

		private Sprite parryActivatedBuffIcon;

		public static BuffDef parryBuffDef;

		public static BuffDef parryActivatedBuffDef;

		private GameObject merc = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercBody.prefab").WaitForCompletion();

		public static GameObject parryImpact = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/ImpactMercFocusedAssault.prefab").WaitForCompletion();

		public static GameObject parryFunImpact = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Captain/CaptainAirstrikeAltImpact.prefab").WaitForCompletion();

		public static SkillDef parrySkillDef = ScriptableObject.CreateInstance<SkillDef>();

		private static BodyIndex mercBodyIndex;

		public static ConfigEntry<float> parryFunDamageMultiplier;

		public static ConfigEntry<float> parryFunRadius;

		public static ConfigEntry<bool> parryFunEnabled;

		private static ConfigFile ParryConfig { get; set; }

		public void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			ParryConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.Parry.cfg", true);
			parryFunDamageMultiplier = ParryConfig.Bind<float>("General", "Fun Mode Damage Multiplier", 20f, "This number is multiplied by the base 500% damage, so 20 would be 10000% damage.");
			parryFunRadius = ParryConfig.Bind<float>("General", "Fun Mode Damage Radius", 26f, "How large the retalitory strike radius is in fun mode.");
			parryFunEnabled = ParryConfig.Bind<bool>("General", "Enable Fun Mode", false, "Parry but fun.");
			parryAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "parrybundle.bundle"));
			parryIcon = parryAssets.LoadAsset<Sprite>("Assets/parryIconNux.png");
			parryBuffIcon = parryAssets.LoadAsset<Sprite>("Assets/parryBuffIconNux.png");
			parryActivatedBuffIcon = parryAssets.LoadAsset<Sprite>("Assets/parryActivatedBuffIconNux.png");
			bool flag = default(bool);
			ContentAddition.AddEntityState<ParryHold>(ref flag);
			ContentAddition.AddEntityState<ParryStrike>(ref flag);
			CreateParryBuffs();
			CreateParrySkill();
			ParryStrike.parrySoundDef = CreateNetworkSoundEventDef("Play_nux_parry");
			ParryStrike.evisSoundDef = CreateNetworkSoundEventDef("Play_merc_sword_impact");
			HealthComponent.TakeDamage += new hook_TakeDamage(TakeDamageHook);
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
		}

		private void OnLoad()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			mercBodyIndex = BodyCatalog.FindBodyIndex("MercBody");
		}

		private void TakeDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && self.body.bodyIndex == mercBodyIndex && self.body.HasBuff(parryBuffDef) && damageInfo.damage > 0f)
			{
				HandleParryBuffsServer(self.body);
			}
			else
			{
				orig.Invoke(self, damageInfo);
			}
		}

		public static void HandleParryBuffsServer(CharacterBody body)
		{
			if (body.HasBuff(parryBuffDef))
			{
				body.RemoveBuff(parryBuffDef);
			}
			if (!body.HasBuff(parryActivatedBuffDef))
			{
				body.AddBuff(parryActivatedBuffDef);
			}
			body.AddTimedBuff(Buffs.Immune, ParryStrike.invulnDuration);
		}

		private void CreateParryBuffs()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			parryBuffDef = ScriptableObject.CreateInstance<BuffDef>();
			((Object)parryBuffDef).name = "ParryBuffNux";
			parryBuffDef.canStack = false;
			parryBuffDef.isCooldown = false;
			parryBuffDef.isDebuff = false;
			parryBuffDef.buffColor = Color.cyan;
			parryBuffDef.iconSprite = parryBuffIcon;
			((Object)parryBuffDef).name = ((Object)parryBuffDef).name;
			parryActivatedBuffDef = ScriptableObject.CreateInstance<BuffDef>();
			((Object)parryActivatedBuffDef).name = "ParryActivatedBuffNux";
			parryActivatedBuffDef.canStack = false;
			parryActivatedBuffDef.isCooldown = false;
			parryActivatedBuffDef.isDebuff = false;
			parryActivatedBuffDef.buffColor = Color.cyan;
			parryActivatedBuffDef.iconSprite = parryActivatedBuffIcon;
			((Object)parryActivatedBuffDef).name = ((Object)parryActivatedBuffDef).name;
			ContentAddition.AddBuffDef(parryBuffDef);
			ContentAddition.AddBuffDef(parryActivatedBuffDef);
		}

		private void CreateParrySkill()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			parrySkillDef.skillName = "专注一击";
			((Object)parrySkillDef).name = "专注一击";
			parrySkillDef.skillNameToken = "专注一击";
			parrySkillDef.skillDescriptionToken = "准备好你的剑,在攻击来袭之前释放以<style=cIsUtility>招架</style>敌人的攻击,对所有附近的敌人造成<style=cIsDamage>500%-1500%的伤害。</style>";
			parrySkillDef.icon = parryIcon;
			parrySkillDef.activationState = new SerializableEntityStateType(typeof(ParryHold));
			parrySkillDef.activationStateMachineName = "Body";
			parrySkillDef.interruptPriority = (InterruptPriority)2;
			parrySkillDef.baseMaxStock = 1;
			parrySkillDef.baseRechargeInterval = 5f;
			parrySkillDef.rechargeStock = 1;
			parrySkillDef.requiredStock = 1;
			parrySkillDef.stockToConsume = 1;
			parrySkillDef.dontAllowPastMaxStocks = false;
			parrySkillDef.beginSkillCooldownOnSkillEnd = false;
			parrySkillDef.canceledFromSprinting = false;
			parrySkillDef.forceSprintDuringState = false;
			parrySkillDef.fullRestockOnAssign = true;
			parrySkillDef.resetCooldownTimerOnUse = false;
			parrySkillDef.isCombatSkill = true;
			parrySkillDef.mustKeyPress = false;
			parrySkillDef.cancelSprintingOnActivation = true;
			ContentAddition.AddSkillDef(parrySkillDef);
			SkillFamily skillFamily = merc.GetComponent<SkillLocator>().secondary.skillFamily;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val = new Variant
			{
				skillDef = parrySkillDef
			};
			((Variant)(ref val)).viewableNode = new Node(parrySkillDef.skillNameToken, false, (Node)null);
			variants[num] = val;
		}

		public static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
		{
			NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			obj.akId = AkSoundEngine.GetIDFromString(eventName);
			obj.eventName = eventName;
			ContentAddition.AddNetworkSoundEventDef(obj);
			return obj;
		}
	}
	public class ParryHold : BaseState
	{
		public static float baseMinDuration = 0f;

		public static string readySoundString = "Play_merc_sword_impact";

		private bool playedSound;

		private float minDuration;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			playedSound = false;
			minDuration = baseMinDuration / base.attackSpeedStat;
			((EntityState)this).PlayCrossfade("FullBody, Override", "GroundLight2", "GroundLight.playbackRate", 999f, 0.05f);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			bool flag = ((EntityState)this).fixedAge >= minDuration;
			if (flag && !playedSound)
			{
				playedSound = true;
				Util.PlaySound(readySoundString, ((EntityState)this).gameObject);
			}
			if (((EntityState)this).isAuthority && (!Object.op_Implicit((Object)(object)((EntityState)this).inputBank) || !((EntityState)this).inputBank.skill2.down) && flag)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new ParryStrike());
			}
		}
	}
	public class ParryStrike : BaseState
	{
		public static NetworkSoundEventDef parrySoundDef;

		public static NetworkSoundEventDef evisSoundDef;

		public static float totalDuration = 0.35f;

		public static float attackDelay = 0.3f;

		public static float invulnDuration = 1f;

		public static float blastAttackDamageCoefficient = 5f;

		public static float projectileGrazeRadius = 3f;

		private bool hasFiredServer;

		private bool hasFiredClient;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			if (NetworkServer.active)
			{
				CleanBuffsServer();
				if (!((EntityState)this).characterBody.HasBuff(Parry.parryBuffDef))
				{
					((EntityState)this).characterBody.AddBuff(Parry.parryBuffDef);
				}
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= attackDelay)
			{
				if (!hasFiredClient)
				{
					DoAttackClient();
				}
				if (NetworkServer.active && !hasFiredServer)
				{
					DoAttackServer();
				}
			}
			else
			{
				CheckProjectileGrazeServer();
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= totalDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if (NetworkServer.active)
			{
				if (!hasFiredServer)
				{
					DoAttackServer();
				}
				CleanBuffsServer();
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "UppercutExit");
			((EntityState)this).OnExit();
		}

		private void CleanBuffsServer()
		{
			if (NetworkServer.active)
			{
				if (((EntityState)this).characterBody.HasBuff(Parry.parryActivatedBuffDef))
				{
					((EntityState)this).characterBody.RemoveBuff(Parry.parryActivatedBuffDef);
				}
				if (((EntityState)this).characterBody.HasBuff(Parry.parryBuffDef))
				{
					((EntityState)this).characterBody.RemoveBuff(Parry.parryBuffDef);
				}
			}
		}

		private void DoAttackClient()
		{
			hasFiredClient = true;
			((EntityState)this).PlayCrossfade("FullBody, Override", "Uppercut", "Uppercut.playbackRate", 1f, totalDuration - attackDelay);
			Util.PlaySound("Play_merc_m2_uppercut", ((EntityState)this).gameObject);
		}

		private void DoAttackServer()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: 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_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: 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_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: 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_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: 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_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_026d: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: 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_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				return;
			}
			hasFiredServer = true;
			bool num = ((EntityState)this).characterBody.HasBuff(Parry.parryActivatedBuffDef);
			DamageType val = (DamageType)32;
			float num2 = blastAttackDamageCoefficient;
			if (num)
			{
				if (Parry.parryFunEnabled.Value)
				{
					DeleteProjectilesServer(((EntityState)this).characterBody.radius + Parry.parryFunRadius.Value);
					num2 *= Parry.parryFunDamageMultiplier.Value;
				}
				else
				{
					DeleteProjectilesServer(((EntityState)this).characterBody.radius + 13f);
					num2 *= 3f;
				}
				val = (DamageType)(val | 0x800000);
				if (Object.op_Implicit((Object)(object)parrySoundDef))
				{
					EffectManager.SimpleSoundEffect(parrySoundDef.index, ((EntityState)this).characterBody.corePosition, true);
				}
			}
			EffectManager.SimpleImpactEffect(Evis.hitEffectPrefab, ((EntityState)this).characterBody.corePosition, Vector3.one, true);
			EffectManager.SimpleImpactEffect(Evis.hitEffectPrefab, ((EntityState)this).characterBody.corePosition, Vector3.zero, true);
			EffectManager.SimpleImpactEffect(Evis.hitEffectPrefab, ((EntityState)this).characterBody.corePosition, Vector3.left, true);
			EffectManager.SimpleImpactEffect(Evis.hitEffectPrefab, ((EntityState)this).characterBody.corePosition, Vector3.right, true);
			Result val2 = ((!Parry.parryFunEnabled.Value) ? new BlastAttack
			{
				impactEffect = EffectCatalog.FindEffectIndexFromPrefab(Evis.hitEffectPrefab),
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject),
				baseDamage = base.damageStat * num2,
				baseForce = 250f,
				position = ((EntityState)this).characterBody.corePosition,
				radius = ((EntityState)this).characterBody.radius + 13f,
				falloffModel = (FalloffModel)0,
				damageType = val,
				attackerFiltering = (AttackerFiltering)2
			}.Fire() : new BlastAttack
			{
				impactEffect = EffectCatalog.FindEffectIndexFromPrefab(Parry.parryFunImpact),
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject),
				baseDamage = base.damageStat * num2,
				baseForce = 10000f,
				position = ((EntityState)this).characterBody.corePosition,
				radius = ((EntityState)this).characterBody.radius + Parry.parryFunRadius.Value,
				falloffModel = (FalloffModel)0,
				damageType = val,
				attackerFiltering = (AttackerFiltering)2
			}.Fire());
			if (val2.hitCount > 0 && Object.op_Implicit((Object)(object)evisSoundDef))
			{
				EffectManager.SimpleSoundEffect(evisSoundDef.index, ((EntityState)this).characterBody.corePosition, true);
			}
			CleanBuffsServer();
		}

		private void CheckProjectileGrazeServer()
		{
			//IL_0039: 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_00b0: 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)
			if (!NetworkServer.active || projectileGrazeRadius <= 0f || !Object.op_Implicit((Object)(object)((EntityState)this).characterBody) || !((EntityState)this).characterBody.HasBuff(Parry.parryBuffDef))
			{
				return;
			}
			Collider[] array = Physics.OverlapSphere(((EntityState)this).characterBody.corePosition, projectileGrazeRadius + ((EntityState)this).characterBody.radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.projectile)).mask));
			for (int i = 0; i < array.Length; i++)
			{
				ProjectileController componentInParent = ((Component)array[i]).GetComponentInParent<ProjectileController>();
				if (Object.op_Implicit((Object)(object)componentInParent) && !componentInParent.cannotBeDeleted && (Object)(object)componentInParent.owner != (Object)(object)((EntityState)this).gameObject && (!Object.op_Implicit((Object)(object)componentInParent.teamFilter) || componentInParent.teamFilter.teamIndex != ((BaseState)this).GetTeam()))
				{
					bool flag = false;
					ProjectileSimple component = ((Component)componentInParent).gameObject.GetComponent<ProjectileSimple>();
					ProjectileCharacterController component2 = ((Component)componentInParent).gameObject.GetComponent<ProjectileCharacterController>();
					if ((!Object.op_Implicit((Object)(object)component) || (Object.op_Implicit((Object)(object)component) && component.desiredForwardSpeed == 0f)) && !Object.op_Implicit((Object)(object)component2))
					{
						flag = true;
					}
					if (!flag)
					{
						Parry.HandleParryBuffsServer(((EntityState)this).characterBody);
						break;
					}
				}
			}
		}

		private void DeleteProjectilesServer(float radius)
		{
			//IL_000c: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			List<ProjectileController> list = new List<ProjectileController>();
			Collider[] array = Physics.OverlapSphere(((EntityState)this).characterBody.corePosition, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.projectile)).mask));
			for (int i = 0; i < array.Length; i++)
			{
				ProjectileController componentInParent = ((Component)array[i]).GetComponentInParent<ProjectileController>();
				if (Object.op_Implicit((Object)(object)componentInParent) && !componentInParent.cannotBeDeleted && (Object)(object)componentInParent.owner != (Object)(object)((EntityState)this).gameObject && (!Object.op_Implicit((Object)(object)componentInParent.teamFilter) || componentInParent.teamFilter.teamIndex != ((BaseState)this).GetTeam()))
				{
					bool flag = false;
					ProjectileSimple component = ((Component)componentInParent).gameObject.GetComponent<ProjectileSimple>();
					ProjectileCharacterController component2 = ((Component)componentInParent).gameObject.GetComponent<ProjectileCharacterController>();
					if ((!Object.op_Implicit((Object)(object)component) || (Object.op_Implicit((Object)(object)component) && component.desiredForwardSpeed == 0f)) && !Object.op_Implicit((Object)(object)component2))
					{
						flag = true;
					}
					if (!flag && !list.Contains(componentInParent))
					{
						list.Add(componentInParent);
					}
				}
			}
			int count = list.Count;
			for (int j = 0; j < count; j++)
			{
				GameObject gameObject = ((Component)list[j]).gameObject;
				if (Object.op_Implicit((Object)(object)gameObject))
				{
					EntityState.Destroy((Object)(object)gameObject);
				}
			}
		}
	}
}

dll/PhotoMode.dll.old

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using On.RoR2.UI;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Dragonyck")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PhotoMode")]
[assembly: AssemblyTitle("PhotoMode")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PhotoMode;

internal class PhotoModeController : MonoBehaviour, ICameraStateProvider
{
	internal struct PhotoModeCameraState
	{
		internal float pitch;

		internal float yaw;

		internal float roll;

		internal Vector3 position;

		internal float fov;

		internal Quaternion Rotation
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				return Quaternion.Euler(pitch, yaw, roll);
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: 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_0021: Unknown result type (might be due to invalid IL or missing references)
				Vector3 eulerAngles = ((Quaternion)(ref value)).eulerAngles;
				pitch = eulerAngles.x;
				yaw = eulerAngles.y;
				roll = eulerAngles.z;
			}
		}
	}

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

		public static EmptyDelegate <>9__16_0;

		public static EmptyDelegate <>9__16_1;

		internal void <EnterPhotoMode>b__16_0()
		{
			SettingsConVars.enableDamageNumbers.SetBool(true);
		}

		internal void <EnterPhotoMode>b__16_1()
		{
			SettingsConVars.cvExpAndMoneyEffects.SetBool(true);
		}
	}

	private static float cameraSpeed = 10f;

	private static float cameraSprintMultiplier = 5f;

	private static float cameraSlowMultiplier = 0.3f;

	public CameraRigController cameraRigController;

	public PauseScreenController pauseController;

	private PhotoModeCameraState cameraState;

	[CompilerGenerated]
	private EmptyDelegate m_OnExit;

	private Camera Camera => cameraRigController.sceneCam;

	public InputSource currentInputSource { get; private set; }

	private bool gamepad => (int)currentInputSource == 1;

	private event EmptyDelegate OnExit
	{
		[CompilerGenerated]
		add
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			EmptyDelegate val = this.m_OnExit;
			EmptyDelegate val2;
			do
			{
				val2 = val;
				EmptyDelegate value2 = (EmptyDelegate)Delegate.Combine((Delegate?)(object)val2, (Delegate?)(object)value);
				val = Interlocked.CompareExchange(ref this.m_OnExit, value2, val2);
			}
			while (val != val2);
		}
		[CompilerGenerated]
		remove
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			EmptyDelegate val = this.m_OnExit;
			EmptyDelegate val2;
			do
			{
				val2 = val;
				EmptyDelegate value2 = (EmptyDelegate)Delegate.Remove((Delegate?)(object)val2, (Delegate?)(object)value);
				val = Interlocked.CompareExchange(ref this.m_OnExit, value2, val2);
			}
			while (val != val2);
		}
	}

	internal void EnterPhotoMode(PauseScreenController pauseController, CameraRigController cameraRigController)
	{
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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_009a: 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_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Expected O, but got Unknown
		//IL_00f5: 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_0100: Expected O, but got Unknown
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Expected O, but got Unknown
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Expected O, but got Unknown
		//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_013c: Expected O, but got Unknown
		this.pauseController = pauseController;
		this.cameraRigController = cameraRigController;
		Debug.Log((object)"Entering photo mode");
		((Component)this.pauseController).gameObject.SetActive(false);
		if (Object.op_Implicit((Object)(object)this.cameraRigController))
		{
			this.cameraRigController.SetOverrideCam((ICameraStateProvider)(object)this, 0f);
			this.cameraRigController.enableFading = false;
		}
		cameraState = default(PhotoModeCameraState);
		cameraState.position = ((Component)Camera).transform.position;
		cameraState.Rotation = Quaternion.LookRotation(((Component)Camera).transform.rotation * Vector3.forward, Vector3.up);
		cameraState.fov = Camera.fieldOfView;
		Time.timeScale = 0f;
		if (SettingsConVars.enableDamageNumbers.value)
		{
			SettingsConVars.enableDamageNumbers.SetBool(false);
			object obj = <>c.<>9__16_0;
			if (obj == null)
			{
				EmptyDelegate val = delegate
				{
					SettingsConVars.enableDamageNumbers.SetBool(true);
				};
				<>c.<>9__16_0 = val;
				obj = (object)val;
			}
			OnExit += (EmptyDelegate)obj;
		}
		if (SettingsConVars.cvExpAndMoneyEffects.value)
		{
			SettingsConVars.cvExpAndMoneyEffects.SetBool(false);
			object obj2 = <>c.<>9__16_1;
			if (obj2 == null)
			{
				EmptyDelegate val2 = delegate
				{
					SettingsConVars.cvExpAndMoneyEffects.SetBool(true);
				};
				<>c.<>9__16_1 = val2;
				obj2 = (object)val2;
			}
			OnExit += (EmptyDelegate)obj2;
		}
		((Behaviour)this.cameraRigController.hud.mainContainer.GetComponent<Canvas>()).enabled = false;
		OnExit += (EmptyDelegate)delegate
		{
			((Behaviour)this.cameraRigController.hud.mainContainer.GetComponent<Canvas>()).enabled = true;
		};
		if (PhotoModePlugin.disableIndicators.Value)
		{
			SetIndicatorsVisible(visible: false);
			OnExit += (EmptyDelegate)delegate
			{
				SetIndicatorsVisible(visible: true);
			};
		}
		SetupPhotoModeHUD(this.cameraRigController.hud);
		Player inputPlayer = this.cameraRigController.localUserViewer.inputPlayer;
		inputPlayer.controllers.AddLastActiveControllerChangedDelegate(new PlayerActiveControllerChangedDelegate(OnLastActiveControllerChanged));
		OnLastActiveControllerChanged(inputPlayer, inputPlayer.controllers.GetLastActiveController());
	}

	private void OnDisable()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		cameraRigController.localUserViewer.inputPlayer.controllers.RemoveLastActiveControllerChangedDelegate(new PlayerActiveControllerChangedDelegate(OnLastActiveControllerChanged));
	}

	private void OnLastActiveControllerChanged(Player player, Controller controller)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected I4, but got Unknown
		if (controller != null)
		{
			ControllerType type = controller.type;
			switch ((int)type)
			{
			case 0:
				currentInputSource = (InputSource)0;
				break;
			case 1:
				currentInputSource = (InputSource)0;
				break;
			case 2:
				currentInputSource = (InputSource)1;
				break;
			}
		}
	}

	private void SetupPhotoModeHUD(HUD hud)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		_ = ((Component)hud).gameObject;
		new GameObject("PhotoModeHUD", new Type[1] { typeof(Canvas) });
	}

	private void ExitPhotoMode()
	{
		//IL_0065: 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)
		this.OnExit.Invoke();
		((Component)pauseController).gameObject.SetActive(true);
		if (Object.op_Implicit((Object)(object)cameraRigController))
		{
			cameraRigController.enableFading = true;
			cameraRigController.SetOverrideCam((ICameraStateProvider)null, 1f);
		}
		Debug.Log((object)"Exiting photo mode");
		Time.timeScale = 1f;
		((Component)Camera).transform.localPosition = Vector3.zero;
		((Component)Camera).transform.localRotation = Quaternion.identity;
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}

	private void SetIndicatorsVisible(bool visible)
	{
		Type nestedType = typeof(Indicator).GetNestedType("IndicatorManager", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		if (nestedType == null)
		{
			Debug.Log((object)"Failed to find indicatorManagerTypeInfo");
		}
		else
		{
			FieldInfo field = nestedType.GetField("runningIndicators", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			if (field == null)
			{
				Debug.Log((object)"Failed to find runningIndicatorsFieldInfo");
			}
			else
			{
				Debug.Log((object)field.ToString());
				object value = field.GetValue(null);
				if (value is List<Indicator>)
				{
					((List<Indicator>)value).ForEach(delegate(Indicator indicator)
					{
						indicator.SetVisualizerInstantiated(visible);
					});
				}
				if (!visible)
				{
					Reflection.GetFieldValue<ParticleSystem>((object)DamageNumberManager.instance, "ps").Clear(true);
				}
			}
		}
		((Behaviour)cameraRigController.hud.combatHealthBarViewer).enabled = visible;
		PingIndicator.instancesList.ForEach(delegate(PingIndicator pingIndicator)
		{
			((Component)pingIndicator).gameObject.SetActive(visible);
		});
		if (!visible)
		{
			cameraRigController.sprintingParticleSystem.Clear(true);
		}
	}

	private void Update()
	{
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: 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_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: 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_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_033e: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		UserProfile userProfile = cameraRigController.localUserViewer.userProfile;
		Player inputPlayer = cameraRigController.localUserViewer.inputPlayer;
		if (inputPlayer.GetButton(25))
		{
			ExitPhotoMode();
			return;
		}
		float mouseLookSensitivity = userProfile.mouseLookSensitivity;
		float mouseLookScaleX = userProfile.mouseLookScaleX;
		float mouseLookScaleY = userProfile.mouseLookScaleY;
		float axis = inputPlayer.GetAxis(23);
		float axis2 = inputPlayer.GetAxis(24);
		float num = 1f;
		if (gamepad)
		{
			num = 10f;
		}
		if ((gamepad && inputPlayer.GetButton(9)) || Input.GetMouseButton(1))
		{
			cameraState.fov = Mathf.Clamp(Camera.fieldOfView + mouseLookSensitivity * Time.unscaledDeltaTime * axis2 * num, 4f, 120f);
		}
		if ((gamepad && inputPlayer.GetButton(10)) || Input.GetMouseButton(2))
		{
			cameraState.roll += (0f - mouseLookScaleX) * mouseLookSensitivity * Time.unscaledDeltaTime * axis * num;
		}
		else
		{
			float value = mouseLookScaleX * mouseLookSensitivity * Time.unscaledDeltaTime * axis * num;
			float value2 = mouseLookScaleY * mouseLookSensitivity * Time.unscaledDeltaTime * axis2 * num;
			ConditionalNegate(ref value, userProfile.mouseLookInvertX);
			ConditionalNegate(ref value2, userProfile.mouseLookInvertY);
			float num2 = cameraState.roll * (MathF.PI / 180f);
			cameraState.yaw += cameraState.fov * (value * Mathf.Cos(num2) - value2 * Mathf.Sin(num2));
			cameraState.pitch += cameraState.fov * ((0f - value2) * Mathf.Cos(num2) - value * Mathf.Sin(num2));
			cameraState.pitch = Mathf.Clamp(cameraState.pitch, -89f, 89f);
		}
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(inputPlayer.GetAxis(0) * num, 0f, inputPlayer.GetAxis(1) * num);
		if ((gamepad && inputPlayer.GetButton(7)) || Input.GetKey((KeyCode)113))
		{
			val.y -= 1f;
		}
		if ((gamepad && inputPlayer.GetButton(8)) || Input.GetKey((KeyCode)101))
		{
			val.y += 1f;
		}
		((Vector3)(ref val)).Normalize();
		if (inputPlayer.GetButton("Sprint"))
		{
			val *= cameraSprintMultiplier;
		}
		if (Input.GetKey((KeyCode)306))
		{
			val *= cameraSlowMultiplier;
		}
		ref Vector3 position = ref cameraState.position;
		position += cameraState.Rotation * val * Time.unscaledDeltaTime * cameraSpeed;
		((Component)Camera).transform.position = cameraState.position;
		Quaternion val2 = cameraState.Rotation;
		if ((double)Mathf.Abs(((Quaternion)(ref val2)).eulerAngles.z) < 2.0)
		{
			val2 = val2.WithEulerAngles(null, null, 0f);
		}
		((Component)Camera).transform.rotation = val2;
		Camera.fieldOfView = cameraState.fov;
	}

	public void GetCameraState(CameraRigController cameraRigController, ref CameraState cameraState)
	{
	}

	private void ConditionalNegate(ref float value, bool condition)
	{
		value = (condition ? (0f - value) : value);
	}

	public bool IsHudAllowed(CameraRigController cameraRigController)
	{
		return false;
	}

	public bool IsUserControlAllowed(CameraRigController cameraRigController)
	{
		return false;
	}

	public bool IsUserLookAllowed(CameraRigController cameraRigController)
	{
		return false;
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.cwmlolzlz.photomode", "PhotoMode", "1.4.2")]
public class PhotoModePlugin : BaseUnityPlugin
{
	public CameraRigController cameraRigController;

	public static ConfigEntry<bool> disableIndicators;

	public void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_002b: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		disableIndicators = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Disable Ping Indicators In Photo Mode", "Disable"), false, new ConfigDescription("Enabling this can cause indicators to not reenable again until the scene is reloaded.", (AcceptableValueBase)null, Array.Empty<object>()));
		CameraRigController.OnEnable += (hook_OnEnable)delegate(orig_OnEnable orig, CameraRigController self)
		{
			orig.Invoke(self);
			cameraRigController = self;
		};
		CameraRigController.OnDisable += (hook_OnDisable)delegate(orig_OnDisable orig, CameraRigController self)
		{
			orig.Invoke(self);
			cameraRigController = null;
		};
		PauseScreenController.Awake += (hook_Awake)delegate(orig_Awake orig, PauseScreenController self)
		{
			orig.Invoke(self);
			SetupPhotoModeButton(self);
		};
	}

	private void SetupPhotoModeButton(PauseScreenController pauseScreenController)
	{
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Expected O, but got Unknown
		GameObject gameObject = ((Component)((Component)pauseScreenController).GetComponentInChildren<ButtonSkinController>()).gameObject;
		GameObject obj = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
		((Object)obj).name = "GenericMenuButton (Photo mode)";
		obj.transform.SetSiblingIndex(1);
		((Component)obj.GetComponent<ButtonSkinController>()).GetComponent<LanguageTextMeshController>().token = "相机";
		HGButton component = obj.GetComponent<HGButton>();
		((Selectable)component).interactable = cameraRigController.localUserViewer != null;
		for (int i = 0; i < ((UnityEventBase)((Button)component).onClick).GetPersistentEventCount(); i++)
		{
			Debug.Log((object)((UnityEventBase)((Button)component).onClick).GetPersistentMethodName(i).ToString());
			((UnityEventBase)((Button)component).onClick).SetPersistentListenerState(i, (UnityEventCallState)0);
		}
		((UnityEvent)((Button)component).onClick).AddListener((UnityAction)delegate
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new GameObject("PhotoModeController").AddComponent<PhotoModeController>().EnterPhotoMode(pauseScreenController, cameraRigController);
		});
	}
}
public static class QuaternionExtension
{
	public static Quaternion WithEulerAngles(this Quaternion quaternion, float? x = null, float? y = null, float? z = null)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 eulerAngles = ((Quaternion)(ref quaternion)).eulerAngles;
		((Vector3)(ref eulerAngles)).Set(x ?? eulerAngles.x, y ?? eulerAngles.y, z ?? eulerAngles.z);
		return Quaternion.Euler(eulerAngles);
	}
}

dll/QuickRestart.dll.old

Decompiled 3 days ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Booth;
using On.RoR2.UI;
using QuickRestart;
using R2API.Utils;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("QuickRestart")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QuickRestart")]
[assembly: AssemblyTitle("QuickRestart")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Booth
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.IkalaGaming.QuickRestart", "QuickRestart", "1.5.0")]
	public class QuickRestart : BaseUnityPlugin
	{
		private static KeyCode ResetKeyCode;

		private float TimeSpentHoldingKey = 0f;

		private float ResetKeyThreshold = 1f;

		private bool ResetAlready = false;

		private bool IsInChatBox = false;

		public static ConfigEntry<string> ConfigRestartButtonPosition { get; set; }

		public static ConfigEntry<string> ConfigCharacterButtonPosition { get; set; }

		public static ConfigEntry<bool> ConfigResetKeyEnabled { get; set; }

		public static ConfigEntry<string> ConfigResetKeyBind { get; set; }

		public static ConfigEntry<float> ConfigResetKeyHoldTime { get; set; }

		public static ConfigEntry<bool> ConfigConfirmationDialog { get; set; }

		public void SetupConfig()
		{
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			ConfigRestartButtonPosition = ((BaseUnityPlugin)this).Config.Bind<string>("Graphics", "RestartPosition", "bottom", "The position of the restart button in the pause menu. Options are 'top', 'bottom', or the number of positions away from the top, so '1' would be 1 below the top item and thus second in the list. Falls back to default if you give weird values.");
			ConfigCharacterButtonPosition = ((BaseUnityPlugin)this).Config.Bind<string>("Graphics", "CharacterPosition", "bottom", "The position of the character select button in the pause menu. Options are 'top', 'bottom', or the number of positions away from the top, so '1' would be 1 below the top item and thus second in the list. Falls back to default if you give weird values. Evaluated after the restart button is placed.");
			ConfigConfirmationDialog = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "ConfirmationDialogEnabled", false, "Enables a confirmation dialog when trying to reset so it is not done accidentally");
			ConfigResetKeyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Keybind", "ResetKeyEnabled", false, "Allows a key press to be used to reset runs in addition to the menu");
			ConfigResetKeyBind = ((BaseUnityPlugin)this).Config.Bind<string>("Keybind", "ResetKeyBind", "T", "The key that has to be pressed to reset. Falls back to default if you give weird values.");
			try
			{
				ResetKeyCode = (KeyCode)Enum.Parse(typeof(KeyCode), ConfigResetKeyBind.Value);
			}
			catch (Exception)
			{
				ResetKeyCode = (KeyCode)116;
			}
			ConfigResetKeyHoldTime = ((BaseUnityPlugin)this).Config.Bind<float>("Keybind", "ResetKeyHoldTime", 1f, "The number of seconds that the reset key has to be held in order to reset. Falls back to default if you give weird values.");
			if (ConfigResetKeyHoldTime.Value >= 0f)
			{
				ResetKeyThreshold = ConfigResetKeyHoldTime.Value;
			}
		}

		private void HandleResetKey()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKey(ResetKeyCode))
			{
				TimeSpentHoldingKey += Time.deltaTime;
				if (TimeSpentHoldingKey > ResetKeyThreshold && !ResetAlready)
				{
					PauseScreenController pauseScreen = null;
					if (PauseScreenController.instancesList.Count > 0)
					{
						pauseScreen = PauseScreenController.instancesList[0];
					}
					TimeSpentHoldingKey = 0f;
					ResetAlready = true;
					BoothUtil.ResetGame(pauseScreen, ConfigConfirmationDialog.Value, this, startNewGame: true);
				}
			}
			if (Input.GetKeyUp(ResetKeyCode))
			{
				TimeSpentHoldingKey = 0f;
				ResetAlready = false;
			}
		}

		private void Update()
		{
			if (ConfigResetKeyEnabled.Value)
			{
				bool flag = Run.instance != null;
				bool flag2 = PlayerCharacterMasterController.instances.Count > 1 && !BoothUtil.IsMultiplayerHost();
				if (flag && !flag2 && !IsInChatBox)
				{
					HandleResetKey();
				}
			}
		}

		public void Awake()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			SetupConfig();
			AssetBundle val;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("QuickRestart.booth_assets"))
			{
				val = AssetBundle.LoadFromStream(stream);
			}
			Texture2D val2 = val.LoadAsset<Texture2D>("Assets/Texture2D/Booth_texUICleanButton.png");
			Texture2D val3 = val.LoadAsset<Texture2D>("Assets/Texture2D/Booth_texUIOutlineOnly.png");
			Texture2D val4 = val.LoadAsset<Texture2D>("Assets/Texture2D/Booth_texUIHighlightBoxOutlineThick.png");
			Rect val5 = default(Rect);
			((Rect)(ref val5))..ctor(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height);
			Rect val6 = default(Rect);
			((Rect)(ref val6))..ctor(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height);
			Rect val7 = default(Rect);
			((Rect)(ref val7))..ctor(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height);
			Sprite.Create(val2, val5, new Vector2(0f, 0f));
			Sprite.Create(val3, val6, new Vector2(0f, 0f));
			Sprite.Create(val4, val7, new Vector2(0f, 0f));
			ChatBox.FocusInputField += (hook_FocusInputField)delegate(orig_FocusInputField orig, ChatBox self)
			{
				orig.Invoke(self);
				IsInChatBox = true;
			};
			ChatBox.UnfocusInputField += (hook_UnfocusInputField)delegate(orig_UnfocusInputField orig, ChatBox self)
			{
				orig.Invoke(self);
				IsInChatBox = false;
			};
			PauseScreenController.Awake += (hook_Awake)delegate(orig_Awake orig, PauseScreenController self)
			{
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Expected O, but got Unknown
				//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ba: Expected O, but got Unknown
				//IL_0304: Unknown result type (might be due to invalid IL or missing references)
				//IL_030e: Expected O, but got Unknown
				orig.Invoke(self);
				if (!((Object)(object)Run.instance == (Object)null) && !Object.op_Implicit((Object)(object)PreGameController.instance))
				{
					Transform child = ((Transform)self.mainPanel).GetChild(0).GetChild(0);
					Transform val8 = Object.Instantiate<Transform>(child, ((Transform)self.mainPanel).GetChild(0));
					HGTextMeshProUGUI componentInChildren = ((Component)val8).GetComponentInChildren<HGTextMeshProUGUI>();
					((TMP_Text)componentInChildren).text = "重开一轮";
					Transform parent = ((TMP_Text)componentInChildren).transform.parent;
					Object.Instantiate<TextMeshProUGUI>((TextMeshProUGUI)(object)componentInChildren, parent);
					Object.Destroy((Object)(object)componentInChildren);
					((UnityEventBase)((Button)((Component)val8).GetComponentInChildren<HGButton>()).onClick).RemoveAllListeners();
					((UnityEvent)((Button)((Component)val8).GetComponentInChildren<HGButton>()).onClick).AddListener((UnityAction)delegate
					{
						BoothUtil.ResetGame(self, ConfigConfirmationDialog.Value, this, startNewGame: true);
					});
					if ("top".Equals(ConfigRestartButtonPosition.Value, StringComparison.InvariantCultureIgnoreCase))
					{
						((Component)val8).transform.SetAsFirstSibling();
					}
					else if ("bottom".Equals(ConfigRestartButtonPosition.Value, StringComparison.InvariantCultureIgnoreCase))
					{
						((Component)val8).transform.SetAsLastSibling();
					}
					else
					{
						try
						{
							int num = Convert.ToInt32(ConfigRestartButtonPosition.Value);
							if (num < 0)
							{
								num = 0;
							}
							else if (num >= ((Component)val8).transform.parent.childCount)
							{
								num = ((Component)val8).transform.parent.childCount - 1;
							}
							((Component)val8).transform.SetSiblingIndex(num);
						}
						catch (FormatException)
						{
							((Component)val8).transform.SetAsLastSibling();
						}
					}
					if (PlayerCharacterMasterController.instances.Count > 1 && !BoothUtil.IsMultiplayerHost())
					{
						((Component)val8).gameObject.SetActive(false);
					}
					((UnityEvent)((Button)((Component)val8).GetComponent<HGButton>()).onClick).AddListener((UnityAction)delegate
					{
						BoothUtil.ResetGame(self, ConfigConfirmationDialog.Value, this, startNewGame: true);
					});
					Transform val9 = Object.Instantiate<Transform>(child, ((Transform)self.mainPanel).GetChild(0));
					HGTextMeshProUGUI componentInChildren2 = ((Component)val9).GetComponentInChildren<HGTextMeshProUGUI>();
					((TMP_Text)componentInChildren2).text = "选择角色";
					Transform parent2 = ((TMP_Text)componentInChildren2).transform.parent;
					Object.Instantiate<TextMeshProUGUI>((TextMeshProUGUI)(object)componentInChildren2, parent2);
					Object.Destroy((Object)(object)componentInChildren2);
					if ("top".Equals(ConfigCharacterButtonPosition.Value, StringComparison.InvariantCultureIgnoreCase))
					{
						((Component)val9).transform.SetAsFirstSibling();
					}
					else if ("bottom".Equals(ConfigCharacterButtonPosition.Value, StringComparison.InvariantCultureIgnoreCase))
					{
						((Component)val9).transform.SetAsLastSibling();
					}
					else
					{
						try
						{
							int num2 = Convert.ToInt32(ConfigCharacterButtonPosition.Value);
							if (num2 < 0)
							{
								num2 = 0;
							}
							else if (num2 >= ((Component)val9).transform.parent.childCount)
							{
								num2 = ((Component)val9).transform.parent.childCount - 1;
							}
							((Component)val9).transform.SetSiblingIndex(num2);
						}
						catch (FormatException)
						{
							((Component)val9).transform.SetAsLastSibling();
						}
					}
					if (PlayerCharacterMasterController.instances.Count > 1 && !BoothUtil.IsMultiplayerHost())
					{
						((Component)val9).gameObject.SetActive(false);
					}
					((UnityEventBase)((Button)((Component)val9).GetComponentInChildren<HGButton>()).onClick).RemoveAllListeners();
					((UnityEvent)((Button)((Component)val9).GetComponent<HGButton>()).onClick).AddListener((UnityAction)delegate
					{
						BoothUtil.ResetGame(self, ConfigConfirmationDialog.Value, this, startNewGame: false);
					});
				}
			};
		}

		static QuickRestart()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ResetKeyCode = (KeyCode)116;
		}
	}
}
namespace QuickRestart
{
	internal class BoothUtil
	{
		public static void ResetGame(PauseScreenController pauseScreen, bool AskConfirmation, Booth.QuickRestart parent, bool startNewGame)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			if (AskConfirmation)
			{
				if (SimpleDialogBox.instancesList.Count <= 0)
				{
					SimpleDialogBox val = SimpleDialogBox.Create((MPEventSystem)null);
					val.headerToken = new TokenParamsPair("Are you sure?", Array.Empty<object>());
					string text = "Are you sure you want to reset this run?";
					if (pauseScreen == null)
					{
						text += " Use info screen button (usually tab/select) to move cursor.";
					}
					val.descriptionToken = new TokenParamsPair(text, Array.Empty<object>());
					val.AddActionButton((UnityAction)delegate
					{
						ActuallyResetGame(pauseScreen, parent, startNewGame);
					}, "Yes", true, Array.Empty<object>());
					val.AddCancelButton("Cancel", Array.Empty<object>());
				}
			}
			else
			{
				ActuallyResetGame(pauseScreen, parent, startNewGame);
			}
		}

		public static bool IsMultiplayerHost()
		{
			return Object.op_Implicit((Object)(object)NetworkSession.instance) && NetworkServer.active;
		}

		private static void ActuallyResetGame(PauseScreenController pauseScreen, Booth.QuickRestart parent, bool startNewGame)
		{
			if (pauseScreen != null)
			{
				Reflection.InvokeMethod((object)pauseScreen, "OnDisable");
				Object.Destroy((Object)(object)((Component)pauseScreen).gameObject);
			}
			if (IsMultiplayerHost())
			{
				NetworkSession.instance.EndRun();
				if (startNewGame)
				{
					((MonoBehaviour)parent).StartCoroutine(StartNewGameMultiplayer());
				}
				return;
			}
			if (Run.instance != null && ((Component)Run.instance).gameObject != null)
			{
				Object.Destroy((Object)(object)((Component)Run.instance).gameObject);
			}
			if (startNewGame)
			{
				((MonoBehaviour)parent).StartCoroutine(StartNewGameSingleplayer());
			}
		}

		private static IEnumerator StartNewGameSingleplayer()
		{
			while (!Object.op_Implicit((Object)(object)PreGameController.instance))
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			Reflection.InvokeMethod((object)PreGameController.instance, "StartRun");
		}

		private static IEnumerator StartNewGameMultiplayer()
		{
			while (!Object.op_Implicit((Object)(object)PreGameController.instance))
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			PreGameController.instance.StartLaunch();
		}
	}
}

dll/ZetArtifacts.dll.old

Decompiled 3 days ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using IL.RoR2;
using IL.RoR2.UI;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.Artifacts;
using RoR2.ContentManagement;
using RoR2.UI;
using TMPro;
using TPDespair.ZetArtifacts.Properties;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ZetArtifacts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ZetArtifacts")]
[assembly: AssemblyTitle("ZetArtifacts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TPDespair.ZetArtifacts
{
	public static class DirectorCardManipulator
	{
		private delegate int DirectorCardReturnInt(DirectorCard self);

		[CompilerGenerated]
		private sealed class <>c__DisplayClass16_0
		{
			public int index;

			internal bool <IteractableCreditExpenditureHook>b__1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, ref index);
			}
		}

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

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

			public static Action<int, SceneDirector, DirectorCard> <>9__16_3;

			public static Manipulator <>9__16_0;

			internal void <IteractableCreditExpenditureHook>b__16_0(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0();
				ILCursor val = new ILCursor(il);
				CS$<>8__locals0.index = -1;
				if (val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.index),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DirectorCard>(x, "get_cost")
				}))
				{
					val.Index += 2;
					val.Emit(OpCodes.Dup);
					val.Emit(OpCodes.Ldarg, 0);
					val.Emit(OpCodes.Ldloc, CS$<>8__locals0.index);
					val.EmitDelegate<Action<int, SceneDirector, DirectorCard>>((Action<int, SceneDirector, DirectorCard>)delegate(int cost, SceneDirector director, DirectorCard card)
					{
						ZetArtifactsPlugin.LogInfo("[Manipulator] - SceneDirector : Spending " + cost + " of " + director.interactableCredit + " credits on " + ((Object)card.spawnCard).name);
					});
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[Manipulator] - IteractableCreditExpenditureHook failed!");
				}
			}

			internal bool <IteractableCreditExpenditureHook>b__16_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallvirt<DirectorCard>(x, "get_cost");
			}

			internal void <IteractableCreditExpenditureHook>b__16_3(int cost, SceneDirector director, DirectorCard card)
			{
				ZetArtifactsPlugin.LogInfo("[Manipulator] - SceneDirector : Spending " + cost + " of " + director.interactableCredit + " credits on " + ((Object)card.spawnCard).name);
			}
		}

		public static bool Active = false;

		private static readonly BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static DirectorCardReturnInt origDirectorCardCostGetter;

		private static readonly List<string> MonsterCardNames = new List<string>();

		private static readonly List<string> InteractableCardNames = new List<string>();

		private static readonly Dictionary<int, int> MonsterCostCache = new Dictionary<int, int>();

		private static readonly Dictionary<int, int> InteractableCostCache = new Dictionary<int, int>();

		internal static void Init()
		{
			Active = ZetHoardifact.State > 0 || ZetLoopifact.State > 0;
			if (Active)
			{
				SceneDirector.onPrePopulateSceneServer += OnPrePopScene;
				Run.onRunDestroyGlobal += OnRunDestroyed;
				DirectorCardCostHook();
				IteractableCreditExpenditureHook();
			}
		}

		internal static void LateSetup()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			if (Active)
			{
				if (ZetLoopifact.State > 0)
				{
					ClassicStageInfo.RebuildCards += new hook_RebuildCards(GatherMonsterCardsHook);
				}
				if (ZetHoardifact.State > 0)
				{
					SceneDirector.onGenerateInteractableCardSelection += GatherInteractableCards;
				}
			}
		}

		private static void OnPrePopScene(SceneDirector director)
		{
			MonsterCostCache.Clear();
			InteractableCostCache.Clear();
		}

		private static void OnRunDestroyed(Run run)
		{
			MonsterCostCache.Clear();
			InteractableCostCache.Clear();
		}

		private static void DirectorCardCostHook()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			MethodInfo method = typeof(DirectorCard).GetMethod("get_cost", flags);
			MethodInfo method2 = typeof(DirectorCardManipulator).GetMethod("GetCostHook", flags);
			Hook val = new Hook((MethodBase)method, method2);
			origDirectorCardCostGetter = val.GenerateTrampoline<DirectorCardReturnInt>();
		}

		private static int GetCostHook(DirectorCard directorCard)
		{
			int num = origDirectorCardCostGetter(directorCard);
			if (Active)
			{
				string name = ((Object)directorCard.spawnCard).name;
				if (ZetLoopifact.Enabled && MonsterCardNames.Contains(name))
				{
					return GetMonsterCostOverride(num);
				}
				if (ZetHoardifact.Enabled && InteractableCardNames.Contains(name))
				{
					return GetInteractableCostOverride(num);
				}
			}
			return num;
		}

		private static int GetMonsterCostOverride(int cost)
		{
			if (MonsterCostCache.ContainsKey(cost))
			{
				return MonsterCostCache[cost];
			}
			Run instance = Run.instance;
			if (Object.op_Implicit((Object)(object)instance) && instance.loopClearCount >= 2)
			{
				MonsterCostCache.Add(cost, cost);
				return cost;
			}
			int num = Mathf.RoundToInt(Mathf.Max(ZetArtifactsPlugin.LoopifactMonsterCostTarget.Value, 1f));
			float num2 = Mathf.Clamp(ZetArtifactsPlugin.LoopifactMonsterCostFactor.Value, 0f, 1f);
			if (num2 > 0f && cost > num)
			{
				int num3 = Mathf.FloorToInt(Mathf.Lerp((float)cost, (float)num, num2));
				ZetArtifactsPlugin.LogInfo("[Manipulator] - Override Monster DirectorCost : " + cost + " => " + num3);
				MonsterCostCache.Add(cost, num3);
				return num3;
			}
			MonsterCostCache.Add(cost, cost);
			return cost;
		}

		private static int GetInteractableCostOverride(int cost)
		{
			if (InteractableCostCache.ContainsKey(cost))
			{
				return InteractableCostCache[cost];
			}
			Run instance = Run.instance;
			if (Object.op_Implicit((Object)(object)instance) && instance.loopClearCount >= 2)
			{
				InteractableCostCache.Add(cost, cost);
				return cost;
			}
			int num = Mathf.RoundToInt(Mathf.Max(ZetArtifactsPlugin.HoardifactInteractableCostTarget.Value, 1f));
			float num2 = Mathf.Clamp(ZetArtifactsPlugin.HoardifactInteractableCostFactor.Value, 0f, 1f);
			if (num2 > 0f && cost > num)
			{
				int num3 = Mathf.FloorToInt(Mathf.Lerp((float)cost, (float)num, num2));
				ZetArtifactsPlugin.LogInfo("[Manipulator] - Override Interactable DirectorCost : " + cost + " => " + num3);
				InteractableCostCache.Add(cost, num3);
				return num3;
			}
			InteractableCostCache.Add(cost, cost);
			return cost;
		}

		private static void IteractableCreditExpenditureHook()
		{
			//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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__16_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Expected O, but got Unknown
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0082: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val2 = new ILCursor(il);
					int index = -1;
					if (val2.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref index),
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DirectorCard>(x, "get_cost")
					}))
					{
						val2.Index += 2;
						val2.Emit(OpCodes.Dup);
						val2.Emit(OpCodes.Ldarg, 0);
						val2.Emit(OpCodes.Ldloc, index);
						val2.EmitDelegate<Action<int, SceneDirector, DirectorCard>>((Action<int, SceneDirector, DirectorCard>)delegate(int cost, SceneDirector director, DirectorCard card)
						{
							ZetArtifactsPlugin.LogInfo("[Manipulator] - SceneDirector : Spending " + cost + " of " + director.interactableCredit + " credits on " + ((Object)card.spawnCard).name);
						});
					}
					else
					{
						ZetArtifactsPlugin.LogWarn("[Manipulator] - IteractableCreditExpenditureHook failed!");
					}
				};
				<>c.<>9__16_0 = val;
				obj = (object)val;
			}
			SceneDirector.PopulateScene += (Manipulator)obj;
		}

		private static void GatherMonsterCardsHook(orig_RebuildCards orig, ClassicStageInfo self)
		{
			orig.Invoke(self);
			GatherMonsterCards(self);
		}

		private static void GatherMonsterCards(ClassicStageInfo stageInfo)
		{
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			WeightedSelection<DirectorCard> monsterSelection = stageInfo.monsterSelection;
			if (monsterSelection == null)
			{
				return;
			}
			for (int i = 0; i < monsterSelection.Count; i++)
			{
				DirectorCard value = monsterSelection.GetChoice(i).value;
				SpawnCard spawnCard = value.spawnCard;
				if (!MonsterCardNames.Contains(((Object)spawnCard).name))
				{
					MonsterCardNames.Add(((Object)spawnCard).name);
				}
			}
		}

		private static void GatherInteractableCards(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
		{
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < dccs.categories.Length; i++)
			{
				Category val = dccs.categories[i];
				string name = val.name;
				if (!ApplyToCategory(name))
				{
					continue;
				}
				for (int num = val.cards.Length - 1; num >= 0; num--)
				{
					DirectorCard val2 = val.cards[num];
					SpawnCard spawnCard = val2.spawnCard;
					if (!InteractableCardNames.Contains(((Object)spawnCard).name))
					{
						InteractableCardNames.Add(((Object)spawnCard).name);
					}
				}
			}
		}

		private static bool ApplyToCategory(string name)
		{
			return name switch
			{
				"Chests" => true, 
				"Shrines" => true, 
				"Drones" => true, 
				"Misc" => true, 
				"Rare" => true, 
				"Duplicator" => true, 
				"Void Stuff" => true, 
				_ => false, 
			};
		}
	}
	public class ZetArtifactsContent : IContentPackProvider
	{
		public static class Artifacts
		{
			public static ArtifactDef ZetBazaarifact;

			public static ArtifactDef ZetRevivifact;

			public static ArtifactDef ZetMultifact;

			public static ArtifactDef ZetHoardifact;

			public static ArtifactDef ZetDropifact;

			public static ArtifactDef ZetLoopifact;

			public static ArtifactDef ZetEarlifact;

			public static ArtifactDef ZetEclifact;

			public static List<ArtifactDef> artifactDefs = new List<ArtifactDef>();

			public static void Create()
			{
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b4: 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_0343: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c9: 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_0468: Unknown result type (might be due to invalid IL or missing references)
				//IL_0481: Unknown result type (might be due to invalid IL or missing references)
				if (ZetArtifactsPlugin.BazaarifactEnable.Value == 1)
				{
					ZetBazaarifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetBazaarifact.cachedName = "ARTIFACT_ZETBAZAARIFACT";
					ZetBazaarifact.nameToken = "ARTIFACT_ZETBAZAARIFACT_NAME";
					ZetBazaarifact.descriptionToken = "ARTIFACT_ZETBAZAARIFACT_DESC";
					ZetBazaarifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetbazaar_selected, Color.magenta);
					ZetBazaarifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetbazaar_deselected, Color.gray);
					artifactDefs.Add(ZetBazaarifact);
				}
				if (ZetArtifactsPlugin.RivivifactEnable.Value == 1)
				{
					ZetRevivifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetRevivifact.cachedName = "ARTIFACT_ZETREVIVIFACT";
					ZetRevivifact.nameToken = "ARTIFACT_ZETREVIVIFACT_NAME";
					ZetRevivifact.descriptionToken = "ARTIFACT_ZETREVIVIFACT_DESC";
					ZetRevivifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetrevive_selected, Color.magenta);
					ZetRevivifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetrevive_deselected, Color.gray);
					artifactDefs.Add(ZetRevivifact);
				}
				if (ZetArtifactsPlugin.MultifactEnable.Value == 1)
				{
					ZetMultifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetMultifact.cachedName = "ARTIFACT_ZETMULTIFACT";
					ZetMultifact.nameToken = "ARTIFACT_ZETMULTIFACT_NAME";
					ZetMultifact.descriptionToken = "ARTIFACT_ZETMULTIFACT_DESC";
					ZetMultifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetmultitude_selected, Color.magenta);
					ZetMultifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetmultitude_deselected, Color.gray);
					artifactDefs.Add(ZetMultifact);
				}
				if (ZetArtifactsPlugin.HoardifactEnable.Value == 1 && !ZetArtifactsPlugin.HoardifactMerge.Value)
				{
					ZetHoardifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetHoardifact.cachedName = "ARTIFACT_ZETHOARDIFACT";
					ZetHoardifact.nameToken = "ARTIFACT_ZETHOARDIFACT_NAME";
					ZetHoardifact.descriptionToken = "ARTIFACT_ZETHOARDIFACT_DESC";
					ZetHoardifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zethoard_selected, Color.magenta);
					ZetHoardifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zethoard_deselected, Color.gray);
					artifactDefs.Add(ZetHoardifact);
				}
				if (ZetArtifactsPlugin.DropifactEnable.Value == 1)
				{
					ZetDropifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetDropifact.cachedName = "ARTIFACT_ZETDROPIFACT";
					ZetDropifact.nameToken = "ARTIFACT_ZETDROPIFACT_NAME";
					ZetDropifact.descriptionToken = "ARTIFACT_ZETDROPIFACT_DESC";
					ZetDropifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetdrop_selected, Color.magenta);
					ZetDropifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetdrop_deselected, Color.gray);
					artifactDefs.Add(ZetDropifact);
				}
				if (ZetArtifactsPlugin.LoopifactEnable.Value == 1)
				{
					ZetLoopifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetLoopifact.cachedName = "ARTIFACT_ZETLOOPIFACT";
					ZetLoopifact.nameToken = "ARTIFACT_ZETLOOPIFACT_NAME";
					ZetLoopifact.descriptionToken = "ARTIFACT_ZETLOOPIFACT_DESC";
					ZetLoopifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetloop_selected, Color.magenta);
					ZetLoopifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetloop_deselected, Color.gray);
					artifactDefs.Add(ZetLoopifact);
				}
				if (ZetArtifactsPlugin.EarlifactEnable.Value == 1 && !ZetArtifactsPlugin.EarlifactMerge.Value)
				{
					ZetEarlifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetEarlifact.cachedName = "ARTIFACT_ZETEARLIFACT";
					ZetEarlifact.nameToken = "ARTIFACT_ZETEARLIFACT_NAME";
					ZetEarlifact.descriptionToken = "ARTIFACT_ZETEARLIFACT_DESC";
					ZetEarlifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetearly_selected, Color.magenta);
					ZetEarlifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zetearly_deselected, Color.gray);
					artifactDefs.Add(ZetEarlifact);
				}
				if (ZetArtifactsPlugin.EclifactEnable.Value == 1 && !ZetArtifactsPlugin.PluginLoaded("com.TPDespair.DiluvianArtifact"))
				{
					ZetEclifact = ScriptableObject.CreateInstance<ArtifactDef>();
					ZetEclifact.cachedName = "ARTIFACT_ZETECLIFACT";
					ZetEclifact.nameToken = "ARTIFACT_ZETECLIFACT_NAME";
					ZetEclifact.descriptionToken = "ARTIFACT_ZETECLIFACT_DESC";
					ZetEclifact.smallIconSelectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zeteclipse_selected, Color.magenta);
					ZetEclifact.smallIconDeselectedSprite = ZetArtifactsPlugin.CreateSprite(Resources.zeteclipse_deselected, Color.gray);
					artifactDefs.Add(ZetEclifact);
				}
			}
		}

		public static class Elites
		{
			public static EliteDef PoisonEarly;

			public static EliteDef HauntedEarly;

			public static EliteDef LunarEarly;

			public static EliteDef AragonEarly;

			public static EliteDef BlightedEarly;

			public static List<EliteDef> eliteDefs = new List<EliteDef>();

			public static void Create()
			{
				if (ZetArtifactsPlugin.LoopifactEnable.Value != 0)
				{
					PoisonEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(PoisonEarly);
					HauntedEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(HauntedEarly);
					LunarEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(LunarEarly);
					AragonEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(AragonEarly);
					BlightedEarly = ScriptableObject.CreateInstance<EliteDef>();
					eliteDefs.Add(BlightedEarly);
				}
			}
		}

		public ContentPack contentPack = new ContentPack();

		public string identifier => "ZetArtifactsContent";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			Artifacts.Create();
			Elites.Create();
			AssignInternalArtifactDefReferences();
			contentPack.artifactDefs.Add(Artifacts.artifactDefs.ToArray());
			contentPack.eliteDefs.Add(Elites.eliteDefs.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}

		public static void AssignInternalArtifactDefReferences()
		{
			ZetBazaarifact.ArtifactDef = Artifacts.ZetBazaarifact;
			ZetRevivifact.ArtifactDef = Artifacts.ZetRevivifact;
			ZetMultifact.ArtifactDef = Artifacts.ZetMultifact;
			ZetHoardifact.ArtifactDef = ((!ZetArtifactsPlugin.HoardifactMerge.Value) ? Artifacts.ZetHoardifact : Artifacts.ZetMultifact);
			ZetDropifact.ArtifactDef = Artifacts.ZetDropifact;
			ZetLoopifact.ArtifactDef = Artifacts.ZetLoopifact;
			ZetEarlifact.ArtifactDef = ((!ZetArtifactsPlugin.EarlifactMerge.Value) ? Artifacts.ZetEarlifact : Artifacts.ZetLoopifact);
			ZetEclifact.ArtifactDef = Artifacts.ZetEclifact;
		}
	}
	[BepInPlugin("com.TPDespair.ZetArtifacts", "ZetArtifacts", "1.4.9")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[R2APISubmoduleDependency(new string[] { "LanguageAPI", "EliteAPI", "NetworkingAPI" })]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ZetArtifactsPlugin : BaseUnityPlugin
	{
		public const string ModVer = "1.4.9";

		public const string ModName = "ZetArtifacts";

		public const string ModGuid = "com.TPDespair.ZetArtifacts";

		public static ManualLogSource logSource;

		public static ConfigEntry<int> BazaarifactEnable { get; set; }

		public static ConfigEntry<bool> BazaarHomeExtraCauldrons { get; set; }

		public static ConfigEntry<int> RivivifactEnable { get; set; }

		public static ConfigEntry<int> MultifactEnable { get; set; }

		public static ConfigEntry<int> MultifactMultiplier { get; set; }

		public static ConfigEntry<int> HoardifactEnable { get; set; }

		public static ConfigEntry<bool> HoardifactMerge { get; set; }

		public static ConfigEntry<bool> HoardifactDifficulty { get; set; }

		public static ConfigEntry<float> HoardifactT1Effect { get; set; }

		public static ConfigEntry<float> HoardifactT2Effect { get; set; }

		public static ConfigEntry<float> HoardifactT3Effect { get; set; }

		public static ConfigEntry<float> HoardifactBossEffect { get; set; }

		public static ConfigEntry<float> HoardifactLunarEffect { get; set; }

		public static ConfigEntry<float> HoardifactPlayerExponent { get; set; }

		public static ConfigEntry<float> HoardifactSetupMoney { get; set; }

		public static ConfigEntry<float> HoardifactInteractableCostTarget { get; set; }

		public static ConfigEntry<float> HoardifactInteractableCostFactor { get; set; }

		public static ConfigEntry<int> DropifactEnable { get; set; }

		public static ConfigEntry<bool> DropifactBypassGround { get; set; }

		public static ConfigEntry<bool> DropifactRemoveScrapper { get; set; }

		public static ConfigEntry<bool> DropifactBazaarScrapper { get; set; }

		public static ConfigEntry<bool> DropifactAltScrap { get; set; }

		public static ConfigEntry<bool> DropifactT1 { get; set; }

		public static ConfigEntry<bool> DropifactT2 { get; set; }

		public static ConfigEntry<bool> DropifactT3 { get; set; }

		public static ConfigEntry<bool> DropifactBoss { get; set; }

		public static ConfigEntry<bool> DropifactLunar { get; set; }

		public static ConfigEntry<bool> DropifactVoidT1 { get; set; }

		public static ConfigEntry<bool> DropifactVoidT2 { get; set; }

		public static ConfigEntry<bool> DropifactVoidT3 { get; set; }

		public static ConfigEntry<bool> DropifactVoidBoss { get; set; }

		public static ConfigEntry<bool> DropifactVoidLunar { get; set; }

		public static ConfigEntry<bool> DropifactVoid { get; set; }

		public static ConfigEntry<bool> DropifactUnique { get; set; }

		public static ConfigEntry<int> LoopifactEnable { get; set; }

		public static ConfigEntry<int> LoopifactEliteLevel { get; set; }

		public static ConfigEntry<bool> LoopifactEliteClassic { get; set; }

		public static ConfigEntry<float> LoopifactEliteReplacementChance { get; set; }

		public static ConfigEntry<float> LoopifactEliteReplacementFactor { get; set; }

		public static ConfigEntry<float> LoopifactCombatMoney { get; set; }

		public static ConfigEntry<float> LoopifactMonsterCostTarget { get; set; }

		public static ConfigEntry<float> LoopifactMonsterCostFactor { get; set; }

		public static ConfigEntry<int> EarlifactEnable { get; set; }

		public static ConfigEntry<bool> EarlifactMerge { get; set; }

		public static ConfigEntry<int> EclifactEnable { get; set; }

		public void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			ConfigSetup(((BaseUnityPlugin)this).Config);
			logSource = ((BaseUnityPlugin)this).Logger;
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			ZetBazaarifact.Init();
			ZetRevivifact.Init();
			ZetMultifact.Init();
			ZetHoardifact.Init();
			ZetDropifact.Init();
			ZetLoopifact.Init();
			ZetEarlifact.Init();
			ZetEclifact.Init();
			DirectorCardManipulator.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LateSetup));
		}

		public void FixedUpdate()
		{
			ZetHoardifact.OnFixedUpdate();
		}

		private static void LateSetup()
		{
			ZetBazaarifact.LateSetup();
			ZetHoardifact.LateSetup();
			ZetDropifact.LateSetup();
			ZetLoopifact.LateSetup();
			DirectorCardManipulator.LateSetup();
		}

		private static void ConfigSetup(ConfigFile Config)
		{
			BazaarifactEnable = Config.Bind<int>("Artifacts", "bazaarifactEnable", 0, "Artifact of the Bazzar. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			BazaarHomeExtraCauldrons = Config.Bind<bool>("Artifacts", "bazaarHomeExtraCauldrons", true, "Allow additional cauldrons from BazaarIsMyHome even if artifact is available and not being used.");
			RivivifactEnable = Config.Bind<int>("Artifacts", "rivivifactEnable", 1, "Artifact of Revival. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			MultifactEnable = Config.Bind<int>("Artifacts", "multifactEnable", 1, "Artifact of Multitudes. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			MultifactMultiplier = Config.Bind<int>("Artifacts", "multifactMultiplier", 2, "Player count multiplier. Whole numbers only.");
			HoardifactEnable = Config.Bind<int>("Artifacts", "hoardifactEnable", 1, "Artifact of Accumulation. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			HoardifactMerge = Config.Bind<bool>("Artifacts", "hoardifactMerge", false, "Merge Accumulation into Multitudes. hoardifactEnable is ignored.");
			HoardifactDifficulty = Config.Bind<bool>("Artifacts", "hoardifactDifficulty", true, "Enable difficulty increase from items.");
			HoardifactT1Effect = Config.Bind<float>("Artifacts", "hoardifactT1Effect", 10f, "Amount of added time per T1 item.");
			HoardifactT2Effect = Config.Bind<float>("Artifacts", "hoardifactT2Effect", 20f, "Amount of added time per T2 item.");
			HoardifactT3Effect = Config.Bind<float>("Artifacts", "hoardifactT3Effect", 60f, "Amount of added time per T3 item.");
			HoardifactBossEffect = Config.Bind<float>("Artifacts", "hoardifactBossEffect", 40f, "Amount of added time per Boss item.");
			HoardifactLunarEffect = Config.Bind<float>("Artifacts", "hoardifactLunarEffect", 40f, "Amount of added time per Lunar item.");
			HoardifactPlayerExponent = Config.Bind<float>("Artifacts", "hoardifactPlayerExponent", 0.5f, "Total time is divided by true player count, then is multiplied by playercount to the exponent. Example : (60 seconds / 2 players) * (2 players ^ 0.5 exponent) = 42.4 seconds.");
			HoardifactSetupMoney = Config.Bind<float>("Artifacts", "hoardifactSetupMoney", 0.2f, "Increase scene director interactable credits. 0.2 = 20% increased credits.");
			HoardifactInteractableCostTarget = Config.Bind<float>("Artifacts", "HoardifactInteractableCostTarget", 20f, "Set Interactable SpawnCard DirectorCost target. Will make interactable spawn costs above value cheaper.");
			HoardifactInteractableCostFactor = Config.Bind<float>("Artifacts", "HoardifactInteractableCostFactor", 0.2f, "Modify Interactable SpawnCard DirectorCost towards target. Will only decrease cost. 0 = don't modify cost, 1 = set to target cost.");
			DropifactEnable = Config.Bind<int>("Artifacts", "dropifactEnable", 1, "Artifact of Tossing. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			DropifactBypassGround = Config.Bind<bool>("Artifacts", "dropifactBypassGround", false, "Drop items directly when Artifact of Command is active. If set to false, dropped items will grant a new command cube when Artifact of Command is active.");
			DropifactRemoveScrapper = Config.Bind<bool>("Artifacts", "dropifactRemoveScrapper", false, "Prevent scrappers from appearing while artifact is active.");
			DropifactBazaarScrapper = Config.Bind<bool>("Artifacts", "dropifactBazaarScrapper", false, "Adds a scrapper to the bazaar while artifact is active.");
			DropifactAltScrap = Config.Bind<bool>("Artifacts", "dropifactAltScrap", true, "Set to false to scrap with RMB instead of Alt+RMB.");
			DropifactT1 = Config.Bind<bool>("Artifacts", "dropifactT1", true, "Allow dropping non-void T1 items.");
			DropifactT2 = Config.Bind<bool>("Artifacts", "dropifactT2", true, "Allow dropping non-void T2 items.");
			DropifactT3 = Config.Bind<bool>("Artifacts", "dropifactT3", true, "Allow dropping non-void T3 items.");
			DropifactBoss = Config.Bind<bool>("Artifacts", "dropifactBoss", true, "Allow dropping non-void boss items.");
			DropifactLunar = Config.Bind<bool>("Artifacts", "dropifactLunar", true, "Allow dropping non-void lunar items.");
			DropifactVoidT1 = Config.Bind<bool>("Artifacts", "dropifactVoidT1", true, "Allow dropping void T1 items.");
			DropifactVoidT2 = Config.Bind<bool>("Artifacts", "dropifactVoidT2", true, "Allow dropping void T2 items.");
			DropifactVoidT3 = Config.Bind<bool>("Artifacts", "dropifactVoidT3", true, "Allow dropping void T3 items.");
			DropifactVoidBoss = Config.Bind<bool>("Artifacts", "dropifactVoidBoss", true, "Allow dropping void boss items.");
			DropifactVoidLunar = Config.Bind<bool>("Artifacts", "dropifactVoidLunar", true, "Allow dropping void lunar items.");
			DropifactVoid = Config.Bind<bool>("Artifacts", "dropifactVoid", true, "Allow dropping ANY void items. Setting this to false will prevent ALL void items from being dropable.");
			DropifactUnique = Config.Bind<bool>("Artifacts", "dropifactUnique", true, "Allow dropping WorldUnique items.");
			LoopifactEnable = Config.Bind<int>("Artifacts", "loopifactEnable", 1, "Artifact of Escalation. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			LoopifactEliteLevel = Config.Bind<int>("Artifacts", "loopifactEliteLevel", 10, "Ambient level for T2 elites to spawn during first loop. -1 to disable early T2 elites.");
			LoopifactEliteClassic = Config.Bind<bool>("Artifacts", "loopifactEliteClassic", true, "Change cost, health, and damage values to 35% towards T2 elite values instead of equal to T1 elite values.");
			LoopifactEliteReplacementChance = Config.Bind<float>("Artifacts", "loopifactEliteReplacementChance", 0.1f, "Base chance that a T1 Elite will be changed into a random early T2 Elite. 0.1 = 10% chance.");
			LoopifactEliteReplacementFactor = Config.Bind<float>("Artifacts", "loopifactEliteReplacementFactor", 0.35f, "Every mod that adds t1 Elites increases replacment chance. Chance = 1 - ((1 - ReplacementChance) ^ (1 + (ModCount * ReplacementFactor)))");
			LoopifactCombatMoney = Config.Bind<float>("Artifacts", "loopifactCombatMoney", 0.1f, "Increase combat director monster credits. 0.1 = 10% increased credits.");
			LoopifactMonsterCostTarget = Config.Bind<float>("Artifacts", "loopifactMonsterCostTarget", 200f, "Set Monster SpawnCard DirectorCost target. Will make monster spawn costs above value cheaper.");
			LoopifactMonsterCostFactor = Config.Bind<float>("Artifacts", "loopifactMonsterCostFactor", 0.2f, "Modify Monster SpawnCard DirectorCost towards target. Will only decrease cost. 0 = don't modify cost, 1 = set to target cost.");
			EarlifactEnable = Config.Bind<int>("Artifacts", "earlifactEnable", 1, "Artifact of Sanction 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
			EarlifactMerge = Config.Bind<bool>("Artifacts", "earlifactMerge", false, "Merge Sanction into Escalation. earlifactEnable is ignored.");
			EclifactEnable = Config.Bind<int>("Artifacts", "eclifactEnable", 1, "Artifact of the Eclipse. 0 = Disabled, 1 = Artifact Available, 2 = Always Active");
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new ZetArtifactsContent());
		}

		internal static void LogInfo(object data)
		{
			logSource.LogInfo(data);
		}

		internal static void LogWarn(object data)
		{
			logSource.LogWarning(data);
		}

		internal static void LogError(object data)
		{
			logSource.LogError(data);
		}

		internal static void RegisterToken(string token, string text)
		{
			LanguageAPI.Add(token, text);
		}

		internal static bool ArtifactEnabled(ArtifactDef artifactDef)
		{
			return Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(artifactDef);
		}

		internal static bool PluginLoaded(string key)
		{
			return Chainloader.PluginInfos.ContainsKey(key);
		}

		internal static Sprite CreateSprite(byte[] resourceBytes, Color fallbackColor)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_004d: 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_007f: 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)
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false);
			try
			{
				if (resourceBytes == null)
				{
					FillTexture(val, fallbackColor);
				}
				else
				{
					ImageConversion.LoadImage(val, resourceBytes, false);
					val.Apply();
					CleanAlpha(val);
				}
			}
			catch (Exception ex)
			{
				LogError(ex.ToString());
				FillTexture(val, fallbackColor);
			}
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(31f, 31f));
		}

		private static Texture2D FillTexture(Texture2D tex, Color color)
		{
			//IL_000f: 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)
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				pixels[i] = color;
			}
			tex.SetPixels(pixels);
			tex.Apply();
			return tex;
		}

		private static Texture2D CleanAlpha(Texture2D tex)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				if (pixels[i].a < 0.05f)
				{
					pixels[i] = Color.clear;
				}
			}
			tex.SetPixels(pixels);
			tex.Apply();
			return tex;
		}
	}
	public static class ZetBazaarifact
	{
		private static readonly BindingFlags Flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static int State = 0;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		internal static void Init()
		{
			State = ZetArtifactsPlugin.BazaarifactEnable.Value;
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETBAZAARIFACT_NAME", "Artifact of the Bazaar");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETBAZAARIFACT_DESC", "The Bazaar Between Time contains a larger variety of interactables.");
			}
		}

		internal static void LateSetup()
		{
			if (State == 1)
			{
				if (ZetArtifactsPlugin.PluginLoaded("com.MagnusMagnuson.BiggerBazaar"))
				{
					BiggerBazaar();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.MagnusMagnuson.BazaarPrinter"))
				{
					BazaarPrinter();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.NetherCrowCSOLYOO.BazaarExpand"))
				{
					BazaarExpand();
				}
				if (ZetArtifactsPlugin.PluginLoaded("KevinPione.BazaareScrapper"))
				{
					BazaareScrapper();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.zorp.ConfigurableBazaar"))
				{
					ConfigurableBazaar();
				}
				if (ZetArtifactsPlugin.PluginLoaded("com.Lunzir.BazaarIsMyHome"))
				{
					BazaarIsMyHome();
				}
			}
		}

		private static void BiggerBazaar()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.MagnusMagnuson.BiggerBazaar"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("isCurrentStageBazaar", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(BiggerBazaarHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BiggerBazaar.isCurrentStageBazaar");
			}
		}

		private static void BazaarPrinter()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.MagnusMagnuson.BazaarPrinter"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("SpawnPrinters", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaarPrinter.SpawnPrinters");
			}
		}

		private static void BazaarExpand()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.NetherCrowCSOLYOO.BazaarExpand"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("SpawnExpand", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaarExpand.SpawnExpand");
			}
		}

		private static void BazaareScrapper()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["KevinPione.BazaareScrapper"].Instance;
			MethodInfo method = ((object)instance).GetType().GetMethod("SpawnScrapper", Flags);
			if (method != null)
			{
				HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaareScrapper.SpawnScrapper");
			}
		}

		private static void ConfigurableBazaar()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.zorp.ConfigurableBazaar"].Instance;
			Type type = ((object)instance).GetType();
			List<string> list = new List<string> { "SpawnScrapper", "SpawnCleansingPool", "SpawnPrinters" };
			foreach (string item in list)
			{
				MethodInfo method = type.GetMethod(item, Flags);
				if (method != null)
				{
					HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : ConfigurableBazaar." + item);
				}
			}
		}

		private static void BazaarIsMyHome()
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.Lunzir.BazaarIsMyHome"].Instance;
			Type type = ((object)instance).GetType();
			List<string> list = new List<string> { "SpawnPrinters", "SpawnScrapper", "SpawnEquipment", "SpawnShrineCleanse", "SpawnShrineRestack", "SpawnShrineHealing" };
			if (!ZetArtifactsPlugin.BazaarHomeExtraCauldrons.Value)
			{
				list.Add("SpawnLunarCauldron");
			}
			foreach (string item in list)
			{
				MethodInfo method = type.GetMethod(item, Flags);
				if (method != null)
				{
					HookEndpointManager.Modify((MethodBase)method, (Delegate)new Manipulator(GenericReturnHook));
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - Could Not Find Method : BazaarIsMyHome." + item);
				}
			}
		}

		private static void BiggerBazaarHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchRet(x)
			}))
			{
				val2 = val.MarkLabel();
				val.Index = 0;
				val.EmitDelegate<Func<bool>>((Func<bool>)(() => Enabled));
				val.Emit(OpCodes.Brfalse, (object)val2);
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - BiggerBazaarHook Failed");
			}
		}

		private static void GenericReturnHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchRet(x)
			}))
			{
				val2 = val.MarkLabel();
				val.Index = 0;
				val.EmitDelegate<Func<bool>>((Func<bool>)(() => Enabled));
				val.Emit(OpCodes.Brfalse, (object)val2);
			}
			else
			{
				ZetArtifactsPlugin.LogWarn("[ZetBazaarifact] - GenericReturnHook Failed");
			}
		}
	}
	public class ZetDropHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		public Func<ItemIndex> GetItemIndex { get; set; }

		public Func<Inventory> GetInventory { get; set; }

		public bool EquipmentIcon { get; set; }

		public void OnPointerClick(PointerEventData eventData)
		{
			ZetDropifact.HandlePointerClick(this, eventData);
		}
	}
	public class ZetDropReply : INetMessage, ISerializableObject
	{
		public CharacterBody Body;

		public int DropType;

		public int Index;

		public void Serialize(NetworkWriter writer)
		{
			writer.Write(((Component)Body).gameObject);
			writer.Write(DropType);
			writer.Write(Index);
		}

		public void Deserialize(NetworkReader reader)
		{
			Body = reader.ReadGameObject().GetComponent<CharacterBody>();
			DropType = reader.ReadInt32();
			Index = reader.ReadInt32();
		}

		public void OnReceived()
		{
			if (!NetworkServer.active)
			{
				ZetDropifact.HandleServerReply(this);
			}
		}
	}
	public class ZetDropRequest : INetMessage, ISerializableObject
	{
		public CharacterBody Body;

		public int DropType;

		public int Index;

		public float Angle;

		public void Serialize(NetworkWriter writer)
		{
			writer.Write(((Component)Body).gameObject);
			writer.Write(DropType);
			writer.Write(Index);
			writer.Write(Angle);
		}

		public void Deserialize(NetworkReader reader)
		{
			Body = reader.ReadGameObject().GetComponent<CharacterBody>();
			DropType = reader.ReadInt32();
			Index = reader.ReadInt32();
			Angle = reader.ReadSingle();
		}

		public void OnReceived()
		{
			if (NetworkServer.active && ZetDropifact.HandleClientRequest(this))
			{
				ZetDropReply zetDropReply = new ZetDropReply
				{
					Body = Body,
					DropType = DropType,
					Index = Index
				};
				NetMessageExtensions.Send((INetMessage)(object)zetDropReply, (NetworkDestination)1);
			}
		}
	}
	public static class ZetDropifact
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

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

			public static Func<ItemIcon, ItemIcon> <>9__30_4;

			public static Manipulator <>9__30_0;

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

			public static Action<ScoreboardStrip> <>9__32_2;

			public static Manipulator <>9__32_0;

			internal void <ItemIconHook>b__30_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 1),
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons")
				});
				val.EmitDelegate<Func<ItemIcon, ItemIcon>>((Func<ItemIcon, ItemIcon>)delegate(ItemIcon icon)
				{
					AttachZetDropHandler(icon);
					return icon;
				});
			}

			internal bool <ItemIconHook>b__30_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchStloc(x, 1);
			}

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

			internal bool <ItemIconHook>b__30_3(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons");
			}

			internal ItemIcon <ItemIconHook>b__30_4(ItemIcon icon)
			{
				AttachZetDropHandler(icon);
				return icon;
			}

			internal void <EquipmentIconHook>b__32_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<ItemInventoryDisplay>(x, "SetSubscribedInventory")
				});
				val.Index += 1;
				val.Emit(OpCodes.Ldarg, 0);
				val.EmitDelegate<Action<ScoreboardStrip>>((Action<ScoreboardStrip>)delegate(ScoreboardStrip strip)
				{
					if ((Object)(object)strip.equipmentIcon != (Object)null)
					{
						AttachZetDropHandler(strip.equipmentIcon);
					}
				});
			}

			internal bool <EquipmentIconHook>b__32_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallvirt<ItemInventoryDisplay>(x, "SetSubscribedInventory");
			}

			internal void <EquipmentIconHook>b__32_2(ScoreboardStrip strip)
			{
				if ((Object)(object)strip.equipmentIcon != (Object)null)
				{
					AttachZetDropHandler(strip.equipmentIcon);
				}
			}
		}

		public static CharacterBody LocalBody;

		public static ItemIndex ArtifactKeyIndex = (ItemIndex)(-1);

		public static ItemIndex LunarScrapIndex = (ItemIndex)(-1);

		public static ItemTier LunarVoidTier = (ItemTier)10;

		public static bool appliedVoidBearFix = false;

		private static int State = 0;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		internal static void Init()
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			State = ZetArtifactsPlugin.DropifactEnable.Value;
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETDROPIFACT_NAME", "Artifact of Tossing");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETDROPIFACT_DESC", "Allows players to drop and scrap items.\n\n<style=cStack>" + (ZetArtifactsPlugin.DropifactAltScrap.Value ? "LeftAlt + " : "") + "RMB to scrap</style>");
				NetworkingAPI.RegisterMessageType<ZetDropReply>();
				NetworkingAPI.RegisterMessageType<ZetDropRequest>();
				ItemIconHook();
				EquipmentIconHook();
				SceneDirector.onGenerateInteractableCardSelection += RemoveScrapperCard;
				BazaarController.Start += new hook_Start(AddBazaarScrapper);
			}
		}

		internal static void LateSetup()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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: Invalid comparison between Unknown and I4
			//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_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)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			if (State >= 1)
			{
				ItemIndex val = ItemCatalog.FindItemIndex("ArtifactKey");
				if ((int)val != -1)
				{
					ArtifactKeyIndex = val;
				}
				val = ItemCatalog.FindItemIndex("ScrapLunar");
				if ((int)val != -1)
				{
					LunarScrapIndex = val;
				}
				ItemTierDef val2 = ItemTierCatalog.FindTierDef("VoidLunarTierDef");
				if (Object.op_Implicit((Object)(object)val2))
				{
					LunarVoidTier = val2.tier;
				}
				if (!ZetArtifactsPlugin.PluginLoaded("com.TPDespair.ZetAspects"))
				{
					CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(VoidBearFix_AddTimedBuff);
					CharacterBody.RemoveBuff_BuffIndex += new hook_RemoveBuff_BuffIndex(VoidBearFix_RemoveBuff);
					appliedVoidBearFix = true;
				}
			}
		}

		internal static void HandlePointerClick(ZetDropHandler handler, PointerEventData eventData)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Invalid comparison between Unknown and I4
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: 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_00fa: Expected I4, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected I4, but got Unknown
			if (!Enabled)
			{
				return;
			}
			Inventory val = handler.GetInventory();
			if (!Object.op_Implicit((Object)(object)val) || !((NetworkBehaviour)val).hasAuthority)
			{
				return;
			}
			CharacterMaster component = ((Component)val).GetComponent<CharacterMaster>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			CharacterBody body = component.GetBody();
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			bool flag = (!ZetArtifactsPlugin.DropifactAltScrap.Value || Input.GetKey((KeyCode)308)) && (int)eventData.button == 1;
			float aimAngle = GetAimAngle(body);
			if (!NetworkServer.active)
			{
				ZetDropRequest zetDropRequest;
				if (handler.EquipmentIcon)
				{
					EquipmentIndex equipmentIndex = val.GetEquipmentIndex();
					if (!ValidDropRequest(equipmentIndex, flag))
					{
						return;
					}
					zetDropRequest = new ZetDropRequest
					{
						Body = body,
						DropType = 2,
						Index = (int)equipmentIndex,
						Angle = aimAngle
					};
				}
				else
				{
					ItemIndex val2 = handler.GetItemIndex();
					if (!ValidDropRequest(val2, flag))
					{
						return;
					}
					zetDropRequest = new ZetDropRequest
					{
						Body = body,
						DropType = (flag ? 1 : 0),
						Index = (int)val2,
						Angle = aimAngle
					};
				}
				LocalBody = body;
				NetMessageExtensions.Send((INetMessage)(object)zetDropRequest, (NetworkDestination)2);
			}
			else if (handler.EquipmentIcon)
			{
				EquipmentIndex equipmentIndex2 = val.GetEquipmentIndex();
				if (ValidDropRequest(equipmentIndex2, flag) && DropItem(body, val, equipmentIndex2, aimAngle))
				{
					CreateNotification(body, equipmentIndex2);
				}
			}
			else
			{
				ItemIndex index = handler.GetItemIndex();
				if (ValidDropRequest(index, flag) && DropItem(body, val, index, aimAngle, flag))
				{
					CreateNotification(body, index, flag);
				}
			}
		}

		internal static void HandleServerReply(ZetDropReply dropReply)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			if (!Enabled)
			{
				return;
			}
			CharacterBody body = dropReply.Body;
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)LocalBody) || (Object)(object)body != (Object)(object)LocalBody)
			{
				return;
			}
			Inventory inventory = body.inventory;
			if (Object.op_Implicit((Object)(object)inventory))
			{
				if (dropReply.DropType == 2)
				{
					EquipmentIndex index = (EquipmentIndex)dropReply.Index;
					CreateNotification(body, index);
				}
				else
				{
					bool scrap = dropReply.DropType == 1;
					ItemIndex index2 = (ItemIndex)dropReply.Index;
					CreateNotification(body, index2, scrap);
				}
			}
		}

		internal static bool HandleClientRequest(ZetDropRequest dropRequest)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled)
			{
				return false;
			}
			CharacterBody body = dropRequest.Body;
			if (!Object.op_Implicit((Object)(object)body))
			{
				return false;
			}
			Inventory inventory = body.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return false;
			}
			if (dropRequest.DropType == 2)
			{
				EquipmentIndex index = (EquipmentIndex)dropRequest.Index;
				if (!ValidDropRequest(index, scrap: false))
				{
					return false;
				}
				if (DropItem(body, inventory, index, dropRequest.Angle))
				{
					return true;
				}
			}
			else
			{
				bool scrap = dropRequest.DropType == 1;
				ItemIndex index2 = (ItemIndex)dropRequest.Index;
				if (!ValidDropRequest(index2, scrap))
				{
					return false;
				}
				if (DropItem(body, inventory, index2, dropRequest.Angle, scrap))
				{
					return true;
				}
			}
			return false;
		}

		private static bool ValidDropRequest(EquipmentIndex index, bool scrap)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)index == -1)
			{
				return false;
			}
			if (scrap)
			{
				return false;
			}
			return true;
		}

		private static bool ValidDropRequest(ItemIndex index, bool scrap)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if ((int)index == -1)
			{
				return false;
			}
			if (index == ArtifactKeyIndex && scrap)
			{
				return false;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef(index);
			if ((int)itemDef.tier == 5)
			{
				return false;
			}
			if (IsDropRestricted(itemDef.tier))
			{
				return false;
			}
			if (!ZetArtifactsPlugin.DropifactUnique.Value && itemDef.ContainsTag((ItemTag)9))
			{
				return false;
			}
			if (scrap)
			{
				return IsScrapable(itemDef.tier);
			}
			return true;
		}

		private static bool IsScrapable(ItemTier tier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected I4, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Invalid comparison between Unknown and I4
			if ((int)LunarVoidTier != 10 && tier == LunarVoidTier)
			{
				return false;
			}
			switch ((int)tier)
			{
			case 0:
			case 1:
			case 2:
			case 4:
				return true;
			case 3:
				if ((int)LunarScrapIndex != -1)
				{
					return true;
				}
				return false;
			case 6:
			case 7:
			case 8:
			case 9:
				return false;
			default:
				return false;
			}
		}

		private static bool IsDropRestricted(ItemTier tier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Invalid comparison between Unknown and I4
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Invalid comparison between Unknown and I4
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Invalid comparison between Unknown and I4
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Invalid comparison between Unknown and I4
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (IsVoidTier(tier))
			{
				if (!ZetArtifactsPlugin.DropifactVoid.Value)
				{
					return true;
				}
				if ((int)tier == 6)
				{
					return !ZetArtifactsPlugin.DropifactVoidT1.Value;
				}
				if ((int)tier == 7)
				{
					return !ZetArtifactsPlugin.DropifactVoidT2.Value;
				}
				if ((int)tier == 8)
				{
					return !ZetArtifactsPlugin.DropifactVoidT3.Value;
				}
				if ((int)tier == 9)
				{
					return !ZetArtifactsPlugin.DropifactVoidBoss.Value;
				}
				if ((int)LunarVoidTier != 10 && tier == LunarVoidTier)
				{
					return !ZetArtifactsPlugin.DropifactVoidLunar.Value;
				}
			}
			else
			{
				if ((int)tier == 0)
				{
					return !ZetArtifactsPlugin.DropifactT1.Value;
				}
				if ((int)tier == 1)
				{
					return !ZetArtifactsPlugin.DropifactT2.Value;
				}
				if ((int)tier == 2)
				{
					return !ZetArtifactsPlugin.DropifactT3.Value;
				}
				if ((int)tier == 4)
				{
					return !ZetArtifactsPlugin.DropifactBoss.Value;
				}
				if ((int)tier == 3)
				{
					return !ZetArtifactsPlugin.DropifactLunar.Value;
				}
			}
			return false;
		}

		private static bool IsVoidTier(ItemTier tier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)tier == 6)
			{
				return true;
			}
			if ((int)tier == 7)
			{
				return true;
			}
			if ((int)tier == 8)
			{
				return true;
			}
			if ((int)tier == 9)
			{
				return true;
			}
			if ((int)LunarVoidTier != 10 && tier == LunarVoidTier)
			{
				return true;
			}
			return false;
		}

		private static int GetRealItemCount(Inventory inventory, ItemIndex itemIndex)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected I4, but got Unknown
			return ArrayUtils.GetSafe<int>(inventory.itemStacks, (int)itemIndex);
		}

		private static bool DropItem(CharacterBody body, Inventory inventory, EquipmentIndex index, float angle)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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)
			if (inventory.GetEquipmentIndex() != index)
			{
				return false;
			}
			inventory.SetEquipmentIndex((EquipmentIndex)(-1));
			CreateDroplet(index, body.transform.position, angle);
			return true;
		}

		private static bool DropItem(CharacterBody body, Inventory inventory, ItemIndex index, float angle, bool scrap)
		{
			//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_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected I4, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex val = index;
			if (GetRealItemCount(inventory, index) <= 0)
			{
				return false;
			}
			if (scrap)
			{
				ItemTier tier = ItemCatalog.GetItemDef(index).tier;
				ItemTier val2 = tier;
				switch ((int)val2)
				{
				case 0:
					val = Items.ScrapWhite.itemIndex;
					break;
				case 1:
					val = Items.ScrapGreen.itemIndex;
					break;
				case 2:
					val = Items.ScrapRed.itemIndex;
					break;
				case 4:
					val = Items.ScrapYellow.itemIndex;
					break;
				case 3:
					if ((int)LunarScrapIndex != -1)
					{
						val = LunarScrapIndex;
					}
					break;
				default:
					return false;
				}
			}
			if ((int)val == -1)
			{
				return false;
			}
			inventory.RemoveItem(index, 1);
			CreateDroplet(val, body.transform.position, angle);
			return true;
		}

		private static float GetAimAngle(CharacterBody body)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			InputBankTest inputBank = body.inputBank;
			if (Object.op_Implicit((Object)(object)inputBank))
			{
				Vector3 aimDirection = inputBank.aimDirection;
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(aimDirection.x, 0f, aimDirection.z);
				return Vector3.SignedAngle(Vector3.forward, val, Vector3.up);
			}
			return 0f;
		}

		private static void CreateDroplet(EquipmentIndex index, Vector3 pos, float angle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CreateDroplet(PickupCatalog.FindPickupIndex(index), pos, angle);
		}

		private static void CreateDroplet(ItemIndex index, Vector3 pos, float angle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CreateDroplet(PickupCatalog.FindPickupIndex(index), pos, angle);
		}

		private static void CreateDroplet(PickupIndex index, Vector3 pos, float angle)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			CreateMarkedPickupDroplet(index, pos, Vector3.up * 20f + Quaternion.AngleAxis(angle, Vector3.up) * (Vector3.forward * 10f));
		}

		private static void CreateMarkedPickupDroplet(PickupIndex pickupIndex, Vector3 position, Vector3 velocity)
		{
			//IL_0003: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			CreatePickupInfo val = default(CreatePickupInfo);
			val.rotation = Quaternion.identity;
			((CreatePickupInfo)(ref val)).pickupIndex = pickupIndex;
			CreatePickupInfo createPickupInfo = val;
			if (!ZetArtifactsPlugin.DropifactBypassGround.Value && CommandArtifactManager.IsCommandArtifactEnabled)
			{
				ref PickupArtifactFlag artifactFlag = ref createPickupInfo.artifactFlag;
				artifactFlag = (PickupArtifactFlag)((uint)artifactFlag | 1u);
			}
			GameObject val2 = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, position, Quaternion.identity);
			PickupDropletController component = val2.GetComponent<PickupDropletController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.createPickupInfo = createPickupInfo;
				component.NetworkpickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex;
			}
			Rigidbody component2 = val2.GetComponent<Rigidbody>();
			component2.velocity = velocity;
			component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere);
			NetworkServer.Spawn(val2);
		}

		private static void CreateNotification(CharacterBody body, EquipmentIndex index)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(index);
			string @string = Language.GetString(equipmentDef.nameToken);
			Texture pickupIconTexture = equipmentDef.pickupIconTexture;
			CreateNotification(body, "丢弃了装备", @string, pickupIconTexture);
		}

		private static void CreateNotification(CharacterBody body, ItemIndex index, bool scrap)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ItemDef itemDef = ItemCatalog.GetItemDef(index);
			string title = (scrap ? "废弃了物品" : "丢弃了物品");
			string @string = Language.GetString(itemDef.nameToken);
			Texture pickupIconTexture = itemDef.pickupIconTexture;
			CreateNotification(body, title, @string, pickupIconTexture);
		}

		private static void CreateNotification(CharacterBody body, string title, string description, Texture texture)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Notification val = ((Component)body).gameObject.AddComponent<Notification>();
			if (Object.op_Implicit((Object)(object)val))
			{
				((Component)val).transform.SetParent(body.transform);
				float num = (float)Screen.width * 0.8f;
				float num2 = (float)Screen.height * 0.25f;
				val.SetPosition(new Vector3(num, num2, 0f));
				val.SetIcon(texture);
				val.GetTitle = () => title;
				val.GetDescription = () => description;
				Object.Destroy((Object)(object)val, 4.25f);
			}
		}

		private static void ItemIconHook()
		{
			//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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__30_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val2 = new ILCursor(il);
					val2.GotoNext(new Func<Instruction, bool>[3]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 1),
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons")
					});
					val2.EmitDelegate<Func<ItemIcon, ItemIcon>>((Func<ItemIcon, ItemIcon>)delegate(ItemIcon icon)
					{
						AttachZetDropHandler(icon);
						return icon;
					});
				};
				<>c.<>9__30_0 = val;
				obj = (object)val;
			}
			ItemInventoryDisplay.AllocateIcons += (Manipulator)obj;
		}

		private static void AttachZetDropHandler(ItemIcon icon)
		{
			if (!((Object)(object)((Component)icon).GetComponent<ZetDropHandler>() != (Object)null))
			{
				ZetDropHandler zetDropHandler = ((Component)((Component)icon).transform).gameObject.AddComponent<ZetDropHandler>();
				zetDropHandler.GetItemIndex = () => Reflection.GetFieldValue<ItemIndex>((object)icon, "itemIndex");
				zetDropHandler.GetInventory = () => Reflection.GetFieldValue<Inventory>((object)((Component)((Transform)icon.rectTransform).parent).GetComponent<ItemInventoryDisplay>(), "inventory");
			}
		}

		private static void EquipmentIconHook()
		{
			//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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__32_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val2 = new ILCursor(il);
					val2.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<ItemInventoryDisplay>(x, "SetSubscribedInventory")
					});
					val2.Index += 1;
					val2.Emit(OpCodes.Ldarg, 0);
					val2.EmitDelegate<Action<ScoreboardStrip>>((Action<ScoreboardStrip>)delegate(ScoreboardStrip strip)
					{
						if ((Object)(object)strip.equipmentIcon != (Object)null)
						{
							AttachZetDropHandler(strip.equipmentIcon);
						}
					});
				};
				<>c.<>9__32_0 = val;
				obj = (object)val;
			}
			ScoreboardStrip.SetMaster += (Manipulator)obj;
		}

		private static void AttachZetDropHandler(EquipmentIcon icon)
		{
			if (!((Object)(object)((Component)icon).GetComponent<ZetDropHandler>() != (Object)null))
			{
				ZetDropHandler zetDropHandler = ((Component)((Component)icon).transform).gameObject.AddComponent<ZetDropHandler>();
				zetDropHandler.GetInventory = () => icon.targetInventory;
				zetDropHandler.EquipmentIcon = true;
			}
		}

		private static void RemoveScrapperCard(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
		{
			if (Enabled && ZetArtifactsPlugin.DropifactRemoveScrapper.Value)
			{
				dccs.RemoveCardsThatFailFilter((Predicate<DirectorCard>)NotScrapper);
			}
		}

		private static bool NotScrapper(DirectorCard card)
		{
			GameObject prefab = card.spawnCard.prefab;
			return !Object.op_Implicit((Object)(object)prefab.GetComponent<ScrapperController>());
		}

		private static void AddBazaarScrapper(orig_Start orig, BazaarController self)
		{
			//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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active && Enabled && ZetArtifactsPlugin.DropifactBazaarScrapper.Value)
			{
				ArtifactDef val = ArtifactCatalog.FindArtifactDef("Sacrifice");
				bool flag = RunArtifactManager.instance.IsArtifactEnabled(val);
				if (flag)
				{
					RunArtifactManager.instance.SetArtifactEnabledServer(val, false);
				}
				SpawnCard val2 = LegacyResourcesAPI.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscScrapper");
				DirectorPlacementRule val3 = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)0
				};
				DirectorSpawnRequest val4 = new DirectorSpawnRequest(val2, val3, Run.instance.runRNG);
				GameObject spawnedInstance = val2.DoSpawn(new Vector3(-85f, -23.75f, -5f), Quaternion.identity, val4).spawnedInstance;
				spawnedInstance.transform.eulerAngles = new Vector3(0f, 165f, 0f);
				NetworkServer.Spawn(spawnedInstance);
				if (flag)
				{
					RunArtifactManager.instance.SetArtifactEnabledServer(val, true);
				}
			}
		}

		private static void VoidBearFix_AddTimedBuff(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			//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_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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)buffDef == (Object)null)
			{
				return;
			}
			if (NetworkServer.active)
			{
				BuffIndex buffIndex = Buffs.BearVoidCooldown.buffIndex;
				if (buffDef.buffIndex == buffIndex && self.GetBuffCount(buffIndex) < 1)
				{
					self.ClearTimedBuffs(buffIndex);
					self.SetBuffCount(buffIndex, 0);
				}
			}
			orig.Invoke(self, buffDef, duration);
		}

		private static void VoidBearFix_RemoveBuff(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex buffType)
		{
			//IL_0030: 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_0016: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				BuffIndex buffIndex = Buffs.BearVoidCooldown.buffIndex;
				if (buffType == buffIndex && self.GetBuffCount(buffIndex) < 1)
				{
					return;
				}
			}
			orig.Invoke(self, buffType);
		}
	}
	public static class ZetEarlifact
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

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

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

			public static Func<int, int> <>9__5_3;

			public static Manipulator <>9__5_0;

			internal void <MinimumStageHook>b__5_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions")
				}))
				{
					val.Index += 2;
					val.EmitDelegate<Func<int, int>>((Func<int, int>)((int stage) => (!Enabled) ? stage : 0));
				}
				else
				{
					ZetArtifactsPlugin.LogWarn("[ZetEarlifact] - MinimumStageHook failed!");
				}
			}

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

			internal bool <MinimumStageHook>b__5_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions");
			}

			internal int <MinimumStageHook>b__5_3(int stage)
			{
				if (Enabled)
				{
					return 0;
				}
				return stage;
			}
		}

		private static int State;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		internal static void Init()
		{
			if (!ZetArtifactsPlugin.EarlifactMerge.Value)
			{
				State = ZetArtifactsPlugin.EarlifactEnable.Value;
			}
			else
			{
				State = ZetArtifactsPlugin.LoopifactEnable.Value;
			}
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETEARLIFACT_NAME", "Artifact of Sanction");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETEARLIFACT_DESC", "Monster and Interactable types can appear earlier.");
				MinimumStageHook();
			}
		}

		private static void MinimumStageHook()
		{
			//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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val2 = new ILCursor(il);
					if (val2.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld<DirectorCard>(x, "minimumStageCompletions")
					}))
					{
						val2.Index += 2;
						val2.EmitDelegate<Func<int, int>>((Func<int, int>)((int stage) => (!Enabled) ? stage : 0));
					}
					else
					{
						ZetArtifactsPlugin.LogWarn("[ZetEarlifact] - MinimumStageHook failed!");
					}
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			DirectorCard.IsAvailable += (Manipulator)obj;
		}
	}
	public static class ZetEclifact
	{
		private static int State;

		internal static ArtifactDef ArtifactDef;

		public static bool Enabled
		{
			get
			{
				if (State < 1)
				{
					return false;
				}
				if (State > 1)
				{
					return true;
				}
				return ZetArtifactsPlugin.ArtifactEnabled(ArtifactDef);
			}
		}

		private static void EnableEffects()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//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
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			CharacterMaster.OnBodyStart += new Manipulator(Eclipse1Hook);
			HoldoutZoneController.FixedUpdate += new Manipulator(Eclipse2Hook);
			GlobalEventManager.OnCharacterHitGroundServer += new Manipulator(Eclipse3Hook);
			CharacterBody.RecalculateStats += new Manipulator(Eclipse4Hook);
			HealthComponent.Heal += new Manipulator(Eclipse5Hook);
			DeathRewards.OnKilledServer += new Manipulator(Eclipse6Hook);
			CharacterBody.RecalculateStats += new Manipulator(Eclipse7Hook);
			HealthComponent.TakeDamage += new Manipulator(Eclipse8Hook);
		}

		private static void DisableEffects()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//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
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			CharacterMaster.OnBodyStart -= new Manipulator(Eclipse1Hook);
			HoldoutZoneController.FixedUpdate -= new Manipulator(Eclipse2Hook);
			GlobalEventManager.OnCharacterHitGroundServer -= new Manipulator(Eclipse3Hook);
			CharacterBody.RecalculateStats -= new Manipulator(Eclipse4Hook);
			HealthComponent.Heal -= new Manipulator(Eclipse5Hook);
			DeathRewards.OnKilledServer -= new Manipulator(Eclipse6Hook);
			CharacterBody.RecalculateStats -= new Manipulator(Eclipse7Hook);
			HealthComponent.TakeDamage -= new Manipulator(Eclipse8Hook);
		}

		private static void OnArtifactEnabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
		{
			if ((Object)(object)artifactDef == (Object)(object)ArtifactDef)
			{
				EnableEffects();
			}
		}

		private static void OnArtifactDisabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
		{
			if ((Object)(object)artifactDef == (Object)(object)ArtifactDef)
			{
				DisableEffects();
			}
		}

		internal static void Init()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			State = ZetArtifactsPlugin.EclifactEnable.Value;
			if (ZetArtifactsPlugin.PluginLoaded("com.TPDespair.DiluvianArtifact"))
			{
				State = 0;
			}
			if (State >= 1)
			{
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETECLIFACT_NAME", "Artifact of the Eclipse");
				ZetArtifactsPlugin.RegisterToken("ARTIFACT_ZETECLIFACT_DESC", "Enables all Eclipse modifiers.\n\n<style=cStack>>Ally Starting Health: <style=cDeath>-50%</style>\n>Teleporter Radius: <style=cDeath>-50%</style>\n>Ally Fall Damage: <style=cDeath>+100% and lethal</style>\n>Enemy Speed: <style=cDeath>+40%</style>\n>Ally Healing: <style=cDeath>-50%</style>\n>Enemy Gold Drops: <style=cDeath>-20%</style>\n>Enemy Cooldowns: <style=cDeath>-50%</style>\n>Allies receive <style=cDeath>permanent damage</style></style>");
				if (State == 1)
				{
					RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(OnArtifactEnabled);
					RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(OnArtifactDisabled);
				}
				else
				{
					EnableEffects();
				}
			}
		}

		private static void Eclipse1Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)3));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)3));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(1) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(1) Failed!");
			}
		}

		private static void Eclipse2Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)4));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)4));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(2) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(2) Failed!");
			}
		}

		private static void Eclipse3Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)5));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)5));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(3) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(3) Failed!");
			}
		}

		private static void Eclipse4Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 6)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)6));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 6),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)6));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(4) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(4) Failed!");
			}
		}

		private static void Eclipse5Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 7)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)7));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
				if (flag)
				{
					int index = val.Index;
					ILLabel val2 = default(ILLabel);
					flag = val.TryGotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 7),
						(Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2)
					});
					if (flag)
					{
						int num = val.Index - index;
						if (num <= 8)
						{
							val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)7));
						}
						else
						{
							ZetArtifactsPlugin.LogWarn("EclipseHook(5) Failed! - LdcI4 Offset [" + num + "]");
						}
					}
				}
			}
			if (!flag)
			{
				ZetArtifactsPlugin.LogWarn("EclipseHook(5) Failed!");
			}
		}

		private static void Eclipse6Hook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 8)
			});
			if (flag)
			{
				val.Index += 2;
				val.EmitDelegate<Func<DifficultyIndex, DifficultyIndex>>((Func<DifficultyIndex, DifficultyIndex>)((DifficultyIndex diffIndex) => (DifficultyIndex)8));
			}
			else
			{
				flag = val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty")
				});
	

dll/ZetAspects.dll.old

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using IL.RoR2;
using IL.RoR2.Stats;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.UI;
using On.RoR2.UI.LogBook;
using On.RoR2.UI.MainMenu;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Stats;
using RoR2.UI;
using RoR2.UI.MainMenu;
using TMPro;
using TPDespair.ZetAspects.Compat;
using TPDespair.ZetAspects.Items;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ZetAspects")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ZetAspects")]
[assembly: AssemblyTitle("ZetAspects")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TPDespair.ZetAspects
{
	public static class Catalog
	{
		public static class RiskOfRain
		{
			private static bool equipDefPopulated;

			private static bool buffDefPopulated;

			private static bool iconsReplaced;

			public static bool populated;

			internal static void PreInit()
			{
				PopulateEquipment();
				ApplyEquipmentIcons();
			}

			internal static void Init()
			{
				//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_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_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_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: 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)
				mithrixBodyIndex = BodyCatalog.FindBodyIndex("BrotherBody");
				voidlingBodyIndex = BodyCatalog.FindBodyIndex("VoidRaidCrabBody");
				urchinTurretBodyIndex = BodyCatalog.FindBodyIndex("UrchinTurretBody");
				healOrbBodyIndex = BodyCatalog.FindBodyIndex("AffixEarthHealerBody");
				artifactShellBodyIndex = BodyCatalog.FindBodyIndex("ArtifactShellBody");
				goldenTitanBodyIndex = BodyCatalog.FindBodyIndex("TitanGoldBody");
				PopulateEquipment();
				PopulateBuffs();
				SetupText();
				ItemEntries(DropHooks.CanObtainItem());
				CopyExpansionReq();
				CopyModelPrefabs();
				ApplyEquipmentIcons();
				if (DropHooks.CanObtainEquipment())
				{
					EquipmentEntries(shown: true);
				}
				EquipmentColor();
				BuffDef affixHauntedRecipient = Buffs.AffixHauntedRecipient;
				affixHauntedRecipient.buffColor = Color.white;
				affixHauntedRecipient.iconSprite = Sprites.HauntCloak;
				FillEqualities();
				populated = true;
			}

			private static void PopulateEquipment()
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					Equip.AffixWhite = Equipment.AffixWhite;
					Equip.AffixBlue = Equipment.AffixBlue;
					Equip.AffixRed = Equipment.AffixRed;
					Equip.AffixHaunted = Equipment.AffixHaunted;
					Equip.AffixPoison = Equipment.AffixPoison;
					Equip.AffixLunar = Equipment.AffixLunar;
					Equip.AffixEarth = EquipmentCatalog.GetEquipmentDef(EquipmentCatalog.FindEquipmentIndex("EliteEarthEquipment"));
					Equip.AffixVoid = EquipmentCatalog.GetEquipmentDef(EquipmentCatalog.FindEquipmentIndex("EliteVoidEquipment"));
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				if (!buffDefPopulated)
				{
					Buff.AffixWhite = Buffs.AffixWhite;
					Buff.AffixBlue = Buffs.AffixBlue;
					Buff.AffixRed = Buffs.AffixRed;
					Buff.AffixHaunted = Buffs.AffixHaunted;
					Buff.AffixPoison = Buffs.AffixPoison;
					Buff.AffixLunar = Buffs.AffixLunar;
					Buff.AffixEarth = Buffs.EliteEarth;
					Buff.AffixVoid = Buffs.EliteVoid;
					buffDefPopulated = true;
				}
			}

			private static void SetupText()
			{
				ZetAspectWhite.SetupTokens();
				ZetAspectBlue.SetupTokens();
				ZetAspectRed.SetupTokens();
				ZetAspectHaunted.SetupTokens();
				ZetAspectPoison.SetupTokens();
				ZetAspectLunar.SetupTokens();
				ZetAspectEarth.SetupTokens();
				ZetAspectVoid.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectWhite, shown);
				SetItemState(Item.ZetAspectBlue, shown);
				SetItemState(Item.ZetAspectRed, shown);
				SetItemState(Item.ZetAspectHaunted, shown);
				SetItemState(Item.ZetAspectPoison, shown);
				SetItemState(Item.ZetAspectLunar, shown);
				SetItemState(Item.ZetAspectEarth, shown);
				SetItemState(Item.ZetAspectVoid, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectWhite, Equip.AffixWhite);
				CopyExpansion(Item.ZetAspectBlue, Equip.AffixBlue);
				CopyExpansion(Item.ZetAspectRed, Equip.AffixRed);
				CopyExpansion(Item.ZetAspectHaunted, Equip.AffixHaunted);
				CopyExpansion(Item.ZetAspectPoison, Equip.AffixPoison);
				CopyExpansion(Item.ZetAspectLunar, Equip.AffixLunar);
				CopyExpansion(Item.ZetAspectEarth, Equip.AffixEarth);
				CopyExpansion(Item.ZetAspectVoid, Equip.AffixVoid);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectEarth, Equip.AffixEarth);
				CopyItemPrefab(Item.ZetAspectVoid, Equip.AffixVoid);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixWhite, Sprites.AffixWhite, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixBlue, Sprites.AffixBlue, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixRed, Sprites.AffixRed, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixHaunted, Sprites.AffixHaunted, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixPoison, Sprites.AffixPoison, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixLunar, Sprites.AffixLunar, Sprites.OutlineBlue);
					ReplaceEquipmentIcon(Equip.AffixEarth, Sprites.AffixEarth, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixVoid, Sprites.AffixVoid, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixWhite, shown);
				SetEquipmentState(Equip.AffixBlue, shown);
				SetEquipmentState(Equip.AffixRed, shown);
				SetEquipmentState(Equip.AffixHaunted, shown);
				SetEquipmentState(Equip.AffixPoison, shown);
				SetEquipmentState(Equip.AffixLunar, shown);
				SetEquipmentState(Equip.AffixEarth, shown);
				SetEquipmentState(Equip.AffixVoid, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixWhite);
				ColorEquipmentDroplet(Equip.AffixBlue);
				ColorEquipmentDroplet(Equip.AffixRed);
				ColorEquipmentDroplet(Equip.AffixHaunted);
				ColorEquipmentDroplet(Equip.AffixPoison);
				ColorEquipmentDroplet(Equip.AffixLunar);
				ColorEquipmentDroplet(Equip.AffixEarth);
				ColorEquipmentDroplet(Equip.AffixVoid);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixWhite, Buff.AffixWhite, Item.ZetAspectWhite);
				CreateEquality(Equip.AffixBlue, Buff.AffixBlue, Item.ZetAspectBlue);
				CreateEquality(Equip.AffixRed, Buff.AffixRed, Item.ZetAspectRed);
				CreateEquality(Equip.AffixHaunted, Buff.AffixHaunted, Item.ZetAspectHaunted);
				CreateEquality(Equip.AffixPoison, Buff.AffixPoison, Item.ZetAspectPoison);
				CreateEquality(Equip.AffixLunar, Buff.AffixLunar, Item.ZetAspectLunar);
				CreateEquality(Equip.AffixEarth, Buff.AffixEarth, Item.ZetAspectEarth);
				CreateEquality(Equip.AffixVoid, Buff.AffixVoid, Item.ZetAspectVoid);
			}
		}

		public static class SpikeStrip
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.groovesalad.GrooveSaladSpikestripContent"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				//IL_0037: 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_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Invalid comparison between Unknown and I4
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: 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_0062: Invalid comparison between Unknown and I4
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Invalid comparison between Unknown and I4
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("EQUIPMENT_AFFIXPLATED");
					if ((int)val != -1)
					{
						Equip.AffixPlated = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("EQUIPMENT_AFFIXWARPED");
					if ((int)val != -1)
					{
						Equip.AffixWarped = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("EQUIPMENT_AFFIXVEILED");
					if ((int)val != -1)
					{
						Equip.AffixVeiled = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("EQUIPMENT_AFFIXARAGONITE");
					if ((int)val != -1)
					{
						Equip.AffixAragonite = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixPlated))
					{
						Buff.AffixPlated = Equip.AffixPlated.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixWarped))
					{
						Buff.AffixWarped = Equip.AffixWarped.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixVeiled))
					{
						Buff.AffixVeiled = Equip.AffixVeiled.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixAragonite))
					{
						Buff.AffixAragonite = Equip.AffixAragonite.passiveBuffDef;
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectPlated, ref Equip.AffixPlated, ref Buff.AffixPlated, populatedState);
				DisableInactiveItem(Item.ZetAspectWarped, ref Equip.AffixWarped, ref Buff.AffixWarped, populatedState);
				DisableInactiveItem(Item.ZetAspectVeiled, ref Equip.AffixVeiled, ref Buff.AffixVeiled, populatedState);
				DisableInactiveItem(Item.ZetAspectAragonite, ref Equip.AffixAragonite, ref Buff.AffixAragonite, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectPlated.SetupTokens();
				ZetAspectWarped.SetupTokens();
				ZetAspectVeiled.SetupTokens();
				ZetAspectAragonite.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectPlated, shown);
				SetItemState(Item.ZetAspectWarped, shown);
				SetItemState(Item.ZetAspectVeiled, shown);
				SetItemState(Item.ZetAspectAragonite, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectPlated, Equip.AffixPlated);
				CopyExpansion(Item.ZetAspectWarped, Equip.AffixWarped);
				CopyExpansion(Item.ZetAspectVeiled, Equip.AffixVeiled);
				CopyExpansion(Item.ZetAspectAragonite, Equip.AffixAragonite);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectPlated, Equip.AffixPlated);
				CopyEquipmentPrefab(Item.ZetAspectWarped, Equip.AffixWarped);
				CopyEquipmentPrefab(Item.ZetAspectVeiled, Equip.AffixVeiled);
				CopyEquipmentPrefab(Item.ZetAspectAragonite, Equip.AffixAragonite);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixPlated, Sprites.AffixPlated, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixWarped, Sprites.AffixWarped, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixVeiled, Sprites.AffixVeiled, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixAragonite, Sprites.AffixAragonite, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixPlated, shown);
				SetEquipmentState(Equip.AffixWarped, shown);
				SetEquipmentState(Equip.AffixVeiled, shown);
				SetEquipmentState(Equip.AffixAragonite, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixPlated);
				ColorEquipmentDroplet(Equip.AffixWarped);
				ColorEquipmentDroplet(Equip.AffixVeiled);
				ColorEquipmentDroplet(Equip.AffixAragonite);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixPlated, Buff.AffixPlated, Item.ZetAspectPlated);
				CreateEquality(Equip.AffixWarped, Buff.AffixWarped, Item.ZetAspectWarped);
				CreateEquality(Equip.AffixVeiled, Buff.AffixVeiled, Item.ZetAspectVeiled);
				CreateEquality(Equip.AffixAragonite, Buff.AffixAragonite, Item.ZetAspectAragonite);
			}
		}

		public static class GoldenCoastPlus
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.Skell.GoldenCoastPlus"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("EliteGoldEquipment");
					if ((int)val != -1)
					{
						Equip.AffixGold = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixGold))
					{
						Buff.AffixGold = Equip.AffixGold.passiveBuffDef;
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectGold, ref Equip.AffixGold, ref Buff.AffixGold, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectGold.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectGold, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectGold, Equip.AffixGold);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectGold, Equip.AffixGold);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixGold, Sprites.AffixGold, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixGold, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixGold);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixGold, Buff.AffixGold, Item.ZetAspectGold);
			}
		}

		public static class Aetherium
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.KomradeSpectre.Aetherium"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("AETHERIUM_ELITE_EQUIPMENT_AFFIX_SANGUINE");
					if ((int)val != -1)
					{
						Equip.AffixSanguine = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!buffDefPopulated)
				{
					BuffIndex val = BuffCatalog.FindBuffIndex("AFFIX_SANGUINE");
					if ((int)val != -1)
					{
						Buff.AffixSanguine = BuffCatalog.GetBuffDef(val);
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectSanguine, ref Equip.AffixSanguine, ref Buff.AffixSanguine, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectSanguine.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectSanguine, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectSanguine, Equip.AffixSanguine);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectSanguine, Equip.AffixSanguine);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixSanguine, Sprites.AffixSanguine, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixSanguine, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixSanguine);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixSanguine, Buff.AffixSanguine, Item.ZetAspectSanguine);
			}
		}

		public static class Bubbet
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("bubbet.bubbetsitems"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				//IL_006b: 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)
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					BuffDef affixSepia = Buff.AffixSepia;
					if (Object.op_Implicit((Object)(object)affixSepia))
					{
						affixSepia.buffColor = Color.white;
						affixSepia.iconSprite = Sprites.SepiaElite;
					}
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("EquipmentDefSepiaElite");
					if ((int)val != -1)
					{
						Equip.AffixSepia = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!buffDefPopulated)
				{
					BuffIndex val = BuffCatalog.FindBuffIndex("BuffDefSepia");
					if ((int)val != -1)
					{
						Buff.AffixSepia = BuffCatalog.GetBuffDef(val);
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectSepia, ref Equip.AffixSepia, ref Buff.AffixSepia, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectSepia.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectSepia, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectSepia, Equip.AffixSepia);
			}

			private static void CopyModelPrefabs()
			{
				CopyItemPrefab(Item.ZetAspectSepia, Equip.AffixSepia);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixSepia, Sprites.AffixSepia, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixSepia, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixSepia);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixSepia, Buff.AffixSepia, Item.ZetAspectSepia);
			}
		}

		public static class WarWisp
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.PopcornFactory.WispMod"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("WARFRAMEWISP_ELITE_EQUIPMENT_AFFIX_NULLIFIER");
					if ((int)val != -1)
					{
						Equip.AffixNullifier = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!buffDefPopulated)
				{
					BuffIndex val = BuffCatalog.FindBuffIndex("AFFIX_NULLIFIER");
					if ((int)val != -1)
					{
						Buff.AffixNullifier = BuffCatalog.GetBuffDef(val);
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectNullifier, ref Equip.AffixNullifier, ref Buff.AffixNullifier, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectNullifier.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectNullifier, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectNullifier, Equip.AffixNullifier);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectNullifier, Equip.AffixNullifier);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixNullifier, Sprites.AffixNullifier, Sprites.NullOutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixNullifier, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixNullifier);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixNullifier, Buff.AffixNullifier, Item.ZetAspectNullifier);
			}
		}

		public static class Blighted
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.Moffein.BlightedElites"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
				else
				{
					PopulateEquipment();
					DisableInactiveItems();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
				else
				{
					PopulateEquipment();
					DisableInactiveItems();
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("AffixBlightedMoffein");
					if ((int)val != -1)
					{
						Equip.AffixBlighted = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixBlighted))
					{
						Buff.AffixBlighted = Equip.AffixBlighted.passiveBuffDef;
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectBlighted, ref Equip.AffixBlighted, ref Buff.AffixBlighted, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectBlighted.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectBlighted, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectBlighted, Equip.AffixBlighted);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectBlighted, Equip.AffixBlighted);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixBlighted, Sprites.AffixBlighted, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixBlighted, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixBlighted);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixBlighted, Buff.AffixBlighted, Item.ZetAspectBlighted);
			}
		}

		public static class GOTCE
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.TheBestAssociatedLargelyLudicrousSillyheadGroup.GOTCE"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				//IL_006b: 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)
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					BuffDef backupDebuff = Buff.BackupDebuff;
					if (Object.op_Implicit((Object)(object)backupDebuff))
					{
						backupDebuff.buffColor = Color.white;
						backupDebuff.iconSprite = Sprites.BackupDebuff;
					}
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("ELITE_EQUIPMENT_BACKUP");
					if ((int)val != -1)
					{
						Equip.AffixBackup = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Invalid comparison between Unknown and I4
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixBackup))
					{
						Buff.AffixBackup = Equip.AffixBackup.passiveBuffDef;
					}
					BuffIndex val = BuffCatalog.FindBuffIndex("Backuped");
					if ((int)val != -1)
					{
						Buff.BackupDebuff = BuffCatalog.GetBuffDef(val);
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectBackup, ref Equip.AffixBackup, ref Buff.AffixBackup, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectBackup.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectBackup, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectBackup, Equip.AffixBackup);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectBackup, Equip.AffixBackup);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixBackup, Sprites.AffixBackup, Sprites.CrackedOutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixBackup, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixBackup);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixBackup, Buff.AffixBackup, Item.ZetAspectBackup);
			}
		}

		public static class Thalasso
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.jt_hehe.Thalassophobia"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Invalid comparison between Unknown and I4
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("THALASSOPHOBIA_ELITE_EQUIPMENT_AFFIX_PURE");
					if ((int)val != -1)
					{
						Equip.AffixPurity = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixPurity))
					{
						Buff.AffixPurity = Equip.AffixPurity.passiveBuffDef;
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectPurity, ref Equip.AffixPurity, ref Buff.AffixPurity, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectPurity.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectPurity, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectPurity, Equip.AffixPurity);
			}

			private static void CopyModelPrefabs()
			{
				CopyItemPrefab(Item.ZetAspectPurity, Equip.AffixPurity);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixPurity, Sprites.AffixPurity, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixPurity, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixPurity);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixPurity, Buff.AffixPurity, Item.ZetAspectPurity);
			}
		}

		public static class RisingTides
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.themysticsword.risingtides"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: 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: Invalid comparison between Unknown and I4
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Invalid comparison between Unknown and I4
				//IL_0046: 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_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Invalid comparison between Unknown and I4
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: 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_00a4: Invalid comparison between Unknown and I4
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Invalid comparison between Unknown and I4
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("RisingTides_AffixBarrier");
					if ((int)val != -1)
					{
						Equip.AffixBarrier = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("RisingTides_AffixBlackHole");
					if ((int)val != -1)
					{
						Equip.AffixBlackHole = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("RisingTides_AffixMoney");
					if ((int)val != -1)
					{
						Equip.AffixMoney = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("RisingTides_AffixNight");
					if ((int)val != -1)
					{
						Equip.AffixNight = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("RisingTides_AffixWater");
					if ((int)val != -1)
					{
						Equip.AffixWater = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("RisingTides_AffixImpPlane");
					if ((int)val != -1)
					{
						Equip.AffixRealgar = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Invalid comparison between Unknown and I4
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Invalid comparison between Unknown and I4
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixBarrier))
					{
						Buff.AffixBarrier = Equip.AffixBarrier.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixBlackHole))
					{
						Buff.AffixBlackHole = Equip.AffixBlackHole.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixMoney))
					{
						Buff.AffixMoney = Equip.AffixMoney.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixNight))
					{
						Buff.AffixNight = Equip.AffixNight.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixWater))
					{
						Buff.AffixWater = Equip.AffixWater.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixRealgar))
					{
						Buff.AffixRealgar = Equip.AffixRealgar.passiveBuffDef;
					}
					BuffIndex val = BuffCatalog.FindBuffIndex("RisingTides_NightSpeedBoost");
					if ((int)val != -1)
					{
						Buff.NightSpeed = BuffCatalog.GetBuffDef(val);
					}
					val = BuffCatalog.FindBuffIndex("RisingTides_NightReducedVision");
					if ((int)val != -1)
					{
						Buff.NightBlind = BuffCatalog.GetBuffDef(val);
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectBarrier, ref Equip.AffixBarrier, ref Buff.AffixBarrier, populatedState);
				DisableInactiveItem(Item.ZetAspectBlackHole, ref Equip.AffixBlackHole, ref Buff.AffixBlackHole, populatedState);
				DisableInactiveItem(Item.ZetAspectMoney, ref Equip.AffixMoney, ref Buff.AffixMoney, populatedState);
				DisableInactiveItem(Item.ZetAspectNight, ref Equip.AffixNight, ref Buff.AffixNight, populatedState);
				DisableInactiveItem(Item.ZetAspectWater, ref Equip.AffixWater, ref Buff.AffixWater, populatedState);
				DisableInactiveItem(Item.ZetAspectRealgar, ref Equip.AffixRealgar, ref Buff.AffixRealgar, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectBarrier.SetupTokens();
				ZetAspectBlackHole.SetupTokens();
				ZetAspectMoney.SetupTokens();
				ZetAspectNight.SetupTokens();
				ZetAspectWater.SetupTokens();
				ZetAspectRealgar.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectBarrier, shown);
				SetItemState(Item.ZetAspectBlackHole, shown);
				SetItemState(Item.ZetAspectMoney, shown);
				SetItemState(Item.ZetAspectNight, shown);
				SetItemState(Item.ZetAspectWater, shown);
				SetItemState(Item.ZetAspectRealgar, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectBarrier, Equip.AffixBarrier);
				CopyExpansion(Item.ZetAspectBlackHole, Equip.AffixBlackHole);
				CopyExpansion(Item.ZetAspectMoney, Equip.AffixMoney);
				CopyExpansion(Item.ZetAspectNight, Equip.AffixNight);
				CopyExpansion(Item.ZetAspectWater, Equip.AffixWater);
				CopyExpansion(Item.ZetAspectRealgar, Equip.AffixRealgar);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectBarrier, Equip.AffixBarrier);
				CopyEquipmentPrefab(Item.ZetAspectBlackHole, Equip.AffixBlackHole);
				CopyEquipmentPrefab(Item.ZetAspectMoney, Equip.AffixMoney);
				CopyEquipmentPrefab(Item.ZetAspectNight, Equip.AffixNight);
				CopyEquipmentPrefab(Item.ZetAspectWater, Equip.AffixWater);
				CopyEquipmentPrefab(Item.ZetAspectRealgar, Equip.AffixRealgar);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixBarrier, Sprites.AffixBarrier, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixBlackHole, Sprites.AffixBlackHole, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixMoney, Sprites.AffixMoney, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixNight, Sprites.AffixNight, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixWater, Sprites.AffixWater, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixRealgar, Sprites.AffixRealgar, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixBarrier, shown);
				SetEquipmentState(Equip.AffixBlackHole, shown);
				SetEquipmentState(Equip.AffixMoney, shown);
				SetEquipmentState(Equip.AffixNight, shown);
				SetEquipmentState(Equip.AffixWater, shown);
				SetEquipmentState(Equip.AffixRealgar, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixBarrier);
				ColorEquipmentDroplet(Equip.AffixBlackHole);
				ColorEquipmentDroplet(Equip.AffixMoney);
				ColorEquipmentDroplet(Equip.AffixNight);
				ColorEquipmentDroplet(Equip.AffixWater);
				ColorEquipmentDroplet(Equip.AffixRealgar);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixBarrier, Buff.AffixBarrier, Item.ZetAspectBarrier);
				CreateEquality(Equip.AffixBlackHole, Buff.AffixBlackHole, Item.ZetAspectBlackHole);
				CreateEquality(Equip.AffixMoney, Buff.AffixMoney, Item.ZetAspectMoney);
				CreateEquality(Equip.AffixNight, Buff.AffixNight, Item.ZetAspectNight);
				CreateEquality(Equip.AffixWater, Buff.AffixWater, Item.ZetAspectWater);
				CreateEquality(Equip.AffixRealgar, Buff.AffixRealgar, Item.ZetAspectRealgar);
			}
		}

		public static class NemRisingTides
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("prodzpod.NemesisRisingTides"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
				else
				{
					PopulateEquipment();
					DisableInactiveItems();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
				else
				{
					PopulateEquipment();
					DisableInactiveItems();
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Invalid comparison between Unknown and I4
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Invalid comparison between Unknown and I4
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					TPDespair.ZetAspects.Compat.NemRisingTides.PrepareEquipmentCheck();
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("NemesisRisingTides_AffixBuffered");
					if ((int)val != -1 && TPDespair.ZetAspects.Compat.NemRisingTides.GetBufferedEnabled())
					{
						Equip.AffixBuffered = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("NemesisRisingTides_AffixOppressive");
					if ((int)val != -1 && TPDespair.ZetAspects.Compat.NemRisingTides.GetOppressiveEnabled())
					{
						Equip.AffixOppressive = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixBuffered))
					{
						Buff.AffixBuffered = Equip.AffixBuffered.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixOppressive))
					{
						Buff.AffixOppressive = Equip.AffixOppressive.passiveBuffDef;
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectBuffered, ref Equip.AffixBuffered, ref Buff.AffixBuffered, populatedState);
				DisableInactiveItem(Item.ZetAspectOppressive, ref Equip.AffixOppressive, ref Buff.AffixOppressive, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectBuffered.SetupTokens();
				ZetAspectOppressive.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectBuffered, shown);
				SetItemState(Item.ZetAspectOppressive, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectBuffered, Equip.AffixBuffered);
				CopyExpansion(Item.ZetAspectOppressive, Equip.AffixOppressive);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectBuffered, Equip.AffixBuffered);
				CopyEquipmentPrefab(Item.ZetAspectOppressive, Equip.AffixOppressive);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixBuffered, Sprites.AffixBuffered, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixOppressive, Sprites.AffixOppressive, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixBuffered, shown);
				SetEquipmentState(Equip.AffixOppressive, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixBuffered);
				ColorEquipmentDroplet(Equip.AffixOppressive);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixBuffered, Buff.AffixBuffered, Item.ZetAspectBuffered);
				CreateEquality(Equip.AffixOppressive, Buff.AffixOppressive, Item.ZetAspectOppressive);
			}
		}

		public static class MoreElites
		{
			private static bool equipDefPopulated = false;

			private static bool buffDefPopulated = false;

			private static bool iconsReplaced = false;

			public static bool populated = false;

			private static int state = -1;

			public static bool Enabled
			{
				get
				{
					if (state == -1)
					{
						if (PluginLoaded("com.Nuxlar.MoreElites"))
						{
							state = 1;
						}
						else
						{
							state = 0;
						}
					}
					return state == 1;
				}
			}

			internal static void PreInit()
			{
				if (Enabled)
				{
					PopulateEquipment();
					DisableInactiveItems();
					ApplyEquipmentIcons();
				}
			}

			internal static void Init()
			{
				if (Enabled)
				{
					PopulateEquipment();
					PopulateBuffs();
					DisableInactiveItems();
					SetupText();
					ItemEntries(DropHooks.CanObtainItem());
					CopyExpansionReq();
					CopyModelPrefabs();
					ApplyEquipmentIcons();
					if (DropHooks.CanObtainEquipment())
					{
						EquipmentEntries(shown: true);
					}
					EquipmentColor();
					FillEqualities();
					populated = true;
				}
			}

			private static void PopulateEquipment()
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				//IL_0037: 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_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Invalid comparison between Unknown and I4
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: 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_0062: Invalid comparison between Unknown and I4
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Invalid comparison between Unknown and I4
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				if (!equipDefPopulated)
				{
					EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("AffixEmpowering");
					if ((int)val != -1)
					{
						Equip.AffixEmpowering = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("AffixFrenziedNuxlar");
					if ((int)val != -1)
					{
						Equip.AffixFrenzied = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("AffixVolatile");
					if ((int)val != -1)
					{
						Equip.AffixVolatile = EquipmentCatalog.GetEquipmentDef(val);
					}
					val = EquipmentCatalog.FindEquipmentIndex("AffixEcho");
					if ((int)val != -1)
					{
						Equip.AffixEcho = EquipmentCatalog.GetEquipmentDef(val);
					}
					equipDefPopulated = true;
				}
			}

			private static void PopulateBuffs()
			{
				if (!buffDefPopulated)
				{
					if (Object.op_Implicit((Object)(object)Equip.AffixEmpowering))
					{
						Buff.AffixEmpowering = Equip.AffixEmpowering.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixFrenzied))
					{
						Buff.AffixFrenzied = Equip.AffixFrenzied.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixVolatile))
					{
						Buff.AffixVolatile = Equip.AffixVolatile.passiveBuffDef;
					}
					if (Object.op_Implicit((Object)(object)Equip.AffixEcho))
					{
						Buff.AffixEcho = Equip.AffixEcho.passiveBuffDef;
					}
					buffDefPopulated = true;
				}
			}

			private static void DisableInactiveItems()
			{
				int populatedState = GetPopulatedState(equipDefPopulated, buffDefPopulated);
				DisableInactiveItem(Item.ZetAspectEmpowering, ref Equip.AffixEmpowering, ref Buff.AffixEmpowering, populatedState);
				DisableInactiveItem(Item.ZetAspectFrenzied, ref Equip.AffixFrenzied, ref Buff.AffixFrenzied, populatedState);
				DisableInactiveItem(Item.ZetAspectVolatile, ref Equip.AffixVolatile, ref Buff.AffixVolatile, populatedState);
				DisableInactiveItem(Item.ZetAspectEcho, ref Equip.AffixEcho, ref Buff.AffixEcho, populatedState);
			}

			private static void SetupText()
			{
				ZetAspectEmpowering.SetupTokens();
				ZetAspectFrenzied.SetupTokens();
				ZetAspectVolatile.SetupTokens();
				ZetAspectEcho.SetupTokens();
			}

			internal static void ItemEntries(bool shown)
			{
				SetItemState(Item.ZetAspectEmpowering, shown);
				SetItemState(Item.ZetAspectFrenzied, shown);
				SetItemState(Item.ZetAspectVolatile, shown);
				SetItemState(Item.ZetAspectEcho, shown);
			}

			private static void CopyExpansionReq()
			{
				CopyExpansion(Item.ZetAspectEmpowering, Equip.AffixEmpowering);
				CopyExpansion(Item.ZetAspectFrenzied, Equip.AffixFrenzied);
				CopyExpansion(Item.ZetAspectVolatile, Equip.AffixVolatile);
				CopyExpansion(Item.ZetAspectEcho, Equip.AffixEcho);
			}

			private static void CopyModelPrefabs()
			{
				CopyEquipmentPrefab(Item.ZetAspectEmpowering, Equip.AffixEmpowering);
				CopyEquipmentPrefab(Item.ZetAspectFrenzied, Equip.AffixFrenzied);
				CopyEquipmentPrefab(Item.ZetAspectVolatile, Equip.AffixVolatile);
				CopyEquipmentPrefab(Item.ZetAspectEcho, Equip.AffixEcho);
			}

			private static void ApplyEquipmentIcons()
			{
				if (!iconsReplaced)
				{
					ReplaceEquipmentIcon(Equip.AffixEmpowering, Sprites.AffixBuffing, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixFrenzied, Sprites.AffixFrenzied, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixVolatile, Sprites.AffixVolatile, Sprites.OutlineOrange);
					ReplaceEquipmentIcon(Equip.AffixEcho, Sprites.AffixEcho, Sprites.OutlineOrange);
					iconsReplaced = true;
				}
			}

			internal static void EquipmentEntries(bool shown)
			{
				SetEquipmentState(Equip.AffixEmpowering, shown);
				SetEquipmentState(Equip.AffixFrenzied, shown);
				SetEquipmentState(Equip.AffixVolatile, shown);
				SetEquipmentState(Equip.AffixEcho, shown);
			}

			internal static void EquipmentColor()
			{
				ColorEquipmentDroplet(Equip.AffixEmpowering);
				ColorEquipmentDroplet(Equip.AffixFrenzied);
				ColorEquipmentDroplet(Equip.AffixVolatile);
				ColorEquipmentDroplet(Equip.AffixEcho);
			}

			internal static void FillEqualities()
			{
				CreateEquality(Equip.AffixEmpowering, Buff.AffixEmpowering, Item.ZetAspectEmpowering);
				CreateEquality(Equip.AffixFrenzied, Buff.AffixFrenzied, Item.ZetAspectFrenzied);
				CreateEquality(Equip.AffixVolatile, Buff.AffixVolatile, Item.ZetAspectVolatile);
				CreateEquality(Equip.AffixEcho, Buff.AffixEcho, Item.ZetAspectEcho);
			}
		}

		public static class Sprites
		{
			public static Sprite OutlineRed;

			public static Sprite OutlineOrange;

			public static Sprite OutlineYellow;

			public static Sprite OutlineBlue;

			public static Sprite OutlineVoid;

			public static Sprite NullOutlineRed;

			public static Sprite NullOutlineOrange;

			public static Sprite NullOutlineYellow;

			public static Sprite CrackedOutlineRed;

			public static Sprite CrackedOutlineOrange;

			public static Sprite CrackedOutlineYellow;

			public static Sprite AffixWhite;

			public static Sprite AffixBlue;

			public static Sprite AffixRed;

			public static Sprite AffixHaunted;

			public static Sprite AffixPoison;

			public static Sprite AffixLunar;

			public static Sprite AffixEarth;

			public static Sprite AffixVoid;

			public static Sprite AffixPlated;

			public static Sprite AffixWarped;

			public static Sprite AffixVeiled;

			public static Sprite AffixAragonite;

			public static Sprite AffixGold;

			public static Sprite AffixSanguine;

			public static Sprite AffixSepia;

			public static Sprite SepiaElite;

			public static Sprite AffixNullifier;

			public static Sprite AffixBlighted;

			public static Sprite AffixBackup;

			public static Sprite BackupDebuff;

			public static Sprite AffixPurity;

			public static Sprite AffixBarrier;

			public static Sprite AffixBlackHole;

			public static Sprite AffixMoney;

			public static Sprite AffixNight;

			public static Sprite AffixWater;

			public static Sprite AffixRealgar;

			public static Sprite AffixBuffered;

			public static Sprite AffixOppressive;

			public static Sprite AffixBuffing;

			public static Sprite AffixFrenzied;

			public static Sprite AffixVolatile;

			public static Sprite AffixEcho;

			public static Sprite HauntCloak;

			public static Sprite ZetHeadHunter;

			public static Sprite ZetSapped;

			public static Sprite ZetShredded;

			public static Sprite ZetPoached;

			public static Sprite ZetSepiaBlind;

			public static Sprite ZetElusive;

			public static Sprite ZetWarped;

			public static void Load()
			{
				OutlineRed = Assets.LoadAsset<Sprite>("Assets/Icons/texOutlineRed.png");
				OutlineOrange = Assets.LoadAsset<Sprite>("Assets/Icons/texOutlineOrange.png");
				OutlineYellow = Assets.LoadAsset<Sprite>("Assets/Icons/texOutlineYellow.png");
				OutlineBlue = Assets.LoadAsset<Sprite>("Assets/Icons/texOutlineBlue.png");
				OutlineVoid = Assets.LoadAsset<Sprite>("Assets/Icons/texOutlineVoid.png");
				AffixWhite = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixWhite.png");
				AffixBlue = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixBlue.png");
				AffixRed = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixRed.png");
				AffixHaunted = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixHaunted.png");
				AffixPoison = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixPoison.png");
				AffixLunar = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixLunar.png");
				AffixEarth = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixEarth.png");
				AffixVoid = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixVoid.png");
				if (SpikeStrip.Enabled)
				{
					AffixPlated = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixPlated.png");
					AffixWarped = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixWarped.png");
					AffixVeiled = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixVeiled.png");
					AffixAragonite = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixAragonite.png");
					ZetElusive = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffElusive.png");
					ZetWarped = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/Slow80").iconSprite;
				}
				if (GoldenCoastPlus.Enabled)
				{
					AffixGold = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixPillaging.png");
				}
				if (Aetherium.Enabled)
				{
					AffixSanguine = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixSanguine.png");
				}
				if (Bubbet.Enabled)
				{
					AffixSepia = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixSepia.png");
					SepiaElite = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffAffixSepia.png");
					ZetSepiaBlind = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffSepiaBlind.png");
				}
				if (WarWisp.Enabled)
				{
					NullOutlineRed = Assets.LoadAsset<Sprite>("Assets/Icons/texNullOutlineRed.png");
					NullOutlineOrange = Assets.LoadAsset<Sprite>("Assets/Icons/texNullOutlineOrange.png");
					NullOutlineYellow = Assets.LoadAsset<Sprite>("Assets/Icons/texNullOutlineYellow.png");
					AffixNullifier = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixNullifier.png");
				}
				AffixBlighted = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixBlighted.png");
				if (GOTCE.Enabled)
				{
					CrackedOutlineRed = Assets.LoadAsset<Sprite>("Assets/Icons/texCrackedOutlineRed.png");
					CrackedOutlineOrange = Assets.LoadAsset<Sprite>("Assets/Icons/texCrackedOutlineOrange.png");
					CrackedOutlineYellow = Assets.LoadAsset<Sprite>("Assets/Icons/texCrackedOutlineYellow.png");
					AffixBackup = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixBackup.png");
					BackupDebuff = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffNoSecondary.png");
				}
				if (Thalasso.Enabled)
				{
					AffixPurity = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixPurity.png");
				}
				if (RisingTides.Enabled)
				{
					AffixBarrier = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixBarrier.png");
					AffixBlackHole = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixBlackHole.png");
					AffixMoney = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixArmored.png");
					AffixNight = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixNight.png");
					AffixWater = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixWater.png");
					AffixRealgar = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixImpPlane.png");
				}
				AffixBuffered = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixBuffered.png");
				AffixOppressive = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixOppressive.png");
				if (MoreElites.Enabled)
				{
					AffixBuffing = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixBuffing.png");
					AffixFrenzied = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixFrenzied.png");
					AffixVolatile = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixVolatile.png");
					AffixEcho = Assets.LoadAsset<Sprite>("Assets/Icons/texAffixEcho.png");
				}
				HauntCloak = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffHauntCloak.png");
				ZetHeadHunter = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffHeadHunter.png");
				ZetSapped = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffSapped.png");
				ZetShredded = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffShredded.png");
				ZetPoached = Assets.LoadAsset<Sprite>("Assets/Icons/texBuffPoached.png");
			}
		}

		public static class Prefabs
		{
			public static GameObject AffixVoid;

			public static GameObject AffixSepia;

			public static GameObject AffixPure;

			public static void Load()
			{
				AffixVoid = Assets.LoadAsset<GameObject>("Assets/Prefabs/prefabAffixVoid.prefab");
				if (Bubbet.Enabled)
				{
					AffixSepia = Assets.LoadAsset<GameObject>("Assets/Prefabs/prefabAffixSepia.prefab");
				}
				if (Thalasso.Enabled)
				{
					AffixPure = Assets.LoadAsset<GameObject>("Assets/Prefabs/prefabAffixPure.prefab");
				}
			}
		}

		public static class Buff
		{
			public static BuffDef ZetHeadHunter;

			public static BuffDef ZetSapped;

			public static BuffDef ZetShredded;

			public static BuffDef ZetPoached;

			public static BuffDef ZetSepiaBlind;

			public static BuffDef ZetElusive;

			public static BuffDef ZetWarped;

			public static BuffDef ZetEchoPrimer;

			public static BuffDef BackupDebuff;

			public static BuffDef NightSpeed;

			public static BuffDef NightBlind;

			public static BuffDef AffixWhite;

			public static BuffDef AffixBlue;

			public static BuffDef AffixRed;

			public static BuffDef AffixHaunted;

			public static BuffDef AffixPoison;

			public static BuffDef AffixLunar;

			public static BuffDef AffixEarth;

			public static BuffDef AffixVoid;

			public static BuffDef AffixPlated;

			public static BuffDef AffixWarped;

			public static BuffDef AffixVeiled;

			public static BuffDef AffixAragonite;

			public static BuffDef AffixGold;

			public static BuffDef AffixSanguine;

			public static BuffDef AffixSepia;

			public static BuffDef AffixNullifier;

			public static BuffDef AffixBlighted;

			public static BuffDef AffixBackup;

			public static BuffDef AffixPurity;

			public static BuffDef AffixBarrier;

			public static BuffDef AffixBlackHole;

			public static BuffDef AffixMoney;

			public static BuffDef AffixNight;

			public static BuffDef AffixWater;

			public static BuffDef AffixRealgar;

			public static BuffDef AffixBuffered;

			public static BuffDef AffixOppressive;

			public static BuffDef AffixEmpowering;

			public static BuffDef AffixFrenzied;

			public static BuffDef AffixVolatile;

			public static BuffDef AffixEcho;
		}

		public static class Equip
		{
			public static EquipmentDef AffixWhite;

			public static EquipmentDef AffixBlue;

			public static EquipmentDef AffixRed;

			public static EquipmentDef AffixHaunted;

			public static EquipmentDef AffixPoison;

			public static EquipmentDef AffixLunar;

			public static EquipmentDef AffixEarth;

			public static EquipmentDef AffixVoid;

			public static EquipmentDef AffixPlated;

			public static EquipmentDef AffixWarped;

			public static EquipmentDef AffixVeiled;

			public static EquipmentDef AffixAragonite;

			public static EquipmentDef AffixGold;

			public static EquipmentDef AffixSanguine;

			public static EquipmentDef AffixSepia;

			public static EquipmentDef AffixNullifier;

			public static EquipmentDef AffixBlighted;

			public static EquipmentDef AffixBackup;

			public static EquipmentDef AffixPurity;

			public static EquipmentDef AffixBarrier;

			public static EquipmentDef AffixBlackHole;

			public static EquipmentDef AffixMoney;

			public static EquipmentDef AffixNight;

			public static EquipmentDef AffixWater;

			public static EquipmentDef AffixRealgar;

			public static EquipmentDef AffixBuffered;

			public static EquipmentDef AffixOppressive;

			public static EquipmentDef AffixEmpowering;

			public static EquipmentDef AffixFrenzied;

			public static EquipmentDef AffixVolatile;

			public static EquipmentDef AffixEcho;
		}

		public static class Item
		{
			public static ItemDef ZetAspectsDropCountTracker;

			public static ItemDef ZetAspectsUpdateInventory;

			public static ItemDef ZetAspectWhite;

			public static ItemDef ZetAspectBlue;

			public static ItemDef ZetAspectRed;

			public static ItemDef ZetAspectHaunted;

			public static ItemDef ZetAspectPoison;

			public static ItemDef ZetAspectLunar;

			public static ItemDef ZetAspectEarth;

			public static ItemDef ZetAspectVoid;

			public static ItemDef ZetAspectPlated;

			public static ItemDef ZetAspectWarped;

			public static ItemDef ZetAspectVeiled;

			public static ItemDef ZetAspectAragonite;

			public static ItemDef ZetAspectGold;

			public static ItemDef ZetAspectSanguine;

			public static ItemDef ZetAspectSepia;

			public static ItemDef ZetAspectNullifier;

			public static ItemDef ZetAspectBlighted;

			public static ItemDef ZetAspectBackup;

			public static ItemDef ZetAspectPurity;

			public static ItemDef ZetAspectBarrier;

			public static ItemDef ZetAspectBlackHole;

			public static ItemDef ZetAspectMoney;

			public static ItemDef ZetAspectNight;

			public static ItemDef ZetAspectWater;

			public static ItemDef ZetAspectRealgar;

			public static ItemDef ZetAspectBuffered;

			public static ItemDef ZetAspectOppressive;

			public static ItemDef ZetAspectEmpowering;

			public static ItemDef ZetAspectFrenzied;

			public static ItemDef ZetAspectVolatile;

			public static ItemDef ZetAspectEcho;
		}

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

			public static hook_Init <>9__87_0;

			public static hook_Init <>9__89_0;

			public static hook_Init <>9__90_0;

			public static hook_Init <>9__91_0;

			public static hook_OnEnter <>9__92_0;

			public static hook_CanSelectItemEntry <>9__93_0;

			public static hook_CanSelectEquipmentEntry <>9__94_0;

			internal void <SetupItemTransformations>b__87_0(orig_Init orig)
			{
				//IL_0030: 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)
				List<Pair> list = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem].ToList();
				foreach (ItemDef transformableAspectItemDef in transformableAspectItemDefs)
				{
					list.Add(new Pair
					{
						itemDef1 = transformableAspectItemDef,
						itemDef2 = Item.ZetAspectVoid
					});
					Logger.Info("Successfully added aspect transformation for " + ((Object)transformableAspectItemDef).name);
				}
				ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = list.ToArray();
				orig.Invoke();
			}

			internal void <OnTransmuteManagerInit>b__89_0(orig_Init orig)
			{
				try
				{
					PreInitValidation();
				}
				catch (Exception data)
				{
					Logger.Error(data);
				}
				orig.Invoke();
			}

			internal void <OnRuleCatalogInit>b__90_0(orig_Init orig)
			{
				try
				{
					PreInitValidation();
				}
				catch (Exception data)
				{
					Logger.Error(data);
				}
				orig.Invoke();
			}

			internal void <OnLogBookInit>b__91_0(orig_Init orig)
			{
				try
				{
					SetupCatalog();
				}
				catch (Exception data)
				{
					Logger.Warn("Failed To Setup Catalog!");
					Logger.Error(data);
				}
				orig.Invoke();
			}

			internal void <OnMainMenuEnter>b__92_0(orig_OnEnter orig, BaseMainMenuScreen self, MainMenuController controller)
			{
				orig.Invoke(self, controller);
				try
				{
					OnMenuEnteredFirstTime();
				}
				catch (Exception data)
				{
					Logger.Error(data);
				}
			}

			internal bool <ItemEntrySelectableHook>b__93_0(orig_CanSelectItemEntry orig, ItemDef itemDef, Dictionary<ExpansionDef, bool> expAva)
			{
				//IL_000f: 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)
				if (Object.op_Implicit((Object)(object)itemDef) && aspectItemIndexes.Contains(itemDef.itemIndex))
				{
					if (Configuration.LogbookHideItem.Value)
					{
						return false;
					}
					if (DropHooks.CanObtainItem() && HasRequiredExpansion(itemDef.requiredExpansion, expAva) && !disabledItemIndexes.Contains(itemDef.itemIndex))
					{
						return true;
					}
					return false;
				}
				return orig.Invoke(itemDef, expAva);
			}

			internal bool <EquipmentEntrySelectableHook>b__94_0(orig_CanSelectEquipmentEntry orig, EquipmentDef equipDef, Dictionary<ExpansionDef, bool> expAva)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: 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)
				if (Object.op_Implicit((Object)(object)equipDef) && aspectEquipIndexes.Contains(equipDef.equipmentIndex))
				{
					if (Configuration.LogbookHideEquipment.Value)
					{
						return false;
					}
					if (DropHooks.CanObtainEquipment() && HasRequiredExpansion(equipDef.requiredExpansion, expAva))
					{
						ItemIndex item = ItemizeEliteEquipment(equipDef.equipmentIndex);
						if (!disabledItemIndexes.Contains(item))
						{
							return true;
						}
					}
					return false;
				}
				return orig.Invoke(equipDef, expAva);
			}
		}

		public static AssetBundle Assets;

		public static bool menuVisited = false;

		public static bool setupComplete = false;

		public static bool setupIntermediate = false;

		public static bool setupCompat = false;

		public static bool setupInitialize = false;

		public static Dictionary<BuffIndex, ItemIndex> buffToItem = new Dictionary<BuffIndex, ItemIndex>();

		public static Dictionary<BuffIndex, EquipmentIndex> buffToEquip = new Dictionary<BuffIndex, EquipmentIndex>();

		public static Dictionary<EquipmentIndex, ItemIndex> equipToItem = new Dictionary<EquipmentIndex, ItemIndex>();

		public static List<ItemIndex> disabledItemIndexes = new List<ItemIndex>();

		public static List<ItemIndex> aspectItemIndexes = new List<ItemIndex>();

		public static List<BuffIndex> aspectBuffIndexes = new List<BuffIndex>();

		public static List<EquipmentIndex> aspectEquipIndexes = new List<EquipmentIndex>();

		public static List<ItemDef> transformableAspectItemDefs = new List<ItemDef>();

		internal static ItemTierDef BossItemTier;

		internal static ItemTierDef RedItemTier;

		internal static GameObject BossDropletPrefab;

		internal static GameObject LightningStakePrefab;

		internal static GameObject RejectTextPrefab;

		internal static GameObject CommandCubePrefab;

		internal static GameObject SmokeBombMiniPrefab;

		public static bool limitChillStacks = false;

		public static bool borboFrostBlade = false;

		public static bool shieldJump = false;

		public static bool aspectAbilities = false;

		public static bool immuneHealth = false;

		public static bool altIceActive = false;

		public static bool nemBarrier = false;

		public static bool dropWeightsAvailable = false;

		public static EffectDef RejectTextDef;

		public static ArtifactIndex diluvianArtifactIndex = (ArtifactIndex)(-1);

		public static BodyIndex mithrixBodyIndex = (BodyIndex)(-1);

		public static BodyIndex voidlingBodyIndex = (BodyIndex)(-1);

		public static BodyIndex urchinTurretBodyIndex = (BodyIndex)(-1);

		public static BodyIndex urchinOrbitalBodyIndex = (BodyIndex)(-1);

		public static BodyIndex healOrbBodyIndex = (BodyIndex)(-1);

		public static BodyIndex artifactShellBodyIndex = (BodyIndex)(-1);

		public static BodyIndex goldenTitanBodyIndex = (BodyIndex)(-1);

		public static BuffIndex altSlow80 = (BuffIndex)(-1);

		public static BuffIndex antiGrav = (BuffIndex)(-1);

		public static BuffIndex rageAura = (BuffIndex)(-1);

		public static BuffIndex veiledCooldown = (BuffIndex)(-1);

		public static BuffIndex nullifierRecipient = (BuffIndex)(-1);

		public static BuffIndex waterInvuln = (BuffIndex)(-1);

		public static BuffIndex reactorInvuln = (BuffIndex)(-1);

		public static ItemIndex summonedEcho = (ItemIndex)(-1);

		public static ItemTier lunarVoidTier = (ItemTier)10;

		public static bool ChillCanStack => Buffs.Slow80.canStack;

		public static Sprite CreateAspectSprite(Sprite baseSprite, Sprite outlineSprite)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Color32[] pixels = baseSprite.texture.GetPixels32();
			Color32[] pixels2 = outlineSprite.texture.GetPixels32();
			for (int i = 0; i < pixels2.Length; i++)
			{
				if (pixels2[i].a > 11)
				{
					pixels[i] = pixels2[i];
				}
			}
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			val.SetPixels32(pixels);
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 25f);
		}

		public static ItemIndex GetAspectItemIndex(BuffIndex buffIndex)
		{
			//IL_0006: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (buffToItem.ContainsKey(buffIndex))
			{
				return buffToItem[buffIndex];
			}
			return (ItemIndex)(-1);
		}

		public static EquipmentIndex GetAspectEquipIndex(BuffIndex buffIndex)
		{
			//IL_0006: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (buffToEquip.ContainsKey(buffIndex))
			{
				return buffToEquip[buffIndex];
			}
			return (EquipmentIndex)(-1);
		}

		public static ItemIndex ItemizeEliteEquipment(EquipmentIndex equipIndex)
		{
			//IL_0006: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (equipToItem.ContainsKey(equipIndex))
			{
				return equipToItem[equipIndex];
			}
			return (ItemIndex)(-1);
		}

		public static float GetStackMagnitude(CharacterBody self, BuffDef buffDef)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			Inventory inventory = self.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return 1f;
			}
			float num = CountAspectEquipment(inventory, buffDef);
			if (num > 0f && self.isPlayerControlled)
			{
				num *= Mathf.Max(1f, Configuration.AspectEquipmentEffect.Value);
			}
			num += (float)inventory.GetItemCount(GetAspectItemIndex(buffDef.buffIndex));
			return Mathf.Max(1f, num);
		}

		public static bool HasAspectItemOrEquipment(Inventory inventory, BuffDef buffDef)
		{
			if (CountAspectEquipment(inventory, buffDef) > 0)
			{
				return true;
			}
			if (HasAspectItem(inventory, buffDef))
			{
				return true;
			}
			return false;
		}

		public static bool HasAspectItemOrEquipment(Inventory inventory, BuffIndex buffIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (CountAspectEquipment(inventory, buffIndex) > 0)
			{
				return true;
			}
			if (HasAspectItem(inventory, buffIndex))
			{
				return true;
			}
			return false;
		}

		public static bool HasAspectItemOrEquipment(Inventory inventory, ItemDef itemDef, EquipmentDef equipDef)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)itemDef) && inventory.GetItemCount(itemDef) > 0)
			{
				return true;
			}
			if (Object.op_Implicit((Object)(object)equipDef))
			{
				EquipmentIndex equipmentIndex = equipDef.equipmentIndex;
				if (inventory.currentEquipmentIndex == equipmentIndex)
				{
					return true;
				}
				if (inventory.alternateEquipmentIndex == equipmentIndex)
				{
					return true;
				}
			}
			return false;
		}

		public static int CountAspectEquipment(Inventory inventory, BuffDef buffDef)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return CountAspectEquipment(inventory, buffDef.buffIndex);
		}

		public static int CountAspectEquipment(Inventory inventory, BuffIndex buffIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			EquipmentIndex aspectEquipIndex = GetAspectEquipIndex(buffIndex);
			if ((int)aspectEquipIndex == -1)
			{
				return 0;
			}
			int num = 0;
			if (inventory.currentEquipmentIndex == aspectEquipIndex)
			{
				num++;
			}
			if (inventory.alternateEquipmentIndex == aspectEquipIndex)
			{
				num++;
			}
			return num;
		}

		public static bool HasAspectItem(Inventory inventory, BuffDef buffDef)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return HasAspectItem(inventory, buffDef.buffIndex);
		}

		public static bool HasAspectItem(Inventory inventory, BuffIndex buffIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex aspectItemIndex = GetAspectItemIndex(buffIndex);
			if ((int)aspectItemIndex == -1)
			{
				return false;
			}
			if (inventory.GetItemCount(aspectItemIndex) > 0)
			{
				return true;
			}
			return false;
		}

		public static EliteDef GetEquipmentEliteDef(EquipmentDef equipDef)
		{
			if ((Object)(object)equipDef == (Object)null)
			{
				return null;
			}
			if ((Object)(object)equipDef.passiveBuffDef == (Object)null)
			{
				return null;
			}
			return equipDef.passiveBuffDef.eliteDef;
		}

		internal static void OnAwake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			RoR2Application.isModded = true;
			string text = "com.TPDespair.ZetAspects:2.7.38";
			NetworkModCompatibilityHelper.networkModList = NetworkModCompatibilityHelper.networkModList.Append(text);
			Logger.Info("Adding " + text + " to the networkModList.");
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(AddContentPackProvider);
			if (Configuration.AspectVoidContagiousItem.Value)
			{
				SetupItemTransformations();
			}
			SetupListeners();
			ItemEntrySelectableHook();
			EquipmentEntrySelectableHook();
		}

		private static void AddContentPackProvider(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new ZetAspectsContent());
		}

		internal static void OnContentLoadStart()
		{
			LoadAssets();
			LoadResources();
			Sprites.Load();
			Prefabs.Load();
			CreateBuffs();
			CreateItems();
		}

		private static void LoadAssets()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TPDespair.ZetAspects.zetaspectbundle");
			Assets = AssetBundle.LoadFromStream(stream);
		}

		private static void LoadResources()
		{
			BossItemTier = LegacyResourcesAPI.Load<ItemTierDef>("ItemTierDefs/BossTierDef");
			RedItemTier = LegacyResourcesAPI.Load<ItemTierDef>("ItemTierDefs/Tier3Def");
			BossDropletPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/ItemPickups/BossOrb");
			LightningStakePrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/LightningStake");
			RejectTextPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/DamageRejected");
			CommandCubePrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/CommandCube");
			SmokeBombMiniPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MuzzleFlashes/Bandit2SmokeBombMini");
		}

		private static void CreateBuffs()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = "ZetHeadHunter";
			val.buffColor = new Color(0.5f, 0.5f, 0.35f);
			val.canStack = true;
			val.isDebuff = false;
			val.iconSprite = Sprites.ZetHeadHunter;
			Buff.ZetHeadHunter = val;
			ZetAspectsContent.buffDefs.Add(val);
			BuffDef val2 = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val2).name = "ZetSapped";
			val2.buffColor = new Color(0.5f, 0.75f, 1f);
			val2.canStack = false;
			val2.isDebuff = true;
			val2.iconSprite = Sprites.ZetSapped;
			Buff.ZetSapped = val2;
			ZetAspectsContent.buffDefs.Add(val2);
			BuffDef val3 = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val3).name = "ZetShredded";
			val3.buffColor = new Color(0.185f, 0.75f, 0.465f);
			val3.canStack = false;
			val3.isDebuff = true;
			val3.iconSprite = Sprites.ZetShredded;
			Buff.ZetShredded = val3;
			ZetAspectsContent.buffDefs.Add(val3);
			BuffDef val4 = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val4).name = "ZetPoached";
			val4.buffColor = new Color(0.5f, 0.75f, 0.185f);
			val4.canStack = false;
			val4.isDebuff = true;
			val4.iconSprite = Sprites.ZetPoached;
			Buff.ZetPoached = val4;
			ZetAspectsContent.buffDefs.Add(val4);
			if (Bubbet.Enabled)
			{
				BuffDef val5 = ScriptableObject.CreateInstance<BuffDef>();
				((Object)val5).name = "ZetSepiaBlind";
				val5.buffColor = Color.white;
				val5.canStack = false;
				val5.isDebuff = true;
				val5.iconSprite = Sprites.ZetSepiaBlind;
				Buff.ZetSepiaBlind = val5;
				ZetAspectsContent.buffDefs.Add(val5);
			}
			if (SpikeStrip.Enabled)
			{
				BuffDef val6 = ScriptableObject.CreateInstance<BuffDef>();
				((Object)val6).name = "ZetElusive";
				val6.buffColor = new Color(0.185f, 0.465f, 0.75f);
				val6.canStack = true;
				val6.isDebuff = false;
				val6.iconSprite = Sprites.ZetElusive;
				Buff.ZetElusive = val6;
				ZetAspectsContent.buffDefs.Add(val6);
				BuffDef val7 = ScriptableObject.CreateInstance<BuffDef>();
				((Object)val7).name = "ZetWarped";
				val7.buffColor = new Color(0.65f, 0.5f, 0.75f);
				val7.canStack = false;
				val7.isDebuff = true;
				val7.iconSprite = Sprites.ZetWarped;
				Buff.ZetWarped = val7;
				ZetAspectsContent.buffDefs.Add(val7);
			}
			if (MoreElites.Enabled)
			{
				BuffDef val8 = ScriptableObject.CreateInstance<BuffDef>();
				((Object)val8).name = "ZetEchoPrimer";
				val8.buffColor = Color.white;
				val8.canStack = false;
				val8.isDebuff = false;
				val8.isHidden = true;
				val8.iconSprite = Sprites.ZetElusive;
				Buff.ZetEchoPrimer = val8;
				ZetAspectsContent.buffDefs.Add(val8);
			}
		}

		private static void CreateItems()
		{
			ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
			((Object)val).name = "ZetAspectsDropCountTracker";
			AssignDepricatedTier(val, (ItemTier)5);
			val.AutoPopulateTokens();
			val.hidden = true;
			val.canRemove = false;
			Item.ZetAspectsDropCountTracker = val;
			ZetAspectsContent.itemDefs.Add(val);
			ItemDef val2 = ScriptableObject.CreateInstance<ItemDef>();
			((Object)val2).name = "ZetAspectsUpdateInventory";
			AssignDepricatedTier(val2, (ItemTier)5);
			val2.AutoPopulateTokens();
			val2.hidden = true;
			val2.canRemove = false;
			Item.ZetAspectsUpdateInventory = val2;
			ZetAspectsContent.itemDefs.Add(val2);
			ItemDef item = (Item.ZetAspectWhite = ZetAspectWhite.DefineItem());
			ZetAspectsContent.itemDefs.Add(item);
			transformableAspectItemDefs.Add(item);
			ItemDef item2 = (Item.ZetAspectBlue = ZetAspectBlue.DefineItem());
			ZetAspectsContent.itemDefs.Add(item2);
			transformableAspectItemDefs.Add(item2);
			ItemDef item3 = (Item.ZetAspectRed = ZetAspectRed.DefineItem());
			ZetAspectsContent.itemDefs.Add(item3);
			transformableAspectItemDefs.Add(item3);
			ItemDef item4 = (Item.ZetAspectHaunted = ZetAspectHaunted.DefineItem());
			ZetAspectsContent.itemDefs.Add(item4);
			transformableAspectItemDefs.Add(item4);
			ItemDef item5 = (Item.ZetAspectPoison = ZetAspectPoison.DefineItem());
			ZetAspectsContent.itemDefs.Add(item5);
			transformableAspectItemDefs.Add(item5);
			ItemDef item6 = (Item.ZetAspectLunar = ZetAspectLunar.DefineItem());
			ZetAspectsContent.itemDefs.Add(item6);
			transformableAspectItemDefs.Add(item6);
			ItemDef item7 = (Item.ZetAspectEarth = ZetAspectEarth.DefineItem());
			ZetAspectsContent.itemDefs.Add(item7);
			transformableAspectItemDefs.Add(item7);
			ItemDef item8 = (Item.ZetAspectVoid = ZetAspectVoid.DefineItem());
			ZetAspectsContent.itemDefs.Add(item8);
			if (SpikeStrip.Enabled)
			{
				ItemDef item9 = (Item.ZetAspectPlated = ZetAspectPlated.DefineItem());
				ZetAspectsContent.itemDefs.Add(item9);
				transformableAspectItemDefs.Add(item9);
				ItemDef item10 = (Item.ZetAspectWarped = ZetAspectWarped.DefineItem());
				ZetAspectsContent.itemDefs.Add(item10);
				transformableAspectItemDefs.Add(item10);
				ItemDef item11 = (Item.ZetAspectVeiled = ZetAspectVeiled.DefineItem());
				ZetAspectsContent.itemDefs.Add(item11);
				transformableAspectItemDefs.Add(item11);
				ItemDef item12 = (Item.ZetAspectAragonite = ZetAspectAragonite.DefineItem());
				ZetAspectsContent.itemDefs.Add(item12);
				transformableAspectItemDefs.Add(item12);
			}
			if (GoldenCoastPlus.Enabled)
			{
				ItemDef item13 = (Item.ZetAspectGold = ZetAspectGold.DefineItem());
				ZetAspectsContent.itemDefs.Add(item13);
				transformableAspectItemDefs.Add(item13);
			}
			if (Aetherium.Enabled)
			{
				ItemDef item14 = (Item.ZetAspectSanguine = ZetAspectSanguine.DefineItem());
				ZetAspectsContent.itemDefs.Add(item14);
				transformableAspectItemDefs.Add(item14);
			}
			if (Bubbet.Enabled)
			{
				ItemDef item15 = (Item.ZetAspectSepia = ZetAspectSepia.DefineItem());
				ZetAspectsContent.itemDefs.Add(item15);
				transformableAspectItemDefs.Add(item15);