Decompiled source of OVER 99 Fortress Island v0.1.2

plugins/HtfFortress.dll

Decompiled 12 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FishNet;
using FishNet.Broadcast;
using FishNet.Connection;
using FishNet.Managing;
using FishNet.Managing.Client;
using FishNet.Managing.Object;
using FishNet.Object;
using FishNet.Object.Synchronizing;
using FishNet.Serializing;
using FishNet.Transporting;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.UI;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HtfFortress
{
	public class Weapons : MonoBehaviour
	{
		private class Gun
		{
			public Gear Gear;

			public float ReadyAt;

			public float Heat;

			public float LastTick = -10f;

			public float RampStart;

			public float NextState;

			public float NumberDmg;

			public float NextNumber;

			public float Rounds;

			public bool Overheated;
		}

		private class Cloud
		{
			public Vector3 At;

			public float Radius;

			public float Until;

			public float Dps;

			public int Owner;

			public bool Legend;
		}

		private class Poison
		{
			public int Stacks;

			public int Owner;

			public float Until;

			public float NextStack;

			public float Dps;

			public bool Legend;
		}

		private class Vortex
		{
			public Vector3 At;

			public float Until;

			public float Dps;

			public int Owner;

			public bool Legend;
		}

		private class Shark
		{
			public int Id;

			public int Owner;

			public Vector3 Pos;

			public Vector3 Face;

			public float Until;

			public float NextBite;

			public float Dmg;

			public float Sight = 14f;
		}

		private class Jelly
		{
			public Vector3 At;

			public float Radius;

			public float Until;

			public float Dps;

			public int Owner;

			public bool Legend;
		}

		private class Fling
		{
			public Item Item;

			public Player By;

			public float Dmg;

			public float Until;

			public int Left;

			public readonly HashSet<Creature> Hit = new HashSet<Creature>();
		}

		private class BeamView
		{
			public Transform Beam;

			public Transform Core;

			public Transform Hit;

			public Transform HaloIn;

			public Transform HaloOut;

			public Transform[] Streaks;

			public Transform[] Bands;

			public Material Sheath;

			public Material Glow;

			public Material HaloInMat;

			public Material HaloOutMat;

			public Material[] BandMats;

			public Vector3 A;

			public Vector3 B;

			public float Width;

			public float Until;

			public float NextFlash;

			public float NextSmoke;

			public float Heat;
		}

		private class GasShown
		{
			public Vector3 At;

			public float Radius;

			public float Until;

			public bool Burst;
		}

		private class Shot
		{
			public Transform T;

			public Vector3 A;

			public Vector3 B;

			public float Start;
		}

		public const float SuckRange = 8f;

		public const float SuckAngle = 30f;

		public const float SuckEvery = 0.5f;

		public const float AbsorberBoost = 2.5f;

		public const byte RightDown = 3;

		public const byte RightHeld = 4;

		public const byte RightUp = 5;

		public const byte SpitKey = 6;

		private readonly Dictionary<int, float> _nextSuck = new Dictionary<int, float>();

		private readonly Dictionary<int, float> _nextSuckFx = new Dictionary<int, float>();

		private static readonly Vector3 DomeAt;

		private const float DomeR = 0.055f;

		private static Material _glass;

		private readonly Dictionary<Transform, (byte id, Transform root)> _chambers = new Dictionary<Transform, (byte, Transform)>();

		private Image _absTop;

		private TextMeshProUGUI _absTopText;

		private bool _rightHeld;

		private float _nextRight;

		private Transform _castRing;

		private Transform _castMark;

		private Transform _castMark2;

		private Transform _castCone;

		private Material _castRingMat;

		private Material _castMarkMat;

		private int _coneHalf = -1;

		public static Weapons Instance;

		public static ConfigEntry<Key> NetKey;

		public static ConfigEntry<float> DamageMultiplier;

		public const float LaserRange = 30f;

		public const float LaserRadius = 0.8f;

		public const float LaserRampSeconds = 2f;

		public const float LaserMaxRamp = 3f;

		public const float OverheatLock = 2f;

		public const float HeatCoolPerSecond = 0.35f;

		public static readonly float[] LaserHeatSeconds;

		public const float GasRange = 24f;

		public const float GasRadius = 3f;

		public const float GasLife = 6f;

		public const float PoisonLinger = 4f;

		public const float LobFlight = 0.6f;

		public const int MaxPoisonStacks = 5;

		public const float BoomerangRange = 18f;

		public const float BoomerangLeg = 0.55f;

		public const float BoomerangHitRadius = 1.3f;

		public const float BoomerangSlow = 0.4f;

		public static readonly float[] SharkLife;

		public const float SharkSpeed = 7f;

		public const float SharkBiteEvery = 1.2f;

		public const float SharkReach = 2.6f;

		public const float SharkSight = 14f;

		public const float SeaRing = 27.5f;

		public const float ShotRange = 25f;

		public const float ShotRadius = 0.8f;

		public const float LobRadius = 1.2f;

		public const float WhirlRange = 24f;

		public const float WhirlRadius = 6f;

		public const float WhirlDps = 5f;

		public const float WhirlBurst = 40f;

		public const float ConchRange = 10f;

		public const float ConchHalfAngle = 30f;

		public const float ConchDamage = 10f;

		public const float BubblePop = 20f;

		public const float NetRange = 24f;

		public const float NetRadius = 3.5f;

		public const float NetDamage = 8f;

		public const float NettedMult = 1.3f;

		public const float JellyRange = 24f;

		public const float JellyRadius = 3f;

		public const float JellyLife = 6f;

		public const float JellySlow = 0.35f;

		public const float JellyHover = 1.3f;

		public const float WaterRange = 15f;

		public const float WaterRadius = 1.3f;

		public const float WaterHurt = 0.6f;

		public const float WaterPushMax = 25f;

		public static readonly float[] WaterTankSeconds;

		public const float PufferRange = 24f;

		public const float PufferRadius = 3.5f;

		public const float PufferFuse = 1.2f;

		public static readonly int[] StarCount;

		public const float StarRange = 25f;

		public const float StarSpread = 9f;

		public const float ClawRange = 12f;

		public const float ClawAim = 1.1f;

		public const float ClawClose = 3.5f;

		public const float ClawCone = 60f;

		public const float ClawSpeed = 60f;

		public const float ClawMiss = 0.5f;

		public const float ClawThrow = 8f;

		public const float ClawFlight = 0.5f;

		public const float ClawSplash = 2.5f;

		public const float RocketRange = 40f;

		public const float RocketRadius = 3f;

		public const float RocketSpeed = 32f;

		public const float RocketSpread = 14f;

		public const float GatlingRange = 30f;

		public const float GatlingRate = 12f;

		public const float GatlingSpinUp = 1.2f;

		public const float GatlingSpinDown = 1.5f;

		public const float GatlingFloor = 0.25f;

		public const float GatlingBounce = 6f;

		private NetworkManager _registeredOn;

		private readonly Dictionary<(int, Gear), Gun> _guns = new Dictionary<(int, Gear), Gun>();

		private readonly List<Cloud> _clouds = new List<Cloud>();

		private readonly Dictionary<Creature, Poison> _poison = new Dictionary<Creature, Poison>();

		private readonly List<Vortex> _vortices = new List<Vortex>();

		private readonly List<Shark> _sharks = new List<Shark>();

		private readonly List<Jelly> _jellies = new List<Jelly>();

		private readonly Dictionary<Creature, float> _netted = new Dictionary<Creature, float>();

		private readonly Dictionary<int, Item> _hooked = new Dictionary<int, Item>();

		private readonly List<Fling> _flung = new List<Fling>();

		public const float FlingSpeed = 30f;

		public const float FlingRadius = 1.2f;

		private int _nextShark = 1;

		private float _nextHalfSecond;

		private float _nextSharkSend;

		private bool _wasActive;

		private static readonly FieldRef<CreatureManager, List<Creature>> Wild;

		private static readonly Dictionary<Creature, (float until, Bounds box)> BossBoxes;

		public const int BeamTop = 20;

		public const float WetSeconds = 5f;

		public const float WetMult = 1.5f;

		private readonly Dictionary<Creature, float> _wet = new Dictionary<Creature, float>();

		private bool _drawn;

		private bool _wasHolding;

		private bool _handEmptied;

		private Item _heldAtDraw;

		private static readonly MethodInfo OpenSlotMethod;

		private float _kick;

		private float _nextSend;

		private readonly List<Renderer> _hidden = new List<Renderer>();

		private Item _hiddenItem;

		private static MethodInfo _toolHands;

		private Item _heldModelOf;

		private Transform _heldModel;

		private Vector3 _heldModelHome;

		private readonly Dictionary<Gear, (float heat, float readyAt, float cooldown)> _mine = new Dictionary<Gear, (float, float, float)>();

		private Image _hud;

		private Image _hudPic;

		private TextMeshProUGUI _hudText;

		private Hud.Bar _hudBar;

		private const float HudPic = 64f;

		private readonly Dictionary<int, BeamView> _beams = new Dictionary<int, BeamView>();

		private readonly Dictionary<int, (Transform t, Vector3 pos, Vector3 face, float seen)> _sharkViews = new Dictionary<int, (Transform, Vector3, Vector3, float)>();

		private float _nextBeamSound;

		private float _nextWake;

		public const float RainbowHeat = 5f;

		private static readonly Color[] HeatStops;

		public const int BeamStreaks = 3;

		public const float StreakSpeed = 160f;

		public const float StreakLength = 3f;

		public const int RainbowBands = 12;

		private readonly List<GasShown> _gasShown = new List<GasShown>();

		private float _nextStarSound;

		private float _nextSpraySound;

		private int _onHook;

		public const float BulletSpeed = 240f;

		public const float BulletLength = 2.5f;

		private const int MaxBullets = 40;

		private readonly List<Shot> _shots = new List<Shot>();

		private int _nextShot;

		private float _nextGatlingSound;

		private float _mySpin;

		private readonly Dictionary<int, (float spin, float at)> _spins = new Dictionary<int, (float, float)>();

		private bool _net;

		private GameObject _netView;

		private Transform _bag;

		private Transform _contents;

		private readonly List<(GameObject go, Mesh baked)> _catch = new List<(GameObject, Mesh)>();

		private float _swing;

		private float _nextSwing;

		private const int MaxShownFish = 12;

		private static readonly Vector3 NetHoop;

		private static readonly Vector3 NetHang;

		internal Vector3 DebugCastMark
		{
			get
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_castMark) || !((Component)_castMark).gameObject.activeSelf)
				{
					return Vector3.zero;
				}
				return _castMark.position;
			}
		}

		internal Vector3 DebugLastShark
		{
			get
			{
				//IL_002c: 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)
				if (_sharks.Count <= 0)
				{
					return Vector3.zero;
				}
				return _sharks[_sharks.Count - 1].Pos;
			}
		}

		public static bool Drawn
		{
			get
			{
				if (Object.op_Implicit((Object)(object)Instance))
				{
					return Instance._drawn;
				}
				return false;
			}
		}

		public static bool NetOut
		{
			get
			{
				if (Object.op_Implicit((Object)(object)Instance) && Instance._drawn)
				{
					return Instance._net;
				}
				return false;
			}
		}

		internal static float Scale => ((Object.op_Implicit((Object)(object)FortressPlugin.Instance) && Object.op_Implicit((Object)(object)Siege.Instance) && Siege.Instance.ServerActive) ? FortressPlugin.Instance.WaveHpMult : 1f) * (DamageMultiplier?.Value ?? 1f);

		public static float BeamMaxBite => WeaponMods.PowerMult(20) * (3f + WeaponMods.TraitAdd(Gear.Laser, 20)) / WeaponMods.TimeMult(20);

		public bool ClientHasWeapon => WeaponItems.Carries(Player.LocalPlayer);

		private static Material LaserMat => WeaponFx.Emissive("Laser", new Color(0.35f, 0.9f, 1f), 5f);

		private static bool HoldsAbsorber(Player p)
		{
			if (Object.op_Implicit((Object)(object)p) && WeaponItems.Held(p, out var g, out var _))
			{
				return g == Gear.Absorber;
			}
			return false;
		}

		public static float ShotMult(int worth)
		{
			return 1f + Mathf.Log(1f + (float)Mathf.Max(0, worth) / 50f, 2f);
		}

		public static float MoveSeconds(EnemyKind boss)
		{
			return boss switch
			{
				EnemyKind.Warden => 2.5f, 
				EnemyKind.Urchin => 2.6f, 
				EnemyKind.Angler => 6f, 
				EnemyKind.Steed => 3.5f, 
				EnemyKind.Stonefish => 3.5f, 
				EnemyKind.Skyfish => 5f, 
				EnemyKind.Kraken => 6f, 
				EnemyKind.Voxel => 7f, 
				EnemyKind.Koi => 5f, 
				_ => 8f, 
			};
		}

		public static float MoveMult(EnemyKind boss)
		{
			return boss switch
			{
				EnemyKind.Warden => 6f, 
				EnemyKind.Urchin => 1.6f, 
				EnemyKind.Angler => 4f, 
				EnemyKind.Steed => 5f, 
				EnemyKind.Stonefish => 2.5f, 
				EnemyKind.Skyfish => 2.5f, 
				EnemyKind.Kraken => 1.5f, 
				EnemyKind.Voxel => 5f, 
				EnemyKind.Koi => 1f, 
				_ => 6f, 
			};
		}

		private Gun GunOf(Player who, Gear g)
		{
			if (!_guns.TryGetValue((((NetworkBehaviour)who).ObjectId, g), out var value))
			{
				Dictionary<(int, Gear), Gun> guns = _guns;
				(int, Gear) key = (((NetworkBehaviour)who).ObjectId, g);
				Gun obj = new Gun
				{
					Gear = g
				};
				Gun result = obj;
				guns[key] = obj;
				return result;
			}
			return value;
		}

		public void DebugReady(Player who)
		{
			foreach (KeyValuePair<(int, Gear), Gun> item in _guns.Where((KeyValuePair<(int, Gear), Gun> kv) => kv.Key.Item1 == ((NetworkBehaviour)who).ObjectId))
			{
				item.Value.ReadyAt = 0f;
			}
			_nextSuck.Remove(((NetworkBehaviour)who).ObjectId);
		}

		internal static bool Copies(Item prefab, out Gear g, out Rarity r)
		{
			if (WeaponItems.Is(prefab, out g, out r) && !GearCatalog.IsGameGun(g))
			{
				return !GearCatalog.IsSpecial(g);
			}
			return false;
		}

		public static Rarity CopyRarity(Rarity copied, Rarity absorber)
		{
			return (Rarity)Mathf.Max((int)copied, (int)absorber);
		}

		private static bool Wields(Player who, Gear g)
		{
			if (!WeaponItems.Held(who, out var g2, out var r))
			{
				return false;
			}
			if (g2 == g)
			{
				return true;
			}
			StoredItem storedItem = ((g2 == Gear.Absorber && Object.op_Implicit((Object)(object)Loot.Instance)) ? Loot.Instance.Vault.AbsorbedOf(Loot.KeyOf(who)) : null);
			if (storedItem != null && Copies(GameInfo.GetSpawnable(storedItem.Id), out var g3, out r))
			{
				return g3 == g;
			}
			return false;
		}

		private void AbsorberFire(Player who, byte phase, Vector3 o, Vector3 d, Rarity r)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			VaultData vault = Loot.Instance.Vault;
			ulong num = Loot.KeyOf(who);
			StoredItem storedItem = vault.AbsorbedOf(num);
			switch (phase)
			{
			case 6:
				if (storedItem != null)
				{
					vault.Absorbed.Remove(num);
					SpitOut(who, storedItem, Muzzle(o, d), d, r);
					Loot.Instance.SaveVault();
				}
				return;
			default:
				if (storedItem != null || phase > 1)
				{
					break;
				}
				goto case 3;
			case 3:
			case 4:
				Suck(who, num, o, d, r, storedItem);
				return;
			}
			if (phase >= 5 || storedItem == null)
			{
				return;
			}
			Item spawnable = GameInfo.GetSpawnable(storedItem.Id);
			if (Copies(spawnable, out var g, out var r2))
			{
				FireAs(who, phase, o, d, g, CopyRarity(r2, r));
				if (phase == 0)
				{
					AutoTest.Count("absorber_copy_" + g);
				}
				return;
			}
			Gun gun = GunOf(who, Gear.Absorber);
			if (phase != 2 && !(Time.time < gun.ReadyAt))
			{
				float v = vault.WeaponValue(num, Gear.Absorber, r) * Scale;
				EnemyKind k;
				float num2 = (BossTrophies.Is(spawnable, out k) ? TrophyMove(k, who, o, d, v) : ItemShot(who, storedItem, o, d, v));
				gun.ReadyAt = Time.time + num2 * GearCatalog.Cooldown(Gear.Absorber, r) / GearCatalog.Cooldown(Gear.Absorber, Rarity.Common) * WeaponMods.TimeMult(vault.ModOf(num, Gear.Absorber, 1));
				SendState(who, gun);
				AutoTest.Count(BossTrophies.Is(spawnable, out var _) ? ("absorber_move_" + k) : "absorber_shot");
			}
		}

		private void Suck(Player who, ulong key, Vector3 o, Vector3 d, Rarity r, StoredItem held)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			float time = Time.time;
			VaultData vault = Loot.Instance.Vault;
			float num = SuckReach(vault, key);
			float cone = 30f + WeaponMods.TraitAdd(Gear.Absorber, vault.ModOf(key, Gear.Absorber, 2));
			Vector3 val = Muzzle(o, d);
			if (!_nextSuckFx.TryGetValue(((NetworkBehaviour)who).ObjectId, out var value) || time >= value)
			{
				_nextSuckFx[((NetworkBehaviour)who).ObjectId] = time + 0.25f;
				AbsFx("suck", val, val + d * num, who);
			}
			if (_nextSuck.TryGetValue(((NetworkBehaviour)who).ObjectId, out var value2) && time < value2)
			{
				return;
			}
			Item val2 = SuckTarget(o, d, num, cone, who);
			SavedItem val3 = (Object.op_Implicit((Object)(object)val2) ? Loot.SavedOf(val2) : null);
			if (val3 != null)
			{
				_nextSuck[((NetworkBehaviour)who).ObjectId] = time + 0.5f;
				vault.Absorbed[key] = new StoredItem
				{
					Saved = val3,
					Dead = (Object.op_Implicit((Object)(object)val2.Creature) && val2.Creature.IsDead),
					Worth = val2.TotalWorth
				};
				Swallow.Server(val2, val, Gulp.Absorber);
				if (held != null)
				{
					SpitOut(who, held, val, d, r);
				}
				Loot.Instance.SaveVault();
				AutoTest.Count("absorbed");
			}
		}

		private static float SuckReach(VaultData vault, ulong key)
		{
			return 8f * WeaponMods.ReachMult(vault.ModOf(key, Gear.Absorber, 3));
		}

		private Item SuckTarget(Vector3 o, Vector3 d, float reach, float cone, Player who)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0062: 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)
			Item result = null;
			float num = float.MaxValue;
			Collider[] array = Physics.OverlapSphere(o, reach, -1, (QueryTriggerInteraction)1);
			for (int i = 0; i < array.Length; i++)
			{
				Item val = ItemManager.Get(array[i]);
				if (!Object.op_Implicit((Object)(object)val) || !Hookable(val, who) || (WeaponItems.Is(val, out var g, out var _) && GearCatalog.IsSpecial(g)))
				{
					continue;
				}
				Vector3 val2 = ((Component)val).transform.position - o;
				float num2 = Vector3.Angle(d, val2);
				if (!(((Vector3)(ref val2)).magnitude > reach) && !(num2 > cone))
				{
					float num3 = num2 + ((Vector3)(ref val2)).magnitude * 2f;
					if (num3 < num)
					{
						result = val;
						num = num3;
					}
				}
			}
			return result;
		}

		private void SpitOut(Player who, StoredItem s, Vector3 muzzle, Vector3 d, Rarity r)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0051: 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)
			Item val = Loot.Spawn(s, muzzle + d * 0.4f);
			AutoTest.Count("absorber_spat");
			if (Object.op_Implicit((Object)(object)val))
			{
				float dmg = Loot.Instance.Vault.WeaponValue(Loot.KeyOf(who), Gear.Absorber, r) * Scale;
				((MonoBehaviour)this).StartCoroutine(SpitNext(who, val, muzzle, d, dmg, r == Rarity.Legendary));
			}
		}

		private IEnumerator SpitNext(Player who, Item it, Vector3 from, Vector3 d, float dmg, bool legend)
		{
			//IL_001c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			yield return null;
			if (Object.op_Implicit((Object)(object)it) && Object.op_Implicit((Object)(object)it.Rig) && Object.op_Implicit((Object)(object)it.RigidbodySync) && Object.op_Implicit((Object)(object)who))
			{
				it.RigidbodySync.StartSimulateLocal(default(Vector3), default(Quaternion));
				FlingOut(who, it, from, d, dmg, legend);
			}
		}

		private float ItemShot(Player who, StoredItem held, Vector3 o, Vector3 d, float v)
		{
			//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_0008: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Reach(o, d, 25f);
			Creature val2 = Along(o, val, 1f).FirstOrDefault();
			AbsFx("shot", Muzzle(o, d), Object.op_Implicit((Object)(object)val2) ? Body(val2) : val, who, held.Id);
			if (Object.op_Implicit((Object)(object)val2))
			{
				HitNumber(val2, Hurt(val2, v * ShotMult(held.Worth), who));
				if (!IsBoss(val2))
				{
					Siege instance = Siege.Instance;
					Vector3 val3 = d.Flat();
					instance.ServerPush(val2, ((Vector3)(ref val3)).normalized * 2.5f);
				}
			}
			return GearCatalog.Cooldown(Gear.Absorber, Rarity.Common);
		}

		private static int MaxOf(Creature c)
		{
			if (!Object.op_Implicit((Object)(object)FortressPlugin.Instance) || !FortressPlugin.Instance.MaxHpOf.TryGetValue(c, out var value))
			{
				return c.MaxHp;
			}
			return value;
		}

		private static Vector3 Ground(Vector3 p)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(p + Vector3.up * 20f, Vector3.down, ref val, 60f, LayerMask.op_Implicit(GameInfo.LevelLayer)))
			{
				p = ((RaycastHit)(ref val)).point;
			}
			p.y = Mathf.Max(p.y, WaterManager.GetWaterHeight(p));
			return p;
		}

		private List<Creature> Within(Vector3 at, float r)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return Targets().Where(delegate(Creature c)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = (((Component)c).transform.position - at).Flat();
				return ((Vector3)(ref val)).sqrMagnitude <= r * r;
			}).ToList();
		}

		private void Envenom(Creature c, int stacks, float dmg, Player who)
		{
			float time = Time.time;
			if (!_poison.TryGetValue(c, out var value))
			{
				value = (_poison[c] = new Poison());
			}
			value.Stacks = Mathf.Min(5, value.Stacks + stacks);
			value.Until = time + 4f;
			value.NextStack = time + 1f;
			value.Dps = Mathf.Max(value.Dps, dmg * 0.04f / Mathf.Max(0.01f, Scale));
			value.Owner = (Object.op_Implicit((Object)(object)who) ? ((NetworkBehaviour)who).ObjectId : 0);
		}

		private float TrophyMove(EnemyKind boss, Player who, Vector3 o, Vector3 d, float v)
		{
			//IL_001c: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_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_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0804: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0817: Unknown result type (might be due to invalid IL or missing references)
			//IL_081c: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0870: Unknown result type (might be due to invalid IL or missing references)
			//IL_0877: Unknown result type (might be due to invalid IL or missing references)
			//IL_0879: Unknown result type (might be due to invalid IL or missing references)
			//IL_0883: Unknown result type (might be due to invalid IL or missing references)
			//IL_0888: Unknown result type (might be due to invalid IL or missing references)
			//IL_088d: Unknown result type (might be due to invalid IL or missing references)
			//IL_088f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_089e: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0900: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0682: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_076e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0960: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a01: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Muzzle(o, d);
			Vector3 val2 = d.Flat();
			Vector3 normalized;
			if (!(((Vector3)(ref val2)).sqrMagnitude > 0.0001f))
			{
				val2 = who.Transform.forward.Flat();
				normalized = ((Vector3)(ref val2)).normalized;
			}
			else
			{
				val2 = d.Flat();
				normalized = ((Vector3)(ref val2)).normalized;
			}
			Vector3 fwd = normalized;
			float hit = v * MoveMult(boss);
			switch (boss)
			{
			case EnemyKind.Warden:
			{
				Vector3 val4 = Reach(o, d, 16f);
				Creature val5 = Along(o, val4, 1f).FirstOrDefault();
				AbsFx("warden", val, Object.op_Implicit((Object)(object)val5) ? Body(val5) : val4, who);
				if (!Object.op_Implicit((Object)(object)val5))
				{
					return 1f;
				}
				HitNumber(val5, Hurt(val5, hit, who));
				if (Object.op_Implicit((Object)(object)val5) && val5._hp.Value > 0 && !IsBoss(val5) && val5._hp.Value * 3 < MaxOf(val5))
				{
					HitNumber(val5, Hurt(val5, val5._hp.Value, who));
				}
				break;
			}
			case EnemyKind.Urchin:
			{
				Vector3 at = who.Transform.position + Vector3.up;
				for (int num = 0; num < 12; num++)
				{
					Vector3 val3 = Quaternion.AngleAxis(360f * (float)num / 12f, Vector3.up) * fwd;
					Vector3 end2 = at + val3 * 14f;
					foreach (Creature item in (from c in Targets()
						where DistToSegment(((Component)c).transform.position.Flat(), at.Flat(), end2.Flat()) <= 1f
						select c).OrderBy(delegate(Creature c)
					{
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0016: Unknown result type (might be due to invalid IL or missing references)
						//IL_001b: Unknown result type (might be due to invalid IL or missing references)
						Vector3 val10 = (((Component)c).transform.position - at).Flat();
						return ((Vector3)(ref val10)).sqrMagnitude;
					}).Take(2))
					{
						HitNumber(item, Hurt(item, hit, who));
					}
				}
				AbsFx("urchin", at, at + fwd, who, 12);
				break;
			}
			case EnemyKind.Angler:
			{
				Vector3 at3 = Land(o, d, 20f);
				AbsFx("angler", val, at3, who);
				foreach (Creature item2 in from c in Within(at3, 10f)
					where !IsBoss(c)
					select c)
				{
					Vector3 val9 = (((Component)item2).transform.position - at3).Flat();
					if (((Vector3)(ref val9)).magnitude > 1.8f)
					{
						Siege.Instance.ServerPull(item2, at3 + ((Vector3)(ref val9)).normalized * 1.8f, 0.6f);
					}
				}
				((MonoBehaviour)this).StartCoroutine(After(0.8f, delegate
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					foreach (Creature item3 in Within(at3, 5f))
					{
						HitNumber(item3, Hurt(item3, hit, who));
						Siege.Instance.Slow(item3, IsBoss(item3) ? 0.5f : 1f, 1.5f);
					}
				}));
				break;
			}
			case EnemyKind.Steed:
			{
				Vector3 val7 = Land(o, d, 18f);
				AbsFx("steed", val7, val7, who);
				foreach (Creature item4 in Within(val7, 5f))
				{
					HitNumber(item4, Hurt(item4, hit, who));
					Vector3 val8 = (((Component)item4).transform.position - val7).Flat();
					if (!IsBoss(item4))
					{
						Siege.Instance.ServerPush(item4, ((((Vector3)(ref val8)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val8)).normalized : fwd) * 7f);
					}
				}
				break;
			}
			case EnemyKind.Stonefish:
			{
				Vector3 a = Ground(who.Transform.position + fwd * 1.5f);
				Vector3 b = Ground(a + fwd * 14f);
				AbsFx("stone", a, b, who);
				foreach (Creature item5 in from c in Targets()
					where DistToSegment(((Component)c).transform.position.Flat(), a.Flat(), b.Flat()) <= 1.8f
					select c)
				{
					HitNumber(item5, Hurt(item5, hit, who));
					Envenom(item5, 3, hit, who);
				}
				break;
			}
			case EnemyKind.Skyfish:
			{
				List<Vector3> list = (from i in Enumerable.Range(0, 6)
					select Ground(who.Transform.position + fwd * (5f + 4f * (float)i))).ToList();
				AbsFx("sky", list[0] + Vector3.up * 6f, list[5] + Vector3.up * 6f, who);
				for (int num2 = 0; num2 < list.Count; num2++)
				{
					Vector3 p = list[num2];
					((MonoBehaviour)this).StartCoroutine(After(0.35f + 0.12f * (float)num2, delegate
					{
						//IL_0006: 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)
						AbsFx("bomb", p, p, who);
						foreach (Creature item6 in Targets().Where(delegate(Creature c)
						{
							//IL_0001: Unknown result type (might be due to invalid IL or missing references)
							//IL_0007: Unknown result type (might be due to invalid IL or missing references)
							//IL_000c: Unknown result type (might be due to invalid IL or missing references)
							//IL_0011: Unknown result type (might be due to invalid IL or missing references)
							Vector3 val10 = Body(c) - p;
							return ((Vector3)(ref val10)).sqrMagnitude <= 9f;
						}))
						{
							HitNumber(item6, Hurt(item6, hit, who));
						}
					}));
				}
				break;
			}
			case EnemyKind.Kraken:
			{
				Vector3 val6 = Land(o, d, 18f);
				AbsFx("kraken", val6 - fwd * 3f, val6, who);
				foreach (Creature item7 in Within(val6, 5f))
				{
					Siege.Instance.Slow(item7, IsBoss(item7) ? 0.5f : 1f, 3f);
				}
				_vortices.Add(new Vortex
				{
					At = val6,
					Until = Time.time + 3f,
					Dps = hit / Mathf.Max(0.01f, Scale),
					Owner = ((NetworkBehaviour)who).ObjectId
				});
				break;
			}
			case EnemyKind.Voxel:
			{
				Vector3 at2 = Land(o, d, 20f);
				Vector3 side = Vector3.Cross(Vector3.up, fwd);
				AbsFx("voxel", at2, at2 + fwd, who, Mathf.RoundToInt(400f));
				((MonoBehaviour)this).StartCoroutine(After(0.8f, delegate
				{
					//IL_0006: 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_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					//IL_005a: 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_006f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0070: Unknown result type (might be due to invalid IL or missing references)
					//IL_0077: 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_0092: Unknown result type (might be due to invalid IL or missing references)
					AbsFx("voxelDelete", at2, at2 + fwd, who, Mathf.RoundToInt(400f));
					foreach (Creature item8 in Targets())
					{
						Vector3 val10 = (((Component)item8).transform.position - at2).Flat();
						if (!(Mathf.Abs(Vector3.Dot(val10, fwd)) > 4f) && !(Mathf.Abs(Vector3.Dot(val10, side)) > 4f))
						{
							if (!IsBoss(item8) && (float)item8._hp.Value <= v * 10f)
							{
								HitNumber(item8, Hurt(item8, item8._hp.Value, who));
							}
							else
							{
								HitNumber(item8, Hurt(item8, hit, who));
							}
						}
					}
				}));
				break;
			}
			case EnemyKind.Koi:
			{
				Vector3 position = who.Transform.position;
				AbsFx("koi", val + fwd * 1.5f, val + fwd * 12f, who, 0, 1500);
				((MonoBehaviour)this).StartCoroutine(Breathe(position, fwd, hit, who));
				break;
			}
			default:
			{
				Vector3 end = Reach(o, d, 45f);
				foreach (Creature item9 in Along(o, end, 1.6f))
				{
					HitNumber(item9, Hurt(item9, hit, who));
				}
				AbsFx("eye", val, end, who);
				foreach (Creature item10 in Targets().OrderBy(delegate(Creature c)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					Vector3 val10 = ((Component)c).transform.position - end;
					return ((Vector3)(ref val10)).sqrMagnitude;
				}).Take(5).ToList())
				{
					Creature t = item10;
					AbsFx("spear", ((Component)t).transform.position, ((Component)t).transform.position, who);
					((MonoBehaviour)this).StartCoroutine(After(0.55f, delegate
					{
						if (Object.op_Implicit((Object)(object)t))
						{
							HitNumber(t, Hurt(t, v * 2f, who));
						}
					}));
				}
				break;
			}
			}
			return MoveSeconds(boss);
		}

		private IEnumerator Breathe(Vector3 from, Vector3 fwd, float hit, Player who)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 6; i++)
			{
				foreach (Creature item in Targets())
				{
					Vector3 val = (((Component)item).transform.position - from).Flat();
					if (((Vector3)(ref val)).sqrMagnitude <= 144f && Vector3.Angle(fwd, val) <= 25f)
					{
						HitNumber(item, Hurt(item, hit, who));
					}
				}
				yield return (object)new WaitForSeconds(0.25f);
			}
		}

		private static void AbsFx(string key, Vector3 a, Vector3 b, Player who, int pieceId = 0, int arg = 0)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (InstanceFinder.IsServerStarted)
			{
				InstanceFinder.ServerManager.Broadcast<FxEvent>(new FxEvent
				{
					Kind = FxKind.Absorber,
					Key = key,
					From = a,
					To = b,
					PieceId = pieceId,
					Arg = arg,
					Who = (Object.op_Implicit((Object)(object)who) ? ((NetworkBehaviour)who).ObjectId : 0)
				}, true, (Channel)0);
			}
		}

		private void AbsorberViews()
		{
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			VaultData vaultData = (Object.op_Implicit((Object)(object)Loot.Instance) ? Loot.Instance.ClientVault : null);
			HashSet<Transform> hashSet = new HashSet<Transform>();
			if (vaultData != null)
			{
				foreach (Player player in PlayerManager.Players)
				{
					Item item = ((Object.op_Implicit((Object)(object)player) && Object.op_Implicit((Object)(object)player.Holding)) ? player.Holding.HeldItem : null);
					if (WeaponItems.Is(item, out var g, out var _) && g == Gear.Absorber)
					{
						Transform val = WeaponItems.ModelOf(item);
						if (val != null)
						{
							hashSet.Add(val);
							Show(val, vaultData.AbsorbedOf(Loot.KeyOf(player))?.Id ?? 0);
						}
					}
				}
			}
			foreach (Transform item2 in _chambers.Keys.ToList())
			{
				if (!Object.op_Implicit((Object)(object)item2))
				{
					_chambers.Remove(item2);
					continue;
				}
				if (!hashSet.Contains(item2))
				{
					Show(item2, 0);
				}
				if (Object.op_Implicit((Object)(object)_chambers[item2].root))
				{
					Transform val2 = _chambers[item2].root.Find("Look");
					if (val2 != null)
					{
						val2.localRotation = Quaternion.Euler(15f, Time.time * 80f, 0f);
					}
				}
			}
		}

		private void Show(Transform model, byte id)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (_chambers.TryGetValue(model, out (byte, Transform) value) && value.Item1 == id && Object.op_Implicit((Object)(object)value.Item2))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)value.Item2))
			{
				Object.Destroy((Object)(object)((Component)value.Item2).gameObject);
			}
			Transform transform = new GameObject("AbsorberChamber").transform;
			transform.SetParent(model, false);
			transform.localPosition = DomeAt;
			if (!Object.op_Implicit((Object)(object)_glass))
			{
				_glass = BossVfx.Wash(new Color(0.75f, 0.92f, 1f, 0.2f));
			}
			WeaponFx.Piece(WeaponFx.Ball, _glass, transform).localScale = Vector3.one * 0.055f * 2f;
			if (id != 0)
			{
				Transform val = LookOf(id, 0.082499996f);
				if (val != null)
				{
					val.SetParent(transform, false);
					((Object)val).name = "Look";
				}
			}
			Transform[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Transform>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.layer = ((Component)model).gameObject.layer;
			}
			_chambers[model] = (id, transform);
		}

		internal static Transform LookOf(byte id, float size)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: 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_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: 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_00d3: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: 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_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			Item spawnable = GameInfo.GetSpawnable(id);
			if (!Object.op_Implicit((Object)(object)spawnable))
			{
				return null;
			}
			Transform transform = new GameObject("AbsorbedLook").transform;
			Transform transform2 = new GameObject("Inner").transform;
			transform2.SetParent(transform, false);
			Matrix4x4 worldToLocalMatrix = ((Component)spawnable).transform.worldToLocalMatrix;
			Bounds val = default(Bounds);
			bool flag = false;
			Renderer[] componentsInChildren = ((Component)spawnable).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val2 in componentsInChildren)
			{
				if (!val2.enabled || val2 is ParticleSystemRenderer || val2 is LineRenderer || val2 is TrailRenderer)
				{
					continue;
				}
				SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null);
				object obj;
				if (val3 == null)
				{
					MeshFilter component = ((Component)val2).GetComponent<MeshFilter>();
					obj = ((component != null) ? component.sharedMesh : null);
				}
				else
				{
					obj = val3.sharedMesh;
				}
				Mesh val4 = (Mesh)obj;
				if (!Object.op_Implicit((Object)(object)val4))
				{
					continue;
				}
				Matrix4x4 val5 = worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix;
				Transform transform3 = new GameObject("Part", new Type[2]
				{
					typeof(MeshFilter),
					typeof(MeshRenderer)
				}).transform;
				transform3.SetParent(transform2, false);
				transform3.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val5)).GetColumn(3));
				transform3.localRotation = ((Matrix4x4)(ref val5)).rotation;
				transform3.localScale = ((Matrix4x4)(ref val5)).lossyScale;
				((Component)transform3).GetComponent<MeshFilter>().sharedMesh = val4;
				MeshRenderer component2 = ((Component)transform3).GetComponent<MeshRenderer>();
				((Renderer)component2).sharedMaterials = val2.sharedMaterials;
				((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
				Bounds bounds = val4.bounds;
				for (int j = 0; j < 8; j++)
				{
					Vector3 val6 = ((Matrix4x4)(ref val5)).MultiplyPoint3x4(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))));
					if (flag)
					{
						((Bounds)(ref val)).Encapsulate(val6);
						continue;
					}
					((Bounds)(ref val))..ctor(val6, Vector3.zero);
					flag = true;
				}
			}
			if (!flag)
			{
				Object.Destroy((Object)(object)((Component)transform).gameObject);
				return null;
			}
			float num = size / Mathf.Max(0.01f, Mathf.Max(((Bounds)(ref val)).size.x, Mathf.Max(((Bounds)(ref val)).size.y, ((Bounds)(ref val)).size.z)));
			transform2.localScale = Vector3.one * num;
			transform2.localPosition = -((Bounds)(ref val)).center * num;
			return transform;
		}

		private string AbsorberLines(Rarity r, out string banner)
		{
			VaultData clientVault = Loot.Instance.ClientVault;
			ulong myKey = Loot.MyKey;
			StoredItem storedItem = clientVault.AbsorbedOf(myKey);
			Siege instance = Siege.Instance;
			float num = ((Object.op_Implicit((Object)(object)instance) && instance.ViewActive) ? FortressPlugin.HpMult(instance.View.Wave) : 1f);
			int num2 = Mathf.RoundToInt(clientVault.WeaponValue(myKey, Gear.Absorber, r) * num);
			if (storedItem == null)
			{
				banner = L10n.T("absorberEmpty");
				return L10n.T("absorberEmptyHow", SuckReach(clientVault, myKey).ToString("0.#"));
			}
			Item spawnable = GameInfo.GetSpawnable(storedItem.Id);
			string text = (Object.op_Implicit((Object)(object)spawnable) ? spawnable.GetName() : ("#" + storedItem.Id));
			string text2;
			if (!Copies(spawnable, out var g, out var r2))
			{
				text2 = ((!BossTrophies.Is(spawnable, out var k)) ? L10n.T("absorberShot", Mathf.RoundToInt((float)num2 * ShotMult(storedItem.Worth)), storedItem.Worth.ToString("N0"), ShotMult(storedItem.Worth).ToString("0.#")) : ("<b>" + L10n.T("absMove" + k) + "</b>:" + L10n.T("absMoveFx" + k, Mathf.RoundToInt((float)num2 * MoveMult(k)))));
			}
			else
			{
				Rarity r3 = CopyRarity(r2, r);
				text = GearCatalog.Label(g, r2);
				text2 = L10n.T("absorberCopy", GearCatalog.Label(g, r3)) + "\n" + clientVault.EffectFor(myKey, g, r3);
			}
			banner = L10n.T("absorberIn", text) + "\u3000<size=80%>" + text2.Split('\n')[0] + "</size>";
			return text2 + "\n" + L10n.T("absorberBoost", 2.5f.ToString("0.#")) + "\n" + L10n.T("absorberSpit", FlingMult(storedItem.Worth).ToString("0.#"));
		}

		private void AbsorberTop(string banner)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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)
			if (banner == null)
			{
				if (Object.op_Implicit((Object)(object)_absTop))
				{
					((Component)_absTop).gameObject.SetActive(false);
				}
				return;
			}
			if (!Object.op_Implicit((Object)(object)_absTop))
			{
				_absTop = Hud.Box(Hud.Root, new Vector2(0.5f, 1f), new Vector2(0f, -150f), new Vector2(600f, 46f), Hud.Panel, 16f);
				_absTopText = Hud.Label(((Component)_absTop).transform, "", 22f, new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(1400f, 40f), (TextAlignmentOptions)514);
			}
			((Component)_absTop).gameObject.SetActive(true);
			if (!(((TMP_Text)_absTopText).text == banner))
			{
				((TMP_Text)_absTopText).text = banner;
				((Graphic)_absTop).rectTransform.sizeDelta = new Vector2(((TMP_Text)_absTopText).GetPreferredValues(banner).x + 48f, 46f);
			}
		}

		private static Gear BarGear(Gear g)
		{
			StoredItem storedItem = ((g == Gear.Absorber && Object.op_Implicit((Object)(object)Loot.Instance)) ? Loot.Instance.ClientVault.AbsorbedOf(Loot.MyKey) : null);
			if (storedItem == null || !Copies(GameInfo.GetSpawnable(storedItem.Id), out var g2, out var _))
			{
				return g;
			}
			return g2;
		}

		private void AbsorberKeys(bool can)
		{
			Mouse current = Mouse.current;
			bool flag = can && current != null && current.rightButton.isPressed;
			if (flag && (!_rightHeld || Time.time >= _nextRight))
			{
				Send((byte)(_rightHeld ? 4 : 3));
				_nextRight = Time.time + 0.1f;
			}
			else if (!flag && _rightHeld)
			{
				Send(5);
			}
			_rightHeld = flag;
			Keyboard current2 = Keyboard.current;
			if (can && current2 != null && ((ButtonControl)current2.rKey).wasPressedThisFrame)
			{
				Send(6);
			}
		}

		private static bool Lobbed(Gear g)
		{
			if (g != Gear.PoisonGas && g != Gear.Whirlpool && g != Gear.NetLauncher && g != Gear.JellyGun)
			{
				return g == Gear.PufferBomb;
			}
			return true;
		}

		private static bool Aimed(Gear g)
		{
			if (g != Gear.BubbleGun && g != Gear.Hook && g != Gear.StarThrower && g != Gear.Boomerang)
			{
				return g == Gear.LobsterClaw;
			}
			return true;
		}

		private void CastIndicator(Gear? held, Rarity r)
		{
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: 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_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0774: Unknown result type (might be due to invalid IL or missing references)
			//IL_0779: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: 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_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_07aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0724: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			Gear? obj;
			if (held.HasValue)
			{
				Gear valueOrDefault = held.GetValueOrDefault();
				obj = BarGear(valueOrDefault);
			}
			else
			{
				obj = null;
			}
			Gear? gear = obj;
			Camera curCamera = GameInfo.CurCamera;
			Player localPlayer = Player.LocalPlayer;
			bool ready;
			float pulse;
			bool past;
			Transform[] array;
			if (gear.HasValue)
			{
				Gear valueOrDefault2 = gear.GetValueOrDefault();
				if ((valueOrDefault2 == Gear.SharkWhistle || valueOrDefault2 == Gear.Rocket || valueOrDefault2 == Gear.Conch || Lobbed(valueOrDefault2) || Aimed(valueOrDefault2)) && Object.op_Implicit((Object)(object)curCamera) && Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)localPlayer.Transform) && !_drawn && !Hud.ModalOpen && !BuildSystem.Building)
				{
					if (!Object.op_Implicit((Object)(object)_castRing))
					{
						_castRingMat = BossVfx.Wash(Color.white);
						_castMarkMat = BossVfx.Wash(Color.white);
						_castRing = WeaponFx.Piece(BossVfx.Ring(0f), _castRingMat);
						_castMark = WeaponFx.Piece(BossVfx.Ring(0.35f), _castMarkMat);
						_castMark2 = WeaponFx.Piece(BossVfx.Ring(0.35f), _castMarkMat);
						_castCone = WeaponFx.Piece(Sector(30), _castRingMat);
						_coneHalf = 30;
						array = (Transform[])(object)new Transform[4] { _castRing, _castMark, _castMark2, _castCone };
						foreach (Transform obj2 in array)
						{
							((Object)obj2).name = "FortressCastIndicator";
							Object.DontDestroyOnLoad((Object)(object)((Component)obj2).gameObject);
						}
					}
					Gear value = gear.Value;
					VaultData vaultData = (Object.op_Implicit((Object)(object)Loot.Instance) ? Loot.Instance.ClientVault : null);
					Gear? gear2 = held;
					Gear g = Gear.Absorber;
					StoredItem storedItem = ((gear2 == g && vaultData != null) ? vaultData.AbsorbedOf(Loot.MyKey) : null);
					Rarity r2;
					bool flag = ((storedItem != null && Copies(GameInfo.GetSpawnable(storedItem.Id), out g, out r2)) ? CopyRarity(r2, r) : r) == Rarity.Legendary;
					float num = WeaponMods.ReachMult(vaultData?.ModOf(Loot.MyKey, value, 3) ?? 0);
					float num2 = WeaponMods.TraitAdd(value, vaultData?.ModOf(Loot.MyKey, value, 2) ?? 0);
					_mine.TryGetValue(value, out (float, float, float) value2);
					ready = Time.time >= value2.Item2;
					pulse = 0.5f + 0.5f * Mathf.Sin(Time.time * 6f);
					Vector3 position = ((Component)curCamera).transform.position;
					Vector3 forward = ((Component)curCamera).transform.forward;
					past = false;
					Vector3 val5;
					if (value == Gear.SharkWhistle)
					{
						Vector3 val = Reach(position, forward, 30f);
						RaycastHit val2 = default(RaycastHit);
						if (Physics.Raycast(val + Vector3.up * 0.5f, Vector3.down, ref val2, 40f, LayerMask.op_Implicit(GameInfo.LevelLayer)))
						{
							val = ((RaycastHit)(ref val2)).point;
						}
						Vector3 at = OnSea(val);
						Disc(at, 14f * num);
						Mark(_castMark, at, 1.3f);
						((Component)_castMark2).gameObject.SetActive(flag);
						if (flag)
						{
							Transform castMark = _castMark2;
							Vector3 val3 = val;
							Quaternion val4 = Quaternion.Euler(0f, 90f, 0f);
							val5 = forward.Flat();
							Mark(castMark, OnSea(val3 + val4 * ((Vector3)(ref val5)).normalized * 4f), 1.3f);
						}
						Off((Transform[])(object)new Transform[1] { _castCone });
					}
					else if (Lobbed(value))
					{
						Vector3 at2 = Land(position, forward, RangeOf(value) * num);
						Disc(at2, value switch
						{
							Gear.NetLauncher => (3.5f + num2) * (flag ? 1.5f : 1f), 
							Gear.JellyGun => 3f, 
							Gear.Whirlpool => 6f, 
							Gear.PoisonGas => 3f, 
							_ => 3.5f + num2, 
						});
						Mark(_castMark, at2, 0.8f);
						Off((Transform[])(object)new Transform[2] { _castMark2, _castCone });
					}
					else
					{
						switch (value)
						{
						case Gear.Rocket:
						{
							Vector3 val7 = Reach(position, forward, 40f * num);
							Creature val8 = Along(position, val7, 1.2f).FirstOrDefault();
							Vector3 at3 = (Object.op_Implicit((Object)(object)val8) ? ((Component)val8).transform.position : Grounded(val7));
							Disc(at3, 3f + num2);
							Mark(_castMark, at3, 0.8f);
							Off((Transform[])(object)new Transform[2] { _castMark2, _castCone });
							break;
						}
						case Gear.Conch:
						{
							int num5 = Mathf.RoundToInt(Mathf.Min(80f, 30f + num2));
							if (num5 != _coneHalf)
							{
								MeshFilter component = ((Component)_castCone).GetComponent<MeshFilter>();
								Object.Destroy((Object)(object)component.sharedMesh);
								component.sharedMesh = Sector(num5);
								_coneHalf = num5;
							}
							float num6 = 10f * num;
							Put(_castCone, Grounded(localPlayer.Transform.position + Vector3.up) + Vector3.up * 0.08f, new Vector3(num6, 1f, num6));
							Vector3 val9 = forward.Flat();
							if (((Vector3)(ref val9)).sqrMagnitude > 0.001f)
							{
								_castCone.rotation = Quaternion.LookRotation(val9);
							}
							Off((Transform[])(object)new Transform[3] { _castRing, _castMark, _castMark2 });
							break;
						}
						default:
						{
							float num3 = RangeOf(value) * num;
							Vector3 val6 = Reach(position, forward, num3);
							List<Creature> list = Along(position, val6, value switch
							{
								Gear.Boomerang => 1.3f, 
								Gear.LobsterClaw => 1.1f, 
								_ => 0.8f, 
							});
							int num4;
							if (list.Count == 0)
							{
								val5 = val6 - position;
								num4 = ((((Vector3)(ref val5)).sqrMagnitude >= (num3 - 0.05f) * (num3 - 0.05f)) ? 1 : 0);
							}
							else
							{
								num4 = 0;
							}
							past = (byte)num4 != 0;
							Mark(_castMark, (list.Count > 0) ? ((Component)list[0]).transform.position : Grounded(val6), 1.1f);
							Off((Transform[])(object)new Transform[3] { _castRing, _castMark2, _castCone });
							break;
						}
						}
					}
					Color val10 = Tint();
					_castRingMat.color = new Color(val10.r, val10.g, val10.b, ready ? 0.42f : 0.24f);
					_castMarkMat.color = new Color(val10.r, val10.g, val10.b, (ready ? 0.55f : 0.3f) + 0.3f * pulse);
					return;
				}
			}
			array = (Transform[])(object)new Transform[4] { _castRing, _castMark, _castMark2, _castCone };
			foreach (Transform val11 in array)
			{
				if (Object.op_Implicit((Object)(object)val11) && ((Component)val11).gameObject.activeSelf)
				{
					((Component)val11).gameObject.SetActive(false);
				}
			}
			void Disc(Vector3 val12, float radius)
			{
				//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_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				Put(_castRing, val12 + Vector3.up * 0.08f, new Vector3(radius, 1f, radius));
			}
			void Mark(Transform t, Vector3 val12, float size)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				Put(t, val12 + Vector3.up * 0.1f, Vector3.one * size * (1f + 0.2f * pulse));
			}
			static void Off(params Transform[] ts)
			{
				foreach (Transform val12 in ts)
				{
					if (((Component)val12).gameObject.activeSelf)
					{
						((Component)val12).gameObject.SetActive(false);
					}
				}
			}
			Color Tint()
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				if (!past)
				{
					if (!ready)
					{
						return new Color(0.62f, 0.64f, 0.68f);
					}
					return new Color(0.35f, 0.85f, 1f);
				}
				return new Color(1f, 0.42f, 0.3f);
			}
		}

		private static void Put(Transform t, Vector3 at, Vector3 scale)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (!((Component)t).gameObject.activeSelf)
			{
				((Component)t).gameObject.SetActive(true);
			}
			t.position = at;
			t.localScale = scale;
		}

		private static Vector3 Grounded(Vector3 p)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(p + Vector3.up * 0.5f, Vector3.down, ref val, 40f, LayerMask.op_Implicit(GameInfo.LevelLayer)))
			{
				p = ((RaycastHit)(ref val)).point;
			}
			p.y = Mathf.Max(p.y, WaterManager.GetWaterHeight(p));
			return p;
		}

		private static Mesh Sector(int half)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			List<Vector3> list = new List<Vector3> { Vector3.zero };
			List<Color> list2 = new List<Color>
			{
				new Color(1f, 1f, 1f, 0f)
			};
			List<int> list3 = new List<int>();
			for (int i = 0; i <= 24; i++)
			{
				float num = MathF.PI / 180f * Mathf.Lerp((float)(-half), (float)half, (float)i / 24f);
				list.Add(new Vector3(Mathf.Sin(num), 0f, Mathf.Cos(num)));
				list2.Add(Color.white);
				if (i > 0)
				{
					list3.AddRange(new int[3]
					{
						0,
						i,
						i + 1
					});
				}
			}
			Mesh val = new Mesh
			{
				name = "FortressCone" + half
			};
			val.SetVertices(list);
			val.SetColors(list2);
			val.SetTriangles(list3, 0);
			val.RecalculateBounds();
			return val;
		}

		public static float[] BoomerangFan(Rarity r)
		{
			return r switch
			{
				Rarity.Rare => new float[2] { -6f, 6f }, 
				Rarity.Epic => new float[3] { -10f, 0f, 10f }, 
				Rarity.Legendary => new float[4] { -15f, -5f, 5f, 15f }, 
				_ => new float[1], 
			};
		}

		public static float RangeOf(Gear g)
		{
			switch (g)
			{
			case Gear.Laser:
				return 30f;
			case Gear.Rocket:
				return 40f;
			case Gear.BubbleGun:
			case Gear.Hook:
				return 25f;
			case Gear.StarThrower:
				return 25f;
			case Gear.PoisonGas:
				return 24f;
			case Gear.Whirlpool:
				return 24f;
			case Gear.NetLauncher:
				return 24f;
			case Gear.JellyGun:
				return 24f;
			case Gear.PufferBomb:
				return 24f;
			case Gear.Boomerang:
				return 18f;
			case Gear.Conch:
				return 10f;
			case Gear.WaterCannon:
				return 15f;
			case Gear.LobsterClaw:
				return 12f;
			case Gear.SharkWhistle:
				return 14f;
			case Gear.Absorber:
				return 8f;
			case Gear.Gatling:
				return 30f;
			default:
				return 0f;
			}
		}

		public static string ModelName(Gear g)
		{
			return g switch
			{
				Gear.Laser => "LaserGun", 
				Gear.PoisonGas => "GasGun", 
				Gear.Boomerang => "Boomerang", 
				Gear.SharkWhistle => "SharkWhistle", 
				Gear.BubbleGun => "BubbleGun", 
				Gear.Hook => "HookGun", 
				Gear.Whirlpool => "WhirlCannon", 
				Gear.Conch => "Conch", 
				_ => g.ToString(), 
			};
		}

		public static float LaserRamp(float seconds, float max = 3f)
		{
			return Mathf.Min(max, 1f + Mathf.Max(0f, seconds) / 2f * (max - 1f));
		}

		public static float GatlingShots(float spin, float rate = 12f)
		{
			return rate * Mathf.Lerp(0.25f, 1f, Mathf.Clamp01(spin));
		}

		public static Vector3 BoomerangAt(Vector3 a, Vector3 b, float t)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (t <= 0.55f)
			{
				return Vector3.Lerp(a, b, Mathf.Sin(Mathf.Clamp01(t / 0.55f) * MathF.PI * 0.5f));
			}
			return Vector3.Lerp(b, a, 1f - Mathf.Cos(Mathf.Clamp01((t - 0.55f) / 0.55f) * MathF.PI * 0.5f));
		}

		public static int ClawPick(Vector3 o, Vector3 end, IList<Vector3> bodies)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			int num = -1;
			float num2 = float.MaxValue;
			Vector3 val = end - o;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			for (int i = 0; i < bodies.Count; i++)
			{
				float num3 = Vector3.Dot(bodies[i] - o, normalized);
				if (num3 > 0f && num3 < num2 && DistToSegment(bodies[i], o, end) <= 1.1f)
				{
					num2 = num3;
					num = i;
				}
			}
			if (num >= 0)
			{
				return num;
			}
			val = normalized.Flat();
			Vector3 normalized2 = ((Vector3)(ref val)).normalized;
			float num4 = 12.25f;
			for (int j = 0; j < bodies.Count; j++)
			{
				Vector3 val2 = (bodies[j] - o).Flat();
				if (((Vector3)(ref val2)).sqrMagnitude <= num4 && Vector3.Angle(normalized2, val2) < 60f)
				{
					num4 = ((Vector3)(ref val2)).sqrMagnitude;
					num = j;
				}
			}
			return num;
		}

		public static float DistToSegment(Vector3 p, Vector3 a, Vector3 b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			Vector3 val = b - a;
			float num = Mathf.Clamp01(Vector3.Dot(p - a, val) / Mathf.Max(0.0001f, ((Vector3)(ref val)).sqrMagnitude));
			Vector3 val2 = a + val * num - p;
			return ((Vector3)(ref val2)).magnitude;
		}

		private void Awake()
		{
			Instance = this;
		}

		static Weapons()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			DomeAt = new Vector3(0f, 0.21f, 0.02f);
			LaserHeatSeconds = new float[4] { 4.5f, 5.5f, 6.5f, 8f };
			SharkLife = new float[4] { 15f, 17f, 20f, 25f };
			WaterTankSeconds = new float[4] { 3.5f, 4f, 4.5f, 5.5f };
			StarCount = new int[4] { 3, 3, 4, 5 };
			Wild = AccessTools.FieldRefAccess<CreatureManager, List<Creature>>("_aliveCreatures");
			BossBoxes = new Dictionary<Creature, (float, Bounds)>();
			OpenSlotMethod = AccessTools.Method(typeof(PlayerInventory), "GetOpenSlot", (Type[])null, (Type[])null);
			HeatStops = (Color[])(object)new Color[5]
			{
				new Color(1f, 0.22f, 0.18f),
				new Color(0.3f, 1f, 0.35f),
				new Color(0.3f, 0.55f, 1f),
				new Color(0.75f, 0.35f, 1f),
				Color.white
			};
			NetHoop = new Vector3(0f, -0.12f, 0.962f);
			Vector3 val = new Vector3(0f, -0.954f, -0.301f);
			NetHang = ((Vector3)(ref val)).normalized;
			GenericWriter<WeaponFire>.SetWrite((Action<Writer, WeaponFire>)delegate(Writer w, WeaponFire v)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				w.WriteByte(v.Phase);
				w.WriteVector3(v.Origin);
				w.WriteVector3(v.Dir);
			});
			GenericReader<WeaponFire>.SetRead((Func<Reader, WeaponFire>)((Reader r) => new WeaponFire
			{
				Phase = r.ReadByte(),
				Origin = r.ReadVector3(),
				Dir = r.ReadVector3()
			}));
			GenericWriter<WeaponState>.SetWrite((Action<Writer, WeaponState>)delegate(Writer w, WeaponState v)
			{
				w.WriteInt32(v.PlayerId);
				w.WriteByte((byte)v.Gear);
				w.WriteSingle(v.Heat);
				w.WriteSingle(v.ReadyIn);
			});
			GenericReader<WeaponState>.SetRead((Func<Reader, WeaponState>)((Reader r) => new WeaponState
			{
				PlayerId = r.ReadInt32(),
				Gear = (Gear)r.ReadByte(),
				Heat = r.ReadSingle(),
				ReadyIn = r.ReadSingle()
			}));
		}

		private void Update()
		{
			NetworkManager networkManager = InstanceFinder.NetworkManager;
			if (Object.op_Implicit((Object)(object)networkManager) && (Object)(object)networkManager != (Object)(object)_registeredOn)
			{
				_registeredOn = networkManager;
				networkManager.ServerManager.RegisterBroadcast<WeaponFire>(Net.Safe(delegate(NetworkConnection conn, WeaponFire f, Channel ch)
				{
					Player val = ((IEnumerable<Player>)PlayerManager.Players).FirstOrDefault((Func<Player, bool>)((Player p) => Object.op_Implicit((Object)(object)p) && ((NetworkBehaviour)p).Owner == conn));
					if (Object.op_Implicit((Object)(object)val))
					{
						ServerFire(val, f);
					}
				}), true);
				networkManager.ClientManager.RegisterBroadcast<WeaponState>((Action<WeaponState, Channel>)delegate(WeaponState s, Channel ch)
				{
					OnState(s);
				});
				networkManager.ClientManager.OnClientConnectionState += delegate(ClientConnectionStateArgs a)
				{
					//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_0007: Invalid comparison between Unknown and I4
					if ((int)a.ConnectionState == 1)
					{
						ClearViews();
					}
				};
			}
			if (InstanceFinder.IsServerStarted)
			{
				ServerTick();
			}
			ClientTick();
		}

		public static float FlingMult(int worth)
		{
			return 1f + Mathf.Sqrt((float)Mathf.Max(0, worth) / 50f);
		}

		public static bool OnLine(Item it)
		{
			if (Object.op_Implicit((Object)(object)Instance) && Object.op_Implicit((Object)(object)it))
			{
				if (!Instance._hooked.ContainsValue(it))
				{
					return Instance._flung.Any((Fling f) => (Object)(object)f.Item == (Object)(object)it);
				}
				return true;
			}
			return false;
		}

		private static Player PlayerById(int id)
		{
			return ((IEnumerable<Player>)PlayerManager.Players).FirstOrDefault((Func<Player, bool>)((Player p) => Object.op_Implicit((Object)(object)p) && ((NetworkBehaviour)p).ObjectId == id));
		}

		private static List<Creature> Targets()
		{
			IEnumerable<Creature> enumerable = FortressPlugin.Alive;
			if (Object.op_Implicit((Object)(object)CreatureManager.Instance))
			{
				enumerable = enumerable.Concat(Wild.Invoke(CreatureManager.Instance));
			}
			return enumerable.Where((Creature c) => Object.op_Implicit((Object)(object)c) && ((NetworkBehaviour)c).IsSpawned && c._hp.Value > 0 && !Object.op_Implicit((Object)(object)((Item)c).Holder) && !Siege.Instance.IsHidden(c) && !Bosses.Entering(c)).Distinct().ToList();
		}

		private static Vector3 Body(Creature c)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)c).transform.position + Vector3.up * 0.5f;
		}

		private static float SizeOf(Creature c)
		{
			if (!Object.op_Implicit((Object)(object)Enemies.Instance) || !Enemies.Instance.TryGet(c, out var tag))
			{
				return 1f;
			}
			return Mathf.Max(1f, Enemies.StatsOf(tag).Scale);
		}

		private static bool IsBoss(Creature c)
		{
			if (Enemies.Instance.TryGet(c, out var tag))
			{
				return EnemyCatalog.IsBoss(tag.Kind);
			}
			return false;
		}

		private static bool IsSpitter(Creature c)
		{
			if (Enemies.Instance.TryGet(c, out var tag))
			{
				return tag.Kind == EnemyKind.Spitter;
			}
			return false;
		}

		private static List<Creature> Along(Vector3 a, Vector3 b, float radius)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return (from c in Targets()
				where Touches(c, a, b, radius)
				select c).OrderBy(delegate(Creature c)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = Body(c) - a;
				return ((Vector3)(ref val)).sqrMagnitude;
			}).ToList();
		}

		private static float Girth(Creature c)
		{
			return 0.45f * (SizeOf(c) - 1f);
		}

		private static Bounds BoxOf(Creature c, float radius)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (!BossBoxes.TryGetValue(c, out (float, Bounds) value) || Time.time > value.Item1)
			{
				if (BossBoxes.Count > 20)
				{
					BossBoxes.Clear();
				}
				value = (BossBoxes[c] = (Time.time + 1f, BossLooks.WorldBounds(((Component)c).transform)));
			}
			Bounds item = value.Item2;
			((Bounds)(ref item)).Expand(radius * 2f);
			return item;
		}

		private static bool Touches(Creature c, Vector3 a, Vector3 b, float radius)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_000f: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (!IsBoss(c))
			{
				return DistToSegment(Body(c), a, b) <= radius + Girth(c);
			}
			Bounds val = BoxOf(c, radius);
			Vector3 val2 = b - a;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			if (!((Bounds)(ref val)).C