Decompiled source of Lion Stuff v3.0.0

ExcaliburRoad.dll

Decompiled 3 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("3.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.0")]
namespace ExcaliburRoad;

[BepInPlugin("com.jotunn.ExcaliburRoad", "ExcaliburRoad", "3.0.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 = "3.0.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");

	private void Awake()
	{
		Logger.LogInfo((object)"ExcaliburRoad has landed");
		LoadAssets();
		AddLocalizations();
		harmony.PatchAll();
		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");
	}

	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_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Expected O, but got Unknown
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Expected O, but got Unknown
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Expected O, but got Unknown
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Expected O, but got Unknown
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Expected O, but got Unknown
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Expected O, but got Unknown
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: 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_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Expected O, but got Unknown
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Expected O, but got Unknown
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Expected O, but got Unknown
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Expected O, but got Unknown
		//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Expected O, but got Unknown
		//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fb: Expected O, but got Unknown
		//IL_0454: Unknown result type (might be due to invalid IL or missing references)
		//IL_045e: Expected O, but got Unknown
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Expected O, but got Unknown
		//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ea: Expected O, but got Unknown
		//IL_051f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Expected O, but got Unknown
		//IL_0593: Unknown result type (might be due to invalid IL or missing references)
		//IL_059a: Expected O, but got Unknown
		//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e6: Expected O, but got Unknown
		//IL_061b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0622: Expected O, but got Unknown
		//IL_0664: Unknown result type (might be due to invalid IL or missing references)
		//IL_066e: Expected O, but got Unknown
		//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06aa: Expected O, but got Unknown
		//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f7: Expected O, but got Unknown
		//IL_072c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0733: Expected O, but got Unknown
		//IL_0776: Unknown result type (might be due to invalid IL or missing references)
		//IL_0780: Expected O, but got Unknown
		//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bc: Expected O, but got Unknown
		//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0809: Expected O, but got Unknown
		//IL_083e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0845: Expected O, but got Unknown
		//IL_0878: Unknown result type (might be due to invalid IL or missing references)
		//IL_0882: Expected O, but got Unknown
		//IL_088d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0897: Expected O, but got Unknown
		//IL_08d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08df: Expected O, but got Unknown
		//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ff: Expected O, but got Unknown
		//IL_0918: Unknown result type (might be due to invalid IL or missing references)
		//IL_091f: Expected O, but got Unknown
		//IL_0939: Unknown result type (might be due to invalid IL or missing references)
		//IL_0940: Expected O, but got Unknown
		//IL_095a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0961: Expected O, but got Unknown
		//IL_097a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0981: Expected O, but got Unknown
		//IL_099b: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a2: Expected O, but got Unknown
		//IL_09bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c3: Expected O, but got Unknown
		//IL_09dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e4: Expected O, but got Unknown
		//IL_09fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a05: Expected O, but got Unknown
		//IL_0a1f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a26: Expected O, but got Unknown
		//IL_0a40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a47: Expected O, but got Unknown
		//IL_0a61: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a68: Expected O, but got Unknown
		//IL_0a82: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a89: Expected O, but got Unknown
		//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aaa: Expected O, but got Unknown
		//IL_0ac4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0acb: 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("BlackMetal", 200, 0);
		val2.AddRequirement("YggdrasilWood", 500, 0);
		val2.AddRequirement("Eitr", 100, 0);
		val2.AddRequirement("DragonTear", 50, 0);
		val2.CraftingStation = "blackforge";
		val2.RepairStation = "blackforge";
		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("YggdrasilWood", 500, 0);
		val3.AddRequirement("YagluthDrop", 15, 0);
		val3.AddRequirement("Thunderstone", 200, 0);
		val3.CraftingStation = "blackforge";
		val3.RepairStation = "blackforge";
		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.AddRequirement(new RequirementConfig("DragonReactorCore", 5, 0, true));
		val4.CraftingStation = "blackforge";
		val4.MinStationLevel = 3;
		val4.RepairStation = "blackforge";
		val4.Name = "$item_sword_excs";
		val4.Description = "$item_sword_excs_desc";
		ItemConfig val5 = new ItemConfig();
		val5.Amount = 1;
		val5.AddRequirement(new RequirementConfig("THSwordExc", 1, 0, true));
		val5.AddRequirement(new RequirementConfig("THSwordExm", 1, 0, true));
		val5.AddRequirement(new RequirementConfig("THSwordExcP", 1, 0, true));
		val5.AddRequirement(new RequirementConfig("DragonReactorCore", 5, 0, true));
		val5.CraftingStation = "blackforge";
		val5.MinStationLevel = 3;
		val5.RepairStation = "blackforge";
		val5.Name = "$item_excelsus";
		val5.Description = "$item_excelsus_desc";
		ItemConfig val6 = new ItemConfig();
		val6.Amount = 1;
		val6.AddRequirement("BlackMetal", 200, 0);
		val6.AddRequirement("YggdrasilWood", 500, 0);
		val6.AddRequirement("BlackMarble", 500, 0);
		val6.AddRequirement("Silver", 50, 0);
		val6.CraftingStation = "blackforge";
		val6.RepairStation = "blackforge";
		val6.Name = "$item_sword_excp";
		val6.Description = "$item_sword_excp_desc";
		ItemConfig val7 = new ItemConfig();
		val7.Amount = 1;
		val7.AddRequirement("TrophyGoblinBrute", 25, 0);
		val7.AddRequirement("TrophyBjorn", 25, 0);
		val7.AddRequirement("UndeadBjornRibcage", 100, 0);
		val7.AddRequirement(new RequirementConfig("DragonReactorCore", 3, 0, true));
		val7.CraftingStation = "blackforge";
		val7.MinStationLevel = 3;
		val7.RepairStation = "blackforge";
		val7.Name = "$item_sei";
		val7.Description = "$item_sei_desc";
		ItemConfig val8 = new ItemConfig();
		val8.Amount = 1;
		val8.AddRequirement("BlackMetal", 150, 0);
		val8.AddRequirement("BlackMarble", 150, 0);
		val8.AddRequirement("Bilebag", 50, 0);
		val8.AddRequirement("YmirRemains", 100, 0);
		val8.AddRequirement(new RequirementConfig("DragonReactorCore", 3, 0, true));
		val8.CraftingStation = "blackforge";
		val8.RepairStation = "blackforge";
		val8.Name = "$item_shield_wen";
		val8.Description = "$item_shield_wen_desc";
		ItemConfig val9 = new ItemConfig();
		val9.Amount = 1;
		val9.AddRequirement("Mandible", 10, 0);
		val9.AddRequirement("Eitr", 100, 0);
		val9.AddRequirement("Needle", 1000, 0);
		val9.AddRequirement(new RequirementConfig("DragonReactorCore", 2, 0, true));
		val9.CraftingStation = "blackforge";
		val9.RepairStation = "blackforge";
		val9.Name = "$item_knife_wensk";
		val9.Description = "$item_knife_wensk_desc";
		ItemConfig val10 = new ItemConfig();
		val10.Amount = 1;
		val10.AddRequirement("Wood", 10, 0);
		val10.AddRequirement("Stone", 10, 0);
		val10.AddRequirement("Flint", 10, 0);
		val10.CraftingStation = "piece_workbench";
		val10.RepairStation = "piece_workbench";
		val10.Name = "$item_zam_meadow";
		val10.Description = "$item_zam_meadow_desc";
		ItemConfig val11 = new ItemConfig();
		val11.Amount = 1;
		val11.AddRequirement("Bronze", 10, 0);
		val11.AddRequirement("RoundLog", 10, 0);
		val11.AddRequirement("TrophyBjorn", 1, 0);
		val11.AddRequirement(new RequirementConfig("BattleaxeZam", 1, 0, true));
		val11.CraftingStation = "forge";
		val11.RepairStation = "forge";
		val11.Name = "$item_zam_bf";
		val11.Description = "$item_zam_bf_desc";
		ItemConfig val12 = new ItemConfig();
		val12.Amount = 1;
		val12.AddRequirement("ElderBark", 10, 0);
		val12.AddRequirement("Iron", 10, 0);
		val12.AddRequirement("TrophyAbomination", 1, 0);
		val12.AddRequirement(new RequirementConfig("BattleaxeZam1", 1, 0, true));
		val12.CraftingStation = "forge";
		val12.RepairStation = "forge";
		val12.Name = "$item_zam_swamp";
		val12.Description = "$item_zam_swamp_desc";
		ItemConfig val13 = new ItemConfig();
		val13.Amount = 1;
		val13.AddRequirement("Silver", 10, 0);
		val13.AddRequirement("Obsidian", 10, 0);
		val13.AddRequirement("OnionSeeds", 10, 0);
		val13.AddRequirement(new RequirementConfig("BattleaxeZam2", 1, 0, true));
		val13.CraftingStation = "forge";
		val13.RepairStation = "forge";
		val13.Name = "$item_zam_mountain";
		val13.Description = "$item_zam_mountain_desc";
		ItemConfig val14 = new ItemConfig();
		val14.Amount = 1;
		val14.AddRequirement("BlackMetal", 10, 0);
		val14.AddRequirement("Needle", 10, 0);
		val14.AddRequirement("Tar", 10, 0);
		val14.AddRequirement(new RequirementConfig("BattleaxeZam3", 1, 0, true));
		val14.CraftingStation = "forge";
		val14.RepairStation = "forge";
		val14.Name = "$item_zam_plain";
		val14.Description = "$item_zam_plain_desc";
		ItemConfig val15 = new ItemConfig();
		val15.Amount = 1;
		val15.AddRequirement("YggdrasilWood", 20, 0);
		val15.AddRequirement("BlackMarble", 20, 0);
		val15.AddRequirement("Mandible", 10, 0);
		val15.AddRequirement(new RequirementConfig("BattleaxeZam4", 1, 0, true));
		val15.CraftingStation = "blackforge";
		val15.RepairStation = "blackforge";
		val15.Name = "$item_zam_ML";
		val15.Description = "$item_zam_ML_desc";
		ItemConfig val16 = new ItemConfig();
		val16.Amount = 1;
		val16.AddRequirement("SurtlingCore", 10, 0);
		val16.AddRequirement("Thunderstone", 10, 0);
		val16.AddRequirement(new RequirementConfig("BattleaxeZam5", 1, 0, true));
		val16.AddRequirement(new RequirementConfig("DragonReactorCore", 1, 0, true));
		val16.CraftingStation = "blackforge";
		val16.RepairStation = "blackforge";
		val16.Name = "$item_zam_ashland";
		val16.Description = "$item_zam_ashland_desc";
		CustomItem val17 = new CustomItem(excaliburBundle, "THSwordExc", false, val2);
		ItemManager.Instance.AddItem(val17);
		CustomItem val18 = new CustomItem(excaliburBundle, "THSwordExm", false, val3);
		ItemManager.Instance.AddItem(val18);
		CustomItem val19 = new CustomItem(excaliburBundle, "THSwordExcS", false, val4);
		ItemManager.Instance.AddItem(val19);
		CustomItem val20 = new CustomItem(excaliburBundle, "ExcaliburExcelsus", false, val5);
		ItemManager.Instance.AddItem(val20);
		CustomItem val21 = new CustomItem(excaliburBundle, "THSwordExcP", false, val6);
		ItemManager.Instance.AddItem(val21);
		CustomItem val22 = new CustomItem(excaliburBundle, "DragonReactorCore", false, val);
		ItemManager.Instance.AddItem(val22);
		CustomItem val23 = new CustomItem(excaliburBundle, "WensKnife", false, val9);
		ItemManager.Instance.AddItem(val23);
		CustomItem val24 = new CustomItem(excaliburBundle, "WensShield", false, val8);
		ItemManager.Instance.AddItem(val24);
		CustomItem val25 = new CustomItem(excaliburBundle, "Hound", false, val7);
		ItemManager.Instance.AddItem(val25);
		CustomItem val26 = new CustomItem(excaliburBundle, "BattleaxeZam", false, val10);
		ItemManager.Instance.AddItem(val26);
		CustomItem val27 = new CustomItem(excaliburBundle, "BattleaxeZam1", false, val11);
		ItemManager.Instance.AddItem(val27);
		CustomItem val28 = new CustomItem(excaliburBundle, "BattleaxeZam2", false, val12);
		ItemManager.Instance.AddItem(val28);
		CustomItem val29 = new CustomItem(excaliburBundle, "BattleaxeZam3", false, val13);
		ItemManager.Instance.AddItem(val29);
		CustomItem val30 = new CustomItem(excaliburBundle, "BattleaxeZam4", false, val14);
		ItemManager.Instance.AddItem(val30);
		CustomItem val31 = new CustomItem(excaliburBundle, "BattleaxeZam5", false, val15);
		ItemManager.Instance.AddItem(val31);
		CustomItem val32 = new CustomItem(excaliburBundle, "BattleaxeZam6", false, val16);
		ItemManager.Instance.AddItem(val32);
		PrefabManager.OnVanillaPrefabsAvailable -= CreateExcaliburs;
	}

	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_sword_excs", "Excalibur Excelsus" },
			{ "item_sword_excs_desc", "Sheathed in the breath of the planet. A shining torrent of life. Victory is in our hands! Excalibur Excelsus!!" },
			{ "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", "The Hound" },
			{ "item_sei_desc", "It just place holder for now" },
			{ "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." }
		});
	}
}
[HarmonyPatch]
public static class SwapAnimatorPatch
{
	private static string lastWeapon = "";

	private static AnimatorOverrideController normalAOC;

	private static AnimatorOverrideController fastAOC;

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

	private static void Postfix(Player __instance)
	{
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: 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");
			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 val2 in animationClips)
			{
				list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val2, val2));
			}
			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 val3 in animationClips2)
			{
				if (((Object)val3).name == "Sledge-Attack1")
				{
					list2.Add(new KeyValuePair<AnimationClip, AnimationClip>(val3, val));
				}
				else
				{
					list2.Add(new KeyValuePair<AnimationClip, AnimationClip>(val3, val3));
				}
			}
			fastAOC.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list2);
		}
		if (name == "$item_excelsus")
		{
			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")
		{
			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)
		{
			return;
		}
		ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon();
		if (currentWeapon == null || currentWeapon.m_shared.m_name != "$item_excelsus")
		{
			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;
	}
}