Decompiled source of Lion Lion v5.0.1

ExcaliburRoad.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ExcaliburRoad")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExcaliburRoad")]
[assembly: AssemblyCopyright("Copyright ?  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("4.5.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.5.0.0")]
namespace ExcaliburRoad;

[BepInPlugin("com.jotunn.ExcaliburRoad", "ExcaliburRoad", "4.5.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class ExcaliburRoad : BaseUnityPlugin
{
	public const string PluginGUID = "com.jotunn.ExcaliburRoad";

	public const string PluginName = "ExcaliburRoad";

	public const string PluginVersion = "4.5.0";

	public static AssetBundle excaliburBundle;

	private CustomLocalization Localization;

	public static RuntimeAnimatorController NormalController;

	public static RuntimeAnimatorController FastController;

	private readonly Harmony harmony = new Harmony("com.jotunn.ExcaliburRoad");

	public static bool isXMode;

	private ButtonConfig Mouse4AttackButton;

	private void Awake()
	{
		Logger.LogInfo((object)"ExcaliburRoad has landed");
		LoadAssets();
		AddLocalizations();
		harmony.PatchAll();
		AddInputs();
		PrefabManager.OnVanillaPrefabsAvailable += CreateExcaliburs;
	}

	private void LoadAssets()
	{
		Logger.LogInfo((object)("Embedded resources: " + string.Join(", ", typeof(ExcaliburRoad).Assembly.GetManifestResourceNames())));
		excaliburBundle = AssetUtils.LoadAssetBundleFromResources("excaliburfsn");
		NormalController = excaliburBundle.LoadAsset<RuntimeAnimatorController>("Player_animator");
		FastController = excaliburBundle.LoadAsset<RuntimeAnimatorController>("Player_animator fast");
		List<MethodInfo> declaredMethods = AccessTools.GetDeclaredMethods(typeof(Attack));
		foreach (MethodInfo item in declaredMethods)
		{
			if (item.Name.ToLower().Contains("spawn") || item.Name.ToLower().Contains("trigger") || item.Name.ToLower().Contains("hit"))
			{
				Logger.LogInfo((object)("Attack method: " + item.Name));
			}
		}
	}

	private void AddItemsWithConfigs()
	{
		excaliburBundle = AssetUtils.LoadAssetBundleFromResources("excaliburfsn");
		Logger.LogInfo((object)$"Loaded asset bundle: {excaliburBundle}");
		CreateExcaliburs();
		excaliburBundle.Unload(false);
	}

	private void CreateExcaliburs()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected O, but got Unknown
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Expected O, but got Unknown
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Expected O, but got Unknown
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Expected O, but got Unknown
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Expected O, but got Unknown
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Expected O, but got Unknown
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Expected O, but got Unknown
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Expected O, but got Unknown
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Expected O, but got Unknown
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Expected O, but got Unknown
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_026d: Expected O, but got Unknown
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Expected O, but got Unknown
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Expected O, but got Unknown
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Expected O, but got Unknown
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Expected O, but got Unknown
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Expected O, but got Unknown
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Expected O, but got Unknown
		//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Expected O, but got Unknown
		//IL_041f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Expected O, but got Unknown
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_046e: Expected O, but got Unknown
		//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ce: Expected O, but got Unknown
		//IL_0503: Unknown result type (might be due to invalid IL or missing references)
		//IL_050a: Expected O, but got Unknown
		//IL_0560: Unknown result type (might be due to invalid IL or missing references)
		//IL_056a: Expected O, but got Unknown
		//IL_059f: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a6: Expected O, but got Unknown
		//IL_0613: Unknown result type (might be due to invalid IL or missing references)
		//IL_061a: Expected O, but got Unknown
		//IL_065c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0666: Expected O, but got Unknown
		//IL_069b: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a2: Expected O, but got Unknown
		//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ee: Expected O, but got Unknown
		//IL_0723: Unknown result type (might be due to invalid IL or missing references)
		//IL_072a: Expected O, but got Unknown
		//IL_076d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0777: Expected O, but got Unknown
		//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b3: Expected O, but got Unknown
		//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0800: Expected O, but got Unknown
		//IL_0835: Unknown result type (might be due to invalid IL or missing references)
		//IL_083c: Expected O, but got Unknown
		//IL_087f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0889: Expected O, but got Unknown
		//IL_08be: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c5: Expected O, but got Unknown
		//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0902: Expected O, but got Unknown
		//IL_090d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0917: Expected O, but got Unknown
		//IL_094c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0953: Expected O, but got Unknown
		//IL_09bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c6: Expected O, but got Unknown
		//IL_0a09: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a13: Expected O, but got Unknown
		//IL_0a54: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5b: Expected O, but got Unknown
		//IL_0a74: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a7b: Expected O, but got Unknown
		//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a9c: Expected O, but got Unknown
		//IL_0ab5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0abc: Expected O, but got Unknown
		//IL_0ad6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0add: Expected O, but got Unknown
		//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0afe: Expected O, but got Unknown
		//IL_0b17: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b1e: Expected O, but got Unknown
		//IL_0b38: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b3f: Expected O, but got Unknown
		//IL_0b59: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b60: Expected O, but got Unknown
		//IL_0b7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b81: Expected O, but got Unknown
		//IL_0b9b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ba2: Expected O, but got Unknown
		//IL_0bbc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bc3: Expected O, but got Unknown
		//IL_0bdd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be4: Expected O, but got Unknown
		//IL_0bfe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c05: Expected O, but got Unknown
		//IL_0c1f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c26: Expected O, but got Unknown
		//IL_0c40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c47: Expected O, but got Unknown
		//IL_0c61: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c68: Expected O, but got Unknown
		//IL_0c82: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c89: Expected O, but got Unknown
		//IL_0ca3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0caa: Expected O, but got Unknown
		ItemConfig val = new ItemConfig();
		val.Amount = 1;
		val.AddRequirement("TrophyEikthyr", 1, 0);
		val.AddRequirement("TrophyTheElder", 1, 0);
		val.AddRequirement("TrophyBonemass", 1, 0);
		val.AddRequirement("TrophyDragonQueen", 1, 0);
		val.AddRequirement("TrophyGoblinKing", 1, 0);
		val.AddRequirement("TrophySeekerQueen", 1, 0);
		val.CraftingStation = "blackforge";
		val.RepairStation = "blackforge";
		val.Name = "$item_drc";
		val.Description = "$item_drc_desc";
		ItemConfig val2 = new ItemConfig();
		val2.Amount = 1;
		val2.AddRequirement("DragonEgg", 20, 0);
		val2.AddRequirement("Silver", 120, 0);
		val2.AddRequirement("TrophyHatchling", 20, 0);
		val2.CraftingStation = "forge";
		val2.RepairStation = "forge";
		val2.Name = "$item_sword_exc";
		val2.Description = "$item_sword_exc_desc";
		ItemConfig val3 = new ItemConfig();
		val3.Amount = 1;
		val3.AddRequirement("BlackMetal", 200, 0);
		val3.AddRequirement("SurtlingCore", 50, 0);
		val3.AddRequirement("UndeadBjornRibcage", 25, 0);
		val3.AddRequirement("Thunderstone", 200, 0);
		val3.CraftingStation = "forge";
		val3.RepairStation = "forge";
		val3.MinStationLevel = 1;
		val3.Name = "$item_sword_exm";
		val3.Description = "$item_sword_exm_desc";
		ItemConfig val4 = new ItemConfig();
		val4.Amount = 1;
		val4.AddRequirement(new RequirementConfig("THSwordExc", 1, 0, true));
		val4.AddRequirement(new RequirementConfig("THSwordExm", 1, 0, true));
		val4.AddRequirement(new RequirementConfig("THSwordExcP", 1, 0, true));
		val4.CraftingStation = "forge";
		val4.MinStationLevel = 4;
		val4.RepairStation = "forge";
		val4.Name = "$item_excelsusP";
		val4.Description = "$item_excelsusP_desc";
		ItemConfig val5 = new ItemConfig();
		val5.Amount = 1;
		val5.AddRequirement(new RequirementConfig("Eitr", 50, 0, true));
		val5.AddRequirement(new RequirementConfig("Mandible", 50, 0, true));
		val5.AddRequirement(new RequirementConfig("YagluthDrop", 5, 0, true));
		val5.AddRequirement(new RequirementConfig("ExcalPlain", 1, 0, true));
		val5.CraftingStation = "blackforge";
		val5.MinStationLevel = 1;
		val5.RepairStation = "blackforge";
		val5.Name = "$item_excelsusML";
		val5.Description = "$item_excelsusML_desc";
		ItemConfig val6 = new ItemConfig();
		val6.Amount = 1;
		val6.AddRequirement(new RequirementConfig("ExcalML", 1, 0, true));
		val6.AddRequirement(new RequirementConfig("FlametalNew", 120, 0, true));
		val6.AddRequirement(new RequirementConfig("MorgenSinew", 50, 0, true));
		val6.AddRequirement(new RequirementConfig("DragonReactorCore", 1, 0, true));
		val6.CraftingStation = "blackforge";
		val6.MinStationLevel = 3;
		val6.RepairStation = "blackforge";
		val6.Name = "$item_excelsus";
		val6.Description = "$item_excelsus_desc";
		ItemConfig val7 = new ItemConfig();
		val7.Amount = 1;
		val7.AddRequirement("BlackMetal", 200, 0);
		val7.AddRequirement("YmirRemains", 100, 0);
		val7.AddRequirement("WolfClaw", 50, 0);
		val7.AddRequirement("Silver", 50, 0);
		val7.CraftingStation = "blackforge";
		val7.RepairStation = "blackforge";
		val7.Name = "$item_sword_excp";
		val7.Description = "$item_sword_excp_desc";
		ItemConfig val8 = new ItemConfig();
		val8.Amount = 1;
		val8.AddRequirement("TrophyGoblinBrute", 25, 0);
		val8.AddRequirement("TrophyBjorn", 25, 0);
		val8.AddRequirement("UndeadBjornRibcage", 100, 0);
		val8.AddRequirement(new RequirementConfig("DragonReactorCore", 0, 1, true));
		val8.CraftingStation = "forge";
		val8.MinStationLevel = 3;
		val8.RepairStation = "forge";
		val8.Name = "$item_sei";
		val8.Description = "$item_sei_desc";
		ItemConfig val9 = new ItemConfig();
		val9.Amount = 1;
		val9.AddRequirement("BlackMetal", 150, 0);
		val9.AddRequirement("TrophyLox", 25, 0);
		val9.AddRequirement("TrophyGoblinShaman", 25, 0);
		val9.AddRequirement("YmirRemains", 100, 0);
		val9.AddRequirement(new RequirementConfig("DragonReactorCore", 0, 1, true));
		val9.CraftingStation = "forge";
		val9.RepairStation = "forge";
		val9.Name = "$item_shield_wen";
		val9.Description = "$item_shield_wen_desc";
		ItemConfig val10 = new ItemConfig();
		val10.Amount = 1;
		val10.AddRequirement("Mandible", 0, 10);
		val10.AddRequirement("Eitr", 0, 100);
		val10.AddRequirement("Needle", 200, 0);
		val10.AddRequirement("BlackMetal", 100, 0);
		val10.AddRequirement(new RequirementConfig("DragonReactorCore", 0, 1, true));
		val10.CraftingStation = "forge";
		val10.RepairStation = "forge";
		val10.Name = "$item_knife_wensk";
		val10.Description = "$item_knife_wensk_desc";
		ItemConfig val11 = new ItemConfig();
		val11.Amount = 1;
		val11.AddRequirement("Wood", 10, 1);
		val11.AddRequirement("Stone", 10, 1);
		val11.AddRequirement("Flint", 10, 1);
		val11.CraftingStation = "piece_workbench";
		val11.RepairStation = "piece_workbench";
		val11.Name = "$item_zam_meadow";
		val11.Description = "$item_zam_meadow_desc";
		ItemConfig val12 = new ItemConfig();
		val12.Amount = 1;
		val12.AddRequirement("Bronze", 10, 1);
		val12.AddRequirement("RoundLog", 10, 1);
		val12.AddRequirement("TrophyBjorn", 1, 1);
		val12.AddRequirement(new RequirementConfig("BattleaxeZam", 1, 0, true));
		val12.CraftingStation = "forge";
		val12.RepairStation = "forge";
		val12.Name = "$item_zam_bf";
		val12.Description = "$item_zam_bf_desc";
		ItemConfig val13 = new ItemConfig();
		val13.Amount = 1;
		val13.AddRequirement("ElderBark", 10, 1);
		val13.AddRequirement("Iron", 10, 1);
		val13.AddRequirement("TrophyAbomination", 1, 1);
		val13.AddRequirement(new RequirementConfig("BattleaxeZam1", 1, 0, true));
		val13.CraftingStation = "forge";
		val13.RepairStation = "forge";
		val13.Name = "$item_zam_swamp";
		val13.Description = "$item_zam_swamp_desc";
		ItemConfig val14 = new ItemConfig();
		val14.Amount = 1;
		val14.AddRequirement("Silver", 10, 1);
		val14.AddRequirement("Obsidian", 10, 1);
		val14.AddRequirement("OnionSeeds", 10, 1);
		val14.AddRequirement(new RequirementConfig("BattleaxeZam2", 1, 0, true));
		val14.CraftingStation = "forge";
		val14.RepairStation = "forge";
		val14.Name = "$item_zam_mountain";
		val14.Description = "$item_zam_mountain_desc";
		ItemConfig val15 = new ItemConfig();
		val15.Amount = 1;
		val15.AddRequirement("BlackMetal", 10, 1);
		val15.AddRequirement("Needle", 10, 1);
		val15.AddRequirement("Tar", 10, 1);
		val15.AddRequirement(new RequirementConfig("BattleaxeZam3", 1, 0, true));
		val15.CraftingStation = "forge";
		val15.RepairStation = "forge";
		val15.Name = "$item_zam_plain";
		val15.Description = "$item_zam_plain_desc";
		ItemConfig val16 = new ItemConfig();
		val16.Amount = 1;
		val16.AddRequirement("YggdrasilWood", 20, 1);
		val16.AddRequirement("BlackMarble", 20, 1);
		val16.AddRequirement("Mandible", 10, 1);
		val16.AddRequirement(new RequirementConfig("BattleaxeZam4", 1, 0, true));
		val16.CraftingStation = "blackforge";
		val16.RepairStation = "blackforge";
		val16.Name = "$item_zam_ML";
		val16.Description = "$item_zam_ML_desc";
		ItemConfig val17 = new ItemConfig();
		val17.Amount = 1;
		val17.AddRequirement("SurtlingCore", 10, 5);
		val17.AddRequirement("Thunderstone", 10, 5);
		val17.AddRequirement(new RequirementConfig("BattleaxeZam5", 1, 0, true));
		val17.AddRequirement(new RequirementConfig("DragonReactorCore", 1, 0, true));
		val17.CraftingStation = "blackforge";
		val17.RepairStation = "blackforge";
		val17.Name = "$item_zam_ashland";
		val17.Description = "$item_zam_ashland_desc";
		ItemConfig val18 = new ItemConfig();
		val18.Amount = 1;
		val18.AddRequirement("Tar", 10, 0);
		val18.AddRequirement("MechanicalSpring", 3, 0);
		val18.AddRequirement("Iron", 10, 0);
		val18.CraftingStation = "blackforge";
		val18.RepairStation = "blackforge";
		val18.Name = "$item_EE";
		val18.Description = "$item_EE_desc";
		ItemConfig val19 = new ItemConfig();
		val19.Amount = 1;
		val19.AddRequirement("RoundLog", 100, 0);
		val19.AddRequirement("Silver", 100, 0);
		val19.AddRequirement("Iron", 100, 0);
		val19.AddRequirement(new RequirementConfig("DragonReactorCore", 0, 1, true));
		val19.CraftingStation = "forge";
		val19.RepairStation = "forge";
		val19.Name = "$item_bow_yeng";
		val19.Description = "$item_bow_yeng_desc";
		CustomItem val20 = new CustomItem(excaliburBundle, "THSwordExc", false, val2);
		ItemManager.Instance.AddItem(val20);
		CustomItem val21 = new CustomItem(excaliburBundle, "THSwordExm", false, val3);
		ItemManager.Instance.AddItem(val21);
		CustomItem val22 = new CustomItem(excaliburBundle, "ExcaliburExcelsus", false, val6);
		ItemManager.Instance.AddItem(val22);
		CustomItem val23 = new CustomItem(excaliburBundle, "ExcalPlain", false, val4);
		ItemManager.Instance.AddItem(val23);
		CustomItem val24 = new CustomItem(excaliburBundle, "ExcalML", false, val5);
		ItemManager.Instance.AddItem(val24);
		CustomItem val25 = new CustomItem(excaliburBundle, "THSwordExcP", false, val7);
		ItemManager.Instance.AddItem(val25);
		CustomItem val26 = new CustomItem(excaliburBundle, "DragonReactorCore", false, val);
		ItemManager.Instance.AddItem(val26);
		CustomItem val27 = new CustomItem(excaliburBundle, "WensKnife", false, val10);
		ItemManager.Instance.AddItem(val27);
		CustomItem val28 = new CustomItem(excaliburBundle, "WensShield", false, val9);
		ItemManager.Instance.AddItem(val28);
		CustomItem val29 = new CustomItem(excaliburBundle, "Hound", false, val8);
		ItemManager.Instance.AddItem(val29);
		CustomItem val30 = new CustomItem(excaliburBundle, "BattleaxeZam", false, val11);
		ItemManager.Instance.AddItem(val30);
		CustomItem val31 = new CustomItem(excaliburBundle, "BattleaxeZam1", false, val12);
		ItemManager.Instance.AddItem(val31);
		CustomItem val32 = new CustomItem(excaliburBundle, "BattleaxeZam2", false, val13);
		ItemManager.Instance.AddItem(val32);
		CustomItem val33 = new CustomItem(excaliburBundle, "BattleaxeZam3", false, val14);
		ItemManager.Instance.AddItem(val33);
		CustomItem val34 = new CustomItem(excaliburBundle, "BattleaxeZam4", false, val15);
		ItemManager.Instance.AddItem(val34);
		CustomItem val35 = new CustomItem(excaliburBundle, "BattleaxeZam5", false, val16);
		ItemManager.Instance.AddItem(val35);
		CustomItem val36 = new CustomItem(excaliburBundle, "BattleaxeZam6", false, val17);
		ItemManager.Instance.AddItem(val36);
		CustomItem val37 = new CustomItem(excaliburBundle, "EmergencyExit", false, val18);
		ItemManager.Instance.AddItem(val37);
		CustomItem val38 = new CustomItem(excaliburBundle, "YengBow", false, val19);
		ItemManager.Instance.AddItem(val38);
		PrefabManager.OnVanillaPrefabsAvailable -= CreateExcaliburs;
	}

	private void AddInputs()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		Mouse4AttackButton = new ButtonConfig
		{
			Name = "Lionclaw",
			Key = (KeyCode)327,
			BlockOtherInputs = false
		};
		InputManager.Instance.AddButton("com.jotunn.ExcaliburRoad", Mouse4AttackButton);
	}

	private void Update()
	{
		if (ZInput.instance == null || (Object)(object)Player.m_localPlayer == (Object)null)
		{
			return;
		}
		ItemData currentWeapon = ((Humanoid)Player.m_localPlayer).GetCurrentWeapon();
		if (currentWeapon != null && (!(currentWeapon.m_shared.m_name != "$item_excelsus") || !(currentWeapon.m_shared.m_name != "$item_excelsusP") || !(currentWeapon.m_shared.m_name != "$item_excelsusML")))
		{
			Logger.LogInfo((object)$"isXMode: {isXMode} | current HP cost: {currentWeapon.m_shared.m_secondaryAttack.m_attackHealthPercentage}");
			if (isXMode)
			{
				currentWeapon.m_shared.m_secondaryAttack.m_attackHealthPercentage = 0f;
				currentWeapon.m_shared.m_secondaryAttack.m_attackHealth = 0f;
				currentWeapon.m_shared.m_secondaryAttack.m_damageMultiplier = 3f;
				currentWeapon.m_shared.m_secondaryAttack.m_attackRange = 4f;
				currentWeapon.m_shared.m_secondaryAttack.m_attackStamina = 80f;
				currentWeapon.m_shared.m_secondaryAttack.m_attackRayWidth = 0.5f;
			}
			else
			{
				currentWeapon.m_shared.m_secondaryAttack.m_attackHealthPercentage = 85f;
				currentWeapon.m_shared.m_secondaryAttack.m_damageMultiplier = 5f;
				currentWeapon.m_shared.m_secondaryAttack.m_attackRange = 20f;
				currentWeapon.m_shared.m_secondaryAttack.m_attackStamina = 240f;
				currentWeapon.m_shared.m_secondaryAttack.m_attackRayWidth = 1.5f;
			}
			if (Input.GetMouseButtonDown(3))
			{
				isXMode = !isXMode;
				Logger.LogInfo((object)$"M4 toggled! isXMode: {isXMode}");
			}
		}
	}

	private void AddLocalizations()
	{
		Localization = LocalizationManager.Instance.GetLocalization();
		CustomLocalization localization = Localization;
		string text = "English";
		localization.AddTranslation(ref text, new Dictionary<string, string>
		{
			{ "item_sword_exc", "Excalibur" },
			{ "item_sword_exc_desc", "This light is the planet's hope... Proof of the life that illuminates this world! Behold! Excalibur!" },
			{ "item_sword_exm", "Excalibur Morgan" },
			{ "item_sword_exm_desc", "Vortigern, Hammer of the Vile King, reverse the rising sun. Swallow the light, Excalibur Morgan!!" },
			{ "item_sword_excp", "Excalibur Proto" },
			{ "item_sword_excp_desc", "Let's put an end to this. Seal Thirteen Decision start Approved. Bedivere, Gareth, Lancelot, Mordred, Galahad. This is a battle to save the world. Excalibur!!" },
			{ "item_drc", "Dragon Reactor Core" },
			{ "item_drc_desc", "Inexhaustible magical energy and miracles far beyond human capacity, and the price paid for them." },
			{ "item_knife_wensk", "Mistilteinn" },
			{ "item_knife_wensk_desc", "Even in the hands of the blind, it shall slay even the immortal gods." },
			{ "item_shield_wen", "Svalin" },
			{ "item_shield_wen_desc", "The courageous shield the guards Jörð from Sól's dying flame." },
			{ "item_excelsus", "Excalibur Excelsus" },
			{ "item_excelsus_desc", "Sheathed in the breath of the planet. A shining torrent of life. Victory is in our hands! Excalibur Excelsus!!" },
			{ "item_sei", "Freki ,the ravenous one" },
			{ "item_sei_desc", "Yet, though serves with thine eyes clouded in chaos. Thou, bound in the cage of madness. I am he who command these chaos" },
			{ "item_zam_meadow", "Axe of the witch in the meadow" },
			{ "item_zam_meadow_desc", "utility axe." },
			{ "item_zam_bf", "Axe of the witch in the blackforest" },
			{ "item_zam_bf_desc", "She start to do drug now." },
			{ "item_zam_swamp", "Axe of the witch in the swamp" },
			{ "item_zam_swamp_desc", "She start to learn the art of poison" },
			{ "item_zam_mountain", "Axe of the witch in the mountain" },
			{ "item_zam_mountain_desc", "She put me inside the fridge and forget about me." },
			{ "item_zam_plain", "Axe of the witch in the plain" },
			{ "item_zam_plain_desc", "She steal the local shaman spell." },
			{ "item_zam_ML", "Axe of the witch in the mistland" },
			{ "item_zam_ML_desc", "She gonna get lost in the mist some day." },
			{ "item_zam_ashland", "Axe of the witch in the ashland" },
			{ "item_zam_ashland_desc", "Our adventure might end here." },
			{ "item_EE", "Emergency Exit" },
			{ "item_EE_desc", "Thou shall not kill." },
			{ "item_excelsusP", "Excalibur Excelsus" },
			{ "item_excelsusP_desc", "Sheathed in the breath of the planet. A shining torrent of life. Victory is in our hands! Excalibur Excelsus!!" },
			{ "item_excelsusML", "Excalibur Excelsus" },
			{ "item_excelsusML_desc", "Sheathed in the breath of the planet. A shining torrent of life. Victory is in our hands! Excalibur Excelsus!!" },
			{ "item_bow_yeng", "Ýdalir" },
			{ "item_bow_yeng_desc", "Ydalir it is called, where Ullr has himself a dwelling made. Alfheim the gods Frey gave in days of yore for a tooth-gift." }
		});
	}
}
[HarmonyPatch(typeof(Recipe), "GetRequiredStationLevel")]
public static class CappedStationLevelPatch
{
	private static readonly HashSet<string> cappedWeapons = new HashSet<string> { "$item_zam_meadow", "$item_zam_bf", "$item_zam_swamp", "$item_zam_mountain", "$item_zam_plain", "$item_zam_ML", "$item_zam_ashland" };

	private static void Postfix(Recipe __instance, ref int __result, int quality)
	{
		if (!((Object)(object)__instance.m_item == (Object)null))
		{
			string name = __instance.m_item.m_itemData.m_shared.m_name;
			if (cappedWeapons.Contains(name))
			{
				__result = Mathf.Min(__result, 1);
			}
		}
	}
}
[HarmonyPatch]
public static class SwapAnimatorPatch
{
	private static string lastWeapon = "";

	private static AnimatorOverrideController normalAOC;

	private static AnimatorOverrideController fastAOC;

	public static AnimatorOverrideController xAOC;

	[HarmonyTargetMethod]
	private static MethodBase TargetMethod()
	{
		return AccessTools.Method(typeof(Player), "CustomFixedUpdate", (Type[])null, (Type[])null);
	}

	private static void Postfix(Player __instance)
	{
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Expected O, but got Unknown
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Expected O, but got Unknown
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Expected O, but got Unknown
		if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer)
		{
			return;
		}
		Animator componentInChildren = ((Component)__instance).GetComponentInChildren<Animator>();
		if ((Object)(object)componentInChildren == (Object)null || componentInChildren.layerCount < 2)
		{
			return;
		}
		ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon();
		if (currentWeapon == null)
		{
			return;
		}
		string name = currentWeapon.m_shared.m_name;
		if (((Object)(object)normalAOC == (Object)null || (Object)(object)fastAOC == (Object)null) && name != lastWeapon)
		{
			lastWeapon = name;
			AnimationClip val = ExcaliburRoad.excaliburBundle.LoadAsset<AnimationClip>("Excaliburswing");
			AnimationClip value = ExcaliburRoad.excaliburBundle.LoadAsset<AnimationClip>("ExcalM1_1");
			AnimationClip val2 = ExcaliburRoad.excaliburBundle.LoadAsset<AnimationClip>("ExcalM1_2");
			AnimationClip val3 = ExcaliburRoad.excaliburBundle.LoadAsset<AnimationClip>("ExcalM1_3");
			AnimationClip value2 = ExcaliburRoad.excaliburBundle.LoadAsset<AnimationClip>("ExcalM1_4");
			AnimationClip value3 = ExcaliburRoad.excaliburBundle.LoadAsset<AnimationClip>("ExcalM1_5");
			AnimationClip val4 = ExcaliburRoad.excaliburBundle.LoadAsset<AnimationClip>("Lionclaw");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			normalAOC = new AnimatorOverrideController(componentInChildren.runtimeAnimatorController);
			List<KeyValuePair<AnimationClip, AnimationClip>> list = new List<KeyValuePair<AnimationClip, AnimationClip>>();
			AnimationClip[] animationClips = ((RuntimeAnimatorController)normalAOC).animationClips;
			foreach (AnimationClip val5 in animationClips)
			{
				list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val5, val5));
			}
			normalAOC.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list);
			fastAOC = new AnimatorOverrideController(componentInChildren.runtimeAnimatorController);
			List<KeyValuePair<AnimationClip, AnimationClip>> list2 = new List<KeyValuePair<AnimationClip, AnimationClip>>();
			AnimationClip[] animationClips2 = ((RuntimeAnimatorController)fastAOC).animationClips;
			foreach (AnimationClip val6 in animationClips2)
			{
				if (((Object)val6).name == "Sledge-Attack1")
				{
					list2.Add(new KeyValuePair<AnimationClip, AnimationClip>(val6, val));
				}
				else if (((Object)val6).name == "Greatsword BaseAttack (1)")
				{
					list2.Add(new KeyValuePair<AnimationClip, AnimationClip>(val6, value));
				}
				else if (((Object)val6).name == "Greatsword BaseAttack (2)")
				{
					list2.Add(new KeyValuePair<AnimationClip, AnimationClip>(val6, value2));
				}
				else if (((Object)val6).name == "Greatsword BaseAttack (3)")
				{
					list2.Add(new KeyValuePair<AnimationClip, AnimationClip>(val6, value3));
				}
				else
				{
					list2.Add(new KeyValuePair<AnimationClip, AnimationClip>(val6, val6));
				}
			}
			fastAOC.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list2);
			if ((Object)(object)val4 != (Object)null)
			{
				xAOC = new AnimatorOverrideController(componentInChildren.runtimeAnimatorController);
				List<KeyValuePair<AnimationClip, AnimationClip>> list3 = new List<KeyValuePair<AnimationClip, AnimationClip>>();
				AnimationClip[] animationClips3 = ((RuntimeAnimatorController)xAOC).animationClips;
				foreach (AnimationClip val7 in animationClips3)
				{
					if (((Object)val7).name == "Sledge-Attack1")
					{
						list3.Add(new KeyValuePair<AnimationClip, AnimationClip>(val7, val4));
					}
					else if (((Object)val7).name == "Greatsword BaseAttack (1)")
					{
						list3.Add(new KeyValuePair<AnimationClip, AnimationClip>(val7, value));
					}
					else if (((Object)val7).name == "Greatsword BaseAttack (2)")
					{
						list3.Add(new KeyValuePair<AnimationClip, AnimationClip>(val7, value2));
					}
					else if (((Object)val7).name == "Greatsword BaseAttack (3)")
					{
						list3.Add(new KeyValuePair<AnimationClip, AnimationClip>(val7, value3));
					}
					else
					{
						list3.Add(new KeyValuePair<AnimationClip, AnimationClip>(val7, val7));
					}
				}
				xAOC.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list3);
			}
		}
		if (name == "$item_sword_exc" || name == "$item_sword_excp" || name == "$item_sword_exm")
		{
			componentInChildren.runtimeAnimatorController = (RuntimeAnimatorController)(object)xAOC;
		}
		if (name == "$item_excelsus" || name == "$item_excelsusP" || name == "$item_excelsusML")
		{
			if (ExcaliburRoad.isXMode && (Object)(object)xAOC != (Object)null)
			{
				componentInChildren.runtimeAnimatorController = (RuntimeAnimatorController)(object)xAOC;
			}
			else
			{
				componentInChildren.runtimeAnimatorController = (RuntimeAnimatorController)(object)fastAOC;
			}
		}
		else if (name != lastWeapon)
		{
			lastWeapon = name;
			componentInChildren.runtimeAnimatorController = (RuntimeAnimatorController)(object)normalAOC;
		}
	}
}
[HarmonyPatch(typeof(Hud), "DamageFlash")]
public static class ExcaliburFlashPatch
{
	private static bool Prefix()
	{
		Player localPlayer = Player.m_localPlayer;
		ItemData val = ((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null);
		if (val == null)
		{
			return true;
		}
		if (val.m_shared.m_name == "$item_excelsus" || val.m_shared.m_name == "$item_excelsusP" || val.m_shared.m_name == "$item_excelsusML")
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(Humanoid), "StartAttack")]
public static class EnergyBladePatch
{
	private static bool isShowing;

	private static void Postfix(Humanoid __instance, Character target, bool secondaryAttack, bool __result)
	{
		Player val = (Player)(object)((__instance is Player) ? __instance : null);
		if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer || !secondaryAttack || !__result || isShowing || ExcaliburRoad.isXMode)
		{
			return;
		}
		ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon();
		if (currentWeapon == null || (currentWeapon.m_shared.m_name != "$item_excelsus" && currentWeapon.m_shared.m_name != "$item_excelsusP" && currentWeapon.m_shared.m_name != "$item_excelsusML"))
		{
			return;
		}
		VisEquipment componentInChildren = ((Component)val).GetComponentInChildren<VisEquipment>();
		if ((Object)(object)componentInChildren == (Object)null)
		{
			return;
		}
		FieldInfo fieldInfo = AccessTools.Field(typeof(VisEquipment), "m_rightItemInstance");
		object? value = fieldInfo.GetValue(componentInChildren);
		GameObject val2 = (GameObject)((value is GameObject) ? value : null);
		if (!((Object)(object)val2 == (Object)null))
		{
			Transform val3 = val2.transform.Find("BeamBlade");
			Logger.LogInfo((object)$"blade null: {(Object)(object)val3 == (Object)null}");
			if (!((Object)(object)val3 == (Object)null))
			{
				isShowing = true;
				((MonoBehaviour)val).StartCoroutine(ShowBlades(val3));
			}
		}
	}

	private static IEnumerator ShowBlades(Transform blade)
	{
		((Component)blade).gameObject.SetActive(true);
		yield return (object)new WaitForSeconds(1.5f);
		((Component)blade).gameObject.SetActive(false);
		isShowing = false;
	}
}
[HarmonyPatch(typeof(Attack), "DoMeleeAttack")]
public static class BlockTriggerEffectPatch
{
	private static void Prefix(Attack __instance)
	{
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		Player localPlayer = Player.m_localPlayer;
		ItemData val = ((localPlayer != null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null);
		if (val != null && (!(val.m_shared.m_name != "$item_excelsus") || !(val.m_shared.m_name != "$item_excelsusP") || !(val.m_shared.m_name != "$item_excelsusML")) && ExcaliburRoad.isXMode)
		{
			__instance.m_triggerEffect = new EffectList();
		}
	}
}