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 DrakesRenameitAlpha v0.9.0
DrakesRenameitAlpha.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DrakeRenameit.API; using DrakeRenameit.Ext.UI; using DrakeRenameit.Patches; using DrakeRenameit.Permissions; using DrakeRenameit.UI; using HarmonyLib; using JetBrains.Annotations; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DrakeRenameit")] [assembly: AssemblyDescription("Manage your doors and chests better")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("DrakeMods")] [assembly: AssemblyProduct("DrakeRenameit")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5DF97E86-BF46-46C5-894F-6B2D80EA6645")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DrakeRenameit { public static class RenameitConfig { private const string SectionGeneral = "General"; private const string SectionUI = "UI-NotSynced"; private const string SectionExclusions = "Exclusions"; private const string SectionLimits = "Limits"; private const string SectionAdmin = "Admin"; private const string SectionUnlock = "UnlockCost"; private const string SectionCraftedBy = "CraftedBy"; private static ConfigSync configSync = new ConfigSync("DrakesRenameit") { DisplayName = "DrakesRenameit", CurrentVersion = "0.9.0", MinimumRequiredVersion = "0.9.0" }; private static ConfigEntry<bool> _lockToOwner; private static ConfigEntry<bool> _rewriteDescriptionsEnable; private static ConfigEntry<bool> _RenameEnable; private static ConfigEntry<bool> _nameClaimsOwner; private static ConfigEntry<bool> _allowAdminOverride; private static ConfigEntry<bool> _allowRenameResources; private static ConfigEntry<int> _nameCharLimit; private static ConfigEntry<int> _descCharLimit; private static ConfigEntry<int> _craftedByCharLimit; private static ConfigEntry<string> _vipList; private static ConfigEntry<string> _menuHintColor; private static ConfigEntry<string> _excludedNames; private static ConfigEntry<string> _excludedCategory; private static ConfigEntry<string> _renameAllowlist; private static ConfigEntry<bool> _vipOnlyOverride; private static ConfigEntry<bool> _showReason; private static ConfigEntry<bool> _separateStacks; private static ConfigEntry<bool> _separateStacksHardLock; private static ConfigEntry<bool> _craftedByLabelEnabled; private static ConfigEntry<bool> _craftedByLabelCustomizable; private static ConfigEntry<string> _craftedByAllowedLabels; private static ConfigEntry<string> _menuOpenModifier; private static ConfigEntry<bool> _unlockCostEnabled; private static ConfigEntry<string> _unlockCost; public static bool LockToOwner => _lockToOwner.Value; public static int DescCharLimit => _descCharLimit.Value; public static bool NameClaimsOwner => _nameClaimsOwner.Value; public static bool RewriteDescriptionsEnabled => _rewriteDescriptionsEnable.Value; public static bool RenameEnabled => _RenameEnable.Value; public static bool CraftedByLabelEnabled => _craftedByLabelEnabled.Value; public static bool CraftedByLabelCustomizable => _craftedByLabelCustomizable.Value; public static string CraftedByAllowedLabels => _craftedByAllowedLabels.Value; public static bool AllowRenameResources => _allowRenameResources.Value; public static bool AllowAdminOverride => _allowAdminOverride.Value; public static int NameCharLimit => _nameCharLimit.Value; public static int CraftedByCharLimit => _craftedByCharLimit.Value; public static string VipList => _vipList.Value; public static string MenuHintColor => _menuHintColor.Value; public static string ExcludedNames => _excludedNames.Value; public static string ExcludedCategory => _excludedCategory.Value; public static string RenameAllowlist => _renameAllowlist.Value; public static bool VipOnlyOverride => _vipOnlyOverride.Value; public static bool ShowReason => _showReason.Value; public static bool SeparateStacks => _separateStacks.Value; public static bool SeparateStacksHardLock => _separateStacksHardLock.Value; public static string MenuOpenModifier => _menuOpenModifier.Value; public static bool UnlockCostEnabled => _unlockCostEnabled.Value; public static string UnlockCost => _unlockCost.Value; public static bool MenuModifierIsShift => string.Equals(_menuOpenModifier.Value, "Shift", StringComparison.OrdinalIgnoreCase); public static List<string> GetCraftedByAllowedLabelsList() { string text = _craftedByAllowedLabels?.Value; if (string.IsNullOrWhiteSpace(text)) { return new List<string> { "Crafted By", "Belongs To", "Return to" }; } List<string> list = (from s in text.Split(new char[2] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim() into s where s.Length > 0 select s).ToList(); if (list.Count == 0) { return new List<string> { "Crafted By", "Belongs To", "Return to" }; } List<string> list2 = new List<string>(); foreach (string p in list) { if (!list2.Exists((string x) => string.Equals(x, p, StringComparison.Ordinal))) { list2.Add(p); } } return list2; } public static void Bind(ConfigFile config) { //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown _lockToOwner = config.BindSynced("General", "LockToOwner", defaultValue: true, "If true, only the crafter/owner can rename or edit description. Items with no crafter (raw resources, m_crafterID 0 and no crafter name) are not locked until someone claims them (NameClaimsOwner) or they are crafted."); _nameClaimsOwner = config.BindSynced("General", "NameClaimsOwner", defaultValue: true, "If true, renaming an unowned item assigns ownership to the renamer. Used in conjunction with LockToOwner, when you rename an unclaimed item, you will have laid claim to it."); _allowRenameResources = config.BindSynced("General", "AllowRenameResources", defaultValue: true, "If true, items with no crafter (picked-up / uncrafted stacks) can be renamed. This is NOT the same as ExcludedCategory Material: Material blocks by item type even for crafted items. If disabled, NameClaimsOwner cannot apply to those stacks."); _RenameEnable = config.BindSynced("General", "RenameEnabled", defaultValue: true, "If enabled, allows players to edit item names. Could be cycled to pre change some items in a world then block others from adding new ones."); _rewriteDescriptionsEnable = config.BindSynced("General", "RewriteDescriptionsEnabled", defaultValue: true, "If enabled, allows players to also edit descriptions of items. Could be turned off preplace items with descriptions."); _craftedByLabelEnabled = config.BindSynced("General", "CraftedByLabelEnabled", defaultValue: true, "If true, players may set a display-only override for the Crafted by line (real crafter id/name unchanged). Server-synced."); _showReason = config.BindSynced("General", "ShowReason", defaultValue: true, "If true, denied rename/description actions show specific reasons (ownership, exclusion, resources). If false, generic messages only. Server-synced so clients cannot override the server's disclosure policy."); _separateStacks = config.BindSynced("General", "SeparateStacks", defaultValue: true, "If true, stacks only combine when Drake custom name, description, and crafted-by display match (same identity). Renamed or customized stacks no longer absorb mismatched pickups automatically."); _separateStacksHardLock = config.BindSynced("General", "SeparateStacksHardLock", defaultValue: false, "Only applies when SeparateStacks is on. If true, mismatched stacks never merge — including manual drags. If false, auto pickup still will not combine mismatched stacks, but you can drag one stack onto another to merge immediately (no dialog; target stack keeps its custom name, description, and crafted-by display)."); _unlockCostEnabled = config.BindSynced("UnlockCost", "UnlockCostEnabled", defaultValue: false, "If true, each item stack must be unlocked once (pay UnlockCost from your inventory) before rename, description, or crafted-by edits apply. After unlock, edits are free for that stack. Invalid/empty UnlockCost is ignored (no gate). Elevated players (AdminOverride) skip the cost."); _unlockCost = config.BindSynced("UnlockCost", "UnlockCost", "Coins:5", "Comma or semicolon separated: PrefabName:amount (e.g. Coins:4, Coal:10) or $item_token:amount. Uses player inventory. Paid once per stack via the Unlock button in the action menu."); _nameCharLimit = config.BindSynced("Limits", "NameCharacterLimit", 50, "Defines the limit for max characters in rename, be sure to account for <color=> tag codes etc."); _craftedByCharLimit = config.BindSynced("Limits", "CraftedByCharLimit", 50, "Defines the limit for max characters in crafted by: edit, be sure to account for <color=> tag codes etc."); _craftedByLabelCustomizable = config.BindSynced("CraftedBy", "LabelCustomizable", defaultValue: true, "If true, players who can edit crafted-by may choose a tooltip line label from AllowedLabels. If false, the label picker is greyed out for normal players (shows the default line only) while admins/VIPs can still change it. Separate from CraftedByLabelEnabled in General."); _craftedByAllowedLabels = config.BindSynced("CraftedBy", "AllowedLabels", "Crafted By, Belongs To, Return to", "Comma- or semicolon-separated labels shown before the crafter name (e.g. “Belongs To: Name”). The first entry is the default (vanilla localized “crafted by” line is used on the tooltip when that option is selected)."); _descCharLimit = config.BindSynced("Limits", "DescriptionCharacterLimit", 1000, "Defines the limit for max characters description, be sure to account for <color=> tag codes etc."); _allowAdminOverride = config.BindSynced("Admin", "AllowAdminOverride", defaultValue: true, "If enabled anyone designated as admin or added to VIP list with api hook, will be able to edit names and descriptions regardless of ownership or enabled."); _vipList = config.BindSynced("Admin", "VipList", "", "Comma-separated player names or player IDs (same as API AddVIP). When AdminOverride is on, VIPs can bypass restrictions. If VipOnlyOverride is on, ONLY VIP/API users count as elevated (Valheim server admin is ignored for overrides)."); _vipOnlyOverride = config.BindSynced("Admin", "VipOnlyOverride", defaultValue: false, "If true (and AdminOverride is on), only VIP list / AddVIP API users are treated as elevated for bypassing rules—Valheim server admin is NOT. Useful for testing VIP behavior locally. If false, Valheim admin OR VIP is elevated."); _menuHintColor = config.BindSynced("UI-NotSynced", "MenuHintColor", "yellow", "Color for the 'Modifier + Right Click for options' inventory tooltip hint. Accepts Unity color names (yellow, green, red, white) or hex values (#fff or #ffffff).", sync: false); _menuOpenModifier = config.Bind<string>("UI-NotSynced", "MenuOpenModifier", "Shift", new ConfigDescription("Which key + right-click opens the Drake menu (Rename / Description / Crafted by): Shift or Ctrl. The other modifier + right-click uses vanilla behavior.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Shift", "Ctrl" }), Array.Empty<object>())); configSync.AddConfigEntry<string>(_menuOpenModifier).SynchronizedConfig = false; _excludedNames = config.BindSynced("Exclusions", "ExcludedNames", "", "Comma-separated entries: Jotunn item list Token column (m_shared.m_name, e.g. $item_axe_stone) OR Item column (spawn/prefab name, e.g. AxeStone, ShieldBronzeBuckler), OR localized display name (English Name column). List: https://valheim-modding.github.io/Jotunn/data/objects/item-list.html — Admins/VIP (when AdminOverride is on) ignore this. See also ExcludedCategory and RenameAllowlist."); _excludedCategory = config.BindSynced("Exclusions", "ExcludedCategory", "", "Comma-separated category tokens (non-elevated players). Examples: Swords,Armor,Material,Bows. Full lists of Skills.SkillType and ItemDrop.ItemData.ItemType names plus aliases are written to BepInEx/config/<this mod GUID>/ExcludedCategoryReference.txt on first run (or when the mod version changes). Does not bypass RenameEnabled when that is off. Elevated users ignore when AdminOverride is on."); _renameAllowlist = config.BindSynced("Exclusions", "RenameAllowlist", "", "Comma-separated entries: Jotunn Token ($item_...) or Item (spawn name) or English display name — same rules as ExcludedNames. When RenameEnabled / RewriteDescriptionsEnabled are ON, these items bypass ExcludedNames, ExcludedCategory, and the uncrafted (AllowRenameResources) rule. Does NOT bypass global RenameEnabled/RewriteDescriptionsEnabled when those are off (only elevated users can). Does not bypass LockToOwner ownership."); } private static ConfigEntry<T> BindSynced<T>(this ConfigFile config, string section, string key, T defaultValue, string description, bool sync = true) { ConfigEntry<T> val = config.Bind<T>(section, key, defaultValue, description); SyncedConfigEntry<T> syncedConfigEntry = configSync.AddConfigEntry<T>(val); syncedConfigEntry.SynchronizedConfig = sync; return val; } } internal static class RenameUnlockCost { private static ManualLogSource? _log; internal static void Init(ManualLogSource log) { _log = log; } internal static bool HasValidCostConfigured() { List<(string, int, string)> lines; string error; return TryBuildResolvedCost(out lines, out error); } internal static bool UnlockCostApplies() { return RenameitConfig.UnlockCostEnabled && HasValidCostConfigured(); } internal static bool CanPlayerAfford(Player? player) { if ((Object)(object)player == (Object)null) { return false; } if (!TryBuildResolvedCost(out List<(string, int, string)> lines, out string _)) { return true; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return false; } foreach (var (text, num, _) in lines) { if (inventory.CountItems(text, -1, true) < num) { return false; } } return true; } internal static bool TryConsumeUnlockCost(Player? player, out string errorMessage) { errorMessage = ""; if ((Object)(object)player == (Object)null) { errorMessage = "No local player."; return false; } if (!TryBuildResolvedCost(out List<(string, int, string)> lines, out string error)) { errorMessage = error ?? "Unlock cost is not configured."; return false; } if (lines.Count == 0) { errorMessage = "Unlock cost is empty."; return false; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { errorMessage = "No inventory."; return false; } foreach (var (text, num, _) in lines) { if (inventory.CountItems(text, -1, true) < num) { errorMessage = "Not enough items to unlock (see tooltip / config)."; return false; } } foreach (var (text2, num2, _) in lines) { inventory.RemoveItem(text2, num2, -1, true); } return true; } internal static string GetCostDisplayShort() { if (!TryBuildResolvedCost(out List<(string, int, string)> lines, out string _) || lines.Count == 0) { return ""; } List<string> list = new List<string>(); foreach (var item3 in lines) { string item = item3.Item1; int item2 = item3.Item2; string arg = item; if (Localization.instance != null) { arg = Localization.instance.Localize(item); } list.Add($"{item2}x {arg}"); } return string.Join(", ", list); } internal static List<(string LocalizedName, int Amount, string PrefabName)> GetCostDisplayEntries() { List<(string, int, string)> list = new List<(string, int, string)>(); if (!TryBuildResolvedCost(out List<(string, int, string)> lines, out string _) || lines.Count == 0) { return list; } foreach (var item5 in lines) { string item = item5.Item1; int item2 = item5.Item2; string item3 = item5.Item3; string item4 = item; if (Localization.instance != null) { item4 = Localization.instance.Localize(item); } list.Add((item4, item2, item3)); } return list; } internal static string GetItemTokenPublic(string prefabName) { return ResolveItemSharedName(prefabName); } internal static Sprite? GetItemIconSprite(string configPrefabName) { if (string.IsNullOrWhiteSpace(configPrefabName) || (Object)(object)ObjectDB.instance == (Object)null) { return null; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(configPrefabName); if ((Object)(object)itemPrefab == (Object)null) { return null; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); object result; if (component == null) { result = null; } else { ItemData itemData = component.m_itemData; result = ((itemData != null) ? itemData.GetIcon() : null); } return (Sprite?)result; } private static bool TryBuildResolvedCost(out List<(string SharedName, int Amount, string ConfigKey)> lines, out string? error) { lines = new List<(string, int, string)>(); error = null; string text = RenameitConfig.UnlockCost?.Trim() ?? ""; if (string.IsNullOrEmpty(text)) { error = "UnlockCost is empty."; return false; } string[] array = text.Split(new char[2] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; foreach (string text2 in array2) { string text3 = text2.Trim(); if (string.IsNullOrEmpty(text3)) { continue; } int num = text3.LastIndexOf(':'); if (num <= 0 || num >= text3.Length - 1) { ManualLogSource? log = _log; if (log != null) { log.LogWarning((object)("[UnlockCost] Ignoring invalid segment (need Name:Amount): \"" + text3 + "\"")); } continue; } string text4 = text3.Substring(0, num).Trim(); string s = text3.Substring(num + 1).Trim(); if (!int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) || result <= 0) { ManualLogSource? log2 = _log; if (log2 != null) { log2.LogWarning((object)("[UnlockCost] Ignoring invalid amount in: \"" + text3 + "\"")); } continue; } string text5 = ResolveItemSharedName(text4); if (string.IsNullOrEmpty(text5)) { ManualLogSource? log3 = _log; if (log3 != null) { log3.LogWarning((object)("[UnlockCost] Unknown item or token: \"" + text4 + "\"")); } } else { lines.Add((text5, result, text4)); } } if (lines.Count == 0) { error = "No valid UnlockCost entries (use Item prefab name or $item_ token, e.g. Coins:4)."; return false; } return true; } private static string ResolveItemSharedName(string tokenOrPrefab) { if (string.IsNullOrWhiteSpace(tokenOrPrefab)) { return ""; } if ((Object)(object)ObjectDB.instance == (Object)null) { return tokenOrPrefab.StartsWith("$", StringComparison.Ordinal) ? tokenOrPrefab : ""; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(tokenOrPrefab); if ((Object)(object)itemPrefab != (Object)null) { string text = itemPrefab.GetComponent<ItemDrop>()?.m_itemData?.m_shared?.m_name; if (!string.IsNullOrEmpty(text)) { return text; } } if (tokenOrPrefab.StartsWith("$", StringComparison.Ordinal)) { return tokenOrPrefab; } return ""; } } [BepInPlugin("com.DrakeMods.DrakesRenameit", "DrakesRenameit", "0.9.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class DrakeRenameit : BaseUnityPlugin { public const string CompanyName = "DrakeMods"; public const string ModName = "DrakesRenameit"; public const string Version = "0.9.0"; public const string GUID = "com.DrakeMods.DrakesRenameit"; public const string DrakeNewName = "Drake_Rename"; public const string DrakeNewDesc = "Drake_Rename_Desc"; public const string DrakeCraftedByDisplay = "Drake_CraftedByDisplay"; public const string DrakeCraftedByLineLabel = "Drake_CraftedByLineLabel"; public const string DrakeRenameUnlocked = "Drake_RenameUnlocked"; public const string TooltipUnlockCostLockedEmoji = "\ud83d\udd12"; public const string TooltipDrakeEditableEmoji = "\ud83d\udd8a\ufe0f"; private readonly Harmony harmony = new Harmony("drakesmod.DrakeRenameit"); private Texture2D TestTex; private Sprite TestSprite; public static ItemData? CurrentItem { get; set; } public static bool IsItemInLocalPlayerInventory(ItemData? item) { if (item == null || (Object)(object)Player.m_localPlayer == (Object)null) { return false; } Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); return inventory != null && inventory.ContainsItem(item); } private void Awake() { RenameitConfig.Bind(((BaseUnityPlugin)this).Config); ExcludedCategoryReferenceWriter.EnsureGenerated(); AddVip(); RenamePermissionManager.Init(((BaseUnityPlugin)this).Logger); RenameUnlockCost.Init(((BaseUnityPlugin)this).Logger); InventoryStackPatches.Apply(harmony, ((BaseUnityPlugin)this).Logger); ItemTooltipPatches.Apply(harmony, ((BaseUnityPlugin)this).Logger); harmony.PatchAll(); } private static void AddVip() { List<string> list = (from s in RenameitConfig.VipList.Split(new char[1] { ',' }) select s.Trim().ToLowerInvariant() into s where !string.IsNullOrEmpty(s) select s).ToList(); RenameitPermission.AddVIP(list); } public static string GetPropperName(ItemData? item) { return getPropperName(item, item.m_shared.m_name); } public static bool hasNewDesc(ItemData? item) { if (item.m_customData == null) { return false; } string value; return item.m_customData.TryGetValue("Drake_Rename_Desc", out value); } public static bool hasNewName(ItemData? item) { if (item == null || item.m_customData == null) { return false; } string value; return item.m_customData.TryGetValue("Drake_Rename", out value); } public static bool HasAnyDrakeRenameCustomization(ItemData? item) { if (item?.m_customData == null) { return false; } if (hasNewName(item)) { return true; } if (hasNewDesc(item)) { return true; } if (HasCraftedByDisplayOverride(item)) { return true; } return HasCraftedByLineLabelOverride(item); } private static bool ReadRenameUnlockedFlag(ItemData item) { if (!item.m_customData.TryGetValue("Drake_RenameUnlocked", out var value)) { return false; } return value == "1" || string.Equals(value, "true", StringComparison.OrdinalIgnoreCase); } public static bool IsRenameUnlocked(ItemData? item) { if (item?.m_customData == null) { return false; } bool flag = ReadRenameUnlockedFlag(item); if (RenameUnlockCost.UnlockCostApplies()) { if (!flag && HasAnyDrakeRenameCustomization(item)) { SetRenameUnlocked(item); return true; } return flag; } return flag; } internal static void SetRenameUnlocked(ItemData item) { if (item.m_customData == null) { item.m_customData = new Dictionary<string, string>(); } item.m_customData["Drake_RenameUnlocked"] = "1"; } public static bool WouldHaveAnyDrakeEditIfUnlockIgnored(ItemData? item) { if (item == null || (Object)(object)Player.m_localPlayer == (Object)null) { return false; } RenamePermissionManager.BeginIgnoreUnlockRequirement(); try { return CanChangeName(item) || CanChangeDesc(item) || CanChangeCraftedByLabel(item); } finally { RenamePermissionManager.EndIgnoreUnlockRequirement(); } } public static bool ShowUnlockButton(ItemData? item) { if (item == null || (Object)(object)Player.m_localPlayer == (Object)null) { return false; } if (!RenameUnlockCost.UnlockCostApplies()) { return false; } if (IsRenameUnlocked(item)) { return false; } if (RenameitPermission.IsElevatedForOverrides(Player.m_localPlayer)) { return false; } return WouldHaveAnyDrakeEditIfUnlockIgnored(item); } public static bool TryPayRenameUnlock(ItemData? item) { if (item == null || (Object)(object)Player.m_localPlayer == (Object)null) { return false; } if (!IsItemInLocalPlayerInventory(item)) { ((Character)Player.m_localPlayer).Message((MessageType)2, "That item is no longer in your inventory. Put it back, then unlock again.", 0, (Sprite)null); return false; } if (!RenameUnlockCost.UnlockCostApplies() || IsRenameUnlocked(item)) { return false; } if (!WouldHaveAnyDrakeEditIfUnlockIgnored(item)) { string menuBlockedReason = GetMenuBlockedReason(item); ((Character)Player.m_localPlayer).Message((MessageType)2, string.IsNullOrEmpty(menuBlockedReason) ? "This item cannot be edited." : menuBlockedReason, 0, (Sprite)null); return false; } if (!RenameUnlockCost.TryConsumeUnlockCost(Player.m_localPlayer, out string errorMessage)) { ((Character)Player.m_localPlayer).Message((MessageType)2, errorMessage, 0, (Sprite)null); return false; } SetRenameUnlocked(item); ((Character)Player.m_localPlayer).Message((MessageType)2, "Item unlocked for editing.", 0, (Sprite)null); return true; } public static bool HasCraftedByDisplayOverride(ItemData? item) { if (item?.m_customData == null) { return false; } string value; return item.m_customData.TryGetValue("Drake_CraftedByDisplay", out value) && !string.IsNullOrEmpty(value); } public static bool HasCraftedByLineLabelOverride(ItemData? item) { if (item?.m_customData == null) { return false; } string value; return item.m_customData.TryGetValue("Drake_CraftedByLineLabel", out value) && !string.IsNullOrEmpty(value); } public static bool CanResetAnyCustomization(ItemData? item) { if (item == null) { return false; } if (CanChangeName(item) && hasNewName(item)) { return true; } if (CanChangeDesc(item) && hasNewDesc(item)) { return true; } if (CanChangeCraftedByLabel(item) && (HasCraftedByDisplayOverride(item) || HasCraftedByLineLabelOverride(item))) { return true; } return false; } public static void ResetAllCustomizations(ItemData? item) { if (item == null) { return; } if (!IsItemInLocalPlayerInventory(item)) { Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "That item is no longer in your inventory.", 0, (Sprite)null); } return; } if (CanChangeName(item) && hasNewName(item)) { resetName(item); } if (CanChangeDesc(item) && hasNewDesc(item)) { resetDesc(item); } if (CanChangeCraftedByLabel(item) && (HasCraftedByDisplayOverride(item) || HasCraftedByLineLabelOverride(item)) && item.m_customData != null) { string craftedByDisplay = getCraftedByDisplay(item); item.m_customData.Remove("Drake_CraftedByDisplay"); item.m_customData.Remove("Drake_CraftedByLineLabel"); string newDisplay = item.m_crafterName ?? ""; RenameEvents.RaiseCraftedByDisplayChanged(Player.m_localPlayer, item, item.m_shared.m_name, craftedByDisplay, newDisplay); } } public static string resetName(ItemData? item) { if (item == null) { return ""; } item.m_customData.Remove("Drake_Rename"); return item.m_shared.m_name; } public static string resetDesc(ItemData? item) { if (item == null) { return ""; } item.m_customData.Remove("Drake_Rename_Desc"); return item.m_shared.m_name; } public static string getPropperName(ItemData? item) { return getPropperName(item, item.m_shared.m_name); } public static string getPropperName(ItemData? item, string defaultName) { if (item.m_customData == null) { item.m_customData = new Dictionary<string, string>(); } string value; return item.m_customData.TryGetValue("Drake_Rename", out value) ? value : defaultName; } public static string getPropperDesc(ItemData? item) { return getPropperDesc(item, item.m_shared.m_description); } public static string getPropperDesc(ItemData? item, string defaultDesc) { if (item.m_customData == null) { item.m_customData = new Dictionary<string, string>(); } string value; return item.m_customData.TryGetValue("Drake_Rename_Desc", out value) ? value : defaultDesc; } public static void OpenRename(ItemData? item) { if (!((Object)(object)InventoryGui.instance == (Object)null) && item != null) { CurrentItem = item; if ((Object)(object)UIPanels.InputNamePanel == (Object)null) { UIPanels.CreateRenameInput(); } string propperName = GetPropperName(item); UIPanels.RenameNameInput.text = propperName; UIPanels.InputNamePanel.SetActive(true); UIPanels.EnsureInputBlocked(); } } public static void OpenRewriteDesc(ItemData? item) { if (!((Object)(object)InventoryGui.instance == (Object)null) && item != null) { CurrentItem = item; if ((Object)(object)UIPanels.InputDescPanel == (Object)null) { UIPanels.CreateRenameDescInput(); } string propperDesc = getPropperDesc(item); UIPanels.RenameDescInput.text = propperDesc; UIPanels.InputDescPanel.SetActive(true); UIPanels.EnsureInputBlocked(); } } public static void RenameItem(string name) { if (CurrentItem == null) { return; } if (CurrentItem.m_customData == null) { CurrentItem.m_customData = new Dictionary<string, string>(); } if (string.IsNullOrEmpty(name)) { CurrentItem.m_customData.Remove("Drake_Rename"); } else { CurrentItem.m_customData["Drake_Rename"] = name; RenameEvents.RaiseNameChanged(Player.m_localPlayer, CurrentItem, CurrentItem.m_shared.m_name, name); } if (RenameitConfig.NameClaimsOwner && (RenameitConfig.AllowRenameResources || RenameExclusionRules.MatchesRenameAllowlist(CurrentItem)) && string.IsNullOrEmpty(CurrentItem.m_crafterName)) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { CurrentItem.m_crafterID = localPlayer.GetPlayerID(); CurrentItem.m_crafterName = localPlayer.GetPlayerName(); } } } public static void RewriteItemDesc(string name) { if (CurrentItem == null) { return; } if (CurrentItem.m_customData == null) { CurrentItem.m_customData = new Dictionary<string, string>(); } if (string.IsNullOrEmpty(name)) { CurrentItem.m_customData.Remove("Drake_Rename_Desc"); } else { CurrentItem.m_customData["Drake_Rename_Desc"] = name; RenameEvents.RaiseDescriptionChanged(Player.m_localPlayer, CurrentItem, CurrentItem.m_shared.m_name, name); } if (RenameitConfig.NameClaimsOwner && (RenameitConfig.AllowRenameResources || RenameExclusionRules.MatchesRenameAllowlist(CurrentItem)) && string.IsNullOrEmpty(CurrentItem.m_crafterName)) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { CurrentItem.m_crafterID = localPlayer.GetPlayerID(); CurrentItem.m_crafterName = localPlayer.GetPlayerName(); } } } public static void ApplyRewriteDesc(string newDesc) { if (CurrentItem == null) { return; } if (!IsItemInLocalPlayerInventory(CurrentItem)) { Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "That item is no longer in your inventory. Put it back, then try again.", 0, (Sprite)null); } UIPanels.CloseAllRenameEditingUi(); } else { RewriteItemDesc(newDesc); ItemData currentItem = CurrentItem; UIPanels.InputDescPanel.SetActive(false); UIPanels.OpenActionMenu(currentItem); } } public static void ApplyRename(string newName) { if (CurrentItem == null) { return; } if (!IsItemInLocalPlayerInventory(CurrentItem)) { Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "That item is no longer in your inventory. Put it back, then try again.", 0, (Sprite)null); } UIPanels.CloseAllRenameEditingUi(); } else { RenameItem(newName); ItemData currentItem = CurrentItem; UIPanels.InputNamePanel.SetActive(false); UIPanels.OpenActionMenu(currentItem); } } public static bool CanChangeName(ItemData? item, bool showError = false) { return RenamePermissionManager.Evaluate(RenamePermissionOperation.RenameItemName, item, Player.m_localPlayer, showError).Allowed; } public static bool CanChangeDesc(ItemData item, bool showError = false) { return RenamePermissionManager.Evaluate(RenamePermissionOperation.RewriteDescription, item, Player.m_localPlayer, showError).Allowed; } public static bool CanChangeCraftedByLabel(ItemData? item, bool showError = false) { if (item == null) { return false; } if (item.m_crafterID == 0L && string.IsNullOrEmpty(item.m_crafterName)) { return false; } return RenamePermissionManager.Evaluate(RenamePermissionOperation.EditCraftedByLabel, item, Player.m_localPlayer, showError).Allowed; } public static bool AnyInventoryActionAvailable(ItemData? item) { if (item == null || (Object)(object)Player.m_localPlayer == (Object)null) { return false; } if (!RenameUnlockCost.UnlockCostApplies() || IsRenameUnlocked(item)) { return CanChangeName(item) || CanChangeDesc(item) || CanChangeCraftedByLabel(item); } if (RenameitPermission.IsElevatedForOverrides(Player.m_localPlayer)) { return CanChangeName(item) || CanChangeDesc(item) || CanChangeCraftedByLabel(item); } return WouldHaveAnyDrakeEditIfUnlockIgnored(item); } public static bool IsMenuOpenModifierHeld() { return (!RenameitConfig.MenuModifierIsShift) ? (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) : (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)); } public static string GetMenuTooltipLockSuffix(ItemData? item) { if (item == null || (Object)(object)Player.m_localPlayer == (Object)null) { return ""; } if (!RenameUnlockCost.UnlockCostApplies()) { return ""; } if (RenameitPermission.IsElevatedForOverrides(Player.m_localPlayer)) { return " \ud83d\udd8a\ufe0f"; } return IsRenameUnlocked(item) ? " \ud83d\udd8a\ufe0f" : " \ud83d\udd12"; } public static string GetMenuBlockedReason(ItemData? item) { if (item == null || (Object)(object)Player.m_localPlayer == (Object)null) { return ""; } List<string> list = new List<string>(); RenamePermissionResult renamePermissionResult = RenamePermissionManager.TryGetDenial(RenamePermissionOperation.RenameItemName, item, Player.m_localPlayer); if (!renamePermissionResult.Allowed) { list.Add(RenamePermissionManager.FormatDenialForPlayer(RenamePermissionOperation.RenameItemName, renamePermissionResult.Reasons)); } RenamePermissionResult renamePermissionResult2 = RenamePermissionManager.TryGetDenial(RenamePermissionOperation.RewriteDescription, item, Player.m_localPlayer); if (!renamePermissionResult2.Allowed && (list.Count == 0 || renamePermissionResult2.Reasons != renamePermissionResult.Reasons)) { list.Add(RenamePermissionManager.FormatDenialForPlayer(RenamePermissionOperation.RewriteDescription, renamePermissionResult2.Reasons)); } RenamePermissionResult renamePermissionResult3 = RenamePermissionManager.TryGetDenial(RenamePermissionOperation.EditCraftedByLabel, item, Player.m_localPlayer); if (!renamePermissionResult3.Allowed && (list.Count == 0 || (renamePermissionResult3.Reasons != renamePermissionResult.Reasons && renamePermissionResult3.Reasons != renamePermissionResult2.Reasons))) { list.Add(RenamePermissionManager.FormatDenialForPlayer(RenamePermissionOperation.EditCraftedByLabel, renamePermissionResult3.Reasons)); } if (list.Count == 0) { return "This item cannot be edited."; } HashSet<string> hashSet = new HashSet<string>(); List<string> list2 = new List<string>(); foreach (string item2 in list) { if (hashSet.Add(item2)) { list2.Add(item2); } } return string.Join(" | ", list2); } public static string getCraftedByDisplay(ItemData? item) { if (item?.m_customData == null) { return item?.m_crafterName ?? ""; } if (item.m_customData.TryGetValue("Drake_CraftedByDisplay", out var value) && !string.IsNullOrEmpty(value)) { return value; } return item.m_crafterName ?? ""; } public static void OpenCraftedByEditor(ItemData? item) { if (!((Object)(object)InventoryGui.instance == (Object)null) && item != null) { CurrentItem = item; if ((Object)(object)UIPanels.InputCraftedByPanel == (Object)null) { UIPanels.CreateCraftedByInput(); } UIPanels.RenameCraftedByInput.text = getCraftedByDisplay(item); UIPanels.RefreshCraftedByLineLabelPicker(item); UIPanels.InputCraftedByPanel.SetActive(true); UIPanels.EnsureInputBlocked(); } } public static void ApplyCraftedByLabel(string display) { if (CurrentItem == null) { return; } if (!IsItemInLocalPlayerInventory(CurrentItem)) { Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "That item is no longer in your inventory. Put it back, then try again.", 0, (Sprite)null); } UIPanels.CloseAllRenameEditingUi(); return; } if (CurrentItem.m_customData == null) { CurrentItem.m_customData = new Dictionary<string, string>(); } string craftedByDisplay = getCraftedByDisplay(CurrentItem); if (string.IsNullOrEmpty(display)) { CurrentItem.m_customData.Remove("Drake_CraftedByDisplay"); } else { CurrentItem.m_customData["Drake_CraftedByDisplay"] = display; } if (RenameitConfig.CraftedByLabelCustomizable || RenameitPermission.IsElevatedForOverrides(Player.m_localPlayer)) { string craftedByLineLabelPendingToken = UIPanels.CraftedByLineLabelPendingToken; if (string.IsNullOrEmpty(craftedByLineLabelPendingToken)) { CurrentItem.m_customData.Remove("Drake_CraftedByLineLabel"); } else if (IsAllowedCustomCraftedByLineLabel(craftedByLineLabelPendingToken)) { CurrentItem.m_customData["Drake_CraftedByLineLabel"] = craftedByLineLabelPendingToken; } } string newDisplay = (string.IsNullOrEmpty(display) ? (CurrentItem.m_crafterName ?? "") : display); RenameEvents.RaiseCraftedByDisplayChanged(Player.m_localPlayer, CurrentItem, CurrentItem.m_shared.m_name, craftedByDisplay, newDisplay); ItemData currentItem = CurrentItem; UIPanels.InputCraftedByPanel.SetActive(false); UIPanels.OpenActionMenu(currentItem); } public static bool IsExcluded(ItemData? item) { return RenameExclusionRules.IsExcludedFromConfig(item); } public static bool IsRenameAllowlisted(ItemData? item) { return RenameExclusionRules.MatchesRenameAllowlist(item); } private static bool IsAllowedCustomCraftedByLineLabel(string value) { List<string> craftedByAllowedLabelsList = RenameitConfig.GetCraftedByAllowedLabelsList(); for (int i = 1; i < craftedByAllowedLabelsList.Count; i++) { if (string.Equals(craftedByAllowedLabelsList[i], value, StringComparison.Ordinal)) { return true; } } return false; } } internal static class StackIdentity { internal static string GetFingerprint(ItemData? item) { if (item?.m_customData == null) { return ""; } StringBuilder stringBuilder = new StringBuilder(); Append(stringBuilder, item, "Drake_Rename"); Append(stringBuilder, item, "Drake_Rename_Desc"); Append(stringBuilder, item, "Drake_CraftedByDisplay"); Append(stringBuilder, item, "Drake_CraftedByLineLabel"); return stringBuilder.ToString(); } private static void Append(StringBuilder sb, ItemData item, string key) { if (item.m_customData.TryGetValue(key, out var value) && !string.IsNullOrEmpty(value)) { sb.Append('|').Append(value); } else { sb.Append('|'); } } internal static bool SameDrakeStackIdentity(ItemData? a, ItemData? b) { if (a == null || b == null) { return false; } return string.Equals(GetFingerprint(a), GetFingerprint(b), StringComparison.Ordinal); } } } namespace DrakeRenameit.UI { internal static class TooltipRichText { private enum RtKind { Color, Size } private static readonly Regex HexColorRegex = new Regex("^[0-9a-fA-F]{3,8}$", RegexOptions.Compiled); internal static string EnsureRichTextTagsClosedForTooltip(string? text) { if (string.IsNullOrEmpty(text)) { return text ?? ""; } Stack<RtKind> stack = new Stack<RtKind>(); int num = 0; while (num < text.Length) { if (text[num] != '<') { num++; continue; } int num2 = text.IndexOf('>', num); if (num2 < 0) { break; } string text2 = text.Substring(num, num2 - num + 1); if (text2.Length >= 2 && text2[1] == '/') { if (text2.StartsWith("</color", StringComparison.OrdinalIgnoreCase)) { if (stack.Count > 0 && stack.Peek() == RtKind.Color) { stack.Pop(); } } else if (text2.StartsWith("</size", StringComparison.OrdinalIgnoreCase) && stack.Count > 0 && stack.Peek() == RtKind.Size) { stack.Pop(); } } else if (text2.StartsWith("<color", StringComparison.OrdinalIgnoreCase)) { stack.Push(RtKind.Color); } else if (IsHashColorOpenTag(text2)) { stack.Push(RtKind.Color); } else if (text2.StartsWith("<size", StringComparison.OrdinalIgnoreCase)) { stack.Push(RtKind.Size); } num = num2 + 1; } if (stack.Count == 0) { return text; } StringBuilder stringBuilder = new StringBuilder(text, text.Length + stack.Count * 10); while (stack.Count > 0) { RtKind rtKind = stack.Pop(); stringBuilder.Append((rtKind == RtKind.Color) ? "</color>" : "</size>"); } return stringBuilder.ToString(); } internal static string WrapCraftedByDisplayWithDefaultStatColorIfNeeded(string text) { if (string.IsNullOrEmpty(text)) { return text; } if (HasExplicitColorMarkup(text)) { return text; } return GetValheimTooltipStatColorOpenTag() + text + "</color>"; } internal static bool HasExplicitColorMarkup(string text) { if (string.IsNullOrEmpty(text)) { return false; } if (text.IndexOf("<color", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } for (int i = 0; i < text.Length - 3; i++) { if (text[i] == '<' && text[i + 1] == '#') { int j; for (j = i + 2; j < text.Length && IsHex(text[j]); j++) { } if (j != i + 2 && j - (i + 2) >= 3 && j - (i + 2) <= 8 && j < text.Length && text[j] == '>') { return true; } } } return false; } private static bool IsHex(char c) { switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': return true; default: return false; } } private static string GetValheimTooltipStatColorOpenTag() { //IL_0012: 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_001d: Unknown result type (might be due to invalid IL or missing references) try { GUIManager instance = GUIManager.Instance; if (instance != null) { Color valheimOrange = instance.ValheimOrange; return "<color=#" + ColorUtility.ToHtmlStringRGB(valheimOrange) + ">"; } } catch { } return "<color=#ff8800>"; } private static bool IsHashColorOpenTag(string tag) { if (tag.Length < 5 || tag[0] != '<' || tag[1] != '#' || tag[tag.Length - 1] != '>') { return false; } string input = tag.Substring(2, tag.Length - 3); return HexColorRegex.IsMatch(input); } } public static class UIPanels { [CompilerGenerated] private static class <>O { public static UnityAction <0>__CloseActionMenuOnly; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__56_0; public static UnityAction <>9__56_1; public static UnityAction <>9__56_2; public static UnityAction <>9__56_3; public static UnityAction <>9__56_4; public static UnityAction <>9__64_0; public static UnityAction <>9__64_1; public static UnityAction <>9__66_0; public static UnityAction <>9__66_1; public static UnityAction <>9__67_0; public static UnityAction <>9__74_0; public static UnityAction <>9__74_1; public static UnityAction <>9__75_0; public static UnityAction <>9__75_1; internal void <EnsureActionMenu>b__56_0() { ItemData currentItem = DrakeRenameit.CurrentItem; if (currentItem != null) { ActionMenuPanel.SetActive(false); OpenUnlockConfirmPanel(currentItem); } } internal void <EnsureActionMenu>b__56_1() { ItemData currentItem = DrakeRenameit.CurrentItem; CloseActionMenuOnly(); if (currentItem != null) { DrakeRenameit.OpenRename(currentItem); } } internal void <EnsureActionMenu>b__56_2() { ItemData currentItem = DrakeRenameit.CurrentItem; CloseActionMenuOnly(); if (currentItem != null) { DrakeRenameit.OpenRewriteDesc(currentItem); } } internal void <EnsureActionMenu>b__56_3() { ItemData currentItem = DrakeRenameit.CurrentItem; CloseActionMenuOnly(); if (currentItem != null) { DrakeRenameit.OpenCraftedByEditor(currentItem); } } internal void <EnsureActionMenu>b__56_4() { ItemData currentItem = DrakeRenameit.CurrentItem; if (currentItem != null) { DrakeRenameit.ResetAllCustomizations(currentItem); } CloseActionMenuOnly(); } internal void <EnsureUnlockConfirmPanel>b__64_0() { ItemData currentItem = DrakeRenameit.CurrentItem; if (currentItem == null) { CloseUnlockConfirmPanel(reopenActionMenu: false); } else if (!DrakeRenameit.TryPayRenameUnlock(currentItem)) { if (DrakeRenameit.CurrentItem == null || !DrakeRenameit.IsItemInLocalPlayerInventory(DrakeRenameit.CurrentItem)) { CloseAllRenameEditingUi(); return; } RefreshUnlockConfirmBody(); ((Selectable)_buttonConfirmUnlock).interactable = RenameUnlockCost.CanPlayerAfford(Player.m_localPlayer); } else { CloseUnlockConfirmPanel(reopenActionMenu: true); } } internal void <EnsureUnlockConfirmPanel>b__64_1() { CloseUnlockConfirmPanel(reopenActionMenu: false); } internal void <CreateCraftedByInput>b__66_0() { DrakeRenameit.ApplyCraftedByLabel(RenameCraftedByInput.text.Trim()); } internal void <CreateCraftedByInput>b__66_1() { if (DrakeRenameit.CurrentItem != null) { RenameCraftedByInput.text = DrakeRenameit.CurrentItem.m_crafterName ?? ""; } List<string> craftedByAllowedLabelsList = RenameitConfig.GetCraftedByAllowedLabelsList(); _craftedByLineLabelPendingToken = null; SetCraftedByLineLabelPickButtonText(craftedByAllowedLabelsList, 0); CloseCraftedByLineLabelPopover(); } internal void <EnsureCraftedByLineLabelControls>b__67_0() { if (!((Object)(object)_buttonCraftedByLineLabelPick == (Object)null) && ((Selectable)_buttonCraftedByLineLabelPick).interactable) { ToggleCraftedByLineLabelPopover(); } } internal void <CreateRenameInput>b__74_0() { DrakeRenameit.ApplyRename(RenameNameInput.text.Trim()); } internal void <CreateRenameInput>b__74_1() { if (DrakeRenameit.CurrentItem != null) { RenameNameInput.text = DrakeRenameit.resetName(DrakeRenameit.CurrentItem); } } internal void <CreateRenameDescInput>b__75_0() { if (string.IsNullOrEmpty(RenameDescInput.text)) { <CreateRenameDescInput>g__GetPlayerAndSendError|75_2("Description must not be empty!"); } else { DrakeRenameit.ApplyRewriteDesc(RenameDescInput.text.Trim()); } } internal void <CreateRenameDescInput>b__75_1() { RenameDescInput.text = DrakeRenameit.resetDesc(DrakeRenameit.CurrentItem); } } private const string RenameItemDescription = "Rewrite Item Desc"; private static Button _buttonOkName; private static Button _buttonOkDesc; private static Button _buttonResetName; private static Button _buttonResetDesc; private static Button? _buttonMenuRename; private static Button? _buttonMenuDesc; private static Button? _buttonMenuCraftedBy; private static Button? _buttonMenuResetAll; private static Button? _buttonMenuUnlock; private static Button? _buttonMenuCancel; private static Button? _buttonOkCraftedBy; private static Button? _buttonResetCraftedBy; private static Button? _buttonCraftedByLineLabelPick; private static GameObject? _craftedByLineLabelPopover; private static string? _craftedByLineLabelPendingToken; private static GameObject? _unlockConfirmPanel; private static RectTransform? _unlockCostListRoot; private static Text? _unlockAffordWarning; private static Button? _buttonConfirmUnlock; private static Button? _buttonConfirmCancel; private static bool _inputBlocked; public static GameObject? InputNamePanel { get; private set; } public static GameObject? InputDescPanel { get; private set; } public static InputField? RenameNameInput { get; private set; } public static InputField? RenameDescInput { get; private set; } public static GameObject? ActionMenuPanel { get; private set; } public static GameObject? InputCraftedByPanel { get; private set; } public static InputField? RenameCraftedByInput { get; private set; } internal static string? CraftedByLineLabelPendingToken => _craftedByLineLabelPendingToken; internal static void EnsureInputBlocked() { if (!_inputBlocked) { GUIManager.BlockInput(true); _inputBlocked = true; } } internal static void EnsureInputUnblocked() { if (_inputBlocked) { GUIManager.BlockInput(false); _inputBlocked = false; } } public static void CloseAllRenameEditingUi() { if ((Object)(object)InputNamePanel != (Object)null) { InputNamePanel.SetActive(false); } if ((Object)(object)InputDescPanel != (Object)null) { InputDescPanel.SetActive(false); } if ((Object)(object)InputCraftedByPanel != (Object)null) { InputCraftedByPanel.SetActive(false); } CloseCraftedByLineLabelPopover(); if ((Object)(object)ActionMenuPanel != (Object)null) { ActionMenuPanel.SetActive(false); } if ((Object)(object)_unlockConfirmPanel != (Object)null) { _unlockConfirmPanel.SetActive(false); } DrakeRenameit.CurrentItem = null; EnsureInputUnblocked(); } public static void OpenActionMenu(ItemData item) { if (GUIManager.Instance == null || !Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { return; } if (!DrakeRenameit.IsItemInLocalPlayerInventory(item)) { CloseAllRenameEditingUi(); Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "That item is no longer in your inventory.", 0, (Sprite)null); } return; } EnsureActionMenu(); if ((Object)(object)ActionMenuPanel == (Object)null || (Object)(object)_buttonMenuRename == (Object)null || (Object)(object)_buttonMenuResetAll == (Object)null || (Object)(object)_buttonMenuUnlock == (Object)null) { return; } DrakeRenameit.CurrentItem = item; bool flag = DrakeRenameit.ShowUnlockButton(item); ((Component)_buttonMenuUnlock).gameObject.SetActive(flag); if (flag) { Text componentInChildren = ((Component)_buttonMenuUnlock).GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { string costDisplayShort = RenameUnlockCost.GetCostDisplayShort(); componentInChildren.text = (string.IsNullOrEmpty(costDisplayShort) ? "\ud83d\udd12 Unlock" : ("\ud83d\udd12 Unlock (" + costDisplayShort + ")")); } ((Selectable)_buttonMenuRename).interactable = false; ((Selectable)_buttonMenuDesc).interactable = false; ((Selectable)_buttonMenuCraftedBy).interactable = false; ((Selectable)_buttonMenuResetAll).interactable = false; ((Selectable)_buttonMenuUnlock).interactable = true; } else { ((Selectable)_buttonMenuRename).interactable = DrakeRenameit.CanChangeName(item); ((Selectable)_buttonMenuDesc).interactable = DrakeRenameit.CanChangeDesc(item); ((Selectable)_buttonMenuCraftedBy).interactable = DrakeRenameit.CanChangeCraftedByLabel(item); ((Selectable)_buttonMenuResetAll).interactable = DrakeRenameit.CanResetAnyCustomization(item); } ActionMenuPanel.SetActive(true); ActionMenuPanel.transform.SetAsLastSibling(); EnsureInputBlocked(); } private static void EnsureActionMenu() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Expected O, but got Unknown //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Expected O, but got Unknown if ((Object)(object)ActionMenuPanel != (Object)null || GUIManager.Instance == null || !Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { return; } ActionMenuPanel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 320f, 280f, false); GUIManager.Instance.CreateText("DrakesRenameIt", ActionMenuPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -48f), GUIManager.Instance.AveriaSerifBold, 22, GUIManager.Instance.ValheimOrange, true, Color.black, 280f, 40f, false); _buttonMenuUnlock = GUIManager.Instance.CreateButton("\ud83d\udd12 Unlock", ActionMenuPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 72f), 220f, 30f).GetComponent<Button>(); ((Component)_buttonMenuUnlock).gameObject.SetActive(false); Button? buttonMenuUnlock = _buttonMenuUnlock; object obj = <>c.<>9__56_0; if (obj == null) { UnityAction val = delegate { ItemData currentItem5 = DrakeRenameit.CurrentItem; if (currentItem5 != null) { ActionMenuPanel.SetActive(false); OpenUnlockConfirmPanel(currentItem5); } }; <>c.<>9__56_0 = val; obj = (object)val; } buttonMenuUnlock.AddUniqueListener((UnityAction)obj); _buttonMenuRename = GUIManager.Instance.CreateButton("Rename", ActionMenuPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 40f), 200f, 32f).GetComponent<Button>(); Button? buttonMenuRename = _buttonMenuRename; object obj2 = <>c.<>9__56_1; if (obj2 == null) { UnityAction val2 = delegate { ItemData currentItem4 = DrakeRenameit.CurrentItem; CloseActionMenuOnly(); if (currentItem4 != null) { DrakeRenameit.OpenRename(currentItem4); } }; <>c.<>9__56_1 = val2; obj2 = (object)val2; } buttonMenuRename.AddUniqueListener((UnityAction)obj2); _buttonMenuDesc = GUIManager.Instance.CreateButton("Description", ActionMenuPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 200f, 32f).GetComponent<Button>(); Button? buttonMenuDesc = _buttonMenuDesc; object obj3 = <>c.<>9__56_2; if (obj3 == null) { UnityAction val3 = delegate { ItemData currentItem3 = DrakeRenameit.CurrentItem; CloseActionMenuOnly(); if (currentItem3 != null) { DrakeRenameit.OpenRewriteDesc(currentItem3); } }; <>c.<>9__56_2 = val3; obj3 = (object)val3; } buttonMenuDesc.AddUniqueListener((UnityAction)obj3); _buttonMenuCraftedBy = GUIManager.Instance.CreateButton("Crafted by", ActionMenuPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -40f), 200f, 32f).GetComponent<Button>(); Button? buttonMenuCraftedBy = _buttonMenuCraftedBy; object obj4 = <>c.<>9__56_3; if (obj4 == null) { UnityAction val4 = delegate { ItemData currentItem2 = DrakeRenameit.CurrentItem; CloseActionMenuOnly(); if (currentItem2 != null) { DrakeRenameit.OpenCraftedByEditor(currentItem2); } }; <>c.<>9__56_3 = val4; obj4 = (object)val4; } buttonMenuCraftedBy.AddUniqueListener((UnityAction)obj4); _buttonMenuResetAll = GUIManager.Instance.CreateButton("Reset all", ActionMenuPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(-66f, -80f), 120f, 28f).GetComponent<Button>(); Button? buttonMenuResetAll = _buttonMenuResetAll; object obj5 = <>c.<>9__56_4; if (obj5 == null) { UnityAction val5 = delegate { ItemData currentItem = DrakeRenameit.CurrentItem; if (currentItem != null) { DrakeRenameit.ResetAllCustomizations(currentItem); } CloseActionMenuOnly(); }; <>c.<>9__56_4 = val5; obj5 = (object)val5; } buttonMenuResetAll.AddUniqueListener((UnityAction)obj5); _buttonMenuCancel = GUIManager.Instance.CreateButton("OK", ActionMenuPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(66f, -80f), 120f, 28f).GetComponent<Button>(); Button? buttonMenuCancel = _buttonMenuCancel; object obj6 = <>O.<0>__CloseActionMenuOnly; if (obj6 == null) { UnityAction val6 = CloseActionMenuOnly; <>O.<0>__CloseActionMenuOnly = val6; obj6 = (object)val6; } buttonMenuCancel.AddUniqueListener((UnityAction)obj6); } private static void CloseActionMenuOnly() { if ((Object)(object)ActionMenuPanel != (Object)null) { ActionMenuPanel.SetActive(false); } EnsureInputUnblocked(); } public static void OpenUnlockMenuFromInventory(ItemData item) { DrakeRenameit.CurrentItem = item; OpenUnlockConfirmPanel(item); } private static void OpenUnlockConfirmPanel(ItemData item) { if (GUIManager.Instance == null || !Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { return; } if (!DrakeRenameit.IsItemInLocalPlayerInventory(item)) { CloseAllRenameEditingUi(); Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "That item is no longer in your inventory.", 0, (Sprite)null); } return; } EnsureUnlockConfirmPanel(); if (!((Object)(object)_unlockConfirmPanel == (Object)null) && !((Object)(object)_unlockCostListRoot == (Object)null) && !((Object)(object)_buttonConfirmUnlock == (Object)null)) { RefreshUnlockConfirmBody(); bool interactable = RenameUnlockCost.CanPlayerAfford(Player.m_localPlayer); ((Selectable)_buttonConfirmUnlock).interactable = interactable; _unlockConfirmPanel.SetActive(true); _unlockConfirmPanel.transform.SetAsLastSibling(); EnsureInputBlocked(); } } private static void RefreshUnlockConfirmBody() { if ((Object)(object)_unlockCostListRoot == (Object)null) { return; } ClearUnlockCostListChildren(); List<(string, int, string)> costDisplayEntries = RenameUnlockCost.GetCostDisplayEntries(); bool flag = RenameUnlockCost.CanPlayerAfford(Player.m_localPlayer); if (costDisplayEntries.Count == 0) { AddUnlockPlainLine(_unlockCostListRoot, "Unlock this item stack for editing?"); if ((Object)(object)_unlockAffordWarning != (Object)null) { _unlockAffordWarning.text = ""; ((Component)_unlockAffordWarning).gameObject.SetActive(false); } return; } foreach (var item4 in costDisplayEntries) { string item = item4.Item1; int item2 = item4.Item2; string item3 = item4.Item3; string itemTokenPublic = RenameUnlockCost.GetItemTokenPublic(item3); int num; if (!((Object)(object)Player.m_localPlayer != (Object)null)) { num = 0; } else { Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); num = ((inventory != null) ? inventory.CountItems(itemTokenPublic, -1, true) : 0); } int num2 = num; string text = ((num2 >= item2) ? "lime" : "red"); string richLine = $"{item2}x {item} <color={text}>({num2} in inv)</color>"; Sprite itemIconSprite = RenameUnlockCost.GetItemIconSprite(item3); CreateUnlockCostRow(_unlockCostListRoot, itemIconSprite, richLine); } if ((Object)(object)_unlockAffordWarning != (Object)null) { if (!flag) { _unlockAffordWarning.text = "<color=red>You don't have enough items to unlock.</color>"; ((Component)_unlockAffordWarning).gameObject.SetActive(true); } else { _unlockAffordWarning.text = ""; ((Component)_unlockAffordWarning).gameObject.SetActive(false); } } } private static void ClearUnlockCostListChildren() { if (!((Object)(object)_unlockCostListRoot == (Object)null)) { for (int num = ((Transform)_unlockCostListRoot).childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)((Transform)_unlockCostListRoot).GetChild(num)).gameObject); } } } private static void AddUnlockPlainLine(RectTransform parent, string message) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0070: 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) GameObject val = new GameObject("PlainLine", new Type[2] { typeof(RectTransform), typeof(Text) }); val.transform.SetParent((Transform)(object)parent, false); Text component = val.GetComponent<Text>(); component.text = message; if (GUIManager.Instance != null) { component.font = GUIManager.Instance.AveriaSerifBold; } component.fontSize = 14; ((Graphic)component).color = Color.white; component.alignment = (TextAnchor)0; component.horizontalOverflow = (HorizontalWrapMode)0; RectTransform component2 = val.GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(300f, 40f); } private static void CreateUnlockCostRow(RectTransform parent, Sprite? icon, string richLine) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_003f: 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_0084: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CostRow", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(300f, 38f); HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val2).spacing = 10f; ((LayoutGroup)val2).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = true; ((LayoutGroup)val2).padding = new RectOffset(2, 2, 2, 2); GameObject val3 = new GameObject("icon", new Type[2] { typeof(RectTransform), typeof(Image) }); val3.transform.SetParent(val.transform, false); Image component2 = val3.GetComponent<Image>(); component2.sprite = icon; component2.preserveAspect = true; ((Graphic)component2).color = Color.white; ((Behaviour)component2).enabled = (Object)(object)icon != (Object)null; LayoutElement val4 = val3.AddComponent<LayoutElement>(); val4.preferredWidth = 32f; val4.preferredHeight = 32f; val4.minWidth = 32f; GameObject val5 = new GameObject("line", new Type[2] { typeof(RectTransform), typeof(Text) }); val5.transform.SetParent(val.transform, false); Text component3 = val5.GetComponent<Text>(); component3.text = richLine; if (GUIManager.Instance != null) { component3.font = GUIManager.Instance.AveriaSerifBold; } component3.fontSize = 14; ((Graphic)component3).color = Color.white; component3.alignment = (TextAnchor)3; component3.supportRichText = true; component3.horizontalOverflow = (HorizontalWrapMode)0; LayoutElement val6 = val5.AddComponent<LayoutElement>(); val6.flexibleWidth = 1f; val6.minWidth = 180f; } private static void EnsureUnlockConfirmPanel() { //IL_0050: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Expected O, but got Unknown if ((Object)(object)_unlockConfirmPanel != (Object)null || GUIManager.Instance == null || !Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { return; } _unlockConfirmPanel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 360f, 280f, false); GUIManager.Instance.CreateText("\ud83d\udd12 Unlock Item", _unlockConfirmPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -44f), GUIManager.Instance.AveriaSerifBold, 20, GUIManager.Instance.ValheimOrange, true, Color.black, 300f, 36f, false); GUIManager.Instance.CreateText("Unlock cost:", _unlockConfirmPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -78f), GUIManager.Instance.AveriaSerifBold, 14, Color.white, true, Color.black, 300f, 22f, false); GameObject val = new GameObject("UnlockCostList", new Type[2] { typeof(RectTransform), typeof(VerticalLayoutGroup) }); val.transform.SetParent(_unlockConfirmPanel.transform, false); _unlockCostListRoot = val.GetComponent<RectTransform>(); _unlockCostListRoot.anchorMin = new Vector2(0.5f, 1f); _unlockCostListRoot.anchorMax = new Vector2(0.5f, 1f); _unlockCostListRoot.pivot = new Vector2(0.5f, 1f); _unlockCostListRoot.sizeDelta = new Vector2(320f, 150f); _unlockCostListRoot.anchoredPosition = new Vector2(0f, -102f); VerticalLayoutGroup component = val.GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component).spacing = 6f; ((LayoutGroup)component).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true; GameObject val2 = GUIManager.Instance.CreateText("", _unlockConfirmPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 78f), GUIManager.Instance.AveriaSerifBold, 13, Color.red, true, Color.black, 310f, 36f, false); _unlockAffordWarning = val2.GetComponent<Text>(); _unlockAffordWarning.supportRichText = true; ((Component)_unlockAffordWarning).gameObject.SetActive(false); _buttonConfirmUnlock = GUIManager.Instance.CreateButton("\ud83d\udd12 Pay", _unlockConfirmPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-55f, 35f), 110f, 30f).GetComponent<Button>(); Button? buttonConfirmUnlock = _buttonConfirmUnlock; object obj = <>c.<>9__64_0; if (obj == null) { UnityAction val3 = delegate { ItemData currentItem = DrakeRenameit.CurrentItem; if (currentItem == null) { CloseUnlockConfirmPanel(reopenActionMenu: false); } else if (!DrakeRenameit.TryPayRenameUnlock(currentItem)) { if (DrakeRenameit.CurrentItem == null || !DrakeRenameit.IsItemInLocalPlayerInventory(DrakeRenameit.CurrentItem)) { CloseAllRenameEditingUi(); } else { RefreshUnlockConfirmBody(); ((Selectable)_buttonConfirmUnlock).interactable = RenameUnlockCost.CanPlayerAfford(Player.m_localPlayer); } } else { CloseUnlockConfirmPanel(reopenActionMenu: true); } }; <>c.<>9__64_0 = val3; obj = (object)val3; } buttonConfirmUnlock.AddUniqueListener((UnityAction)obj); _buttonConfirmCancel = GUIManager.Instance.CreateButton("Cancel", _unlockConfirmPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(55f, 35f), 110f, 30f).GetComponent<Button>(); Button? buttonConfirmCancel = _buttonConfirmCancel; object obj2 = <>c.<>9__64_1; if (obj2 == null) { UnityAction val4 = delegate { CloseUnlockConfirmPanel(reopenActionMenu: false); }; <>c.<>9__64_1 = val4; obj2 = (object)val4; } buttonConfirmCancel.AddUniqueListener((UnityAction)obj2); } private static void CloseUnlockConfirmPanel(bool reopenActionMenu) { if ((Object)(object)_unlockConfirmPanel != (Object)null) { _unlockConfirmPanel.SetActive(false); } if (reopenActionMenu && DrakeRenameit.CurrentItem != null) { ItemData currentItem = DrakeRenameit.CurrentItem; GameObject? actionMenuPanel = ActionMenuPanel; if (actionMenuPanel != null) { actionMenuPanel.SetActive(false); } OpenActionMenu(currentItem); } else { if ((Object)(object)ActionMenuPanel != (Object)null) { ActionMenuPanel.SetActive(false); } DrakeRenameit.CurrentItem = null; EnsureInputUnblocked(); } } public static void CreateCraftedByInput() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) //IL_00ef: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown if (GUIManager.Instance == null) { Debug.LogError((object)"GUIManager instance is null"); return; } if (!Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { Debug.LogError((object)"GUIManager CustomGUI is null"); return; } if (DrakeRenameit.CurrentItem == null) { Debug.LogError((object)"Current Item null"); return; } if ((Object)(object)InputCraftedByPanel == (Object)null) { InputCraftedByPanel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 350f, 230f, false); GUIManager.Instance.CreateText("Crafted by (display)", InputCraftedByPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(15f, -56f), GUIManager.Instance.AveriaSerifBold, 22, GUIManager.Instance.ValheimOrange, true, Color.black, 300f, 60f, false); } InputCraftedByPanel.SetActive(true); InputCraftedByPanel.transform.SetAsLastSibling(); EnsureCraftedByLineLabelControls(); if ((Object)(object)RenameCraftedByInput == (Object)null) { RenameCraftedByInput = GUIManager.Instance.CreateInputField(InputCraftedByPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -28f), (ContentType)0, "Display name on tooltip…", 18, 300f, 30f).GetComponent<InputField>(); } RenameCraftedByInput.characterLimit = RenameitConfig.CraftedByCharLimit; RenameCraftedByInput.text = DrakeRenameit.getCraftedByDisplay(DrakeRenameit.CurrentItem); if (DrakeRenameit.CurrentItem != null) { RefreshCraftedByLineLabelPicker(DrakeRenameit.CurrentItem); } if ((Object)(object)_buttonOkCraftedBy == (Object)null) { _buttonOkCraftedBy = GUIManager.Instance.CreateButton("OK", InputCraftedByPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-42f, 35f), 80f, 30f).GetComponent<Button>(); Button? buttonOkCraftedBy = _buttonOkCraftedBy; object obj = <>c.<>9__66_0; if (obj == null) { UnityAction val = delegate { DrakeRenameit.ApplyCraftedByLabel(RenameCraftedByInput.text.Trim()); }; <>c.<>9__66_0 = val; obj = (object)val; } buttonOkCraftedBy.AddUniqueListener((UnityAction)obj); } if (!((Object)(object)_buttonResetCraftedBy == (Object)null)) { return; } _buttonResetCraftedBy = GUIManager.Instance.CreateButton("Reset", InputCraftedByPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(42f, 35f), 80f, 30f).GetComponent<Button>(); Button? buttonResetCraftedBy = _buttonResetCraftedBy; object obj2 = <>c.<>9__66_1; if (obj2 == null) { UnityAction val2 = delegate { if (DrakeRenameit.CurrentItem != null) { RenameCraftedByInput.text = DrakeRenameit.CurrentItem.m_crafterName ?? ""; } List<string> craftedByAllowedLabelsList = RenameitConfig.GetCraftedByAllowedLabelsList(); _craftedByLineLabelPendingToken = null; SetCraftedByLineLabelPickButtonText(craftedByAllowedLabelsList, 0); CloseCraftedByLineLabelPopover(); }; <>c.<>9__66_1 = val2; obj2 = (object)val2; } buttonResetCraftedBy.AddUniqueListener((UnityAction)obj2); } private static void EnsureCraftedByLineLabelControls() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown if ((Object)(object)InputCraftedByPanel == (Object)null || GUIManager.Instance == null) { return; } RectTransform component = InputCraftedByPanel.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null && component.sizeDelta.y < 220f) { component.sizeDelta = new Vector2(350f, 230f); } if ((Object)(object)_buttonCraftedByLineLabelPick != (Object)null) { return; } GUIManager.Instance.CreateText("Tooltip line", InputCraftedByPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(-118f, -90f), GUIManager.Instance.AveriaSerifBold, 16, Color.white, true, Color.black, 100f, 28f, false); _buttonCraftedByLineLabelPick = GUIManager.Instance.CreateButton("…", InputCraftedByPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(32f, -90f), 210f, 28f).GetComponent<Button>(); Button? buttonCraftedByLineLabelPick = _buttonCraftedByLineLabelPick; object obj = <>c.<>9__67_0; if (obj == null) { UnityAction val = delegate { if (!((Object)(object)_buttonCraftedByLineLabelPick == (Object)null) && ((Selectable)_buttonCraftedByLineLabelPick).interactable) { ToggleCraftedByLineLabelPopover(); } }; <>c.<>9__67_0 = val; obj = (object)val; } buttonCraftedByLineLabelPick.AddUniqueListener((UnityAction)obj); _craftedByLineLabelPopover = GUIManager.Instance.CreateWoodpanel(InputCraftedByPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(24f, -118f), 226f, 48f, false); _craftedByLineLabelPopover.SetActive(false); } internal static void RefreshCraftedByLineLabelPicker(ItemData item) { EnsureCraftedByLineLabelControls(); if ((Object)(object)_buttonCraftedByLineLabelPick == (Object)null) { return; } bool flag = RenameitConfig.CraftedByLabelCustomizable || RenameitPermission.IsElevatedForOverrides(Player.m_localPlayer); List<string> craftedByAllowedLabelsList = RenameitConfig.GetCraftedByAllowedLabelsList(); string value; string text = ((item.m_customData != null && item.m_customData.TryGetValue("Drake_CraftedByLineLabel", out value) && !string.IsNullOrEmpty(value)) ? value : null); int idx = 0; string craftedByLineLabelPendingToken = null; if (flag && text != null) { for (int i = 1; i < craftedByAllowedLabelsList.Count; i++) { if (string.Equals(craftedByAllowedLabelsList[i], text, StringComparison.Ordinal)) { idx = i; craftedByLineLabelPendingToken = text; break; } } } _craftedByLineLabelPendingToken = craftedByLineLabelPendingToken; SetCraftedByLineLabelPickButtonText(craftedByAllowedLabelsList, idx); ((Selectable)_buttonCraftedByLineLabelPick).interactable = flag; CloseCraftedByLineLabelPopover(); } private static void SetCraftedByLineLabelPickButtonText(List<string> options, int idx) { if (!((Object)(object)_buttonCraftedByLineLabelPick == (Object)null)) { string text = ((idx <= 0 || idx >= options.Count) ? LocalizedDefaultCraftedByCaption() : options[idx]); Text componentInChildren = ((Component)_buttonCraftedByLineLabelPick).GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = text + " ▼"; } } } private static string LocalizedDefaultCraftedByCaption() { if (Localization.instance != null) { string text = Localization.instance.Localize("$item_crafter"); if (!string.IsNullOrEmpty(text)) { return text; } } List<string> craftedByAllowedLabelsList = RenameitConfig.GetCraftedByAllowedLabelsList(); return (craftedByAllowedLabelsList.Count > 0) ? craftedByAllowedLabelsList[0] : "Crafted by"; } private static void ToggleCraftedByLineLabelPopover() { if (!((Object)(object)_craftedByLineLabelPopover == (Object)null)) { if (_craftedByLineLabelPopover.activeSelf) { CloseCraftedByLineLabelPopover(); return; } RebuildCraftedByLineLabelPopoverContent(); _craftedByLineLabelPopover.SetActive(true); _craftedByLineLabelPopover.transform.SetAsLastSibling(); } } private static void CloseCraftedByLineLabelPopover() { if ((Object)(object)_craftedByLineLabelPopover != (Object)null) { _craftedByLineLabelPopover.SetActive(false); } } private static void RebuildCraftedByLineLabelPopoverContent() { //IL_00b0: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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) //IL_0174: Expected O, but got Unknown if ((Object)(object)_craftedByLineLabelPopover == (Object)null || GUIManager.Instance == null) { return; } for (int num = _craftedByLineLabelPopover.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)_craftedByLineLabelPopover.transform.GetChild(num)).gameObject); } List<string> options = RenameitConfig.GetCraftedByAllowedLabelsList(); float num2 = 12f + (float)options.Count * 28f; RectTransform component = _craftedByLineLabelPopover.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.sizeDelta = new Vector2(220f, num2); } for (int i = 0; i < options.Count; i++) { int capture = i; string text = ((i == 0) ? LocalizedDefaultCraftedByCaption() : options[i]); Button component2 = GUIManager.Instance.CreateButton(text, _craftedByLineLabelPopover.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -6f - 28f * ((float)i + 0.5f)), 200f, 26f).GetComponent<Button>(); component2.AddUniqueListener((UnityAction)delegate { _craftedByLineLabelPendingToken = ((capture == 0) ? null : options[capture]); SetCraftedByLineLabelPickButtonText(options, capture); CloseCraftedByLineLabelPopover(); }); } } public static void CreateRenameInput() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Expected O, but got Unknown if (GUIManager.Instance == null) { Debug.LogError((object)"GUIManager instance is null"); return; } if (!Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { Debug.LogError((object)"GUIManager CustomGUI is null"); return; } if (DrakeRenameit.CurrentItem == null) { Debug.LogError((object)"Current Item null"); return; } if (!Object.op_Implicit((Object)(object)InputNamePanel)) { InputNamePanel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 350f, 150f, false); } InputNamePanel.SetActive(true); InputNamePanel.transform.SetAsLastSibling(); GUIManager.Instance.CreateText("Rename Item", InputNamePanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(15f, -65f), GUIManager.Instance.AveriaSerifBold, 24, GUIManager.Instance.ValheimOrange, true, Color.black, 200f, 100f, false); if (!Object.op_Implicit((Object)(object)RenameNameInput)) { RenameNameInput = GUIManager.Instance.CreateInputField(InputNamePanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), (ContentType)0, "Enter new name...", 18, 300f, 30f).GetComponent<InputField>(); } RenameNameInput.characterLimit = RenameitConfig.NameCharLimit; RenameNameInput.text = DrakeRenameit.GetPropperName(DrakeRenameit.CurrentItem); if ((Object)(object)_buttonOkName == (Object)null) { _buttonOkName = GUIManager.Instance.CreateButton("OK", InputNamePanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-42f, 35f), 80f, 30f).GetComponent<Button>(); ((Component)_buttonOkName).gameObject.SetActive(true); Button component = ((Component)_buttonOkName).GetComponent<Button>(); object obj = <>c.<>9__74_0; if (obj == null) { UnityAction val = delegate { DrakeRenameit.ApplyRename(RenameNameInput.text.Trim()); }; <>c.<>9__74_0 = val; obj = (object)val; } component.AddUniqueListener((UnityAction)obj); } if (!((Object)(object)_buttonResetName == (Object)null)) { return; } _buttonResetName = GUIManager.Instance.CreateButton("Reset", InputNamePanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(42f, 35f), 80f, 30f).GetComponent<Button>(); ((Component)_buttonResetName).gameObject.SetActive(true); Button component2 = ((Component)_buttonResetName).GetComponent<Button>(); object obj2 = <>c.<>9__74_1; if (obj2 == null) { UnityAction val2 = delegate { if (DrakeRenameit.CurrentItem != null) { RenameNameInput.text = DrakeRenameit.resetName(DrakeRenameit.CurrentItem); } }; <>c.<>9__74_1 = val2; obj2 = (object)val2; } component2.AddUniqueListener((UnityAction)obj2); } public static void CreateRenameDescInput() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Expected O, but got Unknown if (GUIManager.Instance == null) { Debug.LogError((object)"GUIManager instance is null"); return; } if (!Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { Debug.LogError((object)"GUIManager CustomGUI is null"); return; } if (DrakeRenameit.CurrentItem == null) { Debug.LogError((object)"Current Item null"); return; } if (!Object.op_Implicit((Object)(object)InputDescPanel)) { InputDescPanel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 275f, 375f, false); } InputDescPanel.SetActive(true); InputDescPanel.transform.SetAsLastSibling(); GUIManager.Instance.CreateText("Rewrite Item Desc", InputDescPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(15f, -65f), GUIManager.Instance.AveriaSerifBold, 24, GUIManager.Instance.ValheimOrange, true, Color.black, 250f, 80f, false); if (!Object.op_Implicit((Object)(object)RenameDescInput)) { RenameDescInput = GUIManager.Instance.CreateInputField(InputDescPanel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), (ContentType)0, "Enter new desc", 16, 225f, 240f).GetComponent<InputField>(); RenameDescInput.contentType = (ContentType)0; RenameDescInput.lineType = (LineType)2; RenameDescInput.text = DrakeRenameit.getPropperDesc(DrakeRenameit.CurrentItem); } RenameDescInput.characterLimit = RenameitConfig.DescCharLimit; if ((Object)(object)_buttonOkDesc == (Object)null) { _buttonOkDesc = GUIManager.Instance.CreateButton("OK", InputDescPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-42f, 35f), 80f, 30f).GetComponent<Button>(); ((Component)_buttonOkDesc).gameObject.SetActive(true); Button buttonOkDesc = _buttonOkDesc; object obj = <>c.<>9__75_0; if (obj == null) { UnityAction val = delegate { if (string.IsNullOrEmpty(RenameDescInput.text)) { GetPlayerAndSendError("Description must not be empty!"); } else { DrakeRenameit.ApplyRewriteDesc(RenameDescInput.text.Trim()); } }; <>c.<>9__75_0 = val; obj = (object)val; } buttonOkDesc.AddUniqueListener((UnityAction)obj); } if (!((Object)(object)_buttonResetDesc == (Object)null)) { return; } _buttonResetDesc = GUIManager.Instance.CreateButton("Reset", InputDescPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(42f, 35f), 80f, 30f).GetComponent<Button>(); ((Component)_buttonResetDesc).gameObject.SetActive(true); Button component = ((Component)_buttonResetDesc).GetComponent<Button>(); object obj2 = <>c.<>9__75_1; if (obj2 == null) { UnityAction val2 = delegate { RenameDescInput.text = DrakeRenameit.resetDesc(DrakeRenameit.CurrentItem); }; <>c.<>9__75_1 = val2; obj2 = (object)val2; } component.AddUniqueListener((UnityAction)obj2); static void GetPlayerAndSendError(string msg) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { ((Character)localPlayer).Message((MessageType)2, msg, 0, (Sprite)null); } } } [CompilerGenerated] inter