using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
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("erenshor-wiki-integration")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("erenshor-wiki-integration")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("75997405-995f-4221-8603-1441527ed8a7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace erenshor_wiki_integration
{
internal class Metadata
{
public const string MOD_GUID = "dpower.wiki";
public const string MOD_NAME = "Erenshor Quick Wiki";
public const string MOD_VERSION = "1.0.0";
public const string WIKI_BASE_URL = "https://erenshor.wiki.gg/wiki";
}
[BepInPlugin("dpower.wiki", "Erenshor Quick Wiki", "1.0.0")]
public class Mod : BaseUnityPlugin
{
public static Mod Instance;
private readonly Harmony harmony = new Harmony("dpower.wiki");
private ConfigEntry<KeyboardShortcut> _wikiHotkey;
private Item _currentItem;
public void Awake()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
harmony.PatchAll();
_wikiHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Hotkey", new KeyboardShortcut((KeyCode)96, Array.Empty<KeyCode>()), "Hotkey for opening up wiki of items in inventory");
}
public void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = _wikiHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
OpenWiki();
}
}
public void SetHoveredItem(Item Item)
{
_currentItem = Item;
}
public void ClearHoveredItem()
{
_currentItem = null;
}
private string CleanItemName(string ItemName)
{
return ItemName.Replace(' ', '_');
}
private void OpenWiki()
{
if ((Object)(object)_currentItem != (Object)null)
{
string text = CleanItemName(_currentItem.ItemName);
Application.OpenURL("https://erenshor.wiki.gg/wiki/" + text);
return;
}
Character currentTarget = GameData.PlayerControl.CurrentTarget;
if ((Object)(object)currentTarget != (Object)null && currentTarget.isNPC)
{
string text2 = CleanItemName(currentTarget.MyNPC.NPCName);
Application.OpenURL("https://erenshor.wiki.gg/wiki/" + text2);
}
}
}
}
namespace erenshor_wiki_integration.Patches
{
[HarmonyPatch(typeof(SimItemDisplay))]
[HarmonyPatch("OnPointerEnter")]
internal class SimItemDispaly_OnPointerEnter
{
private static void Prefix(SimItemDisplay __instance)
{
Mod.Instance.SetHoveredItem(__instance.MyItem);
}
}
[HarmonyPatch(typeof(SimItemDisplay))]
[HarmonyPatch("OnPointerExit")]
internal class SimItemDisplay_OnPointerExit
{
private static void Prefix(SimItemDisplay __instance)
{
Mod.Instance.ClearHoveredItem();
}
}
[HarmonyPatch(typeof(ItemIcon))]
[HarmonyPatch("OnPointerEnter")]
internal class ItemIcon_OnPointerEnter
{
private static void Prefix(ItemIcon __instance)
{
Mod.Instance.SetHoveredItem(__instance.MyItem);
}
}
[HarmonyPatch(typeof(ItemIcon))]
[HarmonyPatch("OnPointerExit")]
internal class ItemIcon_OnPointerExit
{
private static void Prefix(ItemIcon __instance)
{
Mod.Instance.ClearHoveredItem();
}
}
}