Decompiled source of Skas Staffs v1.1.16

Staffs.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Staffs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.16.0")]
[assembly: AssemblyInformationalVersion("1.1.16")]
[assembly: AssemblyProduct("Staffs")]
[assembly: AssemblyTitle("Staffs")]
[assembly: AssemblyVersion("1.1.16.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 Staffs
{
	internal enum Ability
	{
		None,
		NegativeEnergy,
		Golem,
		Demons,
		Time,
		Storms,
		Roses,
		Lantern,
		Clarity,
		Force,
		Life,
		Light,
		Drakes,
		Gravity,
		Darkness,
		Peace,
		Stone,
		Confusion,
		Illness,
		Hordes,
		Wood,
		Night,
		Undead,
		Hail,
		Sun,
		Release
	}
	internal static class Settings
	{
		public static ConfigEntry<float> BoltDamage;

		public static ConfigEntry<float> BoltDamagePerLevel;

		public static ConfigEntry<float> BoltRange;

		public static ConfigEntry<float> BoltEitr;

		public static ConfigEntry<float> StrikeDamageFactor;

		public static ConfigEntry<float> StrikeRadius;

		public static ConfigEntry<float> StrikeEitr;

		public static ConfigEntry<string> BoltEffects;

		public static ConfigEntry<string> BoltHitEffects;

		public static ConfigEntry<string> StrikeEffects;

		public static ConfigEntry<string> GolemCreature;

		public static ConfigEntry<string> DemonCreature;

		public static ConfigEntry<string> SummonEffects;

		public static ConfigEntry<int> GolemStars;

		public static ConfigEntry<int> DemonStars;

		public static ConfigEntry<float> GolemSize;

		public static ConfigEntry<float> DemonSize;

		public static ConfigEntry<float> GolemEitr;

		public static ConfigEntry<float> DemonEitr;

		public static ConfigEntry<float> TimeSeconds;

		public static ConfigEntry<float> TimeCooldown;

		public static ConfigEntry<float> TimeSlowSpeed;

		public static ConfigEntry<float> TimeSlowRadius;

		public static ConfigEntry<float> TimeSlowSeconds;

		public static ConfigEntry<float> TimeSlowEitr;

		public static ConfigEntry<float> TimeStopRadius;

		public static ConfigEntry<float> TimeStopSeconds;

		public static ConfigEntry<float> TimeStopEitr;

		public static ConfigEntry<bool> TimeBosses;

		public static ConfigEntry<bool> TimePlayerShots;

		public static ConfigEntry<bool> TimeSlowSounds;

		public static ConfigEntry<float> LanternPushSeconds;

		public static ConfigEntry<string> TimeEffects;

		public static ConfigEntry<float> StormSeconds;

		public static ConfigEntry<float> StormCooldown;

		public static ConfigEntry<float> StormEitr;

		public static ConfigEntry<float> StormRadius;

		public static ConfigEntry<string> StormThunder;

		public static ConfigEntry<string> StormCold;

		public static ConfigEntry<string> StormAsh;

		public static ConfigEntry<string> StormEffects;

		public static ConfigEntry<bool> StormWind;

		public static ConfigEntry<bool> StormLightning;

		public static ConfigEntry<float> RosesRadius;

		public static ConfigEntry<float> RosesHeal;

		public static ConfigEntry<float> RosesSeconds;

		public static ConfigEntry<float> RosesEitr;

		public static ConfigEntry<string> RosesEffects;

		public static ConfigEntry<float> LanternRadius;

		public static ConfigEntry<float> LanternSeconds;

		public static ConfigEntry<float> LanternCooldown;

		public static ConfigEntry<float> LanternEitr;

		public static ConfigEntry<string> LanternEffects;

		public static ConfigEntry<float> ClaritySeconds;

		public static ConfigEntry<float> ClarityCooldown;

		public static ConfigEntry<float> ClarityEitr;

		public static ConfigEntry<float> ClarityRadius;

		public static ConfigEntry<string> ClarityWeather;

		public static ConfigEntry<string> ClarityEffects;

		public static ConfigEntry<float> ForceRadius;

		public static ConfigEntry<float> ForceDistance;

		public static ConfigEntry<float> ForceEitr;

		public static ConfigEntry<bool> ForceStagger;

		public static ConfigEntry<bool> ForceBosses;

		public static ConfigEntry<string> ForceEffects;

		public static ConfigEntry<float> LifeReach;

		public static ConfigEntry<float> LifeEitr;

		public static ConfigEntry<string> LifeEffects;

		public static ConfigEntry<float> StormLightningEvery;

		public static ConfigEntry<string> HordeCreature;

		public static ConfigEntry<string> WoodCreature;

		public static ConfigEntry<string> UndeadCreature;

		public static ConfigEntry<string> SeedEffects;

		public static ConfigEntry<int> HordeCount;

		public static ConfigEntry<int> HordeStars;

		public static ConfigEntry<int> WoodStars;

		public static ConfigEntry<int> UndeadCount;

		public static ConfigEntry<int> UndeadStars;

		public static ConfigEntry<float> HordeSize;

		public static ConfigEntry<float> HordeEitr;

		public static ConfigEntry<float> WoodSize;

		public static ConfigEntry<float> WoodEitr;

		public static ConfigEntry<float> UndeadSize;

		public static ConfigEntry<float> UndeadEitr;

		public static ConfigEntry<bool> HordeTame;

		public static ConfigEntry<float> NightSeconds;

		public static ConfigEntry<float> NightRadius;

		public static ConfigEntry<float> NightFade;

		public static ConfigEntry<float> NightCooldown;

		public static ConfigEntry<float> NightEitr;

		public static ConfigEntry<string> NightEffects;

		public static ConfigEntry<float> SunSeconds;

		public static ConfigEntry<float> SunRadius;

		public static ConfigEntry<float> SunFade;

		public static ConfigEntry<float> SunCooldown;

		public static ConfigEntry<float> SunEitr;

		public static ConfigEntry<string> SunEffects;

		public static ConfigEntry<float> ReleaseRadius;

		public static ConfigEntry<float> ReleaseCooldown;

		public static ConfigEntry<float> ReleaseEitr;

		public static ConfigEntry<bool> ReleaseOnlyOwn;

		public static ConfigEntry<string> ReleaseAlso;

		public static ConfigEntry<string> ReleaseEffects;

		public static ConfigEntry<string> ReleaseGoneEffects;

		public static ConfigEntry<float> HailFrost;

		public static ConfigEntry<float> HailFrostPerLevel;

		public static ConfigEntry<float> HailRadius;

		public static ConfigEntry<float> HailDelay;

		public static ConfigEntry<float> HailFreezeChance;

		public static ConfigEntry<float> HailFreezeSeconds;

		public static ConfigEntry<float> HailEitr;

		public static ConfigEntry<bool> HailFreezeBosses;

		public static ConfigEntry<string> HailFallEffects;

		public static ConfigEntry<string> HailHitEffects;

		public static ConfigEntry<float> BeaconSeconds;

		public static ConfigEntry<float> BeaconHeight;

		public static ConfigEntry<float> BeaconRange;

		public static ConfigEntry<float> BeaconBrightness;

		public static ConfigEntry<float> BeaconEitr;

		public static ConfigEntry<string> BeaconEffects;

		public static ConfigEntry<string> DrakeCreature;

		public static ConfigEntry<int> DrakeStars;

		public static ConfigEntry<float> DrakeSize;

		public static ConfigEntry<float> DrakeEitr;

		public static ConfigEntry<float> GravityRadius;

		public static ConfigEntry<float> GravitySeconds;

		public static ConfigEntry<float> GravityReach;

		public static ConfigEntry<float> GravityEitr;

		public static ConfigEntry<bool> GravityBosses;

		public static ConfigEntry<string> GravityEffects;

		public static ConfigEntry<float> DarknessFire;

		public static ConfigEntry<float> DarknessSpirit;

		public static ConfigEntry<float> DarknessLightning;

		public static ConfigEntry<float> DarknessPerLevel;

		public static ConfigEntry<float> DarknessSpeed;

		public static ConfigEntry<float> DarknessDrop;

		public static ConfigEntry<float> DarknessBurst;

		public static ConfigEntry<float> DarknessSpread;

		public static ConfigEntry<float> DarknessEitr;

		public static ConfigEntry<int> DarknessEmbers;

		public static ConfigEntry<string> DarknessEffects;

		public static ConfigEntry<string> DarknessHitEffects;

		public static ConfigEntry<float> PeaceRadius;

		public static ConfigEntry<float> PeaceSeconds;

		public static ConfigEntry<float> PeaceCooldown;

		public static ConfigEntry<float> PeaceEitr;

		public static ConfigEntry<bool> PeaceBosses;

		public static ConfigEntry<string> PeaceEffects;

		public static ConfigEntry<float> ConfusionRadius;

		public static ConfigEntry<float> ConfusionSeconds;

		public static ConfigEntry<float> ConfusionCooldown;

		public static ConfigEntry<float> ConfusionEitr;

		public static ConfigEntry<bool> ConfusionBosses;

		public static ConfigEntry<string> ConfusionEffects;

		public static ConfigEntry<float> StoneLength;

		public static ConfigEntry<float> StoneDepth;

		public static ConfigEntry<float> StoneHeight;

		public static ConfigEntry<float> StoneReach;

		public static ConfigEntry<float> StoneSeconds;

		public static ConfigEntry<float> StoneHealth;

		public static ConfigEntry<float> StoneEitr;

		public static ConfigEntry<string> StoneRock;

		public static ConfigEntry<string> StoneEffects;

		public static ConfigEntry<float> IllnessRadius;

		public static ConfigEntry<float> IllnessSeconds;

		public static ConfigEntry<float> IllnessCooldown;

		public static ConfigEntry<float> IllnessEvery;

		public static ConfigEntry<float> IllnessPoison;

		public static ConfigEntry<float> IllnessPoisonPerLevel;

		public static ConfigEntry<float> IllnessEitr;

		public static ConfigEntry<bool> IllnessBosses;

		public static ConfigEntry<string> IllnessEffects;

		public static void Bind(ConfigFile config)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Expected O, but got Unknown
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Expected O, but got Unknown
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_070f: Expected O, but got Unknown
			//IL_073d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0747: Expected O, but got Unknown
			//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c5: Expected O, but got Unknown
			//IL_112e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1138: Expected O, but got Unknown
			//IL_1166: Unknown result type (might be due to invalid IL or missing references)
			//IL_1170: Expected O, but got Unknown
			//IL_11d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_11da: Expected O, but got Unknown
			//IL_1208: Unknown result type (might be due to invalid IL or missing references)
			//IL_1212: Expected O, but got Unknown
			//IL_127e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1288: Expected O, but got Unknown
			HordeCreature = config.Bind<string>("Staff of Hordes", "Creature", "Goblin", "Prefab name of the creature the staff calls up where its shot lands. Goblin is the game's name for the fuling.");
			HordeCount = config.Bind<int>("Staff of Hordes", "Count", 6, new ConfigDescription("How many of them.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 30), Array.Empty<object>()));
			HordeStars = config.Bind<int>("Staff of Hordes", "Stars", 2, new ConfigDescription("Their stars. Two stars is what the game calls level 3.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>()));
			HordeSize = config.Bind<float>("Staff of Hordes", "Size", 1f, new ConfigDescription("How many times their normal size they are.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>()));
			HordeTame = config.Bind<bool>("Staff of Hordes", "Tame", true, "Whether they are tame and fight for the caster. Off: they are wild, and fight the caster too.");
			HordeEitr = config.Bind<float>("Staff of Hordes", "Eitr", 90f, "Eitr the spell costs. Takes effect on the next launch.");
			SeedEffects = config.Bind<string>("Staff of Hordes", "ShotEffects", "sfx_firestaff_launch,sfx_imp_fireball_launch", "Game effect played at the staff when the Staffs of Hordes, Wood or Hail shoot: the first of these names that the game has. 'none' for nothing.");
			WoodCreature = config.Bind<string>("Staff of Wood", "Creature", "Abomination", "Prefab name of the creature the staff calls up where its shot lands.");
			WoodStars = config.Bind<int>("Staff of Wood", "Stars", 2, new ConfigDescription("Its stars. Two stars is what the game calls level 3.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>()));
			WoodSize = config.Bind<float>("Staff of Wood", "Size", 1f, new ConfigDescription("How many times its normal size it is.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>()));
			WoodEitr = config.Bind<float>("Staff of Wood", "Eitr", 90f, "Eitr the spell costs. Takes effect on the next launch.");
			UndeadCreature = config.Bind<string>("Staff of Undead", "Creature", "Skeleton", "Prefab name of the creature the staff calls up round the caster.");
			UndeadCount = config.Bind<int>("Staff of Undead", "Count", 12, new ConfigDescription("How many of them.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 30), Array.Empty<object>()));
			UndeadStars = config.Bind<int>("Staff of Undead", "Stars", 0, new ConfigDescription("Their stars.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>()));
			UndeadSize = config.Bind<float>("Staff of Undead", "Size", 1f, new ConfigDescription("How many times their normal size they are.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>()));
			UndeadEitr = config.Bind<float>("Staff of Undead", "Eitr", 100f, "Eitr the spell costs. Takes effect on the next launch.");
			NightSeconds = config.Bind<float>("Staff of Night", "Seconds", 120f, "How long the night lasts.");
			NightRadius = config.Bind<float>("Staff of Night", "Radius", 300f, "It is night for everyone within this many metres of where the staff was used.");
			NightFade = config.Bind<float>("Staff of Night", "Fade", 5f, "Seconds the sky takes to turn to night.");
			NightCooldown = config.Bind<float>("Staff of Night", "Cooldown", 0f, "Seconds before the staff can be used again. 0: at once.");
			NightEitr = config.Bind<float>("Staff of Night", "Eitr", 40f, "Eitr the spell costs. Takes effect on the next launch.");
			NightEffects = config.Bind<string>("Staff of Night", "CastEffects", "fx_shield_start,sfx_dverger_heal_finish", "Game effect played at the caster.");
			SunSeconds = config.Bind<float>("Staff of Sun", "Seconds", 120f, "How long the day lasts.");
			SunRadius = config.Bind<float>("Staff of Sun", "Radius", 300f, "It is day for everyone within this many metres of where the staff was used.");
			SunFade = config.Bind<float>("Staff of Sun", "Fade", 5f, "Seconds the sky takes to turn to day.");
			SunCooldown = config.Bind<float>("Staff of Sun", "Cooldown", 0f, "Seconds before the staff can be used again. 0: at once.");
			SunEitr = config.Bind<float>("Staff of Sun", "Eitr", 40f, "Eitr the spell costs. Takes effect on the next launch.");
			SunEffects = config.Bind<string>("Staff of Sun", "CastEffects", "fx_shield_start,sfx_dverger_heal_finish", "Game effect played at the caster: the first of these names that the game has. 'none' for nothing.");
			ReleaseRadius = config.Bind<float>("Staff of Release", "Radius", 25f, "Summoned creatures within this many metres of the caster are sent away. Measured along the ground, so one flying overhead counts.");
			ReleaseOnlyOwn = config.Bind<bool>("Staff of Release", "OnlyOwn", false, "Off: every creature summoned with one of these staffs goes, whoever called it. On: only the caster's own, and none of the game's.");
			ReleaseAlso = config.Bind<string>("Staff of Release", "AlsoCreatures", "Skeleton_Friendly,Troll_Summoned", "Creatures of the game's own summoning staffs that are sent away too, by prefab name. Empty for none.");
			ReleaseCooldown = config.Bind<float>("Staff of Release", "Cooldown", 0f, "Seconds before the staff can be used again. 0: at once.");
			ReleaseEitr = config.Bind<float>("Staff of Release", "Eitr", 20f, "Eitr the spell costs. Takes effect on the next launch.");
			ReleaseEffects = config.Bind<string>("Staff of Release", "CastEffects", "fx_shield_start,sfx_dverger_heal_finish", "Game effect played at the caster: the first of these names that the game has. 'none' for nothing.");
			ReleaseGoneEffects = config.Bind<string>("Staff of Release", "GoneEffects", "fx_summon_skeleton_spawn,fx_summon_start", "Game effect played where each creature was. 'none' for nothing.");
			HailFrost = config.Bind<float>("Staff of Hail", "FrostDamage", 90f, "Frost damage of the burst, before the caster's Elemental Magic skill. Frost slows what it hits, as it does in the game. Takes effect on the next launch.");
			HailFrostPerLevel = config.Bind<float>("Staff of Hail", "FrostDamagePerLevel", 9f, "Added by each upgrade of the staff. Takes effect on the next launch.");
			HailRadius = config.Bind<float>("Staff of Hail", "Radius", 10f, "Radius of the burst, in metres.");
			HailDelay = config.Bind<float>("Staff of Hail", "Delay", 1.2f, "Seconds between the shot landing and the ice arriving.");
			HailFreezeChance = config.Bind<float>("Staff of Hail", "FreezeChance", 50f, new ConfigDescription("Chance, in percent, that an enemy in the burst is frozen where it stands.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			HailFreezeSeconds = config.Bind<float>("Staff of Hail", "FreezeSeconds", 5f, "How long a frozen enemy stays frozen.");
			HailFreezeBosses = config.Bind<bool>("Staff of Hail", "FreezeBosses", false, "Whether bosses can be frozen by it. They take the frost damage either way.");
			HailEitr = config.Bind<float>("Staff of Hail", "Eitr", 45f, "Eitr the spell costs. Takes effect on the next launch.");
			HailFallEffects = config.Bind<string>("Staff of Hail", "FallEffects", "sfx_dverger_ice_projectile_start", "Game effect played as the ice starts to fall.");
			HailHitEffects = config.Bind<string>("Staff of Hail", "HitEffects", "sfx_ice_destroyed", "Game effect played where the ice bursts.");
			BeaconSeconds = config.Bind<float>("Staff of Light", "Seconds", 180f, "How long the light hangs above the caster. Casting again starts it afresh.");
			BeaconHeight = config.Bind<float>("Staff of Light", "Height", 15f, "How far above the caster the light hangs, in metres.");
			BeaconRange = config.Bind<float>("Staff of Light", "Range", 60f, "How far the light reaches, in metres.");
			BeaconBrightness = config.Bind<float>("Staff of Light", "Brightness", 1.5f, "How bright the light is. A torch in the game is about 1.5.");
			BeaconEitr = config.Bind<float>("Staff of Light", "Eitr", 20f, "Eitr the spell costs. Takes effect on the next launch.");
			BeaconEffects = config.Bind<string>("Staff of Light", "CastEffects", "fx_shield_start,sfx_dverger_heal_finish", "Game effect played at the caster when the light is made: the first of these names that the game has. 'none' for nothing.");
			DrakeCreature = config.Bind<string>("Staff of Drakes", "Creature", "Hatchling", "Prefab name of the creature the staff summons. Hatchling is the game's name for the drake.");
			DrakeStars = config.Bind<int>("Staff of Drakes", "Stars", 2, new ConfigDescription("Stars of the summoned creature. Two stars is what the game calls level 3.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>()));
			DrakeSize = config.Bind<float>("Staff of Drakes", "Size", 2.5f, new ConfigDescription("How many times its normal size the creature is.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>()));
			DrakeEitr = config.Bind<float>("Staff of Drakes", "Eitr", 80f, "Eitr the summoning costs. Takes effect on the next launch.");
			GravityRadius = config.Bind<float>("Staff of Gravity", "Radius", 10f, "Enemies within this many metres of the spot are drawn in.");
			GravitySeconds = config.Bind<float>("Staff of Gravity", "Seconds", 10f, "How long they are held in the middle.");
			GravityReach = config.Bind<float>("Staff of Gravity", "Reach", 30f, "How far from the caster the spot may be, in metres.");
			GravityBosses = config.Bind<bool>("Staff of Gravity", "HoldBosses", true, "Whether bosses are drawn in too.");
			GravityEitr = config.Bind<float>("Staff of Gravity", "Eitr", 40f, "Eitr the spell costs. Takes effect on the next launch.");
			GravityEffects = config.Bind<string>("Staff of Gravity", "CastEffects", "fx_shield_start,sfx_stonegolem_attack_wosh", "Game effect played at the spot.");
			DarknessFire = config.Bind<float>("Staff of Darkness", "FireDamage", 30f, "Fire damage of one ember, before the caster's Elemental Magic skill. Fire burns on after the hit, as it does in the game. Takes effect on the next launch.");
			DarknessSpirit = config.Bind<float>("Staff of Darkness", "SpiritDamage", 20f, "Spirit damage of one ember. Takes effect on the next launch.");
			DarknessLightning = config.Bind<float>("Staff of Darkness", "LightningDamage", 20f, "Lightning damage of one ember. Takes effect on the next launch.");
			DarknessPerLevel = config.Bind<float>("Staff of Darkness", "DamagePerLevel", 3f, "Added to each of the three by each upgrade of the staff. Takes effect on the next launch.");
			DarknessEmbers = config.Bind<int>("Staff of Darkness", "Embers", 3, new ConfigDescription("How many embers one cast shoots.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 9), Array.Empty<object>()));
			DarknessSpread = config.Bind<float>("Staff of Darkness", "Spread", 10f, "The angle the embers of one cast fan out over, in degrees.");
			DarknessSpeed = config.Bind<float>("Staff of Darkness", "Speed", 28f, "How fast an ember flies, in metres a second.");
			DarknessDrop = config.Bind<float>("Staff of Darkness", "Drop", 4f, "How hard an ember is pulled down as it flies. The world's own pull is 9.8.");
			DarknessBurst = config.Bind<float>("Staff of Darkness", "BurstRadius", 2f, "Enemies within this many metres of where an ember lands are hurt by it.");
			DarknessEitr = config.Bind<float>("Staff of Darkness", "Eitr", 15f, "Eitr one cast costs. Takes effect on the next launch.");
			DarknessEffects = config.Bind<string>("Staff of Darkness", "CastEffects", "sfx_firestaff_launch,sfx_imp_fireball_launch", "Game effect played at the staff when it is cast.");
			DarknessHitEffects = config.Bind<string>("Staff of Darkness", "HitEffects", "sfx_imp_fireball_explode,sfx_stafforbofahri_explosion", "Game effect played where an ember lands.");
			PeaceRadius = config.Bind<float>("Staff of Peace", "Radius", 50f, "Enemies within this many metres of the caster lay down their anger.");
			PeaceSeconds = config.Bind<float>("Staff of Peace", "Seconds", 60f, "How long they stay at peace.");
			PeaceCooldown = config.Bind<float>("Staff of Peace", "Cooldown", 180f, "Seconds before the staff can be used again.");
			PeaceBosses = config.Bind<bool>("Staff of Peace", "CalmBosses", true, "Whether bosses are calmed too.");
			PeaceEitr = config.Bind<float>("Staff of Peace", "Eitr", 60f, "Eitr the spell costs. Takes effect on the next launch.");
			PeaceEffects = config.Bind<string>("Staff of Peace", "CastEffects", "sfx_dverger_heal_finish,fx_shield_start", "Game effect played at the caster.");
			ConfusionRadius = config.Bind<float>("Staff of Confusion", "Radius", 25f, "Enemies within this many metres of the caster turn on each other.");
			ConfusionSeconds = config.Bind<float>("Staff of Confusion", "Seconds", 60f, "How long they stay confused.");
			ConfusionCooldown = config.Bind<float>("Staff of Confusion", "Cooldown", 180f, "Seconds before the staff can be used again.");
			ConfusionBosses = config.Bind<bool>("Staff of Confusion", "ConfuseBosses", true, "Whether bosses are confused too.");
			ConfusionEitr = config.Bind<float>("Staff of Confusion", "Eitr", 60f, "Eitr the spell costs. Takes effect on the next launch.");
			ConfusionEffects = config.Bind<string>("Staff of Confusion", "CastEffects", "fx_shield_start,sfx_dverger_heal_start", "Game effect played at the caster.");
			StoneLength = config.Bind<float>("Staff of Stone", "Length", 5f, "How long the wall is from side to side, in metres.");
			StoneDepth = config.Bind<float>("Staff of Stone", "Depth", 1f, "How thick the wall is, in metres.");
			StoneHeight = config.Bind<float>("Staff of Stone", "Height", 3f, "How high the wall stands above the ground, in metres.");
			StoneReach = config.Bind<float>("Staff of Stone", "Reach", 25f, "How far from the caster the wall may be raised, in metres.");
			StoneSeconds = config.Bind<float>("Staff of Stone", "Seconds", 0f, "How long a wall stands before it goes by itself. 0: until it is broken.");
			StoneHealth = config.Bind<float>("Staff of Stone", "Health", 300f, "How much damage a wall takes before it breaks. It gives nothing when it breaks. Takes effect on the next launch.");
			StoneRock = config.Bind<string>("Staff of Stone", "Rock", "Rock_3,rock_mistlands1,HeathRockPillar", "The game's rock the wall is a copy of: the first of these names that the game has. Takes effect on the next launch.");
			StoneEitr = config.Bind<float>("Staff of Stone", "Eitr", 30f, "Eitr the spell costs. Takes effect on the next launch.");
			StoneEffects = config.Bind<string>("Staff of Stone", "CastEffects", "sfx_rock_destroyed,sfx_rock_hit", "Game effect played where the wall rises.");
			IllnessRadius = config.Bind<float>("Staff of Illness", "Radius", 25f, "Radius of the circle of sickness, in metres.");
			IllnessSeconds = config.Bind<float>("Staff of Illness", "Seconds", 60f, "How long the circle lasts.");
			IllnessCooldown = config.Bind<float>("Staff of Illness", "Cooldown", 180f, "Seconds before the staff can be used again.");
			IllnessEvery = config.Bind<float>("Staff of Illness", "Every", 2f, "Every this many seconds, each enemy in the circle is poisoned anew.");
			IllnessPoison = config.Bind<float>("Staff of Illness", "Poison", 25f, "Poison damage each time, before the caster's Elemental Magic skill. Poison works over some seconds, as it does in the game. Takes effect on the next launch.");
			IllnessPoisonPerLevel = config.Bind<float>("Staff of Illness", "PoisonPerLevel", 3f, "Added by each upgrade of the staff. Takes effect on the next launch.");
			IllnessBosses = config.Bind<bool>("Staff of Illness", "PoisonBosses", true, "Whether bosses are poisoned too.");
			IllnessEitr = config.Bind<float>("Staff of Illness", "Eitr", 50f, "Eitr the spell costs. Takes effect on the next launch.");
			IllnessEffects = config.Bind<string>("Staff of Illness", "CastEffects", "sfx_Poison_Start,sfx_skeleton_poison_verse_attack", "Game effect played at the caster.");
			LanternRadius = config.Bind<float>("Soul Lantern Staff", "Radius", 200f, "The mist is cleared for this many metres round the caster, and the clearing moves with them.");
			LanternSeconds = config.Bind<float>("Soul Lantern Staff", "Seconds", 60f, "How long the mist stays away.");
			LanternPushSeconds = config.Bind<float>("Soul Lantern Staff", "PushSeconds", 3f, "How long the mist takes to be pushed back from the caster to the edge of the clearing. 0 clears it at once, as before 1.1.16.");
			LanternCooldown = config.Bind<float>("Soul Lantern Staff", "Cooldown", 120f, "Seconds before the staff can be used again.");
			LanternEitr = config.Bind<float>("Soul Lantern Staff", "Eitr", 40f, "Eitr the spell costs. Takes effect on the next launch.");
			LanternEffects = config.Bind<string>("Soul Lantern Staff", "CastEffects", "sfx_demister_start,fx_shield_start", "Game effect played at the caster when the mist is cleared: the first of these names that the game has. 'none' for nothing.");
			ClaritySeconds = config.Bind<float>("Staff of Clarity", "Seconds", 180f, "How long the weather stays clear.");
			ClarityCooldown = config.Bind<float>("Staff of Clarity", "Cooldown", 300f, "Seconds before the staff can be used again.");
			ClarityEitr = config.Bind<float>("Staff of Clarity", "Eitr", 50f, "Eitr the spell costs. Takes effect on the next launch.");
			ClarityRadius = config.Bind<float>("Staff of Clarity", "Radius", 300f, "The weather is clear for everyone within this many metres of where the staff was used.");
			ClarityWeather = config.Bind<string>("Staff of Clarity", "Weather", "Clear,Twilight_Clear", "The game's name for clear weather: the first of these names that the game has.");
			ClarityEffects = config.Bind<string>("Staff of Clarity", "CastEffects", "fx_shield_start,sfx_dverger_heal_finish", "Game effect played at the caster when the sky is cleared.");
			ForceRadius = config.Bind<float>("Staff of Force", "Radius", 15f, "Enemies within this many metres of the caster are thrown.");
			ForceDistance = config.Bind<float>("Staff of Force", "Distance", 12f, "How far they are thrown, in metres, straight away from the caster. A little over the 10 asked for, since rough ground stops some short.");
			ForceStagger = config.Bind<bool>("Staff of Force", "Stagger", true, "Whether the thrown enemies are staggered as well.");
			ForceBosses = config.Bind<bool>("Staff of Force", "ThrowBosses", true, "Whether bosses are thrown too.");
			ForceEitr = config.Bind<float>("Staff of Force", "Eitr", 30f, "Eitr the spell costs. Takes effect on the next launch.");
			ForceEffects = config.Bind<string>("Staff of Force", "CastEffects", "fx_shield_start,sfx_stonegolem_attack_hit", "Game effect played at the caster when the force goes out.");
			LifeReach = config.Bind<float>("Staff of Life", "Reach", 12f, "How far away, in metres, the sapling aimed at may be.");
			LifeEitr = config.Bind<float>("Staff of Life", "Eitr", 30f, "Eitr the spell costs. Takes effect on the next launch.");
			LifeEffects = config.Bind<string>("Staff of Life", "CastEffects", "sfx_greydwarf_shaman_heal,sfx_dverger_heal_start", "Game effect played at the plant as it grows.");
			BoltDamage = config.Bind<float>("Staff of Negative Energy", "BoltDamage", 120f, "Lightning damage of the bolt, before the caster's Elemental Magic skill. It is the staff's own damage, so it shows on the item. Takes effect on the next launch.");
			BoltDamagePerLevel = config.Bind<float>("Staff of Negative Energy", "BoltDamagePerLevel", 12f, "Lightning damage added by each upgrade of the staff. Takes effect on the next launch.");
			BoltRange = config.Bind<float>("Staff of Negative Energy", "BoltRange", 45f, "How far the bolt reaches, in metres.");
			BoltEitr = config.Bind<float>("Staff of Negative Energy", "BoltEitr", 20f, "Eitr one bolt costs. Takes effect on the next launch.");
			StrikeDamageFactor = config.Bind<float>("Staff of Negative Energy", "StrikeDamageFactor", 1.5f, "The bolt called down on the caster (second attack) does the staff's damage times this, to every enemy in its circle.");
			StrikeRadius = config.Bind<float>("Staff of Negative Energy", "StrikeRadius", 8f, "Radius of that circle, in metres.");
			StrikeEitr = config.Bind<float>("Staff of Negative Energy", "StrikeEitr", 50f, "Eitr the second attack costs. Takes effect on the next launch.");
			BoltEffects = config.Bind<string>("Staff of Negative Energy", "BoltEffects", "sfx_staff_lightning_fire,sfx_StaffLightning_fire", "Game effect played at the staff when a bolt is cast: the first of these names that the game has. 'none' for nothing.");
			BoltHitEffects = config.Bind<string>("Staff of Negative Energy", "BoltHitEffects", "fx_chainlightning_hit,sfx_weapons_lightning_impact", "Game effect played where the bolt lands.");
			StrikeEffects = config.Bind<string>("Staff of Negative Energy", "StrikeEffects", "sfx_staffthunderblood_thunder,sfx_thunder", "Game effect played where the bolt from the sky lands.");
			GolemCreature = config.Bind<string>("Staff of Golem", "Creature", "StoneGolem", "Prefab name of the creature the staff summons.");
			GolemStars = config.Bind<int>("Staff of Golem", "Stars", 4, new ConfigDescription("Stars of the summoned creature. The game itself has none above 2; each star adds the creature's base health again and half its damage.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>()));
			GolemSize = config.Bind<float>("Staff of Golem", "Size", 2f, new ConfigDescription("How many times its normal size the creature is.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>()));
			GolemEitr = config.Bind<float>("Staff of Golem", "Eitr", 100f, "Eitr the summoning costs. Takes effect on the next launch.");
			DemonCreature = config.Bind<string>("Staff of Demons", "Creature", "Surtling", "Prefab name of the creature the staff summons.");
			DemonStars = config.Bind<int>("Staff of Demons", "Stars", 3, new ConfigDescription("Stars of the summoned creature.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>()));
			DemonSize = config.Bind<float>("Staff of Demons", "Size", 3f, new ConfigDescription("How many times its normal size the creature is.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>()));
			DemonEitr = config.Bind<float>("Staff of Demons", "Eitr", 80f, "Eitr the summoning costs. Takes effect on the next launch.");
			SummonEffects = config.Bind<string>("Staff of Demons", "SummonEffects", "fx_summon_skeleton_spawn,fx_summon_start", "Game effect played where a creature is summoned or sent away, for both summoning staffs.");
			TimeSlowSpeed = config.Bind<float>("Staff of Time", "SlowSpeed", 10f, new ConfigDescription("Attack: how fast time runs in the bubble, in percent of normal; 10 is ten seconds of the bubble to one of yours.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 90f), Array.Empty<object>()));
			TimeSlowRadius = config.Bind<float>("Staff of Time", "SlowRadius", 30f, "Attack: time slows within this many metres of the caster, the bubble moving with them.");
			TimeSlowSeconds = config.Bind<float>("Staff of Time", "SlowSeconds", 30f, "Attack: how long time stays slow.");
			TimeSlowEitr = config.Bind<float>("Staff of Time", "SlowEitr", 60f, "Eitr the attack costs. Takes effect on the next launch.");
			TimeStopRadius = config.Bind<float>("Staff of Time", "StopRadius", 30f, "Second attack: time stops within this many metres of the caster, the bubble moving with them.");
			TimeStopSeconds = config.Bind<float>("Staff of Time", "StopSeconds", 15f, "Second attack: how long time stays stopped.");
			TimeStopEitr = config.Bind<float>("Staff of Time", "StopEitr", 80f, "Eitr the second attack costs. Takes effect on the next launch.");
			TimeCooldown = config.Bind<float>("Staff of Time", "Cooldown", 120f, "Seconds before the staff can be used again, after either attack.");
			TimeBosses = config.Bind<bool>("Staff of Time", "FreezeBosses", true, "Whether bosses are slowed and stopped too.");
			TimePlayerShots = config.Bind<bool>("Staff of Time", "PlayerShots", true, "Whether players' arrows and spells slow and stop in the bubble too, the caster's own among them. Creatures' always do.");
			TimeSlowSounds = config.Bind<bool>("Staff of Time", "SlowSounds", true, "Sounds in the bubble slow down too, and stop where time stops. Only on this computer.");
			TimeSeconds = config.Bind<float>("Staff of Time", "Seconds", 30f, "How long a creature frozen by the status effect SkaStaffs_TimeFreeze stays frozen. The staff no longer uses it since 1.1.16; kept for creatures frozen by an older version.");
			TimeEffects = config.Bind<string>("Staff of Time", "CastEffects", "fx_shield_start_frost,sfx_stafffrostorbs_cast", "Game effect played at the caster when time slows or stops.");
			StormSeconds = config.Bind<float>("Staff of Storms", "Seconds", 60f, "How long the storm lasts.");
			StormCooldown = config.Bind<float>("Staff of Storms", "Cooldown", 180f, "Seconds before the staff can be used again.");
			StormEitr = config.Bind<float>("Staff of Storms", "Eitr", 60f, "Eitr the spell costs. Takes effect on the next launch.");
			StormRadius = config.Bind<float>("Staff of Storms", "Radius", 300f, "The storm is over everyone within this many metres of where it was called.");
			StormThunder = config.Bind<string>("Staff of Storms", "Weather", "ThunderStorm", "The game's name for the weather of the storm, where it is neither cold nor the Ashlands. The first of these names that the game has.");
			StormCold = config.Bind<string>("Staff of Storms", "ColdWeather", "SnowStorm,Twilight_SnowStorm,Snow", "The weather in the Mountain and the Deep North.");
			StormAsh = config.Bind<string>("Staff of Storms", "AshlandsWeather", "Ashlands_storm,Ashlands_CinderRain,Ashlands_ashrain", "The weather in the Ashlands.");
			StormWind = config.Bind<bool>("Staff of Storms", "FullWind", true, "Whether the wind blows at full strength for as long as the storm lasts.");
			StormLightning = config.Bind<bool>("Staff of Storms", "ExtraLightning", true, "Whether bolts of lightning come down round the players every few seconds while it thunders. They are for show and hurt nobody.");
			StormLightningEvery = config.Bind<float>("Staff of Storms", "LightningEvery", 10f, "Seconds between those bolts, on average. It was 2.5 before 0.4.0.");
			StormEffects = config.Bind<string>("Staff of Storms", "ThunderEffects", "sfx_staffthunderblood_thunder,sfx_staffthunderblood_cast", "Game effect played with each of those bolts, and when the storm is called.");
			RosesRadius = config.Bind<float>("Staff of Roses", "Radius", 12f, "Radius of the healing circle, in metres.");
			RosesHeal = config.Bind<float>("Staff of Roses", "Heal", 200f, "Health the circle gives back, in all, to each one standing in it for its whole time.");
			RosesSeconds = config.Bind<float>("Staff of Roses", "Seconds", 10f, "How long the circle lasts.");
			RosesEitr = config.Bind<float>("Staff of Roses", "Eitr", 50f, "Eitr the spell costs. Takes effect on the next launch.");
			RosesEffects = config.Bind<string>("Staff of Roses", "CastEffects", "sfx_dverger_heal_start,sfx_greydwarf_shaman_heal", "Game effect played at the caster when the circle is made.");
		}
	}
	internal static class Abilities
	{
		[HarmonyPatch(typeof(Attack), "Start")]
		private static class Attack_Start_Patch
		{
			private static bool Prefix(Humanoid character, ItemData weapon, ref bool __result)
			{
				Player val = (Player)(object)((character is Player) ? character : null);
				if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer || !TryGet(weapon, out StaffDef def))
				{
					return true;
				}
				float num = RechargeLeft(val, def);
				if (num <= 0f)
				{
					if (def.Ability != Ability.Release || Summons.AnyToRelease(val))
					{
						return true;
					}
					((Character)val).Message((MessageType)2, $"No summoned creature within {Settings.ReleaseRadius.Value:0} m", 0, (Sprite)null, false);
					__result = false;
					return false;
				}
				((Character)val).Message((MessageType)2, $"{def.Name} is recharging: {Mathf.CeilToInt(num)} s", 0, (Sprite)null, false);
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Attack), "OnAttackTrigger")]
		private static class Attack_OnAttackTrigger_Patch
		{
			private static bool Prefix(Humanoid ___m_character, ItemData ___m_weapon)
			{
				if (!TryGet(___m_weapon, out StaffDef def))
				{
					return true;
				}
				Player val = (Player)(object)((___m_character is Player) ? ___m_character : null);
				if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer)
				{
					return false;
				}
				if (((Character)val).IsStaggering())
				{
					return false;
				}
				bool secondary = false;
				try
				{
					if (s_isSecondary != null)
					{
						secondary = s_isSecondary.Invoke((Humanoid)(object)val);
					}
				}
				catch (Exception)
				{
					secondary = false;
				}
				try
				{
					Use(val, def, ___m_weapon, secondary);
				}
				catch (Exception arg)
				{
					StaffsPlugin.Log.LogError((object)$"{def.Name} failed: {arg}");
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class ZNetScene_Awake_Patch
		{
			private static void Postfix()
			{
				Net.Register();
				TimeBubble.Reset();
				Storm.Reset();
				Night.Reset();
				Summons.Reset();
			}
		}

		[HarmonyPatch(typeof(Character), "Awake")]
		private static class Character_Awake_Patch
		{
			private static void Postfix(Character __instance)
			{
				Summons.ApplySize(__instance);
			}
		}

		[HarmonyPatch(typeof(MonsterAI), "UpdateAI")]
		private static class MonsterAI_UpdateAI_Patch
		{
			private static bool Prefix(MonsterAI __instance, ref bool __result)
			{
				if (!TimeFreeze.IsHeld((BaseAI)(object)__instance))
				{
					return true;
				}
				__result = true;
				return false;
			}
		}

		[HarmonyPatch(typeof(AnimalAI), "UpdateAI")]
		private static class AnimalAI_UpdateAI_Patch
		{
			private static bool Prefix(AnimalAI __instance, ref bool __result)
			{
				if (!TimeFreeze.IsHeld((BaseAI)(object)__instance))
				{
					return true;
				}
				__result = true;
				return false;
			}
		}

		[HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")]
		private static class CharacterAnimEvent_CustomFixedUpdate_Patch
		{
			private static void Prefix(Character ___m_character, Animator ___m_animator)
			{
				TimeFreeze.BeforeAnimation(___m_character, ___m_animator);
				TimeBubble.BeforeAnimation(___m_character, ___m_animator);
			}

			private static void Postfix(Character ___m_character, Animator ___m_animator)
			{
				TimeFreeze.AfterAnimation(___m_character, ___m_animator);
				if (!TimeFreeze.Holds(___m_character))
				{
					TimeBubble.AfterAnimation(___m_character, ___m_animator);
				}
			}
		}

		[HarmonyPatch(typeof(BaseAI), "IsEnemy", new Type[]
		{
			typeof(Character),
			typeof(Character)
		})]
		private static class BaseAI_IsEnemy_Patch
		{
			private static void Postfix(Character a, Character b, ref bool __result)
			{
				Minds.Judge(a, b, ref __result);
			}
		}

		[HarmonyPatch(typeof(Humanoid), "StartAttack")]
		private static class Humanoid_StartAttack_Patch
		{
			private static bool Prefix(Humanoid __instance, ref bool __result)
			{
				if (!Minds.IsAtPeace((Character)(object)__instance))
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(EnemyHud), "ShowHud")]
		private static class EnemyHud_ShowHud_Patch
		{
			private static void Postfix(Character c, object ___m_huds)
			{
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					if ((Object)(object)c == (Object)null || c.GetLevel() < 4 || !Summons.IsSummon(c) || !(___m_huds is IDictionary dictionary) || !dictionary.Contains(c))
					{
						return;
					}
					object obj = dictionary[c];
					object? obj2 = AccessTools.Field(obj.GetType(), "m_gui")?.GetValue(obj);
					GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null);
					if (!Object.op_Implicit((Object)(object)val) || Object.op_Implicit((Object)(object)val.transform.Find("ska_stars")))
					{
						return;
					}
					Transform val2 = val.transform.Find("level_3");
					if (!Object.op_Implicit((Object)(object)val2) || val2.childCount < 2)
					{
						return;
					}
					GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, val2.parent);
					((Object)val3).name = "ska_stars";
					val3.SetActive(true);
					Transform child = val3.transform.GetChild(0);
					Transform child2 = val3.transform.GetChild(1);
					Vector3 val4 = child2.localPosition - child.localPosition;
					int num = Mathf.Min(c.GetLevel() - 1, 5);
					for (int i = 2; i < num; i++)
					{
						Object.Instantiate<GameObject>(((Component)child2).gameObject, val3.transform).transform.localPosition = child.localPosition + val4 * (float)i;
					}
					foreach (Transform item in val3.transform)
					{
						item.localPosition -= val4 * (float)(num - 2) / 2f;
					}
				}
				catch (Exception ex)
				{
					StaffsPlugin.Log.LogWarning((object)("The stars over a summoned creature could not be drawn: " + ex.Message));
				}
			}
		}

		private static readonly Dictionary<string, StaffDef> s_byToken = new Dictionary<string, StaffDef>();

		private static readonly Dictionary<Ability, StatusEffect> s_recharging = new Dictionary<Ability, StatusEffect>();

		private static FieldRef<Humanoid, bool>? s_isSecondary;

		public static void Register()
		{
			foreach (StaffDef item in StaffDefs.All)
			{
				s_byToken["$" + item.NameToken] = item;
			}
			try
			{
				s_isSecondary = AccessTools.FieldRefAccess<Humanoid, bool>("m_currentAttackIsSecondary");
			}
			catch (Exception ex)
			{
				StaffsPlugin.Log.LogWarning((object)("The second attack cannot be told from the first in this game version (" + ex.Message + "); the Staffs of Negative Energy and Time only cast their first attack."));
			}
		}

		public static bool TryGet(ItemData? weapon, out StaffDef def)
		{
			def = null;
			if (weapon != null && weapon.m_shared != null && s_byToken.TryGetValue(weapon.m_shared.m_name, out def))
			{
				return def.Ability != Ability.None;
			}
			return false;
		}

		public static void Configure(StaffDef def, SharedData shared)
		{
			//IL_0029: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: 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_067d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_061a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			if (def.Ability != Ability.None)
			{
				shared.m_damages = default(DamageTypes);
				shared.m_damagesPerLevel = default(DamageTypes);
				shared.m_attackStatusEffect = null;
				shared.m_secondaryAttack = new Attack();
				switch (def.Ability)
				{
				case Ability.NegativeEnergy:
					shared.m_skillType = (SkillType)9;
					shared.m_damages.m_lightning = Settings.BoltDamage.Value;
					shared.m_damagesPerLevel.m_lightning = Settings.BoltDamagePerLevel.Value;
					shared.m_attack = Cast("StaffFireball", Settings.BoltEitr.Value);
					shared.m_secondaryAttack = Cast("StaffShield", Settings.StrikeEitr.Value);
					break;
				case Ability.Golem:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffGreenRoots", Settings.GolemEitr.Value);
					break;
				case Ability.Demons:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffGreenRoots", Settings.DemonEitr.Value);
					break;
				case Ability.Time:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.TimeSlowEitr.Value);
					shared.m_secondaryAttack = Cast("StaffFireball", Settings.TimeStopEitr.Value);
					break;
				case Ability.Storms:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.StormEitr.Value);
					break;
				case Ability.Roses:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffShield", Settings.RosesEitr.Value);
					break;
				case Ability.Lantern:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.LanternEitr.Value);
					break;
				case Ability.Clarity:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.ClarityEitr.Value);
					break;
				case Ability.Force:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.ForceEitr.Value);
					break;
				case Ability.Life:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffGreenRoots", Settings.LifeEitr.Value);
					break;
				case Ability.Light:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.BeaconEitr.Value);
					break;
				case Ability.Drakes:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffGreenRoots", Settings.DrakeEitr.Value);
					break;
				case Ability.Gravity:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffFireball", Settings.GravityEitr.Value);
					break;
				case Ability.Darkness:
					shared.m_skillType = (SkillType)9;
					shared.m_damages.m_fire = Settings.DarknessFire.Value;
					shared.m_damages.m_spirit = Settings.DarknessSpirit.Value;
					shared.m_damages.m_lightning = Settings.DarknessLightning.Value;
					shared.m_damagesPerLevel.m_fire = (shared.m_damagesPerLevel.m_spirit = (shared.m_damagesPerLevel.m_lightning = Settings.DarknessPerLevel.Value));
					shared.m_attack = Cast("StaffFireball", Settings.DarknessEitr.Value);
					break;
				case Ability.Peace:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffShield", Settings.PeaceEitr.Value);
					break;
				case Ability.Stone:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffFireball", Settings.StoneEitr.Value);
					break;
				case Ability.Confusion:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffShield", Settings.ConfusionEitr.Value);
					break;
				case Ability.Hordes:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffFireball", Settings.HordeEitr.Value);
					break;
				case Ability.Wood:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffFireball", Settings.WoodEitr.Value);
					break;
				case Ability.Undead:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffGreenRoots", Settings.UndeadEitr.Value);
					break;
				case Ability.Night:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.NightEitr.Value);
					break;
				case Ability.Sun:
					shared.m_skillType = (SkillType)9;
					shared.m_attack = Cast("StaffShield", Settings.SunEitr.Value);
					break;
				case Ability.Release:
					shared.m_skillType = (SkillType)10;
					shared.m_attack = Cast("StaffShield", Settings.ReleaseEitr.Value);
					break;
				case Ability.Hail:
					shared.m_skillType = (SkillType)9;
					shared.m_damages.m_frost = Settings.HailFrost.Value;
					shared.m_damagesPerLevel.m_frost = Settings.HailFrostPerLevel.Value;
					shared.m_attack = Cast("StaffFireball", Settings.HailEitr.Value);
					break;
				case Ability.Illness:
					shared.m_skillType = (SkillType)9;
					shared.m_damages.m_poison = Settings.IllnessPoison.Value;
					shared.m_damagesPerLevel.m_poison = Settings.IllnessPoisonPerLevel.Value;
					shared.m_attack = Cast("StaffShield", Settings.IllnessEitr.Value);
					break;
				}
			}
			Attack Cast(string animationOf, float eitr)
			{
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				GameObject prefab = PrefabManager.Instance.GetPrefab(animationOf);
				ItemDrop val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponent<ItemDrop>() : null);
				Attack val2 = (Object.op_Implicit((Object)(object)val) ? val.m_itemData.m_shared.m_attack : shared.m_attack).Clone();
				if (!Object.op_Implicit((Object)(object)val))
				{
					StaffsPlugin.Log.LogWarning((object)(def.Id + ": the vanilla staff " + animationOf + " was not found, so it keeps the cast animation of " + def.Base + "."));
				}
				val2.m_attackType = (AttackType)2;
				val2.m_attackEitr = Mathf.Max(0f, eitr);
				val2.m_attackStamina = 0f;
				val2.m_attackHealth = 0f;
				val2.m_attackHealthPercentage = 0f;
				val2.m_perBurstResourceUsage = false;
				val2.m_projectileBursts = 1;
				val2.m_loopingAttack = false;
				val2.m_chargeAnimationBool = "";
				val2.m_bowDraw = false;
				val2.m_requiresReload = false;
				return val2;
			}
		}

		public static void AddRecharge(StaffDef def, Sprite? icon)
		{
			if (def.Ability != Ability.None)
			{
				StatusEffect val = ScriptableObject.CreateInstance<StatusEffect>();
				((Object)val).name = "SkaStaffs_Recharging_" + def.Ability;
				val.m_name = def.Name;
				val.m_tooltip = def.Name + " is gathering its power again.";
				val.m_icon = icon;
				val.m_ttl = 1f;
				s_recharging[def.Ability] = val;
			}
		}

		private static float RechargeSeconds(Ability ability)
		{
			return ability switch
			{
				Ability.Time => Settings.TimeCooldown.Value, 
				Ability.Storms => Settings.StormCooldown.Value, 
				Ability.Lantern => Settings.LanternCooldown.Value, 
				Ability.Clarity => Settings.ClarityCooldown.Value, 
				Ability.Peace => Settings.PeaceCooldown.Value, 
				Ability.Confusion => Settings.ConfusionCooldown.Value, 
				Ability.Illness => Settings.IllnessCooldown.Value, 
				Ability.Night => Settings.NightCooldown.Value, 
				Ability.Sun => Settings.SunCooldown.Value, 
				Ability.Release => Settings.ReleaseCooldown.Value, 
				_ => 0f, 
			};
		}

		private static float RechargeLeft(Player player, StaffDef def)
		{
			if (!s_recharging.TryGetValue(def.Ability, out StatusEffect value))
			{
				return 0f;
			}
			StatusEffect statusEffect = ((Character)player).GetSEMan().GetStatusEffect(value.NameHash());
			if (!((Object)(object)statusEffect != (Object)null))
			{
				return 0f;
			}
			return Mathf.Max(0f, statusEffect.GetRemaningTime());
		}

		private static void StartRecharge(Player player, StaffDef def)
		{
			float num = RechargeSeconds(def.Ability);
			if (!(num <= 0f) && s_recharging.TryGetValue(def.Ability, out StatusEffect value))
			{
				StatusEffect val = ((Character)player).GetSEMan().AddStatusEffect(value, true, 0, 0f, (short)(-1));
				if ((Object)(object)val != (Object)null)
				{
					val.m_ttl = num;
				}
			}
		}

		private static void Use(Player player, StaffDef def, ItemData weapon, bool secondary)
		{
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			bool flag;
			switch (def.Ability)
			{
			default:
				return;
			case Ability.NegativeEnergy:
				flag = (secondary ? NegativeEnergy.Strike(player, weapon) : NegativeEnergy.CastBolt(player, weapon));
				break;
			case Ability.Golem:
				flag = Summons.Cast(player, def, Settings.GolemCreature.Value, Settings.GolemStars.Value, Settings.GolemSize.Value);
				break;
			case Ability.Demons:
				flag = Summons.Cast(player, def, Settings.DemonCreature.Value, Settings.DemonStars.Value, Settings.DemonSize.Value);
				break;
			case Ability.Time:
				flag = (secondary ? TimeBubble.CastStop(player) : TimeBubble.CastSlow(player));
				break;
			case Ability.Storms:
				flag = Storm.Cast(player);
				break;
			case Ability.Roses:
				flag = Roses.Cast(player);
				break;
			case Ability.Lantern:
				flag = SoulLantern.Cast(player);
				break;
			case Ability.Clarity:
				flag = Storm.CastClear(player);
				break;
			case Ability.Force:
				flag = ForcePush.Cast(player);
				break;
			case Ability.Life:
				flag = Life.Cast(player);
				break;
			case Ability.Light:
				flag = Beacon.Cast(player);
				break;
			case Ability.Drakes:
				flag = Summons.Cast(player, def, Settings.DrakeCreature.Value, Settings.DrakeStars.Value, Settings.DrakeSize.Value);
				break;
			case Ability.Gravity:
				flag = Gravity.Cast(player);
				break;
			case Ability.Darkness:
				flag = Darkness.Cast(player, weapon);
				break;
			case Ability.Peace:
				flag = Minds.Cast(player, confuse: false);
				break;
			case Ability.Stone:
				flag = StoneWall.Cast(player);
				break;
			case Ability.Confusion:
				flag = Minds.Cast(player, confuse: true);
				break;
			case Ability.Illness:
				flag = Illness.Cast(player, weapon);
				break;
			case Ability.Hordes:
				flag = Bands.CastHordes(player, def);
				break;
			case Ability.Wood:
				flag = Bands.CastWood(player, def);
				break;
			case Ability.Undead:
				flag = Bands.CastUndead(player, def);
				break;
			case Ability.Night:
				flag = Night.Cast(player, day: false);
				break;
			case Ability.Sun:
				flag = Night.Cast(player, day: true);
				break;
			case Ability.Release:
				flag = Summons.Release(player);
				break;
			case Ability.Hail:
				flag = Hail.Cast(player, weapon);
				break;
			}
			if (flag)
			{
				StartRecharge(player, def);
				if (weapon.m_shared.m_useDurability)
				{
					weapon.m_durability -= weapon.m_shared.m_useDurabilityDrain * Game.m_durabilityRate;
				}
				((Character)player).RaiseSkill(weapon.m_shared.m_skillType, 1f);
			}
		}
	}
	internal static class Net
	{
		public enum Kind
		{
			Bolt,
			Strike,
			Summon,
			Freeze,
			Storm,
			Roses,
			Lantern,
			Clarity,
			Force,
			Life,
			Light,
			Stone,
			Gravity,
			Ember,
			EmberHit,
			Mind,
			Illness,
			Night,
			Hail,
			Sun,
			Release,
			TimeSlow,
			TimeStop
		}

		private const string RpcName = "SkaStaffs_Ability";

		public static void Register()
		{
			if (ZRoutedRpc.instance != null)
			{
				ZRoutedRpc.instance.Register<ZPackage>("SkaStaffs_Ability", (Action<long, ZPackage>)Receive);
			}
		}

		public static void Send(Kind kind, Action<ZPackage> write)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			if (ZRoutedRpc.instance != null)
			{
				ZPackage val = new ZPackage();
				val.Write((int)kind);
				write(val);
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "SkaStaffs_Ability", new object[1] { val });
			}
		}

		private static void Receive(long sender, ZPackage package)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				switch ((Kind)package.ReadInt())
				{
				case Kind.Bolt:
					NegativeEnergy.ShowBolt(package.ReadVector3(), package.ReadVector3(), package.ReadBool());
					break;
				case Kind.Strike:
					NegativeEnergy.ShowStrike(package.ReadVector3(), package.ReadSingle());
					break;
				case Kind.Summon:
					Summons.ShowArrival(package.ReadVector3(), package.ReadSingle());
					break;
				case Kind.Freeze:
					TimeFreeze.Show(package.ReadVector3(), package.ReadSingle());
					break;
				case Kind.Storm:
					Storm.Begin(package.ReadVector3(), package.ReadSingle(), clear: false);
					break;
				case Kind.Clarity:
					Storm.Begin(package.ReadVector3(), package.ReadSingle(), clear: true);
					break;
				case Kind.Lantern:
				{
					long caster = package.ReadLong();
					Vector3 at = package.ReadVector3();
					float radius = package.ReadSingle();
					float seconds = package.ReadSingle();
					float push = ((package.GetPos() < package.Size()) ? package.ReadSingle() : 0f);
					SoulLantern.Begin(caster, at, radius, seconds, push);
					break;
				}
				case Kind.TimeSlow:
				case Kind.TimeStop:
					TimeBubble.Receive(package.ReadLong(), package.ReadVector3(), package.ReadSingle(), package.ReadSingle(), package.ReadSingle(), package.ReadBool(), package.ReadBool());
					break;
				case Kind.Force:
					ForcePush.Show(package.ReadVector3(), package.ReadSingle());
					break;
				case Kind.Life:
					Life.Show(package.ReadVector3());
					break;
				case Kind.Light:
					Beacon.Begin(package.ReadLong(), package.ReadVector3(), package.ReadSingle());
					break;
				case Kind.Stone:
					StoneWall.Show(package.ReadVector3(), package.ReadSingle());
					break;
				case Kind.Gravity:
					Gravity.Begin(package.ReadVector3(), package.ReadSingle(), package.ReadSingle(), package.ReadBool());
					break;
				case Kind.Ember:
					Ember.Show(package.ReadLong(), package.ReadVector3(), package.ReadVector3(), package.ReadVector3(), package.ReadSingle(), package.ReadSingle(), package.ReadSingle());
					break;
				case Kind.EmberHit:
					Darkness.ShowBurst(package.ReadVector3());
					break;
				case Kind.Mind:
					Minds.Show(package.ReadVector3(), package.ReadSingle(), package.ReadBool());
					break;
				case Kind.Illness:
					Illness.Begin(package.ReadLong(), package.ReadVector3(), package.ReadSingle(), package.ReadSingle());
					break;
				case Kind.Night:
					Night.Begin(package.ReadVector3(), package.ReadSingle(), day: false);
					break;
				case Kind.Sun:
					Night.Begin(package.ReadVector3(), package.ReadSingle(), day: true);
					break;
				case Kind.Release:
					Summons.ShowRelease(package);
					break;
				case Kind.Hail:
					Hail.Show(package.ReadVector3(), package.ReadSingle(), package.ReadSingle());
					break;
				case Kind.Roses:
					Roses.Begin(package.ReadVector3(), package.ReadSingle(), package.ReadSingle(), package.ReadSingle());
					break;
				}
			}
			catch (Exception ex)
			{
				StaffsPlugin.Log.LogWarning((object)("A message about a staff's ability could not be read: " + ex.Message));
			}
		}
	}
	internal sealed class Crackle : MonoBehaviour
	{
		private sealed class Arc
		{
			public LineRenderer Line;

			public readonly List<Vector3> Path = new List<Vector3>();

			public readonly List<Vector3> Outward = new List<Vector3>();

			public readonly List<Vector3> Drawn = new List<Vector3>();

			public CrackleArcs.Kind Kind;

			public float Age;

			public float Life;

			public float NextReshape;

			public float Width;

			public Color Tint;

			public bool Live;
		}

		private const int PoolSize = 8;

		private const float ReshapeEvery = 0.035f;

		public float ShaftFrom;

		public float ShaftTo;

		public float ShaftRadiusLow;

		public float ShaftRadiusHigh;

		public float OrbRadius;

		public float RingRadius;

		public float Rate = 12f;

		public Vector3 Orb;

		public Color ColourA = Color.white;

		public Color ColourB = Color.white;

		private readonly List<Arc> _arcs = new List<Arc>();

		private Renderer? _model;

		private float _toNext;

		private CrackleShape _shape;

		public void Set(CrackleShape shape, float rate)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			ShaftFrom = shape.ShaftFrom;
			ShaftTo = shape.ShaftTo;
			ShaftRadiusLow = shape.ShaftRadiusLow;
			ShaftRadiusHigh = shape.ShaftRadiusHigh;
			Orb = shape.Orb;
			OrbRadius = shape.OrbRadius;
			RingRadius = shape.RingRadius;
			ColourA = shape.ColourA;
			ColourB = shape.ColourB;
			Rate = rate;
		}

		private void Start()
		{
			//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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00ce: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			_model = (Renderer?)(object)((Component)this).GetComponentInChildren<MeshRenderer>();
			Material val = Vfx.Line();
			if ((Object)(object)val == (Object)null || (Object)(object)_model == (Object)null || Rate <= 0f)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			_shape = new CrackleShape
			{
				ShaftFrom = ShaftFrom,
				ShaftTo = ShaftTo,
				ShaftRadiusLow = ShaftRadiusLow,
				ShaftRadiusHigh = ShaftRadiusHigh,
				Orb = Orb,
				OrbRadius = OrbRadius,
				RingRadius = RingRadius,
				ColourA = ColourA,
				ColourB = ColourB
			};
			for (int i = 0; i < 8; i++)
			{
				GameObject val2 = new GameObject("crackle")
				{
					layer = ((Component)this).gameObject.layer
				};
				val2.transform.SetParent(((Component)this).transform, false);
				LineRenderer val3 = val2.AddComponent<LineRenderer>();
				((Renderer)val3).sharedMaterial = val;
				val3.useWorldSpace = false;
				val3.textureMode = (LineTextureMode)0;
				val3.alignment = (LineAlignment)0;
				((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)val3).receiveShadows = false;
				val3.numCornerVertices = 1;
				((Renderer)val3).enabled = false;
				_arcs.Add(new Arc
				{
					Line = val3
				});
			}
		}

		private void Update()
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_model == (Object)null || !_model.isVisible)
			{
				foreach (Arc arc in _arcs)
				{
					Stop(arc);
				}
				return;
			}
			float deltaTime = Time.deltaTime;
			_toNext -= deltaTime;
			while (_toNext <= 0f)
			{
				int num = ((!(Random.value < 0.12f)) ? 1 : 3);
				for (int i = 0; i < num; i++)
				{
					Begin();
				}
				_toNext += Random.Range(0.3f, 1.7f) / Rate * (float)num;
			}
			float x = ((Component)this).transform.lossyScale.x;
			Color val = default(Color);
			foreach (Arc arc2 in _arcs)
			{
				if (!arc2.Live)
				{
					continue;
				}
				arc2.Age += deltaTime;
				if (arc2.Age >= arc2.Life)
				{
					Stop(arc2);
					continue;
				}
				if (arc2.Age >= arc2.NextReshape)
				{
					Reshape(arc2);
				}
				float num2 = 1f - arc2.Age / arc2.Life;
				arc2.Line.widthMultiplier = arc2.Width * x * (0.5f + 0.5f * num2);
				((Color)(ref val))..ctor(arc2.Tint.r, arc2.Tint.g, arc2.Tint.b, Mathf.Min(1f, num2 * 1.6f));
				arc2.Line.startColor = val;
				arc2.Line.endColor = val;
			}
		}

		private void Begin()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Arc arc = _arcs.Find((Arc a) => !a.Live);
			if (arc != null)
			{
				arc.Kind = CrackleArcs.Pick(Random.value);
				CrackleArcs.Lay(_shape, arc.Kind, arc.Path, arc.Outward);
				arc.Age = 0f;
				arc.Life = Random.Range(0.06f, 0.2f);
				arc.Width = CrackleArcs.Width(Random.value);
				arc.Tint = Color.Lerp(_shape.ColourA, _shape.ColourB, Random.value);
				arc.Live = true;
				arc.Line.positionCount = arc.Path.Count;
				Reshape(arc);
				((Renderer)arc.Line).enabled = true;
			}
		}

		private void Reshape(Arc arc)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			arc.NextReshape = arc.Age + 0.035f;
			CrackleArcs.Jag(arc.Path, arc.Outward, CrackleArcs.Spread(arc.Kind), arc.Drawn);
			for (int i = 0; i < arc.Drawn.Count; i++)
			{
				arc.Line.SetPosition(i, arc.Drawn[i]);
			}
		}

		private static void Stop(Arc arc)
		{
			if (arc.Live)
			{
				arc.Live = false;
				((Renderer)arc.Line).enabled = false;
			}
		}
	}
	internal struct CrackleShape
	{
		public float ShaftFrom;

		public float ShaftTo;

		public float ShaftRadiusLow;

		public float ShaftRadiusHigh;

		public Vector3 Orb;

		public float OrbRadius;

		public float RingRadius;

		public Color ColourA;

		public Color ColourB;
	}
	internal static class CrackleArcs
	{
		public enum Kind
		{
			Shaft,
			Orb,
			Link
		}

		public static readonly CrackleShape StormOrb = new CrackleShape
		{
			ShaftFrom = -0.8f,
			ShaftTo = 0.7f,
			ShaftRadiusLow = 0.025f,
			ShaftRadiusHigh = 0.038f,
			Orb = new Vector3(0.005f, 0f, 0.885f),
			OrbRadius = 0.118f,
			ColourA = new Color(0.55f, 0.82f, 1f),
			ColourB = new Color(0.78f, 0.6f, 1f)
		};

		public static readonly CrackleShape NegativeRing = new CrackleShape
		{
			ShaftFrom = -0.8f,
			ShaftTo = 0.78f,
			ShaftRadiusLow = 0.022f,
			ShaftRadiusHigh = 0.026f,
			Orb = new Vector3(0f, 0f, 0.96f),
			OrbRadius = 0.09f,
			RingRadius = 0.086f,
			ColourA = new Color(0.72f, 0.4f, 1f),
			ColourB = new Color(0.88f, 0.66f, 1f)
		};

		private const float Clear = 0.006f;

		public static Kind Pick(float roll)
		{
			if (!(roll < 0.58f))
			{
				if (!(roll < 0.9f))
				{
					return Kind.Link;
				}
				return Kind.Orb;
			}
			return Kind.Shaft;
		}

		public static void Lay(CrackleShape s, Kind kind, List<Vector3> path, List<Vector3> outward)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: 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_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			path.Clear();
			outward.Clear();
			Vector3 val3;
			switch (kind)
			{
			case Kind.Shaft:
			{
				float num4 = Random.Range(0.12f, 0.35f);
				float num5 = Random.Range(s.ShaftFrom, s.ShaftTo - num4);
				float num6 = Random.Range(0f, 360f);
				float num7 = Random.Range(-75f, 75f);
				Vector3 val5 = default(Vector3);
				for (int j = 0; j < 9; j++)
				{
					float num8 = (float)j / 8f;
					float num9 = num5 + num4 * num8;
					float num10 = (num6 + num7 * num8) * ((float)Math.PI / 180f);
					((Vector3)(ref val5))..ctor(Mathf.Cos(num10), Mathf.Sin(num10), 0f);
					path.Add(val5 * (ShaftRadius(s, num9) + 0.006f) + Vector3.forward * num9);
					outward.Add(val5);
				}
				break;
			}
			case Kind.Orb:
			{
				if (s.RingRadius > 0f)
				{
					float num11 = Random.Range(0f, 360f);
					float num12 = Random.Range(40f, 130f) * ((Random.value < 0.5f) ? (-1f) : 1f);
					Vector3 val6 = default(Vector3);
					for (int k = 0; k < 10; k++)
					{
						float num13 = (num11 + num12 * (float)k / 9f) * ((float)Math.PI / 180f);
						((Vector3)(ref val6))..ctor(Mathf.Cos(num13), 0f, Mathf.Sin(num13));
						path.Add(s.Orb + val6 * (s.RingRadius + 0.004f));
						outward.Add(val6);
					}
					break;
				}
				Vector3 onUnitSphere = Random.onUnitSphere;
				val3 = Vector3.Cross(onUnitSphere, Random.onUnitSphere);
				Vector3 normalized2 = ((Vector3)(ref val3)).normalized;
				if (((Vector3)(ref normalized2)).sqrMagnitude < 0.01f)
				{
					val3 = Vector3.Cross(onUnitSphere, Vector3.up);
					normalized2 = ((Vector3)(ref val3)).normalized;
				}
				Vector3 val7 = Quaternion.AngleAxis(Random.Range(35f, 115f), normalized2) * onUnitSphere;
				for (int l = 0; l < 10; l++)
				{
					val3 = Vector3.Slerp(onUnitSphere, val7, (float)l / 9f);
					Vector3 normalized3 = ((Vector3)(ref val3)).normalized;
					path.Add(s.Orb + normalized3 * (s.OrbRadius + 0.004f));
					outward.Add(normalized3);
				}
				break;
			}
			default:
			{
				float num = s.ShaftTo - Random.Range(0f, 0.06f);
				float num2 = Random.Range(0f, 360f) * ((float)Math.PI / 180f);
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(Mathf.Cos(num2), Mathf.Sin(num2), 0f);
				Vector3 val2 = val * (ShaftRadius(s, num) + 0.006f) + Vector3.forward * num;
				val3 = Vector3.Slerp(Vector3.back, val, Random.Range(0.35f, 0.8f));
				Vector3 normalized = ((Vector3)(ref val3)).normalized;
				Vector3 val4 = s.Orb + normalized * (s.OrbRadius + 0.004f);
				for (int i = 0; i < 9; i++)
				{
					float num3 = (float)i / 8f;
					path.Add(Vector3.Lerp(val2, val4, num3));
					val3 = Vector3.Slerp(val, normalized, num3);
					outward.Add(((Vector3)(ref val3)).normalized);
				}
				break;
			}
			}
		}

		public static void Jag(List<Vector3> path, List<Vector3> outward, float spread, List<Vector3> into)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			into.Clear();
			int count = path.Count;
			for (int i = 0; i < count; i++)
			{
				float num = spread * Mathf.Sin((float)Math.PI * (float)i / (float)(count - 1));
				Vector3 val = path[Mathf.Min(i + 1, count - 1)] - path[Mathf.Max(i - 1, 0)];
				Vector3 val2 = Vector3.Cross(outward[i], val);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				into.Add(path[i] + outward[i] * (Random.value * num) + normalized * (Random.Range(-1f, 1f) * num));
			}
		}

		public static float Spread(Kind kind)
		{
			if (kind != Kind.Orb)
			{
				return 0.008f;
			}
			return 0.02f;
		}

		public static float Width(float roll)
		{
			return Mathf.Lerp(0.012f, 0.022f, roll);
		}

		private static float ShaftRadius(CrackleShape s, float z)
		{
			return Mathf.Lerp(s.ShaftRadiusLow, s.ShaftRadiusHigh, Mathf.InverseLerp(s.ShaftFrom, s.ShaftTo, z));
		}
	}
	internal sealed class Motes : MonoBehaviour
	{
		public int Kind;

		public Vector3 Centre;

		public float Radius;

		public float Height;

		public float Rate;

		public float SizeMin;

		public float SizeMax;

		public float Life;

		public Color ColourA = Color.white;

		public Color ColourB = Color.white;

		private Light? _light;

		private float _lightPeak;

		private float _seed;

		public void Set(MoteShape shape)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Kind = (int)shape.Kind;
			Centre = shape.Centre;
			Radius = shape.Radius;
			Height = shape.Height;
			Rate = shape.Rate;
			SizeMin = shape.SizeMin;
			SizeMax = shape.SizeMax;
			Life = shape.Life;
			ColourA = shape.ColourA;
			ColourB = shape.ColourB;
		}

		private void Start()
		{
			//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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			MoteShape s = new MoteShape
			{
				Kind = (MoteKind)Kind,
				Centre = Centre,
				Radius = Radius,
				Height = Height,
				Rate = Rate,
				SizeMin = SizeMin,
				SizeMax = SizeMax,
				Life = Life,
				ColourA = ColourA,
				ColourB = ColourB
			};
			if ((Object)(object)StaffMotes.Build(((Component)this).transform, s, Vfx.Dot(), Vfx.Mist(), Vfx.Flame()) == (Object)null || s.Kind != MoteKind.Fire || (Object)(object)((Component)this).transform.parent == (Object)null)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			_light = ((Component)((Component)this).transform.parent).GetComponentInChildren<Light>();
			if ((Object)(object)_light == (Object)null)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			_lightPeak = _light.intensity;
			_seed = Random.value * 100f;
		}

		private void Update()
		{
			if (!((Object)(object)_light == (Object)null))
			{
				float num = Time.time * 7f + _seed;
				_light.intensity = _lightPeak * (0.8f + 0.2f * Mathf.PerlinNoise(num, _seed) + 0.05f * Mathf.Sin(num * 3.1f));
			}
		}
	}
	internal static class Targets
	{
		public static bool IsEnemy(Player player, Character target, bool bosses = true)
		{
			if ((Object)(object)target == (Object)null || (Object)(object)target == (Object)(object)player || target.IsDead())
			{
				return false;
			}
			if (target.IsBoss() && !bosses)
			{
				return false;
			}
			if (target.IsPlayer())
			{
				if (((Character)player).IsPVPEnabled())
				{
					return target.IsPVPEnabled();
				}
				return false;
			}
			return BaseAI.IsEnemy((Character)(object)player, target);
		}

		public static List<Character> EnemiesNear(Player player, Vector3 centre, float radius, bool bosses = true)
		{
			//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_0029: Unknown result type (might be due to invalid IL or missing references)
			List<Character> list = new List<Character>();
			Character.GetCharactersInRange(centre, radius + 6f, list);
			return list.Where((Character target) => IsEnemy(player, target, bosses) && Vector3.Distance(((Component)target).transform.position, centre) - target.GetRadius() <= radius).ToList();
		}
	}
	internal static class NegativeEnergy
	{
		private static int s_mask;

		public static bool CastBolt(Player player, ItemData weapon)
		{
			//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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			if (s_mask == 0)
			{
				s_mask = LayerMask.GetMask(new string[12]
				{
					"Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",
					"character_noenv", "vehicle"
				});
			}
			Vector3 eye = ((Character)player).GetEyePoint();
			Vector3 aimDir = ((Humanoid)player).GetAimDir(eye);
			Vector3 dir = ((Vector3)(ref aimDir)).normalized;
			float value = Settings.BoltRange.Value;
			Vector3 end = eye + dir * value;
			IDestructible struck = null;
			RaycastHit[] array = Physics.RaycastAll(eye, dir, value, s_mask, (QueryTriggerInteraction)1);
			Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance));
			RaycastHit[] array2 = array;
			for (int num = 0; num < array2.Length; num++)
			{
				RaycastHit val = array2[num];
				Character componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)(object)player) && (!((Object)(object)componentInParent != (Object)null) || Targets.IsEnemy(player, componentInParent)))
				{
					end = ((RaycastHit)(ref val)).point;
					IDestructible obj;
					if (!((Object)(object)componentInParent != (Object)null))
					{
						obj = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<IDestructible>();
					}
					else
					{
						IDestructible val2 = (IDestructible)(object)componentInParent;
						obj = val2;
					}
					struck = obj;
					break;
				}
			}
			IDestructible obj2 = struck;
			if (obj2 != null)
			{
				obj2.Damage(Hit(player, weapon, end, dir, 1f, 40f));
			}
			Net.Send(Net.Kind.Bolt, delegate(ZPackage package)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				package.Write(StaffHead(player, eye + dir * 0.6f));
				package.Write(end);
				package.Write(struck != null);
			});
			return true;
		}

		public static bool Strike(Player player, ItemData weapon)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 centre = ((Component)player).transform.position;
			float radius = Settings.StrikeRadius.Value;
			List<Character> list = Targets.EnemiesNear(player, centre, radius);
			foreach (Character item in list)
			{
				Vector3 dir = ((Component)item).transform.position - centre;
				dir.y = 0f;
				dir = ((((Vector3)(ref dir)).sqrMagnitude > 0.01f) ? ((Vector3)(ref dir)).normalized : ((Component)player).transform.forward);
				HitData val = Hit(player, weapon, item.GetCenterPoint(), dir, Settings.StrikeDamageFactor.Value, 70f);
				val.m_staggerMultiplier = 3f;
				item.Damage(val);
			}
			Net.Send(Net.Kind.Strike, delegate(ZPackage package)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				package.Write(centre);
				package.Write(radius);
			});
			StaffsPlugin.Log.LogInfo((object)$"Staff of Negative Energy: the bolt from the sky hit {list.Count} enemy(ies) within {radius:0.#} m.");
			return true;
		}

		private static HitData Hit(Player player, ItemData weapon, Vector3 point, Vector3 dir, float factor, float push)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			HitData val = new HitData
			{
				m_point = point,
				m_dir = dir,
				m_pushForce = push,
				m_blockable = false,
				m_dodgeable = false,
				m_ranged = true,
				m_skill = weapon.m_shared.m_skillType,
				m_hitType = (HitType)2,
				m_damage = weapon.GetDamage()
			};
			((DamageTypes)(ref val.m_damage)).Modify(factor * ((Character)player).GetRandomSkillFactor(weapon.m_shared.m_skillType));
			val.SetAttacker((Character)(object)player);
			return val;
		}

		internal static Vector3 StaffHead(Player player, Vector3 fallback)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			VisEquipment component = ((Component)player).GetComponent<VisEquipment>();
			Transform val = (Object.op_Implicit((Object)(object)component) ? component.m_rightHand : null);
			if (!Object.op_Implicit((Object)(object)val) || val.childCount == 0)
			{
				return fallback;
			}
			return val.GetChild(val.childCount - 1).TransformPoint(new Vector3(0f, 0f, 0.95f));
		}

		public static void ShowBolt(Vector3 from, Vector3 to, bool struck)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0086: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: