Decompiled source of RainrotSUL v1.3.5

RainrotSharedUtils.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
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 EntityStates;
using EntityStates.ArtifactShell;
using EntityStates.BeetleGuardMonster;
using EntityStates.Bell.BellWeapon;
using EntityStates.BrotherMonster;
using EntityStates.Captain.Weapon;
using EntityStates.Chef;
using EntityStates.ChildMonster;
using EntityStates.ClayBoss;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Croco;
using EntityStates.FalseSon;
using EntityStates.FlyingVermin.Weapon;
using EntityStates.GlobalSkills.LunarNeedle;
using EntityStates.GrandParentBoss;
using EntityStates.GreaterWispMonster;
using EntityStates.Gup;
using EntityStates.LemurianMonster;
using EntityStates.Loader;
using EntityStates.LunarWisp;
using EntityStates.Mage.Weapon;
using EntityStates.MiniMushroom;
using EntityStates.MinorConstruct.Weapon;
using EntityStates.Railgunner.Weapon;
using EntityStates.Seeker;
using EntityStates.Toolbot;
using EntityStates.VagrantMonster;
using EntityStates.VoidBarnacle.Weapon;
using EntityStates.VoidSurvivor.Weapon;
using IL.EntityStates.Bell.BellWeapon;
using IL.EntityStates.FlyingVermin.Weapon;
using IL.EntityStates.Huntress.HuntressWeapon;
using IL.RoR2;
using IL.RoR2.UI;
using Inferno;
using Inferno.Skill_Misc;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.ArtifactShell;
using On.EntityStates.BeetleGuardMonster;
using On.EntityStates.Bell.BellWeapon;
using On.EntityStates.BrotherMonster;
using On.EntityStates.Captain.Weapon;
using On.EntityStates.Chef;
using On.EntityStates.ChildMonster;
using On.EntityStates.ClayBoss;
using On.EntityStates.Croco;
using On.EntityStates.FalseSon;
using On.EntityStates.GrandParentBoss;
using On.EntityStates.GreaterWispMonster;
using On.EntityStates.Gup;
using On.EntityStates.LemurianMonster;
using On.EntityStates.Loader;
using On.EntityStates.LunarWisp;
using On.EntityStates.Mage.Weapon;
using On.EntityStates.MiniMushroom;
using On.EntityStates.Railgunner.Weapon;
using On.EntityStates.Seeker;
using On.EntityStates.VagrantMonster;
using On.EntityStates.VoidSurvivor.Weapon;
using On.RoR2;
using On.RoR2.Projectile;
using On.RoR2.Skills;
using R2API;
using R2API.Utils;
using RainrotSharedUtils.Components;
using RainrotSharedUtils.Difficulties;
using RainrotSharedUtils.Frost;
using RainrotSharedUtils.Shelters;
using RainrotSharedUtils.Status;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using SnowtimeToybox;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

[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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RainrotSharedUtils")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RainrotSharedUtils")]
[assembly: AssemblyTitle("RainrotSharedUtils")]
[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 RainrotSharedUtils
{
	public static class Assets
	{
		internal static GameObject iceDelayBlastPrefab;

		public static GameObject iceNovaEffectStrong;

		public static GameObject iceNovaEffectWeak;

		public static GameObject iceNovaEffectLowPriority;

		public static Texture2D iceNovaRamp;

		public static Texture2D iceNovaRampPersistent;

		public static BuffDef shockMarker;

		public static int shockMarkerDuration = 4;

		public static BuffDef shockHealCooldown;

		public static Color32 sparkBoosterColor = new Color32((byte)35, (byte)115, byte.MaxValue, byte.MaxValue);

		public static BuffDef sparkBoosterBuff;

		public static float sparkBoosterDuration = 8f;

		public static float sparkBoosterAspdBonus = 0.25f;

		public const int maxNebulaBoosterStackCount = 5;

		public static float nebulaBoosterBuffDuration = 5f;

		public static float nebulaBoosterBuffRadius = 50f;

		public static GameObject sparkBoosterObject;

		public static EffectDef RegisterEffect(GameObject effect)
		{
			//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)
			//IL_009c: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			if ((Object)(object)effect == (Object)null)
			{
				Debug.LogError((object)"Effect prefab was null");
				return null;
			}
			EffectComponent component = effect.GetComponent<EffectComponent>();
			if ((Object)(object)component == (Object)null)
			{
				Debug.LogErrorFormat("Effect prefab: \"{0}\" does not have an EffectComponent.", new object[1] { ((Object)effect).name });
				return null;
			}
			VFXAttributes component2 = effect.GetComponent<VFXAttributes>();
			if ((Object)(object)component2 == (Object)null)
			{
				Debug.LogErrorFormat("Effect prefab: \"{0}\" does not have a VFXAttributes component.", new object[1] { ((Object)effect).name });
				return null;
			}
			ContentAddition.AddEffect(effect);
			return new EffectDef
			{
				prefab = effect,
				prefabEffectComponent = component,
				prefabVfxAttributes = component2,
				prefabName = ((Object)effect).name,
				spawnSoundEventName = component.soundName
			};
		}

		private static Texture2D CreateNewRampTex(Gradient grad)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 8, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[8];
			for (int i = 0; i < 256; i++)
			{
				Color val2 = grad.Evaluate((float)i / 255f);
				for (int j = 0; j < 8; j++)
				{
					array[j] = val2;
				}
				val.SetPixels(i, 0, 1, 8, array);
			}
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply();
			return val;
		}

		public static void Init()
		{
			CreateFrostNovaAssets();
			CreateShockReworkAssets();
		}

		private static void CreateFrostNovaAssets()
		{
			iceNovaRamp = GetIceRemap(1.1f, 0f);
			iceNovaRampPersistent = GetIceRemap(0.4f, 0.1f);
			iceNovaEffectStrong = CreateSingleIceNova(iceNovaRamp, "Strong", 1.2f);
			iceNovaEffectWeak = CreateSingleIceNova(iceNovaRamp, "Weak", 0.85f);
			iceNovaEffectLowPriority = CreateSingleIceNova(iceNovaRamp, "LowPriority", 0.3f);
			iceDelayBlastPrefab = CreateIceDelayBlastPrefab();
			static Texture2D GetIceRemap(float alphaMod, float alphaAdd)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_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_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_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_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_00dc: 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_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: 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_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_018b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_019a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01eb: 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_020c: 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_0237: 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)
				Gradient val = new Gradient();
				val.mode = (GradientMode)0;
				val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[8]
				{
					new GradientAlphaKey(0f * alphaMod + alphaAdd, 0f),
					new GradientAlphaKey(0f * alphaMod + alphaAdd, 0.14f),
					new GradientAlphaKey(0.22f * alphaMod + alphaAdd, 0.46f),
					new GradientAlphaKey(0.22f * alphaMod + alphaAdd, 0.61f),
					new GradientAlphaKey(0.72f * alphaMod + alphaAdd, 0.63f),
					new GradientAlphaKey(0.72f * alphaMod + alphaAdd, 0.8f),
					new GradientAlphaKey(0.87f * alphaMod + alphaAdd, 0.81f),
					new GradientAlphaKey(0.87f * alphaMod + alphaAdd, 1f)
				};
				val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[8]
				{
					new GradientColorKey(new Color(0f + alphaAdd, 0f + alphaAdd, 0f + alphaAdd), 0f),
					new GradientColorKey(new Color(0f + alphaAdd, 0f + alphaAdd, 0f + alphaAdd), 0.14f),
					new GradientColorKey(new Color(0.179f + alphaAdd, 0.278f + alphaAdd, 0.25f + alphaAdd), 0.46f),
					new GradientColorKey(new Color(0.179f + alphaAdd, 0.278f + alphaAdd, 0.25f + alphaAdd), 0.61f),
					new GradientColorKey(new Color(0.5f + alphaAdd, 0.8f + alphaAdd, 0.75f + alphaAdd), 0.63f),
					new GradientColorKey(new Color(0.5f + alphaAdd, 0.8f + alphaAdd, 0.75f + alphaAdd), 0.8f),
					new GradientColorKey(new Color(0.6f + alphaAdd, 0.9f + alphaAdd, 0.85f + alphaAdd), 0.81f),
					new GradientColorKey(new Color(0.6f + alphaAdd, 0.9f + alphaAdd, 0.85f + alphaAdd), 1f)
				};
				Gradient grad = val;
				return CreateNewRampTex(grad);
			}
		}

		private static GameObject CreateSingleIceNova(Texture2D remapTex, string s, float alphaMod)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/AffixWhiteExplosion"), "IceExplosion" + s, false);
			ParticleSystemRenderer component = ((Component)val.transform.Find("Nova Sphere")).GetComponent<ParticleSystemRenderer>();
			Material val2 = Object.Instantiate<Material>(((Renderer)component).material);
			val2.SetTexture("_RemapTex", (Texture)(object)remapTex);
			Color color = val2.GetColor("_TintColor");
			color.a *= alphaMod;
			val2.SetColor("_TintColor", color);
			((Renderer)component).material = val2;
			RegisterEffect(val);
			return val;
		}

		private static GameObject CreateIceDelayBlastPrefab()
		{
			//IL_003d: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/GenericDelayBlast"), "IceDelayBlast", false);
			DelayBlast component = val.GetComponent<DelayBlast>();
			component.crit = false;
			component.procCoefficient = 1f;
			component.maxTimer = 0.2f;
			component.falloffModel = (FalloffModel)0;
			component.explosionEffect = iceNovaEffectWeak;
			component.delayEffect = CreateIceDelayEffect();
			component.damageType = DamageTypeCombo.op_Implicit((DamageType)256);
			component.baseForce = 250f;
			ProjectileController val2 = val.AddComponent<ProjectileController>();
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static GameObject CreateIceDelayEffect()
		{
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/AffixWhiteDelayEffect"), "iceDelay", false);
			val.GetComponent<DestroyOnTimer>().duration = 0.2f;
			ParticleSystemRenderer component = ((Component)val.transform.Find("Nova Sphere")).GetComponent<ParticleSystemRenderer>();
			Material val2 = Object.Instantiate<Material>(((Renderer)component).material);
			val2.SetTexture("_RemapTex", (Texture)(object)iceNovaRamp);
			((Renderer)component).material = val2;
			RegisterEffect(val);
			return val;
		}

		private static void CreateShockReworkAssets()
		{
			AddShockDebuff();
			AddShockCooldown();
			CreateSparkBuff();
			CreateSparkPickup();
		}

		private static void CreateSparkPickup()
		{
			//IL_000b: 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_003a: Expected O, but got Unknown
			sparkBoosterObject = NewNebulaBooster("SparkBoosterPickup", sparkBoosterBuff, sparkBoosterColor, sparkBoosterDuration, 0.8f, 1.8f);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(SparkBoosterStats);
		}

		private static void SparkBoosterStats(CharacterBody sender, StatHookEventArgs args)
		{
			int buffCount = sender.GetBuffCount(sparkBoosterBuff);
			if (buffCount > 0)
			{
				args.attackSpeedMultAdd += sparkBoosterAspdBonus * (float)buffCount;
			}
		}

		private static GameObject NewNebulaBooster(string boosterName, BuffDef boosterBuff, Color32 boosterColor, float boosterDuration, float antiGravity = 1f, float pickupRangeMultiplier = 3f)
		{
			//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_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_004c: 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_0170: 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_00b4: 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_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_0319: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"7f9217d45f824f245862e65716abc746").WaitForCompletion();
			GameObject val2 = PrefabAPI.InstantiateClone(val, boosterName, true);
			ParticleSystemRenderer[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystemRenderer>();
			foreach (ParticleSystemRenderer val3 in componentsInChildren)
			{
				string name = ((Object)((Component)val3).gameObject).name;
				Color32 val4 = Color32.op_Implicit(Color.white);
				string text = "";
				if (name == "Core")
				{
					text = "matSparkPickupCore";
					val4 = boosterColor;
				}
				if (name == "Trail")
				{
					text = "matSparkPickupTrail";
					val4 = Color32.op_Implicit(Color.clear);
				}
				if (name == "Pulseglow")
				{
					text = "matSparkPickupGlow";
					val4 = boosterColor;
				}
				if (text != "")
				{
					Material val6 = (((Renderer)val3).material = Object.Instantiate<Material>(((Renderer)val3).material));
					((Object)val6).name = text;
					val6.DisableKeyword("VERTEXCOLOR");
					val6.SetFloat("_VertexColorOn", 0f);
					val6.SetColor("_TintColor", Color32.op_Implicit(val4));
				}
			}
			VelocityRandomOnStart component = val2.GetComponent<VelocityRandomOnStart>();
			if ((Object)(object)component != (Object)null)
			{
				component.minSpeed = 15f;
				component.maxSpeed = 25f;
				component.coneAngle = 360f;
				component.directionMode = (DirectionMode)0;
			}
			else
			{
				Debug.Log((object)(boosterName + " HAS NO VROS????"));
			}
			DestroyOnTimer component2 = val2.GetComponent<DestroyOnTimer>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.duration = boosterDuration;
			}
			else
			{
				Debug.Log((object)(boosterName + " HAS NO DOT????"));
			}
			BeginRapidlyActivatingAndDeactivating component3 = val2.GetComponent<BeginRapidlyActivatingAndDeactivating>();
			if ((Object)(object)component3 != (Object)null)
			{
				component3.delayBeforeBeginningBlinking = boosterDuration - 2f;
				component3.blinkFrequency = 5f;
			}
			else
			{
				Debug.Log((object)(boosterName + " HAS NO BRAAD????"));
			}
			if (antiGravity != 0f)
			{
				Rigidbody component4 = val2.GetComponent<Rigidbody>();
				if (antiGravity == 1f)
				{
					component4.useGravity = true;
				}
				else
				{
					AntiGravityForce val7 = val2.AddComponent<AntiGravityForce>();
					val7.rb = component4;
					val7.antiGravityCoefficient = antiGravity;
				}
			}
			HealthPickup componentInChildren = val2.GetComponentInChildren<HealthPickup>();
			NebulaPickup nebulaPickup = ((Component)componentInChildren).gameObject.AddComponent<NebulaPickup>();
			nebulaPickup.pickupEffect = componentInChildren.pickupEffect;
			nebulaPickup.baseObject = componentInChildren.baseObject;
			nebulaPickup.teamFilter = val2.GetComponent<TeamFilter>();
			if ((Object)(object)boosterBuff != (Object)null)
			{
				nebulaPickup.buffDef = boosterBuff;
			}
			else
			{
				Debug.Log((object)(boosterName + "BOOSTER BUFFDEF WAS NULL"));
			}
			GravitatePickup componentInChildren2 = val2.GetComponentInChildren<GravitatePickup>();
			if ((Object)(object)componentInChildren2 != (Object)null)
			{
				componentInChildren2.acceleration = 2f;
				componentInChildren2.maxSpeed = 50f;
				Collider component5 = ((Component)componentInChildren2).gameObject.GetComponent<Collider>();
				if (component5.isTrigger)
				{
					Transform transform = ((Component)component5).transform;
					transform.localScale *= pickupRangeMultiplier;
				}
			}
			else
			{
				Debug.Log((object)(boosterName + " HAS NO GRAVITATION????"));
			}
			Object.Destroy((Object)(object)componentInChildren);
			ContentAddition.AddNetworkedObject(val2);
			return val2;
		}

		private static void CreateSparkBuff()
		{
			//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)
			//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)
			sparkBoosterBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)sparkBoosterBuff).name = "bdSparkBoost";
			sparkBoosterBuff.buffColor = Color32.op_Implicit(sparkBoosterColor);
			sparkBoosterBuff.canStack = true;
			AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_ShockNearby.texBuffTeslaIcon_tif);
			val.Completed += delegate(AsyncOperationHandle<Sprite> ctx)
			{
				sparkBoosterBuff.iconSprite = ctx.Result;
			};
			ContentAddition.AddBuffDef(sparkBoosterBuff);
		}

		private static void AddShockDebuff()
		{
			//IL_002f: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			shockMarker = ScriptableObject.CreateInstance<BuffDef>();
			((Object)shockMarker).name = "bdShockDebuff";
			shockMarker.buffColor = new Color(0f, 0f, 0.6f);
			shockMarker.canStack = false;
			shockMarker.isDebuff = true;
			shockMarker.isHidden = true;
			AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_ShockNearby.texBuffTeslaIcon_tif);
			val.Completed += delegate(AsyncOperationHandle<Sprite> ctx)
			{
				shockMarker.iconSprite = ctx.Result;
			};
			ContentAddition.AddBuffDef(shockMarker);
		}

		private static void AddShockCooldown()
		{
			//IL_002f: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			shockHealCooldown = ScriptableObject.CreateInstance<BuffDef>();
			((Object)shockHealCooldown).name = "bdShockDebuff";
			shockHealCooldown.buffColor = new Color(0f, 0f, 0.6f);
			shockHealCooldown.canStack = true;
			shockHealCooldown.isDebuff = false;
			shockHealCooldown.isCooldown = true;
			AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_ShockNearby.texBuffTeslaIcon_tif);
			val.Completed += delegate(AsyncOperationHandle<Sprite> ctx)
			{
				shockHealCooldown.iconSprite = ctx.Result;
			};
			ContentAddition.AddBuffDef(shockHealCooldown);
		}
	}
	public static class Hooks
	{
		public static void DoHooks()
		{
			//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
			IcicleAuraController.Awake += new hook_Awake(AuraControllerFix);
			BuffWard.BuffTeam += new hook_BuffTeam(ApplyDotWard);
			ProjectileOverlapLimitHits.CountOverlapHits += new hook_CountOverlapHits(DecayProjectileOverlapDamage);
			ProjectileOverlapLimitHits.OnEnable += new hook_OnEnable(DecayProjectileRecordInitialDamage);
			ShockState.OnExit += new hook_OnExit(ShockSparkOnExit);
			ShockState.OnEnter += new hook_OnEnter(ShockBuffEnter);
		}

		private static void DecayProjectileRecordInitialDamage(orig_OnEnable orig, ProjectileOverlapLimitHits self)
		{
			orig.Invoke(self);
			if (self is ProjectileOverlapDecayDamage)
			{
				(self as ProjectileOverlapDecayDamage).initialDamageCoefficient = self.projectileOverlapAttack.damageCoefficient;
				(self as ProjectileOverlapDecayDamage).initialProcCoefficient = self.projectileOverlapAttack.overlapProcCoefficient;
			}
		}

		private static void DecayProjectileOverlapDamage(orig_CountOverlapHits orig, ProjectileOverlapLimitHits self)
		{
			orig.Invoke(self);
			if (self is ProjectileOverlapDecayDamage)
			{
				ProjectileOverlapDecayDamage projectileOverlapDecayDamage = self as ProjectileOverlapDecayDamage;
				if (self.hitCount < self.hitLimit)
				{
					self.projectileOverlapAttack.damageCoefficient = projectileOverlapDecayDamage.initialDamageCoefficient * projectileOverlapDecayDamage.firstHitDamageMultiplier * Mathf.Pow(projectileOverlapDecayDamage.onHitDamageMultiplier, (float)(self.hitCount - 1));
					self.projectileOverlapAttack.overlapProcCoefficient = projectileOverlapDecayDamage.initialProcCoefficient * projectileOverlapDecayDamage.firstHitDamageMultiplier * Mathf.Pow(projectileOverlapDecayDamage.onHitDamageMultiplier, (float)(self.hitCount - 1));
				}
			}
		}

		private static void AuraControllerFix(orig_Awake orig, IcicleAuraController self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.buffWard) && self.buffWard is DotWard dotWard)
			{
				dotWard.ownerObject = self.cachedOwnerInfo.gameObject;
				dotWard.ownerBody = self.cachedOwnerInfo.characterBody;
			}
		}

		private static void ApplyDotWard(orig_BuffTeam orig, BuffWard self, IEnumerable<TeamComponent> recipients, float radiusSqr, Vector3 currentPosition)
		{
			//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_0042: Invalid comparison between Unknown and I4
			//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_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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Invalid comparison between Unknown and I4
			//IL_010c: 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_0155: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			if (!(self is DotWard dotWard))
			{
				orig.Invoke(self, recipients, radiusSqr, currentPosition);
			}
			else
			{
				if (!NetworkServer.active || (int)dotWard.dotIndex == -1)
				{
					return;
				}
				GameObject ownerObject = dotWard.ownerObject;
				CharacterBody ownerBody = dotWard.ownerBody;
				Inventory ownerInventory = dotWard.ownerInventory;
				foreach (TeamComponent recipient in recipients)
				{
					Vector3 val = ((Component)recipient).transform.position - currentPosition;
					if ((int)self.shape == 1)
					{
						val.y = 0f;
					}
					if (!(((Vector3)(ref val)).sqrMagnitude <= radiusSqr))
					{
						continue;
					}
					CharacterBody component = ((Component)recipient).GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && (!self.requireGrounded || !Object.op_Implicit((Object)(object)component.characterMotor) || component.characterMotor.isGrounded))
					{
						InflictDotInfo val2 = default(InflictDotInfo);
						val2.attackerObject = ownerObject;
						val2.victimObject = ((Component)component).gameObject;
						val2.totalDamage = dotWard.damageCoefficient * ownerBody.damage;
						val2.damageMultiplier = 1f;
						val2.dotIndex = dotWard.dotIndex;
						val2.maxStacksFromAttacker = null;
						InflictDotInfo val3 = val2;
						if ((Object)(object)ownerInventory != (Object)null)
						{
							StrengthenBurnUtils.CheckDotForUpgrade(ownerInventory, ref val3);
						}
						DotController.InflictDot(ref val3);
					}
				}
			}
		}

		private static void ShockSparkOnExit(orig_OnExit orig, ShockState self)
		{
			//IL_0073: 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)
			if (ShockUtilsModule.UseShockSparks)
			{
				float num = self.healthFraction - ((EntityState)self).healthComponent.combinedHealthFraction;
				if (num >= self.healthFractionToForceExit)
				{
					GameObject lastHitAttacker = ((EntityState)self).healthComponent.lastHitAttacker;
					if ((Object)(object)lastHitAttacker != (Object)null)
					{
						CharacterBody component = lastHitAttacker.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component))
						{
							Debug.Log((object)"break make spark");
							NebulaPickup.CreateBoosterPickup(((EntityState)self).transform.position, component.teamComponent.teamIndex, Assets.sparkBoosterObject);
						}
					}
				}
			}
			orig.Invoke(self);
		}

		private static void ShockHit(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (ShockUtilsModule.UseShockSparks && ((Enum)damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)16777216))
			{
				self.body.AddTimedBuff(Assets.shockMarker, (float)Assets.shockMarkerDuration);
			}
			orig.Invoke(self, damageInfo);
		}

		private static void ShockBuffEnter(orig_OnEnter orig, ShockState self)
		{
			orig.Invoke(self);
			if (ShockUtilsModule.UseShockSparks)
			{
				self.healthFractionToForceExit = ShockUtilsModule.shockForceExitFraction;
			}
		}

		private static void ShockBuffExit(orig_OnExit orig, ShockState self)
		{
			if (ShockUtilsModule.UseShockSparks && self != null && (Object)(object)((EntityState)self).characterBody != (Object)null && ((EntityState)self).characterBody.HasBuff(Assets.shockMarker))
			{
				HealthComponent healthComponent = ((EntityState)self).healthComponent;
				GameObject lastHitAttacker = healthComponent.lastHitAttacker;
				if (!((Object)(object)lastHitAttacker == (Object)null))
				{
					CharacterBody component = lastHitAttacker.GetComponent<CharacterBody>();
					if ((Object)(object)component != (Object)null && component.maxShield > 0f && component.healthComponent?.shield != component.maxShield)
					{
						ShockHeal(component.healthComponent);
					}
				}
			}
			orig.Invoke(self);
		}

		private static void ShockHeal(HealthComponent attacker)
		{
			if (!attacker.body.HasBuff(Assets.shockHealCooldown))
			{
				float num = (attacker.body.maxShield - attacker.shield) / attacker.body.maxShield;
				float num2 = attacker.body.maxShield / attacker.fullCombinedHealth;
				int num3 = (int)(num2 * num * 20f);
				for (int i = 0; i < num3; i++)
				{
					attacker.body.AddTimedBuff(Assets.shockHealCooldown, (float)(i + 1));
				}
				attacker.ForceShieldRegen();
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.RiskOfBrainrot.RainrotSharedUtils", "RainrotSharedUtils", "1.3.5")]
	[R2APISubmoduleDependency(new string[] { "LanguageAPI" })]
	public class SharedUtilsPlugin : BaseUnityPlugin
	{
		public const string guid = "com.RiskOfBrainrot.RainrotSharedUtils";

		public const string teamName = "RiskOfBrainrot";

		public const string modName = "RainrotSharedUtils";

		public const string version = "1.3.5";

		public const string shelterKeywordToken = "2R4R_SHELTER_KEYWORD";

		public const string executeKeywordToken = "2R4R_EXECUTION_KEYWORD";

		public const string noAttackSpeedKeywordToken = "2R4R_NOATTACKSPEED_KEYWORD";

		public const string sparkPickupKeywordToken = "2R4R_SPARKPICKUP_KEYWORD";

		public const float survivorExecuteThreshold = 0.15f;

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			Assets.Init();
			ShelterUtilsModule.Init();
			FrostUtilsModule.Init();
			Hooks.DoHooks();
			LanguageAPI.Add("2R4R_EXECUTION_KEYWORD", "<style=cKeywordName>Finisher</style><style=cSub>Enemies targeted by this skill can be <style=cIsHealth>instantly killed</style> if below " + $"<style=cIsHealth>{15.000001f}% health</style>.</style>");
			LanguageAPI.Add("2R4R_NOATTACKSPEED_KEYWORD", "<style=cKeywordName>Exacting</style><style=cSub>This skill <style=cIsHealth>does not gain attack speed bonuses</style>. Instead, attack speed <style=cIsDamage>increases total damage</style>.</style>");
			LanguageAPI.Add("2R4R_SHELTER_KEYWORD", "<style=cKeywordName>Shelter</style><style=cSub>Protects from storms and fog.</style>");
			LanguageAPI.Add("2R4R_SPARKPICKUP_KEYWORD", "<style=cKeywordName>Energizing Sparks</style><style=cSub>Creates <style=cIsDamage>spark pickups</style> that increase the " + $"<style=cIsDamage>attack speed</style> of all allies within <style=cIsDamage>{Assets.nebulaBoosterBuffRadius}m</style> " + $"by <style=cIsDamage>{Assets.sparkBoosterAspdBonus * 100f}%</style> for {Assets.nebulaBoosterBuffDuration} seconds. " + $"Can stack up to {5} times.</style>");
		}

		public static void DebugBreakpoint(string methodName, int breakpointNumber = -1)
		{
			string text = "RainrotSharedUtils: " + methodName + " IL hook failed!";
			if (breakpointNumber >= 0)
			{
				text += $" (breakpoint {breakpointNumber})";
			}
			Debug.LogError((object)text);
		}
	}
}
namespace RainrotSharedUtils.Status
{
	public static class ShockUtilsModule
	{
		public static float shockForceExitFraction = 0.1f;

		private static bool _UseShockSparks = false;

		public static bool UseShockSparks
		{
			get
			{
				return _UseShockSparks;
			}
			set
			{
				if (value)
				{
					LanguageAPI.Add("KEYWORD_SHOCKING", "<style=cKeywordName>Shocking</style><style=cSub>Interrupts enemies and stuns them. The stun is broken if the target takes more than " + $"<style=cIsHealth>{shockForceExitFraction * 100f}%</style> " + "of their maximum health in damage. Breaking shock creates <style=cIsUtility>Energizing Sparks</style>.</style>");
				}
				_UseShockSparks = true;
			}
		}

		public static void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SkillCatalog.Init += new hook_Init(OnSkillCatalogInit);
		}

		private static void OnSkillCatalogInit(orig_Init orig)
		{
			orig.Invoke();
			if (!UseShockSparks)
			{
				return;
			}
			foreach (SkillDef allSkillDef in SkillCatalog.allSkillDefs)
			{
				if (allSkillDef.keywordTokens.Contains("KEYWORD_SHOCKING"))
				{
					string text = "2R4R_SPARKPICKUP_KEYWORD";
					HGArrayUtilities.ArrayAppend<string>(ref allSkillDef.keywordTokens, ref text);
				}
			}
		}
	}
}
namespace RainrotSharedUtils.Frost
{
	public static class FrostUtilsModule
	{
		public static int maxIceExplosionsPerSecond = 4;

		public static int iceExplosionsThisSecond = 0;

		public const int chillStacksMax = 6;

		public const float chillProcDuration = 6f;

		private static float iceExplosionTrackerTimer = 0f;

		public static GameObject iceExplosion => Assets.iceDelayBlastPrefab;

		public static void Init()
		{
			FixSnapfreeze();
		}

		public static void FixedUpdate()
		{
			if (maxIceExplosionsPerSecond <= 0 || iceExplosionsThisSecond <= 0)
			{
				iceExplosionsThisSecond = 0;
				iceExplosionTrackerTimer = 1 / maxIceExplosionsPerSecond;
				return;
			}
			iceExplosionTrackerTimer -= Time.fixedDeltaTime;
			while (iceExplosionTrackerTimer < 0f)
			{
				iceExplosionTrackerTimer += 1 / maxIceExplosionsPerSecond;
				iceExplosionsThisSecond--;
			}
		}

		public static void FixSnapfreeze()
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"65d14128d015b6946b0dec7981dfe63a").WaitForCompletion();
			ProjectileImpactExplosion componentInChildren = val.GetComponentInChildren<ProjectileImpactExplosion>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.destroyOnEnemy = false;
			}
		}

		public static void CreateIceBlast(CharacterBody attackerBody, float baseForce, float damage, float procCoefficient, float radius, bool crit, Vector3 blastPosition, bool isStrongBlast = false, DamageSource damageSource = 0)
		{
			//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_001b: 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_0031: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0048: 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_006c: 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_008b: 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_009c: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				EffectManager.SpawnEffect(GetIceBlastEffect(isStrongBlast), new EffectData
				{
					origin = blastPosition,
					scale = radius
				}, true);
				BlastAttack val = new BlastAttack();
				val.radius = radius;
				val.procCoefficient = procCoefficient;
				val.position = blastPosition;
				val.attacker = ((Component)attackerBody).gameObject;
				val.crit = crit;
				val.baseDamage = damage;
				val.falloffModel = (FalloffModel)0;
				val.baseForce = baseForce;
				val.teamIndex = attackerBody.teamComponent.teamIndex;
				val.attackerFiltering = (AttackerFiltering)2;
				val.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)131072, damageSource);
				val.Fire();
			}
		}

		public static GameObject GetIceBlastEffect(bool isStrongBlast)
		{
			if (isStrongBlast)
			{
				return Assets.iceNovaEffectStrong;
			}
			iceExplosionsThisSecond++;
			if (iceExplosionsThisSecond < maxIceExplosionsPerSecond)
			{
				return Assets.iceNovaEffectWeak;
			}
			return Assets.iceNovaEffectLowPriority;
		}

		public static void ApplyChillSphere(Vector3 origin, float radius, TeamIndex teamIndex, float duration = 6f, float chillCount = 3f)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//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_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_003e: 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)
			if (!NetworkServer.active)
			{
				return;
			}
			SphereSearch val = new SphereSearch();
			val.origin = origin;
			val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
			val.radius = radius;
			val.RefreshCandidates();
			val.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(teamIndex));
			val.FilterCandidatesByDistinctHurtBoxEntities();
			val.OrderCandidatesByDistance();
			List<HurtBox> list = new List<HurtBox>();
			val.GetHurtBoxes(list);
			val.ClearCandidates();
			for (int i = 0; i < list.Count; i++)
			{
				HurtBox val2 = list[i];
				CharacterBody val3 = val2.healthComponent?.body;
				if (Object.op_Implicit((Object)(object)val3))
				{
					bool flag = val3.HasBuff(Buffs.FreezeImmune);
					bool isInFrozenState = val3.healthComponent.isInFrozenState;
					if (!flag && !isInFrozenState)
					{
						ApplyChillStacks(val3, 100f, chillCount, duration);
					}
				}
			}
			list.Clear();
		}

		public static void ApplyChillStacks(CharacterMaster attackerMaster, CharacterBody vBody, float procChance, float chillCount = 1f, float chillDuration = 6f)
		{
			ApplyChillStacks(vBody, procChance, chillCount, chillDuration, Object.op_Implicit((Object)(object)attackerMaster) ? attackerMaster.luck : 1f);
		}

		public static void ApplyChillStacks(CharacterBody vBody, float procChance, float totalChillToApply = 1f, float chillDuration = 6f, float luck = 1f)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			int buffCount = vBody.GetBuffCount(Buffs.Frost);
			int num = 0;
			int num2 = 10 - 3 * num;
			if (buffCount > num2)
			{
				return;
			}
			totalChillToApply = Mathf.Min(totalChillToApply, (float)(num2 - buffCount));
			for (int i = 0; (float)i < totalChillToApply; i++)
			{
				if (Util.CheckRoll(procChance, luck, (CharacterMaster)null))
				{
					vBody.AddTimedBuff(Buffs.Frost.buffIndex, chillDuration);
				}
			}
		}
	}
}
namespace RainrotSharedUtils.Shelters
{
	public class MockShelterComponent : ShelterProviderBehavior
	{
		public float scaleMultiplier = 1f;

		private Vector3 baseScale;

		public GameObject areaIndicatorReference;

		public float startingRadius;

		public float endRadius = 10f;

		public float durationBeforeShrink = 1f;

		public float durationForMaxShrink = 15f;

		private float age = 0f;

		private bool hasStartedShrink = false;

		private void FixedUpdate()
		{
			//IL_0077: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			if (age >= durationForMaxShrink)
			{
				return;
			}
			age += Time.fixedDeltaTime;
			if (!(age > durationBeforeShrink))
			{
				return;
			}
			if (!hasStartedShrink)
			{
				hasStartedShrink = true;
				if (Object.op_Implicit((Object)(object)areaIndicatorReference))
				{
					baseScale = areaIndicatorReference.transform.localScale / startingRadius;
				}
			}
			if (age >= durationForMaxShrink)
			{
				SetSize(endRadius);
				return;
			}
			float num = (age - durationBeforeShrink) / durationForMaxShrink;
			float size = Mathf.Lerp(startingRadius, endRadius, num);
			SetSize(size);
		}

		private void SetSize(float radius)
		{
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			base.fallbackRadius = radius;
			if (!((Object)(object)areaIndicatorReference == (Object)null))
			{
				areaIndicatorReference.transform.localScale = radius * baseScale * scaleMultiplier;
			}
		}
	}
	public class ShelterProviderBehavior : MonoBehaviour
	{
		private static List<ShelterProviderBehavior> instancesList = new List<ShelterProviderBehavior>();

		public static ReadOnlyCollection<ShelterProviderBehavior> readOnlyInstancesList = new ReadOnlyCollection<ShelterProviderBehavior>(instancesList);

		public HoldoutZoneController holdoutZoneController;

		public bool isSuperShelter = false;

		public bool isHazardZone = false;

		public float _fallbackRadius;

		public IZone zoneBehavior;

		public float fallbackRadius
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)holdoutZoneController))
				{
					return _fallbackRadius;
				}
				if (holdoutZoneController.charge <= 0f || holdoutZoneController.charge >= 1f || !((Behaviour)holdoutZoneController).isActiveAndEnabled)
				{
					return 0f;
				}
				return holdoutZoneController.currentRadius;
			}
			set
			{
				_fallbackRadius = value;
			}
		}

		public bool IsInBounds(Vector3 position, float radius = 0f)
		{
			//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_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_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_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)
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: 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)
			Vector3 val = position;
			if (radius > 0f)
			{
				Vector3 val2 = position - ((Component)this).transform.position;
				val = position - ((Vector3)(ref val2)).normalized * radius;
			}
			if (zoneBehavior != null)
			{
				return zoneBehavior.IsInBounds(val);
			}
			if (fallbackRadius < 1f)
			{
				return false;
			}
			Vector3 val3 = val - ((Component)this).transform.position;
			return ((Vector3)(ref val3)).sqrMagnitude <= fallbackRadius * fallbackRadius;
		}

		private void OnEnable()
		{
			if (!ShelterUtilsModule.UseGlobalShelters && !ShelterUtilsModule.UseCustomShelters)
			{
				Debug.LogError((object)"Shelter Provider cannot initialize: Shelter Module not enabled. (Set UseGlobalShelters or UseCustomShelters to true!)");
				Object.Destroy((Object)(object)this);
			}
			instancesList.Add(this);
		}

		private void OnDisable()
		{
			if (instancesList.Contains(this))
			{
				instancesList.Remove(this);
			}
		}
	}
	public static class ShelterUtilsModule
	{
		public static bool UseGlobalShelters;

		public static bool UseCustomShelters;

		public static bool IsBodySuperSheltered(CharacterBody body, float radius = 0f)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList)
			{
				if (!readOnlyInstances.isSuperShelter || !readOnlyInstances.IsInBounds(body.corePosition, radius))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		public static bool IsPositionSuperSheltered(Vector3 position, float radius = 0f)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList)
			{
				if (!readOnlyInstances.isSuperShelter || !readOnlyInstances.IsInBounds(position, radius))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		public static bool IsBodySheltered(CharacterBody body, float radius = 0f)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList)
			{
				if (readOnlyInstances.isHazardZone || !readOnlyInstances.IsInBounds(body.corePosition, radius))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		public static bool IsPositionSheltered(Vector3 position, float radius = 0f)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList)
			{
				if (readOnlyInstances.isHazardZone || !readOnlyInstances.IsInBounds(position, radius))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		public static void Init()
		{
			//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_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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			TeleporterInteraction.Awake += new hook_Awake(SheltersOnTeleporterAwake);
			HoldoutZoneController.Awake += new hook_Awake(SheltersOnHoldoutAwake);
			SphereZone.OnEnable += new hook_OnEnable(SheltersOnSphereZoneEnable);
			VerticalTubeZone.OnEnable += new hook_OnEnable(SheltersOnTubeZoneEnable);
			FogDamageController.EvaluateTeam += new hook_EvaluateTeam(EvaluateShelteredTeam);
			FogDamageController.GetAffectedBodiesOnTeam += new hook_GetAffectedBodiesOnTeam(GetFogAffectedBodies);
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/ShrineHalcyonite.prefab").WaitForCompletion();
			if (Object.op_Implicit((Object)(object)val))
			{
				HalcyoniteShrineInteractable component = val.GetComponent<HalcyoniteShrineInteractable>();
				if (Object.op_Implicit((Object)(object)component))
				{
					ShelterProviderBehavior shelterProviderBehavior = val.AddComponent<ShelterProviderBehavior>();
					shelterProviderBehavior.fallbackRadius = component.radius;
				}
			}
			HalcyoniteShrineInteractable.DrainConditionMet += new hook_DrainConditionMet(MockShelter_Halcyon);
			ChargingState.OnExit += new hook_OnExit(MockShelter_TP);
			Run.onRunDestroyGlobal += SheltersOnRunDestroy;
		}

		private static void MockShelter_TP(orig_OnExit orig, ChargingState self)
		{
			HoldoutZoneController holdoutZoneController = ((BaseTeleporterState)self).teleporterInteraction.holdoutZoneController;
			float currentRadius = holdoutZoneController.currentRadius;
			GameObject gameObject = ((Component)holdoutZoneController.radiusIndicator).gameObject;
			MakeMockShelter(gameObject, currentRadius, 25f);
			orig.Invoke(self);
		}

		private static void MockShelter_Halcyon(orig_DrainConditionMet orig, HalcyoniteShrineInteractable self)
		{
			float radius = self.radius;
			GameObject gameObject = self.shrineHalcyoniteBubble.gameObject;
			MakeMockShelter(gameObject, radius, 15f, 2f);
			orig.Invoke(self);
		}

		public static void MakeMockShelter(GameObject indicator, float startRadius, float endRadius, float stupidBullshit = 1f)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (!UseGlobalShelters)
			{
				return;
			}
			GameObject val = new GameObject();
			((Object)val).name = "MockShelter";
			val.transform.position = indicator.transform.position;
			MockShelterComponent mockShelterComponent = val.AddComponent<MockShelterComponent>();
			mockShelterComponent.startingRadius = startRadius;
			mockShelterComponent.endRadius = endRadius;
			mockShelterComponent.scaleMultiplier = stupidBullshit;
			if (!((Object)(object)indicator == (Object)null))
			{
				GameObject val2 = Object.Instantiate<GameObject>(indicator, val.transform);
				if (!val2.activeInHierarchy)
				{
					val2.SetActive(true);
				}
				val2.transform.parent = val.transform;
				mockShelterComponent.areaIndicatorReference = val2;
				ShelterProviderBehavior shelterProviderBehavior = default(ShelterProviderBehavior);
				if (val2.TryGetComponent<ShelterProviderBehavior>(ref shelterProviderBehavior))
				{
					((Behaviour)shelterProviderBehavior).enabled = false;
				}
			}
		}

		private static void EvaluateShelteredTeam(orig_EvaluateTeam orig, FogDamageController self, TeamIndex teamIndex)
		{
			//IL_0027: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!UseCustomShelters && !UseGlobalShelters)
			{
				orig.Invoke(self, teamIndex);
				return;
			}
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(teamIndex))
			{
				CharacterBody body = teamMember.body;
				bool flag = self.characterBodyToStacks.ContainsKey(body);
				bool flag2 = IsBodySheltered(body);
				bool flag3 = body.HasBuff(Buffs.VoidFogStackCooldown);
				if (!flag2)
				{
					foreach (IZone safeZone in self.safeZones)
					{
						if (safeZone.IsInBounds(((Component)teamMember).transform.position))
						{
							flag2 = true;
							break;
						}
					}
				}
				if (flag2)
				{
					if (flag)
					{
						self.characterBodyToStacks.Remove(body);
						if (flag3)
						{
							body.RemoveOldestTimedBuff(Buffs.VoidFogStackCooldown);
						}
					}
				}
				else if (!flag)
				{
					self.characterBodyToStacks.Add(body, 1);
					self.DumpArenaDamageInfo(body);
					body.AddTimedBuff(Buffs.VoidFogStackCooldown, self.healthFractionRampIncreaseCooldown);
				}
				else if (!flag3)
				{
					self.characterBodyToStacks[body]++;
					self.DumpArenaDamageInfo(body);
					body.AddTimedBuff(Buffs.VoidFogStackCooldown, self.healthFractionRampIncreaseCooldown);
				}
			}
		}

		private static IEnumerable<CharacterBody> GetFogAffectedBodies(orig_GetAffectedBodiesOnTeam orig, FogDamageController self, TeamIndex teamIndex)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			IEnumerable<CharacterBody> source = orig.Invoke(self, teamIndex);
			return source.Where((CharacterBody body) => !IsBodySheltered(body));
		}

		private static ShelterProviderBehavior AddShelterProvider(GameObject obj, IZone zone, bool inverted = false, float radius = 0f)
		{
			ShelterProviderBehavior shelterProviderBehavior = obj.GetComponent<ShelterProviderBehavior>();
			if (!Object.op_Implicit((Object)(object)shelterProviderBehavior))
			{
				shelterProviderBehavior = obj.AddComponent<ShelterProviderBehavior>();
				shelterProviderBehavior.isHazardZone = inverted;
			}
			shelterProviderBehavior.zoneBehavior = zone;
			shelterProviderBehavior.fallbackRadius = radius;
			return shelterProviderBehavior;
		}

		private static void SheltersOnRunDestroy(Run obj)
		{
			ReadOnlyCollection<ShelterProviderBehavior> readOnlyInstancesList = ShelterProviderBehavior.readOnlyInstancesList;
			for (int num = readOnlyInstancesList.Count - 1; num >= 0; num--)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstancesList[num]))
				{
					Object.Destroy((Object)(object)((Component)readOnlyInstancesList[num]).gameObject);
				}
			}
		}

		private static void SheltersOnTeleporterAwake(orig_Awake orig, TeleporterInteraction self)
		{
			orig.Invoke(self);
			if (UseGlobalShelters)
			{
				ShelterProviderBehavior shelterProviderBehavior = AddShelterProvider(((Component)self).gameObject, (IZone)(object)self.holdoutZoneController, inverted: false, self.holdoutZoneController.baseRadius);
				shelterProviderBehavior.holdoutZoneController = self.holdoutZoneController;
				shelterProviderBehavior.isSuperShelter = true;
			}
		}

		private static void SheltersOnTubeZoneEnable(orig_OnEnable orig, VerticalTubeZone self)
		{
			orig.Invoke(self);
			if (UseGlobalShelters)
			{
				AddShelterProvider(((Component)self).gameObject, (IZone)(object)self, inverted: false, self.radius);
			}
		}

		private static void SheltersOnSphereZoneEnable(orig_OnEnable orig, SphereZone self)
		{
			orig.Invoke(self);
			if (UseGlobalShelters)
			{
				AddShelterProvider(((Component)self).gameObject, (IZone)(object)self, self.isInverted, self.radius);
			}
		}

		private static void SheltersOnHoldoutAwake(orig_Awake orig, HoldoutZoneController self)
		{
			orig.Invoke(self);
			if (UseGlobalShelters)
			{
				ShelterProviderBehavior shelterProviderBehavior = AddShelterProvider(((Component)self).gameObject, (IZone)(object)self, inverted: false, self.baseRadius);
				shelterProviderBehavior.holdoutZoneController = self;
			}
		}
	}
}
namespace RainrotSharedUtils.Compat
{
	[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("com.RiskOfBrainrot.RainrotSharedCompats", "RainrotSharedCompats", "1.0.0")]
	[R2APISubmoduleDependency(new string[] { "LanguageAPI" })]
	public class SharedUtilsCompatPlugin : BaseUnityPlugin
	{
		public delegate bool orig_ChangeAmbientCap(Main main, Run run, RuleBook ruleBook);

		public const string guid = "com.RiskOfBrainrot.RainrotSharedCompats";

		public const string teamName = "RiskOfBrainrot";

		public const string modName = "RainrotSharedCompats";

		public const string version = "1.0.0";

		public static PluginInfo PInfo { get; private set; }

		public static bool infernoLoaded => ModLoaded("HIFU.Inferno");

		public static bool snowtimeLoaded => ModLoaded("SnowySnowtime.SnowtimeToyboxMod");

		public static bool riskierLoaded => ModLoaded("com.RiskOfBrainrot.RiskierRain");

		public static bool ModLoaded(string modGuid)
		{
			return !Utility.IsNullOrWhiteSpace(modGuid) && Chainloader.PluginInfos.ContainsKey(modGuid);
		}

		private void Awake()
		{
			if (infernoLoaded)
			{
				DoInfernoCompat();
			}
			if (snowtimeLoaded)
			{
				DoSnowtimeCompat();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void DoSnowtimeCompat()
		{
			//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_0075: Unknown result type (might be due to invalid IL or missing references)
			DifficultyIndex snowtimeLegendaryDiffIndex = SnowtimeToyboxMod.SnowtimeLegendaryDiffIndex;
			MoreDifficultyStats moreDifficultyStats = DifficultyUtilsModule.GetMoreDifficultyStats(snowtimeLegendaryDiffIndex);
			moreDifficultyStats.startingLevelBoost = 9f;
			moreDifficultyStats.startingDifficultyCoefficientBoost = 0f;
			moreDifficultyStats.startingDifficultyDisplay = 12f;
			moreDifficultyStats.ambientLevelCap = int.MaxValue;
			moreDifficultyStats.tier2EliteStage = 3;
			moreDifficultyStats.tier1AndHalfEliteStage = 1;
			moreDifficultyStats.delayFirstStorm_ForSwanSong = false;
			moreDifficultyStats.desiredStormTime_ForSwanSong = 3f;
			moreDifficultyStats.desiredStormWarningTime_ForSwanSong = 0.5f;
			moreDifficultyStats.stormIntensifyStrength_ForSwanSong = 0.7f;
			DifficultyUtilsModule.difficultyCustomStats[snowtimeLegendaryDiffIndex] = moreDifficultyStats;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void DoInfernoCompat()
		{
			//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_0074: Unknown result type (might be due to invalid IL or missing references)
			DifficultyIndex infernoDiffIndex = Main.InfernoDiffIndex;
			MoreDifficultyStats moreDifficultyStats = DifficultyUtilsModule.GetMoreDifficultyStats(infernoDiffIndex);
			moreDifficultyStats.startingLevelBoost = Main.LevelDiffBoost.Value;
			moreDifficultyStats.startingDifficultyDisplay = Main.LevelDiffBoost.Value;
			moreDifficultyStats.ambientLevelCap = int.MaxValue;
			moreDifficultyStats.tier2EliteStage = 4;
			moreDifficultyStats.tier1AndHalfEliteStage = 2;
			moreDifficultyStats.delayFirstStorm_ForSwanSong = false;
			moreDifficultyStats.desiredStormTime_ForSwanSong = 3.5f;
			moreDifficultyStats.desiredStormWarningTime_ForSwanSong = 1f;
			moreDifficultyStats.stormIntensifyStrength_ForSwanSong = 0.6f;
			DifficultyUtilsModule.difficultyCustomStats[infernoDiffIndex] = moreDifficultyStats;
			DifficultyUtilsModule.CompensateRewardsForDifficultyBoost = true;
			Run.onRunStartGlobal += RemoveInfernoHooks;
		}

		private static void RemoveInfernoHooks(Run obj)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (riskierLoaded)
			{
				Run.RecalculateDifficultyCoefficentInternal -= new hook_RecalculateDifficultyCoefficentInternal(Hooks.AmbientLevelBoost);
			}
		}

		public static void InfernoAmbientCap(orig_ChangeAmbientCap orig, Main main, Run run, RuleBook ruleBook)
		{
		}
	}
}
namespace RainrotSharedUtils.MoreProjectiles
{
	public static class MoreProjectilesHooks
	{
		public const float missileSpread = 45f;

		public const float projectileSpread = 20f;

		public static void OverrideIcbmMissiles(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = 0;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "MoreMissile"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective")
			}))
			{
				SharedUtilsPlugin.DebugBreakpoint("OverrideIcbmMissiles", 1);
				return;
			}
			ILLabel val2 = default(ILLabel);
			if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2)
			}))
			{
				SharedUtilsPlugin.DebugBreakpoint("OverrideIcbmMissiles", 2);
				return;
			}
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Func<int, CharacterBody, int>>((Func<int, CharacterBody, int>)delegate(int icbmCount, CharacterBody body)
			{
				if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(body))
				{
					icbmCount++;
				}
				return icbmCount;
			});
		}

		public static void MissileArtifact_FireProjectile(orig_FireProjectile orig, GenericProjectileBaseState self)
		{
			//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_009a: 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_00a7: 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)
			//IL_00da: 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_00ff: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_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_017b: 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_0199: 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_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody) && ((EntityState)self).isAuthority)
			{
				bool flag = false;
				bool flag2 = false;
				float spread = 20f;
				if (self is FireConstructBeam || self is FireFMJ || self is FireGrenadeLauncher)
				{
					flag = true;
				}
				else
				{
					if (self is Spit)
					{
						flag = true;
						flag2 = true;
					}
					if (self is Fire)
					{
						flag = true;
						spread = 45f;
					}
				}
				if (flag)
				{
					Ray val = ((BaseState)self).GetAimRay();
					val = self.ModifyProjectileAimRay(val);
					((Ray)(ref val)).direction = Util.ApplySpread(((Ray)(ref val)).direction, self.minSpread, self.maxSpread, 1f, 1f, 0f, self.projectilePitchBonus);
					FireProjectileInfo val2 = default(FireProjectileInfo);
					val2.projectilePrefab = self.projectilePrefab;
					val2.position = ((Ray)(ref val)).origin;
					val2.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref val)).direction);
					val2.owner = ((EntityState)self).gameObject;
					val2.damage = ((BaseState)self).damageStat * self.damageCoefficient;
					val2.crit = Util.CheckRoll(((BaseState)self).critStat, ((EntityState)self).characterBody.master);
					val2.force = self.force;
					FireProjectileInfo val3 = val2;
					ProjectileManager.instance.FireProjectile(val3);
					Vector3 val4 = Vector3.Cross(Vector3.up, ((Ray)(ref val)).direction);
					if (!flag2)
					{
						val4 = Vector3.Cross(((Ray)(ref val)).direction, val4);
					}
					MoreProjectilesModule.FireWarfareProjectiles(val, val3, spread, val4);
					return;
				}
			}
			orig.Invoke(self);
		}

		public static void MissileArtifact_FireHuntressSeekingArrow(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_006b: 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)
			ILCursor val = new ILCursor(il);
			int orbLoc = 0;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref orbLoc),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OrbManager>(x, "AddOrb")
			}))
			{
				Debug.LogError((object)"IABM Huntress fail");
				return;
			}
			val.Emit(OpCodes.Ldloc, orbLoc);
			val.Emit(OpCodes.Ldarg, 0);
			val.EmitDelegate<Action<Orb, EntityState>>((Action<Orb, EntityState>)delegate(Orb orb, EntityState state)
			{
				if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(state.characterBody))
				{
					OrbManager.instance.AddOrb(orb);
					OrbManager.instance.AddOrb(orb);
				}
			});
		}

		public static void MissileArtifact_Shuriken(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProjectileManager>(x, "FireProjectileWithoutDamageType")
			}))
			{
				SharedUtilsPlugin.DebugBreakpoint("MissileArtifact_Shuriken");
				return;
			}
			val.Remove();
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<ProjectileManager, GameObject, Vector3, Quaternion, GameObject, float, float, bool, DamageColorIndex, GameObject, float, PrimarySkillShurikenBehavior>>((Action<ProjectileManager, GameObject, Vector3, Quaternion, GameObject, float, float, bool, DamageColorIndex, GameObject, float, PrimarySkillShurikenBehavior>)delegate(ProjectileManager projectileManagerInstance, GameObject projectilePrefab, Vector3 origin, Quaternion rotation, GameObject owner, float damage, float force, bool crit, DamageColorIndex damageColorIndex, GameObject target, float speedOverride, PrimarySkillShurikenBehavior behavior)
			{
				//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_000e: 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_0035: 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_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: 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_0071: 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)
				projectileManagerInstance.FireProjectileWithoutDamageType(projectilePrefab, origin, rotation, owner, damage, force, crit, damageColorIndex, target, speedOverride);
				if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((ItemBehavior)behavior).body))
				{
					Ray aimRay = behavior.GetAimRay();
					FireProjectileInfo val2 = default(FireProjectileInfo);
					val2.projectilePrefab = projectilePrefab;
					val2.position = origin;
					val2.rotation = rotation;
					val2.owner = owner;
					val2.damage = damage;
					val2.crit = crit;
					FireProjectileInfo fireProjectileInfo = val2;
					MoreProjectilesModule.FireWarfareProjectiles(aimRay, fireProjectileInfo, 20f);
				}
			});
		}

		public static void MissileArtifact_VerminSpit(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0130: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int aimRayLoc = 0;
			int damageLoc = 0;
			if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<BaseState>(x, "GetAimRay"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref aimRayLoc)
			}))
			{
				SharedUtilsPlugin.DebugBreakpoint("MissileArtifact_VerminSpit", 1);
				return;
			}
			if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<BaseState>(x, "damageStat")
			}) || !val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref damageLoc)
			}))
			{
				SharedUtilsPlugin.DebugBreakpoint("MissileArtifact_VerminSpit", 2);
				return;
			}
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProjectileManager>(x, "FireProjectileWithoutDamageType")
			}))
			{
				SharedUtilsPlugin.DebugBreakpoint("MissileArtifact_VerminSpit", 3);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldloc, aimRayLoc);
			val.Emit(OpCodes.Ldloc, damageLoc);
			val.EmitDelegate<Action<Spit, Ray, float>>((Action<Spit, Ray, float>)delegate(Spit self, Ray aimRay, float damage)
			{
				//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_0032: 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_0045: 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_007d: 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_0085: 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_008f: 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_0091: 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)
				if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
				{
					FireProjectileInfo val2 = default(FireProjectileInfo);
					val2.projectilePrefab = ((GenericProjectileBaseState)self).projectilePrefab;
					val2.position = ((Ray)(ref aimRay)).origin;
					val2.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val2.owner = ((EntityState)self).gameObject;
					val2.damage = damage;
					val2.crit = Util.CheckRoll(((BaseState)self).critStat, ((EntityState)self).characterBody.master);
					FireProjectileInfo fireProjectileInfo = val2;
					Vector3 axis = Vector3.Cross(Vector3.up, ((Ray)(ref aimRay)).direction);
					MoreProjectilesModule.FireWarfareProjectiles(aimRay, fireProjectileInfo, 20f, axis);
				}
			});
		}

		public static void MissileArtifact_ChargeTrioBomb(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3)
			}))
			{
				SharedUtilsPlugin.DebugBreakpoint("MissileArtifact_ChargeTrioBomb", 1);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, ChargeTrioBomb, int>>((Func<int, ChargeTrioBomb, int>)((int bellCount, ChargeTrioBomb self) => (!MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody)) ? bellCount : (bellCount + 2)));
		}

		public static Transform MissileArtifact_FindTrioBombTransform(orig_FindTargetChildTransformFromBombIndex orig, ChargeTrioBomb self)
		{
			Transform val = orig.Invoke(self);
			if ((Object)(object)val == (Object)null && self.currentBombIndex >= 3)
			{
				val = GenerateTransform(((EntityState)self).transform, self.currentBombIndex);
			}
			return val;
			Transform GenerateTransform(Transform parent, int index)
			{
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Expected O, but got Unknown
				//IL_00a7: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
				float num = 3.8f;
				float num2 = 0f;
				int num3 = 7;
				float num4 = num;
				float num5 = MathF.PI * 2f / (float)num3;
				int num6 = Mathf.FloorToInt((float)(index / 2));
				int num7 = ((index % 2 == 0) ? 1 : (-1));
				float num8 = num2 + num5 * (float)num6 * (float)num7;
				float num9 = Mathf.Sin(num8) * num4;
				float num10 = Mathf.Cos(num8) * num4;
				float num11 = 0f;
				Vector3 localPosition = default(Vector3);
				((Vector3)(ref localPosition))..ctor(num9, num10, num11);
				GameObject val2 = new GameObject();
				((Object)val2).name = "ProjectilePosition" + self.currentBombIndex;
				val2.transform.parent = parent;
				val2.transform.localPosition = localPosition;
				val2.transform.localScale = Vector3.one;
				val2.transform.rotation = Quaternion.identity;
				return val2.transform;
			}
		}

		public static void MissileArtifact_ChildSpark(orig_FireBomb orig, SparkBallFire self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, SparkBallFire.bombDamageCoefficient, SparkBallFire.projectilePrefab);
		}

		public static void MissileArtifact_SeekerPunch(orig_FireGauntlet orig, SpiritPunch self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, self.damageCoefficient, self.projectilePrefab);
		}

		public static void MissileArtifact_SonSurvivorSpike(orig_FireLunarSpike orig, LunarSpikes self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, self.damageCoefficient, self.projectilePrefab);
		}

		public static void MissileArtifact_LodrPylon(orig_OnEnter orig, ThrowPylon self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, ThrowPylon.damageCoefficient, ThrowPylon.projectilePrefab);
		}

		public static void MissileArtifact_ArtiBolts(orig_FireGauntlet orig, FireFireBolt self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, self.damageCoefficient, self.projectilePrefab);
		}

		public static void MissileArtifact_VagrantTrackingBomb(orig_FireBomb orig, FireTrackingBomb self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, FireTrackingBomb.bombDamageCoefficient, FireTrackingBomb.projectilePrefab);
		}

		public static void MissileArtifact_CaptainTazer(orig_Fire orig, FireTazer self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, FireTazer.damageCoefficient, FireTazer.projectilePrefab);
		}

		public static void MissileArtifact_ViendSecondary(orig_FireProjectiles orig, FireMegaBlasterBase self)
		{
			orig.Invoke(self);
			MoreProjectilesModule.FireWarfareProjectilesSimple(((EntityState)self).characterBody, self.damageCoefficient, self.projectilePrefab);
		}

		public static void MissileArtifact_GreaterWispFireCannons(orig_OnEnter orig, FireCannons self)
		{
			//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)
			orig.Invoke(self);
			if (!MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				return;
			}
			Ray aimRay = ((BaseState)self).GetAimRay();
			if (!((EntityState)self).isAuthority || !Object.op_Implicit((Object)(object)((EntityState)self).modelLocator) || !Object.op_Implicit((Object)(object)((EntityState)self).modelLocator.modelTransform))
			{
				return;
			}
			ChildLocator component = ((Component)((EntityState)self).modelLocator.modelTransform).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				int num = component.FindChildIndex("MuzzleLeft");
				int num2 = component.FindChildIndex("MuzzleRight");
				Transform val = component.FindChild(num);
				Transform val2 = component.FindChild(num2);
				if (Object.op_Implicit((Object)(object)val))
				{
					FireProjectilesFromTransform(val);
				}
				if (Object.op_Implicit((Object)(object)val2))
				{
					FireProjectilesFromTransform(val2);
				}
			}
			void FireProjectilesFromTransform(Transform transform)
			{
				//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_0021: 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_0027: 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_002b: 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_004b: 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_0062: 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_00c5: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)transform == (Object)null))
				{
					Vector3 val3 = Vector3.Cross(Vector3.up, ((Ray)(ref aimRay)).direction);
					Vector3 axis = val3;
					FireProjectileInfo val4 = default(FireProjectileInfo);
					val4.projectilePrefab = self.projectilePrefab;
					val4.position = transform.position;
					val4.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val4.owner = ((EntityState)self).gameObject;
					val4.damage = ((BaseState)self).damageStat * self.damageCoefficient;
					val4.crit = Util.CheckRoll(((EntityState)self).characterBody.crit, ((EntityState)self).characterBody.master);
					FireProjectileInfo fireProjectileInfo = val4;
					MoreProjectilesModule.FireWarfareProjectiles(aimRay, fireProjectileInfo, 20f, axis);
				}
			}
		}

		public static void MissileArtifact_BrotherFistSlam(orig_OnEnter orig, FistSlam self)
		{
			orig.Invoke(self);
			if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				FistSlam.waveProjectileCount *= 2;
			}
		}

		public static void MissileArtifact_BrotherUltChannelState(orig_OnEnter orig, UltChannelState self)
		{
			orig.Invoke(self);
			if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				UltChannelState.waveProjectileCount += 2;
			}
		}

		public static void MissileArtifact_BrotherWeaponSlam(orig_OnEnter orig, WeaponSlam self)
		{
			orig.Invoke(self);
			if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				WeaponSlam.waveProjectileCount += 2;
			}
		}

		public static void MissileArtifact_GupDeathEnter(orig_OnEnter orig, BaseSplitDeath self)
		{
			if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				self.spawnCount = 3;
			}
			orig.Invoke(self);
		}

		public static void MissileArtifact_ChefCleaver(orig_OnEnter orig, Dice self)
		{
			//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_003c: 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_004d: 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_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_005f: 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_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_008e: 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_00e0: 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_00eb: 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_00f7: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0125: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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)
			orig.Invoke(self);
			if (((EntityState)self).isAuthority && !self.hasBoost && MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				Ray aimRay = ((BaseState)self).GetAimRay();
				Vector3 val = Vector3.Cross(Vector3.up, ((Ray)(ref aimRay)).direction);
				Vector3 val2 = Vector3.Cross(((Ray)(ref aimRay)).direction, val);
				FireProjectileInfo val3 = default(FireProjectileInfo);
				val3.projectilePrefab = self.projectilePrefab;
				val3.position = ((Ray)(ref aimRay)).origin;
				val3.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
				val3.owner = ((EntityState)self).gameObject;
				val3.damage = ((BaseState)self).damageStat * self.damageCoefficient;
				val3.force = self.force;
				val3.crit = Util.CheckRoll(((BaseState)self).critStat, ((EntityState)self).characterBody.master);
				FireProjectileInfo val4 = val3;
				val3.rotation = Util.QuaternionSafeLookRotation(Quaternion.AngleAxis(-45f, val2) * ((Ray)(ref aimRay)).direction);
				val4.rotation = Util.QuaternionSafeLookRotation(Quaternion.AngleAxis(45f, val2) * ((Ray)(ref aimRay)).direction);
				if (!NetworkServer.active && Object.op_Implicit((Object)(object)self.chefController))
				{
					self.chefController.CacheCleaverProjectileFireInfo(val3);
				}
				ProjectileManager.instance.FireProjectile(val3);
				if (!NetworkServer.active && Object.op_Implicit((Object)(object)self.chefController))
				{
					self.chefController.CacheCleaverProjectileFireInfo(val4);
				}
				ProjectileManager.instance.FireProjectile(val4);
			}
		}

		public static void MissileArtifact_GrandpaVacuum(orig_Fire orig, FireSecondaryProjectile self)
		{
			//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)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			if (!MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				orig.Invoke(self);
				return;
			}
			self.hasFired = true;
			if (Object.op_Implicit((Object)(object)self.muzzleEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(self.muzzleEffectPrefab, ((EntityState)self).gameObject, self.muzzleName, false);
			}
			if (!((EntityState)self).isAuthority || !Object.op_Implicit((Object)(object)self.projectilePrefab))
			{
				return;
			}
			Ray aimRay = ((BaseState)self).GetAimRay();
			Transform modelTransform = ((EntityState)self).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((Ray)(ref aimRay)).origin = ((Component)component.FindChild(self.muzzleName)).transform.position;
				}
			}
			FireProjectileInfo val = default(FireProjectileInfo);
			val.projectilePrefab = self.projectilePrefab;
			val.position = ((Ray)(ref aimRay)).origin;
			val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
			val.owner = ((EntityState)self).gameObject;
			val.damage = ((BaseState)self).damageStat * self.damageCoefficient;
			val.force = self.force;
			val.crit = Util.CheckRoll(((BaseState)self).critStat, ((EntityState)self).characterBody.master);
			ProjectileManager.instance.FireProjectile(val);
			MoreProjectilesModule.FireWarfareProjectiles(aimRay, val, 45f);
		}

		public static void MissileArtifact_RailerPistol(orig_FireBullet orig, FirePistol self, Ray aimRay)
		{
			//IL_0023: 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_00dd: 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_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_0104: 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_010d: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0128: 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_014b: 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_0194: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: 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_01da: Unknown result type (might be due to invalid IL or missing references)
			if (!MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody))
			{
				orig.Invoke(self, aimRay);
				return;
			}
			((BaseState)self).StartAimMode(aimRay, 2f, false);
			Util.PlaySound(self.fireSoundString, ((EntityState)self).gameObject);
			EffectManager.SimpleMuzzleFlash(self.muzzleFlashPrefab, ((EntityState)self).gameObject, self.muzzleName, false);
			((EntityState)self).PlayAnimation(self.animationLayerName, self.animationStateName, self.animationPlaybackRateParam, self.duration, 0f);
			((BaseState)self).AddRecoil(self.recoilYMin, self.recoilYMax, self.recoilXMin, self.recoilXMax);
			if (((EntityState)self).isAuthority)
			{
				float num = 0f;
				if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
				{
					num = ((EntityState)self).characterBody.spreadBloomAngle;
				}
				Quaternion val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.forward);
				Quaternion val2 = Quaternion.AngleAxis(Random.Range(0f, self.baseInaccuracyDegrees + num), Vector3.left);
				Quaternion rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction, Vector3.up) * val * val2;
				FireProjectileInfo val3 = default(FireProjectileInfo);
				val3.projectilePrefab = self.projectilePrefab;
				val3.position = ((Ray)(ref aimRay)).origin;
				val3.rotation = rotation;
				val3.owner = ((EntityState)self).gameObject;
				val3.damage = ((BaseState)self).damageStat * self.damageCoefficient;
				val3.crit = ((BaseState)self).RollCrit();
				val3.force = self.force;
				val3.procChainMask = default(ProcChainMask);
				val3.damageColorIndex = (DamageColorIndex)0;
				FireProjectileInfo val4 = val3;
				ProjectileManager.instance.FireProjectile(val4);
				MoreProjectilesModule.FireWarfareProjectiles(aimRay, val4, 20f);
				((EntityState)self).characterBody.characterMotor.ApplyForce((0f - self.selfKnockbackForce) * ((Ray)(ref aimRay)).direction, false, false);
			}
			((EntityState)self).characterBody.AddSpreadBloom(self.spreadBloomValue);
		}

		public static void MissileArtifact_ThrowBomb(orig_Fire orig, BaseThrowBombState self)
		{
			//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_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_00b1: 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_00bb: 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_00f5: 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_010d: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (MoreProjectilesModule.IsMoreProjectilesActiveForBody(((EntityState)self).characterBody) && ((EntityState)self).isAuthority && self is ThrowLunarSecondary)
			{
				Ray aimRay = ((BaseState)self).GetAimRay();
				if ((Object)(object)self.projectilePrefab != (Object)null)
				{
					float num = Util.Remap(self.charge, 0f, 1f, self.minDamageCoefficient, self.maxDamageCoefficient);
					float force = self.charge * self.force;
					FireProjectileInfo val = default(FireProjectileInfo);
					val.projectilePrefab = self.projectilePrefab;
					val.position = ((Ray)(ref aimRay)).origin;
					val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val.owner = ((EntityState)self).gameObject;
					val.damage = ((BaseState)self).damageStat * num;
					val.force = force;
					val.crit = ((BaseState)self).RollCrit();
					FireProjectileInfo val2 = val;
					self.ModifyProjectile(ref val2);
					ProjectileManager.instance.FireProjectile(val2);
					MoreProjectilesModule.FireWarfareProjectiles(aimRay, val2, 20f);
				}
				if (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor))
				{
					((EntityState)self).characterMotor.ApplyForce(((Ray)(ref aimRay)).directio