Decompiled source of SOTSItemRework v1.0.0

SOTSItemRework.dll

Decompiled 4 days ago
using System;
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.ImpMonster;
using IL.RoR2;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Navigation;
using RoR2.Projectile;
using SOTSItemRework.Items.Green;
using SOTSItemRework.Items.Red;
using SOTSItemRework.Items.White;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SOTSItemRework")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SOTSItemRework")]
[assembly: AssemblyTitle("SOTSItemRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace SOTSItemRework
{
	public class ProjectileGlue : MonoBehaviour
	{
		private Transform target;

		private ProjectileTargetComponent targetComponent;

		public void Start()
		{
			targetComponent = ((Component)this).GetComponent<ProjectileTargetComponent>();
			target = targetComponent.target;
		}

		private void FixedUpdate()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)target))
			{
				((Component)this).transform.position = target.position;
			}
		}
	}
	[BepInPlugin("com.Nuxlar.SOTSItemRework", "SOTSItemRework", "1.0.0")]
	public class SOTSItemRework : BaseUnityPlugin
	{
		public static ItemDef emptyItem = ScriptableObject.CreateInstance<ItemDef>();

		public static BuffDef emptyBuff = ScriptableObject.CreateInstance<BuffDef>();

		public static AssetBundle assetBundle;

		public static Sprite transmitterEquipIcon;

		public static ConfigEntry<bool> enableEcho;

		public static ConfigEntry<bool> enableAntler;

		public static ConfigEntry<bool> enableFin;

		public static ConfigEntry<bool> enableChronic;

		public static ConfigEntry<bool> enableLantern;

		public static ConfigEntry<bool> enableDoll;

		public static ConfigEntry<bool> enableBeads;

		public static ConfigEntry<bool> enableThorn;

		public static ConfigEntry<bool> enableTransmitter;

		public static ConfigEntry<bool> enableWarBonds;

		public static ConfigEntry<bool> enableLens;

		public static ConfigEntry<bool> enableNectar;

		private static ConfigFile SIRConfig { 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_01e2: 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)
			SIRConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.SOTSItemRework.cfg", true);
			enableEcho = SIRConfig.Bind<bool>("General", "Enable Warped Echo Change", true, "Enable Rework");
			enableAntler = SIRConfig.Bind<bool>("General", "Enable Antler Shield Change", true, "Enable Rework");
			enableFin = SIRConfig.Bind<bool>("General", "Enable Knockback Fin Change", true, "Enable Rework");
			enableChronic = SIRConfig.Bind<bool>("General", "Enable Chronic Expansion Change", true, "Enable Rework");
			enableLantern = SIRConfig.Bind<bool>("General", "Enable Bolstering Lantern Change", true, "Enable Rework");
			enableDoll = SIRConfig.Bind<bool>("General", "Enable Chance Doll Change", true, "Enable Rework");
			enableBeads = SIRConfig.Bind<bool>("General", "Enable Prayer Beads Change", true, "Enable Rework");
			enableThorn = SIRConfig.Bind<bool>("General", "Enable Noxious Thorn Change", true, "Enable Rework");
			enableTransmitter = SIRConfig.Bind<bool>("General", "Enable Unstable Transmitter Change", true, "Enable Rework");
			enableWarBonds = SIRConfig.Bind<bool>("General", "Enable War Bonds Change", true, "Enable Rework");
			enableLens = SIRConfig.Bind<bool>("General", "Enable Runic Lens Change", true, "Enable Rework");
			enableNectar = SIRConfig.Bind<bool>("General", "Enable Growth Nectar Change", true, "Enable Rework");
			assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "sotsitemrework.bundle"));
			transmitterEquipIcon = assetBundle.LoadAsset<Sprite>("assets/transmitterequipicon.png");
			emptyItem.tier = (ItemTier)5;
			emptyItem.hidden = true;
			emptyItem.deprecatedTier = (ItemTier)5;
			((Object)emptyItem).name = "Empty ItemNux";
			ContentAddition.AddItemDef(emptyItem);
			((Object)emptyBuff).name = "Empty BuffNux";
			ContentAddition.AddBuffDef(emptyBuff);
			bool flag = default(bool);
			ContentAddition.AddEntityState<TransmitterBlink>(ref flag);
			if (enableEcho.Value)
			{
				new WarpedEcho();
			}
			if (enableAntler.Value)
			{
				new AntlerShield();
			}
			if (enableFin.Value)
			{
				new KnockbackFin();
			}
			if (enableChronic.Value)
			{
				new ChronicExpansion();
			}
			if (enableLantern.Value)
			{
				new BolsteringLantern();
			}
			if (enableDoll.Value)
			{
				new ChanceDoll();
			}
			if (enableBeads.Value)
			{
				new PrayerBeads();
			}
			if (enableThorn.Value)
			{
				new NoxiousThorn();
			}
			if (enableTransmitter.Value)
			{
				new UnstableTransmitter();
			}
			if (enableWarBonds.Value)
			{
				new WarBonds();
			}
			if (enableLens.Value)
			{
				new RunicLens();
			}
			if (enableNectar.Value)
			{
				new GrowthNectar();
			}
		}
	}
	public class TransmitterBlink : BaseState
	{
		private Transform modelTransform;

		private float stopwatch;

		private float duration = 0.3f;

		private Vector3 blinkDestination = Vector3.zero;

		private Vector3 blinkStart = Vector3.zero;

		private Animator animator;

		private CharacterModel characterModel;

		private HurtBoxGroup hurtboxGroup;

		private Vector3 blinkVector = Vector3.zero;

		public override void OnEnter()
		{
			//IL_00ae: 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_00bd: 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_00ca: 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_00db: 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_00f7: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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)
			((BaseState)this).OnEnter();
			modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				animator = ((Component)modelTransform).GetComponent<Animator>();
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
				hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>();
			}
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				obj.invisibilityCount++;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup obj2 = hurtboxGroup;
				int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter + 1;
				obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			Vector3 val = GetBlinkVector() * 50f;
			blinkDestination = ((EntityState)this).transform.position;
			blinkStart = ((EntityState)this).transform.position;
			NodeGraph groundNodes = SceneInfo.instance.groundNodes;
			groundNodes.GetNodePosition(groundNodes.FindClosestNode(((EntityState)this).transform.position + val, ((EntityState)this).characterBody.hullClassification, float.PositiveInfinity), ref blinkDestination);
			blinkDestination += ((EntityState)this).transform.position - ((EntityState)this).characterBody.footPosition;
			CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject));
			RiftAttack();
		}

		private void CreateBlinkEffect(Vector3 origin)
		{
			//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_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)
			//IL_001b: 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_0028: Expected O, but got Unknown
			EffectManager.SpawnEffect(BlinkState.blinkPrefab, new EffectData
			{
				rotation = Util.QuaternionSafeLookRotation(blinkVector),
				origin = origin
			}, false);
		}

		protected virtual Vector3 GetBlinkVector()
		{
			//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_002a: 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_002f: 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)
			Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
			return ((Vector3)(ref val)).normalized;
		}

		private void SetPosition(Vector3 newPosition)
		{
			//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)
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPositionAndRotation(newPosition, Quaternion.identity, true);
			}
		}

		private void RiftAttack()
		{
			//IL_0000: 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_0016: 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_0038: 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_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_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_005b: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0086: 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_0092: 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_009d: 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_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)
			//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_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_00d2: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			new BlastAttack
			{
				attacker = ((Component)((EntityState)this).characterBody).gameObject,
				baseDamage = ((EntityState)this).characterBody.damage * 4f,
				baseForce = 1000f,
				bonusForce = Vector3.zero,
				attackerFiltering = (AttackerFiltering)2,
				crit = ((EntityState)this).characterBody.RollCrit(),
				damageColorIndex = (DamageColorIndex)3,
				damageType = DamageTypeCombo.op_Implicit((DamageType)0),
				falloffModel = (FalloffModel)0,
				inflictor = ((Component)((EntityState)this).characterBody).gameObject,
				position = ((EntityState)this).characterBody.corePosition,
				procChainMask = default(ProcChainMask),
				procCoefficient = 1f,
				radius = 25f,
				losType = (LoSType)0,
				teamIndex = (TeamIndex)1
			}.Fire();
			EffectManager.SpawnEffect(CommonAssets.teleportOnLowHealthExplosion, new EffectData
			{
				origin = ((EntityState)this).characterBody.corePosition,
				scale = 50f,
				rotation = Quaternion.identity
			}, true);
			Util.PlaySound("Play_item_proc_teleportOnLowHealth", ((Component)((EntityState)this).characterBody).gameObject);
		}

		public override void FixedUpdate()
		{
			//IL_0045: 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_005c: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			stopwatch += ((EntityState)this).GetDeltaTime();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			SetPosition(Vector3.Lerp(blinkStart, blinkDestination, stopwatch / BlinkState.duration));
			if (!((double)stopwatch < (double)BlinkState.duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			RiftAttack();
			CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject));
			modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform) && Object.op_Implicit((Object)(object)BlinkState.destealthMaterial))
			{
				TemporaryOverlayInstance obj = TemporaryOverlayManager.AddOverlay(((Component)animator).gameObject);
				obj.duration = 1f;
				obj.destroyComponentOnEnd = true;
				obj.originalMaterial = BlinkState.destealthMaterial;
				obj.inspectorCharacterModel = ((Component)animator).gameObject.GetComponent<CharacterModel>();
				obj.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
				obj.animateShaderAlpha = true;
			}
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj2 = characterModel;
				obj2.invisibilityCount--;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup obj3 = hurtboxGroup;
				int hurtBoxesDeactivatorCounter = obj3.hurtBoxesDeactivatorCounter - 1;
				obj3.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = true;
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)5;
		}
	}
}
namespace SOTSItemRework.Items.White
{
	public class AntlerShield
	{
		private ItemDef antlerDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/NegateAttack/NegateAttack.asset").WaitForCompletion();

		public AntlerShield()
		{
			//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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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
			antlerDef.pickupToken = "Gain shield equal to <style=cIsUtility>4%</style> <style=cStack>(+4% per stack)</style> of your maximum health. Increase movement speed by <style=cIsUtility>14%</style> <style=cStack>(+14% per stack)</style> while shield is active.";
			antlerDef.descriptionToken = "Gain a recharging shield and increase movement speed while shield is active.";
			HealthComponent.TakeDamageProcess += new Manipulator(RemoveVanillaAntlerShield);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(NewAntlerShield);
		}

		private void NewAntlerShield(CharacterBody sender, StatHookEventArgs args)
		{
			if (!Object.op_Implicit((Object)(object)sender.inventory))
			{
				return;
			}
			int itemCount = sender.inventory.GetItemCount(Items.NegateAttack);
			if (itemCount > 0)
			{
				args.baseShieldAdd += 0.04f * sender.maxHealth * (float)itemCount;
				if (Object.op_Implicit((Object)(object)sender.healthComponent) && sender.healthComponent.shield > 0f)
				{
					args.moveSpeedMultAdd += 0.14f * (float)itemCount;
				}
			}
		}

		private void RemoveVanillaAntlerShield(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(ItemCounts), "antlerShield"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0)
			}))
			{
				val.Index += 2;
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int stack) => int.MaxValue));
			}
			else
			{
				Debug.LogError((object)"SOTSItemRework: Removing vanilla Antler Shield hook failed.");
			}
		}
	}
	public class BolsteringLantern
	{
		private ItemDef lanternDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/LowerHealthHigherDamage/LowerHealthHigherDamage.asset").WaitForCompletion();

		public BolsteringLantern()
		{
			//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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			lanternDef.pickupToken = "While <style=cIsHealth>health and shield are at 100%</style>, increase damage by <style=cIsUtility>20%</style> <style=cStack>(+20% per stack)</style>.";
			lanternDef.descriptionToken = "Deal extra damage at max health.";
			CharacterBody.UpdateLowerHealthHigherDamage += new hook_UpdateLowerHealthHigherDamage(LanternChange);
		}

		private void LanternChange(orig_UpdateLowerHealthHigherDamage orig, CharacterBody self)
		{
			//IL_0120: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Invalid comparison between Unknown and I4
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Invalid comparison between Unknown and I4
			//IL_0193: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)self.inventory))
			{
				return;
			}
			int itemCount = self.inventory.GetItemCount(Items.LowerHealthHigherDamage);
			if (NetworkServer.active)
			{
				if (itemCount > 0)
				{
					if (Object.op_Implicit((Object)(object)self.inventory) && !((double)self.healthComponent.health <= 0.0) && (int)self.teamComponent.teamIndex == 1)
					{
						float combinedHealthFraction = self.healthComponent.combinedHealthFraction;
						if ((double)combinedHealthFraction == 1.0 && !self.HasBuff(Buffs.LowerHealthHigherDamageBuff))
						{
							self.AddBuff(Buffs.LowerHealthHigherDamageBuff);
							Util.PlaySound("Play_item_proc_lowerHealthHigherDamage_proc", ((Component)self).gameObject);
							self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 1f));
						}
						else if (self.HasBuff(Buffs.LowerHealthHigherDamageBuff) && (double)combinedHealthFraction != 1.0)
						{
							self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff);
							self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 0f));
						}
					}
				}
				else if (self.HasBuff(Buffs.LowerHealthHigherDamageBuff))
				{
					self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff);
					self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 0f));
				}
			}
			else if (itemCount == 0 && self.HasBuff(Buffs.LowerHealthHigherDamageBuff) && !((double)self.healthComponent.health <= 0.0) && (int)self.teamComponent.teamIndex == 1 && (double)self.healthComponent.GetNormalizedHealth() != 1.0)
			{
				self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff);
				self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 0f));
			}
		}
	}
	public class ChronicExpansion
	{
		private ItemDef cExpansionDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/IncreaseDamageOnMultiKill/IncreaseDamageOnMultiKill.asset").WaitForCompletion();

		public ChronicExpansion()
		{
			//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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			cExpansionDef.nameToken = "Escalating Expansion";
			cExpansionDef.pickupToken = "Gain a stacking 5% Critical Strike chance after killing an enemy for <style=cIsUtility>5 seconds</style> <style=cStack>(+2.5s per stack)</style>. Duration resets with each kill.";
			cExpansionDef.descriptionToken = "Gain a stacking 5% Critical Strike chance after killing an enemy for 5 seconds. Duration resets with each kill.";
			CharacterBody.RecalculateStats += new Manipulator(RemoveVanillaCExpansion);
			CharacterBody.RecalculateStats += new Manipulator(RemoveVanillaCExpansionBuff);
			GlobalEventManager.onCharacterDeathGlobal += ApplyCExpansionBuff;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(NewCExpansionBuff);
			CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(ResetCExpansionBuff);
			CharacterBody.UpdateMultiKill += new hook_UpdateMultiKill(RemoveVanillaCExpansionMultiKillUpdate);
			CharacterBody.AddMultiKill += new hook_AddMultiKill(RemoveVanillaCExpansionMultiKill);
		}

		private void RemoveVanillaCExpansionMultiKillUpdate(orig_UpdateMultiKill orig, CharacterBody self, float deltaTime)
		{
		}

		private void RemoveVanillaCExpansionMultiKill(orig_AddMultiKill orig, CharacterBody self, int count)
		{
		}

		private void RemoveVanillaCExpansionBuff(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: 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.MatchLdsfld(x, typeof(Buffs), "IncreaseDamageBuff")
			}))
			{
				val.Remove();
				val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyBuff");
			}
			else
			{
				Debug.LogError((object)"SOTSItemRework: Removing vanilla CExpansion buff hook failed.");
			}
		}

		private void ResetCExpansionBuff(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			//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)
			//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)
			if (buffDef.buffIndex == Buffs.IncreaseDamageBuff.buffIndex)
			{
				foreach (TimedBuff timedBuff in self.timedBuffs)
				{
					if (timedBuff.buffIndex == Buffs.IncreaseDamageBuff.buffIndex)
					{
						timedBuff.timer = duration;
					}
				}
			}
			orig.Invoke(self, buffDef, duration);
		}

		private void ApplyCExpansionBuff(DamageReport dmgReport)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)dmgReport.attacker) || !Object.op_Implicit((Object)(object)dmgReport.attackerBody) || !Object.op_Implicit((Object)(object)dmgReport.victim) || !Object.op_Implicit((Object)(object)dmgReport.victimBody) || !NetworkServer.active)
			{
				return;
			}
			CharacterBody attackerBody = dmgReport.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody.inventory) && NetworkServer.active)
			{
				int itemCount = attackerBody.inventory.GetItemCount(Items.IncreaseDamageOnMultiKill);
				if (itemCount > 0)
				{
					float num = 2.5f;
					num += 2.5f * (float)itemCount;
					attackerBody.AddTimedBuffAuthority(Buffs.IncreaseDamageBuff.buffIndex, num);
				}
			}
		}

		private void RemoveVanillaCExpansion(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: 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.MatchLdsfld(x, typeof(Items), "IncreaseDamageOnMultiKill")
			}))
			{
				val.Remove();
				val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem");
			}
			else
			{
				Debug.LogError((object)"SOTSItemRework: Removing vanilla CExpansion hook failed.");
			}
		}

		private void NewCExpansionBuff(CharacterBody sender, StatHookEventArgs args)
		{
			int buffCount = sender.GetBuffCount(Buffs.IncreaseDamageBuff);
			if (buffCount > 0)
			{
				args.critAdd += 5f * (float)buffCount;
			}
		}
	}
	public class KnockbackFin
	{
		private ItemDef finDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/KnockBackHitEnemies/KnockBackHitEnemies.asset").WaitForCompletion();

		public KnockbackFin()
		{
			//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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			finDef.nameToken = "Nimble Fin";
			finDef.pickupToken = "Gain <style=cIsUtility>1</style> <style=cStack>(+1 per stack)</style> weaker base jump.";
			finDef.descriptionToken = "Gain an additional base jump.";
			CharacterBody.RecalculateStats += new hook_RecalculateStats(NewFin);
			GlobalEventManager.ProcessHitEnemy += new Manipulator(RemoveVanillaFin);
		}

		private void NewFin(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCount(Items.KnockBackHitEnemies) > 0)
			{
				int num = 1;
				if (((Object)self).name.Contains("Merc"))
				{
					num = 2;
				}
				if (((Object)self).name.Contains("Heretic"))
				{
					num = 3;
				}
				self.baseJumpCount = num + self.inventory.GetItemCount(Items.KnockBackHitEnemies);
			}
		}

		private void RemoveVanillaFin(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: 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.MatchLdsfld(x, typeof(Items), "KnockBackHitEnemies")
			}))
			{
				val.Remove();
				val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem");
			}
			else
			{
				Debug.LogError((object)"SOTSItemRework: Removing vanilla Fin hook failed.");
			}
		}
	}
	public class WarpedEcho
	{
		private ItemDef echoDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/DelayedDamage/DelayedDamage.asset").WaitForCompletion();

		private static GameObject microMissile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/MicroMissileProjectile.prefab").WaitForCompletion(), "MicroMissileNux", false);

		public WarpedEcho()
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			microMissile.GetComponent<MissileController>().maxVelocity = 35f;
			microMissile.GetComponent<ProjectileController>().procCoefficient = 0.1f;
			echoDef.nameToken = "Targeting Compass";
			echoDef.pickupToken = "15% chance to fire a micro-missile that deals <style=cIsUtility>75%</style> <style=cStack>(+75% per stack)</style> TOTAL damage.";
			echoDef.descriptionToken = "Chance to fire a micro-missile.";
			DelayedDamageBehavior.Update += new hook_Update(RemoveVanillaEchoBehavior);
			GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(NewEcho);
			CharacterBody.UpdateDelayedDamage += new hook_UpdateDelayedDamage(RemoveVanillaEcho);
		}

		private void RemoveVanillaEcho(orig_UpdateDelayedDamage orig, CharacterBody self, float deltaTime)
		{
		}

		private void RemoveVanillaEchoBehavior(orig_Update orig, DelayedDamageBehavior self)
		{
		}

		private void NewEcho(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_00b7: 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)
			orig.Invoke(self, damageInfo, victim);
			if ((double)damageInfo.procCoefficient == 0.0 || damageInfo.rejected || !NetworkServer.active || !Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			CharacterMaster master = component.master;
			if (!Object.op_Implicit((Object)(object)master))
			{
				return;
			}
			Inventory inventory = master.inventory;
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)1))
			{
				int itemCount = inventory.GetItemCount(Items.DelayedDamage);
				if (itemCount > 0 && Util.CheckRoll(15f * damageInfo.procCoefficient, master))
				{
					float num = 0.75f * (float)itemCount;
					float num2 = Util.OnHitProcDamage(damageInfo.damage, component.damage, num);
					MissileUtils.FireMissile(component.corePosition, component, damageInfo.procChainMask, victim, num2, damageInfo.crit, microMissile, (DamageColorIndex)3, true);
				}
			}
		}
	}
}
namespace SOTSItemRework.Items.Red
{
	public class GrowthNectar
	{
		private ItemDef nectarDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/BoostAllStats/BoostAllStats.asset").WaitForCompletion();

		public GrowthNectar()
		{
			//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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			nectarDef.nameToken = "Vitality Nectar";
			nectarDef.pickupToken = "Gain a <style=cIsUtility>10%</style> <style=cStack>(+10% per stack)</style> stat boost while in combat.";
			nectarDef.descriptionToken = "Gain a 10% stat boost while in combat.";
			CharacterBody.RecalculateStats += new hook_RecalculateStats(AddNewNectar);
			CharacterBody.UpdateBoostAllStatsTimer += new hook_UpdateBoostAllStatsTimer(RemoveVanillaNectarTimer);
		}

		private void RemoveVanillaNectarTimer(orig_UpdateBoostAllStatsTimer orig, CharacterBody self, float deltaTime)
		{
		}

		private void AddNewNectar(orig_RecalculateStats orig, CharacterBody self)
		{
			//IL_0052: 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)
			orig.Invoke(self);
			if (self.inventory.GetItemCount(Items.BoostAllStats) > 0 && !self.outOfCombat)
			{
				if (self.boostAllStatsMultiplier != 0.1f)
				{
					self.boostAllStatsMultiplier = 0.1f;
				}
				self.SetBuffCount(Buffs.BoostAllStatsBuff.buffIndex, 1);
			}
			else
			{
				self.SetBuffCount(Buffs.BoostAllStatsBuff.buffIndex, 0);
			}
		}
	}
	public class RunicLens
	{
		private ItemDef lensDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/MeteorAttackOnHighDamage/MeteorAttackOnHighDamage.asset").WaitForCompletion();

		public RunicLens()
		{
			//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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			lensDef.nameToken = "Runic Talisman";
			lensDef.pickupToken = "Gain <style=cIsUtility>25%</style><style=cStack> (+25% per stack)</style> move speed and decrease slow debuffs by <style=cIsUtility>50%</style><style=cStack> (+25% per stack)</style>.";
			lensDef.descriptionToken = "Gain move speed and reduce slow debuffs.";
			CharacterBody.RecalculateStats += new Manipulator(ReducesSlows);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			MeteorAttackOnHighDamageBehavior.FixedUpdate += new hook_FixedUpdate(RemoveVanillaLens);
		}

		private void RemoveVanillaLens(orig_FixedUpdate orig, MeteorAttackOnHighDamageBehavior self)
		{
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(Items.MeteorAttackOnHighDamage);
				if (itemCount > 0)
				{
					args.moveSpeedMultAdd += 0.25f * (float)itemCount;
				}
			}
		}

		private void ReducesSlows(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int totalSlowIdx = -1;
			int idx1 = -1;
			int num3 = default(int);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMoveSpeed")
			}) || !val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMoveSpeed")
			}) || !val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref idx1)
			}) || !val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, idx1),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref totalSlowIdx),
				(Instruction x) => ILPatternMatchingExt.MatchDiv(x),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, idx1)
			}))
			{
				return;
			}
			val.TryGotoPrev(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, totalSlowIdx)
			});
			val.Index += 1;
			val.Emit(OpCodes.Ldarg, 0);
			val.EmitDelegate<Func<float, CharacterBody, float>>((Func<float, CharacterBody, float>)delegate(float totalSlow, CharacterBody body)
			{
				int itemCount = body.inventory.GetItemCount(Items.MeteorAttackOnHighDamage);
				float num = totalSlow - 1f;
				if (itemCount > 0 && num > 0f)
				{
					float num2 = Mathf.Clamp01(0.5f + 0.25f * (float)(itemCount - 1));
					return totalSlow - num * num2;
				}
				return totalSlow;
			});
		}
	}
	public class WarBonds
	{
		private ItemDef bondDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/GoldOnStageStart/GoldOnStageStart.asset").WaitForCompletion();

		private static GameObject orbitalProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Captain/CaptainAirstrikeProjectile2.prefab").WaitForCompletion();

		public WarBonds()
		{
			//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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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
			orbitalProjectile.AddComponent<ProjectileGlue>();
			orbitalProjectile.AddComponent<ProjectileTargetComponent>();
			bondDef.nameToken = "Orbital Launch Codes";
			bondDef.pickupToken = "10% chance on hit to launch an orbital probe that deals <style=cIsUtility>750%</style> <style=cStack>(+750% per stack)</style> total damage.";
			bondDef.descriptionToken = "10% chance on hit to launch an orbital probe.";
			GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(NewWarBond);
			GoldOnStageStartBehaviour.OnEnable += new hook_OnEnable(RemoveVanillaBondOnEnable);
			GoldOnStageStartBehaviour.OnDisable += new hook_OnDisable(RemoveVanillaBondOnDisable);
		}

		private void RemoveVanillaBondOnEnable(orig_OnEnable orig, GoldOnStageStartBehaviour self)
		{
		}

		private void RemoveVanillaBondOnDisable(orig_OnDisable orig, GoldOnStageStartBehaviour self)
		{
		}

		private void NewWarBond(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_00c8: 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_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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, victim);
			if ((double)damageInfo.procCoefficient == 0.0 || damageInfo.rejected || !NetworkServer.active || !Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			CharacterMaster master = component.master;
			if (!Object.op_Implicit((Object)(object)master))
			{
				return;
			}
			Inventory inventory = master.inventory;
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)22))
			{
				int itemCount = inventory.GetItemCount(Items.GoldOnStageStart);
				if (itemCount > 0 && Util.CheckRoll(10f * damageInfo.procCoefficient, master))
				{
					float num = 7.5f + 7.5f * (float)itemCount;
					float damage = Util.OnHitProcDamage(damageInfo.damage, component.damage, num);
					ProcChainMask procChainMask = default(ProcChainMask);
					((ProcChainMask)(ref procChainMask)).AddProc((ProcType)22);
					FireProjectileInfo val = default(FireProjectileInfo);
					val.projectilePrefab = orbitalProjectile;
					val.position = damageInfo.position;
					val.rotation = Quaternion.identity;
					val.owner = damageInfo.attacker;
					val.damage = damage;
					val.force = 2000f;
					val.crit = damageInfo.crit;
					val.damageColorIndex = (DamageColorIndex)3;
					val.target = victim;
					val.procChainMask = procChainMask;
					FireProjectileInfo val2 = val;
					ProjectileManager.instance.FireProjectile(val2);
				}
			}
		}
	}
}
namespace SOTSItemRework.Items.Green
{
	public class ChanceDoll
	{
		private ItemDef dollDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/ExtraShrineItem/ExtraShrineItem.asset").WaitForCompletion();

		public ChanceDoll()
		{
			//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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			dollDef.pickupToken = "Increase Luck by <style=cIsUtility>20%</style> <style=cStack>(+20% per stack)</style>.";
			dollDef.descriptionToken = "Increase Luck by 20%.";
			ShrineChanceBehavior.AddShrineStack += new Manipulator(RemoveVanillaDoll);
			CharacterMaster.OnInventoryChanged += new hook_OnInventoryChanged(AddDecimalLuck);
			Util.CheckRoll_float_float_CharacterMaster += new hook_CheckRoll_float_float_CharacterMaster(CalculateDecimalLuck);
		}

		private void RemoveVanillaDoll(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: 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.MatchLdsfld(x, typeof(Items), "ExtraShrineItem")
			}))
			{
				val.Remove();
				val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem");
			}
			else
			{
				Debug.LogError((object)"SOTSItemRework: Removing vanilla Doll hook failed.");
			}
		}

		private void AddDecimalLuck(orig_OnInventoryChanged orig, CharacterMaster self)
		{
			orig.Invoke(self);
			if (self.inventory.GetItemCount(Items.ExtraShrineItem) > 0)
			{
				self.luck = 0f;
				self.luck += (float)self.inventory.GetItemCount(Items.Clover);
				self.luck -= (float)self.inventory.GetItemCount(Items.LunarBadLuck);
				self.luck += 0.2f * (float)self.inventory.GetItemCount(Items.ExtraShrineItem);
			}
		}

		private bool CalculateDecimalLuck(orig_CheckRoll_float_float_CharacterMaster orig, float percentChance, float luck, CharacterMaster effectOriginMaster)
		{
			if (luck > 0f && luck % 1f != 0f)
			{
				if (percentChance <= 0f)
				{
					return false;
				}
				int num = Mathf.FloorToInt(Mathf.Abs(luck));
				float num2 = Mathf.Abs(luck) - (float)num;
				float num3 = Random.Range(0f, 100f);
				for (int i = 0; i < num; i++)
				{
					float num4 = Random.Range(0f, 100f);
					num3 = ((luck > 0f) ? Mathf.Min(num3, num4) : Mathf.Max(num3, num4));
				}
				if (num2 > 0f)
				{
					float num5 = Random.Range(0f, 100f);
					if (luck > 0f && num5 < num2 * 100f)
					{
						float num6 = Random.Range(0f, 100f);
						num3 = Mathf.Min(num3, num6);
					}
				}
				if ((double)num3 > (double)percentChance)
				{
					return false;
				}
				if (Object.op_Implicit((Object)(object)effectOriginMaster))
				{
					GameObject bodyObject = effectOriginMaster.GetBodyObject();
					if (Object.op_Implicit((Object)(object)bodyObject))
					{
						CharacterBody component = bodyObject.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component))
						{
							component.wasLucky = true;
						}
					}
				}
				return true;
			}
			return orig.Invoke(percentChance, luck, effectOriginMaster);
		}
	}
	public class NoxiousThorn
	{
		private ItemDef thornDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/TriggerEnemyDebuffs/TriggerEnemyDebuffs.asset").WaitForCompletion();

		private GameObject thornExplosionEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Items/TriggerEnemyDebuffs/NoxiousThornExplosion.prefab").WaitForCompletion();

		public NoxiousThorn()
		{
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008a: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			thornExplosionEffect.GetComponent<EffectComponent>().soundName = "Play_acrid_m2_explode";
			Transform transform = thornExplosionEffect.transform;
			transform.localScale *= 2f;
			foreach (Transform item in thornExplosionEffect.transform)
			{
				item.localScale *= 2f;
			}
			thornDef.pickupToken = "Enemies explode on death for <style=cIsUtility>150%</style> <style=cStack>(+150% per stack)</style> base damage in a <style=cIsUtility>12m</style> <style=cStack>(+2.4m per stack)</style> radius and poison enemies.";
			thornDef.descriptionToken = "Enemies explode and poison nearby enemies on death.";
			GlobalEventManager.onCharacterDeathGlobal += CreateThornExplosion;
			CharacterBody.TriggerEnemyDebuffs += new hook_TriggerEnemyDebuffs(RemoveVanillaThorn);
		}

		private void RemoveVanillaThorn(orig_TriggerEnemyDebuffs orig, CharacterBody self, DamageInfo damageInfo)
		{
		}

		private void CreateThornExplosion(DamageReport dmgReport)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00ce: 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_00e1: 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_00e7: 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_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_0104: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_012e: 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_0130: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0187: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)dmgReport.attacker) || !Object.op_Implicit((Object)(object)dmgReport.attackerBody) || !Object.op_Implicit((Object)(object)dmgReport.victim) || !Object.op_Implicit((Object)(object)dmgReport.victimBody) || !NetworkServer.active)
			{
				return;
			}
			CharacterBody attackerBody = dmgReport.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody.inventory) && NetworkServer.active)
			{
				int itemCount = attackerBody.inventory.GetItemCount(Items.TriggerEnemyDebuffs);
				if (itemCount > 0)
				{
					Vector3 corePosition = dmgReport.victimBody.corePosition;
					float num = (float)(12.0 + 2.4 * ((double)itemCount - 1.0));
					float num2 = 1.5f * (float)itemCount;
					float baseDamage = Util.OnKillProcDamage(attackerBody.damage, num2);
					new BlastAttack
					{
						attacker = dmgReport.attacker,
						baseDamage = baseDamage,
						baseForce = 1000f,
						bonusForce = Vector3.zero,
						attackerFiltering = (AttackerFiltering)2,
						crit = dmgReport.attackerBody.RollCrit(),
						damageColorIndex = (DamageColorIndex)3,
						damageType = DamageTypeCombo.op_Implicit((DamageType)4096),
						falloffModel = (FalloffModel)0,
						inflictor = dmgReport.attacker,
						position = corePosition,
						procChainMask = default(ProcChainMask),
						procCoefficient = 1f,
						radius = num,
						losType = (LoSType)0,
						teamIndex = dmgReport.attackerBody.teamComponent.teamIndex
					}.Fire();
					EffectManager.SpawnEffect(CommonAssets.thornExplosionEffect, new EffectData
					{
						origin = dmgReport.victimBody.corePosition,
						scale = num * 2f,
						rotation = Quaternion.identity
					}, true);
				}
			}
		}
	}
	public class PrayerBeads
	{
		private ItemDef beadsDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/ExtraStatsOnLevelUp/ExtraStatsOnLevelUp.asset").WaitForCompletion();

		public PrayerBeads()
		{
			//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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			beadsDef.pickupToken = "Grows in power by absorbing experience, storing <style=cIsUtility>5%</style> <style=cStack>(+5% per item stack)</style> of player stats per item level up.";
			beadsDef.descriptionToken = "Stores experience and gives stats on item level up.";
			CharacterBody.RecalculateStats += new Manipulator(RemoveRemovalFunctionality);
			CharacterBody.prayerBeadCalculateAppliedStats += new Manipulator(ReduceBeadStats);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(AddRemovalLogic);
		}

		private void AddRemovalLogic(orig_RecalculateStats orig, CharacterBody self)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCount(Items.ExtraStatsOnLevelUp) <= 0 && self.GetBuffCount(Buffs.ExtraStatsOnLevelUpBuff) > 0)
			{
				self.SetBuffCount(Buffs.ExtraStatsOnLevelUpBuff.buffIndex, 0);
			}
		}

		private void ReduceBeadStats(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.2f)
			}))
			{
				val.Next.Operand = 0.05f;
			}
			else
			{
				Debug.LogError((object)"SOTSItemRework: Tweaking Beads stats hook failed.");
			}
		}

		private void RemoveRemovalFunctionality(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: 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.MatchLdsfld(x, typeof(Items), "ExtraStatsOnLevelUp")
			}))
			{
				val.Remove();
				val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem");
			}
			else
			{
				Debug.LogError((object)"SOTSItemRework: Removing vanilla Beads hook failed.");
			}
		}
	}
	public class UnstableTransmitter
	{
		private ItemDef transmitterDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/TeleportOnLowHealth/TeleportOnLowHealth.asset").WaitForCompletion();

		private static EquipmentDef transmitterEquip;

		public UnstableTransmitter()
		{
			//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_0025: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			transmitterDef.deprecatedTier = (ItemTier)5;
			transmitterEquip = ScriptableObject.CreateInstance<EquipmentDef>();
			transmitterEquip.appearsInMultiPlayer = true;
			transmitterEquip.appearsInSinglePlayer = true;
			transmitterEquip.canBeRandomlyTriggered = false;
			transmitterEquip.canDrop = false;
			transmitterEquip.colorIndex = (ColorIndex)5;
			transmitterEquip.cooldown = 20f;
			transmitterEquip.isLunar = false;
			transmitterEquip.isBoss = false;
			transmitterEquip.enigmaCompatible = false;
			transmitterEquip.pickupIconSprite = SOTSItemRework.transmitterEquipIcon;
			transmitterEquip.pickupModelPrefab = transmitterDef.pickupModelPrefab;
			transmitterEquip.nameToken = transmitterDef.nameToken;
			((Object)transmitterEquip).name = "transmitter";
			transmitterEquip.pickupToken = "Enter a dimensional rift, teleporting forwards and damaging nearby enemies for <style=cIsUtility>400%</style> base damage when entering and exiting the rift.";
			transmitterEquip.descriptionToken = "Enter a dimensional rift, teleporting forwards and damaging nearby enemies when entering and exiting the rift.";
			transmitterEquip.loreToken = transmitterDef.loreToken;
			ContentAddition.AddEquipmentDef(transmitterEquip);
			EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
			TeleportOnLowHealthBehavior.Start += new hook_Start(RemoveVanillaTransmitterStart);
			TeleportOnLowHealthBehavior.Update += new hook_Update(RemoveVanillaTransmitterUpdate);
			TeleportOnLowHealthBehavior.OnDisable += new hook_OnDisable(RemoveVanillaTransmitterDisable);
		}

		private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
		{
			if ((Object)(object)equipmentDef == (Object)(object)transmitterEquip)
			{
				return ActivateEquipment(self);
			}
			return orig.Invoke(self, equipmentDef);
		}

		protected bool ActivateEquipment(EquipmentSlot slot)
		{
			EntityStateMachine[] components = ((Component)slot.characterBody).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName == "Body")
				{
					val.SetInterruptState((EntityState)(object)new TransmitterBlink(), (InterruptPriority)5);
				}
			}
			return true;
		}

		private void RemoveVanillaTransmitterStart(orig_Start orig, TeleportOnLowHealthBehavior self)
		{
		}

		private void RemoveVanillaTransmitterUpdate(orig_Update orig, TeleportOnLowHealthBehavior self)
		{
		}

		private void RemoveVanillaTransmitterDisable(orig_OnDisable orig, TeleportOnLowHealthBehavior self)
		{
		}
	}
}