Decompiled source of OlympianArsenal v2.1.0

OlympianArsenal.dll

Decompiled a day 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.Text;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Extensions;
using Jotunn.Managers;
using Jotunn.Utils;
using MagicaCloth2;
using Microsoft.CodeAnalysis;
using OlympianArsenal.Armor;
using OlympianArsenal.DebugTools;
using OlympianArsenal.Runtime;
using OlympianArsenal.Weapons;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("OlympianArsenal")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0+6f08c044ceb59955be47a23fcead3a9baf2b9185")]
[assembly: AssemblyProduct("OlympianArsenal")]
[assembly: AssemblyTitle("OlympianArsenal")]
[assembly: AssemblyVersion("2.1.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 OlympianArsenal
{
	[BepInPlugin("com.olympianarsenal.valheim", "OlympianArsenal", "2.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static string Dir;

		internal static ConfigEntry<bool> TraceAttacks;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Expected O, but got Unknown
			Dir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			Cfg.BindVersion(((BaseUnityPlugin)this).Config);
			TraceAttacks = Cfg.Advanced(((BaseUnityPlugin)this).Config, "Debug", "Trace attacks", def: false, "Log every attack trigger of our weapons (for tuning).");
			KeysMenu.BindConfig(((BaseUnityPlugin)this).Config);
			Controls.BindConfig(((BaseUnityPlugin)this).Config);
			StructureGuard.BindConfig(((BaseUnityPlugin)this).Config);
			QualityLooks.BindConfig(((BaseUnityPlugin)this).Config);
			Hugin.BindConfig(((BaseUnityPlugin)this).Config);
			StandPoses.BindConfig(((BaseUnityPlugin)this).Config);
			EpicLootNames.BindConfig(((BaseUnityPlugin)this).Config);
			SkyBolt.BindConfig(((BaseUnityPlugin)this).Config);
			BladeOfOlympus.BindConfig(((BaseUnityPlugin)this).Config);
			BladesOfChaos.BindConfig(((BaseUnityPlugin)this).Config);
			LeviathanAxe.BindConfig(((BaseUnityPlugin)this).Config);
			Mjolnir.BindConfig(((BaseUnityPlugin)this).Config);
			HuldraPick.BindConfig(((BaseUnityPlugin)this).Config);
			GuardianShield.BindConfig(((BaseUnityPlugin)this).Config);
			Draupnir.BindConfig(((BaseUnityPlugin)this).Config);
			TalonBow.BindConfig(((BaseUnityPlugin)this).Config);
			ValkyrieArmor.BindConfig(((BaseUnityPlugin)this).Config);
			RageArmor.BindConfig(((BaseUnityPlugin)this).Config);
			RageSettings.BindConfig(((BaseUnityPlugin)this).Config);
			ThorArmor.BindConfig(((BaseUnityPlugin)this).Config);
			ThorSettings.BindConfig(((BaseUnityPlugin)this).Config);
			BodyHiding.BindConfig(((BaseUnityPlugin)this).Config);
			UpgradeCosts.BindConfig(((BaseUnityPlugin)this).Config, BladesOfChaos.Costs, LeviathanAxe.Costs, Mjolnir.Costs, BladeOfOlympus.Costs, ValkyrieArmor.ChestCosts, ValkyrieArmor.LegsCosts, ValkyrieArmor.HelmetCosts, HuldraPick.Costs, GuardianShield.Costs, RageArmor.ChestCosts, RageArmor.LegsCosts, RageArmor.HelmetCosts, RageArmor.CloakCosts, Draupnir.Costs, TalonBow.Costs, ThorArmor.ChestCosts, ThorArmor.LegsCosts, ThorArmor.HoodCosts, ThorArmor.CloakCosts);
			SpecialAttacks.BindConfig(((BaseUnityPlugin)this).Config);
			SecondaryCooldowns.BindConfig(((BaseUnityPlugin)this).Config);
			HudSettings.BindConfig(((BaseUnityPlugin)this).Config);
			Cfg.StampVersion();
			Controls.AddInput();
			Mjolnir.AddInput();
			SpecialKeys.AddInput();
			KeyRows.Watch();
			ThrowRegistry.Register(LeviathanThrown.CreateDef());
			CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
			string text = "English";
			localization.AddTranslation(ref text, Controls.English);
			text = "English";
			localization.AddTranslation(ref text, BladeOfOlympus.English);
			text = "English";
			localization.AddTranslation(ref text, BladesOfChaos.English);
			text = "English";
			localization.AddTranslation(ref text, ChaosWarmth.English);
			text = "English";
			localization.AddTranslation(ref text, LeviathanAxe.English);
			text = "English";
			localization.AddTranslation(ref text, LeviathanFrost.English);
			text = "English";
			localization.AddTranslation(ref text, Mjolnir.English);
			text = "English";
			localization.AddTranslation(ref text, HuldraPick.English);
			text = "English";
			localization.AddTranslation(ref text, GuardianShield.English);
			text = "English";
			localization.AddTranslation(ref text, Draupnir.English);
			text = "English";
			localization.AddTranslation(ref text, TalonBow.English);
			text = "English";
			localization.AddTranslation(ref text, ValkyrieArmor.English);
			text = "English";
			localization.AddTranslation(ref text, RageArmor.English);
			text = "English";
			localization.AddTranslation(ref text, RageSettings.English);
			text = "English";
			localization.AddTranslation(ref text, ThorArmor.English);
			text = "English";
			localization.AddTranslation(ref text, ThorSettings.English);
			text = "English";
			localization.AddTranslation(ref text, UpgradeCosts.English);
			text = "English";
			localization.AddTranslation(ref text, TipLines.English);
			text = "English";
			localization.AddTranslation(ref text, Hugin.English);
			text = "English";
			localization.AddTranslation(ref text, SpecialAttacks.English);
			text = "English";
			localization.AddTranslation(ref text, SecondaryCooldowns.English);
			text = "English";
			localization.AddTranslation(ref text, HudSettings.English);
			text = "English";
			localization.AddTranslation(ref text, KeyRows.English);
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyDumpCommand());
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyTuneCommand());
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyFxCommand());
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyRageCommand());
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyThorCommand());
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyStandCommand());
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyHuginCommand());
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyHudCommand());
			PrefabManager.OnVanillaPrefabsAvailable += AddItems;
			_harmony = new Harmony("com.olympianarsenal.valheim");
			_harmony.PatchAll(typeof(Plugin).Assembly);
			Logger.LogInfo((object)("OlympianArsenal 2.1.0 loaded from " + Dir));
		}

		private void Start()
		{
			Controls.WarnAboutKeyConflicts();
			EpicLootNames.Install(_harmony);
		}

		private void AddItems()
		{
			PrefabManager.OnVanillaPrefabsAvailable -= AddItems;
			Safe("Shared effects", SkyBolt.Register);
			Safe("Blade of Olympus", BladeOfOlympus.Register);
			Safe("Blades of Chaos", BladesOfChaos.Register);
			Safe("Leviathan Axe", LeviathanAxe.Register);
			Safe("Mjolnir", Mjolnir.Register);
			Safe("Huldra Pick", HuldraPick.Register);
			Safe("Guardian Shield", GuardianShield.Register);
			Safe("Draupnir Spear", Draupnir.Register);
			Safe("Talon Bow", TalonBow.Register);
			Safe("Special attacks", SpecialAttacks.Register);
			Safe("Secondary cooldowns", SecondaryCooldowns.Register);
			Safe("Valkyrie armor", ValkyrieArmor.Register);
			Safe("Rage armor", RageArmor.Register);
			Safe("Thor armor", ThorArmor.Register);
			Safe("Wall stands", WallStands.Register);
			Safe("Level icons", LevelIcons.Register);
		}

		private static void Safe(string what, Action register)
		{
			try
			{
				register();
			}
			catch (Exception arg)
			{
				Logger.LogError((object)$"{what} failed to register: {arg}");
			}
		}

		private void Update()
		{
			ThrowController.Tick();
			DraupnirSpears.Tick();
			DraupnirPrompt.Tick();
			TalonDraw.Tick();
			TalonMarkView.Tick();
			SpecialController.Tick();
			PlayerFlight.Tick();
			LightningDash.Tick();
			ArsenalQueue.Tick();
			Controls.TickClashNote();
			RageMeter.Tick();
			RageHud.Tick();
			RageGlowMaps.Tick();
			ThorMeter.Tick();
			ThorHud.Tick();
			OlyHud.Tick();
		}

		private void FixedUpdate()
		{
			ThrowController.FixedTick();
			DraupnirSpears.FixedTick();
			SpecialController.FixedTick();
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	internal static class PluginInfo
	{
		public const string Guid = "com.olympianarsenal.valheim";

		public const string Name = "OlympianArsenal";

		public const string Version = "2.1.0";
	}
}
namespace OlympianArsenal.Weapons
{
	internal static class BladeOfOlympus
	{
		public const string Prefab = "OLY_BladeOfOlympus";

		public const string Token = "$item_oly_bladeofolympus";

		private const string BasePrefab = "THSwordKrom";

		private const string ChainPrefab = "OLY_ChainLightning_Olympus";

		internal const string LookKey = "Olympus";

		private static ConfigEntry<float> _slash;

		private static ConfigEntry<float> _slashPerLevel;

		private static ConfigEntry<float> _lightning;

		private static ConfigEntry<float> _lightningPerLevel;

		private static ConfigEntry<float> _chainChance;

		private static ConfigEntry<float> _chainChanceSecondary;

		private static ConfigEntry<float> _chainDamage;

		private static ConfigEntry<float> _chainJump;

		private static ConfigEntry<float> _slamDamage;

		private static ConfigEntry<float> _slamStamina;

		private static ConfigEntry<float> _slamRadius;

		private static ConfigEntry<float> _glowIntensity;

		internal static ConfigEntry<Vector3> ModelOffset;

		internal static ConfigEntry<Vector3> ModelEuler;

		internal static ConfigEntry<float> ModelScale;

		public static readonly Dictionary<string, string> English = new Dictionary<string, string>
		{
			{ "item_oly_bladeofolympus", "Blade of Olympus" },
			{ "item_oly_bladeofolympus_description", "A god-forged greatsword humming with stolen thunder." },
			{ "oly_olympus_power", "Powers" },
			{ "oly_olympus_unlock_chain", "Chain lightning forks to one more enemy at every jump" },
			{ "oly_olympus_unlock_storm", "Storm strike: Divine Reckoning calls a sky bolt onto the strongest enemy it hits" },
			{ "oly_olympus_unlock_wrath", "Wrath of Olympus: a wider Divine Reckoning that staggers every enemy it hits" },
			{ "oly_olympus_unlocks_off", "Upgrade powers are switched off" },
			{ "oly_olympus_now_chain", "Chain lightning forks wider" },
			{ "oly_olympus_now_storm", "Divine Reckoning: sky bolt" },
			{ "oly_olympus_now_wrath", "Divine Reckoning: wide, staggers" },
			{ "oly_olympus_later_chain", "wider chain lightning" },
			{ "oly_olympus_later_storm", "storm strike" },
			{ "oly_olympus_later_wrath", "Wrath of Olympus" }
		};

		private static readonly Color Lightning = new Color(0.55f, 0.85f, 1f);

		private static readonly float[] GlowStrength = new float[4] { 0.63f, 0.63f, 2.5f, 2.5f };

		private static readonly float[] EdgeStrength = new float[4] { 0f, 0f, 0f, 2.5f };

		private const float BladeGlowStrength = 2f;

		internal static readonly UpgradeCosts.Path Costs = new UpgradeCosts.Path
		{
			Prefab = "OLY_BladeOfOlympus",
			Weapon = "Blade of Olympus",
			WeaponId = 1,
			Classic = new UpgradeCosts.Row[5]
			{
				new UpgradeCosts.Row("BlackMetal", 20, 7),
				new UpgradeCosts.Row("Eitr", 10, 3),
				new UpgradeCosts.Row("Thunderstone", 4, 1),
				new UpgradeCosts.Row("Coins", 200, 50),
				new UpgradeCosts.Row("TrophyEikthyr", 1, 0)
			},
			Craft = "BlackMetal:20, Eitr:10, Thunderstone:4, TrophyEikthyr:1",
			Level2 = "BlackMetal:7, Eitr:3, Thunderstone:1, Coins:100",
			Level3 = "FlametalNew:10, Eitr:6, Thunderstone:2, Coins:200",
			Level4 = "FaderDrop:1, FlametalNew:15, GemstoneBlue:1, Thunderstone:4",
			Where2 = "$oly_where_mistlands",
			Where3 = "$oly_where_ashlands",
			Where4 = "$oly_where_fader"
		};

		public static void BindConfig(ConfigFile cfg)
		{
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			_slash = Cfg.Baked(cfg, "Blade of Olympus", "Slash damage", 125f, "Base slash damage (Krom: 150).");
			_slashPerLevel = Cfg.Baked(cfg, "Blade of Olympus", "Slash per upgrade", 6f, "Extra slash damage per quality level.");
			_lightning = Cfg.Baked(cfg, "Blade of Olympus", "Lightning damage", 35f, "Base lightning damage.");
			_lightningPerLevel = Cfg.Baked(cfg, "Blade of Olympus", "Lightning per upgrade", 5f, "Extra lightning damage per quality level.");
			_chainChance = Cfg.Baked(cfg, "Blade of Olympus", "Chain lightning chance", 0.2f, "Chance per hit for the primary attack to chain lightning to nearby enemies.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			_chainChanceSecondary = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning chain chance", 1f, "Chance per enemy hit by the heavy slam to release chain lightning.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			_chainDamage = Cfg.Baked(cfg, "Blade of Olympus", "Chain lightning damage", 60f, "Lightning damage of each chain jump.");
			_chainJump = Cfg.Baked(cfg, "Blade of Olympus", "Chain jump chance", 1f, "Chance for chain lightning to jump on to each nearby enemy (vanilla weapons: 0.3).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			_slamDamage = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning damage multiplier", 1.5f, "Damage of the heavy slam relative to a normal hit.");
			_slamStamina = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning stamina", 35f, "Stamina cost of the heavy slam.");
			_slamRadius = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning radius", 4f, "Radius (m) of the slam's impact area.");
			Cfg.Migrate(_slash, 155f, 125f, "0.4.0");
			Cfg.Migrate(_slamDamage, 2f, 1.5f, "0.4.0");
			_glowIntensity = Cfg.Local(cfg, "Blade of Olympus", "Glow light intensity", 1.2f, "Brightness of the blade's light (0 = off).");
			OlympusUnlocks.BindConfig(cfg);
			ModelOffset = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Olympus offset", new Vector3(0f, 0f, 0f), "Model position in the hand (use oly_tune in game).");
			ModelEuler = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Olympus rotation", Vector3.zero, "Extra model rotation in degrees.");
			ModelScale = Cfg.Advanced(cfg, "Debug: model fit", "Olympus scale", 1.1f, "Model scale.");
		}

		public static ModelSpec Spec()
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			return new ModelSpec
			{
				Obj = "blade_of_olympus.obj",
				MeshChild = "attach/Krom",
				Offset = ModelOffset.Value,
				Euler = ModelEuler.Value,
				Scale = ModelScale.Value,
				TrailBase = 0.33f,
				TrailTip = 1.44f,
				GlowLight = new Color(0.55f, 0.85f, 1f, 1f),
				GlowIntensity = _glowIntensity.Value,
				GlowRange = 3f,
				GlowAt = 0.89f,
				Surfaces = Surfaces(1),
				LookKey = "Olympus",
				SurfacesFor = Surfaces
			};
		}

		private static Dictionary<string, SurfaceSpec> Surfaces(int q)
		{
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: 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_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			q = Quality.Clamp(q);
			float num = QualityLooks.K(q);
			string texture = ((q >= 2) ? WeaponVisuals.TextureOr("OLY_Olympus_Blade_Q" + q, "OLY_Olympus_Blade") : "OLY_Olympus_Blade");
			string emissionTexture = ((q >= 2) ? WeaponVisuals.TextureOr("OLY_Olympus_Blade_Glow_Q" + q, "OLY_Olympus_Blade_Glow") : "OLY_Olympus_Blade_Glow");
			string texture2 = ((q >= 2) ? WeaponVisuals.TextureOr("OLY_Olympus2_Blade_Q" + q, "OLY_Olympus2_Blade_Q1") : "OLY_Olympus2_Blade_Q1");
			string emissionTexture2 = ((q >= 2) ? WeaponVisuals.TextureOr("OLY_Olympus2_Blade_Glow_Q" + q, "OLY_Olympus2_Blade_Glow_Q1") : "OLY_Olympus2_Blade_Glow_Q1");
			Color metalColor = default(Color);
			((Color)(ref metalColor))..ctor(1f, 0.82f, 0.45f);
			Color metalColor2 = default(Color);
			((Color)(ref metalColor2))..ctor(0.92f, 0.95f, 1f);
			float num2 = EdgeStrength[q - 1] * num;
			return new Dictionary<string, SurfaceSpec>
			{
				["OLY_OlyBlade"] = new SurfaceSpec
				{
					Texture = texture,
					Metallic = 0.8f,
					Glossiness = 0.5f,
					MetalColor = Color.white,
					EmissionTexture = emissionTexture,
					Emission = Color.white * (2f * num)
				},
				["OLY_OlySilver"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Silver",
					Metallic = 0.85f,
					Glossiness = 0.6f,
					MetalColor = metalColor2
				},
				["OLY_OlyGold"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Gold",
					Metallic = 0.8f,
					Glossiness = 0.5f,
					MetalColor = metalColor
				},
				["OLY_OlySteel"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Steel",
					Metallic = 0.85f,
					Glossiness = 0.55f,
					MetalColor = metalColor2
				},
				["OLY_OlyLeather"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Leather",
					Metallic = 0f,
					Glossiness = 0.15f
				},
				["OLY_OlyGlow"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Glow",
					Emission = Lightning * (GlowStrength[q - 1] * num)
				},
				["OLY_OlyEdge"] = new SurfaceSpec
				{
					Texture = WeaponVisuals.TextureOr("OLY_Olympus_Edge", "OLY_Olympus_Silver"),
					Metallic = 0.85f,
					Glossiness = 0.6f,
					MetalColor = metalColor2,
					Emission = ((num2 > 0f) ? (Lightning * num2) : Color.black)
				},
				["OLY_Oly2_Blade"] = new SurfaceSpec
				{
					Texture = texture2,
					Metallic = 0.8f,
					Glossiness = 0.5f,
					EmissionTexture = emissionTexture2,
					Emission = Color.white * (2f * num)
				},
				["OLY_Oly2_Gold"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus2_Hilt",
					Metallic = 0.8f,
					Glossiness = 0.45f
				},
				["OLY_Oly2_Silver"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus2_Hilt",
					Metallic = 0.9f,
					Glossiness = 0.58f
				},
				["OLY_Oly2_Wrap"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus2_Hilt",
					Metallic = 0f,
					Glossiness = 0.08f
				},
				["OLY_Oly2_Ring"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus2_Hilt",
					Metallic = 0f,
					Glossiness = 0.6f,
					Emission = ((q >= 3) ? (Lightning * (2.5f * num)) : Color.black)
				},
				["OLY_Gold"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Gold",
					Metallic = 0.8f,
					Glossiness = 0.55f,
					MetalColor = metalColor
				},
				["OLY_Engraved"] = new SurfaceSpec
				{
					Texture = WeaponVisuals.TextureOr("OLY_Olympus_Engraved", "OLY_Olympus_Gold"),
					Metallic = 0.75f,
					Glossiness = 0.45f,
					MetalColor = new Color(1f, 0.8f, 0.42f)
				},
				["OLY_Silver"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Silver",
					Metallic = 0.85f,
					Glossiness = 0.65f,
					MetalColor = metalColor2
				},
				["OLY_Glow"] = new SurfaceSpec
				{
					Texture = "OLY_Olympus_Glow",
					Emission = new Color(0.9f, 1.6f, 2.4f)
				}
			};
		}

		public static void Register()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0088: 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)
			ItemConfig val = new ItemConfig
			{
				Name = "$item_oly_bladeofolympus",
				Description = "$item_oly_bladeofolympus_description",
				CraftingStation = CraftingStations.BlackForge,
				MinStationLevel = 1
			};
			UpgradeCosts.AddClassicRows(val, Costs);
			CustomItem val2 = new CustomItem("OLY_BladeOfOlympus", "THSwordKrom", val);
			if ((Object)(object)val2.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)"could not clone THSwordKrom");
				return;
			}
			CustomRecipe recipe = val2.Recipe;
			if (Object.op_Implicit((Object)(object)((recipe != null) ? recipe.Recipe : null)))
			{
				Recipe recipe2 = val2.Recipe.Recipe;
				((Object)recipe2).hideFlags = (HideFlags)(((Object)recipe2).hideFlags | 0x20);
			}
			if (!ItemManager.Instance.AddItem(val2))
			{
				Logger.LogError((object)"could not register OLY_BladeOfOlympus");
				return;
			}
			UpgradeCosts.Apply(val2, Costs);
			SharedData shared = val2.ItemDrop.m_itemData.m_shared;
			shared.m_damages.m_slash = _slash.Value;
			shared.m_damages.m_lightning = _lightning.Value;
			shared.m_damagesPerLevel.m_slash = _slashPerLevel.Value;
			shared.m_damagesPerLevel.m_lightning = _lightningPerLevel.Value;
			shared.m_hitVariant = -1;
			shared.m_maxQuality = 4;
			shared.m_hitEffect = Effects.With(shared.m_hitEffect, "fx_lightningweapon_hit", "sfx_weapons_lightning_impact");
			GameObject val3 = CreateChainLightning();
			if (Object.op_Implicit((Object)(object)val3))
			{
				shared.m_attack.m_spawnOnHit = val3;
				shared.m_attack.m_spawnOnHitChance = _chainChance.Value;
			}
			OlympusUnlocks.Register(val3);
			Attack val4 = CreateDivineReckoning(val3);
			if (val4 != null)
			{
				shared.m_secondaryAttack = val4;
				AreaAttackOverride.Register("Olympus", IsOurs, OlympusReckoning.Execute);
				if (!AreaAttackOverride.Installed)
				{
					Logger.LogWarning((object)"area-attack override not installed: Divine Reckoning keeps the vanilla area attack (it also hits buildings; no Storm strike or Wrath of Olympus)");
				}
			}
			if (!Object.op_Implicit((Object)(object)shared.m_equipStatusEffect))
			{
				UnlockTooltips.Register(1, OlympusUnlocks.TooltipLines);
				shared.m_equipStatusEffect = (StatusEffect)(object)UnlockTooltips.CreateInfoSE<SE_OLY_UnlockInfo>("SE_OLY_OlympusPower", 1, "$oly_olympus_power");
			}
			UpgradeCosts.RegisterTooltip(Costs);
			WeaponVisuals.Apply(val2.ItemPrefab, Spec());
			string text = WeaponVisuals.FindAsset("Icons", "icon_blade_of_olympus.png");
			Sprite val5 = ((text != null) ? AssetUtils.LoadSpriteFromFile(text) : null);
			if (Object.op_Implicit((Object)(object)val5))
			{
				shared.m_icons = (Sprite[])(object)new Sprite[1] { val5 };
			}
			else
			{
				Logger.LogWarning((object)"Blade of Olympus icon not found; keeping Krom's");
			}
		}

		private static Attack CreateDivineReckoning(GameObject chain)
		{
			GameObject prefab = Cache.GetPrefab<GameObject>("SledgeIron");
			Attack val = ((!Object.op_Implicit((Object)(object)prefab)) ? null : prefab.GetComponent<ItemDrop>()?.m_itemData?.m_shared?.m_attack);
			if (val == null)
			{
				Logger.LogWarning((object)"SledgeIron not found; keeping Krom's heavy attack");
				return null;
			}
			Attack val2 = Effects.CloneAttack(val);
			val2.m_damageMultiplier = _slamDamage.Value;
			val2.m_attackStamina = _slamStamina.Value;
			val2.m_attackRayWidth = _slamRadius.Value;
			val2.m_forceMultiplier = 2f;
			val2.m_staggerMultiplier = 3f;
			val2.m_startEffect = Effects.With(val.m_startEffect, "sfx_StaffLightning_charge");
			val2.m_triggerEffect = Effects.With(val.m_triggerEffect, "fx_eikthyr_stomp", "fx_himminafl_hit", "sfx_staffthunderblood_thunder");
			if (Object.op_Implicit((Object)(object)chain))
			{
				val2.m_spawnOnHit = chain;
				val2.m_spawnOnHitChance = _chainChanceSecondary.Value;
			}
			return val2;
		}

		private static GameObject CreateChainLightning()
		{
			GameObject val = PrefabManager.Instance.CreateClonedPrefab("OLY_ChainLightning_Olympus", "ChainLightning");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Logger.LogWarning((object)"ChainLightning not found; Blade of Olympus will hit without chain lightning");
				return null;
			}
			Aoe component = val.GetComponent<Aoe>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.m_chainObj = val;
				component.m_hitVariant = -1;
				component.m_damage.m_lightning = _chainDamage.Value;
				component.m_chainStartChance = 1f;
				component.m_chainChancePerTarget = _chainJump.Value;
			}
			PrefabManager.Instance.AddPrefab(val);
			return val;
		}

		public static bool IsOurs(ItemData item)
		{
			if (item?.m_shared != null)
			{
				if (!Object.op_Implicit((Object)(object)item.m_dropPrefab) || !(((Object)item.m_dropPrefab).name == "OLY_BladeOfOlympus"))
				{
					return item.m_shared.m_name == "$item_oly_bladeofolympus";
				}
				return true;
			}
			return false;
		}
	}
	internal static class BladesOfChaos
	{
		internal enum EyeGemColour
		{
			Ember,
			Blood
		}

		public const string Prefab = "OLY_BladesOfChaos";

		public const string Token = "$item_oly_bladesofchaos";

		private const string BasePrefab = "KnifeSkollAndHati";

		private const string Obj = "blades_of_chaos_r.obj";

		private static readonly Vector3 HiltLocal = new Vector3(0f, -0.11f, 0f);

		private static readonly Quaternion MeshInHand = new Quaternion(0f, 0.7071068f, 0.7071068f, 0f);

		private const string LookKey = "chaos";

		private const string PowerSE = "SE_OLY_ChaosPower";

		private static ConfigEntry<float> _slash;

		private static ConfigEntry<float> _slashPerLevel;

		private static ConfigEntry<float> _fire;

		private static ConfigEntry<float> _firePerLevel;

		private static ConfigEntry<float> _reach;

		private static ConfigEntry<float> _spinStamina;

		private static ConfigEntry<float> _spinRange;

		private static ConfigEntry<float> _spinRangeLow;

		private static ConfigEntry<float> _lightIntensity;

		internal static ConfigEntry<Vector3> OffsetR;

		internal static ConfigEntry<Vector3> OffsetL;

		internal static ConfigEntry<Vector3> EulerR;

		internal static ConfigEntry<Vector3> EulerL;

		internal static ConfigEntry<float> ModelScale;

		internal static ConfigEntry<bool> Chains;

		internal static ConfigEntry<float> WrapRadius;

		internal static ConfigEntry<float> WrapArmour;

		internal static ConfigEntry<float> ChainWidth;

		internal static ConfigEntry<bool> SpinFlyOut;

		internal static ConfigEntry<ChainGlowStyle> ChainGlow;

		internal static ConfigEntry<bool> FlamesOnlyWhenFighting;

		internal static ConfigEntry<float> FlamesLinger;

		internal static ConfigEntry<Vector3> BackOffset;

		internal static ConfigEntry<Vector3> BackEuler;

		internal static ConfigEntry<float> BackSpread;

		private static ConfigEntry<bool> _scareFire;

		private static ConfigEntry<bool> _warmth;

		private static ConfigEntry<bool> _warmthSheathed;

		private static Transform s_backCross;

		private static Transform s_groundCross;

		public static readonly Dictionary<string, string> English = new Dictionary<string, string>
		{
			{ "item_oly_bladesofchaos", "Blades of Chaos" },
			{ "item_oly_bladesofchaos_description", "Twin blades of the underworld, chained to your arms." },
			{ "se_oly_chaospower", "Powers" },
			{ "oly_chaos_level", "Level {0}" },
			{ "oly_chaos_locked", "not yet unlocked" },
			{ "oly_chaos_hotter", "Hotter flames: burns last {0} s, +{1}% fire damage" },
			{ "oly_chaos_ember", "Ember burst: every {0} hits on one enemy set off a fire burst around it" },
			{ "oly_chaos_cyclone", "Cyclone of Chaos: the spin flings the blades out on their chains" },
			{ "oly_chaos_now_hotter", "Burns {0} s, +{1}% fire" },
			{ "oly_chaos_now_ember", "Ember burst every {0} hits" },
			{ "oly_chaos_now_cyclone", "Spin: Cyclone of Chaos" },
			{ "oly_chaos_later_hotter", "hotter flames" },
			{ "oly_chaos_later_ember", "ember burst" },
			{ "oly_chaos_later_cyclone", "Cyclone of Chaos" },
			{ "se_oly_chaosflame", "Chaos flames" }
		};

		private static ConfigEntry<EyeGemColour> _eyeGem;

		private const float DefaultRuneGlow = 1.5f;

		internal static ConfigEntry<float> RuneGlowLevel;

		internal static readonly UpgradeCosts.Path Costs = new UpgradeCosts.Path
		{
			Prefab = "OLY_BladesOfChaos",
			Weapon = "Blades of Chaos",
			WeaponId = 2,
			Classic = new UpgradeCosts.Row[4]
			{
				new UpgradeCosts.Row("Iron", 16, 5),
				new UpgradeCosts.Row("Chain", 3, 0),
				new UpgradeCosts.Row("SurtlingCore", 3, 1),
				new UpgradeCosts.Row("LeatherScraps", 4, 2)
			},
			Craft = "Iron:16, Chain:3, SurtlingCore:3, LeatherScraps:4",
			Level2 = "Iron:5, SurtlingCore:1, LeatherScraps:2",
			Level3 = "Silver:10, Obsidian:5, SurtlingCore:2",
			Level4 = "BlackMetal:15, Silver:5, SurtlingCore:4",
			Where2 = "$oly_where_swamp",
			Where3 = "$oly_where_mountains",
			Where4 = "$oly_where_plains"
		};

		private const float GripApart = 0.14f;

		private const float CrossDepth = 0.02f;

		private const float DefaultSpread = 76f;

		private static Color RuneGlow
		{
			get
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				float num = ((RuneGlowLevel != null) ? RuneGlowLevel.Value : 1.5f);
				return new Color(num, num, num);
			}
		}

		public static void BindConfig(ConfigFile cfg)
		{
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			_slash = Cfg.Baked(cfg, "Blades of Chaos", "Slash damage", 48f, "Base slash damage.");
			_slashPerLevel = Cfg.Baked(cfg, "Blades of Chaos", "Slash per upgrade", 5f, "Extra slash damage per quality level.");
			_fire = Cfg.Baked(cfg, "Blades of Chaos", "Fire damage", 24f, "Base fire damage (sets enemies burning).");
			_firePerLevel = Cfg.Baked(cfg, "Blades of Chaos", "Fire per upgrade", 4f, "Extra fire damage per quality level.");
			Cfg.Migrate(_slash, 40f, 48f, "2.0.0");
			Cfg.Migrate(_slashPerLevel, 4f, 5f, "2.0.0");
			Cfg.Migrate(_fire, 20f, 24f, "2.0.0");
			Cfg.Migrate(_firePerLevel, 3f, 4f, "2.0.0");
			_reach = Cfg.Baked(cfg, "Blades of Chaos", "Reach", 4.5f, "Reach of the whip-like primary attack in metres (vanilla knives: ~1.8).");
			_spinStamina = Cfg.Baked(cfg, "Blades of Chaos", "Cyclone of Chaos stamina", 30f, "Stamina cost of the 360° spin.");
			_spinRange = Cfg.Synced(cfg, "Blades of Chaos", "Cyclone of Chaos range", 4.5f, "Radius (m) of the full Cyclone of Chaos, where the blades are thrown out on their chains.");
			_spinRangeLow = Cfg.Synced(cfg, "Blades of Chaos", "Spin range below Cyclone level", 3f, "Radius (m) of the ordinary spin before the Cyclone unlocks, or with it switched off (vanilla atgeir spin: 3).");
			ChaosUnlocks.BindConfig(cfg, "Blades of Chaos");
			_lightIntensity = Cfg.Baked(cfg, "Blades of Chaos", "Fire light intensity", 0.8f, "Brightness of each blade's firelight (0 = off). At 1, two blades together are about as bright as a torch.");
			Cfg.Migrate(_lightIntensity, 1f, 0.8f, "1.0.0");
			FlamesOnlyWhenFighting = Cfg.Local(cfg, "Blades of Chaos", "Flames only when fighting", def: true, "Show the fire along the blades only while you fight: it flares up when a blade hits a creature (and during the spin), stays for \"Flames linger\" seconds after the last hit and goes out again, so the blades' pattern shows while you walk. The firelight, the fire that keeps animals away and the warmth stay as they are. Off: the blades burn all the time, as before. Changes live; your own view (what other players see follows their setting).");
			FlamesLinger = Cfg.Local(cfg, "Blades of Chaos", "Flames linger", 6f, "Seconds the flames keep burning after your last hit on a creature.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 60f));
			_warmth = Cfg.Synced(cfg, "Blades of Chaos", "Warmth", def: true, "While equipped, the blades' fire keeps you warm: no Cold or Freezing (like the wolf cape), which also means frost resistance.");
			_warmthSheathed = Cfg.Synced(cfg, "Blades of Chaos", "Warmth while sheathed", def: true, "Keep the warmth while the blades are on your back, not only while drawn.");
			_warmth.SettingChanged += delegate
			{
				ChaosWarmth.Enabled = _warmth.Value;
			};
			_warmthSheathed.SettingChanged += delegate
			{
				ChaosWarmth.WhileSheathed = _warmthSheathed.Value;
			};
			ChaosWarmth.Enabled = _warmth.Value;
			ChaosWarmth.WhileSheathed = _warmthSheathed.Value;
			_eyeGem = Cfg.Local(cfg, "Blades of Chaos", "Eye gem", EyeGemColour.Ember, "Colour of the glowing gems in the guards' eye sockets.");
			_eyeGem.SettingChanged += delegate
			{
				QualityLooks.Refresh("chaos");
			};
			RuneGlowLevel = Cfg.Local(cfg, "Blades of Chaos", "Rune glow", 1.5f, "Brightness of the fire in the rune tree and the inscription on the blades, from level 2 (level 1 has plain silver runes with no glow). It glows all the time, flames or not; 0 = off. Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4f));
			RuneGlowLevel.SettingChanged += delegate
			{
				QualityLooks.Refresh("chaos");
			};
			_scareFire = Cfg.Baked(cfg, "Blades of Chaos", "Scare fire-fearing creatures", def: true, "While drawn, the blades count as fire like a carried torch: creatures that fear fire keep away.");
			Chains = Cfg.Local(cfg, "Blades of Chaos", "Show chains", def: true, "Draw the chains from the forearms to the blades.");
			WrapRadius = Cfg.Local(cfg, "Blades of Chaos", "Chain wrap radius", 0.07f, "How far (m) the chain wraps out from the forearm bone. Raise it if the chain sinks into your arms.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.03f, 0.15f));
			Cfg.Migrate(WrapRadius, 0.058f, 0.07f, "1.0.0");
			ChainWidth = Cfg.Local(cfg, "Blades of Chaos", "Chain thickness", 0.045f, "Thickness (m) of the chains.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.015f, 0.12f));
			SpinFlyOut = Cfg.Local(cfg, "Blades of Chaos", "Cyclone blades fly out", def: true, "During Cyclone of Chaos the blades fly out on their chains to the spin's damage radius.");
			WrapArmour = Cfg.Local(cfg, "Blades of Chaos", "Chain wrap extra with chest armour", 0.046f, "Extra wrap radius (m) while chest armour (which covers the arms) is worn.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.1f));
			Cfg.Migrate(WrapArmour, 0.016f, 0.046f, "1.0.0");
			ChainGlow = Cfg.Local(cfg, "Blades of Chaos", "Chain glow", ChainGlowStyle.Links, "With Looks / Upgrade looks on, the chains glow from the pommel out from level 2 (level 4: the whole chain). Links: each heated link glows in its own shape. Band: a glowing core down the middle of the chain (try it if the glowing links don't sit on the chain's links). Off: no chain glow. Changes live.");
			OffsetR = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos right offset", Vector3.zero, "Right blade position in the hand (oly_tune chaosR).");
			EulerR = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos right rotation", Vector3.zero, "Right blade extra rotation (degrees).");
			OffsetL = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos left offset", Vector3.zero, "Left blade position in the hand (oly_tune chaosL).");
			EulerL = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos left rotation", Vector3.zero, "Left blade extra rotation (degrees).");
			ModelScale = Cfg.Advanced(cfg, "Debug: model fit", "Chaos scale", 1f, "Blade scale in the hands.");
			BackOffset = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos back offset", new Vector3(0f, 0.1f, 0f), "Where the crossed blades sit on your back, in metres from the back slot: x = to your right, y = up, z = forward (into the back). (0, 0, 0) = the blades cross right at the slot. Changes live.");
			BackEuler = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos back rotation", Vector3.zero, "Extra turn of the crossed blades, in degrees: x tilts the tips towards (+) or away from (-) your back, y turns the pair about the vertical, z leans the whole X to your left (+) or right (-). (0, 0, 0) = upright and flat on the back, like the inventory icon. Changes live.");
			BackSpread = Cfg.Advanced(cfg, "Debug: model fit", "Chaos back spread", 76f, "Angle (degrees) between the two sheathed blades (also on the ground and on item stands): 76 = the inventory icon's X, 38 degrees each side of vertical. Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 150f));
			Cfg.Migrate(BackSpread, 68f, 76f, "1.2.0");
			BackOffset.SettingChanged += delegate
			{
				RefreshBack();
			};
			BackEuler.SettingChanged += delegate
			{
				RefreshBack();
			};
			BackSpread.SettingChanged += delegate
			{
				RefreshBack();
			};
			PushRigSettings();
			FlamesOnlyWhenFighting.SettingChanged += delegate
			{
				PushRigSettings();
			};
			FlamesLinger.SettingChanged += delegate
			{
				PushRigSettings();
			};
			OffsetR.SettingChanged += delegate
			{
				PushRigSettings();
			};
			OffsetL.SettingChanged += delegate
			{
				PushRigSettings();
			};
			EulerR.SettingChanged += delegate
			{
				PushRigSettings();
			};
			EulerL.SettingChanged += delegate
			{
				PushRigSettings();
			};
			ModelScale.SettingChanged += delegate
			{
				PushRigSettings();
			};
			Chains.SettingChanged += delegate
			{
				PushRigSettings();
			};
			WrapRadius.SettingChanged += delegate
			{
				PushRigSettings();
			};
			WrapArmour.SettingChanged += delegate
			{
				PushRigSettings();
			};
			ChainWidth.SettingChanged += delegate
			{
				PushRigSettings();
			};
			SpinFlyOut.SettingChanged += delegate
			{
				PushRigSettings();
			};
			ChainGlow.SettingChanged += delegate
			{
				PushRigSettings();
			};
			_spinRange.SettingChanged += delegate
			{
				PushRigSettings();
			};
			ChaosUnlocks.Cyclone.On.SettingChanged += delegate
			{
				PushRigSettings();
			};
			ChaosUnlocks.Cyclone.Level.SettingChanged += delegate
			{
				PushRigSettings();
			};
		}

		public static void PushRigSettings()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			ChaosBladesRig.OffsetR = OffsetR.Value;
			ChaosBladesRig.OffsetL = OffsetL.Value;
			ChaosBladesRig.EulerR = EulerR.Value;
			ChaosBladesRig.EulerL = EulerL.Value;
			ChaosBladesRig.Scale = ModelScale.Value;
			ChaosBladesRig.ChainsOn = Chains.Value;
			ChaosBladesRig.WrapRadius = WrapRadius.Value;
			ChaosBladesRig.WrapArmourExtra = WrapArmour.Value;
			ChaosBladesRig.ChainWidth = ChainWidth.Value;
			ChaosBladesRig.SpinFlyOut = SpinFlyOut.Value;
			ChaosBladesRig.SpinReach = _spinRange.Value;
			ChaosBladesRig.CycloneOn = ChaosUnlocks.Cyclone.On.Value;
			ChaosBladesRig.CycloneLevel = ChaosUnlocks.Cyclone.Level.Value;
			if (ChainGlow != null)
			{
				ChaosChainHeat.Style = ChainGlow.Value;
			}
			if (FlamesOnlyWhenFighting != null)
			{
				ChaosBladesRig.FlamesGated = FlamesOnlyWhenFighting.Value;
			}
			if (FlamesLinger != null)
			{
				ChaosBladesRig.FlamesLinger = FlamesLinger.Value;
			}
		}

		private static Dictionary<string, SurfaceSpec> SurfacesFor(int level)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			int num = Quality.Clamp(level);
			string texture = WeaponVisuals.TextureOr("OLY_ChaosR_Design_Q" + num, "OLY_ChaosR_Design");
			string emissionTexture = WeaponVisuals.TextureOr("OLY_ChaosR_DesignGlow_Q" + num, "OLY_ChaosR_DesignGlow_Q1");
			float num2 = ((num <= 1) ? 0f : (0.5f + 0.45f * (float)(num - 2)));
			bool flag = _eyeGem != null && _eyeGem.Value == EyeGemColour.Blood;
			return new Dictionary<string, SurfaceSpec>
			{
				["OLY_ChaosR_Design"] = new SurfaceSpec
				{
					Texture = texture,
					Metallic = 0.55f,
					Glossiness = 0.5f,
					MetalColor = new Color(0.92f, 0.92f, 0.92f),
					EmissionTexture = emissionTexture,
					Emission = RuneGlow
				},
				["OLY_ChaosR_Ember"] = new SurfaceSpec
				{
					Texture = (flag ? "OLY_ChaosR_EmberDeep" : "OLY_ChaosR_Ember"),
					Metallic = 0f,
					Glossiness = 0.8f,
					Emission = new Color(num2, num2, num2)
				},
				["OLY_ChaosR_EmberDeep"] = new SurfaceSpec
				{
					Texture = "OLY_ChaosR_EmberDeep",
					Metallic = 0f,
					Glossiness = 0.8f,
					Emission = new Color(num2 * 0.7f, num2 * 0.7f, num2 * 0.7f)
				},
				["OLY_ChaosR_Claw"] = new SurfaceSpec
				{
					Texture = "OLY_ChaosR_Claw",
					Metallic = 0.6f,
					Glossiness = 0.55f,
					MetalColor = new Color(0.9f, 0.9f, 0.9f)
				},
				["OLY_ChaosR_HeadSide"] = new SurfaceSpec
				{
					Texture = "OLY_ChaosR_HeadSide",
					Metallic = 0.55f,
					Glossiness = 0.5f,
					MetalColor = new Color(0.9f, 0.9f, 0.9f)
				},
				["OLY_ChaosR_Iron"] = new SurfaceSpec
				{
					Texture = "OLY_ChaosR_Iron",
					Metallic = 0.7f,
					Glossiness = 0.45f,
					MetalColor = new Color(0.85f, 0.85f, 0.85f)
				},
				["OLY_ChaosR_Leather"] = new SurfaceSpec
				{
					Texture = "OLY_ChaosR_Leather",
					Metallic = 0f,
					Glossiness = 0.15f
				}
			};
		}

		private static float FlameScale(int quality)
		{
			if (!QualityLooks.Enabled || !ChaosUnlocks.Hotter.At(quality))
			{
				return 1f;
			}
			return ChaosUnlocks.HotFlameSize.Value;
		}

		public static void Register()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0088: 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_014d: Unknown result type (might be due to invalid IL or missing references)
			ItemConfig val = new ItemConfig
			{
				Name = "$item_oly_bladesofchaos",
				Description = "$item_oly_bladesofchaos_description",
				CraftingStation = CraftingStations.Forge,
				MinStationLevel = 2
			};
			UpgradeCosts.AddClassicRows(val, Costs);
			CustomItem val2 = new CustomItem("OLY_BladesOfChaos", "KnifeSkollAndHati", val);
			if ((Object)(object)val2.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)"could not clone KnifeSkollAndHati");
				return;
			}
			CustomRecipe recipe = val2.Recipe;
			if (Object.op_Implicit((Object)(object)((recipe != null) ? recipe.Recipe : null)))
			{
				Recipe recipe2 = val2.Recipe.Recipe;
				((Object)recipe2).hideFlags = (HideFlags)(((Object)recipe2).hideFlags | 0x20);
			}
			if (!ItemManager.Instance.AddItem(val2))
			{
				Logger.LogError((object)"could not register OLY_BladesOfChaos");
				return;
			}
			UpgradeCosts.Apply(val2, Costs);
			SharedData shared = val2.ItemDrop.m_itemData.m_shared;
			shared.m_damages.m_slash = _slash.Value;
			shared.m_damages.m_pierce = 0f;
			shared.m_damages.m_fire = _fire.Value;
			shared.m_damagesPerLevel.m_slash = _slashPerLevel.Value;
			shared.m_damagesPerLevel.m_pierce = 0f;
			shared.m_damagesPerLevel.m_fire = _firePerLevel.Value;
			shared.m_hitVariant = 0;
			shared.m_maxQuality = 4;
			shared.m_attachOverride = (ItemType)5;
			shared.m_weight = 2f;
			Attack attack = shared.m_attack;
			attack.m_attackRange = _reach.Value;
			attack.m_attackAngle = 100f;
			attack.m_attackRayWidth = 0.35f;
			attack.m_attackHeight = 0.8f;
			attack.m_attackRayWidthCharExtra = 0.2f;
			attack.m_attackHeightChar1 = -0.55f;
			attack.m_attackHeightChar2 = 1f;
			attack.m_maxYAngle = 20f;
			GameObject prefab = Cache.GetPrefab<GameObject>("AtgeirIron");
			Attack val3 = ((!Object.op_Implicit((Object)(object)prefab)) ? null : prefab.GetComponent<ItemDrop>()?.m_itemData?.m_shared?.m_secondaryAttack);
			if (val3 != null)
			{
				Attack val4 = Effects.CloneAttack(val3);
				val4.m_attackRange = _spinRangeLow.Value;
				val4.m_attackStamina = _spinStamina.Value;
				shared.m_secondaryAttack = val4;
			}
			else
			{
				Logger.LogWarning((object)"AtgeirIron not found; Blades of Chaos keep Skoll and Hati's secondary");
			}
			BuildVisuals(val2.ItemPrefab);
			string text = WeaponVisuals.FindAsset("Icons", "icon_blades_of_chaos_r.png");
			Sprite val5 = ((text != null) ? AssetUtils.LoadSpriteFromFile(text) : null);
			if (Object.op_Implicit((Object)(object)val5))
			{
				shared.m_icons = (Sprite[])(object)new Sprite[1] { val5 };
			}
			ChaosWarmth.Register(Object.op_Implicit((Object)(object)val5) ? val5 : shared.m_icons[0]);
			SE_OLY_Power equipStatusEffect = UnlockTooltips.CreateInfoSE<SE_OLY_Power>("SE_OLY_ChaosPower", 2, "$se_oly_chaospower");
			shared.m_equipStatusEffect = (StatusEffect)(object)equipStatusEffect;
			SE_OLY_Power.RegisterHitHook(2, IsOurs, OnHit);
			UnlockTooltips.Register(2, ChaosUnlocks.TooltipLines);
			UpgradeCosts.RegisterTooltip(Costs);
			ChaosUnlocks.Register();
		}

		private static void OnHit(SE_OLY_Power se, Player p, ItemData weapon, Character target, ref HitData hit)
		{
			ChaosUnlocks.OnHit(se, p, weapon, target, ref hit);
			if (Object.op_Implicit((Object)(object)target))
			{
				ChaosBladesRig.MarkHot(p);
			}
		}

		private static void BuildVisuals(GameObject prefab)
		{
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			if (!WeaponVisuals.LoadModel("blades_of_chaos_r.obj", out var mesh, out var names))
			{
				return;
			}
			Transform obj = prefab.transform.Find("attach/skoll");
			object obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				MeshRenderer component = ((Component)obj).GetComponent<MeshRenderer>();
				obj2 = ((component != null) ? ((Renderer)component).sharedMaterial : null);
			}
			Material val = (Material)obj2;
			if (!Object.op_Implicit((Object)(object)val))
			{
				Logger.LogError((object)"Skoll and Hati material not found");
				return;
			}
			Material[] mats = QualityLooks.Build("chaos", val, names, SurfacesFor)[0];
			GameObject prefab2 = Cache.GetPrefab<GameObject>("SwordDyrnwyn");
			GameObject prefab3 = Cache.GetPrefab<GameObject>("SwordIronFire");
			Transform val2 = prefab.transform.Find("attach_skin");
			if (Object.op_Implicit((Object)(object)val2))
			{
				for (int num = val2.childCount - 1; num >= 0; num--)
				{
					Object.DestroyImmediate((Object)(object)((Component)val2.GetChild(num)).gameObject);
				}
				Animator component2 = ((Component)val2).GetComponent<Animator>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					Object.DestroyImmediate((Object)(object)component2);
				}
				List<Renderer> list = new List<Renderer>();
				List<Light> list2 = new List<Light>();
				List<ParticleSystem> list3 = new List<ParticleSystem>();
				MakeHandBlade(val2, "blade_R", mesh, mats, prefab2, prefab3, withLight: true, list, list2, list3);
				MakeHandBlade(val2, "blade_L", mesh, mats, prefab2, prefab3, withLight: true, list, list2, list3);
				MakeEquipped(val2);
				LineRenderer val3 = MakeChain(val2, "chain_R");
				MakeChain(val2, "chain_L");
				ChaosChainHeat.Setup(Cache.GetPrefab<Material>("red_trail") ?? Cache.GetPrefab<Material>("club_trail"), Object.op_Implicit((Object)(object)val3) ? ((Renderer)val3).sharedMaterial : null);
				((Component)val2).gameObject.AddComponent<ChaosBladesRig>();
				QualityLooks.Attach(val2, "chaos", list.ToArray(), list2.ToArray(), list3.ToArray(), FlameScale);
			}
			Transform val4 = prefab.transform.Find("attach");
			if (Object.op_Implicit((Object)(object)val4))
			{
				Renderer[] componentsInChildren = ((Component)val4).GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].enabled = false;
				}
				Collider[] componentsInChildren2 = ((Component)val4).GetComponentsInChildren<Collider>(true);
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					componentsInChildren2[i].enabled = false;
				}
				List<Renderer> list4 = new List<Renderer>();
				s_groundCross = BuildCross(val4, mesh, mats, withCollider: true, list4);
				s_groundCross.localRotation = MeshInHand;
				QualityLooks.Attach(val4, "chaos", list4.ToArray());
				Transform val5 = prefab.transform.Find("attach_back");
				if (Object.op_Implicit((Object)(object)val5))
				{
					Object.DestroyImmediate((Object)(object)((Component)val5).gameObject);
				}
				GameObject val6 = new GameObject("attach_back")
				{
					layer = ((Component)val4).gameObject.layer
				};
				val6.SetActive(false);
				val6.transform.SetParent(prefab.transform, false);
				val6.transform.SetAsFirstSibling();
				List<Renderer> list5 = new List<Renderer>();
				s_backCross = BuildCross(val6.transform, mesh, mats, withCollider: false, list5);
				QualityLooks.Attach(val6.transform, "chaos", list5.ToArray());
				ApplyBackPose();
			}
		}

		private static Transform BuildCross(Transform parent, Mesh mesh, Material[] mats, bool withCollider, List<Renderer> renderers)
		{
			//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_001e: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			int layer = ((Component)parent).gameObject.layer;
			GameObject val = new GameObject("OLY_cross")
			{
				layer = layer
			};
			val.transform.SetParent(parent, false);
			for (int i = 0; i < 2; i++)
			{
				GameObject val2 = new GameObject((i == 0) ? "OLY_static_R" : "OLY_static_L")
				{
					layer = layer
				};
				val2.transform.SetParent(val.transform, false);
				val2.AddComponent<MeshFilter>().sharedMesh = mesh;
				MeshRenderer val3 = val2.AddComponent<MeshRenderer>();
				((Renderer)val3).sharedMaterials = mats;
				renderers.Add((Renderer)(object)val3);
				if (i == 0 && withCollider)
				{
					BoxCollider obj = val2.AddComponent<BoxCollider>();
					Bounds bounds = mesh.bounds;
					obj.center = ((Bounds)(ref bounds)).center;
					bounds = mesh.bounds;
					obj.size = Vector3.Max(((Bounds)(ref bounds)).size, Vector3.one * 0.03f);
				}
			}
			LayoutCross(val.transform, (BackSpread != null) ? BackSpread.Value : 76f);
			return val.transform;
		}

		private static void LayoutCross(Transform pivot, float spread)
		{
			//IL_0060: 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_0096: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)pivot))
			{
				float num = Mathf.Clamp(spread, 1f, 179f) * 0.5f;
				float num2 = 0.14f / Mathf.Tan(num * ((float)Math.PI / 180f));
				Transform val = pivot.Find("OLY_static_R");
				Transform val2 = pivot.Find("OLY_static_L");
				if (Object.op_Implicit((Object)(object)val))
				{
					val.localPosition = new Vector3(-0.14f, 0f - num2, -0.02f);
					val.localRotation = Quaternion.Euler(0f, 0f, 0f - num);
				}
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.localPosition = new Vector3(0.14f, 0f - num2, 0.02f);
					val2.localRotation = Quaternion.Euler(0f, 0f, num) * Quaternion.Euler(0f, 180f, 0f);
				}
			}
		}

		private static void ApplyBackPose()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			float spread = ((BackSpread != null) ? BackSpread.Value : 76f);
			LayoutCross(s_groundCross, spread);
			LayoutCross(s_backCross, spread);
			if (Object.op_Implicit((Object)(object)s_backCross))
			{
				SheathPose.Pose(s_backCross, SheathPose.BackShieldJoint, Quaternion.identity, Vector3.zero, (Vector3)((BackOffset != null) ? BackOffset.Value : new Vector3(0f, 0.1f, 0f)), (BackEuler != null) ? BackEuler.Value : Vector3.zero);
			}
		}

		internal static string MeasureBack()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Expected O, but got Unknown
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer))
			{
				return "chaosback: no player";
			}
			Transform root = ((Component)localPlayer).transform;
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append($"chaosback: offset={BackOffset?.Value} rot={BackEuler?.Value} spread={BackSpread?.Value}");
			Transform[] componentsInChildren = ((Component)localPlayer).GetComponentsInChildren<Transform>(false);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == "BackShield_attach" || ((Object)val).name == "Spine2" || ((Object)val).name == "Spine1" || ((Object)val).name == "Neck")
				{
					stringBuilder.Append("\n  " + ((Object)val).name + " at " + V(val.position) + " up " + D(val.up) + " fwd " + D(val.forward) + " right " + D(val.right));
				}
				if (((Object)val).name != "OLY_cross" || !Object.op_Implicit((Object)(object)val.parent) || !((Object)val.parent).name.StartsWith("attach_back"))
				{
					continue;
				}
				string[] obj = new string[5]
				{
					"\n  cross at ",
					V(val.position),
					" (under ",
					null,
					null
				};
				Transform parent = val.parent.parent;
				obj[3] = ((parent != null) ? ((Object)parent).name : null);
				obj[4] = ")";
				stringBuilder.Append(string.Concat(obj));
				foreach (Transform item in val)
				{
					Transform val2 = item;
					MeshFilter component = ((Component)val2).GetComponent<MeshFilter>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.sharedMesh))
					{
						Bounds bounds = component.sharedMesh.bounds;
						stringBuilder.Append("\n  " + ((Object)val2).name + ": grip " + V(val2.position) + " tip " + V(val2.TransformPoint(new Vector3(0f, ((Bounds)(ref bounds)).max.y, 0f))) + " pommel " + V(val2.TransformPoint(new Vector3(0f, ((Bounds)(ref bounds)).min.y, 0f))) + " flat-normal " + D(val2.forward) + " edge " + D(val2.right));
					}
				}
			}
			return stringBuilder.ToString();
			string D(Vector3 w)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: 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_0028: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val3 = root.InverseTransformDirection(w);
				return $"({val3.x:0.00}, {val3.y:0.00}, {val3.z:0.00})";
			}
			string V(Vector3 w)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: 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_0028: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val3 = root.InverseTransformPoint(w);
				return $"({val3.x:0.000}, {val3.y:0.000}, {val3.z:0.000})";
			}
		}

		private static void RefreshBack()
		{
			ApplyBackPose();
			SheathPose.RefreshLocalBack();
		}

		private static void MakeHandBlade(Transform skin, string name, Mesh mesh, Material[] mats, GameObject dyrnwyn, GameObject fireSword, bool withLight, List<Renderer> renderers, List<Light> lights, List<ParticleSystem> flames)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Invalid comparison between Unknown and I4
			//IL_025b: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = new GameObject(name).transform;
			transform.SetParent(skin, false);
			GameObject val = new GameObject("model");
			val.layer = 12;
			val.transform.SetParent(transform, false);
			val.transform.localRotation = MeshInHand;
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			MeshRenderer val2 = val.AddComponent<MeshRenderer>();
			((Renderer)val2).sharedMaterials = mats;
			renderers.Add((Renderer)(object)val2);
			Transform transform2 = new GameObject("hilt").transform;
			transform2.SetParent(val.transform, false);
			transform2.localPosition = HiltLocal;
			GameObject val3 = WeaponVisuals.CopyChild(dyrnwyn, "attach/Burny vfx", transform);
			if (Object.op_Implicit((Object)(object)val3))
			{
				val3.transform.localPosition = new Vector3(0f, 0f, 0.37f);
				ParticleSystem[] componentsInChildren = val3.GetComponentsInChildren<ParticleSystem>(true);
				foreach (ParticleSystem val4 in componentsInChildren)
				{
					ShapeModule shape = val4.shape;
					if ((int)((ShapeModule)(ref shape)).shapeType == 5)
					{
						((ShapeModule)(ref shape)).scale = new Vector3(((ShapeModule)(ref shape)).scale.x * 0.8f, ((ShapeModule)(ref shape)).scale.y * 0.8f, 0.48f);
					}
					MainModule main = val4.main;
					((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0;
					((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 0.8f;
					flames.Add(val4);
				}
				((Object)val3).name = "OLY_deferred_fx";
				val3.SetActive(false);
			}
			if (withLight)
			{
				GameObject val5 = WeaponVisuals.CopyChild(dyrnwyn, "attach/Point Light", transform);
				if (Object.op_Implicit((Object)(object)val5))
				{
					val5.transform.localPosition = new Vector3(0f, 0f, 0.36f);
					Light component = val5.GetComponent<Light>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.intensity = _lightIntensity.Value;
						component.range = 8f;
						((Behaviour)component).enabled = _lightIntensity.Value > 0f;
						lights.Add(component);
					}
				}
			}
			GameObject val6 = WeaponVisuals.CopyChild(fireSword, "attach/equiped/trail", transform);
			if (Object.op_Implicit((Object)(object)val6))
			{
				Transform val7 = val6.transform.Find("base");
				Transform val8 = val6.transform.Find("tip");
				if (Object.op_Implicit((Object)(object)val7))
				{
					val7.localPosition = new Vector3(0f, 0f, 0.13f);
				}
				if (Object.op_Implicit((Object)(object)val8))
				{
					val8.localPosition = new Vector3(0f, 0f, 0.6f);
				}
			}
		}

		private static void MakeEquipped(Transform skin)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("equiped");
			val.transform.SetParent(skin, false);
			val.SetActive(false);
			if (_scareFire.Value)
			{
				GameObject val2 = WeaponVisuals.CopyChild(Cache.GetPrefab<GameObject>("Torch"), "attach/equiped/FireWarmth", val.transform);
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.transform.localPosition = Vector3.zero;
				}
			}
		}

		private static LineRenderer MakeChain(Transform skin, string name)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(skin, false);
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			val2.useWorldSpace = true;
			val2.positionCount = 0;
			val2.widthMultiplier = 0.045f;
			val2.textureMode = (LineTextureMode)1;
			val2.alignment = (LineAlignment)0;
			val2.numCornerVertices = 2;
			((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
			Material prefab = Cache.GetPrefab<Material>("GrapplingHookWire");
			if (Object.op_Implicit((Object)(object)prefab))
			{
				((Renderer)val2).sharedMaterial = prefab;
				val2.textureScale = new Vector2(22f, 1f);
			}
			else
			{
				Logger.LogWarning((object)"GrapplingHookWire material not found; chains will use the default material");
			}
			return val2;
		}

		public static float SpinRangeFor(int quality)
		{
			if (!ChaosUnlocks.Cyclone.At(quality))
			{
				return _spinRangeLow.Value;
			}
			return _spinRange.Value;
		}

		public static bool IsOurs(ItemData item)
		{
			if (item?.m_shared != null)
			{
				if (!Object.op_Implicit((Object)(object)item.m_dropPrefab) || !(((Object)item.m_dropPrefab).name == "OLY_BladesOfChaos"))
				{
					return item.m_shared.m_name == "$item_oly_bladesofchaos";
				}
				return true;
			}
			return false;
		}
	}
	internal static class Draupnir
	{
		public const string Prefab = "OLY_Draupnir";

		public const string Token = "$item_oly_draupnir";

		public const string Section = "Draupnir Spear";

		public const string ThrowSection = "Draupnir Spear - Throw";

		public const string BlastSection = "Draupnir Spear - Blast";

		public const string LookSection = "Draupnir Spear - Look";

		internal const string BasePrefab = "SpearWolfFang";

		private static ConfigEntry<float> _pierce;

		private static ConfigEntry<float> _piercePerLevel;

		private static ConfigEntry<float> _block;

		private static ConfigEntry<float> _parry;

		private static ConfigEntry<float> _blockForce;

		private static ConfigEntry<float> _blockForcePerLevel;

		private static ConfigEntry<float> _pokeStamina;

		private static ConfigEntry<float> _durability;

		private static ConfigEntry<float> _durabilityPerLevel;

		internal static Unlock WiderBlast;

		internal static Unlock DeepBite;

		internal static Unlock SeveralSpears;

		internal static ConfigEntry<float> ThrowStamina;

		internal static ConfigEntry<float> ThrowSpeed;

		internal static ConfigEntry<float> StraightRange;

		internal static ConfigEntry<float> Momentum;

		internal static ConfigEntry<float> FallGravity;

		internal static ConfigEntry<float> ThrowDamage;

		internal static ConfigEntry<bool> AimAtCrosshair;

		internal static ConfigEntry<bool> StopAtDomes;

		internal static ConfigEntry<bool> StickInCreatures;

		internal static ConfigEntry<float> BlastRadius;

		internal static ConfigEntry<float> WideRadius;

		internal static ConfigEntry<float> BlastDamage;

		internal static ConfigEntry<float> BluntShare;

		internal static ConfigEntry<float> DeepBiteDamage;

		internal static ConfigEntry<float> StaggerMultiplier;

		internal static ConfigEntry<float> PushForce;

		internal static ConfigEntry<float> ExtraBlastDamage;

		internal static ConfigEntry<float> DetonateStamina;

		internal static ConfigEntry<float> ArmDelay;

		internal static ConfigEntry<float> Lifetime;

		internal static ConfigEntry<int> BlastsThatCount;

		internal static ConfigEntry<int> SpearsAtFullLevel;

		internal static ConfigEntry<bool> LineOfSight;

		internal static ConfigEntry<bool> PlantedPulse;

		internal static ConfigEntry<bool> SnapEffect;

		internal static ConfigEntry<bool> FormFromRing;

		internal static ConfigEntry<bool> ReformAfterThrow;

		internal static ConfigEntry<bool> ShowWristBand;

		internal static ConfigEntry<bool> QuickForm;

		internal static ConfigEntry<float> Glow;

		internal static ConfigEntry<float> SpearGlow;

		internal static ConfigEntry<float> FormSeconds;

		internal static ConfigEntry<float> BandSize;

		internal static ConfigEntry<float> BandSizeBracers;

		internal static ConfigEntry<Vector3> BandOffset;

		internal static ConfigEntry<Vector3> BandRotation;

		internal static ConfigEntry<Vector3> BandOffsetBracers;

		internal static ConfigEntry<string> LongBracerChests;

		internal static ConfigEntry<Vector3> ModelOffset;

		internal static ConfigEntry<Vector3> ModelEuler;

		internal static ConfigEntry<float> ModelScale;

		internal const string DefaultLongChests = "OLY_RageChest, OLY_ValkyrieChest, ArmorIronChest, ArmorWolfChest, ArmorPaddedCuirass, ArmorCarapaceChest, ArmorFlametalChest, ArmorDeepNorthHeavyChest, ArmorAshlandsMediumChest";

		public static readonly Dictionary<string, string> English = new Dictionary<string, string>
		{
			{ "item_oly_draupnir", "Draupnir Spear" },
			{ "item_oly_draupnir_description", "A spear forged around the ring that multiplies." },
			{ "oly_drau_detonate", "Detonate" },
			{ "oly_drau_first_plant", "Press {0} to set off the planted spear" },
			{ "se_oly_draupnir", "Powers" },
			{ "oly_drau_level", "Level" },
			{ "oly_drau_locked", "locked" },
			{ "oly_drau_unlock_wider", "Wider blast: the blast reaches further" },
			{ "oly_drau_unlock_deep", "Deep bite: a blast inside a creature hits harder and staggers it" },
			{ "oly_drau_unlock_several", "Several spears: more spears planted at once, all set off with one press" },
			{ "oly_drau_keys", "Throw {0} · blast {1}" },
			{ "oly_drau_now_wider", "Wider blast" },
			{ "oly_drau_now_deep", "Blast inside: harder, staggers" },
			{ "oly_drau_now_several", "Several spears at once" },
			{ "oly_drau_later_wider", "wider blast" },
			{ "oly_drau_later_deep", "deep bite" },
			{ "oly_drau_later_several", "several spears" }
		};

		internal static readonly UpgradeCosts.Path Costs = new UpgradeCosts.Path
		{
			Prefab = "OLY_Draupnir",
			Weapon = "Draupnir Spear",
			WeaponId = 14,
			Classic = new UpgradeCosts.Row[4]
			{
				new UpgradeCosts.Row("FineWood", 8, 0),
				new UpgradeCosts.Row("BlackMetal", 20, 7),
				new UpgradeCosts.Row("LinenThread", 6, 2),
				new UpgradeCosts.Row("Needle", 8, 3)
			},
			Craft = "BlackMetal:20, FineWood:8, LinenThread:6, Needle:8",
			Level2 = "BlackMetal:8, LinenThread:4, Needle:4",
			Level3 = "Carapace:10, YggdrasilWood:6, BlackMetal:8",
			Level4 = "QueenDrop:1, Carapace:10, Mandible:4, Eitr:6",
			Where2 = "$oly_where_plains",
			Where3 = "$oly_where_mistlands",
			Where4 = "$oly_where_queen"
		};

		internal static GameObject ItemPrefab { get; private set; }

		public static void BindConfig(ConfigFile cfg)
		{
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_0787: Unknown result type (might be due to invalid IL or missing references)
			//IL_0812: Unknown result type (might be due to invalid IL or missing references)
			//IL_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
			_pierce = Cfg.Baked(cfg, "Draupnir Spear", "Pierce damage", 95f, "Base pierce damage of the poke (the Fang Spear: 70 pierce).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f));
			_piercePerLevel = Cfg.Baked(cfg, "Draupnir Spear", "Pierce per upgrade", 6f, "Extra pierce damage per item level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
			_block = Cfg.Baked(cfg, "Draupnir Spear", "Block", 38f, "Block armor.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f));
			_parry = Cfg.Baked(cfg, "Draupnir Spear", "Parry bonus", 2f, "Parry (timed block) multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f));
			_blockForce = Cfg.Baked(cfg, "Draupnir Spear", "Block force", 20f, "How hard a block pushes the attacker back.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f));
			_blockForcePerLevel = Cfg.Baked(cfg, "Draupnir Spear", "Block force per upgrade", 5f, "Extra block force per item level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f));
			_pokeStamina = Cfg.Baked(cfg, "Draupnir Spear", "Poke stamina", 14f, "Stamina a poke costs.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
			_durability = Cfg.Baked(cfg, "Draupnir Spear", "Durability", 200f, "Durability at level 1 (a poke or a throw wears 1; a detonation nothing).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 5000f));
			_durabilityPerLevel = Cfg.Baked(cfg, "Draupnir Spear", "Durability per upgrade", 50f, "Extra durability per item level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f));
			WiderBlast = Unlock.Bind(cfg, "Draupnir Spear", "Wider blast", 2, "Level unlock: a planted spear's blast reaches \"Wider blast radius\" (\"Draupnir Spear - Blast\") instead of \"Blast radius\".");
			DeepBite = Unlock.Bind(cfg, "Draupnir Spear", "Deep bite", 3, "Level unlock: a spear stuck inside a creature hits that creature harder when it goes off (\"Deep bite multiplier\") and staggers it (never a boss).");
			SeveralSpears = Unlock.Bind(cfg, "Draupnir Spear", "Several spears", 4, "Level unlock: up to \"Spears out at full level\" spears can be planted at once and one press sets them all off. Below it, a new throw makes the planted spear fade.");
			ThrowStamina = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Throw stamina", 18f, "Stamina a throw costs.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
			ThrowSpeed = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Throw speed", 50f, "How fast the thrown copy flies, in metres per second.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100f));
			StraightRange = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Straight range", 50f, "How many metres the copy flies dead straight before it drops. It also drops where the loaded world ends.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 150f));
			Momentum = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Speed kept as it drops", 0.3f, "Share of its speed the copy keeps as it drops (0 = straight down).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			FallGravity = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Fall gravity", 25f, "How fast a dropping copy speeds up, in m/s².", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 60f));
			ThrowDamage = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Throw damage multiplier", 1.5f, "Damage of the thrown copy's hit, as a multiple of a poke.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f));
			StopAtDomes = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Stop at shield domes", def: true, "A copy that hits a shield dome from outside shatters on it.");
			StickInCreatures = Cfg.Synced(cfg, "Draupnir Spear - Throw", "Stick in creatures", def: true, "A copy that hits a creature sticks in it and rides along (if the creature dies it drops and stays planted). Off: it drops and plants at the creature's feet, and for 5 seconds Deep bite counts the creature it hit (when the blast reaches it).");
			AimAtCrosshair = Cfg.Local(cfg, "Draupnir Spear - Throw", "Aim at crosshair", def: true, "The copy flies to where the crosshair points (off: straight ahead from your hand, a little above it).");
			ThrowStamina.SettingChanged += delegate
			{
				DraupnirSpear.ApplyThrowConfig();
			};
			ThrowSpeed.SettingChanged += delegate
			{
				DraupnirSpear.ApplyThrowConfig();
			};
			BlastRadius = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Blast radius", 3.5f, "How far a planted spear's blast reaches, in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f));
			WideRadius = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Wider blast radius", 4.5f, "The blast's reach once \"Wider blast\" is unlocked.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 12f));
			BlastDamage = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Blast damage multiplier", 1.2f, "A blast's damage as a multiple of a poke.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f));
			BluntShare = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Blunt share", 0.667f, "Share of the blast that is blunt damage; the rest is pierce.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			DeepBiteDamage = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Deep bite multiplier", 1.5f, "Extra multiplier for the creature a spear is stuck in (Deep bite).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f));
			StaggerMultiplier = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Stagger multiplier", 2f, "How much a blast adds to a creature's stagger bar.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f));
			PushForce = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Push force", 30f, "How hard a blast pushes creatures away (times your skill roll, like a weapon's own push).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f));
			ExtraBlastDamage = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Extra blast damage", 0.5f, "When several spears go off around one creature, the strongest hits it fully and each further blast this share.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			BlastsThatCount = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Blasts that count", 4, "At most this many blasts of one press hit the same creature.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10));
			DetonateStamina = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Detonate stamina", 10f, "Stamina one press of the detonate key costs (any number of spears).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
			ArmDelay = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Arm delay", 0.25f, "Seconds after it sticks before a spear can be set off.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f));
			Lifetime = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Spear lifetime seconds", 60f, "A planted spear fades (no blast) after this many seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 600f));
			SpearsAtFullLevel = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Spears out at full level", 5, "How many spears can be planted at once with \"Several spears\".", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10));
			LineOfSight = Cfg.Synced(cfg, "Draupnir Spear - Blast", "Line of sight", def: true, "A blast only reaches creatures it can see (not through walls).");
			PlantedPulse = Cfg.Local(cfg, "Draupnir Spear - Look", "Planted pulse", def: true, "A planted spear glows with a slow pale-gold pulse, faster in its last 5 seconds.");
			Glow = Cfg.Local(cfg, "Draupnir Spear - Look", "Glow", 1f, "Brightness of the planted pulse (0 = off). Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f));
			SnapEffect = Cfg.Local(cfg, "Draupnir Spear - Look", "Snap effect", def: true, "When a spear sticks, its lower half breaks off, drops and fades.");
			SpearGlow = Cfg.Local(cfg, "Draupnir Spear - Look", "Spear glow", 1f, "Brightness of the pale-gold glow in the spear's gold rings (and the head's lattice at levels 3-4). 0 = no glow. Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f));
			FormFromRing = Cfg.Local(cfg, "Draupnir Spear - Look", "Form from the ring", def: true, "Drawing the spear, it forms from the gold ring in your hand (the shaft grows both ways, the head last, with a short pale-gold shimmer); putting it away, it folds back into the ring. Off: the whole spear at once.");
			FormSeconds = Cfg.Local(cfg, "Draupnir Spear - Look", "Form seconds", 0.35f, "How long the spear takes to form from the ring.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1.5f));
			QuickForm = Cfg.Local(cfg, "Draupnir Spear - Look", "Quick form while eating", def: true, "The game puts the spear away for each bite of food and draws it again without a motion: a spear drawn again within 3 seconds of being put away forms in 0.15 seconds instead.");
			ReformAfterThrow = Cfg.Local(cfg, "Draupnir Spear - Look", "Re-form after a throw", def: true, "After a throw (a copy leaves the ring) the spear in your hand re-forms quickly from the ring.");
			ShowWristBand = Cfg.Local(cfg, "Draupnir Spear - Look", "Show wrist band", def: true, "Put away, the spear is not carried on the back: only its ring shows, on your right index finger. Off: nothing shows. Changes live.");
			BandOffset = Cfg.Local<Vector3>(cfg, "Draupnir Spear - Look", "Wrist band offset", new Vector3(0f, -0.02f, 0f), "Where the band sits on a bare wrist, in metres along the hand bone's axes (oly_tune drauband pos). Changes live.");
			BandRotation = Cfg.Local<Vector3>(cfg, "Draupnir Spear - Look", "Wrist band rotation", Vector3.zero, "Extra turn of the band in degrees (oly_tune drauband rot). Changes live.");
			BandSize = Cfg.Local(cfg, "Draupnir Spear - Look", "Wrist band size", 1f, "Size of the band on a bare wrist (1 = as designed; oly_tune drauband scale).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 3f));
			BandSizeBracers = Cfg.Local(cfg, "Draupnir Spear - Look", "Wrist band size over bracers", 1.15f, "Size of the band when the chest armour has long bracers (\"Long-bracer chests\"), so it fits over them.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 3f));
			BandOffsetBracers = Cfg.Local<Vector3>(cfg, "Draupnir Spear - Look", "Wrist band offset over bracers", new Vector3(0f, -0.05f, 0f), "Where the band sits over long bracers (a little up the forearm, on the bracer's end), in metres.");
			LongBracerChests = Cfg.Local(cfg, "Draupnir Spear - Look", "Long-bracer chests", "OLY_RageChest, OLY_ValkyrieChest, ArmorIronChest, ArmorWolfChest, ArmorPaddedCuirass, ArmorCarapaceChest, ArmorFlametalChest, ArmorDeepNorthHeavyChest, ArmorAshlandsMediumChest", "Chest armour (prefab names, comma separated) whose bracers or sleeves reach the wrist: with one of them on, the band uses the \"over bracers\" size and offset.");
			SpearGlow.SettingChanged += delegate
			{
				DraupnirModel.RefreshLooks();
			};
			BandOffset.SettingChanged += delegate
			{
				OlyDraupnirForm.BandSettingsChanged();
			};
			BandRotation.SettingChanged += delegate
			{
				OlyDraupnirForm.BandSettingsChanged();
			};
			BandSize.SettingChanged += delegate
			{
				OlyDraupnirForm.BandSettingsChanged();
			};
			BandSizeBracers.SettingChanged += delegate
			{
				OlyDraupnirForm.BandSettingsChanged();
			};
			BandOffsetBracers.SettingChanged += delegate
			{
				OlyDraupnirForm.BandSettingsChanged();
			};
			LongBracerChests.SettingChanged += delegate
			{
				OlyDraupnirForm.BandSettingsChanged();
			};
			ShowWristBand.SettingChanged += delegate
			{
				OlyDraupnirForm.BandSettingsChanged();
			};
			ModelOffset = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Draupnir offset", Vector3.zero, "Spear position in the hand, on top of the measured fit (oly_tune draupnir).");
			ModelEuler = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Draupnir rotation", Vector3.zero, "Extra spear rotation in degrees (y turns it about its shaft).");
			ModelScale = Cfg.Advanced(cfg, "Debug: model fit", "Draupnir scale", 1f, "Size multiplier (1 = the real 2.25 m spear).");
			foreach (KeyValuePair<string, string> item in DraupnirInfo.English)
			{
				English[item.Key] = item.Value;
			}
		}

		public static void Register()
		{
			//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_0016: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			ItemConfig val = new ItemConfig
			{
				Name = "$item_oly_draupnir",
				Description = "$item_oly_draupnir_description",
				CraftingStation = CraftingStations.Forge,
				MinStationLevel = 4
			};
			UpgradeCosts.AddClassicRows(val, Costs);
			CustomItem item = new CustomItem("OLY_Draupnir", "SpearWolfFang", val);
			if ((Object)(object)item.ItemPrefab == (Object)null)
			{
				Logger.LogError((object)"could not clone SpearWolfFang");
				return;
			}
			CustomRecipe recipe = item.Recipe;
			if (Object.op_Implicit((Object)(object)((recipe != null) ? recipe.Recipe : null)))
			{
				Recipe recipe2 = item.Recipe.Recipe;
				((Object)recipe2).hideFlags = (HideFlags)(((Object)recipe2).hideFlags | 0x20);
			}
			if (!ItemManager.Instance.AddItem(item))
			{
				Logger.LogError((object)"could not register OLY_Draupnir");
				return;
			}
			ItemPrefab = item.ItemPrefab;
			UpgradeCosts.Apply(item, Costs);
			SharedData shared = item.ItemDrop.m_itemData.m_shared;
			SetStats(shared);
			StructureGuard.RegisterThrown(IsOurs, () => true);
			Safe("tooltip", delegate
			{
				DraupnirInfo.Register(shared);
			});
			Safe("upgrade tooltip", delegate
			{
				UpgradeCosts.RegisterTooltip(Costs);
			});
			Safe("icon", delegate
			{
				SetIcon(shared);
			});
			Safe("model", delegate
			{
				DraupnirModel.Build(item.ItemPrefab);
			});
			try
			{
				Attack val2 = DraupnirSpear.Register(shared.m_secondaryAttack);
				if (val2 != null)
				{
					shared.m_secondaryAttack = val2;
				}
				else if (shared.m_secondaryAttack != null)
				{
					shared.m_secondaryAttack.m_attackType = (AttackType)3;
				}
			}
			catch (Exception arg)
			{
				Logger.LogError((object)$"Draupnir Spear: throw not available: {arg}");
				if (shared.m_secondaryAttack != null)
				{
					shared.m_secondaryAttack.m_attackType = (AttackType)3;
				}
			}
			Safe("blast effects", DraupnirBlast.Register);
		}

		private static void Safe(string what, Action step)
		{
			try
			{
				step();
			}
			catch (Exception arg)
			{
				Logger.LogError((object)$"Draupnir Spear: {what} not available: {arg}");
			}
		}

		private static void SetStats(SharedData shared)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			shared.m_damages = new DamageTypes
			{
				m_pierce = _pierce.Value
			};
			shared.m_damagesPerLevel = new DamageTypes
			{
				m_pierce = _piercePerLevel.Value
			};
			shared.m_blockPower = _block.Value;
			shared.m_blockPowerPerLevel = 0f;
			shared.m_timedBlockBonus = _parry.Value;
			shared.m_deflectionForce = _blockForce.Value;
			shared.m_deflectionForcePerLevel = _blockForcePerLevel.Value;
			shared.m_maxDurability = _durability.Value;
			shared.m_durabilityPerLevel = _durabilityPerLevel.Value;
			shared.m_useDurability = true;
			shared.m_maxQuality = 4;
			shared.m_attackStatusEffect = null;
			shared.m_spawnOnHitTerrain = null;
			if (shared.m_attack != null)
			{
				shared.m_attack.m_attackStamina = _pokeStamina.Value;
			}
		}

		private static void SetIcon(SharedData shared)
		{
			string text = WeaponVisuals.FindAsset("Icons", "icon_draupnir.png");
			Sprite val = ((text != null) ? AssetUtils.LoadSpriteFromFile(text) : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				shared.m_icons = (Sprite[])(object)new Sprite[1] { val };
			}
			else
			{
				Logger.LogInfo((object)"icon_draupnir.png not found yet: the Draupnir Spear keeps the Fang Spear's icon");
			}
		}

		internal static int Cap(ItemData item)
		{
			if (SeveralSpears == null || !SeveralSpears.At(item))
			{
				return 1;
			}
			return Mathf.Max(1, (SpearsAtFullLevel != null) ? SpearsAtFullLevel.Value : 5);
		}

		internal static float Radius(int quality)
		{
			if (WiderBlast == null || !WiderBlast.At(quality))
			{
				if (BlastRadius == null)
				{
					return 3.5f;
				}
				return BlastRadius.Value;
			}
			if (WideRadius == null)
			{
				return 4.5f;
			}
			return WideRadius.Value;
		}

		public static bool IsOurs(ItemData item)
		{
			if (item?.m_shared != null)
			{
				if (!Object.op_Implicit((Object)(object)item.m_dropPrefab) || !(((Object)item.m_dropPrefab).name == "OLY_Draupnir"))
				{
					return item.m_shared.m_name == "$item_oly_draupnir";
				}
				return true;
			}
			return false;
		}
	}
	internal static class GuardianShield
	{
		public const string Prefab = "OLY_GuardianShield";

		public const string Token = "$item_oly_guardianshield";

		public const string Section = "Guardian Shield";

		public const string LookKey = "guardian";

		internal const int WeaponId = 9;

		internal const string PowerSE = "SE_OLY_GuardianShield";

		private static readonly string[] BasePrefabs = new string[3] { "ShieldIronBuckler", "ShieldBronzeBuckler", "ShieldBanded" };

		private const string Obj = "guardian_shield.obj";

		private const string MeshChildPath = "attach/model (1)";

		internal static readonly Quaternion MeshInHand = new Quaternion(-0.537127f, 0.461411f, 0.525591f, 0.471538f);

		internal static readonly Vector3 GripOffset = new Vector3(0.0074f, -0.0572f, 0.0024f);

		internal static readonly Vector3 TiltPivot = new Vector3(0f, -0.03f, 0.014f);

		internal static readonly Quaternion MeshOnBack = new Quaternion(0.696364f, 0.122788f, 0.122788f, 0.696364f);

		private const float BaseScale = 1f;

		internal const float GlowStrength = 1.6f;

		internal static readonly Color GlowColour = new Color(1f, 0.7f, 0.28f);

		internal const float ClassicBlockPerLevel = 6f;

		private static readonly float[] DefaultBlock = new float[5] { 0f, 12f, 45f, 64f, 88f };

		private static readonly ConfigEntry<float>[] _block = new ConfigEntry<float>[5];

		private static ConfigEntry<float> _parry;

		private static ConfigEntry<float> _parry4;

		private static ConfigEntry<float> _push;

		private static ConfigEntry<float> _pushPerLevel;

		private static ConfigEntry<float> _durability;

		private static ConfigEntry<float> _durabilityPerLevel;

		private static ConfigEntry<float> _weight;

		private static ConfigEntry<float> _movement;

		internal static Unlock Stride;

		internal static Unlock Bash;

		internal static ConfigEntry<float> BashDamage;

		internal static ConfigEntry<float> BashPush;

		internal static ConfigEntry<bool> FoldingShield;

		internal static ConfigEntry<bool> ParryFlash;

		internal static ConfigEntry<bool> StayOnForearm;

		internal static ConfigEntry<bool> KeepShieldUp;

		internal static ConfigEntry<float> FoldSpeed;

		internal static ConfigEntry<float> ArmGap;

		internal static ConfigEntry<float> ArmGapArmour;

		internal static ConfigEntry<float> ElbowTilt;

		internal const float DefaultArmGap = -0.008f;

		internal const float DefaultArmGapArmour = 0.016f;

		internal static ConfigEntry<Vector3> ModelOffset;

		internal static ConfigEntry<Vector3> ModelEuler;

		internal static ConfigEntry<Vector3> BackOffset;

		internal static ConfigEntry<Vector3> BackEuler;

		internal static ConfigEntry<float> ModelScale;

		internal static ConfigEntry<float> OpenShieldSize;

		internal const float DefaultOpenSize = 1.5f;

		private static readonly float[] s_block = (float[])DefaultBlock.Clone();

		private static float s_blockStep = 25f;

		private static float s_parry = 2f;

		private static float s_parry4 = 2.5f;

		private static float s_push1 = 25f;

		private static float s_pushStep = 10f;

		private static float s_dur1 = 200f;

		private static float s_durStep = 50f;

		private static float s_weight = 4f;

		private static float s_move = -0.05f;

		private static string s_meshChild = "attach/model (1)";

		private static bool s_vanillaPose;

		private static Vector3 s_vanillaPos;

		private static Vector3 s_vanillaScale = Vector3.one;

		private static Quaternion s_vanillaRot = Quaternion.identity;

		private const string GlowPrefix = "OLY_Guardian_Face_Glow_Q";

		private static readonly Texture2D[] s_glowMaps = (Texture2D[])(object)new Texture2D[5];

		private static readonly bool[] s_glowLooked = new bool[5];

		private static bool s_warnedBack;

		public static readonly Dictionary<string, string> English = new Dictionary<string, string>
		{
			{ "item_oly_guardianshield", "Guardian Shield" },
			{ "item_oly_guardianshield_description", "A parry shield that folds onto your forearm." },
			{ "se_oly_guardianshield", "Powers" },
			{ "se_oly_guardparry", "Parry" },
			{ "oly_guard_level", "Level {0}" },
			{ "oly_guard_locked", "not yet unlocked" },
			{ "oly_guard_stride", "Folded stride" },
			{ "oly_guard_stride_on", "no slowdown while the shield is folded ({0} while you block)" },
			{ "oly_guard_stride_hint", "no slowdown while folded" },
			{ "oly_guard_bash", "Shield bash" },
			{ "oly_guard_bash_on", "a clean parry of a melee hit strikes back: blunt damage ({0}% of the hit) and a hard push" },
			{ "oly_guard_bash_hint", "parries strike back" },
			{ "oly_guard_parry4", "Stronger parry" },
			{ "oly_guard_parry4_on", "parry bonus {0}x" },
			{ "oly_guard_now_stride", "No slowdown while folded" },
			{ "oly_guard_now_bash", "Parries strike back: {0}%" },
			{ "oly_guard_now_parry4", "Parry bonus {0}" },
			{ "oly_guard_later_stride", "folded stride" },
			{ "oly_guard_later_bash", "shield bash" },
			{ "oly_guard_later_parry4", "stronger parry" },
			{ "oly_guard_held", "Held: the cross-biome upgrade costs are not in use (see the log). Each upgrade adds +6 block, the parry stays {0}x and the level abilities are off." }
		};

		internal static readonly UpgradeCosts.Path Costs = new UpgradeCosts.Path
		{
			Prefab = "OLY_GuardianShield",
			Weapon = "Guardian Shield",
			WeaponId = 9,
			Classic = new UpgradeCosts.Row[5]
			{
				new UpgradeCosts.Row("Wood", 10, 5),
				new UpgradeCosts.Row("Flint", 6, 0),
				new UpgradeCosts.Row("LeatherScraps", 6, 3),
				new UpgradeCosts.Row("Resin", 4, 0),
				new UpgradeCosts.Row("Iron", 0, 5)
			},
			Craft = "Wood:10, Flint:6, LeatherScraps:6, Resin:4",
			Level2 = "Iron:10, ElderBark:4, Bronze:4",
			Level3 = "BlackMetal:10, LinenThread:6, Chain:3",
			Level4 = "FlametalNew:10, Blackwood:8, AskHide:3",
			Where2 = "$oly_where_swamp",
			Where3 = "$oly_where_plains",
			Where4 = "$oly_where_ashlands"
		};

		private static readonly Color SteelTint = new Color(0.86f, 0.9f, 0.98f);

		private static readonly Color BronzeTint = new Color(1f, 0.78f, 0.5f);

		private static readonly flo