Decompiled source of WispHopper v4.2.0

WispStaff.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("WispStaff")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WispStaff")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c7f5ed5d-3d03-4322-b18f-5a202c6b6d5f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace WispStaff;

[BepInPlugin("TheRonTron.WispStaff", "WispStaff", "4.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class WispStaff : BaseUnityPlugin
{
	private AssetBundle WispStaffAB;

	public void Awake()
	{
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Expected O, but got Unknown
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Expected O, but got Unknown
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Expected O, but got Unknown
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Expected O, but got Unknown
		Logger.ShowDate = true;
		Game.isModded = true;
		Logger.LogInfo((object)("Embedded resources: " + string.Join(",", typeof(WispStaff).Assembly.GetManifestResourceNames())));
		WispStaffAB = AssetUtils.LoadAssetBundleFromResources("wispstaff", typeof(WispStaff).Assembly);
		GameObject WispStaffGO = WispStaffAB.LoadAsset<GameObject>("WispStaff");
		ItemConfig val = new ItemConfig();
		val.CraftingStation = "piece_magetable";
		val.AddRequirement(new RequirementConfig("YggdrasilWood", 20, 10, false));
		val.AddRequirement(new RequirementConfig("Wisp", 16, 8, false));
		val.AddRequirement(new RequirementConfig("Eitr", 16, 8, false));
		ItemManager.Instance.AddItem(new CustomItem(WispStaffGO, true, val));
		PrefabManager.OnPrefabsRegistered += delegate
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			ItemConfig val2 = new ItemConfig();
			CustomItem val3 = new CustomItem("WispLeapVFX", "vfx_sledge_iron_hit", val2);
			Transform componentInChildren = PrefabManager.Instance.GetPrefab("WispLeapVFX").GetComponentInChildren<Transform>();
			((Component)componentInChildren.GetChild(1)).gameObject.SetActive(false);
			((Component)componentInChildren.GetChild(2)).gameObject.SetActive(false);
			((Component)componentInChildren.GetChild(3)).gameObject.SetActive(false);
			((Component)componentInChildren.GetChild(4)).gameObject.SetActive(false);
			WispStaffGO.GetComponent<ItemDrop>().m_itemData.m_shared.m_attack.m_triggerEffect.m_effectPrefabs.ElementAt(1).m_prefab = PrefabManager.Instance.GetPrefab("WispLeapVFX");
			PrefabManager.Instance.GetPrefab("Wisp").GetComponent<ItemDrop>().m_itemData.m_shared.m_itemType = (ItemType)9;
			PrefabManager.Instance.GetPrefab("Wisp").GetComponent<ItemDrop>().m_itemData.m_shared.m_maxStackSize = 100;
			PrefabManager.Instance.GetPrefab("Wisp").GetComponent<ItemDrop>().m_itemData.m_shared.m_weight = 0.1f;
			PrefabManager.Instance.GetPrefab("Wisp").GetComponent<ItemDrop>().m_itemData.m_shared.m_ammoType = "$item_wisp";
			PrefabManager.Instance.GetPrefab("Wisp").GetComponent<ItemDrop>().m_itemData.m_shared.m_equipDuration = 0f;
		};
		WispStaffAB.Unload(false);
	}
}