Decompiled source of HexRunicArts v1.0.1

plugins/HexRunicArts.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using HexRunicArts.Assets;
using HexRunicArts.Core.Features;
using HexRunicArts.Core.GUI;
using HexRunicArts.Core.Services;
using HexRunicArts.Core.Services.RuneStone;
using HexRunicArts.Models;
using HexRunicArts.Services.Lore;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HexRunicArts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HexRunicArts")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3ef44f9b-3971-4170-a482-34e7f06de9f2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HexRunicArts
{
	[BepInPlugin("com.hex.runicarts", "HexRunicArts", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string PluginGuid = "com.hex.runicarts";

		private const string PluginName = "HexRunicArts";

		private const string PluginVersion = "1.0.1";

		private Harmony _harmonyInstance;

		internal static ConfigEntry<KeyboardShortcut> SplinterHotkey;

		internal static ConfigEntry<int> SplinterRadius;

		internal static ConfigEntry<bool> EnableSplinterEffect;

		internal static ConfigEntry<bool> EnableStumpDestroy;

		internal static ManualLogSource Log;

		internal static Plugin Instance;

		private void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			AssetBundleHelper.LoadAssetBundle();
			ItemManagerService.Init();
			SplinterHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Splinter", "SplinterHotkey", new KeyboardShortcut((KeyCode)102, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Hotkey to activate Splinter ability.");
			SplinterRadius = ((BaseUnityPlugin)this).Config.Bind<int>("Splinter", "SplinterRadius", 10, new ConfigDescription("Radius within which logs will be splintered. Measured in meters.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>()));
			EnableSplinterEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Splinter", "EnableSplinterEffect", true, "Enable or disable the visual effect when logs are splintered.");
			EnableStumpDestroy = ((BaseUnityPlugin)this).Config.Bind<bool>("Splinter", "EnableTreeTrunkDestroy", true, "Enable or disable the destruction of tree trunks.");
			RunicQuestTrackerGui.Init();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmonyInstance = new Harmony("com.hex.runicarts");
			_harmonyInstance.PatchAll(executingAssembly);
			Log.LogInfo((object)"HexRunicArts v1.0.1 loaded.");
		}

		private void OnDestroy()
		{
			Log.LogInfo((object)"HexRunicArts v1.0.1 unloaded.");
			RunicQuestTrackerGui.Destroy();
			Harmony harmonyInstance = _harmonyInstance;
			if (harmonyInstance != null)
			{
				harmonyInstance.UnpatchSelf();
			}
			_harmonyInstance = null;
			Instance = null;
			Log = null;
		}
	}
}
namespace HexRunicArts.Patches
{
	[HarmonyPatch]
	internal static class HeightmapLifecyclePatch
	{
		private static bool _placementValidated;

		internal static void Reset()
		{
			_placementValidated = false;
		}

		[HarmonyPatch(typeof(Heightmap), "Generate")]
		[HarmonyPostfix]
		private static void HeightmapGeneratePostfix(Heightmap __instance, bool __result)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0043: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (!__result || _placementValidated || !StartTempleService.IsInitialized)
			{
				return;
			}
			Vector3 position = ((Component)__instance).transform.position;
			Vector3 runeStonePosition = StartTempleService.RuneStonePosition;
			if (!(Mathf.Abs(position.x - runeStonePosition.x) > 64f) && !(Mathf.Abs(position.z - runeStonePosition.z) > 64f))
			{
				Vector3 validPosition;
				if (RuneStoneSpawnService.Exists(runeStonePosition))
				{
					_placementValidated = true;
				}
				else if (RuneStonePlacementService.TryGetValidPosition(runeStonePosition, out validPosition) && RuneStoneSpawnService.TrySpawn(validPosition))
				{
					_placementValidated = true;
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class PlayerPatch
	{
		private static Inventory _subscribedInventory;

		[HarmonyPatch(typeof(Player), "TakeInput")]
		[HarmonyPostfix]
		private static void TakeInputPostfix(Player __instance, bool __result)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (!__result || (Object)(object)__instance != (Object)(object)Player.m_localPlayer)
			{
				return;
			}
			KeyboardShortcut value = Plugin.SplinterHotkey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				if (LoreProgressionService.GetSplinteringProgress(__instance) != SplinteringProgressModel.Unlocked)
				{
					((Character)__instance).Message((MessageType)2, "Splintering has not been unlocked", 0, (Sprite)null, false);
				}
				else
				{
					TreeSplinterFeature.ActivateSplinterAbility(__instance);
				}
			}
		}

		[HarmonyPatch(typeof(Player), "OnSpawned", new Type[] { typeof(bool) })]
		[HarmonyPostfix]
		private static void OnSpawnedPostfix(Player __instance, bool spawnValkyrie)
		{
			if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				SubscribeToInventory(__instance);
				if (!spawnValkyrie)
				{
					RunicQuestTrackerGui.Show();
				}
			}
		}

		[HarmonyPatch(typeof(Player), "OnDestroy")]
		[HarmonyPrefix]
		private static void OnDestroyPrefix(Player __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				UnsubscribeFromInventory();
				RunicQuestTrackerGui.Hide();
			}
		}

		private static void SubscribeToInventory(Player player)
		{
			Inventory inventory = ((Humanoid)player).GetInventory();
			if (inventory != null && _subscribedInventory != inventory)
			{
				UnsubscribeFromInventory();
				_subscribedInventory = inventory;
				Inventory subscribedInventory = _subscribedInventory;
				subscribedInventory.m_onChanged = (Action)Delegate.Combine(subscribedInventory.m_onChanged, new Action(OnInventoryChanged));
			}
		}

		private static void UnsubscribeFromInventory()
		{
			if (_subscribedInventory != null)
			{
				Inventory subscribedInventory = _subscribedInventory;
				subscribedInventory.m_onChanged = (Action)Delegate.Remove(subscribedInventory.m_onChanged, new Action(OnInventoryChanged));
				_subscribedInventory = null;
			}
		}

		private static void OnInventoryChanged()
		{
			Player localPlayer = Player.m_localPlayer;
			if (!((Object)(object)localPlayer == (Object)null) && _subscribedInventory == ((Humanoid)localPlayer).GetInventory() && LoreProgressionService.GetSplinteringProgress(localPlayer) == SplinteringProgressModel.CollectingMaterials)
			{
				RunicQuestTrackerGui.UpdateQuest(localPlayer);
			}
		}
	}
	[HarmonyPatch(typeof(RuneStone), "Interact")]
	internal static class RuneStoneInteractionPatch
	{
		private const string RuneStoneIdentifierKey = "HexRunicArts_RuneStoneId";

		private const string RuneStoneIdentifier = "StartTempleRuneStone";

		[HarmonyPrefix]
		private static bool InteractPrefix(RuneStone __instance, Humanoid character, bool hold, ref bool __result)
		{
			ZNetView componentInParent = ((Component)__instance).GetComponentInParent<ZNetView>();
			if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsValid())
			{
				return true;
			}
			ZDO zDO = componentInParent.GetZDO();
			if (zDO == null || zDO.GetString("HexRunicArts_RuneStoneId", "") != "StartTempleRuneStone")
			{
				return true;
			}
			if (hold)
			{
				__result = false;
				return false;
			}
			Player val = (Player)(object)((character is Player) ? character : null);
			if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer)
			{
				__result = false;
				return false;
			}
			SplinteringProgressModel splinteringProgress = LoreProgressionService.GetSplinteringProgress(val);
			string text = "";
			switch (splinteringProgress)
			{
			case SplinteringProgressModel.NotStarted:
				LoreProgressionService.SetSplinteringProgress(val, SplinteringProgressModel.CollectingMaterials);
				text = LoreTextService.SplinteringIntroduction;
				break;
			case SplinteringProgressModel.CollectingMaterials:
				if (LoreObjectiveService.TryConsumeSplinteringMaterials(val))
				{
					LoreProgressionService.SetSplinteringProgress(val, SplinteringProgressModel.Unlocked);
					text = LoreTextService.SplinteringUnlocked;
				}
				else
				{
					text = LoreTextService.GetSplinteringCollectionText(val);
				}
				break;
			case SplinteringProgressModel.Unlocked:
				text = LoreTextService.SplinteringAlreadyUnlocked;
				break;
			}
			RunicQuestTrackerGui.UpdateQuest(val);
			TextViewer.instance.ShowText((Style)0, "The First Rune", text, true);
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(TreeLog), "Destroy")]
	internal static class TreeLogPatch
	{
		private const float SkillExperiencePerLog = 0.5f;

		[HarmonyPrefix]
		private static bool DestroyPrefix(TreeLog __instance, HitData hitData, bool cheatedTool)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if (hitData == null || hitData.m_variant != 12345)
			{
				return true;
			}
			SpawnDropService.SpawnDrops(__instance.m_dropWhenDestroyed, ((Component)__instance).transform.position, ((Component)__instance).transform, hitData, cheatedTool, __instance.m_spawnDistance);
			if ((Object)(object)__instance.m_subLogPrefab != (Object)null && __instance.m_subLogPoints != null)
			{
				TreeLog component = __instance.m_subLogPrefab.GetComponent<TreeLog>();
				if ((Object)(object)component != (Object)null)
				{
					Transform[] subLogPoints = __instance.m_subLogPoints;
					foreach (Transform val in subLogPoints)
					{
						if (!((Object)(object)val == (Object)null))
						{
							SpawnDropService.SpawnDrops(component.m_dropWhenDestroyed, val.position, val, hitData, cheatedTool, component.m_spawnDistance);
						}
					}
				}
			}
			ZNetScene.instance.Destroy(((Component)__instance).gameObject);
			return false;
		}
	}
	[HarmonyPatch(typeof(Valkyrie), "DropPlayer")]
	internal static class ValkyriePatch
	{
		[HarmonyPostfix]
		private static void DropPlayerPostfix()
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null))
			{
				RunicQuestTrackerGui.Show();
			}
		}
	}
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	internal static class ZNetScenePatch
	{
		[HarmonyPostfix]
		private static void Postfix(ZNetScene __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				TreeStumpService.Init(__instance);
				GameObject prefab = __instance.GetPrefab("Eikthyr");
				if ((Object)(object)prefab != (Object)null)
				{
					CreatureDropService.RegisterEikthyrDrops(prefab);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class ZoneSystemSpawnLifecyclePatch
	{
		[HarmonyPatch(typeof(ZoneSystem), "Load")]
		[HarmonyPostfix]
		private static void LoadPostfix()
		{
			StartTempleService.FindStartTemple();
		}
	}
}
namespace HexRunicArts.Models
{
	internal enum SplinteringProgressModel
	{
		NotStarted,
		CollectingMaterials,
		Unlocked
	}
}
namespace HexRunicArts.Services.Lore
{
	internal static class LoreObjectiveService
	{
		private static readonly Dictionary<string, int> SplinteringMaterials = new Dictionary<string, int> { { "$item_hexrunicarts_eikthyrheart", 1 } };

		internal static bool HasRequiredMaterials(Player player)
		{
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			Inventory inventory = ((Humanoid)player).GetInventory();
			foreach (KeyValuePair<string, int> splinteringMaterial in SplinteringMaterials)
			{
				if (inventory.CountItems(splinteringMaterial.Key, -1, false) < splinteringMaterial.Value)
				{
					return false;
				}
			}
			return true;
		}

		internal static Dictionary<string, (int Current, int Required)> GetSplinteringMaterialProgress(Player player)
		{
			Dictionary<string, (int, int)> dictionary = new Dictionary<string, (int, int)>();
			if ((Object)(object)player == (Object)null)
			{
				return dictionary;
			}
			Inventory inventory = ((Humanoid)player).GetInventory();
			foreach (KeyValuePair<string, int> splinteringMaterial in SplinteringMaterials)
			{
				int item = inventory.CountItems(splinteringMaterial.Key, -1, false);
				dictionary[splinteringMaterial.Key] = (item, splinteringMaterial.Value);
			}
			return dictionary;
		}

		internal static bool TryConsumeSplinteringMaterials(Player player)
		{
			if (!HasRequiredMaterials(player))
			{
				return false;
			}
			Inventory inventory = ((Humanoid)player).GetInventory();
			foreach (KeyValuePair<string, int> splinteringMaterial in SplinteringMaterials)
			{
				inventory.RemoveItem(splinteringMaterial.Key, splinteringMaterial.Value, -1, false);
			}
			return true;
		}
	}
	internal static class LoreProgressionService
	{
		private const string SplinteringProgressKey = "HexRunicArts_SplinteringProgress";

		internal static SplinteringProgressModel GetSplinteringProgress(Player player)
		{
			if ((Object)(object)player == (Object)null)
			{
				return SplinteringProgressModel.NotStarted;
			}
			if (!player.m_customData.TryGetValue("HexRunicArts_SplinteringProgress", out var value))
			{
				return SplinteringProgressModel.NotStarted;
			}
			if (int.TryParse(value, out var result) && Enum.IsDefined(typeof(SplinteringProgressModel), result))
			{
				return (SplinteringProgressModel)result;
			}
			return SplinteringProgressModel.NotStarted;
		}

		internal static void SetSplinteringProgress(Player player, SplinteringProgressModel progress)
		{
			if (!((Object)(object)player == (Object)null))
			{
				Dictionary<string, string> customData = player.m_customData;
				int num = (int)progress;
				customData["HexRunicArts_SplinteringProgress"] = num.ToString();
			}
		}

		internal static void ResetSplinteringProgress(Player player)
		{
			_ = (Object)(object)player == (Object)null;
		}
	}
	internal static class LoreTextService
	{
		internal static string SplinteringIntroduction => Localization.instance.Localize("$hexrunicarts_lore_splintering_introduction");

		internal static string SplinteringUnlocked => string.Format(Localization.instance.Localize("$hexrunicarts_lore_splintering_unlocked"), Plugin.SplinterHotkey.Value);

		internal static string SplinteringAlreadyUnlocked => string.Format(Localization.instance.Localize("$hexrunicarts_lore_splintering_already_unlocked"), Plugin.SplinterHotkey.Value);

		internal static string GetSplinteringCollectionText(Player player)
		{
			(int, int) tuple = LoreObjectiveService.GetSplinteringMaterialProgress(player)["$item_hexrunicarts_eikthyrheart"];
			string arg = Localization.instance.Localize("$item_hexrunicarts_eikthyrheart");
			return string.Format(Localization.instance.Localize("$hexrunicarts_lore_splintering_collection"), arg, tuple.Item1, tuple.Item2);
		}
	}
}
namespace HexRunicArts.Core.Services
{
	internal static class CreatureDropService
	{
		internal static void RegisterEikthyrDrops(GameObject eikthyrPrefab)
		{
			AddDrop(eikthyrPrefab, AssetBundleHelper.EikthyrHeart);
		}

		private static void AddDrop(GameObject creaturePrefab, GameObject itemPrefab)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			if ((Object)(object)creaturePrefab == (Object)null || (Object)(object)itemPrefab == (Object)null)
			{
				return;
			}
			CharacterDrop component = creaturePrefab.GetComponent<CharacterDrop>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			foreach (Drop drop in component.m_drops)
			{
				if ((Object)(object)drop.m_prefab == (Object)(object)itemPrefab)
				{
					return;
				}
			}
			component.m_drops.Add(new Drop
			{
				m_prefab = itemPrefab,
				m_amountMin = 1,
				m_amountMax = 1,
				m_chance = 1f,
				m_onePerPlayer = false,
				m_levelMultiplier = false,
				m_dontScale = true
			});
		}
	}
	internal static class ItemManagerService
	{
		internal static void Init()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			if (!((Object)(object)AssetBundleHelper.EikthyrHeart == (Object)null))
			{
				CustomItem val = new CustomItem(AssetBundleHelper.EikthyrHeart, true, new ItemConfig
				{
					Name = "$item_hexrunicarts_eikthyrheart",
					Description = "$item_hexrunicarts_eikthyrheart_desc"
				});
				ItemManager.Instance.AddItem(val);
			}
		}
	}
	internal static class SpawnDropService
	{
		internal static void SpawnDrops(DropTable dropTable, Vector3 origin, Transform direction, HitData hitData, bool cheatedTool, float spawnDistance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> dropList = dropTable.GetDropList();
			for (int i = 0; i < dropList.Count; i++)
			{
				Vector3 val = origin + direction.up * Random.Range(0f - spawnDistance, spawnDistance) + Vector3.up * 0.3f * (float)i;
				Quaternion val2 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f);
				GameObject val3 = dropList[i];
				ItemDrop component = val3.GetComponent<ItemDrop>();
				int num = 1;
				if ((Object)(object)component != (Object)null)
				{
					val3 = Game.instance.CheckDropConversion(hitData, component, val3, ref num);
				}
				for (int j = 0; j < num; j++)
				{
					ItemDrop.OnCreateNew(Object.Instantiate<GameObject>(val3, val, val2), cheatedTool);
				}
			}
		}
	}
	internal static class EffectService
	{
		private const string LightningPrefabName = "lightningAOE";

		internal static void Spawn(Vector3 position)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ZNetScene.instance == (Object)null)
			{
				return;
			}
			GameObject prefab = ZNetScene.instance.GetPrefab("lightningAOE");
			if ((Object)(object)prefab == (Object)null)
			{
				return;
			}
			Aoe[] componentsInChildren = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity).GetComponentsInChildren<Aoe>(true);
			foreach (Aoe val in componentsInChildren)
			{
				Collider[] components = ((Component)val).GetComponents<Collider>();
				foreach (Collider val2 in components)
				{
					if (val2.isTrigger)
					{
						val2.enabled = false;
					}
				}
				((Behaviour)val).enabled = false;
			}
		}
	}
	internal static class StartTempleService
	{
		private const float RuneStoneDistance = 15f;

		private static readonly FieldInfo PrefabField = AccessTools.Field(typeof(ZoneLocation), "m_prefab");

		internal static bool IsInitialized { get; private set; }

		internal static Vector3 TemplePosition { get; private set; }

		internal static Vector3 RuneStonePosition { get; private set; }

		internal static void Reset()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			IsInitialized = false;
			TemplePosition = Vector3.zero;
			RuneStonePosition = Vector3.zero;
		}

		internal static void FindStartTemple()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (IsInitialized || (Object)(object)ZoneSystem.instance == (Object)null || PrefabField == null || WorldGenerator.instance == null)
			{
				return;
			}
			foreach (LocationInstance location in ZoneSystem.instance.GetLocationList())
			{
				if (location.m_location != null)
				{
					object value = PrefabField.GetValue(location.m_location);
					if (value != null && value.ToString().StartsWith("StartTemple.prefab"))
					{
						TemplePosition = location.m_position;
						RuneStonePosition = TemplePosition + Vector3.forward * 15f;
						RuneStonePosition = new Vector3(RuneStonePosition.x, WorldGenerator.instance.GetHeight(RuneStonePosition), RuneStonePosition.z);
						IsInitialized = true;
						break;
					}
				}
			}
		}
	}
	internal static class TreeStumpService
	{
		private static readonly FieldInfo NamedPrefabsField = AccessTools.Field(typeof(ZNetScene), "m_namedPrefabs");

		internal static HashSet<int> StumpPrefabHashKeys { get; private set; } = new HashSet<int>();

		internal static void Init(ZNetScene __instance)
		{
			StumpPrefabHashKeys.Clear();
			if (NamedPrefabsField == null || !(NamedPrefabsField.GetValue(__instance) is Dictionary<int, GameObject> dictionary))
			{
				return;
			}
			foreach (GameObject value in dictionary.Values)
			{
				if (!((Object)(object)value == (Object)null))
				{
					TreeBase component = value.GetComponent<TreeBase>();
					if (!((Object)(object)component == (Object)null) && !((Object)(object)component.m_stubPrefab == (Object)null))
					{
						StumpPrefabHashKeys.Add(StringExtensionMethods.GetStableHashCode(((Object)component.m_stubPrefab).name));
					}
				}
			}
		}

		internal static int DestroyNearbyStumps(Player player, short toolTier)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			Vector3 position = ((Component)player).transform.position;
			Destructible[] array = Object.FindObjectsByType<Destructible>((FindObjectsSortMode)0);
			foreach (Destructible val in array)
			{
				ZNetView component = ((Component)val).GetComponent<ZNetView>();
				if ((Object)(object)component == (Object)null || !component.IsValid())
				{
					continue;
				}
				ZDO zDO = component.GetZDO();
				if (zDO == null || !StumpPrefabHashKeys.Contains(zDO.GetPrefab()))
				{
					continue;
				}
				Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>();
				foreach (Collider val2 in componentsInChildren)
				{
					if (!val2.enabled || val2.isTrigger)
					{
						continue;
					}
					Vector3 val3 = val2.ClosestPoint(position);
					if (!(Vector3.Distance(position, val3) >= (float)Plugin.SplinterRadius.Value))
					{
						if (toolTier >= val.m_minToolTier)
						{
							HitData val4 = new HitData();
							val4.m_damage.m_chop = 10000f;
							val4.m_toolTier = toolTier;
							val4.m_point = val3;
							val4.SetAttacker((Character)(object)player);
							val.Damage(val4);
							num++;
						}
						break;
					}
				}
			}
			return num;
		}
	}
}
namespace HexRunicArts.Core.Services.RuneStone
{
	internal static class RuneStonePlacementService
	{
		private const float SampleDistance = 2f;

		private const float MaximumHeightDifference = 1f;

		private const float ObstacleCheckRadius = 2f;

		private const float ObstacleCheckHeight = 3f;

		internal static bool TryGetValidPosition(Vector3 targetPosition, out Vector3 validPosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			validPosition = Vector3.zero;
			float num = default(float);
			if (!Heightmap.GetHeight(targetPosition, ref num))
			{
				return false;
			}
			Vector3 val = targetPosition + Vector3.forward * 2f;
			Vector3 val2 = targetPosition + Vector3.back * 2f;
			Vector3 val3 = targetPosition + Vector3.right * 2f;
			Vector3 val4 = targetPosition + Vector3.left * 2f;
			float num2 = default(float);
			float num3 = default(float);
			float num4 = default(float);
			float num5 = default(float);
			if (!Heightmap.GetHeight(val, ref num2) || !Heightmap.GetHeight(val2, ref num3) || !Heightmap.GetHeight(val3, ref num4) || !Heightmap.GetHeight(val4, ref num5))
			{
				return false;
			}
			float num6 = Mathf.Min(new float[5] { num, num2, num3, num4, num5 });
			if (Mathf.Max(new float[5] { num, num2, num3, num4, num5 }) - num6 > 1f)
			{
				return false;
			}
			Collider[] array = Physics.OverlapBox(new Vector3(targetPosition.x, num + 1.5f, targetPosition.z), new Vector3(2f, 1.5f, 2f), Quaternion.identity, -5, (QueryTriggerInteraction)1);
			for (int i = 0; i < array.Length; i++)
			{
				if (!((Object)(object)((Component)array[i]).GetComponentInParent<Heightmap>() != (Object)null))
				{
					return false;
				}
			}
			validPosition = new Vector3(targetPosition.x, num, targetPosition.z);
			return true;
		}
	}
	internal static class RuneStoneSpawnService
	{
		private const string LocationName = "Runestone_Meadows";

		private const float DuplicateDistance = 5f;

		private const string RuneStoneIdentifierKey = "HexRunicArts_RuneStoneId";

		private const string RuneStoneIdentifier = "StartTempleRuneStone";

		private static readonly FieldInfo LocationProxyPrefabField = AccessTools.Field(typeof(ZoneSystem), "m_locationProxyPrefab");

		private static readonly MethodInfo GetLocationMethod = AccessTools.Method(typeof(ZoneSystem), "GetLocation", new Type[1] { typeof(int) }, (Type[])null);

		internal static bool TrySpawn(Vector3 position)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ZoneSystem.instance == (Object)null || ZDOMan.instance == null || (Object)(object)ZNet.instance == (Object)null || LocationProxyPrefabField == null || GetLocationMethod == null)
			{
				return false;
			}
			if (!ZNet.instance.IsServer())
			{
				return false;
			}
			object? value = LocationProxyPrefabField.GetValue(ZoneSystem.instance);
			GameObject val = (GameObject)((value is GameObject) ? value : null);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			int stableHashCode = StringExtensionMethods.GetStableHashCode("Runestone_Meadows");
			if ((int)(ZoneLocation)GetLocationMethod.Invoke(ZoneSystem.instance, new object[1] { stableHashCode }) == 0)
			{
				return false;
			}
			List<ZDO> list = new List<ZDO>();
			Vector2s zone = ZoneSystem.GetZone(position);
			ZDOMan.instance.FindSectorObjects(zone, new SimulationDistance(1, 0, false), list, (List<ZDO>)null);
			int stableHashCode2 = StringExtensionMethods.GetStableHashCode(((Object)val).name);
			foreach (ZDO item in list)
			{
				if (item.GetPrefab() != stableHashCode2 || item.GetInt(ZDOVars.s_location, 0) != stableHashCode || Vector3.Distance(item.GetPosition(), position) > 5f)
				{
					continue;
				}
				string text = item.GetString("HexRunicArts_RuneStoneId", "");
				if (string.IsNullOrEmpty(text))
				{
					item.Set("HexRunicArts_RuneStoneId", "StartTempleRuneStone");
				}
				else
				{
					if (text != "StartTempleRuneStone")
					{
						return false;
					}
					Plugin.Log.LogInfo((object)$"RuneStone | Existing proxy found | ID: {text} | Position: {item.GetPosition()}");
				}
				return true;
			}
			ZDO obj = ZDOMan.instance.CreateNewZDO(position, stableHashCode2);
			obj.Persistent = true;
			obj.Type = (ObjectType)2;
			obj.Distant = false;
			obj.SetPrefab(stableHashCode2);
			obj.SetRotation(Quaternion.identity);
			obj.Set(ZDOVars.s_location, stableHashCode, false);
			obj.Set(ZDOVars.s_seed, 0, false);
			obj.Set("HexRunicArts_RuneStoneId", "StartTempleRuneStone");
			return true;
		}

		internal static bool Exists(Vector3 position)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ZoneSystem.instance == (Object)null || ZDOMan.instance == null || LocationProxyPrefabField == null)
			{
				return false;
			}
			object? value = LocationProxyPrefabField.GetValue(ZoneSystem.instance);
			GameObject val = (GameObject)((value is GameObject) ? value : null);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			List<ZDO> list = new List<ZDO>();
			Vector2s zone = ZoneSystem.GetZone(position);
			ZDOMan.instance.FindSectorObjects(zone, new SimulationDistance(1, 0, false), list, (List<ZDO>)null);
			int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)val).name);
			int stableHashCode2 = StringExtensionMethods.GetStableHashCode("Runestone_Meadows");
			foreach (ZDO item in list)
			{
				if (item.GetPrefab() == stableHashCode && item.GetInt(ZDOVars.s_location, 0) == stableHashCode2 && !(Vector3.Distance(item.GetPosition(), position) > 5f) && !(item.GetString("HexRunicArts_RuneStoneId", "") != "StartTempleRuneStone"))
				{
					return true;
				}
			}
			return false;
		}
	}
}
namespace HexRunicArts.Core.GUI
{
	internal static class RunicQuestTrackerGui
	{
		private static GameObject _panel;

		private static Text _objectiveText;

		private static Button _collapseButton;

		private static bool _collapsed;

		private const float ExpandedHeight = 140f;

		private const float CollapsedHeight = 48f;

		internal static void Init()
		{
			if (!GUIManager.IsHeadless())
			{
				GUIManager.OnCustomGUIAvailable += CreatePanel;
			}
		}

		internal static void Destroy()
		{
			GUIManager.OnCustomGUIAvailable -= CreatePanel;
			if ((Object)(object)_panel != (Object)null)
			{
				Object.Destroy((Object)(object)_panel);
			}
			_panel = null;
			_objectiveText = null;
			_collapseButton = null;
		}

		internal static void UpdateQuest(Player player)
		{
			if (!((Object)(object)player == (Object)null) && !((Object)(object)_panel == (Object)null) && !((Object)(object)_objectiveText == (Object)null))
			{
				switch (LoreProgressionService.GetSplinteringProgress(player))
				{
				case SplinteringProgressModel.NotStarted:
					_objectiveText.text = Localization.instance.Localize("$hexrunicarts_quest_not_started");
					_panel.SetActive(true);
					break;
				case SplinteringProgressModel.CollectingMaterials:
				{
					(int, int) tuple = LoreObjectiveService.GetSplinteringMaterialProgress(player)["$item_hexrunicarts_eikthyrheart"];
					string text = Localization.instance.Localize("$hexrunicarts_quest_retrieve_heart");
					string format = Localization.instance.Localize("$hexrunicarts_quest_heart_progress");
					string text2 = Localization.instance.Localize("$hexrunicarts_quest_return_runestone");
					_objectiveText.text = text + "\n" + string.Format(format, tuple.Item1, tuple.Item2) + "\n" + text2;
					_panel.SetActive(true);
					break;
				}
				case SplinteringProgressModel.Unlocked:
					Hide();
					break;
				}
			}
		}

		internal static void Show()
		{
			if (!((Object)(object)_panel == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null))
			{
				UpdateQuest(Player.m_localPlayer);
			}
		}

		internal static void Hide()
		{
			if ((Object)(object)_panel != (Object)null)
			{
				_panel.SetActive(false);
			}
		}

		private static void CreatePanel()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			if (GUIManager.Instance != null && !((Object)(object)GUIManager.CustomGUIFront == (Object)null) && (!((Object)(object)_panel != (Object)null) || !((Object)(object)_panel.transform.parent == (Object)(object)GUIManager.CustomGUIFront.transform)))
			{
				if ((Object)(object)_panel != (Object)null)
				{
					Object.Destroy((Object)(object)_panel);
				}
				_panel = null;
				_objectiveText = null;
				_collapseButton = null;
				_panel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-150f, -380f), 280f, 140f, true);
				((Object)_panel).name = "HexRunicArts_QuestTracker";
				GUIManager.Instance.CreateText(Localization.instance.Localize("$hexrunicarts_quest_title"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -20f), GUIManager.Instance.AveriaSerifBold, 14, GUIManager.Instance.ValheimOrange, true, Color.black, 250f, 75f, false).GetComponent<Text>().alignment = (TextAnchor)4;
				_collapseButton = GUIManager.Instance.CreateButton("-", _panel.transform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-24f, -24f), 28f, 28f).GetComponent<Button>();
				((UnityEvent)_collapseButton.onClick).AddListener(new UnityAction(ToggleCollapsed));
				GameObject obj = GUIManager.Instance.CreateText(Localization.instance.Localize("$hexrunicarts_quest_not_started"), _panel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -10f), GUIManager.Instance.AveriaSerif, 14, Color.white, true, Color.black, 290f, 85f, false);
				obj.GetComponent<Text>().alignment = (TextAnchor)4;
				_objectiveText = obj.GetComponent<Text>();
				_panel.SetActive(false);
				if (_collapsed)
				{
					_collapsed = false;
					ToggleCollapsed();
				}
				if ((Object)(object)Player.m_localPlayer != (Object)null)
				{
					UpdateQuest(Player.m_localPlayer);
				}
			}
		}

		private static void ToggleCollapsed()
		{
			if (!((Object)(object)_panel == (Object)null) && !((Object)(object)_objectiveText == (Object)null) && !((Object)(object)_collapseButton == (Object)null))
			{
				_collapsed = !_collapsed;
				_panel.GetComponent<RectTransform>().SetSizeWithCurrentAnchors((Axis)1, _collapsed ? 48f : 140f);
				((Component)_objectiveText).gameObject.SetActive(!_collapsed);
				((Component)_collapseButton).GetComponentInChildren<Text>().text = (_collapsed ? "+" : "-");
			}
		}
	}
}
namespace HexRunicArts.Core.Features
{
	internal static class TreeSplinterFeature
	{
		private static readonly MethodInfo GetRightItemMethod = AccessTools.Method(typeof(Humanoid), "GetRightItem", (Type[])null, (Type[])null);

		internal static void ActivateSplinterAbility(Player player)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			object? obj = GetRightItemMethod?.Invoke(player, null);
			ItemData val = (ItemData)((obj is ItemData) ? obj : null);
			if (val == null || (int)val.m_shared.m_skillType != 7 || val.m_shared.m_damages.m_chop <= 0f)
			{
				((Character)player).Message((MessageType)2, Localization.instance.Localize("$hexrunicarts_splinter_equip_axe"), 0, (Sprite)null, false);
				return;
			}
			short num = (short)val.m_shared.m_toolTier;
			Vector3 position = ((Component)player).transform.position;
			int num2 = 0;
			bool flag = false;
			TreeLog[] array = Object.FindObjectsByType<TreeLog>((FindObjectsSortMode)0);
			foreach (TreeLog val2 in array)
			{
				Collider[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Collider>();
				foreach (Collider val3 in componentsInChildren)
				{
					if (!val3.enabled || val3.isTrigger)
					{
						continue;
					}
					Vector3 val4 = val3.ClosestPoint(position);
					if (!(Vector3.Distance(position, val4) >= (float)Plugin.SplinterRadius.Value))
					{
						if (num < val2.m_minToolTier)
						{
							flag = true;
							break;
						}
						HitData val5 = new HitData();
						val5.m_variant = 12345;
						val5.m_damage.m_chop = 10000f;
						val5.m_toolTier = num;
						val5.m_point = val4;
						val5.SetAttacker((Character)(object)player);
						val2.Damage(val5);
						((Character)player).RaiseSkill((SkillType)13, 0.5f);
						num2++;
						break;
					}
				}
			}
			if (Plugin.EnableStumpDestroy.Value)
			{
				num2 += TreeStumpService.DestroyNearbyStumps(player, num);
			}
			if (flag)
			{
				((Character)player).Message((MessageType)2, Localization.instance.Localize("$hexrunicarts_splinter_weak_axe"), 0, (Sprite)null, false);
			}
			else if (num2 == 0)
			{
				((Character)player).Message((MessageType)2, Localization.instance.Localize("$hexrunicarts_splinter_no_logs"), 0, (Sprite)null, false);
			}
			if (num2 > 0 && Plugin.EnableSplinterEffect.Value)
			{
				EffectService.Spawn(position);
			}
		}
	}
}
namespace HexRunicArts.Core.Constants
{
	internal static class DamageIdentifiers
	{
		internal const short SplinteringDamageID = 12345;
	}
	internal static class ItemIdentifiers
	{
		internal const string EikthyrHeart = "$item_hexrunicarts_eikthyrheart";

		internal const string EikthyrHeartDescription = "$item_hexrunicarts_eikthyrheart_desc";
	}
}
namespace HexRunicArts.Assets
{
	internal static class AssetBundleHelper
	{
		private const string AssetBundleName = "hexrunicarts";

		private static AssetBundle HexRunicArtsAssetBundle;

		private const string HeartPrefabPath = "Assets/_CustomItems/HexRunicArts/EikthyrHeart.prefab";

		internal static GameObject EikthyrHeart;

		internal static void LoadAssetBundle()
		{
			HexRunicArtsAssetBundle = GetAssetBundleFromResources("hexrunicarts");
			if ((Object)(object)HexRunicArtsAssetBundle == (Object)null)
			{
				Plugin.Log.LogError((object)"AssetBundle | Failed to load: hexrunicarts");
				return;
			}
			EikthyrHeart = HexRunicArtsAssetBundle.LoadAsset<GameObject>("Assets/_CustomItems/HexRunicArts/EikthyrHeart.prefab");
			if ((Object)(object)EikthyrHeart == (Object)null)
			{
				Plugin.Log.LogError((object)"AssetBundle | Prefab not found: Assets/_CustomItems/HexRunicArts/EikthyrHeart.prefab");
			}
		}

		private static AssetBundle GetAssetBundleFromResources(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = executingAssembly.GetManifestResourceNames().SingleOrDefault((string name) => name.EndsWith(fileName));
			if (text == null)
			{
				Plugin.Log.LogError((object)("AssetBundle | Embedded resource not found: " + fileName));
				return null;
			}
			using Stream stream = executingAssembly.GetManifestResourceStream(text);
			if (stream == null)
			{
				Plugin.Log.LogError((object)("AssetBundle | Failed to open resource: " + text));
				return null;
			}
			return AssetBundle.LoadFromStream(stream);
		}
	}
}