Decompiled source of SilverTheHedgehog v0.0.2

SilverTheHedgehog.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.FalseSonBoss;
using HG;
using HG.BlendableTypes;
using HedgehogUtils;
using HedgehogUtils.Boost;
using HedgehogUtils.Boost.EntityStates;
using HedgehogUtils.Forms;
using HedgehogUtils.Forms.EntityStates;
using HedgehogUtils.Forms.SuperForm;
using HedgehogUtils.Launch;
using HedgehogUtils.Miscellaneous;
using JetBrains.Annotations;
using KinematicCharacterController;
using LookingGlass.LookingGlassLanguage;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.ContentManagement;
using RoR2.HudOverlay;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPaths;
using SilverTheHedgehog.Components;
using SilverTheHedgehog.Modules;
using SilverTheHedgehog.Modules.Characters;
using SilverTheHedgehog.Modules.SilverSkillDefs;
using SilverTheHedgehog.Modules.Survivors;
using SilverTheHedgehog.Rig;
using SilverTheHedgehog.SkillStates;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SilverTheHedgehog
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

		internal static void Message(object data)
		{
			if (Config.EnableLogs().Value)
			{
				_logSource.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			if (Config.EnableLogs().Value)
			{
				_logSource.LogWarning(data);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.gavinel.SilverTheHedgehog", "SilverTheHedgehog", "0.0.2")]
	public class SilverTheHedgehogPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.gavinel.SilverTheHedgehog";

		public const string MODNAME = "SilverTheHedgehog";

		public const string MODVERSION = "0.0.2";

		public const string DEVELOPER_PREFIX = "GAVINEL";

		public static SilverTheHedgehogPlugin instance;

		public static bool emoteAPILoaded = false;

		public static bool lookingGlassLoaded = false;

		public static bool riskOfOptionsLoaded = false;

		public static bool ancientScepterLoaded = false;

		private static BodyIndex silverBodyIndex = (BodyIndex)(-1);

		private static bool chestWarningShown;

		private static string chestHidingMod;

		private static bool chestHidingModSearched;

		private static readonly Dictionary<HealthComponent, float> recentSilverHits = new Dictionary<HealthComponent, float>();

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			emoteAPILoaded = Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI");
			Log.Message("Emote API exists? " + emoteAPILoaded);
			lookingGlassLoaded = Chainloader.PluginInfos.ContainsKey("droppod.lookingglass");
			Log.Message("Looking Glass exists? " + lookingGlassLoaded);
			riskOfOptionsLoaded = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			ancientScepterLoaded = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
			Log.Message("Risk of Options exists? " + riskOfOptionsLoaded);
			LoadTimer.Mark("start");
			Assets.Initialize();
			LoadTimer.Mark("Assets.Initialize");
			Config.ReadConfig();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			DamageTypes.Initialize();
			PsychicHold.Initialize();
			PsychicProjectiles.Create();
			LoadTimer.Mark("Psychic projectiles");
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			LoadTimer.Mark("ItemDisplays.PopulateDisplays");
			NetworkingAPI.RegisterMessageType<PsychicThrowMessage>();
			new SilverTheHedgehogCharacter().Initialize();
			LoadTimer.Mark("SilverTheHedgehogCharacter");
			new ContentPacks().Initialize();
			LoadTimer.Mark("ContentPacks");
			if (riskOfOptionsLoaded)
			{
				RiskOfOptionsSetup();
			}
			Hook();
		}

		private void FixedUpdate()
		{
			PsychicHold.ServerFixedUpdate();
		}

		private void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			FootstepHandler.Footstep_string_GameObject += new hook_Footstep_string_GameObject(SilverFootstep);
			HealthComponent.TakeDamage += new hook_TakeDamage(TakeDamage);
			GlobalEventManager.onServerDamageDealt += DamageRefillsBoost;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStats);
			GenericSkill.ExecuteIfReady += new hook_ExecuteIfReady(BlockSkillsWhileCharging);
			InteractionDriver.FindBestInteractableObject += new hook_FindBestInteractableObject(NoInteractingHeldObjects);
			UserProfile.OnLogin += new hook_OnLogin(ConfigUnlocks);
			CharacterBody.onBodyStartGlobal += WarnChestHidingMods;
			Run.onRunStartGlobal += ResetChestWarning;
			if (lookingGlassLoaded)
			{
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LookingGlassSetup));
			}
		}

		public static void LookingGlassSetup()
		{
			if (Language.languagesByName.TryGetValue("en", out var value))
			{
				RegisterLookingGlassBuff(value, Buffs.boostBuff, "Silver Boost", $"Gain <style=cIsUtility>+{50f} armor</style> and <style=cIsUtility>movement speed</style>.");
				RegisterLookingGlassBuff(value, Buffs.psychicGrabModeBuff, "Psychic Grab", "Grabbing nearby enemies' bodies and projectiles. No passive Boost regeneration.");
			}
		}

		private static void RegisterLookingGlassBuff(Language language, BuffDef buff, string name, string description)
		{
			LookingGlassLanguageAPI.SetupToken(language, "NAME_" + ((Object)buff).name, name);
			LookingGlassLanguageAPI.SetupToken(language, "DESCRIPTION_" + ((Object)buff).name, description);
		}

		private static void RiskOfOptionsSetup()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			ModSettingsManager.SetModIcon(SilverResources.Icon("texSilverPortrait"));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.EnableLogs()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockVeniceSkin()));
			Config.ForceUnlockVeniceSkin().SettingChanged += SilverTheHedgehogCharacter.UnlockVeniceSkinConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockMastery()));
			Config.ForceUnlockMastery().SettingChanged += SilverTheHedgehogCharacter.UnlockMasteryConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockMetalSkin()));
			Config.ForceUnlockMetalSkin().SettingChanged += SilverTheHedgehogCharacter.UnlockMetalSkinConfig;
		}

		private void ConfigUnlocks(orig_OnLogin orig, UserProfile self)
		{
			orig.Invoke(self);
			if (!self.HasAchievement("GAVINELSILVERFALSESONSKINUNLOCKABLE") && Config.ForceUnlockVeniceSkin().Value)
			{
				self.AddAchievement("GAVINELSILVERFALSESONSKINUNLOCKABLE", true);
			}
			if (!self.HasAchievement("GAVINELSILVERMASTERYUNLOCKABLE") && Config.ForceUnlockMastery().Value)
			{
				self.AddAchievement("GAVINELSILVERMASTERYUNLOCKABLE", true);
			}
			if (!self.HasAchievement("GAVINELSILVERSOLUSSKINUNLOCKABLE") && Config.ForceUnlockMetalSkin().Value)
			{
				self.AddAchievement("GAVINELSILVERSOLUSSKINUNLOCKABLE", true);
			}
		}

		private void RecalculateStats(CharacterBody self, StatHookEventArgs stats)
		{
			if (Object.op_Implicit((Object)(object)self) && self.HasBuff(Buffs.boostBuff))
			{
				BoostLogic.BoostStats(self, stats, PowerBoostLogic.ShouldPowerBoost(self) ? 0.5f : 0.25f);
				stats.armorAdd += 50f;
			}
		}

		private void SilverFootstep(orig_Footstep_string_GameObject orig, FootstepHandler self, string childName, GameObject footstepEffect)
		{
			SilverAnimator silverAnimator = (Object.op_Implicit((Object)(object)self) ? ((Component)self).GetComponentInParent<SilverAnimator>() : null);
			if (!Object.op_Implicit((Object)(object)silverAnimator) || !(silverAnimator.BaseClip != "walk"))
			{
				orig.Invoke(self, childName, footstepEffect);
			}
		}

		private GameObject NoInteractingHeldObjects(orig_FindBestInteractableObject orig, InteractionDriver self)
		{
			GameObject val = orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return val;
			}
			GameObject val2 = val;
			EntityLocator component = val.GetComponent<EntityLocator>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.entity))
			{
				val2 = component.entity;
			}
			if (PsychicHoldController.heldInteractables.Contains(val) || PsychicHoldController.heldInteractables.Contains(val2))
			{
				return null;
			}
			if (Object.op_Implicit((Object)(object)val2.GetComponent<SpecialObjectAttributes>()) && Object.op_Implicit((Object)(object)VehicleSeat.FindVehicleSeatWithPassenger(val2, (VehicleSeat)null)))
			{
				return null;
			}
			return val;
		}

		private static void ResetChestWarning(Run run)
		{
			chestWarningShown = false;
		}

		private static string FindChestHidingMod()
		{
			if (!chestHidingModSearched)
			{
				chestHidingModSearched = true;
				foreach (PluginInfo value in Chainloader.PluginInfos.Values)
				{
					if (value != null && value.Metadata != null)
					{
						string text = (value.Metadata.GUID + " " + value.Metadata.Name).ToLowerInvariant();
						if (text.Contains("qolchests") || text.Contains("emptychestsbegone") || text.Contains("hideopenedchests") || text.Contains("removeemptychests") || text.Contains("hideemptychests"))
						{
							chestHidingMod = value.Metadata.Name;
							break;
						}
					}
				}
			}
			return chestHidingMod;
		}

		private static void WarnChestHidingMods(CharacterBody body)
		{
			if (!chestWarningShown && Object.op_Implicit((Object)(object)body) && body.isPlayerControlled && body.hasEffectiveAuthority && !(body.baseNameToken != "GAVINEL_SILVER_THE_HEDGEHOG_BODY_NAME"))
			{
				string text = FindChestHidingMod();
				if (!string.IsNullOrEmpty(text))
				{
					chestWarningShown = true;
					Chat.AddMessage("<color=#7FFFF0>[Silver]</color> <color=#FFD27F>" + text + "</color> hides opened chests. Silver can't grab hidden objects, so you'll have fewer things to throw. Consider turning that option off while playing Silver.");
				}
			}
		}

		private void TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damage)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Object.op_Implicit((Object)(object)self) && self.alive;
			orig.Invoke(self, damage);
			if (!NetworkServer.active || damage == null || !Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.body))
			{
				return;
			}
			bool flag2 = Object.op_Implicit((Object)(object)damage.attacker) && Object.op_Implicit((Object)(object)damage.attacker.GetComponent<PsychicGrabModeVisual>());
			if (flag2 && !damage.rejected && self.alive)
			{
				recentSilverHits[self] = Time.fixedTime;
				if (recentSilverHits.Count > 256)
				{
					recentSilverHits.Clear();
				}
			}
			if (flag && !self.alive && !damage.rejected && !self.body.HasBuff(Buffs.launchedBuff))
			{
				float value;
				bool flag3 = recentSilverHits.TryGetValue(self, out value) && Time.fixedTime - value <= 3f;
				recentSilverHits.Remove(self);
				if (!PsychicHold.suppressVulnerable && (flag2 || flag3 || DamageAPI.HasModdedDamageType(ref damage.damageType, DamageTypes.psychicHoldOnKill)))
				{
					PsychicHold.MakeVulnerable(self.body);
				}
			}
		}

		private void DamageRefillsBoost(DamageReport report)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//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_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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || report == null || report.damageInfo == null)
			{
				return;
			}
			if ((int)silverBodyIndex == -1)
			{
				silverBodyIndex = BodyCatalog.FindBodyIndex("SilverTheHedgehog");
			}
			CharacterBody attackerBody = report.attackerBody;
			if (!Object.op_Implicit((Object)(object)attackerBody) || (Object)(object)attackerBody == (Object)(object)report.victimBody || attackerBody.bodyIndex != silverBodyIndex || (int)report.dotType != -1 || report.damageInfo.procChainMask.mask != 0 || report.damageInfo.procCoefficient <= 0f)
			{
				return;
			}
			DamageSource damageSource = report.damageInfo.damageType.damageSource;
			int num = PsychicHold.ExtraSpecialStacks(attackerBody);
			if ((damageSource & 1) != 0 && (damageSource & 8) == 0)
			{
				BoostLogic component = ((Component)attackerBody).GetComponent<BoostLogic>();
				if (Object.op_Implicit((Object)(object)component) && component.boostExists)
				{
					float num2 = 1f + 0.5f * (float)num;
					component.AddBoost(component.maxBoostMeter * 0.01f * Mathf.Min(1f, report.damageInfo.procCoefficient) * FightBoostScale(attackerBody) * num2);
				}
			}
			else if ((damageSource & 2) != 0 && num > 0)
			{
				BoostLogic component2 = ((Component)attackerBody).GetComponent<BoostLogic>();
				if (Object.op_Implicit((Object)(object)component2) && component2.boostExists)
				{
					component2.AddBoost(component2.maxBoostMeter * 0.01f * 1f * (float)num * Mathf.Min(1f, report.damageInfo.procCoefficient));
				}
			}
		}

		private static float FightBoostScale(CharacterBody body)
		{
			if (PsychicHoldController.CountHeld(body) <= 0)
			{
				return 1f;
			}
			return 0.25f;
		}

		private bool BlockSkillsWhileCharging(orig_ExecuteIfReady orig, GenericSkill self)
		{
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.characterBody))
			{
				SkillLocator skillLocator = self.characterBody.skillLocator;
				if (Object.op_Implicit((Object)(object)skillLocator) && ((Object)(object)self == (Object)(object)skillLocator.secondary || (Object)(object)self == (Object)(object)skillLocator.utility))
				{
					EntityStateMachine val = EntityStateMachine.FindByCustomName(((Component)self.characterBody).gameObject, "Weapon");
					if (Object.op_Implicit((Object)(object)val) && val.state is PsychicBlast { BlocksOtherSkills: not false })
					{
						return false;
					}
				}
			}
			return orig.Invoke(self);
		}
	}
}
namespace SilverTheHedgehog.SkillStates
{
	public class BoostIdle : BoostIdle
	{
		public override void OnEnter()
		{
			((BoostIdle)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
		}

		public override void PlayBoostIdleEnterAnimation()
		{
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			((BoostIdle)this).OnExit();
		}
	}
	public class Death : GenericCharacterDeath
	{
		protected string soundString = "Play_hedgehogutils_death";

		private const float destroyTime = 1.6f;

		public override void OnEnter()
		{
			((GenericCharacterDeath)this).OnEnter();
			Util.PlaySound(soundString, ((EntityState)this).gameObject);
			((EntityState)this).cameraTargetParams.cameraPivotTransform = ((EntityState)this).gameObject.transform;
		}

		public override void FixedUpdate()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (((EntityState)this).fixedAge >= 1.6f && NetworkServer.active)
			{
				((GenericCharacterDeath)this).DestroyBodyAsapServer();
			}
		}

		public override void OnExit()
		{
			((GenericCharacterDeath)this).DestroyModel();
			((GenericCharacterDeath)this).OnExit();
		}
	}
	public class PsychicBlast : BaseSkillState
	{
		private int level = -1;

		private float chargeTimer;

		private bool fired;

		private float firedAge;

		private uint chargeSoundId;

		private bool chargePosed;

		private BoostLogic boostLogic;

		private PsychicProjectiles.Set shots;

		private int MaxLevel
		{
			get
			{
				if (shots == null || shots.orbPrefabs == null)
				{
					return StaticValues.psychicOrbScale.Length - 1;
				}
				return shots.orbPrefabs.Length - 1;
			}
		}

		private bool Charging
		{
			get
			{
				if (!fired)
				{
					return ((EntityState)this).fixedAge >= 0.25f;
				}
				return false;
			}
		}

		public bool BlocksOtherSkills => !fired;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			boostLogic = ((EntityState)this).GetComponent<BoostLogic>();
			shots = PsychicProjectiles.For(((EntityState)this).characterBody);
			((EntityState)this).characterBody.SetAimTimer(2f);
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.PrimaryStart();
		}

		private bool HasBoost()
		{
			if (!Object.op_Implicit((Object)(object)boostLogic) || !boostLogic.boostExists)
			{
				return true;
			}
			if (!boostLogic.boostAvailable)
			{
				return false;
			}
			if (!NetworkServer.active)
			{
				return boostLogic.predictedMeter > 0f;
			}
			return boostLogic.boostMeter > 0f;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.SetAimTimer(2f);
			if (fired)
			{
				firedAge += Time.fixedDeltaTime;
				if (((EntityState)this).isAuthority && firedAge >= 0.4f / ((BaseState)this).attackSpeedStat)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				return;
			}
			if (Charging && HasBoost())
			{
				if (level < 0)
				{
					level = 0;
					chargeSoundId = Util.PlaySound("Play_silver_psych_charge", ((EntityState)this).gameObject);
					ChargeEffect();
					if (!chargePosed)
					{
						chargePosed = true;
						SilverAnimator.Find(((EntityState)this).GetModelTransform())?.PrimaryCharge();
					}
				}
				if (level < MaxLevel)
				{
					chargeTimer += Time.fixedDeltaTime;
					if (chargeTimer >= shots.orbChargeTime[level + 1] / ((BaseState)this).attackSpeedStat)
					{
						chargeTimer = 0f;
						level++;
						Util.PlaySound("Play_silver_psych_ting", ((EntityState)this).gameObject);
						ChargeEffect();
					}
				}
				if (NetworkServer.active && Object.op_Implicit((Object)(object)boostLogic) && boostLogic.boostExists)
				{
					float num = boostLogic.boostRegen;
					if (level < MaxLevel)
					{
						num += 20f * ((BaseState)this).attackSpeedStat * PsychicScaling.CooldownCostFactor(((EntityState)this).characterBody);
					}
					boostLogic.RemoveBoost(num * Time.fixedDeltaTime);
				}
			}
			else if (Charging && !chargePosed)
			{
				chargePosed = true;
				SilverAnimator.Find(((EntityState)this).GetModelTransform())?.PrimaryCharge();
			}
			if (((EntityState)this).isAuthority && !((EntityState)this).inputBank.skill1.down)
			{
				Fire();
			}
		}

		private void Fire()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_014e: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			fired = true;
			StopChargeSound();
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.PrimaryRelease();
			Util.PlaySound((level < 3 && (shots == null || !shots.isSuper)) ? "Play_silver_psych_toss" : "Play_silver_psych_throw", ((EntityState)this).gameObject);
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			Ray aimRay = ((BaseState)this).GetAimRay();
			PsychicProjectiles.Set set = shots;
			GameObject val = ((level < 0) ? set.blastPrefab : set.orbPrefabs[level]);
			float num = ((level < 0) ? set.tapDamage : set.orbDamage[level]);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Vector3 val2 = ((Ray)(ref aimRay)).direction;
			val2.y = 0f;
			val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : ((EntityState)this).characterBody.transform.forward);
			Vector3 val3 = ((EntityState)this).characterBody.corePosition + val2 * 1f + Vector3.up * 0.1f;
			Vector3 point = ((Ray)(ref aimRay)).GetPoint(200f);
			Ray val4 = aimRay;
			LayerIndex val5 = LayerIndex.world;
			int num2 = LayerMask.op_Implicit(((LayerIndex)(ref val5)).mask);
			val5 = LayerIndex.entityPrecise;
			RaycastHit[] array = Physics.RaycastAll(val4, 200f, num2 | LayerMask.op_Implicit(((LayerIndex)(ref val5)).mask), (QueryTriggerInteraction)1);
			float num3 = float.MaxValue;
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val6 = array2[i];
				HurtBox val7 = (Object.op_Implicit((Object)(object)((RaycastHit)(ref val6)).collider) ? ((Component)((RaycastHit)(ref val6)).collider).GetComponent<HurtBox>() : null);
				if ((!Object.op_Implicit((Object)(object)val7) || !((Object)(object)val7.healthComponent == (Object)(object)((EntityState)this).healthComponent)) && !(Vector3.Dot(((RaycastHit)(ref val6)).point - val3, ((Ray)(ref aimRay)).direction) < 0.5f) && ((RaycastHit)(ref val6)).distance < num3)
				{
					num3 = ((RaycastHit)(ref val6)).distance;
					point = ((RaycastHit)(ref val6)).point;
				}
			}
			Vector3 val8 = point - val3;
			val8 = ((((Vector3)(ref val8)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val8)).normalized : ((Ray)(ref aimRay)).direction);
			if (Vector3.Dot(val8, ((Ray)(ref aimRay)).direction) < 0.5f)
			{
				val8 = ((Ray)(ref aimRay)).direction;
			}
			GameObject val9 = ((level < 0) ? set.muzzleTap : set.muzzleCharged);
			if (Object.op_Implicit((Object)(object)val9))
			{
				EffectManager.SpawnEffect(val9, new EffectData
				{
					origin = val3,
					rotation = Util.QuaternionSafeLookRotation(val8)
				}, true);
			}
			GameObject val10 = null;
			if (level + 1 >= 4 || (shots != null && shots.isSuper))
			{
				HomingTracker component = ((EntityState)this).GetComponent<HomingTracker>();
				HurtBox val11 = (Object.op_Implicit((Object)(object)component) ? component.GetTrackingTarget() : null);
				if (Object.op_Implicit((Object)(object)val11))
				{
					val10 = ((Component)val11).gameObject;
				}
			}
			ProjectileManager.instance.FireProjectile(val, val3, Util.QuaternionSafeLookRotation(val8), ((EntityState)this).gameObject, num * ((BaseState)this).damageStat, 0f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, val10, -1f, (DamageTypeCombo?)null);
			((EntityState)this).characterBody.AddSpreadBloom((level < 0) ? 0.4f : 1.2f);
		}

		private void ChargeEffect()
		{
			//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)
			bool num = level >= MaxLevel;
			PsychicProjectiles.Set set = shots ?? PsychicProjectiles.For(((EntityState)this).characterBody);
			GameObject val = (num ? set.chargeMaxEffect : set.chargeLevelEffect);
			if (Object.op_Implicit((Object)(object)val))
			{
				Object.Instantiate<GameObject>(val, ((EntityState)this).characterBody.corePosition, Quaternion.identity, ((EntityState)this).characterBody.transform);
			}
		}

		private void StopChargeSound()
		{
			if (chargeSoundId != 0)
			{
				AkSoundEngine.StopPlayingID(chargeSoundId);
				chargeSoundId = 0u;
			}
		}

		public override void OnExit()
		{
			if (((EntityState)this).isAuthority && !fired)
			{
				Fire();
			}
			StopChargeSound();
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.PrimaryRelease();
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			if (fired)
			{
				return (InterruptPriority)0;
			}
			return (InterruptPriority)2;
		}
	}
	public class PsychicGrabToggle : BaseSkillState
	{
		public override void OnEnter()
		{
			//IL_0028: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (((EntityState)this).isAuthority)
			{
				if (NetworkServer.active)
				{
					PsychicHold.ServerToggleGrabMode(((EntityState)this).characterBody);
				}
				else
				{
					NetMessageExtensions.Send((INetMessage)(object)new PsychicThrowMessage(((NetworkBehaviour)((EntityState)this).characterBody).netId, PsychicThrowMessage.Action.ToggleGrabMode, ((EntityState)this).characterBody.corePosition, ((EntityState)this).characterBody.transform.forward), (NetworkDestination)2);
				}
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)0;
		}
	}
	public class PsychicSlap : BaseSkillState
	{
		private Vector3 startVelocity;

		private GameObject handGlow;

		private uint chargeSoundId;

		private bool redirected;

		private bool releasedEarly;

		public override void OnEnter()
		{
			//IL_004f: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (PsychicHoldController.CountHeld(((EntityState)this).characterBody) > 0)
			{
				redirected = true;
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new PsychicThrow());
				}
				return;
			}
			startVelocity = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			}
			((EntityState)this).characterBody.SetAimTimer(2f);
			handGlow = CreateHandGlow((EntityState)(object)this);
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.SlapCharge();
		}

		internal static GameObject CreateHandGlow(EntityState state)
		{
			//IL_0041: 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)
			Transform val = FindHand(state);
			GameObject slapHandGlow = PsychicProjectiles.For(Object.op_Implicit((Object)(object)state.outer) ? ((Component)state.outer).GetComponent<CharacterBody>() : null).slapHandGlow;
			if (!Object.op_Implicit((Object)(object)slapHandGlow) || !Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			return Object.Instantiate<GameObject>(slapHandGlow, val.position, val.rotation, val);
		}

		internal static void ReleaseHandGlow(GameObject glow)
		{
			if (Object.op_Implicit((Object)(object)glow))
			{
				glow.transform.SetParent((Transform)null, true);
				ParticleSystem[] componentsInChildren = glow.GetComponentsInChildren<ParticleSystem>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].Stop(true, (ParticleSystemStopBehavior)1);
				}
				Object.Destroy((Object)(object)glow, 0.6f);
			}
		}

		private static Transform FindHand(EntityState state)
		{
			ModelLocator component = ((Component)state.outer).GetComponent<ModelLocator>();
			Transform val = (Object.op_Implicit((Object)(object)component) ? component.modelTransform : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			SilverAnimator silverAnimator = SilverAnimator.Find(val);
			Transform val2 = (Object.op_Implicit((Object)(object)silverAnimator) ? silverAnimator.FindBone("RightHand") : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				return val2;
			}
			ChildLocator component2 = ((Component)val).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				string[] array = new string[3] { "HandR", "Hand_R", "hand.r" };
				foreach (string text in array)
				{
					Transform val3 = component2.FindChild(text);
					if (Object.op_Implicit((Object)(object)val3))
					{
						return val3;
					}
				}
			}
			Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true);
			foreach (Transform val4 in componentsInChildren)
			{
				if (((Object)val4).name == "Hand_R" || ((Object)val4).name == "hand.r" || ((Object)val4).name == "HandR")
				{
					return val4;
				}
			}
			return val;
		}

		public override void FixedUpdate()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (redirected)
			{
				return;
			}
			((EntityState)this).characterBody.SetAimTimer(2f);
			SkillAirStop.Apply((BaseState)(object)this, startVelocity, ((EntityState)this).fixedAge);
			SkillAirStop.FaceAim((BaseState)(object)this);
			if (chargeSoundId == 0 && ((EntityState)this).fixedAge >= 0.15f)
			{
				chargeSoundId = Util.PlaySound("Play_silver_psych_charge", ((EntityState)this).gameObject);
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (((EntityState)this).fixedAge >= 0.7f)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new PsychicSlapFire
				{
					charged = true
				});
				return;
			}
			if (!((EntityState)this).inputBank.skill2.down)
			{
				releasedEarly = true;
			}
			if (releasedEarly && ((EntityState)this).fixedAge >= 0.25f)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new PsychicSlapFire
				{
					charged = false
				});
			}
		}

		public override void OnExit()
		{
			if (chargeSoundId != 0)
			{
				AkSoundEngine.StopPlayingID(chargeSoundId);
				chargeSoundId = 0u;
			}
			ReleaseHandGlow(handGlow);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class PsychicSlapFire : BaseSkillState
	{
		public bool charged;

		private float duration;

		private Vector3 startVelocity;

		private GameObject handGlow;

		private float Range => (charged ? 28f : 12f) * SuperSilver.SlapRange(((EntityState)this).characterBody);

		public override void OnEnter()
		{
			//IL_0033: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = 0.3f / ((BaseState)this).attackSpeedStat;
			startVelocity = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
			((EntityState)this).characterBody.SetAimTimer(2f);
			SkillAirStop.FaceAim((BaseState)(object)this);
			handGlow = PsychicSlap.CreateHandGlow((EntityState)(object)this);
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.SlapFire();
			Fire();
		}

		private void Fire()
		{
			//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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0095: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Util.PlaySound("Play_silver_psych_slap", ((EntityState)this).gameObject);
			Util.PlaySound("Play_silver_psych_toss", ((EntityState)this).gameObject);
			PsychicProjectiles.Set set = PsychicProjectiles.For(((EntityState)this).characterBody);
			GameObject val = (charged ? set.slapEffectCharged : set.slapEffect);
			if (Object.op_Implicit((Object)(object)val))
			{
				EffectManager.SpawnEffect(val, new EffectData
				{
					origin = ((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 1.5f,
					rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction)
				}, false);
			}
			if (NetworkServer.active)
			{
				ServerHit(aimRay);
			}
		}

		private void ServerHit(Ray aim)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_005b: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0111: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Expected O, but got Unknown
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			BullseyeSearch val = new BullseyeSearch
			{
				teamMaskFilter = TeamMask.GetEnemyTeams(((BaseState)this).GetTeam()),
				filterByLoS = true,
				searchOrigin = ((Ray)(ref aim)).origin,
				searchDirection = ((Ray)(ref aim)).direction,
				sortMode = (SortMode)1,
				maxDistanceFilter = Range,
				maxAngleFilter = 45f
			};
			val.RefreshCandidates();
			val.FilterOutGameObject(((EntityState)this).gameObject);
			HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>();
			foreach (HurtBox result in val.GetResults())
			{
				HealthComponent val2 = (Object.op_Implicit((Object)(object)result) ? result.healthComponent : null);
				if (!Object.op_Implicit((Object)(object)val2) || !val2.alive || !hashSet.Add(val2))
				{
					continue;
				}
				Vector3 val3 = ((Component)result).transform.position - ((Ray)(ref aim)).origin;
				val3.y = 0f;
				Vector3 val4;
				Vector3 normalized;
				if (!(((Vector3)(ref val3)).sqrMagnitude > 0.01f))
				{
					val4 = new Vector3(((Ray)(ref aim)).direction.x, 0f, ((Ray)(ref aim)).direction.z);
					normalized = ((Vector3)(ref val4)).normalized;
				}
				else
				{
					normalized = ((Vector3)(ref val3)).normalized;
				}
				val3 = normalized;
				DamageInfo val5 = new DamageInfo
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					damage = ((BaseState)this).damageStat * (charged ? 3f : 1f),
					crit = ((BaseState)this).RollCrit(),
					position = ((Component)result).transform.position,
					procCoefficient = 0.5f,
					damageColorIndex = (DamageColorIndex)0,
					damageType = DamageTypeCombo.op_Implicit((DamageType)0),
					force = Vector3.zero
				};
				val5.damageType.damageSource = (DamageSource)2;
				DamageAPI.AddModdedDamageType(ref val5.damageType, DamageTypes.psychicHoldOnKill);
				PsychicHold.suppressVulnerable = true;
				try
				{
					val2.TakeDamage(val5);
				}
				finally
				{
					PsychicHold.suppressVulnerable = false;
				}
				GlobalEventManager.instance.OnHitEnemy(val5, ((Component)val2).gameObject);
				GlobalEventManager.instance.OnHitAll(val5, ((Component)val2).gameObject);
				if (!Object.op_Implicit((Object)(object)val2.body))
				{
					continue;
				}
				if (!val2.alive)
				{
					CharacterBody body = val2.body;
					if (!body.HasBuff(Buffs.suppressDeathBuff) && !body.HasBuff(Buffs.launchedBuff) && !Object.op_Implicit((Object)(object)body.currentVehicle) && LaunchManager.TargetCanBeLaunched(body))
					{
						body.AddBuff(Buffs.suppressDeathBuff);
						Vector3 corePosition = body.corePosition;
						val4 = val3 + Vector3.up * 0.25f;
						Vector3 aimPoint = corePosition + ((Vector3)(ref val4)).normalized * 30f;
						((MonoBehaviour)SilverTheHedgehogPlugin.instance).StartCoroutine(PsychicHoldController.LaunchNextFrame(body, ((EntityState)this).characterBody, aimPoint, ((BaseState)this).damageStat * 3f, val5.crit));
					}
					continue;
				}
				float num = 1f;
				if (Object.op_Implicit((Object)(object)val2.body.characterMotor))
				{
					num = val2.body.characterMotor.mass;
				}
				else if (Object.op_Implicit((Object)(object)val2.body.rigidbody))
				{
					num = val2.body.rigidbody.mass;
				}
				num = Mathf.Min(num, 400f);
				Vector3 val6 = val3 * 30f + Vector3.up * 10f;
				val2.TakeDamageForce(val6 * num, true, true);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.SetAimTimer(2f);
			SkillAirStop.Apply((BaseState)(object)this, startVelocity, ((EntityState)this).fixedAge);
			SkillAirStop.FaceAim((BaseState)(object)this);
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			PsychicSlap.ReleaseHandGlow(handGlow);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(charged);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			charged = reader.ReadBoolean();
		}
	}
	public class PsychicThrow : BaseSkillState
	{
		private bool released;

		private float releaseAge;

		private Vector3 startVelocity;

		private float gatherTimer;

		private uint chargeSoundId;

		public override void OnEnter()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			startVelocity = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			}
			((EntityState)this).characterBody.SetAimTimer(2f);
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.ThrowStart();
			if (((EntityState)this).isAuthority)
			{
				Send(PsychicThrowMessage.Action.Ready);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.SetAimTimer(2f);
			SkillAirStop.Apply((BaseState)(object)this, startVelocity, ((EntityState)this).fixedAge);
			SkillAirStop.FaceAim((BaseState)(object)this);
			if (!released && PsychicHoldController.CountGathered(((EntityState)this).characterBody) >= 2)
			{
				SilverAnimator.Find(((EntityState)this).GetModelTransform())?.ThrowGather();
				if (chargeSoundId == 0)
				{
					chargeSoundId = Util.PlaySound("Play_silver_psych_charge", ((EntityState)this).gameObject);
				}
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (!released)
			{
				if (!((EntityState)this).inputBank.skill2.down)
				{
					Release();
				}
				else if (((EntityState)this).fixedAge >= 0.3f && PsychicHoldController.CountHeld(((EntityState)this).characterBody) > PsychicHoldController.CountGathered(((EntityState)this).characterBody))
				{
					gatherTimer -= Time.fixedDeltaTime;
					if (gatherTimer <= 0f)
					{
						gatherTimer = 0.15f / ((BaseState)this).attackSpeedStat;
						Util.PlaySound("Play_silver_psych_toss", ((EntityState)this).gameObject);
						Util.PlaySound("Play_silver_psych_ting", ((EntityState)this).gameObject);
						Util.PlaySound("Play_silver_psych_slap", ((EntityState)this).gameObject);
						Send(PsychicThrowMessage.Action.Gather);
						SilverAnimator.Find(((EntityState)this).GetModelTransform())?.ThrowGather();
					}
				}
			}
			else
			{
				releaseAge += Time.fixedDeltaTime;
				if (releaseAge >= 0.3f / ((BaseState)this).attackSpeedStat)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		private void Release()
		{
			released = true;
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.ThrowRelease();
			StopChargeSound();
			Util.PlaySound("Play_silver_psych_throw", ((EntityState)this).gameObject);
			Send(PsychicThrowMessage.Action.Throw);
		}

		private void Send(PsychicThrowMessage.Action action)
		{
			//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_0050: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			if (NetworkServer.active)
			{
				switch (action)
				{
				case PsychicThrowMessage.Action.Throw:
					PsychicHold.ServerThrow(((EntityState)this).characterBody, ((Ray)(ref aimRay)).origin, ((Ray)(ref aimRay)).direction);
					break;
				case PsychicThrowMessage.Action.Gather:
					PsychicHold.ServerGather(((EntityState)this).characterBody);
					break;
				default:
					PsychicHold.ServerReady(((EntityState)this).characterBody);
					break;
				}
			}
			else
			{
				NetMessageExtensions.Send((INetMessage)(object)new PsychicThrowMessage(((NetworkBehaviour)((EntityState)this).characterBody).netId, action, ((Ray)(ref aimRay)).origin, ((Ray)(ref aimRay)).direction), (NetworkDestination)2);
			}
		}

		private void StopChargeSound()
		{
			if (chargeSoundId != 0)
			{
				AkSoundEngine.StopPlayingID(chargeSoundId);
				chargeSoundId = 0u;
			}
		}

		public override void OnExit()
		{
			StopChargeSound();
			if (((EntityState)this).isAuthority && !released)
			{
				Release();
			}
			SilverAnimator.Find(((EntityState)this).GetModelTransform())?.ThrowRelease();
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class SilverBoost : Boost
	{
		private const float boostChangeCooldown = 0.4f;

		private float boostChangeCooldownTimer;

		private bool boostChangeEffect;

		protected override BuffDef buff => Buffs.boostBuff;

		protected override float boostMeterDrain
		{
			get
			{
				float num = ((Boost)this).boostMeterDrain;
				if (num > 0f && Object.op_Implicit((Object)(object)base.boostLogic))
				{
					num = base.boostLogic.boostRegen + 15f;
				}
				return num;
			}
		}

		public override void OnEnter()
		{
			((Boost)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
			if (base.airBoosting)
			{
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			}
		}

		public override void FixedUpdate()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			((Boost)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((BaseCharacterMain)this).hasCharacterMotor && !((BaseState)this).isGrounded && !((EntityState)this).characterMotor.isFlying)
			{
				((EntityState)this).characterMotor.velocity.y -= Physics.gravity.y * 0.6f * Time.fixedDeltaTime;
			}
			if (boostChangeCooldownTimer > 0f)
			{
				boostChangeCooldownTimer -= Time.fixedDeltaTime;
			}
			if (boostChangeCooldownTimer <= 0f && (((PowerBoostLogic)(object)base.boostLogic).powerBoosting ^ PowerBoostLogic.ShouldPowerBoost(((EntityState)this).healthComponent)))
			{
				((Boost)this).RemoveBoostVFX();
				boostChangeEffect = true;
				((Boost)this).CreateBoostVFX();
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			((Boost)this).OnExit();
		}

		public override void PlayBoostAnimation()
		{
		}

		public override void PlayAirBoostAnimation()
		{
		}

		protected override void CreateBoostVFX()
		{
			((PowerBoostLogic)(object)base.boostLogic).UpdatePowerBoosting();
			((Boost)this).CreateBoostVFX();
			boostChangeCooldownTimer = 0.4f;
			boostChangeEffect = false;
		}

		public override Material GetOverlayMaterial()
		{
			if (SuperSilver.IsSuper(((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)Assets.SuperBoostOverlay))
			{
				return Assets.SuperBoostOverlay;
			}
			if (((PowerBoostLogic)(object)base.boostLogic).powerBoosting)
			{
				if (!Object.op_Implicit((Object)(object)Assets.PowerBoostOverlay))
				{
					return ((Boost)this).GetOverlayMaterial();
				}
				return Assets.PowerBoostOverlay;
			}
			return null;
		}

		public override GameObject GetAuraPrefab()
		{
			if (SuperSilver.IsSuper(((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)Assets.superBoostAuraEffect))
			{
				return Assets.superBoostAuraEffect;
			}
			if (((PowerBoostLogic)(object)base.boostLogic).powerBoosting)
			{
				return Assets.powerBoostAuraEffect;
			}
			return Assets.boostAuraEffect;
		}

		public override GameObject GetFlashPrefab()
		{
			if (SuperSilver.IsSuper(((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)Assets.superBoostFlashEffect))
			{
				return Assets.superBoostFlashEffect;
			}
			if (((PowerBoostLogic)(object)base.boostLogic).powerBoosting)
			{
				return Assets.powerBoostFlashEffect;
			}
			return Assets.boostFlashEffect;
		}

		public override string GetSoundString()
		{
			if (boostChangeEffect)
			{
				return "Play_silver_psych_ting";
			}
			return "Play_silver_psych_boost";
		}
	}
	public class SilverBrake : Brake
	{
		public override void OnEnter()
		{
			((Brake)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
			Util.PlaySound("Play_hedgehogutils_brake", ((EntityState)this).gameObject);
		}

		public override void PlayAnimation(float duration, bool reverse)
		{
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			((EntityState)this).OnExit();
		}
	}
	public class SilverDeath : Death
	{
		private float fallSpeed;

		private float airHold;

		private const float groundExtra = 1.5f;

		private float groundHold;

		private const float legacyExtra = 0.79f;

		private float legacyHold;

		public override void OnEnter()
		{
			((Death)this).OnEnter();
			Util.PlaySound("Play_silver_dead", ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				fallSpeed = Mathf.Min(0f, ((EntityState)this).characterMotor.velocity.y);
			}
		}

		public override void PlayDeathAnimation(float crossfadeDuration = 0.1f)
		{
		}

		public override void FixedUpdate()
		{
			//IL_00df: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			if (airHold < 4f && !SilverAnimator.IsGroundedForDeath(((EntityState)this).characterBody))
			{
				airHold += Time.fixedDeltaTime;
				((EntityState)this).fixedAge = ((EntityState)this).fixedAge - Time.fixedDeltaTime;
			}
			else if (groundHold < 1.5f)
			{
				groundHold += Time.fixedDeltaTime;
				((EntityState)this).fixedAge = ((EntityState)this).fixedAge - Time.fixedDeltaTime;
			}
			else if (legacyHold < 0.79f)
			{
				legacyHold += Time.fixedDeltaTime;
				((EntityState)this).fixedAge = ((EntityState)this).fixedAge - Time.fixedDeltaTime;
			}
			((Death)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).isAuthority)
			{
				if (((EntityState)this).characterMotor.isGrounded)
				{
					fallSpeed = 0f;
					return;
				}
				fallSpeed = Mathf.Max(fallSpeed + Physics.gravity.y * Time.fixedDeltaTime, -40f);
				((EntityState)this).characterMotor.velocity = new Vector3(0f, fallSpeed, 0f);
			}
		}
	}
	public class SilverMainState : GenericCharacterMain
	{
		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			((GenericCharacterMain)this).OnExit();
		}
	}
	public static class SkillAirStop
	{
		public static void Apply(BaseState state, Vector3 startVelocity, float age, float easeTime = 0.35f, float keepMoveFraction = 0.15f)
		{
			//IL_002e: 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_0045: 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_004a: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			CharacterMotor characterMotor = ((EntityState)state).characterMotor;
			if (Object.op_Implicit((Object)(object)characterMotor))
			{
				Vector3 val = (Object.op_Implicit((Object)(object)((EntityState)state).inputBank) ? (((Vector3)(ref ((EntityState)state).inputBank.moveVector)).normalized * ((EntityState)state).characterBody.moveSpeed * keepMoveFraction) : Vector3.zero);
				val.y = -0.5f;
				characterMotor.velocity = Vector3.Lerp(startVelocity, val, Mathf.Clamp01(age / easeTime));
			}
		}

		public static void FaceAim(BaseState state)
		{
			//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_004b: Unknown result type (might be due to invalid IL or missing references)
			CharacterDirection characterDirection = ((EntityState)state).characterDirection;
			InputBankTest inputBank = ((EntityState)state).inputBank;
			if (((EntityState)state).isAuthority && Object.op_Implicit((Object)(object)characterDirection) && Object.op_Implicit((Object)(object)inputBank))
			{
				Vector3 aimDirection = inputBank.aimDirection;
				aimDirection.y = 0f;
				if (((Vector3)(ref aimDirection)).sqrMagnitude > 0.01f)
				{
					characterDirection.forward = ((Vector3)(ref aimDirection)).normalized;
				}
			}
		}
	}
}
namespace SilverTheHedgehog.Modules
{
	public static class Assets
	{
		public static GameObject boostAuraEffect;

		public static GameObject powerBoostHud;

		private static Texture2D boostRamp;

		private static Texture2D powerRamp;

		public static GameObject powerBoostFlashEffect;

		public static GameObject boostFlashEffect;

		public static GameObject powerBoostAuraEffect;

		public static GameObject superBoostFlashEffect;

		public static GameObject superBoostAuraEffect;

		private static Material superBoostOverlay;

		private static Texture2D superRamp;

		public static GameObject homingIndicatorPrefab;

		private static Material powerBoostOverlay;

		private static Material psychicPaleOutline;

		private static Material psychicStrongOutline;

		private static Material psychicNextOutline;

		private static Material psychicGlowOverlay;

		private static Material strongOutlineGold;

		private static Material nextOutlineGold;

		private static Material paleOutlineGold;

		private static Material glowOverlayGold;

		private static Texture2D SuperRamp
		{
			get
			{
				//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_0043: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)superRamp))
				{
					superRamp = BoostRamp("SilverSuperBoost", new Color(0.55f, 0.3f, 0f, 1f), SilverColors.goldPsychic, new Color(1f, 0.97f, 0.75f, 1f));
				}
				return superRamp;
			}
		}

		public static Material SuperBoostOverlay
		{
			get
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)superBoostOverlay))
				{
					Material val = LegacyResourcesAPI.Load<Material>("Materials/matOnHelfire");
					if (Object.op_Implicit((Object)(object)val))
					{
						superBoostOverlay = RecolorMaterial(val, SilverColors.goldPsychic, SuperRamp);
						((Object)superBoostOverlay).name = "matSilverSuperBoostOverlay";
					}
				}
				return superBoostOverlay;
			}
		}

		public static Texture2D BoostRampTex
		{
			get
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)boostRamp))
				{
					boostRamp = BoostRamp("SilverBoost", SilverColors.boostDark, SilverColors.boost, SilverColors.boostCore);
				}
				return boostRamp;
			}
		}

		public static Texture2D PowerRamp
		{
			get
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)powerRamp))
				{
					powerRamp = BoostRamp("SilverPowerBoost", SilverColors.powerBoostDark, SilverColors.powerBoost, SilverColors.powerBoostCore);
				}
				return powerRamp;
			}
		}

		public static Material PowerBoostOverlay
		{
			get
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)powerBoostOverlay))
				{
					Material val = LegacyResourcesAPI.Load<Material>("Materials/matOnHelfire");
					if (Object.op_Implicit((Object)(object)val))
					{
						powerBoostOverlay = RecolorMaterial(val, SilverColors.boost, BoostRampTex);
					}
				}
				return powerBoostOverlay;
			}
		}

		public static Material PsychicNextOutline
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)psychicNextOutline))
				{
					psychicNextOutline = BuildNextOutline();
				}
				return psychicNextOutline;
			}
		}

		public static Material PsychicPaleOutline
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)psychicPaleOutline))
				{
					psychicPaleOutline = BuildPaleOutline();
				}
				return psychicPaleOutline;
			}
		}

		public static Material PsychicGlowOverlay
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)psychicGlowOverlay))
				{
					psychicGlowOverlay = BuildGlowOverlay();
				}
				return psychicGlowOverlay;
			}
		}

		public static Material PsychicStrongOutline
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)psychicStrongOutline))
				{
					psychicStrongOutline = BuildStrongOutline();
				}
				return psychicStrongOutline;
			}
		}

		private static string PaletteName
		{
			get
			{
				if (!SilverColors.gold)
				{
					return "";
				}
				return "Gold";
			}
		}

		private static Material BuildStrongOutline()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Assets.superFormOverlay))
			{
				return null;
			}
			Material obj = RecolorMaterial(Assets.superFormOverlay, SilverColors.psychic, BoostRamp("SilverPsychic" + PaletteName, SilverColors.psychicDark, SilverColors.psychic, SilverColors.psychicCore));
			((Object)obj).name = "matSilverPsychicOutline" + PaletteName;
			return obj;
		}

		private static Material BuildNextOutline()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Assets.superFormOverlay))
			{
				return null;
			}
			Material obj = RecolorMaterial(Assets.superFormOverlay, SilverColors.psychicNext, BoostRamp("SilverPsychicNext" + PaletteName, SilverColors.psychicNextDark, SilverColors.psychicNext, SilverColors.psychicCore));
			((Object)obj).name = "matSilverPsychicNextOutline" + PaletteName;
			return obj;
		}

		private static Material BuildPaleOutline()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Assets.superFormOverlay))
			{
				return null;
			}
			Material obj = RecolorMaterial(Assets.superFormOverlay, SilverColors.psychicPale, BoostRamp("SilverPsychicPale" + PaletteName, SilverColors.psychicPaleDark, SilverColors.psychicPale, SilverColors.psychicCore));
			((Object)obj).name = "matSilverPsychicPaleOutline" + PaletteName;
			return obj;
		}

		private static Material BuildGlowOverlay()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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)
			if (BurnEffectController.normalEffect == null || !Object.op_Implicit((Object)(object)BurnEffectController.normalEffect.overlayMaterial))
			{
				return null;
			}
			Texture2D ramp = BoostRamp("SilverPsychicGlow" + PaletteName, SilverColors.psychicDark, SilverColors.psychic, SilverColors.psychicCore);
			Material obj = RecolorMaterial(BurnEffectController.normalEffect.overlayMaterial, SilverColors.psychic, ramp);
			((Object)obj).name = "matSilverPsychicGlow" + PaletteName;
			return obj;
		}

		private static Material Gold(ref Material cache, Func<Material> build)
		{
			if (!Object.op_Implicit((Object)(object)cache))
			{
				bool gold = SilverColors.gold;
				SilverColors.gold = true;
				try
				{
					cache = build();
				}
				finally
				{
					SilverColors.gold = gold;
				}
			}
			return cache;
		}

		public static Material PsychicStrongOutlineFor(CharacterBody body)
		{
			if (!SuperSilver.IsSuper(body))
			{
				return PsychicStrongOutline;
			}
			return Gold(ref strongOutlineGold, BuildStrongOutline);
		}

		public static Material PsychicNextOutlineFor(CharacterBody body)
		{
			if (!SuperSilver.IsSuper(body))
			{
				return PsychicNextOutline;
			}
			return Gold(ref nextOutlineGold, BuildNextOutline);
		}

		public static Material PsychicPaleOutlineFor(CharacterBody body)
		{
			if (!SuperSilver.IsSuper(body))
			{
				return PsychicPaleOutline;
			}
			return Gold(ref paleOutlineGold, BuildPaleOutline);
		}

		public static Material PsychicGlowOverlayFor(CharacterBody body)
		{
			if (!SuperSilver.IsSuper(body))
			{
				return PsychicGlowOverlay;
			}
			return Gold(ref glowOverlayGold, BuildGlowOverlay);
		}

		public static Texture2D BoostRamp(string name, Color dark, Color main, Color core)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_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)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 8, (TextureFormat)4, false);
			((Object)val).name = "texRamp" + name;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			for (int i = 0; i < 256; i++)
			{
				float num = (float)i / 255f;
				Color val2 = ((!(num < 0.15f)) ? ((num < 0.6f) ? Color.Lerp(dark, main, (num - 0.15f) / 0.45f) : Color.Lerp(main, core, (num - 0.6f) / 0.4f)) : Color.Lerp(Color.black, dark, num / 0.15f));
				val2.a = Mathf.Clamp01(num * 1.6f);
				for (int j = 0; j < 8; j++)
				{
					val.SetPixel(i, j, val2);
				}
			}
			val.Apply();
			return val;
		}

		internal static void Initialize()
		{
			LoadSoundbank();
			LoadTimer.Mark("sound banks");
			PopulateAssets();
		}

		internal static void LoadSoundbank()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SilverTheHedgehog.SilverBank.bnk");
			if (stream != null)
			{
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				SoundBanks.Add(array);
			}
		}

		internal static void PopulateAssets()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			SilverModel.Init();
			powerBoostFlashEffect = Assets.CreateBoostFlashEffect("SilverPowerBoostFlash", (Texture)(object)PowerRamp, Color.white, SilverColors.powerBoost, true, 1f);
			powerBoostAuraEffect = Assets.CreateBoostAuraEffect("SilverPowerBoostAura", (Texture)(object)PowerRamp, Color.white, SilverColors.powerBoost, SilverColors.powerBoost, 1f);
			superBoostFlashEffect = Assets.CreateBoostFlashEffect("SilverSuperBoostFlash", (Texture)(object)SuperRamp, Color.white, SilverColors.goldPsychic, true, 1.1f);
			superBoostAuraEffect = Assets.CreateBoostAuraEffect("SilverSuperBoostAura", (Texture)(object)SuperRamp, Color.white, SilverColors.goldPsychic, SilverColors.goldPsychic, 1.1f);
			try
			{
				GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/HuntressTrackingIndicator");
				if (Object.op_Implicit((Object)(object)val))
				{
					homingIndicatorPrefab = PrefabAPI.InstantiateClone(val, "SilverHomingIndicator", false);
					SpriteRenderer[] componentsInChildren = homingIndicatorPrefab.GetComponentsInChildren<SpriteRenderer>(true);
					foreach (SpriteRenderer val2 in componentsInChildren)
					{
						val2.color = new Color(SilverColors.boost.r, SilverColors.boost.g, SilverColors.boost.b, val2.color.a);
					}
					Renderer[] componentsInChildren2 = homingIndicatorPrefab.GetComponentsInChildren<Renderer>(true);
					foreach (Renderer val3 in componentsInChildren2)
					{
						if (val3 is SpriteRenderer)
						{
							continue;
						}
						Material[] sharedMaterials = val3.sharedMaterials;
						for (int j = 0; j < sharedMaterials.Length; j++)
						{
							if (Object.op_Implicit((Object)(object)sharedMaterials[j]))
							{
								Material val4 = new Material(sharedMaterials[j]);
								if (val4.HasProperty("_TintColor"))
								{
									val4.SetColor("_TintColor", SilverColors.boost);
								}
								if (val4.HasProperty("_Color"))
								{
									val4.SetColor("_Color", SilverColors.boost);
								}
								sharedMaterials[j] = val4;
							}
						}
						val3.sharedMaterials = sharedMaterials;
					}
				}
			}
			catch (Exception ex)
			{
				Log.Error("Failed to create the homing reticle: " + ex);
			}
			boostFlashEffect = Assets.CreateBoostFlashEffect("SilverBoostFlash", (Texture)null, new Color(0.07f, 0.07f, 0.07f), Color.black, false, 0.9f);
			boostAuraEffect = Assets.CreateBoostAuraEffect("SilverBoostAura", (Texture)null, new Color(0.07f, 0.07f, 0.07f), Color.black, Color.black, 0.9f);
			try
			{
				powerBoostHud = CreatePowerParticles();
			}
			catch (Exception ex2)
			{
				Log.Error("[Silver] power boost HUD: " + ex2);
			}
		}

		private static GameObject CreatePowerParticles()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_001c: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: 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_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("SilverPowerParticles");
			GameObject val2 = PrefabAPI.InstantiateClone(val, "SilverPowerParticles", false);
			Object.DestroyImmediate((Object)val);
			RectTransform obj = val2.AddComponent<RectTransform>();
			obj.anchorMin = Vector2.zero;
			obj.anchorMax = Vector2.one;
			obj.sizeDelta = Vector2.zero;
			ParticleSystem val3 = val2.AddComponent<ParticleSystem>();
			val3.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val3.main;
			((MainModule)(ref main)).duration = 1f;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.2f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.7f);
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(SilverColors.boost);
			((MainModule)(ref main)).maxParticles = 10;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0;
			EmissionModule emission = val3.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(20f);
			ShapeModule shape = val3.shape;
			((ShapeModule)(ref shape)).enabled = false;
			SizeOverLifetimeModule sizeOverLifetime = val3.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0.55f, 1f, 1f));
			ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val4 = new Gradient();
			val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[5]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(0.64f, 0.02f),
				new GradientAlphaKey(1f, 0.17f),
				new GradientAlphaKey(1f, 0.74f),
				new GradientAlphaKey(0.69f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val4);
			RotationOverLifetimeModule rotationOverLifetime = val3.rotationOverLifetime;
			((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
			((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(-2.618f, 2.618f);
			ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)0;
			component.maxParticleSize = 1f;
			Material val5 = SilverVfx.FindGlowMaterial();
			if (Object.op_Implicit((Object)(object)val5))
			{
				((Renderer)component).sharedMaterial = SilverVfx.Tinted(val5, SilverColors.boost, SilverVfx.Ramp(SilverColors.boost, Color.white), CreateSwirlTexture());
			}
			val2.AddComponent<PowerBoostHUD>();
			return val2;
		}

		private static Texture2D CreateSwirlTexture()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//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)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, true);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Color[] array = (Color[])(object)new Color[16384];
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					float num = ((float)j + 0.5f) / 128f * 2f - 1f;
					float num2 = ((float)i + 0.5f) / 128f * 2f - 1f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					float num4 = (Mathf.Atan2(num2, num) + MathF.PI) / (MathF.PI * 2f);
					float num5 = Mathf.Clamp01(1f - Mathf.Abs(num3 - 0.72f) / 0.16f);
					float num6 = num5 * num5 * Mathf.Pow(num4, 1.5f);
					array[i * 128 + j] = new Color(1f, 1f, 1f, num6);
				}
			}
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		public static Texture2D CreateRamp(Color[] keys)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0038: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 8, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			for (int i = 0; i < 256; i++)
			{
				float num = (float)i / 255f * (float)(keys.Length - 1);
				int num2 = Mathf.Min((int)num, keys.Length - 2);
				Color val2 = Color.Lerp(keys[num2], keys[num2 + 1], num - (float)num2);
				for (int j = 0; j < 8; j++)
				{
					val.SetPixel(i, j, val2);
				}
			}
			val.Apply();
			return val;
		}

		public static void RecolorEffect(GameObject effect, Color color, Texture2D ramp)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] componentsInChildren = effect.GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem obj in componentsInChildren)
			{
				MainModule main = obj.main;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
				ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime;
				if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
				{
					((ColorOverLifetimeModule)(ref colorOverLifetime)).color = RedGradientKeepingAlpha(((ColorOverLifetimeModule)(ref colorOverLifetime)).color);
				}
			}
			Renderer[] componentsInChildren2 = effect.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren2)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				for (int j = 0; j < sharedMaterials.Length; j++)
				{
					if (Object.op_Implicit((Object)(object)sharedMaterials[j]))
					{
						sharedMaterials[j] = RecolorMaterial(sharedMaterials[j], color, ramp);
					}
				}
				val.sharedMaterials = sharedMaterials;
			}
			Light[] componentsInChildren3 = effect.GetComponentsInChildren<Light>(true);
			for (int k = 0; k < componentsInChildren3.Length; k++)
			{
				componentsInChildren3[k].color = color;
			}
		}

		private static MinMaxGradient RedGradientKeepingAlpha(MinMaxGradient source)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected I4, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_009a: Expected O, but got Unknown
			//IL_00a3: 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_00b2: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystemGradientMode mode = ((MinMaxGradient)(ref source)).mode;
			GradientAlphaKey[] array;
			switch (mode - 1)
			{
			case 0:
			case 3:
				array = ((((MinMaxGradient)(ref source)).gradient != null) ? ((MinMaxGradient)(ref source)).gradient.alphaKeys : null);
				break;
			case 2:
				array = ((((MinMaxGradient)(ref source)).gradientMax != null) ? ((MinMaxGradient)(ref source)).gradientMax.alphaKeys : null);
				break;
			default:
				array = null;
				break;
			}
			if (array == null || array.Length == 0)
			{
				array = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(1f, 1f)
				};
			}
			Gradient val = new Gradient();
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, array);
			return new MinMaxGradient(val);
		}

		public static Material RecolorMaterial(Material original, Color color, Texture2D ramp)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001a: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(original);
			if (val.HasProperty("_TintColor"))
			{
				val.SetColor("_TintColor", color);
			}
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", color);
			}
			if (val.HasProperty("_EmColor"))
			{
				val.SetColor("_EmColor", color);
			}
			if (val.HasProperty("_RemapTex"))
			{
				val.SetTexture("_RemapTex", (Texture)(object)ramp);
			}
			return val;
		}

		public static GameObject MaterialSwap(GameObject prefab, string assetPath, string pathToParticle = "")
		{
			//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)
			Transform val = prefab.transform.Find(pathToParticle);
			if (Object.op_Implicit((Object)(object)val))
			{
				((Renderer)((Component)val).GetComponent<ParticleSystemRenderer>()).sharedMaterial = Addressables.LoadAssetAsync<Material>((object)assetPath).WaitForCompletion();
			}
			return prefab;
		}

		public static GameObject MaterialSwap(GameObject prefab, Material material, string pathToParticle = "")
		{
			Transform val = prefab.transform.Find(pathToParticle);
			if (Object.op_Implicit((Object)(object)val))
			{
				((Renderer)((Component)val).GetComponent<ParticleSystemRenderer>()).sharedMaterial = material;
			}
			return prefab;
		}

		private static GameObject CreateTracer(string originalTracerName, string newTracerName)
		{
			if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null)
			{
				return null;
			}
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>()))
			{
				val.AddComponent<EffectComponent>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>()))
			{
				val.AddComponent<VFXAttributes>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
			{
				val.AddComponent<NetworkIdentity>();
			}
			val.GetComponent<Tracer>().speed = 250f;
			val.GetComponent<Tracer>().length = 50f;
			AddNewEffectDef(val);
			return val;
		}

		internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
		{
			NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			obj.akId = AkSoundEngine.GetIDFromString(eventName);
			obj.eventName = eventName;
			Content.AddNetworkSoundEventDef(obj);
			return obj;
		}

		internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
		{
			if (!Object.op_Implicit((Object)(object)objectToConvert))
			{
				return;
			}
			Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>();
			foreach (Renderer obj in componentsInChildren)
			{
				if (obj != null)
				{
					obj.material?.SetHopooMaterial();
				}
			}
		}

		internal static RendererInfo[] SetupRendererInfos(GameObject obj)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				array[i] = new RendererInfo
				{
					defaultMaterial = ((Renderer)componentsInChildren[i]).material,
					renderer = (Renderer)(object)componentsInChildren[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}

		public static GameObject LoadSurvivorModel(string modelName, string cloneName = null)
		{
			return SilverModel.BuildModel(cloneName ?? modelName, modelName.EndsWith("Display"));
		}

		internal static GameObject LoadCrosshair(string crosshairName)
		{
			if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null)
			{
				return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
			}
			return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair");
		}

		private static void AddNewEffectDef(GameObject effectPrefab)
		{
			AddNewEffectDef(effectPrefab, "");
		}

		internal static void RegisterEffect(GameObject effectPrefab)
		{
			AddNewEffectDef(effectPrefab, "");
		}

		private static void AddNewEffectDef(GameObject effectPrefab, string soundName)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_003c: Expected O, but got Unknown
			Content.AddEffectDef(new EffectDef
			{
				prefab = effectPrefab,
				prefabEffectComponent = effectPrefab.GetComponent<EffectComponent>(),