Decompiled source of StonePick v1.0.2

plugins/StonePickMod.dll

Decompiled 5 days 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 = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StonePickMod;

[BepInPlugin("com.obiwon12.stonepickmod", "StonePickMod", "1.0.0")]
public class StonePickMod : BaseUnityPlugin
{
	public const string PluginGUID = "com.obiwon12.stonepickmod";

	public const string PluginName = "StonePickMod";

	public const string PluginVersion = "1.0.0";

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

	private void AddLocalization()
	{
		LocalizationManager.Instance.AddToken("item_pick_stone", "Stone Pick", false);
		LocalizationManager.Instance.AddToken("item_pick_stone_desc", "A crude and flimsy pick made of stone roughly bound to a stick.", false);
	}

	private void AddCustomWeapon()
	{
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Expected O, but got Unknown
		GameObject prefab = PrefabManager.Instance.GetPrefab("PickaxeStone");
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Could not find base prefab 'PickaxeStone'!");
			return;
		}
		GameObject val = Object.Instantiate<GameObject>(prefab);
		((Object)val).name = "PickStone";
		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_pick_stone";
		component.m_itemData.m_shared.m_description = "$item_pick_stone_desc";
		component.m_itemData.m_shared.m_damages.m_slash = 10f;
		component.m_itemData.m_shared.m_weight = 3f;
		component.m_itemData.m_shared.m_attackForce = 30f;
		component.m_itemData.m_shared.m_maxQuality = 4;
		component.m_itemData.m_shared.m_toolTier = 4;
		component.m_itemData.m_quality = 1;
		CustomItem val2 = new CustomItem(val, true);
		ItemManager.Instance.AddItem(val2);
		AddRecipe(val2.ItemDrop);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[StonePickMod] succesfully loaded.");
	}

	private void AddRecipe(ItemDrop item)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Expected O, but got Unknown
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: 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: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Expected O, but got Unknown
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		Recipe val = ScriptableObject.CreateInstance<Recipe>();
		((Object)val).name = "Recipe_PickStone";
		val.m_item = item;
		val.m_amount = 1;
		val.m_enabled = true;
		val.m_minStationLevel = 1;
		val.m_resources = (Requirement[])(object)new Requirement[2]
		{
			new Requirement
			{
				m_resItem = PrefabManager.Instance.GetPrefab("Wood").GetComponent<ItemDrop>(),
				m_amount = 10,
				m_recover = true
			},
			new Requirement
			{
				m_resItem = PrefabManager.Instance.GetPrefab("Stone").GetComponent<ItemDrop>(),
				m_amount = 10,
				m_recover = true
			}
		};
		val.m_craftingStation = PrefabManager.Instance.GetPrefab("WorkBench").GetComponent<CraftingStation>();
		CustomRecipe val2 = new CustomRecipe(val, true, true);
		ItemManager.Instance.AddRecipe(val2);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Recipe for 'PickStone' successfully added.");
	}
}