Decompiled source of FireSteelSword v1.0.3

plugins/FireSteelSwordMod.dll

Decompiled 2 weeks ago
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 Jotunn.Entities;
using Jotunn.Managers;
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("FireSteelSwordMod")]
[assembly: AssemblyDescription("A blazing hot sword forged from fire and steel. Its flames burn through the living, leaving only ash behind...")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ObiWon12")]
[assembly: AssemblyProduct("FireSteelSwordMod")]
[assembly: AssemblyCopyright("Copyright © ObiWon12 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7e61f470-fb41-4c6b-a654-4e199ea7d009")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FireSteelSwordMod;

[BepInPlugin("com.proflupin.firesteelswordmod", "FireSteelSwordMod", "1.0.0")]
public class FireSteelSwordMod : BaseUnityPlugin
{
	public const string PluginGUID = "com.proflupin.firesteelswordmod";

	public const string PluginName = "FireSteelSwordMod";

	public const string PluginVersion = "1.0.0";

	private void Awake()
	{
		PrefabManager.OnVanillaPrefabsAvailable += AddCustomWeapon;
		LocalizationManager.OnLocalizationAdded += AddLocalization;
	}

	private void AddLocalization()
	{
		LocalizationManager.Instance.AddToken("item_sword_firesteel", "Firesteel Sword", false);
		LocalizationManager.Instance.AddToken("item_sword_firesteel_desc", "A blazing hot sword forged from fire and steel, capable of wreaking havoc as you wish...", false);
	}

	private void AddCustomWeapon()
	{
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Expected O, but got Unknown
		GameObject prefab = PrefabManager.Instance.GetPrefab("SwordIronFire");
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Could not find base prefab 'SwordIronFire'!");
			return;
		}
		GameObject val = Object.Instantiate<GameObject>(prefab);
		((Object)val).name = "SwordFiresteel";
		ItemDrop component = val.GetComponent<ItemDrop>();
		if ((Object)(object)component == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Cloned prefab does not contain ItemDrop component!");
			return;
		}
		component.m_itemData.m_shared.m_name = "$item_sword_firesteel";
		component.m_itemData.m_shared.m_description = "$item_sword_firesteel_desc";
		component.m_itemData.m_shared.m_damages.m_slash = 170f;
		component.m_itemData.m_shared.m_damages.m_fire = 90f;
		component.m_itemData.m_shared.m_weight = 3f;
		component.m_itemData.m_shared.m_attackForce = 200f;
		CustomItem val2 = new CustomItem(val, true);
		ItemManager.Instance.AddItem(val2);
		AddRecipe(val2.ItemDrop);
	}

	private void AddRecipe(ItemDrop item)
	{
		//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_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Expected O, but got Unknown
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Expected O, but got Unknown
		Recipe val = ScriptableObject.CreateInstance<Recipe>();
		((Object)val).name = "Recipe_SwordFiresteel";
		val.m_item = item;
		val.m_amount = 1;
		val.m_enabled = true;
		val.m_resources = (Requirement[])(object)new Requirement[3]
		{
			new Requirement
			{
				m_resItem = PrefabManager.Instance.GetPrefab("Iron").GetComponent<ItemDrop>(),
				m_amount = 25,
				m_recover = true
			},
			new Requirement
			{
				m_resItem = PrefabManager.Instance.GetPrefab("SurtlingCore").GetComponent<ItemDrop>(),
				m_amount = 5,
				m_recover = true
			},
			new Requirement
			{
				m_resItem = PrefabManager.Instance.GetPrefab("Wood").GetComponent<ItemDrop>(),
				m_amount = 8,
				m_recover = true
			}
		};
		val.m_craftingStation = PrefabManager.Instance.GetPrefab("forge").GetComponent<CraftingStation>();
		CustomRecipe val2 = new CustomRecipe(val, true, true);
		ItemManager.Instance.AddRecipe(val2);
	}
}