Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EnhancedTooltip v4.0.0
EnhancedTooltip.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using EnhancedTooltip.Patches; using EpicLoot.Crafting; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace EnhancedTooltip { [BepInPlugin("com.rizumi.enhancedtooltip", "EnhancedTooltip", "4.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("valheim.exe")] public class EnhancedTooltipPlugin : BaseUnityPlugin { public const string PluginGUID = "com.rizumi.enhancedtooltip"; public const string PluginName = "EnhancedTooltip"; public const string PluginVersion = "4.0.0"; private Harmony _harmony; private ConfigEntry<bool> _disableEpicLootSetReplacement; public static ConfigEntry<bool> EnableDialogLogging; private void Awake() { _disableEpicLootSetReplacement = ((BaseUnityPlugin)this).Config.Bind<bool>("EnhancedTooltip", "DisableEpicLootSetReplacement", true, "Отключает замену ванильного Item.set на кастомный от EpicLoot. True - EpicLoot НЕ заменяет сет бонус, False - работает как обычно."); _disableEpicLootSetReplacement.SettingChanged += OnConfigChanged; EnableDialogLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDialogLogging", false, "Enable logging of CraftSuccessDialog state in enchanting table."); ApplyPatches(); Debug.Log((object)string.Format("[{0}] Plugin loaded. DisableEpicLootSetReplacement = {1}", "EnhancedTooltip", _disableEpicLootSetReplacement.Value)); } private void OnConfigChanged(object sender, EventArgs e) { if (sender is ConfigEntry<bool> val && ((ConfigEntryBase)val).Definition.Key == "DisableEpicLootSetReplacement") { Debug.Log((object)string.Format("[{0}] Config changed: DisableEpicLootSetReplacement = {1}", "EnhancedTooltip", val.Value)); } } private void ApplyPatches() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown try { _harmony = new Harmony("com.rizumi.enhancedtooltip"); _harmony.PatchAll(); EpicLootDisableSetPatch.Toggle(_disableEpicLootSetReplacement.Value); if (_disableEpicLootSetReplacement.Value) { EpicLootDisableSetPatch.Apply(_harmony); } Debug.Log((object)"[EnhancedTooltip] Harmony patches applied successfully."); } catch (Exception ex) { Debug.LogError((object)("[EnhancedTooltip] Failed to apply Harmony patches: " + ex.Message + "\n" + ex.StackTrace)); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(CraftSuccessDialog), "Show")] public static class CraftSuccessDialogFixPatch { [HarmonyPostfix] public static void Postfix(CraftSuccessDialog __instance) { if ((Object)(object)__instance == (Object)null) { return; } try { bool flag = false; if ((Object)(object)__instance.Icon != (Object)null && !((Behaviour)__instance.Icon).enabled) { ((Behaviour)__instance.Icon).enabled = true; flag = true; } if ((Object)(object)__instance.Description != (Object)null && !((Behaviour)__instance.Description).enabled) { ((Behaviour)__instance.Description).enabled = true; flag = true; } if ((Object)(object)__instance.NameText != (Object)null && !((Behaviour)__instance.NameText).enabled) { ((Behaviour)__instance.NameText).enabled = true; flag = true; } if ((Object)(object)__instance.MagicBG != (Object)null && !((Behaviour)__instance.MagicBG).enabled) { ((Behaviour)__instance.MagicBG).enabled = true; flag = true; } if (EnhancedTooltipPlugin.EnableDialogLogging.Value) { string[] obj = new string[6] { "[EnhancedTooltip][CraftSuccessDialog] NameText='", null, null, null, null, null }; int num = 1; TMP_Text nameText = __instance.NameText; obj[num] = (((Object)(object)nameText != (Object)null) ? nameText.text : null) ?? "null"; obj[2] = "' "; int num2 = 3; string format = "DescLen={0} "; TMP_Text description = __instance.Description; int? num3 = ((!((Object)(object)description == (Object)null)) ? description.text?.Length : ((int?)null)); int? num4 = num3; obj[num2] = string.Format(format, num4.GetValueOrDefault()); int num5 = 4; string format2 = "IconEnabled={0} "; Image icon = __instance.Icon; obj[num5] = string.Format(format2, ((Object)(object)icon != (Object)null) ? new bool?(((Behaviour)icon).enabled) : ((bool?)null)); obj[5] = $"Fixed={flag}"; Debug.LogWarning((object)string.Concat(obj)); } } catch (Exception ex) { Debug.LogError((object)("[EnhancedTooltip] CraftSuccessDialog fix error: " + ex.Message)); } } } } namespace EnhancedTooltip.Patches { public static class EpicLootDisableSetPatch { private static bool _enabled = true; private static bool _unpatched = false; public static void Toggle(bool enabled) { _enabled = enabled; Debug.Log((object)$"[EnhancedTooltip] EpicLoot set replacement disabled: {_enabled}"); } public static void Apply(Harmony harmony) { if (!_enabled || _unpatched) { return; } try { MethodInfo method = typeof(ItemData).GetMethod("GetTooltip", BindingFlags.Static | BindingFlags.Public, null, new Type[5] { typeof(ItemData), typeof(int), typeof(bool), typeof(float), typeof(int) }, null); if (method == null) { Debug.LogError((object)"[EnhancedTooltip] Не найден ItemDrop.ItemData.GetTooltip!"); return; } harmony.Unpatch((MethodBase)method, (HarmonyPatchType)2, "randyknapp.mods.epicloot"); _unpatched = true; Debug.Log((object)"[EnhancedTooltip] EpicLoot.Postfix удалён. Игра сама генерирует Item.set для ванильных."); } catch (Exception ex) { Debug.LogError((object)("[EnhancedTooltip] Ошибка: " + ex.Message + "\n" + ex.StackTrace)); } } } }