Decompiled source of ValheimRiftMagic v1.3.0

ValheimRiftMagic.dll

Decompiled 14 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using RiftMagic.Companion;
using RiftMagic.Config;
using RiftMagic.Creatures;
using RiftMagic.Effects;
using RiftMagic.Harvest;
using RiftMagic.Items;
using RiftMagic.Net;
using RiftMagic.Spells;
using RiftMagic.Visuals;
using Splatform;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("ValheimRiftMagic")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f43490334644ec73b0ddfb9818e0bc00a7931212")]
[assembly: AssemblyProduct("ValheimRiftMagic")]
[assembly: AssemblyTitle("ValheimRiftMagic")]
[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 RiftMagic
{
	[BepInPlugin("tmana.riftmagic", "Rift Magic", "1.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class RiftMagicPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "tmana.riftmagic";

		public const string PluginName = "Rift Magic";

		public const string PluginVersion = "1.3.0";

		private Harmony _harmony;

		private const float BarWidthFraction = 0.18f;

		private const float BarHeightPixels = 14f;

		private const float BarBottomFraction = 0.26f;

		private static GUIStyle _labelStyle;

		private static Texture2D _fillTex;

		private static Texture2D _backTex;

		private void Awake()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			RiftConfig.Bind(((BaseUnityPlugin)this).Config);
			((BaseUnityPlugin)this).Config.SettingChanged += delegate
			{
				StaffFactory.ApplyConfig();
				GnarledStaffFactory.ApplyConfig();
			};
			RiftNetwork.Register();
			CompanionCommands.Register();
			AddLocalization();
			RiftSkills.Register();
			EffectRegistry.Register();
			PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable;
			CreatureManager.OnVanillaCreaturesAvailable += OnVanillaCreaturesAvailable;
			_harmony = new Harmony("tmana.riftmagic");
			int num = 0;
			Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(typeof(RiftMagicPlugin).Assembly);
			foreach (Type type in typesFromAssembly)
			{
				try
				{
					_harmony.CreateClassProcessor(type).Patch();
				}
				catch (Exception ex)
				{
					num++;
					Logger.LogError((object)("Patch " + type.FullName + " failed, the rest still apply: " + ex.Message));
				}
			}
			Logger.LogInfo((object)("Rift Magic 1.3.0 loaded" + ((num > 0) ? $" ({num} patch(es) failed, see above)." : ".")));
		}

		private void OnVanillaCreaturesAvailable()
		{
			CreatureManager.OnVanillaCreaturesAvailable -= OnVanillaCreaturesAvailable;
			try
			{
				Riftling.Register();
			}
			catch (Exception arg)
			{
				Logger.LogError((object)$"Failed to register the Riftling: {arg}");
			}
		}

		private void OnVanillaPrefabsAvailable()
		{
			PrefabManager.OnVanillaPrefabsAvailable -= OnVanillaPrefabsAvailable;
			try
			{
				RiftAnchorMarker.RegisterPrefab();
			}
			catch (Exception arg)
			{
				Logger.LogError((object)$"Failed to register the rift anchor marker: {arg}");
			}
			try
			{
				RiftCoreItem.EnsureRegistered();
			}
			catch (Exception arg2)
			{
				Logger.LogError((object)$"Failed to register the Rift Core: {arg2}");
			}
			try
			{
				StaffFactory.Register();
			}
			catch (Exception arg3)
			{
				Logger.LogError((object)$"Failed to register the Riftwalker's Staff: {arg3}");
			}
			try
			{
				GnarledStaffFactory.Register();
			}
			catch (Exception arg4)
			{
				Logger.LogError((object)$"Failed to register the Staff of the Gnarled Root: {arg4}");
			}
			try
			{
				SerpentPearlItem.Register();
			}
			catch (Exception arg5)
			{
				Logger.LogError((object)$"Failed to register the Serpent's Pearl: {arg5}");
			}
			try
			{
				SaddleFactory.Register();
			}
			catch (Exception arg6)
			{
				Logger.LogError((object)$"Failed to register the Rift Saddle: {arg6}");
			}
			try
			{
				RiftTether.Register();
			}
			catch (Exception arg7)
			{
				Logger.LogError((object)$"Failed to register the Rift Tether: {arg7}");
			}
			EffectRegistry.BorrowIcon();
		}

		private void Update()
		{
			RiftChannel.Tick();
			SaddleUnlocks.Tick();
			RiftAnchorMarker.Tick();
			RiftCastSigil.TickRemotes();
			RiftDelivery.Tick();
			CompanionRiding.RiderTick();
			CompanionFollow.Tick(Time.deltaTime);
			MountedCombat.Tick();
			CompanionPins.Tick();
			RiftMastery.Tick();
			SerpentFightHud.Tick(Time.deltaTime);
		}

		private void OnGUI()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			SerpentFightHud.Draw();
			if (RiftChannel.Active && !Hud.IsUserHidden())
			{
				EnsureStyles();
				float num = (float)Screen.width * 0.18f;
				float num2 = ((float)Screen.width - num) * 0.5f;
				float num3 = (float)Screen.height * 0.74f;
				float progress = RiftChannel.Progress;
				GUI.DrawTexture(new Rect(num2, num3, num, 14f), (Texture)(object)_backTex);
				GUI.DrawTexture(new Rect(num2, num3, num * progress, 14f), (Texture)(object)_fillTex);
				GUI.Label(new Rect(num2, num3 - 22f, num, 20f), RiftChannel.Label, _labelStyle);
			}
		}

		private static void EnsureStyles()
		{
			//IL_0036: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_fillTex != (Object)null) || !((Object)(object)_backTex != (Object)null) || _labelStyle == null)
			{
				_fillTex = SolidTexture(new Color(0.62f, 0.35f, 0.95f, 0.95f));
				_backTex = SolidTexture(new Color(0f, 0f, 0f, 0.55f));
				_labelStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontStyle = (FontStyle)1
				};
				_labelStyle.normal.textColor = new Color(0.85f, 0.75f, 1f);
			}
		}

		private static Texture2D SolidTexture(Color color)
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, color);
			val.Apply();
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			RiftCastSigil.Reset();
			RiftDelivery.Reset();
		}

		private static void AddLocalization()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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_014a: 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_0174: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: 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_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: 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_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_071d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0732: Unknown result type (might be due to invalid IL or missing references)
			//IL_0747: Unknown result type (might be due to invalid IL or missing references)
			//IL_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0771: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07da: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0804: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_082e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0843: Unknown result type (might be due to invalid IL or missing references)
			//IL_0858: Unknown result type (might be due to invalid IL or missing references)
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_0897: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0900: Unknown result type (might be due to invalid IL or missing references)
			//IL_0915: Unknown result type (might be due to invalid IL or missing references)
			//IL_092a: Unknown result type (might be due to invalid IL or missing references)
			//IL_093f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0954: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_097e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0993: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ad: Expected O, but got Unknown
			LocalizationManager.Instance.AddLocalization(new LocalizationConfig("English")
			{
				Translations = { { "riftmagic_skill_name", "Rift Magic" } },
				Translations = { { "riftmagic_skill_desc", "Bending distance. Raises the reach and reliability of blinks and rifts." } },
				Translations = { { "riftmagic_item_riftwalker", "Riftwalker's Staff" } },
				Translations = { { "riftmagic_item_riftwalker_desc", "Primary folds the space ahead of you and steps through it, throwing aside anything caught in the fold.\nHold secondary to plant a rift anchor, or to unmake a cube of the world and deliver everything it was worth to the anchor you already planted. Consumes Surtling Cores.\nHold both to clear the anchor. Bosses are too heavy to move." } },
				Translations = { { "riftmagic_hud_anchor", "Planting rift anchor" } },
				Translations = { { "riftmagic_hud_rift", "Opening rift" } },
				Translations = { { "riftmagic_hud_cancel", "Clearing rift anchor" } },
				Translations = { { "riftmagic_msg_blinkblocked", "No room to step." } },
				Translations = { { "riftmagic_msg_anchorset", "Rift anchor set:" } },
				Translations = { { "riftmagic_msg_anchorcleared", "Rift anchor cleared." } },
				Translations = { { "riftmagic_msg_nocores", "Not enough Surtling Cores. Need:" } },
				Translations = { { "riftmagic_msg_noeitr", "Not enough Eitr to open the rift." } },
				Translations = { { "riftmagic_msg_interrupted", "The rift collapsed." } },
				Translations = { { "riftmagic_msg_nothing", "Nothing in the rift worth taking." } },
				Translations = { { "riftmagic_msg_failed", "The rift tore open wrong and closed." } },
				Translations = { { "riftmagic_msg_sent", "Sent through the rift:" } },
				Translations = { { "riftmagic_item_gnarledroot", "Staff of the Gnarled Root" } },
				Translations = { { "riftmagic_item_gnarledroot_desc", "Primary spits a bolt of rot. Where it lands, foes take root-poison and allies are knit back together.\nSecondary calls up a shaman's cloud that does the same, over and over, for as long as it hangs in the air." } },
				Translations = { { "riftmagic_se_regrowth", "Regrowth" } },
				Translations = { { "riftmagic_se_regrowth_tooltip", "Root-sap is closing your wounds. Heals over time." } },
				Translations = { { "riftmagic_item_riftsaddle", "Rift Saddle" } },
				Translations = { { "riftmagic_item_riftsaddle_desc", "The rift's own saddle, and it fits anything alive that has been tamed and named - a creature no other saddle was cut for included. It grows larger, its eyes burn with rift-light, and it hits harder, lasts longer and shrugs off more. It can be ridden, told to follow or stay, and fed like a person - health foods mend it, stamina foods carry you further, eitr foods make it fiercer and tougher. Travel, fight and eat together and the bond deepens into stars. If it falls, the rift catches it and carries it home to recover." } },
				Translations = { { "riftmagic_item_saddle_boar", "Bronzebound Rift Saddle" } },
				Translations = { { "riftmagic_item_saddle_boar_desc", "Deer hide and bronze over rift-stained leather, cut for a boar. Binds a tamed, named boar as a rift companion: larger, fiercer, rideable, and yours. Upgrade it and it carries more of the rift with it." } },
				Translations = { { "riftmagic_item_saddle_wolf", "Silverbound Rift Saddle" } },
				Translations = { { "riftmagic_item_saddle_wolf_desc", "Wolf pelt and mountain silver over rift-stained leather, cut for a wolf. Binds a tamed, named wolf as a rift companion." } },
				Translations = { { "riftmagic_item_saddle_lox", "Blackmetal Rift Saddle" } },
				Translations = { { "riftmagic_item_saddle_lox_desc", "Lox pelt, black metal and plains jute, cut for a lox. Binds a tamed, named lox as a rift companion." } },
				Translations = { { "riftmagic_item_saddle_asksvin", "Flameforged Rift Saddle" } },
				Translations = { { "riftmagic_item_saddle_asksvin_desc", "Ash-hide, flametal and charred bone, cut for an asksvin. Binds a tamed, named asksvin as a rift companion." } },
				Translations = { { "riftmagic_item_saddle_moose", "Auroral Rift Saddle" } },
				Translations = { { "riftmagic_item_saddle_serpent", "Tidebound Rift Saddle" } },
				Translations = { { "riftmagic_item_saddle_serpent_desc", "Serpent scale and chitin over rift-stained leather, cut for a serpent. Binds a tamed, named serpent as a rift companion." } },
				Translations = { { "riftmagic_tether_nowater", "There is no open water here for a serpent to come through." } },
				Translations = { { "riftmagic_item_saddle_moose_desc", "Moose hide and sinew bound with celestial feathers, cut for a moose. Binds a tamed, named moose as a rift companion." } },
				Translations = { { "riftmagic_saddle_wrongspecies", "That animal cannot wear this:" } },
				Translations = { { "riftmagic_saddle_learned", "You could cut a saddle for this animal now:" } },
				Translations = { { "riftmagic_pet_needtame", "Tame it first." } },
				Translations = { { "riftmagic_pet_needname", "Give it a name before binding it with a rift saddle." } },
				Translations = { { "riftmagic_pet_cannot", "This creature cannot bear a rift saddle." } },
				Translations = { { "riftmagic_pet_already", "already wears a rift saddle." } },
				Translations = { { "riftmagic_pet_removesaddle", "Take its saddle off first." } },
				Translations = { { "riftmagic_pet_bound", "is bound to you through the rift, and becomes" } },
				Translations = { { "riftmagic_pet_the", "the" } },
				Translations = { { "riftmagic_pet_command", "Follow / Stay" } },
				Translations = { { "riftmagic_pet_hold", "Hold" } },
				Translations = { { "riftmagic_pet_stance", "Stance" } },
				Translations = { { "riftmagic_pet_stance_now", "is now" } },
				Translations = { { "riftmagic_pet_aggressive", "Aggressive" } },
				Translations = { { "riftmagic_pet_defensive", "Defensive" } },
				Translations = { { "riftmagic_pet_health", "Health" } },
				Translations = { { "riftmagic_pet_resting", "Resting at home" } },
				Translations = { { "riftmagic_pet_attack", "Attack" } },
				Translations = { { "riftmagic_pet_riding", "Riding stamina" } },
				Translations = { { "riftmagic_pet_defense", "Defense" } },
				Translations = { { "riftmagic_pet_bond", "Bond" } },
				Translations = { { "riftmagic_pet_stars", "stars" } },
				Translations = { { "riftmagic_pet_tonext", "to the next" } },
				Translations = { { "riftmagic_pet_max", "- as close as can be" } },
				Translations = { { "riftmagic_pet_fed", "Fed" } },
				Translations = { { "riftmagic_pet_unfed", "Hungry - use food on it to feed it" } },
				Translations = { { "riftmagic_pet_ate", "ate" } },
				Translations = { { "riftmagic_pet_full", "is too full to eat" } },
				Translations = { { "riftmagic_pet_notyet", "isn't ready for more" } },
				Translations = { { "riftmagic_pet_rescued", "was caught by the rift and carried home to recover." } },
				Translations = { { "riftmagic_pet_recalled", "is pulled through the rift to your side." } },
				Translations = { { "riftmagic_pet_notyours", "answers only to" } },
				Translations = { { "riftmagic_pet_regen", "regen" } },
				Translations = { { "riftmagic_enemy_riftling", "Riftling" } },
				Translations = { { "riftmagic_item_riftcore", "Rift Core" } },
				Translations = { { "riftmagic_item_riftcore_desc", "A Surtling Core the rift got into: heavier, colder, and never quite still. What the rift's own things are made with. Taken from a Riftling, or forged from ten Surtling Cores at the Black Forge." } },
				Translations = { { "riftmagic_item_serpentpearl", "Serpent's Pearl" } },
				Translations = { { "riftmagic_item_serpentpearl_desc", "Cold as the deep, and heavier than it looks. Something vast swallowed this once. It would again." } },
				Translations = { { "riftmagic_serpent_hooked", "Something vast takes the pearl!" } },
				Translations = { { "riftmagic_serpent_thrash", "It thrashes! Let it run." } },
				Translations = { { "riftmagic_serpent_rest", "It slows. Reel it in!" } },
				Translations = { { "riftmagic_serpent_strain", "The line strains!" } },
				Translations = { { "riftmagic_serpent_bar_thrash", "Thrashing" } },
				Translations = { { "riftmagic_serpent_bar_rest", "Tiring" } },
				Translations = { { "riftmagic_serpent_bar_harpooned", "harpooned" } },
				Translations = { { "riftmagic_serpent_helm", "A hooked serpent has the ship - the helm will not answer!" } },
				Translations = { { "riftmagic_serpent_offboat", "Without a ship beneath you, the line tears from your hands." } },
				Translations = { { "riftmagic_pet_rested", "Rested" } },
				Translations = { { "riftmagic_serpent_offboat_warn", "Get back aboard - the line is slipping!" } },
				Translations = { { "riftmagic_serpent_pearlbroke", "The Serpent's Pearl shattered." } },
				Translations = { { "riftmagic_serpent_pearlback", "The Serpent's Pearl comes back on the line." } },
				Translations = { { "riftmagic_item_trophy_riftling", "Riftling trophy" } },
				Translations = { { "riftmagic_item_trophy_riftling_desc", "A Surtling the rift got into. It still flickers, as if about to be somewhere else." } },
				Translations = { { "riftmagic_mastery_blink", "Blink" } },
				Translations = { { "riftmagic_mastery_cast", "cast speed" } },
				Translations = { { "riftmagic_mastery_eitr", "Eitr" } },
				Translations = { { "riftmagic_mastery_blinkcost", "blink" } },
				Translations = { { "riftmagic_mastery_riftcost", "rift" } },
				Translations = { { "riftmagic_mastery_channel", "Rift channel" } },
				Translations = { { "riftmagic_item_tether", "Rift Tether" } },
				Translations = { { "riftmagic_item_tether_desc", "A bronze charm strung on a thread of the rift. Put it on and one of your rift companions is pulled through to your side, if it is well enough to come, and follows you; the others go home. Middle-click it in your inventory to choose which one answers." } },
				Translations = { { "riftmagic_tether_cooldown", "The Rift Tether has not recovered yet. Ready in" } },
				Translations = { { "riftmagic_tether_noground", "There is no ground here for a companion to land on." } },
				Translations = { { "riftmagic_tether_none", "You have no rift companion to call." } },
				Translations = { { "riftmagic_tether_nonekind", "You have no rift-bound" } },
				Translations = { { "riftmagic_tether_recovering", "is still recovering from the rift, and cannot come yet." } },
				Translations = { { "riftmagic_tether_hurt", "is too badly hurt to come through the rift:" } },
				Translations = { { "riftmagic_tether_now", "The Rift Tether now calls" } },
				Translations = { { "riftmagic_tether_your", "your" } },
				Translations = { { "riftmagic_tether_calls", "Calls" } },
				Translations = { { "riftmagic_tether_first", "your first rift companion" } },
				Translations = { { "riftmagic_tether_readyin", "Ready in" } },
				Translations = { { "riftmagic_tether_ready", "Ready" } },
				Translations = { { "riftmagic_tether_cycle", "Middle-click to choose which companion it calls" } },
				Translations = { { "riftmagic_pet_notyours_anyone", "answers only to the one it is bound to." } },
				Translations = { { "riftmagic_pet_boundto", "Bound to" } },
				Translations = { { "riftmagic_pet_senthome", "Only one rift companion follows you at a time. Sent home through the rift to wait for you:" } },
				Translations = { { "riftmagic_pet_haveone", "Only one of each kind of animal can be bound to you through the rift, and you already have" } },
				Translations = { { "riftmagic_pet_bond_grows", "The bond between you and your pet grows." } },
				Translations = { { "riftmagic_pet_loves_you", "loves you very much!" } },
				Translations = { { "riftmagic_notice_bossresisted", "Something in there was far too heavy to move." } },
				Translations = { { "riftmagic_notice_playerstripped", "You pulled the belongings of another soul through." } }
			});
		}
	}
}
namespace RiftMagic.Visuals
{
	internal class BlinkTrail : MonoBehaviour
	{
		private struct Streak
		{
			internal LineRenderer Line;

			internal Vector3 Tail;

			internal Vector3 Head;

			internal float Alpha;

			internal float Width;
		}

		private const int StreakCount = 9;

		private const float Lifetime = 0.45f;

		private const float MinRadius = 0.08f;

		private const float MaxRadius = 0.55f;

		private const float MinWidth = 0.018f;

		private const float MaxWidth = 0.045f;

		private static readonly Color StreakColor = new Color(0.78f, 0.52f, 1f);

		private static readonly AnimationCurve StreakShape = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
		{
			new Keyframe(0f, 0.15f),
			new Keyframe(0.6f, 1f),
			new Keyframe(1f, 0.35f)
		});

		private Streak[] _streaks;

		private Light _light;

		private float _lightIntensity;

		private float _age;

		internal static void Spawn(Vector3 from, Vector3 to)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			Vector3 val = to - from;
			if (!(((Vector3)(ref val)).sqrMagnitude < 0.25f))
			{
				Material material = GetMaterial();
				if (!((Object)(object)material == (Object)null))
				{
					GameObject val2 = new GameObject("RM_BlinkTrail");
					val2.transform.position = (from + to) * 0.5f;
					val2.AddComponent<BlinkTrail>().Build(from, to, material);
				}
			}
		}

		private void Build(Vector3 from, Vector3 to, Material material)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0103: 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_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_0116: 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_0130: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = to - from;
			float magnitude = ((Vector3)(ref val)).magnitude;
			Vector3 val2 = val / magnitude;
			Vector3 val3 = Vector3.Cross(val2, Vector3.up);
			if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f)
			{
				val3 = Vector3.Cross(val2, Vector3.right);
			}
			((Vector3)(ref val3)).Normalize();
			Vector3 val4 = Vector3.Cross(val3, val2);
			_streaks = new Streak[9];
			for (int i = 0; i < 9; i++)
			{
				float num = Random.value * (float)Math.PI * 2f;
				float num2 = Random.Range(0.08f, 0.55f);
				Vector3 val5 = (val3 * Mathf.Cos(num) + val4 * Mathf.Sin(num)) * num2;
				float num3 = Random.Range(0f, 0.25f);
				float num4 = Random.Range(0.75f, 1f);
				float num5 = Random.Range(0.55f, 1f);
				Vector3 tail = from + val * num3 + val5;
				Vector3 head = from + val * num4 + val5 * num5;
				_streaks[i] = new Streak
				{
					Line = MakeLine(i, material, tail, head),
					Tail = tail,
					Head = head,
					Alpha = Random.Range(0.55f, 1f),
					Width = Random.Range(0.018f, 0.045f)
				};
			}
			_light = ((Component)this).gameObject.AddComponent<Light>();
			_light.type = (LightType)2;
			_light.color = StreakColor;
			_light.range = Mathf.Clamp(magnitude * 0.6f, 2f, 8f);
			_light.shadows = (LightShadows)0;
			_lightIntensity = 1.4f;
			_light.intensity = _lightIntensity;
			Apply(0f);
		}

		private LineRenderer MakeLine(int index, Material material, Vector3 tail, Vector3 head)
		{
			//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_003d: 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)
			GameObject val = new GameObject("streak" + index);
			val.transform.SetParent(((Component)this).transform, false);
			LineRenderer obj = val.AddComponent<LineRenderer>();
			obj.useWorldSpace = true;
			obj.positionCount = 2;
			obj.SetPosition(0, tail);
			obj.SetPosition(1, head);
			((Renderer)obj).sharedMaterial = material;
			obj.textureMode = (LineTextureMode)0;
			obj.numCapVertices = 2;
			obj.widthCurve = StreakShape;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj).receiveShadows = false;
			return obj;
		}

		private void Update()
		{
			_age += Time.deltaTime;
			float num = _age / 0.45f;
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Apply(num);
			}
		}

		private void Apply(float t)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			float num = 1f - Mathf.SmoothStep(0f, 1f, t);
			Streak[] streaks = _streaks;
			for (int i = 0; i < streaks.Length; i++)
			{
				Streak streak = streaks[i];
				if (!((Object)(object)streak.Line == (Object)null))
				{
					streak.Line.SetPosition(0, Vector3.Lerp(streak.Tail, streak.Head, t * 0.85f));
					streak.Line.widthMultiplier = streak.Width * (1f - 0.5f * t);
					float num2 = streak.Alpha * num;
					streak.Line.startColor = new Color(StreakColor.r, StreakColor.g, StreakColor.b, num2 * 0.1f);
					streak.Line.endColor = new Color(StreakColor.r, StreakColor.g, StreakColor.b, num2);
				}
			}
			if ((Object)(object)_light != (Object)null)
			{
				_light.intensity = _lightIntensity * num;
			}
		}

		private static Material GetMaterial()
		{
			return GlowMaterials.Additive("Blink trail", (Texture)(object)GlowMaterials.SoftEdge());
		}
	}
	internal static class GlowMaterials
	{
		private static readonly string[] AdditiveShaders = new string[7] { "Legacy Shaders/Particles/Additive", "Particles/Additive", "Mobile/Particles/Additive", "Sprites/Default", "Particles/Standard Unlit", "Unlit/Transparent", "Legacy Shaders/Particles/Alpha Blended" };

		private static readonly string[] TransparentShaders = new string[4] { "Sprites/Default", "Particles/Standard Unlit", "Unlit/Transparent", "Legacy Shaders/Particles/Alpha Blended" };

		private static readonly Dictionary<string, Material> Cache = new Dictionary<string, Material>();

		private static Texture2D _white;

		private static Texture2D _softEdge;

		internal static Material Additive(string purpose, Texture texture)
		{
			return Build(purpose, texture, 3100, AdditiveShaders);
		}

		internal static Material Transparent(string purpose, Texture texture)
		{
			return Build(purpose, texture, 3000, TransparentShaders);
		}

		private static Material Build(string purpose, Texture texture, int queue, string[] shaders)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (Cache.TryGetValue(purpose, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Shader val = ShaderLookup.Find(purpose, shaders);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			Material val2 = new Material(val)
			{
				renderQueue = queue
			};
			if (val2.HasProperty("_MainTex"))
			{
				val2.SetTexture("_MainTex", texture);
			}
			if (val2.HasProperty("_TintColor"))
			{
				val2.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f));
			}
			if (val2.HasProperty("_Color"))
			{
				val2.SetColor("_Color", Color.white);
			}
			Cache[purpose] = val2;
			return val2;
		}

		internal static void SetAlpha(Material material, float alpha)
		{
			//IL_003b: 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)
			if (!((Object)(object)material == (Object)null))
			{
				alpha = Mathf.Clamp01(alpha);
				if (material.HasProperty("_TintColor"))
				{
					material.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f * alpha));
				}
				if (material.HasProperty("_Color"))
				{
					material.SetColor("_Color", new Color(1f, 1f, 1f, alpha));
				}
			}
		}

		internal static Texture2D White()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_white != (Object)null)
			{
				return _white;
			}
			_white = new Texture2D(2, 2, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61
			};
			_white.SetPixels((Color[])(object)new Color[4]
			{
				Color.white,
				Color.white,
				Color.white,
				Color.white
			});
			_white.Apply();
			return _white;
		}

		internal static Texture2D SoftEdge()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0081: 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)
			if ((Object)(object)_softEdge != (Object)null)
			{
				return _softEdge;
			}
			_softEdge = new Texture2D(2, 32, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1,
				hideFlags = (HideFlags)61
			};
			Color val = default(Color);
			for (int i = 0; i < 32; i++)
			{
				float num = ((float)i + 0.5f) / 32f * 2f - 1f;
				float num2 = Mathf.Clamp01(1f - num * num);
				num2 *= num2;
				((Color)(ref val))..ctor(1f, 1f, 1f, num2);
				_softEdge.SetPixel(0, i, val);
				_softEdge.SetPixel(1, i, val);
			}
			_softEdge.Apply();
			return _softEdge;
		}
	}
	internal class LightPillar : MonoBehaviour
	{
		private enum Kind
		{
			Departure,
			Arrival
		}

		private struct Frame
		{
			internal bool Visible;

			internal float Base;

			internal float Taper;

			internal float Width;

			internal float Opacity;

			internal float Light;

			internal float SigilOpacity;

			internal float SigilSpin;

			internal float Shake;
		}

		private const float Length = 900f;

		private const float Flight = 260f;

		private const float TaperSpan = 0.07f;

		private const int Segments = 40;

		private static readonly float[] LayerRadius = new float[5] { 1f, 0.78f, 0.57f, 0.37f, 0.18f };

		private static readonly float[] LayerOpacity = new float[5] { 0.1f, 0.15f, 0.22f, 0.32f, 0.5f };

		private static readonly Color RimColor = new Color(0.62f, 0.35f, 0.95f);

		private static readonly Color CoreColor = new Color(0.97f, 0.93f, 1f);

		private static readonly float[] RowAt = new float[8] { 0f, 0.004f, 0.012f, 0.03f, 0.07f, 0.25f, 0.55f, 1f };

		private static readonly float[] RowOpacity = new float[8] { 0.55f, 0.9f, 1f, 1f, 1f, 0.9f, 0.5f, 0f };

		private const float DepartExpand = 0.12f;

		private const float DepartHold = 0.35f;

		private const float DepartRise = 1.1f;

		private const float ArriveDescend = 0.45f;

		private const float ArriveHold = 0.3f;

		private const float ArriveCollapse = 0.35f;

		private const float PeakLight = 3.2f;

		private const float PeakShake = 1.6f;

		private const float FullShakeRadius = 4.5f;

		private const float CullDistance = 1000f;

		private Kind _kind;

		private float _radius;

		private float _delay;

		private float _age;

		private bool _impacted;

		private Mesh[] _meshes;

		private MeshRenderer[] _renderers;

		private Vector3[] _vertices;

		private Color[] _colors;

		private Light _light;

		private Transform _sigil;

		private Material _sigilMaterial;

		internal static void SpawnDeparture(Vector3 groundPoint, float radius)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Spawn(Kind.Departure, groundPoint, radius, 0f);
		}

		internal static void SpawnArrival(Vector3 groundPoint, float radius, float delay)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Spawn(Kind.Arrival, groundPoint, radius, delay);
		}

		private static void Spawn(Kind kind, Vector3 groundPoint, float radius, float delay)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && !(Vector3.Distance(((Component)Player.m_localPlayer).transform.position, groundPoint) > 1000f))
			{
				Material val = GlowMaterials.Additive("Rift pillar", (Texture)(object)GlowMaterials.White());
				if (!((Object)(object)val == (Object)null))
				{
					GameObject val2 = new GameObject((kind == Kind.Departure) ? "RM_PillarDeparture" : "RM_PillarArrival");
					val2.transform.position = groundPoint;
					val2.AddComponent<LightPillar>().Build(kind, radius, delay, val);
				}
			}
		}

		private void Build(Kind kind, float radius, float delay, Material material)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			_kind = kind;
			_radius = Mathf.Max(0.5f, radius);
			_delay = Mathf.Max(0f, delay);
			int num = 41;
			int num2 = RowAt.Length;
			_vertices = (Vector3[])(object)new Vector3[num2 * num];
			_colors = (Color[])(object)new Color[num2 * num];
			int[] triangles = BuildTriangles(num2, num);
			_meshes = (Mesh[])(object)new Mesh[LayerRadius.Length];
			_renderers = (MeshRenderer[])(object)new MeshRenderer[LayerRadius.Length];
			for (int i = 0; i < LayerRadius.Length; i++)
			{
				GameObject val = new GameObject("layer" + i);
				val.transform.SetParent(((Component)this).transform, false);
				Mesh val2 = new Mesh
				{
					name = "RM_PillarLayer"
				};
				val2.MarkDynamic();
				val2.vertices = _vertices;
				val2.colors = _colors;
				val2.triangles = triangles;
				val.AddComponent<MeshFilter>().sharedMesh = val2;
				MeshRenderer val3 = val.AddComponent<MeshRenderer>();
				((Renderer)val3).sharedMaterial = material;
				((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)val3).receiveShadows = false;
				_meshes[i] = val2;
				_renderers[i] = val3;
			}
			GameObject val4 = new GameObject("light");
			val4.transform.SetParent(((Component)this).transform, false);
			_light = val4.AddComponent<Light>();
			_light.type = (LightType)2;
			_light.color = RimColor;
			_light.range = _radius * 3.5f;
			_light.shadows = (LightShadows)0;
			if (_kind == Kind.Departure)
			{
				_sigil = Sigil.Create(((Component)this).transform, _radius * 2f, ownMaterial: true, out _sigilMaterial);
				if ((Object)(object)_sigil != (Object)null)
				{
					_sigil.localPosition = Vector3.up * 0.07f;
				}
			}
			Apply(Evaluate(0f));
		}

		private static int[] BuildTriangles(int rows, int cols)
		{
			int[] array = new int[(rows - 1) * 40 * 6];
			int num = 0;
			for (int i = 0; i < rows - 1; i++)
			{
				for (int j = 0; j < 40; j++)
				{
					int num2 = i * cols + j;
					int num3 = num2 + cols;
					array[num++] = num2;
					array[num++] = num3;
					array[num++] = num3 + 1;
					array[num++] = num2;
					array[num++] = num3 + 1;
					array[num++] = num2 + 1;
				}
			}
			return array;
		}

		private void Update()
		{
			_age += Time.deltaTime;
			Frame f = Evaluate(_age);
			if (f.Opacity < 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Apply(f);
			if (f.Shake > 0f)
			{
				Shake(f.Shake);
			}
		}

		private void Shake(float envelope)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)GameCamera.instance == (Object)null))
			{
				float num = Mathf.Max(0f, RiftConfig.PillarShake.Value) * 1.6f * Mathf.Clamp(_radius / 4.5f, 0.5f, 1f) * envelope;
				if (!(num <= 0f))
				{
					GameCamera.instance.AddShake(((Component)this).transform.position, Mathf.Max(1f, RiftConfig.PillarShakeRange.Value), num, true);
				}
			}
		}

		private Frame Evaluate(float age)
		{
			if (_kind != Kind.Departure)
			{
				return EvaluateArrival(age - _delay);
			}
			return EvaluateDeparture(age);
		}

		private static Frame EvaluateDeparture(float t)
		{
			Frame result = new Frame
			{
				Visible = true,
				Taper = 1f,
				Width = 1f,
				Opacity = 1f,
				SigilOpacity = 1f
			};
			if (t < 0.12f)
			{
				float num = t / 0.12f;
				result.Width = 1f - Mathf.Pow(1f - num, 3f);
				result.Light = 3.2f * num;
				result.SigilSpin = 720f;
				result.Shake = 1f;
				return result;
			}
			t -= 0.12f;
			if (t < 0.35f)
			{
				result.Light = 3.2f * (0.9f + 0.1f * Mathf.Sin(t * 40f));
				result.SigilSpin = Mathf.Lerp(720f, 360f, t / 0.35f);
				result.Shake = 0.75f;
				return result;
			}
			t -= 0.35f;
			if (t < 1.1f)
			{
				float num2 = t / 1.1f;
				result.Base = 260f * Mathf.Pow(num2, 2.2f);
				result.Taper = Mathf.Lerp(1f, 0.04f, Ramp(0f, 0.45f, num2));
				result.Width = Mathf.Lerp(1f, 0.65f, num2);
				result.Opacity = 1f - Ramp(0.5f, 1f, num2);
				result.Light = 3.2f * (1f - num2);
				result.SigilOpacity = 1f - Ramp(0f, 0.5f, num2);
				result.SigilSpin = Mathf.Lerp(360f, 40f, num2);
				result.Shake = 0.5f * (1f - Ramp(0f, 0.35f, num2));
				return result;
			}
			result.Opacity = -1f;
			return result;
		}

		private static Frame EvaluateArrival(float t)
		{
			Frame result = new Frame
			{
				Taper = 1f,
				Width = 1f,
				Opacity = 1f
			};
			if (t < 0f)
			{
				result.Visible = false;
				return result;
			}
			result.Visible = true;
			if (t < 0.45f)
			{
				float num = t / 0.45f;
				result.Base = 260f * (1f - num * num);
				result.Taper = Mathf.Lerp(0.04f, 1f, Ramp(0.55f, 1f, num));
				result.Opacity = Ramp(0f, 0.2f, num);
				result.Light = 3.2f * Ramp(0.7f, 1f, num);
				result.Shake = Ramp(0.85f, 1f, num);
				return result;
			}
			t -= 0.45f;
			if (t < 0.3f)
			{
				result.Light = 3.2f * (0.9f + 0.1f * Mathf.Sin(t * 40f));
				result.Shake = Mathf.Lerp(1f, 0.6f, t / 0.3f);
				return result;
			}
			t -= 0.3f;
			if (t < 0.35f)
			{
				float num2 = t / 0.35f;
				result.Width = 1f - num2 * num2;
				result.Opacity = 1f - Ramp(0.3f, 1f, num2);
				result.Light = 3.2f * (1f - num2);
				return result;
			}
			result.Opacity = -1f;
			return result;
		}

		private void Apply(Frame f)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_027b: 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_0138: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < _renderers.Length; i++)
			{
				if ((Object)(object)_renderers[i] != (Object)null)
				{
					((Renderer)_renderers[i]).enabled = f.Visible;
				}
			}
			if ((Object)(object)_light != (Object)null)
			{
				((Behaviour)_light).enabled = f.Visible;
			}
			if (!f.Visible)
			{
				return;
			}
			if (_kind == Kind.Arrival && !_impacted && f.Base <= 0.01f)
			{
				_impacted = true;
				RiftEffects.Play("vfx_spawn_large", ((Component)this).transform.position);
			}
			int num = 41;
			Color val2 = default(Color);
			for (int j = 0; j < _meshes.Length; j++)
			{
				float num2 = _radius * LayerRadius[j] * f.Width;
				float num3 = (float)j / (float)(LayerRadius.Length - 1);
				Color val = Color.Lerp(RimColor, CoreColor, num3);
				float num4 = LayerOpacity[j] * f.Opacity;
				for (int k = 0; k < RowAt.Length; k++)
				{
					float num5 = RowAt[k];
					float num6 = f.Base + num5 * 900f;
					float num7 = Mathf.Lerp(f.Taper, 1f, Ramp(0f, 0.07f, num5));
					float num8 = num2 * num7;
					((Color)(ref val2))..ctor(val.r, val.g, val.b, num4 * RowOpacity[k]);
					for (int l = 0; l < num; l++)
					{
						float num9 = (float)l / 40f * (float)Math.PI * 2f;
						int num10 = k * num + l;
						_vertices[num10] = new Vector3(Mathf.Cos(num9) * num8, num6, Mathf.Sin(num9) * num8);
						_colors[num10] = val2;
					}
				}
				Mesh obj = _meshes[j];
				obj.vertices = _vertices;
				obj.colors = _colors;
				obj.bounds = new Bounds(new Vector3(0f, f.Base + 450f, 0f), new Vector3(_radius * 2f, 900f, _radius * 2f));
			}
			if ((Object)(object)_light != (Object)null)
			{
				_light.intensity = f.Light;
				((Component)_light).transform.localPosition = Vector3.up * (f.Base + 2f);
			}
			if ((Object)(object)_sigil != (Object)null)
			{
				Sigil.Spin(_sigil, f.SigilSpin * Time.deltaTime);
				GlowMaterials.SetAlpha(_sigilMaterial, f.SigilOpacity);
				((Component)_sigil).gameObject.SetActive(f.SigilOpacity > 0.01f);
			}
		}

		private static float Ramp(float a, float b, float x)
		{
			return Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(a, b, x));
		}

		private void OnDestroy()
		{
			if (_meshes != null)
			{
				Mesh[] meshes = _meshes;
				foreach (Mesh val in meshes)
				{
					if ((Object)(object)val != (Object)null)
					{
						Object.Destroy((Object)(object)val);
					}
				}
			}
			if ((Object)(object)_sigilMaterial != (Object)null)
			{
				Object.Destroy((Object)(object)_sigilMaterial);
			}
		}
	}
	internal static class RiftCastSigil
	{
		private class Remote
		{
			public View View;

			public Vector3 Point;

			public Vector3 Target;

			public float Ring;

			public float Progress;

			public float Rate;

			public float LastHeard;
		}

		private sealed class View
		{
			private readonly string _name;

			private GameObject _root;

			private Transform _quad;

			private Material _material;

			private Light _light;

			internal View(string name)
			{
				_name = name;
			}

			internal void Show(Vector3 groundPoint, float fullRingDiameter, float progress)
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_root == (Object)null)
				{
					Build();
				}
				if (!((Object)(object)_root == (Object)null))
				{
					if (!_root.activeSelf)
					{
						_root.SetActive(true);
					}
					progress = Mathf.Clamp01(progress);
					_root.transform.position = groundPoint + Vector3.up * 0.07f;
					float num = 1f - (1f - progress) * (1f - progress);
					float num2 = Mathf.Lerp(fullRingDiameter * 0.04f, fullRingDiameter, num);
					Sigil.SetRingDiameter(_quad, num2);
					float num3 = Mathf.Lerp(25f, 720f, progress * progress);
					Sigil.Spin(_quad, num3 * Time.deltaTime);
					GlowMaterials.SetAlpha(_material, Mathf.Lerp(0.55f, 1f, progress));
					if ((Object)(object)_light != (Object)null)
					{
						_light.range = Mathf.Max(2f, num2 * 0.75f);
						_light.intensity = Mathf.Lerp(0.5f, 2.4f, progress);
					}
				}
			}

			internal void Hide()
			{
				if ((Object)(object)_root != (Object)null && _root.activeSelf)
				{
					_root.SetActive(false);
				}
			}

			internal void Destroy()
			{
				if ((Object)(object)_root != (Object)null)
				{
					Object.Destroy((Object)(object)_root);
				}
				if ((Object)(object)_material != (Object)null)
				{
					Object.Destroy((Object)(object)_material);
				}
				_root = null;
				_quad = null;
				_material = null;
				_light = null;
			}

			private void Build()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				_root = new GameObject(_name);
				Object.DontDestroyOnLoad((Object)(object)_root);
				_light = _root.AddComponent<Light>();
				_light.type = (LightType)2;
				_light.color = Sigil.Purple;
				_light.shadows = (LightShadows)0;
				_quad = Sigil.Create(_root.transform, 1f, ownMaterial: true, out _material);
			}
		}

		private const float StartFraction = 0.04f;

		private const float BaseSpin = 25f;

		private const float PeakSpin = 720f;

		private const float GroundOffset = 0.07f;

		private const float RemoteTimeout = 1.5f;

		private static View _local;

		private static readonly Dictionary<long, Remote> Remotes = new Dictionary<long, Remote>();

		internal static void Show(Vector3 groundPoint, float fullRingDiameter, float progress)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Player.m_localPlayer == (Object)null))
			{
				if (_local == null)
				{
					_local = new View("RM_RiftCastSigil");
				}
				_local.Show(groundPoint, fullRingDiameter, progress);
			}
		}

		internal static void Hide()
		{
			if (_local != null)
			{
				_local.Hide();
			}
		}

		internal static void ShowRemote(long caster, Vector3 groundPoint, float fullRingDiameter, float progress, float secondsLeft)
		{
			//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)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Player.m_localPlayer == (Object)null))
			{
				if (!Remotes.TryGetValue(caster, out var value))
				{
					value = new Remote
					{
						View = new View("RM_RiftCastSigil_remote"),
						Point = groundPoint
					};
					Remotes[caster] = value;
				}
				value.Target = groundPoint;
				value.Ring = fullRingDiameter;
				progress = Mathf.Clamp01(progress);
				value.Progress = ((progress + 0.25f < value.Progress) ? progress : Mathf.Max(value.Progress, progress));
				value.Rate = ((secondsLeft > 0.01f) ? ((1f - value.Progress) / secondsLeft) : 0f);
				value.LastHeard = Time.time;
			}
		}

		internal static void HideRemote(long caster)
		{
			if (Remotes.TryGetValue(caster, out var value))
			{
				value.View.Destroy();
				Remotes.Remove(caster);
			}
		}

		internal static void TickRemotes()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (Remotes.Count == 0)
			{
				return;
			}
			List<long> list = null;
			foreach (KeyValuePair<long, Remote> remote in Remotes)
			{
				Remote value = remote.Value;
				if (Time.time - value.LastHeard > 1.5f)
				{
					(list ?? (list = new List<long>())).Add(remote.Key);
					continue;
				}
				value.Progress = Mathf.Min(1f, value.Progress + value.Rate * Time.deltaTime);
				value.Point = Vector3.Lerp(value.Point, value.Target, 1f - Mathf.Exp(-6f * Time.deltaTime));
				value.View.Show(value.Point, value.Ring, value.Progress);
			}
			if (list == null)
			{
				return;
			}
			foreach (long item in list)
			{
				HideRemote(item);
			}
		}

		internal static void Reset()
		{
			if (_local != null)
			{
				_local.Destroy();
			}
			_local = null;
			foreach (Remote value in Remotes.Values)
			{
				value.View.Destroy();
			}
			Remotes.Clear();
		}
	}
	internal static class RiftFx
	{
		private const string RpcName = "RM_RiftFx";

		private const string TrailRpc = "RM_RiftTrail";

		private const string SigilRpc = "RM_RiftSigil";

		private const string SigilEndRpc = "RM_RiftSigilEnd";

		private const float ArrivalDelay = 0.6f;

		private const float SightRange = 150f;

		internal static void Register()
		{
			if (ZRoutedRpc.instance == null)
			{
				return;
			}
			try
			{
				ZRoutedRpc.instance.Register<Vector3, Vector3, float, float>("RM_RiftFx", (Method<Vector3, Vector3, float, float>)OnRpc);
				ZRoutedRpc.instance.Register<Vector3, Vector3>("RM_RiftTrail", (Action<long, Vector3, Vector3>)OnTrail);
				ZRoutedRpc.instance.Register<Vector3, float, float, float>("RM_RiftSigil", (Method<Vector3, float, float, float>)OnSigil);
				ZRoutedRpc.instance.Register("RM_RiftSigilEnd", (Action<long>)OnSigilEnd);
			}
			catch (ArgumentException)
			{
			}
		}

		internal static void Broadcast(Vector3 from, Vector3 to, float radius)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Broadcast(from, to, radius, 0.6f);
		}

		internal static void Broadcast(Vector3 from, Vector3 to, float radius, float arrivalDelay)
		{
			//IL_0025: 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_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)
			if (ZRoutedRpc.instance == null)
			{
				Play(from, to, radius, arrivalDelay);
				return;
			}
			ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RM_RiftFx", new object[4] { from, to, radius, arrivalDelay });
		}

		private static void OnRpc(long sender, Vector3 from, Vector3 to, float radius, float arrivalDelay)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Play(from, to, radius, arrivalDelay);
		}

		private static void Play(Vector3 from, Vector3 to, float radius, float arrivalDelay)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			LightPillar.SpawnDeparture(from, radius);
			if (arrivalDelay >= 0f)
			{
				LightPillar.SpawnArrival(to, radius, arrivalDelay);
			}
		}

		internal static void Trail(Vector3 from, Vector3 to)
		{
			//IL_0023: 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_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)
			if (ZRoutedRpc.instance == null)
			{
				BlinkTrail.Spawn(from, to);
				return;
			}
			ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RM_RiftTrail", new object[2] { from, to });
		}

		private static void OnTrail(long sender, Vector3 from, Vector3 to)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (InSight(from) || InSight(to))
			{
				BlinkTrail.Spawn(from, to);
			}
		}

		internal static void CastSigil(Vector3 groundPoint, float ringDiameter, float progress, float secondsLeft)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (ZRoutedRpc.instance != null)
			{
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RM_RiftSigil", new object[4] { groundPoint, ringDiameter, progress, secondsLeft });
			}
		}

		internal static void CastSigilEnd()
		{
			if (ZRoutedRpc.instance != null)
			{
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RM_RiftSigilEnd", Array.Empty<object>());
			}
		}

		private static void OnSigil(long sender, Vector3 groundPoint, float ringDiameter, float progress, float secondsLeft)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!IsSelf(sender) && InSight(groundPoint))
			{
				RiftCastSigil.ShowRemote(sender, groundPoint, ringDiameter, progress, secondsLeft);
			}
		}

		private static void OnSigilEnd(long sender)
		{
			if (!IsSelf(sender))
			{
				RiftCastSigil.HideRemote(sender);
			}
		}

		private static bool IsSelf(long sender)
		{
			return sender == ZNet.GetUID();
		}

		private static bool InSight(Vector3 at)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer != (Object)null)
			{
				Vector3 val = ((Component)localPlayer).transform.position - at;
				return ((Vector3)(ref val)).sqrMagnitude <= 22500f;
			}
			return false;
		}
	}
	internal static class RiftMotes
	{
		internal sealed class Palette
		{
			internal readonly string Name;

			internal readonly Color Deep;

			internal readonly Color Bright;

			internal readonly Color SparkEmission;

			internal Palette(string name, Color deep, Color bright, Color sparkEmission)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: 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)
				Name = name;
				Deep = deep;
				Bright = bright;
				SparkEmission = sparkEmission;
			}
		}

		private struct Tuning
		{
			internal float PerSecond;

			internal float PerMetre;

			internal float Lifetime;

			internal float Size;

			internal float Gravity;
		}

		private const string SourceItem = "Demister";

		private const string SourceBall = "demister_ball";

		internal static readonly Palette Rift = new Palette("rift", new Color(0.55f, 0.2f, 1f), new Color(0.85f, 0.6f, 1f), new Color(0.6f, 0.18f, 1f) * 3.2f);

		private static readonly Dictionary<string, Tuning> Tunings = new Dictionary<string, Tuning>
		{
			["embers"] = new Tuning
			{
				PerSecond = 2f,
				PerMetre = 0f,
				Lifetime = 2f,
				Size = 0.03f,
				Gravity = -0.03f
			},
			["sparcs_front"] = new Tuning
			{
				PerSecond = 0.5f,
				PerMetre = 1.2f,
				Lifetime = 0.6f,
				Size = 0.045f,
				Gravity = 0f
			}
		};

		private static GameObject _holder;

		private static readonly Dictionary<Palette, List<GameObject>> Templates = new Dictionary<Palette, List<GameObject>>();

		private static readonly Dictionary<Palette, Dictionary<Material, Material>> Recoloured = new Dictionary<Palette, Dictionary<Material, Material>>();

		internal static void Attach(Transform parent, Bounds area, float rate, Palette palette = null)
		{
			//IL_0050: 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_0070: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)parent == (Object)null || rate <= 0f)
			{
				return;
			}
			foreach (GameObject item in Prepare(palette ?? Rift))
			{
				GameObject obj = Object.Instantiate<GameObject>(item, parent, false);
				((Object)obj).name = ((Object)item).name;
				obj.transform.localPosition = ((Bounds)(ref area)).center;
				obj.transform.localRotation = Quaternion.identity;
				obj.transform.localScale = Vector3.one;
				ParticleSystem component = obj.GetComponent<ParticleSystem>();
				ShapeModule shape = component.shape;
				((ShapeModule)(ref shape)).scale = Vector3.Max(((Bounds)(ref area)).size, Vector3.one * 0.01f);
				EmissionModule emission = component.emission;
				((EmissionModule)(ref emission)).rateOverTimeMultiplier = ((EmissionModule)(ref emission)).rateOverTimeMultiplier * rate;
				((EmissionModule)(ref emission)).rateOverDistanceMultiplier = ((EmissionModule)(ref emission)).rateOverDistanceMultiplier * rate;
			}
		}

		private static List<GameObject> Prepare(Palette palette)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			if (Templates.TryGetValue(palette, out var value))
			{
				return value;
			}
			value = new List<GameObject>();
			Templates[palette] = value;
			Transform val = FindBall();
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogWarning((object)("Could not find the Wisplight's glow to copy; nothing will give off " + palette.Name + " motes."));
				return value;
			}
			if ((Object)(object)_holder == (Object)null)
			{
				_holder = new GameObject("RM_RiftMotes");
				_holder.SetActive(false);
				Object.DontDestroyOnLoad((Object)(object)_holder);
			}
			ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem val2 in componentsInChildren)
			{
				if (!Tunings.TryGetValue(((Object)val2).name, out var value2))
				{
					continue;
				}
				GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, _holder.transform, false);
				((Object)val3).name = "RM_mote_" + palette.Name + "_" + ((Object)val2).name;
				foreach (Transform item in val3.transform)
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
				val3.SetActive(true);
				Retune(val3.GetComponent<ParticleSystem>(), value2, palette);
				ParticleSystemRenderer component = val3.GetComponent<ParticleSystemRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).sharedMaterials = ((Renderer)component).sharedMaterials.Select((Material m) => Recolour(m, palette)).ToArray();
				}
				value.Add(val3);
			}
			Logger.LogInfo((object)((value.Count > 0) ? ("Motes copied from the Wisplight: " + string.Join(", ", value.Select((GameObject t) => ((Object)t).name).ToArray()) + ".") : ("The Wisplight's glow has no ember or spark systems to copy; nothing will give off " + palette.Name + " motes.")));
			return value;
		}

		private static Transform FindBall()
		{
			GameObject prefab = PrefabManager.Instance.GetPrefab("Demister");
			ItemDrop val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null);
			SE_Demister val2 = (SE_Demister)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null);
			if ((Object)(object)val2 != (Object)null && (Object)(object)val2.m_ballPrefab != (Object)null)
			{
				return val2.m_ballPrefab.transform;
			}
			GameObject prefab2 = PrefabManager.Instance.GetPrefab("demister_ball");
			if (!((Object)(object)prefab2 != (Object)null))
			{
				return null;
			}
			return prefab2.transform;
		}

		private static void Retune(ParticleSystem ps, Tuning tuning, Palette palette)
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Invalid comparison between Unknown and I4
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: 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)
			MainModule main = ps.main;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)2;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).prewarm = false;
			((MainModule)(ref main)).playOnAwake = true;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(tuning.Lifetime);
			((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(tuning.Size);
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(tuning.Gravity);
			((MainModule)(ref main)).startColor = new MinMaxGradient(palette.Deep, palette.Bright);
			EmissionModule emission = ps.emission;
			((EmissionModule)(ref emission)).enabled = true;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(tuning.PerSecond);
			((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(tuning.PerMetre);
			ShapeModule shape = ps.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5;
			((ShapeModule)(ref shape)).position = Vector3.zero;
			((ShapeModule)(ref shape)).rotation = Vector3.zero;
			((ShapeModule)(ref shape)).sphericalDirectionAmount = 1f;
			ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime;
			if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
			{
				MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
				object obj;
				if ((int)((MinMaxGradient)(ref color)).mode != 1)
				{
					obj = null;
				}
				else
				{
					color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
					obj = ((MinMaxGradient)(ref color)).gradient;
				}
				Gradient val = (Gradient)obj;
				Gradient val2 = new Gradient();
				val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(Color.white, 0f),
					new GradientColorKey(Color.white, 1f)
				}, (GradientAlphaKey[])((val != null && val.alphaKeys.Length != 0) ? ((Array)val.alphaKeys) : ((Array)new GradientAlphaKey[3]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(1f, 0.6f),
					new GradientAlphaKey(0f, 1f)
				})));
				((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2);
			}
		}

		private static Material Recolour(Material source, Palette palette)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)source == (Object)null)
			{
				return null;
			}
			if (!Recoloured.TryGetValue(palette, out var value))
			{
				value = (Recoloured[palette] = new Dictionary<Material, Material>());
			}
			if (value.TryGetValue(source, out var value2))
			{
				return value2;
			}
			value2 = new Material(source)
			{
				name = ((Object)source).name + " (" + palette.Name + ")"
			};
			if (value2.HasProperty("_EmissionColor"))
			{
				value2.SetColor("_EmissionColor", palette.SparkEmission);
			}
			value[source] = value2;
			return value2;
		}
	}
	internal static class ShaderLookup
	{
		private static readonly HashSet<string> Logged = new HashSet<string>();

		internal static Shader Find(string purpose, params string[] candidates)
		{
			foreach (string text in candidates)
			{
				Shader val = Shader.Find(text);
				if (!((Object)(object)val == (Object)null))
				{
					if (Logged.Add(purpose))
					{
						Logger.LogInfo((object)(purpose + ": using shader '" + text + "'."));
					}
					return val;
				}
			}
			if (Logged.Add(purpose))
			{
				Logger.LogWarning((object)(purpose + ": none of [" + string.Join(", ", candidates) + "] survived the build."));
			}
			return null;
		}
	}
	internal static class Sigil
	{
		internal static readonly Color Purple = new Color(0.62f, 0.35f, 0.95f);

		internal const float RingFraction = 0.92f;

		private const int TextureSize = 256;

		private static Texture2D _texture;

		internal static Transform Create(Transform parent, float ringDiameter, bool ownMaterial, out Material material)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			material = null;
			Material val = GlowMaterials.Transparent("Rift sigil", (Texture)(object)Texture());
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			material = (Material)((!ownMaterial) ? ((object)val) : ((object)new Material(val)));
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5);
			((Object)obj).name = "sigil";
			obj.transform.SetParent(parent, false);
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			obj.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
			MeshRenderer component2 = obj.GetComponent<MeshRenderer>();
			((Renderer)component2).sharedMaterial = material;
			((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component2).receiveShadows = false;
			SetRingDiameter(obj.transform, ringDiameter);
			return obj.transform;
		}

		internal static void SetRingDiameter(Transform quad, float ringDiameter)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)quad == (Object)null))
			{
				float num = Mathf.Max(0.01f, ringDiameter) / 0.92f;
				quad.localScale = new Vector3(num, num, 1f);
			}
		}

		internal static void Spin(Transform quad, float degrees)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)quad != (Object)null)
			{
				quad.Rotate(Vector3.forward, degrees, (Space)1);
			}
		}

		private static Texture2D Texture()
		{
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_texture != (Object)null)
			{
				return _texture;
			}
			Color[] array = (Color[])(object)new Color[65536];
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num = (float)j + 0.5f - 128f;
					float num2 = (float)i + 0.5f - 128f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2) / 128f;
					float num4 = 0f;
					num4 = Mathf.Max(num4, Ring(num3, 0.92f, 0.02f));
					num4 = Mathf.Max(num4, Ring(num3, 0.8f, 0.01f));
					num4 = Mathf.Max(num4, Ring(num3, 0.46f, 0.014f));
					if (num3 > 0.8f && num3 < 0.92f)
					{
						float num5 = Mathf.Repeat(Mathf.Atan2(num2, num) * 57.29578f + 180f, 30f);
						if (num5 < 4f || num5 > 26f)
						{
							num4 = Mathf.Max(num4, 0.85f);
						}
					}
					if (num3 < 0.46f)
					{
						num4 = Mathf.Max(num4, Mathf.SmoothStep(0.18f, 0f, num3) * 0.35f);
					}
					if (num3 > 0.98f)
					{
						num4 = 0f;
					}
					array[i * 256 + j] = new Color(Purple.r, Purple.g, Purple.b, Mathf.Clamp01(num4));
				}
			}
			_texture = new Texture2D(256, 256, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1,
				hideFlags = (HideFlags)61
			};
			_texture.SetPixels(array);
			_texture.Apply();
			return _texture;
		}

		private static float Ring(float radius, float at, float width)
		{
			float num = Mathf.Abs(radius - at);
			if (!(num > width))
			{
				return 1f - num / width;
			}
			return 0f;
		}
	}
}
namespace RiftMagic.Spells
{
	public class BlinkSpell : MonoBehaviour, IProjectile
	{
		private const float WallMargin = 0.15f;

		private static int _solidMask;

		private static int _characterMask;

		private static void EnsureMasks()
		{
			if (_solidMask == 0)
			{
				_solidMask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "terrain", "vehicle" });
				_characterMask = LayerMask.GetMask(new string[4] { "character", "character_net", "character_ghost", "character_noenv" });
			}
		}

		public void Setup(Character owner, Vector3 velocity, float hitNoise, HitData hitData, ItemData item, ItemData ammo)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Cast(owner, velocity, item);
			}
			catch (Exception arg)
			{
				Logger.LogError((object)$"Blink failed: {arg}");
			}
			finally
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public string GetTooltipString(int itemQuality)
		{
			return string.Empty;
		}

		private static void Cast(Character owner, Vector3 velocity, ItemData staff)
		{
			//IL_003c: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			Player val = (Player)(object)((owner is Player) ? owner : null);
			if ((Object)(object)val == (Object)null || (Object)(object)((Character)val).m_eye == (Object)null)
			{
				return;
			}
			EnsureMasks();
			Vector3 val2 = ((((Vector3)(ref velocity)).sqrMagnitude > 0.001f) ? ((Vector3)(ref velocity)).normalized : ((Character)val).GetLookDir());
			((Vector3)(ref val2)).Normalize();
			float num = RiftMastery.BlinkRange(val, staff?.m_quality ?? 1);
			float num2 = Mathf.Max(0.05f, RiftConfig.BlinkClearanceRadius.Value);
			Vector3 position = ((Character)val).m_eye.position;
			Vector3 val3 = position - ((Component)val).transform.position;
			if (RiftConfig.BlinkDisplaceEnemies.Value)
			{
				DisplaceCreaturesAlongPath(val, position, val2, num, num2);
			}
			float num3 = num;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.SphereCast(position, num2, val2, ref val4, num, _solidMask, (QueryTriggerInteraction)1))
			{
				num3 = Mathf.Max(0f, ((RaycastHit)(ref val4)).distance - 0.15f);
			}
			if (num3 < 0.5f)
			{
				ShowMessage("$riftmagic_msg_blinkblocked");
				return;
			}
			Vector3 val5 = position + val2 * num3;
			Vector3 val6 = RiftGround.LiftOntoFloor(val5 - val3, val5);
			Vector3 position2 = ((Component)val).transform.position;
			MoveInstantly((Character)(object)val, val6);
			Vector3 val7 = val3 * 0.6f;
			RiftEffects.Play("vfx_spawn_small", position2 + val7);
			RiftEffects.Play("vfx_spawn_small", val6 + val7);
			RiftFx.Trail(position2 + val7, val6 + val7);
			Skills skills = ((Character)val).GetSkills();
			if ((Object)(object)skills != (Object)null)
			{
				skills.RaiseSkill(RiftSkills.Skill, 1f);
			}
		}

		private static void DisplaceCreaturesAlongPath(Player caster, Vector3 eye, Vector3 dir, float range, float radius)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_016d: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit[] array = Physics.SphereCastAll(eye, radius, dir, range, _characterMask, (QueryTriggerInteraction)1);
			HashSet<Character> hashSet = new HashSet<Character>();
			RaycastHit[] array2 = array;
			RaycastHit val5 = default(RaycastHit);
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val = array2[i];
				Character componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)caster) && !(componentInParent is Player) && !componentInParent.IsBoss() && hashSet.Add(componentInParent))
				{
					Vector3 val2 = ((Component)componentInParent).transform.position - ((Component)caster).transform.position;
					val2.y = 0f;
					if (((Vector3)(ref val2)).sqrMagnitude < 0.01f)
					{
						val2 = dir;
					}
					((Vector3)(ref val2)).Normalize();
					float num = Mathf.Clamp(RiftConfig.BlinkEnemyPushSpread.Value, 0f, 180f);
					Vector3 val3 = Quaternion.AngleAxis(Random.Range(0f - num, num), Vector3.up) * val2;
					Vector3 val4 = ((Component)componentInParent).transform.position + val3 * RiftConfig.BlinkEnemyPushDistance.Value;
					if (Physics.Raycast(((Component)componentInParent).transform.position, val3, ref val5, RiftConfig.BlinkEnemyPushDistance.Value, _solidMask, (QueryTriggerInteraction)1))
					{
						val4 = ((Component)componentInParent).transform.position + val3 * Mathf.Max(0f, ((RaycastHit)(ref val5)).distance - 0.5f);
					}
					val4 = RiftGround.LiftOntoFloor(val4, val4 + Vector3.up * 2f);
					float num2 = Mathf.Max(0.5f, componentInParent.GetCenterPoint().y - ((Component)componentInParent).transform.position.y);
					RiftEffects.Play("vfx_spawn_small", componentInParent.GetCenterPoint());
					MoveInstantly(componentInParent, val4);
					RiftEffects.Play("vfx_spawn_small", val4 + Vector3.up * num2);
				}
			}
		}

		private static void MoveInstantly(Character character, Vector3 position)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)character.m_nview != (Object)null && character.m_nview.IsValid())
			{
				character.m_nview.ClaimOwnership();
			}
			((Component)character).transform.position = position;
			if ((Object)(object)character.m_body != (Object)null)
			{
				character.m_body.position = position;
				character.m_body.velocity = Vector