using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("AdminPanel")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AdminPanel")] [assembly: AssemblyTitle("AdminPanel")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 AdminPanel { [BepInPlugin("com.halitb.adminpanel", "AdminPanel", "2.3.0")] public class AdminPanelPlugin : BaseUnityPlugin { private class ItemEntry { public ItemDrop Drop; public string Prefab; public string Display; public string Info; public string Cat; public string Sub; public Sprite Icon; public bool IconTried; } private class SeEntry { public StatusEffect Se; public string Display; public string Tooltip; public int Hash; public int Bucket; } private class CreatureEntry { public GameObject Prefab; public string Name; public string Display; public string Faction; public bool Boss; public bool Tamable; } private enum SideMode { None, WhatsNew, BugReport } [HarmonyPatch] private static class CheatPatches { [HarmonyPatch(typeof(Player), "UseStamina")] [HarmonyPrefix] private static bool NoStaminaPrefix(Player __instance) { if (NoStaminaFlag) { return !((Object)(object)__instance == (Object)(object)Player.m_localPlayer); } return true; } [HarmonyPatch(typeof(Character), "Damage")] [HarmonyPrefix] private static void OneHitPrefix(Character __instance, HitData hit) { if (!OneHitKillFlag || hit == null || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)__instance == (Object)null || (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { return; } try { if (!((Object)(object)hit.GetAttacker() != (Object)(object)Player.m_localPlayer)) { hit.m_damage.m_damage = 1E+09f; } } catch { } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] private static class CursorPatch { [HarmonyPrefix] private static bool Prefix() { if ((Object)(object)Instance == (Object)null || !Instance._visible) { return true; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; return false; } } [HarmonyPatch(typeof(Player), "TakeInput")] private static class InputBlockPatch { [HarmonyPostfix] private static void Postfix(ref bool __result) { if ((Object)(object)Instance != (Object)null && Instance._visible) { __result = false; } } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] private static class BlockAttackPatch { [HarmonyPrefix] private static bool Prefix(Humanoid __instance) { if ((Object)(object)Instance != (Object)null && Instance._visible) { return !((Object)(object)__instance == (Object)(object)Player.m_localPlayer); } return true; } } [HarmonyPatch] private static class CameraLockPatch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("ZInput"); if (!(type == null)) { return AccessTools.Method(type, "GetMouseDelta", Type.EmptyTypes, (Type[])null); } return null; } [HarmonyPostfix] private static void Postfix(ref Vector2 __result) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance != (Object)null && Instance._visible && (Instance._cameraLockCfg == null || Instance._cameraLockCfg.Value)) { __result = Vector2.zero; } } } [HarmonyPatch(typeof(Player), "OnDeath")] private static class DeathPointPatch { [HarmonyPrefix] private static void Prefix(Player __instance) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) if (!((Object)(object)Instance == (Object)null) && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { Vector3 position = ((Component)__instance).transform.position; Instance._lastDeathCfg.Value = string.Format(CultureInfo.InvariantCulture, "{0:0.#},{1:0.#},{2:0.#}", position.x, position.y, position.z); ((BaseUnityPlugin)Instance).Config.Save(); } } } private static class ZoomWheelMute { internal static float SafeScrollWheel() { if (!((Object)(object)Instance != (Object)null) || !Instance._visible) { return ZInput.GetMouseScrollWheel(); } return 0f; } internal static float SafeGetAxis(string name) { if (!((Object)(object)Instance != (Object)null) || !Instance._visible || !(name == "Mouse ScrollWheel")) { return Input.GetAxis(name); } return 0f; } internal static IEnumerable ReplaceAxisReads(IEnumerable instructions, string owner) { MethodInfo original = AccessTools.Method(typeof(Input), "GetAxis", new Type[1] { typeof(string) }, (Type[])null); MethodInfo safe = AccessTools.Method(typeof(ZoomWheelMute), "SafeGetAxis", (Type[])null, (Type[])null); int replaced = 0; foreach (CodeInstruction instruction in instructions) { if (original != null && CodeInstructionExtensions.Calls(instruction, original)) { instruction.opcode = OpCodes.Call; instruction.operand = safe; replaced++; } yield return instruction; } if (replaced == 0) { AdminPanelPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)("Cross-mod zoom mute (" + owner + "): no Input.GetAxis calls found — mod code changed, mute inactive there.")); } } else { AdminPanelPlugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)$"Cross-mod zoom mute ({owner}): {replaced} axis read(s) muted while panel open."); } } } internal static IEnumerable VPlusAxisTranspiler(IEnumerable instructions) { return ReplaceAxisReads(instructions, "ValheimPlus FirstPerson.Postfix"); } internal static IEnumerable ReplaceWheelReads(IEnumerable instructions, string owner) { MethodInfo original = AccessTools.Method(typeof(ZInput), "GetMouseScrollWheel", Type.EmptyTypes, (Type[])null); MethodInfo safe = AccessTools.Method(typeof(ZoomWheelMute), "SafeScrollWheel", (Type[])null, (Type[])null); int replaced = 0; foreach (CodeInstruction instruction in instructions) { if (original != null && CodeInstructionExtensions.Calls(instruction, original)) { instruction.opcode = OpCodes.Call; instruction.operand = safe; replaced++; } yield return instruction; } if (replaced == 0) { AdminPanelPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)("Zoom-freeze transpiler (" + owner + "): no GetMouseScrollWheel calls found — game code changed, zoom freeze inactive.")); } } else { AdminPanelPlugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)$"Zoom-freeze transpiler ({owner}): {replaced} wheel read(s) muted while panel open."); } } } } [HarmonyPatch(typeof(GameCamera), "UpdateCamera")] private static class ZoomFreezeCameraTranspiler { [HarmonyTranspiler] private static IEnumerable Transpiler(IEnumerable instructions) { return ZoomWheelMute.ReplaceWheelReads(instructions, "UpdateCamera"); } } [HarmonyPatch(typeof(GameCamera), "UpdateFreeFly")] private static class ZoomFreezeFreeFlyTranspiler { [HarmonyTranspiler] private static IEnumerable Transpiler(IEnumerable instructions) { return ZoomWheelMute.ReplaceWheelReads(instructions, "UpdateFreeFly"); } } [HarmonyPatch(typeof(FejdStartup), "SetupGui")] private static class MenuVersionPatch { [HarmonyPostfix] private static void Postfix(FejdStartup __instance) { try { object obj = AccessTools.Field(typeof(FejdStartup), "m_versionLabel")?.GetValue(__instance); PropertyInfo propertyInfo = obj?.GetType().GetProperty("text"); if (propertyInfo?.GetValue(obj) is string text && !text.Contains("Advanced Admin Panel")) { propertyInfo.SetValue(obj, text + "\nAdvanced Admin Panel 2.3.0"); } } catch (Exception ex) { AdminPanelPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)("Menu version line failed (cosmetic only): " + ex.Message)); } } } } [HarmonyPatch] private static class RpcRegistration { [HarmonyPatch(typeof(ZNet), "Awake")] [HarmonyPostfix] private static void ZNetAwakePostfix() { if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.Register("AP_InvData", (Action)OnInventoryData); ZRoutedRpc.instance.Register("AP_VersionData", (Action)OnVersionData); } } } public const string PluginGuid = "com.halitb.adminpanel"; public const string PluginName = "AdminPanel"; public const string PluginVersion = "2.3.0"; internal static AdminPanelPlugin Instance; private ConfigEntry _toggleKey; private ConfigEntry _mapTpKey; private ConfigEntry _fontChoiceCfg; private ConfigEntry _fontSizeCfg; private ConfigEntry _languageCfg; private ConfigEntry _panelAlphaCfg; private ConfigEntry _cameraLockCfg; private int _fontSizeLive; private int _panelAlphaLive; private int _rebindTarget; private int _rebindTargetLayout; private Vector2 _settingsScroll; private static readonly string[] FontChoices = new string[5] { "Norse (auto)", "Norse Bold", "Norse", "Averia Serif", "Default" }; private bool _visible; private Rect _windowRect = new Rect(60f, 60f, 740f, 680f); private Rect _lastSavedRect; private int _tab; private static readonly string[] TabKeys = new string[8] { "tab.items", "tab.creatures", "tab.bosses", "tab.player", "tab.world", "tab.players", "tab.server", "tab.settings" }; private string _itemSearch = ""; private Vector2 _itemScroll; private int _itemAmount = 1; private int _itemQuality = 1; private long _giveTargetId; private List _othersSnapshot; private List _globalKeysLayout; private int _itemSort; private List _itemWindowList; private int _itemWindowFirst; private int _itemWindowVisible; private int _itemWindowTotal; private static readonly string[] ItemSortModes = new string[3] { "A → Z", "Z → A", "Category" }; private static readonly string[] CreatureSortModes = new string[3] { "A → Z", "Z → A", "Faction" }; private int _creatureSort; private string _openDropdown; private string _openDropdownLayout; private List _filteredItemsCache; private string _itemFilterKey = ""; private int _favVersion; private int _recentVersion; private List _filteredCreaturesCache; private string _creatureFilterKey = ""; private List _creatureCats; private List _subCatsCache; private string _subCatsKey; private List _itemIndex; private List _seIndex; private List _seFilteredCache; private string _seFilterKey; private string _mainCat = "All"; private string _subCat = "All"; private ConfigEntry _favoritesCfg; private ConfigEntry _crafterNameCfg; private ConfigEntry _bulkPackCfg; private HashSet _favorites; private readonly List _recentItems = new List(); private static readonly string[] MainCats = new string[14] { "All", "★ Fav", "Recent", "Kits", "Weapons", "Shields", "Armor", "Accessories", "Ammo", "Tools", "Food & Potions", "Materials", "Trophies", "Misc" }; private static readonly Dictionary MaterialBiome = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "Wood", "Meadows" }, { "Stone", "Meadows" }, { "Resin", "Meadows" }, { "Feathers", "Meadows" }, { "LeatherScraps", "Meadows" }, { "DeerHide", "Meadows" }, { "Flint", "Meadows" }, { "RawMeat", "Meadows" }, { "NeckTail", "Meadows" }, { "BoarMeat", "Meadows" }, { "DeerMeat", "Meadows" }, { "Honey", "Meadows" }, { "Dandelion", "Meadows" }, { "BeechSeeds", "Meadows" }, { "QueenBee", "Meadows" }, { "FineWood", "Black Forest" }, { "RoundLog", "Black Forest" }, { "Coal", "Black Forest" }, { "Tin", "Black Forest" }, { "TinOre", "Black Forest" }, { "Copper", "Black Forest" }, { "CopperOre", "Black Forest" }, { "CopperScrap", "Black Forest" }, { "Bronze", "Black Forest" }, { "BronzeNails", "Black Forest" }, { "TrollHide", "Black Forest" }, { "BoneFragments", "Black Forest" }, { "SurtlingCore", "Black Forest" }, { "GreydwarfEye", "Black Forest" }, { "Thistle", "Black Forest" }, { "AncientSeed", "Black Forest" }, { "Amber", "Black Forest" }, { "AmberPearl", "Black Forest" }, { "Ruby", "Black Forest" }, { "Coins", "Black Forest" }, { "CarrotSeeds", "Black Forest" }, { "FirCone", "Black Forest" }, { "PineCone", "Black Forest" }, { "Iron", "Swamp" }, { "IronScrap", "Swamp" }, { "WitheredBone", "Swamp" }, { "Chain", "Swamp" }, { "ElderBark", "Swamp" }, { "Guck", "Swamp" }, { "Ooze", "Swamp" }, { "Entrails", "Swamp" }, { "Bloodbag", "Swamp" }, { "TurnipSeeds", "Swamp" }, { "IronNails", "Swamp" }, { "Root", "Swamp" }, { "SerpentScale", "Swamp" }, { "Chitin", "Swamp" }, { "Silver", "Mountain" }, { "SilverOre", "Mountain" }, { "Obsidian", "Mountain" }, { "WolfPelt", "Mountain" }, { "WolfFang", "Mountain" }, { "FreezeGland", "Mountain" }, { "Crystal", "Mountain" }, { "WolfClaw", "Mountain" }, { "WolfHairBundle", "Mountain" }, { "JuteRed", "Mountain" }, { "DragonEgg", "Mountain" }, { "OnionSeeds", "Mountain" }, { "BlackMetal", "Plains" }, { "BlackMetalScrap", "Plains" }, { "Barley", "Plains" }, { "Flax", "Plains" }, { "LoxPelt", "Plains" }, { "Needle", "Plains" }, { "LinenThread", "Plains" }, { "Tar", "Plains" }, { "BarleyFlour", "Plains" }, { "LoxMeat", "Plains" }, { "Cloudberry", "Plains" }, { "BlackMarble", "Mistlands" }, { "Sap", "Mistlands" }, { "Eitr", "Mistlands" }, { "RefinedEitr", "Mistlands" }, { "YggdrasilWood", "Mistlands" }, { "Carapace", "Mistlands" }, { "Softtissue", "Mistlands" }, { "ScaleHide", "Mistlands" }, { "BlackCore", "Mistlands" }, { "Wisp", "Mistlands" }, { "Mandible", "Mistlands" }, { "RoyalJelly", "Mistlands" }, { "SeekerBrain", "Mistlands" }, { "JuteBlue", "Mistlands" }, { "FlametalNew", "Ashlands" }, { "FlametalOreNew", "Ashlands" }, { "Grausten", "Ashlands" }, { "CharredBone", "Ashlands" }, { "ProustitePowder", "Ashlands" }, { "CelestialFeather", "Ashlands" }, { "AskHide", "Ashlands" }, { "Blackwood", "Ashlands" }, { "SulfurStone", "Ashlands" }, { "MoltenCore", "Ashlands" }, { "CharcoalResin", "Ashlands" }, { "GemstoneRed", "Ashlands" }, { "GemstoneGreen", "Ashlands" }, { "GemstoneBlue", "Ashlands" }, { "BonemawSerpentMeat", "Ashlands" } }; private static readonly (string Name, (string Prefab, int Count)[] Items)[] GearKits = new(string, (string, int)[])[8] { ("Bronze Kit", new(string, int)[6] { ("ArmorBronzeChest", 1), ("ArmorBronzeLegs", 1), ("HelmetBronze", 1), ("CapeDeerHide", 1), ("SwordBronze", 1), ("ShieldBronzeBuckler", 1) }), ("Iron Kit", new(string, int)[6] { ("ArmorIronChest", 1), ("ArmorIronLegs", 1), ("HelmetIron", 1), ("CapeTrollHide", 1), ("SwordIron", 1), ("ShieldBanded", 1) }), ("Wolf Kit", new(string, int)[6] { ("ArmorWolfChest", 1), ("ArmorWolfLegs", 1), ("HelmetDrake", 1), ("CapeWolf", 1), ("SwordSilver", 1), ("ShieldSilver", 1) }), ("Padded Kit", new(string, int)[6] { ("ArmorPaddedCuirass", 1), ("ArmorPaddedGreaves", 1), ("HelmetPadded", 1), ("CapeLox", 1), ("SwordBlackmetal", 1), ("ShieldBlackmetal", 1) }), ("Carapace Kit", new(string, int)[6] { ("ArmorCarapaceChest", 1), ("ArmorCarapaceLegs", 1), ("HelmetCarapace", 1), ("CapeFeather", 1), ("SwordMistwalker", 1), ("ShieldCarapace", 1) }), ("Ashlands Kit", new(string, int)[6] { ("ArmorAshlandsMediumChest", 1), ("ArmorAshlandsMediumlegs", 1), ("HelmetAshlandsMediumHood", 1), ("CapeAsksvin", 1), ("SwordNiedhogg", 1), ("ShieldFlametal", 1) }), ("Food Pack", new(string, int)[5] { ("FishAndBread", 10), ("MeatPlatter", 10), ("YggdrasilPorridge", 10), ("MeadHealthMajor", 5), ("MeadStaminaLingering", 5) }), ("Builder Pack", new(string, int)[7] { ("Hammer", 1), ("Hoe", 1), ("Cultivator", 1), ("Wood", 50), ("Stone", 50), ("IronNails", 100), ("FineWood", 50) }) }; private string _creatureSearch = ""; private Vector2 _creatureScroll; private List _creWindowList; private int _creWindowFirst; private int _creWindowVisible; private int _creWindowTotal; private int _creatureCount = 1; private int _creatureLevel = 1; private List _creatureIndex; private string _creatureCat = "All"; private bool _spawnAtCrosshair; private string _petName = ""; private string _arenaA; private string _arenaB; private int _arenaCountA = 5; private int _arenaCountB = 5; private ConfigEntry _spawnPresetsCfg; private string _presetName = ""; private string _weather = ""; private float _timeSlider = 0.5f; private bool _timeLocked; private float _windAngle; private float _windIntensity = 0.5f; private bool _windLocked; private ConfigEntry _bookmarksCfg; private string _bookmarkName = ""; private string _tpX = "0"; private string _tpY = "0"; private string _tpZ = "0"; private string _newGlobalKey = ""; private bool _peaceful; private Vector2 _worldScroll; private static readonly (string Label, string Location)[] QuickJumps = new(string, string)[8] { ("Spawn", "StartTemple"), ("Eikthyr", "Eikthyrnir"), ("The Elder", "GDKing"), ("Bonemass", "Bonemass"), ("Moder", "Dragonqueen"), ("Yagluth", "GoblinKing"), ("The Queen", "Mistlands_DvergrBossEntrance1"), ("Fader", "FaderLocation") }; private bool _god; private bool _ghost; private bool _fly; private bool _noCost; private float _speedMult = 1f; private float _jumpMult = 1f; private bool _infiniteWeight; private bool _noStamina; private bool _oneHitKill; private float _pickupRange = 2f; private float _baseWalk = -1f; private float _baseRun; private float _baseSwim; private float _baseJump; private float _baseWeight; private float _basePickup; private Player _appliedTo; private string _seSearch = ""; private Vector2 _seScroll; private bool _showStatusEffects; private Vector2 _playerScroll; private bool _showSkills; private Vector2 _skillScroll; private string _skillCustom = "25"; private long _skillTargetId; private long _seTargetId; private string _skillMsg = ""; private static readonly SkillType[] AllSkillTypes = (from SkillType t in Enum.GetValues(typeof(SkillType)) where (int)t != 0 && (int)t != 999 select t).ToArray(); private Vector2 _playersScroll; private string _broadcastText = ""; private ConfigEntry _playerNotesCfg; private ConfigEntry _windowRectCfg; private bool _resizing; private bool _notesDirty; private Dictionary _playerNotes; private string _inspectPlayerName; private long _inspectTargetId; private List<(string name, int stack, int quality)> _inspectInventory; private bool _inspectPending; private float _inspectRequestTime; private Vector2 _inspectScroll; private readonly List _joinLog = new List(); private HashSet _lastSeenPlayers = new HashSet(); private bool _seenPlayersInit; private float _nextPlayerPoll; private float _nextInvClean; private Vector2 _serverScroll; private static readonly string[] RaidEvents = new string[14] { "army_eikthyr", "army_theelder", "army_bonemass", "army_moder", "army_goblin", "army_seekers", "army_gjall", "foresttrolls", "skeletons", "blobs", "surtlings", "wolves", "bats", "army_charred" }; private SideMode _sideMode; private SideMode _sideModeLayout; private Vector2 _sideScroll; private ConfigEntry _autoWhatsNewCfg; private ConfigEntry _seenVersionCfg; private ConfigEntry _bugWebhookCfg; private ConfigEntry _lastDeathCfg; private string _bugText = ""; private bool _bugAttachShot = true; private volatile string _bugStatus; private string _bugStatusLayout; private bool _bugCoolLayout; private bool _bugSending; private float _nextBugSend; private const string DiscordInvite = "https://discord.gg/2RVn78hNrz"; private const string DonateUrl = "https://www.paypal.com/donate/?business=HRKGKS3G5JD94&no_recurring=0&item_name=Your+Friendly+Neighborhood+Dev%2C+Halit.%0AMay+the+Lord+bless+you+with+even+more%21¤cy_code=USD"; private volatile string _updateAvailable; private string _updateBannerLayout; private volatile string _srvCompVersion; private string _versionWarnLayout; private float _nextVersionReq; private float _versionReqFirst; private const string ReleasesApi = "https://api.github.com/repos/hldblc/ValheimAdminPanel/releases/latest"; private const string ReleasesPage = "https://github.com/hldblc/ValheimAdminPanel/releases/latest"; private const string DefaultBugWebhook = "https://discord.com/api/webhooks/1527589135672672266/vqCLH1pZV8mRtKauUCcRxExWGwTazxkSJ6gz75Ey6yQoSfriVnuc4b07e3DYNvCaUPK3"; private const string WhatsNewText = "• The panel speaks your language: German, French, Spanish, Italian, Portuguese (BR), Polish, Dutch and Swedish. It follows Valheim's own language setting by default — change it under Settings → Language.\n\n• Smarter search: results are ranked by relevance, so typing \"iron\" puts Iron first instead of burying it alphabetically. Typing no longer re-sorts the whole list on every keystroke.\n\n• Multi-step undo: Undo spawn now steps back through your last 20 spawns instead of just one, and each admin has their own history — your undo can't delete someone else's work.\n\n• Destructive actions ask first: Kill ALL loaded, Ground items, Clear trees and Ban now need a second click to confirm.\n\n• Status effects for anyone: the status-effect browser now has the same Me/any-player target picker as the skill browser (needs companion 2.3.0 on the target).\n\n• Undo actually works on dedicated servers now — the destroy silently did nothing server-side unless the server owned the object.\n\n• Scrolling panel lists no longer zooms the vanilla camera (muted at the IL level, with startup verification in the log). ValheimPlus's separate FirstPerson zoom gets a best-effort mute too.\n\n• Layout survives big font sizes: labels never wrap mid-word and buttons no longer stretch across the row.\n\n• Server tab: added ZDOs loaded, zones loaded and session uptime.\n\n• Smoother: the panel does far less work per frame across every tab, and switches to a readable font automatically if the game's Norse font can't draw your language.\n\n• If the mod has been useful, there's now a \"Buy the developer a coffee\" button in Settings. Entirely optional — the mod is free and always will be."; private Vector2 _bossScroll; private static readonly (string Prefab, string Label, string OfferPrefab, int OfferCount)[] BossList = new(string, string, string, int)[7] { ("Eikthyr", "Eikthyr", "TrophyDeer", 2), ("gd_king", "The Elder", "AncientSeed", 3), ("Bonemass", "Bonemass", "WitheredBone", 10), ("Dragon", "Moder", "DragonEgg", 3), ("GoblinKing", "Yagluth", "GoblinTotem", 5), ("SeekerQueen", "The Queen", "DvergrKeyFragment", 9), ("Fader", "Fader", "BellFragment", 3) }; private GUIStyle _windowStyle; private GUIStyle _buttonStyle; private GUIStyle _labelStyle; private GUIStyle _headerStyle; private GUIStyle _textFieldStyle; private GUIStyle _toggleStyle; private GUIStyle _tabStyle; private GUIStyle _catStyle; private GUIStyle _rowEven; private GUIStyle _rowOdd; private GUIStyle _dimLabelStyle; private GUIStyle _textAreaStyle; private GUIStyle _cellStyle; private GUIStyle _dimCellStyle; private GUIStyle _hintStyle; private GUIStyle _proseStyle; private Texture2D _texWood; private Texture2D _texRule; private Texture2D _logoTex; private bool _logoTried; private float _logoAspect = 3.63f; private ConfigEntry _showLogoCfg; private bool _skinReady; private bool _fontApplied; private Font _appliedFont; private bool _wasInWorld; private float _nextFontTry; private int _fontTries; internal static bool NoStaminaFlag; internal static bool OneHitKillFlag; private string _presetsKvRaw; private string _bookmarksKvRaw; private Dictionary _presetsKv; private Dictionary _bookmarksKv; private List> _presetRowsLayout; private List> _bookmarkRowsLayout; private static MethodInfo _screenToWorld; private static readonly string[] SeBucketKeys = new string[6] { "se.boss_powers", "se.set_bonuses", "se.potions", "se.debuffs", "se.comfort", "se.other" }; private static readonly string[] SeDebuffKeys = new string[19] { "Burning", "Cold", "Freezing", "Frost", "Wet", "Poison", "Smoked", "Tared", "Harpooned", "Stagger", "Encumbered", "Slime", "Lightning", "Immobilized", "Barnacle", "Puke", "Debuff", "Curse", "Bleeding" }; private static readonly string[] SeComfortKeys = new string[11] { "Rested", "Resting", "Shelter", "Comfort", "Campfire", "Warm", "Fire", "Sated", "SoftDeath", "Sitting", "Bed" }; private string _seSearchApplied = ""; private string _seSearchLastSeen = ""; private float _seSearchDirtyAt = -1f; private Texture2D _coffeeTex; private bool _coffeeTried; private static bool? _companionLoadedHost; private static readonly string[] MainCatKeys = new string[14] { "cat.all", "cat.fav", "cat.recent", "cat.kits", "cat.weapons", "cat.shields", "cat.armor", "cat.accessories", "cat.ammo", "cat.tools", "cat.food", "cat.materials", "cat.trophies", "cat.misc" }; private string[] _mainCatLabels; private string[] _itemSortLabels; private string[] _creatureSortLabels; private string _labelsLang; private const float ConfirmWindowSeconds = 3f; private string _confirmAction; private float _confirmExpiresAt; private const float SearchDebounceSeconds = 0.15f; private string _itemSearchApplied = ""; private string _itemSearchLastSeen = ""; private float _itemSearchDirtyAt = -1f; private string _creatureSearchApplied = ""; private string _creatureSearchLastSeen = ""; private float _creatureSearchDirtyAt = -1f; private float _nextStatsRefresh; private string _statsMain = ""; private string _statsLoad = ""; private string _statsHost = ""; private string _unbanId = ""; private static Player LocalPlayer => Player.m_localPlayer; private void Awake() { //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) Instance = this; _toggleKey = ((BaseUnityPlugin)this).Config.Bind("General", "ToggleKey", (KeyCode)288, "Key that opens/closes the admin panel"); _mapTpKey = ((BaseUnityPlugin)this).Config.Bind("General", "MapTeleportKey", (KeyCode)116, "With the full map open, hover a spot and press this key to teleport there"); _favoritesCfg = ((BaseUnityPlugin)this).Config.Bind("Items", "Favorites", "", "Comma-separated favorite item prefabs"); _crafterNameCfg = ((BaseUnityPlugin)this).Config.Bind("Items", "CrafterName", "", "Crafter signature on given items (empty = none)"); _bulkPackCfg = ((BaseUnityPlugin)this).Config.Bind("Items", "BulkPack", "Wood:50,Stone:50,FineWood:30,Iron:30,BronzeNails:100", "Items granted by the Bulk Pack button (prefab:count, comma-separated)"); _spawnPresetsCfg = ((BaseUnityPlugin)this).Config.Bind("Creatures", "SpawnPresets", "", "Saved creature spawn presets"); _bookmarksCfg = ((BaseUnityPlugin)this).Config.Bind("World", "Bookmarks", "", "Saved teleport bookmarks"); _playerNotesCfg = ((BaseUnityPlugin)this).Config.Bind("Players", "Notes", "", "Per-player admin notes"); _windowRectCfg = ((BaseUnityPlugin)this).Config.Bind("General", "WindowRect", "60,60,740,680", "Admin panel window position+size x,y,width,height (auto-saved)"); _fontChoiceCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "Font", FontChoices[0], new ConfigDescription("Panel font. 'Norse (auto)' picks the best available game font; 'Default' is Unity's built-in font.", (AcceptableValueBase)(object)new AcceptableValueList(FontChoices), Array.Empty())); _fontSizeCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "FontSize", 13, new ConfigDescription("Base font size for panel text; headers, tabs and the title scale with it.", (AcceptableValueBase)(object)new AcceptableValueRange(10, 20), Array.Empty())); _languageCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "Language", Loc.MenuNames[0], new ConfigDescription("Panel language. 'Auto' follows Valheim's own language setting. Item and creature names always follow the game regardless of this setting.", (AcceptableValueBase)(object)new AcceptableValueList(Loc.MenuNames), Array.Empty())); _panelAlphaCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "PanelOpacity", 96, new ConfigDescription("Panel background opacity in percent.", (AcceptableValueBase)(object)new AcceptableValueRange(55, 100), Array.Empty())); _cameraLockCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "CameraLockWhilePanelOpen", true, "Lock mouse-look while the panel is open (like the inventory). Turn off to keep the camera live."); _showLogoCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "ShowLogoHeader", true, "Show the Advanced Admin Panel logo at the top of the panel."); _autoWhatsNewCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "ShowWhatsNewOnUpdate", true, "Open the What's New side panel once after the mod updates."); _seenVersionCfg = ((BaseUnityPlugin)this).Config.Bind("UI", "WhatsNewSeenVersion", "", "Last version whose What's New was shown (internal bookkeeping)."); _bugWebhookCfg = ((BaseUnityPlugin)this).Config.Bind("BugReport", "WebhookUrl", "https://discord.com/api/webhooks/1527589135672672266/vqCLH1pZV8mRtKauUCcRxExWGwTazxkSJ6gz75Ey6yQoSfriVnuc4b07e3DYNvCaUPK3", "Discord webhook that receives in-panel bug reports. Empty disables the Send button."); _lastDeathCfg = ((BaseUnityPlugin)this).Config.Bind("Player", "LastDeathPos", "", "Your last death position, auto-recorded for the 'TP to last death' button (x,y,z)."); _fontSizeLive = _fontSizeCfg.Value; _panelAlphaLive = _panelAlphaCfg.Value; try { string[] array = _windowRectCfg.Value.Split(new char[1] { ',' }); if (array.Length == 4 && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3) && float.TryParse(array[3], out var result4)) { _windowRect = new Rect(result, result2, result3, result4); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Bad WindowRect config, using default: " + ex.Message)); } _lastSavedRect = _windowRect; _favorites = new HashSet(_favoritesCfg.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries), StringComparer.OrdinalIgnoreCase); _playerNotes = ParseKv(_playerNotesCfg.Value); Harmony.CreateAndPatchAll(typeof(RpcRegistration), (string)null); Harmony.CreateAndPatchAll(typeof(CheatPatches), (string)null); try { Harmony.CreateAndPatchAll(typeof(CursorPatch), (string)null); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Cursor patch failed (panel still works): " + ex2.Message)); } try { Harmony.CreateAndPatchAll(typeof(InputBlockPatch), (string)null); } catch (Exception ex3) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Input-block patch failed (panel still works): " + ex3.Message)); } try { Harmony.CreateAndPatchAll(typeof(BlockAttackPatch), (string)null); } catch (Exception ex4) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Attack-block patch failed (panel still works): " + ex4.Message)); } try { Harmony.CreateAndPatchAll(typeof(CameraLockPatch), (string)null); } catch (Exception ex5) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Camera-lock patch failed (panel still works): " + ex5.Message)); } try { Harmony.CreateAndPatchAll(typeof(DeathPointPatch), (string)null); } catch (Exception ex6) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Death-point patch failed (panel still works): " + ex6.Message)); } try { Harmony.CreateAndPatchAll(typeof(ZoomFreezeCameraTranspiler), (string)null); } catch (Exception ex7) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Zoom-freeze camera transpiler failed (panel still works): " + ex7.Message)); } try { Harmony.CreateAndPatchAll(typeof(ZoomFreezeFreeFlyTranspiler), (string)null); } catch (Exception ex8) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Zoom-freeze free-fly transpiler failed (panel still works): " + ex8.Message)); } PatchValheimPlusZoomIfPresent(); VerifyCameraPatches(); try { Harmony.CreateAndPatchAll(typeof(MenuVersionPatch), (string)null); } catch (Exception ex9) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Menu version-line patch failed (panel still works): " + ex9.Message)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} {1} loaded. Press {2} in-game.", "AdminPanel", "2.3.0", _toggleKey.Value)); StartUpdateCheck(); } private void PatchValheimPlusZoomIfPresent() { //IL_0045: 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_0069: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("ValheimPlus.FirstPerson.VPlusFirstPerson+GameCamera_Update_Patch"); MethodInfo methodInfo = ((type != null) ? AccessTools.Method(type, "Postfix", (Type[])null, (Type[])null) : null); if (methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"ValheimPlus FirstPerson patch not found — cross-mod zoom mute not needed."); } else { new Harmony("com.halitb.adminpanel.crossmod").Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ZoomWheelMute), "VPlusAxisTranspiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Cross-mod zoom mute failed (panel still works): " + ex.Message)); } } private void VerifyCameraPatches() { try { List<(string, MethodBase)> list = new List<(string, MethodBase)> { ("UpdateCamera", AccessTools.Method(typeof(GameCamera), "UpdateCamera", (Type[])null, (Type[])null)), ("UpdateFreeFly", AccessTools.Method(typeof(GameCamera), "UpdateFreeFly", (Type[])null, (Type[])null)) }; Type type = AccessTools.TypeByName("ValheimPlus.FirstPerson.VPlusFirstPerson+GameCamera_Update_Patch"); if (type != null) { list.Add(("V+ FP.Postfix", AccessTools.Method(type, "Postfix", (Type[])null, (Type[])null))); } foreach (var item3 in list) { string item = item3.Item1; MethodBase item2 = item3.Item2; Patches val = ((item2 != null) ? Harmony.GetPatchInfo(item2) : null); if (val == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("patch-verify " + item + ": NO patches bound")); continue; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("patch-verify " + item + ": " + $"{val.Prefixes.Count} prefix, {val.Postfixes.Count} postfix, {val.Transpilers.Count} transpiler " + "[" + string.Join(", ", val.Transpilers.Select((Patch p) => p.PatchMethod.DeclaringType?.Name)) + "]")); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("patch-verify failed: " + ex.Message)); } } private void StartUpdateCheck() { Task.Run(delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown try { ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; HttpClient val = new HttpClient(); try { val.Timeout = TimeSpan.FromSeconds(10.0); val.DefaultRequestHeaders.UserAgent.ParseAdd("AdvancedAdminPanel/2.3.0"); Match match = Regex.Match(val.GetStringAsync("https://api.github.com/repos/hldblc/ValheimAdminPanel/releases/latest").GetAwaiter().GetResult(), "\"tag_name\"\\s*:\\s*\"v?([0-9.]+)\""); if (match.Success && new Version(match.Groups[1].Value) > new Version("2.3.0")) { _updateAvailable = match.Groups[1].Value; } } finally { ((IDisposable)val)?.Dispose(); } } catch { } }); } private static string EncKv(string s) { if (!string.IsNullOrEmpty(s)) { return s.Replace("%", "%25").Replace("|", "%7C").Replace("=", "%3D"); } return s; } private static string DecKv(string s) { if (!string.IsNullOrEmpty(s)) { return s.Replace("%3D", "=").Replace("%7C", "|").Replace("%25", "%"); } return s; } private Dictionary PresetsKv() { string text = _spawnPresetsCfg.Value ?? ""; if (_presetsKv == null || _presetsKvRaw != text) { _presetsKv = ParseKv(text); _presetsKvRaw = text; } return _presetsKv; } private Dictionary BookmarksKv() { string text = _bookmarksCfg.Value ?? ""; if (_bookmarksKv == null || _bookmarksKvRaw != text) { _bookmarksKv = ParseKv(text); _bookmarksKvRaw = text; } return _bookmarksKv; } private List> PresetRows() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((Event.current != null && (int)Event.current.type == 8) || _presetRowsLayout == null) { _presetRowsLayout = new List>(PresetsKv()); } return _presetRowsLayout; } private List> BookmarkRows() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((Event.current != null && (int)Event.current.type == 8) || _bookmarkRowsLayout == null) { _bookmarkRowsLayout = new List>(BookmarksKv()); } return _bookmarkRowsLayout; } private static Dictionary ParseKv(string raw) { Dictionary dictionary = new Dictionary(); string[] array = raw.Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { int num = text.IndexOf('='); if (num > 0) { dictionary[DecKv(text.Substring(0, num))] = DecKv(text.Substring(num + 1)); } } return dictionary; } private static string JoinKv(Dictionary dict) { return string.Join("|", dict.Select((KeyValuePair kv) => EncKv(kv.Key) + "=" + EncKv(kv.Value))); } private static void OnVersionData(long sender, string version) { if ((Object)(object)Instance != (Object)null) { Instance._srvCompVersion = version; } } private static void OnInventoryData(long sender, ZPackage pkg) { AdminPanelPlugin instance = Instance; if ((Object)(object)instance == (Object)null) { return; } try { string inspectPlayerName = pkg.ReadString(); int num = pkg.ReadInt(); if (num >= 0 && num <= 512) { List<(string, int, int)> list = new List<(string, int, int)>(); for (int i = 0; i < num; i++) { string item = pkg.ReadString(); int item2 = pkg.ReadInt(); int item3 = pkg.ReadInt(); list.Add((item, item2, item3)); } instance._inspectPlayerName = inspectPlayerName; instance._inspectInventory = list; instance._inspectPending = false; } } catch (Exception) { } } private static long PeerIdOf(PlayerInfo info) { return ((ZDOID)(ref info.m_characterID)).UserID; } private static long ServerUid() { return (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetServerPeer() : null)?.m_uid ?? 0; } private long SelfUid() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNet.instance == (Object)null || (Object)(object)LocalPlayer == (Object)null) { return 0L; } string playerName = LocalPlayer.GetPlayerName(); foreach (PlayerInfo player in ZNet.instance.GetPlayerList()) { if (player.m_name == playerName) { return PeerIdOf(player); } } return 0L; } private void Update() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Invalid comparison between Unknown and I4 if (_rebindTarget == 0 && Input.GetKeyDown(_toggleKey.Value)) { _visible = !_visible; if (_visible) { Loc.Refresh(_languageCfg.Value); RefreshCaches(); if (_autoWhatsNewCfg.Value && _seenVersionCfg.Value != "2.3.0") { _sideMode = SideMode.WhatsNew; _seenVersionCfg.Value = "2.3.0"; ((BaseUnityPlugin)this).Config.Save(); } } else { FlushNotes(); CommitUiSettings(); _openDropdown = null; } } if (_visible && (((_itemIndex == null || _seIndex == null) && (Object)(object)ObjectDB.instance != (Object)null) || (_creatureIndex == null && (Object)(object)ZNetScene.instance != (Object)null))) { RefreshCaches(); } if (_rebindTarget == 0 && Input.GetKeyDown(_mapTpKey.Value) && (Object)(object)LocalPlayer != (Object)null && (Object)(object)Minimap.instance != (Object)null && (int)Minimap.instance.m_mode == 2) { TeleportToMapCursor(); } if (_visible && Input.GetMouseButtonUp(0)) { CommitUiSettings(); } EventSystem current = EventSystem.current; if ((Object)(object)current != (Object)null && !((Behaviour)current).enabled) { ((Behaviour)current).enabled = true; } if (_visible && _srvCompVersion == null && (Object)(object)ZNet.instance != (Object)null && Time.time >= _nextVersionReq) { _nextVersionReq = Time.time + 30f; if (_versionReqFirst == 0f) { _versionReqFirst = Time.time; } SrvRpc("AP_SrvVersion"); } if ((Object)(object)ZNet.instance != (Object)null) { _wasInWorld = true; } else if (_wasInWorld) { _wasInWorld = false; ResetSessionState(); } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && (Object)(object)localPlayer != (Object)(object)_appliedTo) { ReapplyPlayerState(localPlayer); _appliedTo = localPlayer; } if ((Object)(object)localPlayer != (Object)null && Time.time >= _nextInvClean) { _nextInvClean = Time.time + 2f; Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (inventory != null) { List list = (from i in inventory.GetAllItems() where i.m_shared == null || i.m_shared.m_icons == null || i.m_shared.m_icons.Length == 0 select i).ToList(); if (list.Count > 0) { foreach (ItemData item in list) { inventory.RemoveItem(item); } ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Auto-removed {list.Count} icon-less item(s) that would freeze the inventory."); ((Character)localPlayer).Message((MessageType)1, $"[Admin] Removed {list.Count} broken item(s) from your bag", 0, (Sprite)null); } } } if (!((Object)(object)ZNet.instance != (Object)null) || !(Time.time >= _nextPlayerPoll)) { return; } _nextPlayerPoll = Time.time + 3f; HashSet hashSet = new HashSet(from p in ZNet.instance.GetPlayerList() select p.m_name); if (_seenPlayersInit) { foreach (string item2 in hashSet.Except(_lastSeenPlayers)) { _joinLog.Insert(0, $"{DateTime.Now:HH:mm} + {item2} joined"); } foreach (string item3 in _lastSeenPlayers.Except(hashSet)) { _joinLog.Insert(0, $"{DateTime.Now:HH:mm} - {item3} left"); } } else { _seenPlayersInit = true; } if (_joinLog.Count > 100) { _joinLog.RemoveRange(100, _joinLog.Count - 100); } _lastSeenPlayers = hashSet; } private void OnDisable() { FlushNotes(); } private void ResetSessionState() { FlushNotes(); _visible = false; _itemIndex = null; _seIndex = null; _creatureIndex = null; _creatureCats = null; _filteredItemsCache = null; _itemFilterKey = ""; _filteredCreaturesCache = null; _creatureFilterKey = ""; _seFilteredCache = null; _seFilterKey = null; _subCatsCache = null; _subCatsKey = null; _itemWindowList = null; _creWindowList = null; _othersSnapshot = null; _recentItems.Clear(); _recentVersion++; _giveTargetId = 0L; _openDropdown = null; _openDropdownLayout = null; _sideMode = SideMode.None; _inspectPlayerName = null; _inspectInventory = null; _inspectPending = false; _inspectTargetId = 0L; _joinLog.Clear(); _lastSeenPlayers.Clear(); _seenPlayersInit = false; _skillTargetId = 0L; _skillMsg = ""; _srvCompVersion = null; _versionReqFirst = 0f; _nextVersionReq = 0f; _appliedTo = null; _baseWalk = -1f; } private void FlushNotes() { if (_notesDirty) { _playerNotesCfg.Value = JoinKv(_playerNotes); ((BaseUnityPlugin)this).Config.Save(); _notesDirty = false; } } private void ReapplyPlayerState(Player p) { _baseWalk = ((Character)p).m_walkSpeed; _baseRun = ((Character)p).m_runSpeed; _baseSwim = ((Character)p).m_swimSpeed; _baseJump = ((Character)p).m_jumpForce; _baseWeight = p.m_maxCarryWeight; _basePickup = p.m_autoPickupRange; if (_god) { p.SetGodMode(true); } if (_ghost) { p.SetGhostMode(true); } if (_noCost) { p.SetNoPlacementCost(true); } if (_infiniteWeight) { p.m_maxCarryWeight = 100000f; } if (_speedMult > 1.001f) { ((Character)p).m_walkSpeed = _baseWalk * _speedMult; ((Character)p).m_runSpeed = _baseRun * _speedMult; ((Character)p).m_swimSpeed = _baseSwim * _speedMult; } if (_jumpMult > 1.001f) { ((Character)p).m_jumpForce = _baseJump * _jumpMult; } if (_pickupRange > 2.001f) { p.m_autoPickupRange = _pickupRange; } _fly = false; } private void TeleportToMapCursor() { //IL_006a: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (_screenToWorld == null) { _screenToWorld = AccessTools.Method(typeof(Minimap), "ScreenToWorldPoint", new Type[1] { typeof(Vector3) }, (Type[])null); } if (_screenToWorld == null) { Message(Loc.T("world.msg_map_tp_unavailable")); return; } Vector3 val = (Vector3)_screenToWorld.Invoke(Minimap.instance, new object[1] { Input.mousePosition }); TeleportToWorld(val, $"map point ({val.x:0}, {val.z:0})"); } private void TeleportToWorld(Vector3 world, string label) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) float num = world.y; float num2 = default(float); if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(world, ref num2)) { num = num2; } ((Character)LocalPlayer).TeleportTo(new Vector3(world.x, num + 1.5f, world.z), ((Component)LocalPlayer).transform.rotation, true); Message(Loc.T("world.msg_tp_to", label)); } private static (string cat, string sub) Categorize(ItemDrop drop) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected I4, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 SharedData shared = drop.m_itemData.m_shared; ItemType itemType = shared.m_itemType; switch (itemType - 1) { case 2: case 3: case 13: case 21: if ((int)shared.m_skillType == 12) { return (cat: "Tools", sub: "Pickaxes"); } return (cat: "Weapons", sub: ((object)Unsafe.As(ref shared.m_skillType)/*cast due to .constrained prefix*/).ToString()); case 4: return (cat: "Shields", sub: "All"); case 5: return (cat: "Armor", sub: "Helmets"); case 6: return (cat: "Armor", sub: "Chest"); case 10: return (cat: "Armor", sub: "Legs"); case 16: return (cat: "Armor", sub: "Capes"); case 9: case 17: return (cat: "Accessories", sub: "All"); case 8: case 22: return (cat: "Ammo", sub: "All"); case 1: return (cat: "Food & Potions", sub: (shared.m_food > 0f) ? "Food" : "Potions & Other"); case 14: case 18: return (cat: "Tools", sub: "All"); case 12: return (cat: "Trophies", sub: "All"); case 0: { string value; return (cat: "Materials", sub: MaterialBiome.TryGetValue(((Object)drop).name, out value) ? value : "Other"); } default: return (cat: "Misc", sub: "All"); } } private static string LocalizeSafe(string token, string fallback) { string text = ((Localization.instance != null) ? Localization.instance.Localize(token) : fallback); if (string.IsNullOrEmpty(text) || text.StartsWith("[")) { text = fallback; } return text; } private static string ShortDesc(string token, int max) { string text = LocalizeSafe(token, ""); if (string.IsNullOrEmpty(text)) { return ""; } text = text.Replace('\n', ' ').Replace('\r', ' ').Trim(); if (text.Length > max) { text = text.Substring(0, max).TrimEnd(Array.Empty()) + "…"; } return text; } private static string BuildDamageLine(DamageTypes d) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_016f: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) List list = new List(4); if (d.m_damage > 0f) { list.Add($"Dmg {d.m_damage:0}"); } if (d.m_blunt > 0f) { list.Add($"Blunt {d.m_blunt:0}"); } if (d.m_slash > 0f) { list.Add($"Slash {d.m_slash:0}"); } if (d.m_pierce > 0f) { list.Add($"Pierce {d.m_pierce:0}"); } if (d.m_chop > 0f) { list.Add($"Chop {d.m_chop:0}"); } if (d.m_pickaxe > 0f) { list.Add($"Pickaxe {d.m_pickaxe:0}"); } if (d.m_fire > 0f) { list.Add($"Fire {d.m_fire:0}"); } if (d.m_frost > 0f) { list.Add($"Frost {d.m_frost:0}"); } if (d.m_lightning > 0f) { list.Add($"Lightning {d.m_lightning:0}"); } if (d.m_poison > 0f) { list.Add($"Poison {d.m_poison:0}"); } if (d.m_spirit > 0f) { list.Add($"Spirit {d.m_spirit:0}"); } return string.Join(" · ", list); } private static string BuildStatLine(SharedData s) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected I4, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (s == null) { return ""; } if (s.m_food > 0f) { List list = new List(4); list.Add($"+{s.m_food:0} HP"); if (s.m_foodStamina > 0f) { list.Add($"+{s.m_foodStamina:0} ST"); } if (s.m_foodEitr > 0f) { list.Add($"+{s.m_foodEitr:0} Eitr"); } list.Add($"{s.m_foodBurnTime:0}s"); return string.Join(" · ", list); } ItemType itemType = s.m_itemType; switch (itemType - 3) { case 0: case 1: case 6: case 11: case 12: case 17: case 19: case 20: { string text2 = BuildDamageLine(s.m_damages); if (text2.Length <= 0) { return ShortDesc(s.m_description, 60); } return text2; } case 3: case 4: case 8: case 14: { string text = $"Armor {s.m_armor:0}"; if (s.m_armorPerLevel > 0f) { text += $" (+{s.m_armorPerLevel:0}/lv)"; } return text; } case 2: return $"Block {s.m_blockPower:0}"; default: return ShortDesc(s.m_description, 60); } } private static int ClassifySe(string name) { if (string.IsNullOrEmpty(name)) { return 5; } if (name.StartsWith("GP_", StringComparison.OrdinalIgnoreCase)) { return 0; } if (name.StartsWith("SetEffect_", StringComparison.OrdinalIgnoreCase)) { return 1; } if (name.StartsWith("Potion_", StringComparison.OrdinalIgnoreCase)) { return 2; } string[] seDebuffKeys = SeDebuffKeys; foreach (string value in seDebuffKeys) { if (name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { return 3; } } seDebuffKeys = SeComfortKeys; foreach (string value2 in seDebuffKeys) { if (name.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { return 4; } } return 5; } private List FilteredStatusEffects() { string q = DebounceSearch(_seSearch, ref _seSearchApplied, ref _seSearchLastSeen, ref _seSearchDirtyAt); if (_seFilteredCache != null && q == _seFilterKey) { return _seFilteredCache; } if (_seIndex == null) { _seFilteredCache = new List(); _seFilterKey = q; return _seFilteredCache; } IEnumerable source = _seIndex; if (!string.IsNullOrEmpty(q)) { source = _seIndex.Where((SeEntry e) => e.Display.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)e.Se).name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0); } _seFilteredCache = source.ToList(); _seFilterKey = q; return _seFilteredCache; } private void RefreshCaches() { _itemIndex = null; _seIndex = null; _seFilteredCache = null; _seFilterKey = null; _creatureIndex = null; _creatureCats = null; _subCatsCache = null; _subCatsKey = null; if ((Object)(object)ObjectDB.instance != (Object)null) { _itemIndex = (from e in (from go in ObjectDB.instance.m_items select go.GetComponent() into id where (Object)(object)id != (Object)null select id).Select(delegate(ItemDrop id) { var (cat, sub) = Categorize(id); return new ItemEntry { Drop = id, Prefab = ((Object)id).name, Display = LocalizeSafe(id.m_itemData.m_shared.m_name, ((Object)id).name), Info = BuildStatLine(id.m_itemData.m_shared), Cat = cat, Sub = sub }; }) orderby e.Cat, e.Sub, e.Display select e).ToList(); _seIndex = (from se in ObjectDB.instance.m_StatusEffects where (Object)(object)se != (Object)null select new SeEntry { Se = se, Display = LocalizeSafe(se.m_name, ((Object)se).name), Tooltip = ShortDesc(se.m_tooltip, 90), Hash = se.NameHash(), Bucket = ClassifySe(((Object)se).name) } into e orderby e.Bucket select e).ThenBy((SeEntry e) => e.Display, StringComparer.OrdinalIgnoreCase).ToList(); } if ((Object)(object)ZNetScene.instance != (Object)null) { _creatureIndex = (from e in ZNetScene.instance.m_prefabs.Where((GameObject p) => (Object)(object)p != (Object)null && (Object)(object)p.GetComponent() != (Object)null && (Object)(object)p.GetComponent() == (Object)null).Select(delegate(GameObject p) { Character component = p.GetComponent(); return new CreatureEntry { Prefab = p, Name = ((Object)p).name, Display = LocalizeSafe(component.m_name, ((Object)p).name), Faction = ((object)Unsafe.As(ref component.m_faction)/*cast due to .constrained prefix*/).ToString(), Boss = component.IsBoss(), Tamable = ((Object)(object)p.GetComponent() != (Object)null) }; }) orderby e.Faction, e.Display select e).ToList(); _creatureCats = new List { "All", "Bosses", "Tamable" }; _creatureCats.AddRange(from f in _creatureIndex.Select((CreatureEntry e) => e.Faction).Distinct() orderby f select f); } } private static Texture2D SolidTex(Color c) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, c); val.Apply(); return val; } private void EnsureSkin() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Expected O, but got Unknown //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0322: 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_0333: Expected O, but got Unknown //IL_033e: 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_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0398: 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_03b5: Expected O, but got Unknown //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Expected O, but got Unknown //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: 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_0402: Expected O, but got Unknown //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Expected O, but got Unknown //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Expected O, but got Unknown //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Expected O, but got Unknown //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Expected O, but got Unknown //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Expected O, but got Unknown //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Expected O, but got Unknown //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Expected O, but got Unknown //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Expected O, but got Unknown //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Expected O, but got Unknown //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Expected O, but got Unknown //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Expected O, but got Unknown //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Expected O, but got Unknown //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Expected O, but got Unknown if (!_skinReady || !((Object)(object)_texWood != (Object)null)) { _texWood = SolidTex(WoodColor(_panelAlphaLive)); _texRule = SolidTex(new Color(0.62f, 0.46f, 0.22f, 0.45f)); Texture2D background = SolidTex(new Color(0.22f, 0.16f, 0.1f, 1f)); Texture2D background2 = SolidTex(new Color(0.31f, 0.23f, 0.13f, 1f)); Texture2D background3 = SolidTex(new Color(0.16f, 0.115f, 0.07f, 1f)); Texture2D background4 = SolidTex(new Color(0.07f, 0.05f, 0.035f, 1f)); Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.87f, 0.79f, 0.62f); Color textColor2 = default(Color); ((Color)(ref textColor2))..ctor(0.98f, 0.78f, 0.35f); _windowStyle = new GUIStyle(GUI.skin.window); _windowStyle.normal.background = _texWood; _windowStyle.onNormal.background = _texWood; _windowStyle.normal.textColor = textColor2; _windowStyle.onNormal.textColor = textColor2; _windowStyle.fontStyle = (FontStyle)1; _windowStyle.fontSize = 15; _buttonStyle = new GUIStyle(GUI.skin.button); _buttonStyle.normal.background = background; _buttonStyle.hover.background = background2; _buttonStyle.active.background = background3; _buttonStyle.onNormal.background = background2; _buttonStyle.normal.textColor = textColor; _buttonStyle.hover.textColor = textColor2; _buttonStyle.active.textColor = textColor2; _buttonStyle.onNormal.textColor = textColor2; _buttonStyle.fontStyle = (FontStyle)1; _labelStyle = new GUIStyle(GUI.skin.label) { fontSize = 13 }; _labelStyle.normal.textColor = textColor; _labelStyle.stretchWidth = false; _labelStyle.wordWrap = false; _headerStyle = new GUIStyle(_labelStyle) { fontStyle = (FontStyle)1, fontSize = 14 }; _headerStyle.normal.textColor = textColor2; _textFieldStyle = new GUIStyle(GUI.skin.textField); _textFieldStyle.normal.background = background4; _textFieldStyle.focused.background = background4; _textFieldStyle.hover.background = background4; _textFieldStyle.normal.textColor = textColor; _textFieldStyle.focused.textColor = textColor2; _textFieldStyle.hover.textColor = textColor; _textAreaStyle = new GUIStyle(_textFieldStyle) { wordWrap = true }; _toggleStyle = new GUIStyle(GUI.skin.toggle) { fontSize = 13, stretchWidth = false }; _toggleStyle.normal.textColor = textColor; _toggleStyle.onNormal.textColor = textColor2; _toggleStyle.hover.textColor = textColor; _toggleStyle.onHover.textColor = textColor2; _buttonStyle.padding = new RectOffset(10, 10, 5, 5); _buttonStyle.margin = new RectOffset(3, 3, 3, 3); _buttonStyle.fontSize = 13; _buttonStyle.stretchWidth = false; _tabStyle = new GUIStyle(_buttonStyle) { fontSize = 14, stretchWidth = true }; _tabStyle.padding = new RectOffset(12, 12, 8, 8); _tabStyle.margin = new RectOffset(3, 3, 4, 4); Texture2D background5 = SolidTex(new Color(0.42f, 0.3f, 0.12f, 1f)); _tabStyle.onNormal.background = background5; _tabStyle.onHover.background = background5; _catStyle = new GUIStyle(_buttonStyle) { fontSize = 12, stretchWidth = true }; _catStyle.padding = new RectOffset(10, 10, 6, 6); _catStyle.margin = new RectOffset(3, 3, 4, 4); _catStyle.onNormal.background = background5; _catStyle.onHover.background = background5; _rowEven = new GUIStyle(); _rowEven.padding = new RectOffset(4, 4, 3, 3); _rowOdd = new GUIStyle(_rowEven); _rowOdd.normal.background = SolidTex(new Color(1f, 1f, 1f, 0.035f)); _dimLabelStyle = new GUIStyle(_labelStyle) { fontSize = 12 }; _dimLabelStyle.normal.textColor = new Color(0.62f, 0.55f, 0.44f); _cellStyle = new GUIStyle(_labelStyle) { wordWrap = false, clipping = (TextClipping)1 }; _dimCellStyle = new GUIStyle(_dimLabelStyle) { wordWrap = false, clipping = (TextClipping)1 }; _hintStyle = new GUIStyle(_dimLabelStyle) { wordWrap = true, stretchWidth = true }; _proseStyle = new GUIStyle(_labelStyle) { wordWrap = true, stretchWidth = true }; ApplyFontSizes(); _skinReady = true; } } private static Font FindValheimFont() { Font[] source = Resources.FindObjectsOfTypeAll(); return ((IEnumerable)source).FirstOrDefault((Func)((Font f) => ((Object)f).name.IndexOf("Norsebold", StringComparison.OrdinalIgnoreCase) >= 0)) ?? ((IEnumerable)source).FirstOrDefault((Func)((Font f) => ((Object)f).name.IndexOf("AveriaSerifLibre", StringComparison.OrdinalIgnoreCase) >= 0)) ?? ((IEnumerable)source).FirstOrDefault((Func)((Font f) => ((Object)f).name.IndexOf("Norse", StringComparison.OrdinalIgnoreCase) >= 0)); } private static Font FindFontFor(string choice) { Font[] source = Resources.FindObjectsOfTypeAll(); return (Font)(choice switch { "Norse Bold" => ((IEnumerable)source).FirstOrDefault((Func)((Font f) => ((Object)f).name.IndexOf("Norsebold", StringComparison.OrdinalIgnoreCase) >= 0)), "Norse" => ((IEnumerable)source).FirstOrDefault((Func)((Font f) => ((Object)f).name.IndexOf("Norse", StringComparison.OrdinalIgnoreCase) >= 0 && ((Object)f).name.IndexOf("bold", StringComparison.OrdinalIgnoreCase) < 0)), "Averia Serif" => ((IEnumerable)source).FirstOrDefault((Func)((Font f) => ((Object)f).name.IndexOf("AveriaSerifLibre", StringComparison.OrdinalIgnoreCase) >= 0)), _ => FindValheimFont(), }); } private IEnumerable ContentFontSamples() { int n = 0; if (_itemIndex != null) { foreach (ItemEntry item in _itemIndex) { if (n++ >= 200) { break; } yield return item.Display; } } n = 0; if (_creatureIndex == null) { yield break; } foreach (CreatureEntry item2 in _creatureIndex) { if (n++ >= 200) { break; } yield return item2.Display; } } private void ApplyFont() { if (_fontApplied && (Object)(object)_appliedFont == (Object)null && _fontChoiceCfg.Value != "Default") { _fontApplied = false; _fontTries = 0; _appliedFont = null; } if (_fontApplied) { return; } Font val = null; if (_fontChoiceCfg.Value != "Default") { if (Time.time < _nextFontTry) { return; } _nextFontTry = Time.time + 1f; val = FindFontFor(_fontChoiceCfg.Value); if ((Object)(object)val == (Object)null && ++_fontTries < 10) { return; } if ((Object)(object)val != (Object)null && Loc.ResolveFontSafety(val, ContentFontSamples())) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Font '" + ((Object)val).name + "' lacks glyphs for the current language; using the default font instead.")); val = null; } } GUIStyle[] array = (GUIStyle[])(object)new GUIStyle[16] { _windowStyle, _buttonStyle, _labelStyle, _headerStyle, _textFieldStyle, _toggleStyle, _tabStyle, _catStyle, _rowEven, _rowOdd, _dimLabelStyle, _textAreaStyle, _cellStyle, _dimCellStyle, _hintStyle, _proseStyle }; foreach (GUIStyle val2 in array) { if (val2 != null) { val2.font = val; } } _appliedFont = val; _fontApplied = true; } private static Texture2D LoadEmbeddedPng(string fileSuffix) { //IL_00db: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string n) => n.EndsWith(fileSuffix, StringComparison.OrdinalIgnoreCase)); if (text == null) { return null; } byte[] array; using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream == null) { return null; } array = new byte[stream.Length]; int num2; for (int num = 0; num < array.Length; num += num2) { num2 = stream.Read(array, num, array.Length - num); if (num2 <= 0) { break; } } } MethodInfo methodInfo = AccessTools.Method(AccessTools.TypeByName("UnityEngine.ImageConversion"), "LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }, (Type[])null); if (methodInfo == null) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true) { filterMode = (FilterMode)2, hideFlags = (HideFlags)61 }; return ((bool)methodInfo.Invoke(null, new object[2] { val, array })) ? val : null; } catch { return null; } } private Texture2D CoffeeTex() { if (_coffeeTried && (Object)(object)_coffeeTex != (Object)null) { return _coffeeTex; } _coffeeTried = true; _coffeeTex = LoadEmbeddedPng("coffee.png"); return _coffeeTex; } private void DrawCoffeeButton(float minWidth) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown Texture2D val = CoffeeTex(); string text = Loc.T("set.buy_coffee"); if (GUILayout.Button(((Object)(object)val != (Object)null) ? new GUIContent(" " + text, (Texture)(object)val) : new GUIContent(text), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.MinWidth(minWidth), GUILayout.Height(28f) })) { Application.OpenURL("https://www.paypal.com/donate/?business=HRKGKS3G5JD94&no_recurring=0&item_name=Your+Friendly+Neighborhood+Dev%2C+Halit.%0AMay+the+Lord+bless+you+with+even+more%21¤cy_code=USD"); } } private Texture2D LogoTex() { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown if (_logoTried) { return _logoTex; } _logoTried = true; try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string n) => n.EndsWith("logo.png", StringComparison.OrdinalIgnoreCase)); if (text == null) { return null; } byte[] array; using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream == null) { return null; } array = new byte[stream.Length]; int num2; for (int num = 0; num < array.Length; num += num2) { num2 = stream.Read(array, num, array.Length - num); if (num2 <= 0) { break; } } } MethodInfo methodInfo = AccessTools.Method(AccessTools.TypeByName("UnityEngine.ImageConversion"), "LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }, (Type[])null); if (methodInfo == null) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true) { filterMode = (FilterMode)2, hideFlags = (HideFlags)61 }; if (!(bool)methodInfo.Invoke(null, new object[2] { val, array })) { return null; } _logoAspect = (float)((Texture)val).width / (float)((Texture)val).height; _logoTex = val; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Logo header failed to load (panel still works): " + ex.Message)); } return _logoTex; } private Vector2 LogoSize() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(((Rect)(ref _windowRect)).width * 0.55f, 430f); return new Vector2(num, num / _logoAspect); } private float LogoHeaderHeight() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_logoTex == (Object)null || _showLogoCfg == null || !_showLogoCfg.Value) { return 0f; } return LogoSize().y + 6f; } private void DrawLogoHeader() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)LogoTex() == (Object)null) && _showLogoCfg.Value) { Vector2 val = LogoSize(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.FlexibleSpace(); Rect rect = GUILayoutUtility.GetRect(val.x, val.y, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(val.x), GUILayout.Height(val.y) }); if ((int)Event.current.type == 7) { GUI.DrawTexture(rect, (Texture)(object)_logoTex, (ScaleMode)2, true); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(6f); } } private static bool CompanionLoadedInProcess() { _companionLoadedHost = _companionLoadedHost ?? (AccessTools.TypeByName("AdminPanelCompanion.CompanionPlugin") != null); return _companionLoadedHost.Value; } private string CompanionWarning() { if ((Object)(object)ZNet.instance == (Object)null) { return null; } if (ZNet.instance.IsServer() && !CompanionLoadedInProcess()) { return Loc.T("chrome.companion_missing_host"); } if (_srvCompVersion != null) { if (!(_srvCompVersion == "2.3.0")) { return Loc.T("chrome.version_mismatch", "2.3.0", _srvCompVersion); } return null; } if (!ZNet.instance.IsServer() && _versionReqFirst > 0f && Time.time - _versionReqFirst > 15f) { return Loc.T("chrome.companion_silent"); } return null; } private void DrawSection(string title) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_0064: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(10f); Rect rect = GUILayoutUtility.GetRect(1f, 2f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if ((int)Event.current.type == 7 && (Object)(object)_texRule != (Object)null) { GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - 14f, 2f), (Texture)(object)_texRule); } GUILayout.Space(4f); if (!string.IsNullOrEmpty(title)) { GUILayout.Label(title, _headerStyle, Array.Empty()); } } private void OnGUI() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Invalid comparison between Unknown and I4 //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) if (_visible) { EnsureSkin(); ApplyFont(); ((Rect)(ref _windowRect)).width = Mathf.Clamp(((Rect)(ref _windowRect)).width, 660f, (float)Screen.width); ((Rect)(ref _windowRect)).height = Mathf.Clamp(((Rect)(ref _windowRect)).height, 300f, (float)Screen.height); ((Rect)(ref _windowRect)).x = Mathf.Clamp(((Rect)(ref _windowRect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _windowRect)).width)); ((Rect)(ref _windowRect)).y = Mathf.Clamp(((Rect)(ref _windowRect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _windowRect)).height)); bool flag = (Object)(object)_logoTex != (Object)null && _showLogoCfg.Value; _windowRect = GUI.Window(918273, _windowRect, new WindowFunction(DrawWindow), flag ? Loc.T("chrome.title_hint", _toggleKey.Value) : Loc.T("chrome.title_full", _toggleKey.Value), _windowStyle); if ((int)Event.current.type == 1) { SaveWindowRect(); } if (_sideMode != SideMode.None) { float num = Mathf.Clamp(((Rect)(ref _windowRect)).height, 380f, 560f); float num2 = ((((Rect)(ref _windowRect)).xMax + 6f + 340f <= (float)Screen.width) ? (((Rect)(ref _windowRect)).xMax + 6f) : (((Rect)(ref _windowRect)).x - 340f - 6f)); GUI.Window(918274, new Rect(num2, ((Rect)(ref _windowRect)).y, 340f, num), new WindowFunction(DrawSideWindow), (_sideMode == SideMode.WhatsNew) ? "What's New" : "Bug Report", _windowStyle); } } } private void SaveWindowRect() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!(_windowRect == _lastSavedRect)) { _lastSavedRect = _windowRect; _windowRectCfg.Value = $"{((Rect)(ref _windowRect)).x:0},{((Rect)(ref _windowRect)).y:0},{((Rect)(ref _windowRect)).width:0},{((Rect)(ref _windowRect)).height:0}"; ((BaseUnityPlugin)this).Config.Save(); } } private float ListView(float reserve) { return Mathf.Clamp(((Rect)(ref _windowRect)).height - reserve - LogoHeaderHeight() - (float)Mathf.Max(0, _fontSizeLive - 13) * 3f, 160f, 4000f); } private void DrawWindow(int id) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Invalid comparison between Unknown and I4 //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Invalid comparison between Unknown and I4 //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) if (GUI.Button(new Rect(((Rect)(ref _windowRect)).width - 34f, 4f, 28f, 22f), "✕", _buttonStyle)) { _visible = false; FlushNotes(); CommitUiSettings(); _openDropdown = null; } if ((Object)(object)LocalPlayer == (Object)null) { GUILayout.Label(Loc.T("chrome.not_in_game"), _labelStyle, Array.Empty()); GUI.DragWindow(); return; } if ((int)Event.current.type == 8) { _openDropdownLayout = _openDropdown; _rebindTargetLayout = _rebindTarget; _updateBannerLayout = _updateAvailable; _versionWarnLayout = CompanionWarning(); _othersSnapshot = OtherPlayers(); _globalKeysLayout = (((Object)(object)ZoneSystem.instance != (Object)null) ? new List(ZoneSystem.instance.GetGlobalKeys()) : null); } DrawLogoHeader(); if (_updateBannerLayout != null) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("chrome.update_available", _updateBannerLayout, "2.3.0"), _proseStyle, Array.Empty()); if (GUILayout.Button(Loc.T("chrome.get_update"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(110f) })) { Application.OpenURL("https://github.com/hldblc/ValheimAdminPanel/releases/latest"); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } if (_versionWarnLayout != null) { GUILayout.Label(_versionWarnLayout, _proseStyle, Array.Empty()); } GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i < TabKeys.Length; i++) { if (GUILayout.Toggle(_tab == i, Loc.T(TabKeys[i]), _tabStyle, Array.Empty()) && _tab != i) { _tab = i; _openDropdown = null; _rebindTarget = 0; } } GUILayout.EndHorizontal(); GUILayout.Space(14f); try { switch (_tab) { case 0: DrawItemsTab(); break; case 1: DrawCreaturesTab(); break; case 2: DrawBossesTab(); break; case 3: DrawPlayerTab(); break; case 4: DrawWorldTab(); break; case 5: DrawPlayersTab(); break; case 6: DrawServerTab(); break; case 7: DrawSettingsTab(); break; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)$"AdminPanel tab {_tab} draw error: {ex.Message}"); } Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref _windowRect)).width - 22f, ((Rect)(ref _windowRect)).height - 22f, 22f, 22f); GUI.Label(val, "◢", _dimLabelStyle); Event current = Event.current; if (_resizing && ((int)current.rawType == 1 || !Input.GetMouseButton(0))) { _resizing = false; SaveWindowRect(); } if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref val)).Contains(current.mousePosition)) { _resizing = true; current.Use(); } else if (_resizing && (int)current.type == 3 && current.button == 0) { ((Rect)(ref _windowRect)).width = Mathf.Clamp(current.mousePosition.x + 11f, 660f, (float)Screen.width - ((Rect)(ref _windowRect)).x); ((Rect)(ref _windowRect)).height = Mathf.Clamp(current.mousePosition.y + 11f, 300f, (float)Screen.height - ((Rect)(ref _windowRect)).y); current.Use(); } GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } private List OtherPlayers() { if ((Object)(object)ZNet.instance == (Object)null) { return new List(); } string myName = (((Object)(object)LocalPlayer != (Object)null) ? LocalPlayer.GetPlayerName() : ""); return (from p in ZNet.instance.GetPlayerList() where p.m_name != myName select p).ToList(); } private int GiveTargetIndex(List others) { if (_giveTargetId == 0L) { return -1; } return others.FindIndex((PlayerInfo p) => PeerIdOf(p) == _giveTargetId); } private string GiveTargetName(List others) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) int num = GiveTargetIndex(others); if (num >= 0) { return others[num].m_name; } return Loc.T("common.nobody"); } private void CycleGiveTarget(List others) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (others.Count == 0) { _giveTargetId = 0L; return; } int index = (GiveTargetIndex(others) + 1) % others.Count; _giveTargetId = PeerIdOf(others[index]); } private Vector3 SpawnPos(float distance = 3f) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (_spawnAtCrosshair && (Object)(object)GameCamera.instance != (Object)null) { Transform transform = ((Component)GameCamera.instance).transform; RaycastHit val = default(RaycastHit); if (Physics.Raycast(transform.position, transform.forward, ref val, 200f)) { return ((RaycastHit)(ref val)).point + Vector3.up * 0.3f; } } return ((Component)LocalPlayer).transform.position + ((Component)LocalPlayer).transform.forward * distance + Vector3.up * 0.5f; } private void SrvRpc(string method, params object[] parameters) { long num = ServerUid(); if (num == 0L && (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsServer())) { Message(Loc.T("common.not_connected_srv")); } else if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(num, method, parameters); } } private void SendServerSpawn(int kind, string prefabName, Vector3 pos, int count, int levelOrQuality, bool tamed, string petName = "") { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) ZPackage val = new ZPackage(); val.Write(kind); val.Write(prefabName); val.Write(pos); val.Write(count); val.Write(levelOrQuality); val.Write(tamed); val.Write(petName ?? ""); SrvRpc("AP_SrvSpawn", val); } private void SendServerGive(long targetUid, string prefabName, int amount, int quality) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write(targetUid); val.Write(prefabName); val.Write(amount); val.Write(quality); val.Write(_crafterNameCfg.Value ?? ""); SrvRpc("AP_SrvGive", val); } private void Message(string text) { Player localPlayer = LocalPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)1, "[Admin] " + text, 0, (Sprite)null); } ((BaseUnityPlugin)this).Logger.LogInfo((object)text); } private static bool HasIcon(ItemDrop drop) { Sprite[] icons = drop.m_itemData.m_shared.m_icons; if (icons != null) { return icons.Length != 0; } return false; } private void DrawIcon(ItemEntry e) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(26f, 26f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(26f) }); if (!e.IconTried) { e.IconTried = true; try { e.Icon = e.Drop.m_itemData.GetIcon(); } catch { } } Sprite icon = e.Icon; if (!((Object)(object)icon == (Object)null) && !((Object)(object)icon.texture == (Object)null)) { Rect textureRect = icon.textureRect; Texture2D texture = icon.texture; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref textureRect)).x / (float)((Texture)texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)texture).height); GUI.DrawTextureWithTexCoords(rect, (Texture)(object)texture, val); } } private void ToggleFavorite(string prefab) { if (!_favorites.Remove(prefab)) { _favorites.Add(prefab); } _favoritesCfg.Value = string.Join(",", _favorites); _favVersion++; ((BaseUnityPlugin)this).Config.Save(); } private void MarkRecent(ItemEntry e) { _recentItems.RemoveAll((ItemEntry r) => r.Prefab == e.Prefab); _recentItems.Insert(0, e); if (_recentItems.Count > 25) { _recentItems.RemoveAt(_recentItems.Count - 1); } _recentVersion++; } private void EnsureLocalizedLabels() { if (!(_labelsLang == Loc.ActiveCode) || _mainCatLabels == null) { _labelsLang = Loc.ActiveCode; _mainCatLabels = new string[MainCatKeys.Length]; for (int i = 0; i < MainCatKeys.Length; i++) { _mainCatLabels[i] = Loc.T(MainCatKeys[i]); } _itemSortLabels = new string[3] { Loc.T("sort.az"), Loc.T("sort.za"), Loc.T("sort.category") }; _creatureSortLabels = new string[3] { Loc.T("sort.az"), Loc.T("sort.za"), Loc.T("sort.faction") }; } } private bool ConfirmButton(string id, string label, params GUILayoutOption[] opts) { bool flag = _confirmAction == id && Time.realtimeSinceStartup < _confirmExpiresAt; if (!GUILayout.Button(flag ? Loc.T("common.confirm_prompt") : label, _buttonStyle, opts)) { return false; } if (flag) { _confirmAction = null; return true; } _confirmAction = id; _confirmExpiresAt = Time.realtimeSinceStartup + 3f; return false; } private static string DebounceSearch(string live, ref string applied, ref string lastSeen, ref float dirtyAt) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if (Event.current == null || (int)Event.current.type != 8) { return applied; } if (!string.Equals(live, lastSeen, StringComparison.Ordinal)) { lastSeen = live; dirtyAt = Time.realtimeSinceStartup; } if (dirtyAt >= 0f && Time.realtimeSinceStartup - dirtyAt >= 0.15f) { applied = live; dirtyAt = -1f; } return applied; } private static int MatchRank(string display, string id, string q) { if (string.Equals(display, q, StringComparison.OrdinalIgnoreCase)) { return 0; } if (display.StartsWith(q, StringComparison.OrdinalIgnoreCase)) { return 1; } if (WordStartsWith(display, q)) { return 2; } if (display.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return 3; } if (id.StartsWith(q, StringComparison.OrdinalIgnoreCase)) { return 4; } return 5; } private static bool WordStartsWith(string s, string q) { int num = s.IndexOf(' '); while (num >= 0 && num + 1 < s.Length) { if (string.Compare(s, num + 1, q, 0, q.Length, StringComparison.OrdinalIgnoreCase) == 0) { return true; } num = s.IndexOf(' ', num + 1); } return false; } private List FilteredItems() { string q = DebounceSearch(_itemSearch, ref _itemSearchApplied, ref _itemSearchLastSeen, ref _itemSearchDirtyAt); string text = $"{_mainCat}|{_subCat}|{q}|{_favVersion}|{_recentItems.Count}|{_recentVersion}|{_itemSort}"; if (_filteredItemsCache != null && text == _itemFilterKey) { return _filteredItemsCache; } IEnumerable source = _itemIndex; if (_mainCat == "★ Fav") { source = _itemIndex.Where((ItemEntry e) => _favorites.Contains(e.Prefab)); } else if (_mainCat == "Recent") { source = _recentItems; } else if (_mainCat != "All") { source = _itemIndex.Where((ItemEntry e) => e.Cat == _mainCat); if (_subCat != "All") { source = source.Where((ItemEntry e) => e.Sub == _subCat); } } if (!string.IsNullOrEmpty(q)) { source = source.Where((ItemEntry e) => e.Display.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0 || e.Prefab.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0); } if (_mainCat != "Recent") { IOrderedEnumerable source2 = (string.IsNullOrEmpty(q) ? source.OrderBy((ItemEntry _) => 0) : (from e in source orderby MatchRank(e.Display, e.Prefab, q), e.Display.Length select e)); source = _itemSort switch { 1 => source2.ThenByDescending((ItemEntry e) => e.Display, StringComparer.OrdinalIgnoreCase), 2 => source2.ThenBy((ItemEntry e) => e.Cat).ThenBy((ItemEntry e) => e.Sub).ThenBy((ItemEntry e) => e.Display, StringComparer.OrdinalIgnoreCase), _ => source2.ThenBy((ItemEntry e) => e.Display, StringComparer.OrdinalIgnoreCase), }; } _filteredItemsCache = source.ToList(); _itemFilterKey = text; return _filteredItemsCache; } private void GiveKit((string Name, (string Prefab, int Count)[] Items) kit, long targetUid) { (string, int)[] item = kit.Items; for (int i = 0; i < item.Length; i++) { var (prefabName, amount) = item[i]; SendServerGive(targetUid, prefabName, amount, 1); } Message(Loc.T("items.kit_sent", kit.Name)); } private void DropdownButton(string id, string label, string[] options, int selected, float width) { string text = options[Mathf.Clamp(selected, 0, options.Length - 1)]; if (GUILayout.Button(string.IsNullOrEmpty(label) ? (text + " " + ((_openDropdown == id) ? "▲" : "▼")) : (label + ": " + text + " " + ((_openDropdown == id) ? "▲" : "▼")), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(width) })) { _openDropdown = ((_openDropdown == id) ? null : id); } } private bool DropdownOptions(string id, string[] options, ref int selected, float width) { if (_openDropdownLayout != id) { return false; } bool result = false; for (int i = 0; i < options.Length; i++) { if (GUILayout.Button(((i == selected) ? "• " : " ") + options[i], _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(width) })) { selected = i; _openDropdown = null; result = true; } } return result; } private void DrawItemsTab() { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Invalid comparison between Unknown and I4 //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: 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_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_0b60: Unknown result type (might be due to invalid IL or missing references) //IL_0ba7: Unknown result type (might be due to invalid IL or missing references) EnsureLocalizedLabels(); for (int i = 0; i < 2; i++) { GUILayout.BeginHorizontal(Array.Empty()); int num = (MainCats.Length + 1) / 2; for (int j = i * num; j < Mathf.Min(MainCats.Length, (i + 1) * num); j++) { if (GUILayout.Toggle(_mainCat == MainCats[j], _mainCatLabels[j], _catStyle, Array.Empty()) && _mainCat != MainCats[j]) { _mainCat = MainCats[j]; _subCat = "All"; _itemScroll = Vector2.zero; } } GUILayout.EndHorizontal(); } GUILayout.Space(12f); List list = _othersSnapshot ?? (_othersSnapshot = OtherPlayers()); if (_mainCat == "Kits") { GUILayout.Label(Loc.T("items.kits_title"), _headerStyle, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("items.give_target"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); if (GUILayout.Button(GiveTargetName(list), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(180f) })) { CycleGiveTarget(list); } GUILayout.EndHorizontal(); _itemScroll = GUILayout.BeginScrollView(_itemScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(Mathf.Min(ListView(300f), (float)GearKits.Length * 28f + 96f)) }); (string, (string, int)[])[] gearKits = GearKits; for (int k = 0; k < gearKits.Length; k++) { (string, (string, int)[]) kit = gearKits[k]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(kit.Item1, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); GUILayout.Label(string.Join(", ", kit.Item2.Select(((string Prefab, int Count) tuple) => (tuple.Count <= 1) ? tuple.Prefab : $"{tuple.Prefab} x{tuple.Count}")), _labelStyle, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(Loc.T("items.to_me"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) })) { GiveKit(kit, SelfUid()); } if (GUILayout.Button(Loc.T("items.give"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(55f) })) { int num2 = GiveTargetIndex(list); if (num2 >= 0) { GiveKit(kit, PeerIdOf(list[num2])); } } GUILayout.EndHorizontal(); } GUILayout.Space(10f); GUILayout.Label(Loc.T("items.bulk_title"), _headerStyle, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(_bulkPackCfg.Value, _labelStyle, Array.Empty()); if (GUILayout.Button(Loc.T("items.bulk_grab"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(120f) })) { string[] array = _bulkPackCfg.Value.Split(new char[1] { ',' }); for (int k = 0; k < array.Length; k++) { string[] array2 = array[k].Trim().Split(new char[1] { ':' }); if (array2.Length == 2 && int.TryParse(array2[1], out var result)) { SendServerGive(SelfUid(), array2[0].Trim(), result, 1); } } Message(Loc.T("items.bulk_requested")); } GUILayout.EndHorizontal(); GUILayout.EndScrollView(); return; } if (_itemIndex != null && _mainCat != "All" && _mainCat != "★ Fav" && _mainCat != "Recent") { if (_subCatsCache == null || _subCatsKey != _mainCat) { _subCatsCache = (from s in (from e in _itemIndex where e.Cat == _mainCat select e.Sub).Distinct() orderby s select s).ToList(); _subCatsKey = _mainCat; } List subCatsCache = _subCatsCache; if (subCatsCache.Count > 1) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Toggle(_subCat == "All", Loc.T("common.all"), _catStyle, Array.Empty()) && _subCat != "All") { _subCat = "All"; _itemScroll = Vector2.zero; } foreach (string item in subCatsCache) { if (GUILayout.Toggle(_subCat == item, item, _catStyle, Array.Empty()) && _subCat != item) { _subCat = item; _itemScroll = Vector2.zero; } } GUILayout.EndHorizontal(); GUILayout.Space(10f); } } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("common.search"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) }); _itemSearch = GUILayout.TextField(_itemSearch, _textFieldStyle, Array.Empty()); GUILayout.Label(Loc.T("items.amount"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(55f) }); int.TryParse(GUILayout.TextField(_itemAmount.ToString(), _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }), out _itemAmount); GUILayout.Label(Loc.T("items.quality"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) }); int.TryParse(GUILayout.TextField(_itemQuality.ToString(), _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }), out _itemQuality); GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("items.give_target"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); if (GUILayout.Button(GiveTargetName(list), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(180f) })) { CycleGiveTarget(list); } GUILayout.Label(Loc.T("items.legend"), _labelStyle, Array.Empty()); GUILayout.FlexibleSpace(); DropdownButton("itemSort", Loc.T("common.sort"), _itemSortLabels, _itemSort, 150f); GUILayout.EndHorizontal(); DropdownOptions("itemSort", _itemSortLabels, ref _itemSort, 150f); if (_itemIndex == null) { GUILayout.Label(Loc.T("items.db_not_loaded"), _labelStyle, Array.Empty()); return; } GUILayout.Space(10f); float num3 = ListView(330f); if ((int)Event.current.type == 8 || _itemWindowList == null) { _itemWindowList = FilteredItems(); _itemWindowTotal = _itemWindowList.Count; _itemWindowFirst = Mathf.Clamp(Mathf.FloorToInt(_itemScroll.y / 32f) - 1, 0, Mathf.Max(0, _itemWindowTotal)); _itemWindowVisible = Mathf.Max(0, Mathf.Min(_itemWindowTotal - _itemWindowFirst, Mathf.CeilToInt(num3 / 32f) + 3)); } List itemWindowList = _itemWindowList; int itemWindowTotal = _itemWindowTotal; int itemWindowFirst = _itemWindowFirst; int itemWindowVisible = _itemWindowVisible; _itemScroll = GUILayout.BeginScrollView(_itemScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num3) }); if (itemWindowFirst > 0) { GUILayout.Space((float)itemWindowFirst * 32f); } for (int num4 = itemWindowFirst; num4 < itemWindowFirst + itemWindowVisible; num4++) { ItemEntry itemEntry = itemWindowList[num4]; GUILayout.BeginHorizontal((num4 % 2 == 0) ? _rowEven : _rowOdd, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); if (GUILayout.Button(_favorites.Contains(itemEntry.Prefab) ? "★" : "☆", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(30f) })) { ToggleFavorite(itemEntry.Prefab); } DrawIcon(itemEntry); GUILayout.Space(6f); GUILayout.Label(itemEntry.Display, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(210f) }); GUILayout.Label(itemEntry.Info, _dimCellStyle, Array.Empty()); GUILayout.FlexibleSpace(); int num5 = Math.Max(1, _itemAmount); int num6 = Math.Max(1, _itemQuality); if (GUILayout.Button(Loc.T("items.drop"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(58f) })) { SendServerSpawn(0, itemEntry.Prefab, SpawnPos(1.5f), num5, num6, tamed: false); MarkRecent(itemEntry); Message(Loc.T("items.msg_requested", num5, itemEntry.Display)); } bool flag = HasIcon(itemEntry.Drop); if (GUILayout.Button(flag ? Loc.T("items.bag") : "✕", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(52f) })) { if (flag) { SendServerGive(SelfUid(), itemEntry.Prefab, num5, num6); MarkRecent(itemEntry); Message(Loc.T("items.msg_requested_bag", num5, itemEntry.Display)); } else { Message(Loc.T("items.msg_no_icon_drop", itemEntry.Display)); } } if (GUILayout.Button(flag ? Loc.T("items.give") : "✕", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(58f) })) { int num7 = GiveTargetIndex(list); if (!flag) { Message(Loc.T("items.msg_no_icon_give", itemEntry.Display)); } else if (num7 >= 0) { SendServerGive(PeerIdOf(list[num7]), itemEntry.Prefab, num5, num6); MarkRecent(itemEntry); Message(Loc.T("items.msg_sent", num5, itemEntry.Display, list[num7].m_name)); } else { Message(Loc.T("items.msg_no_target")); } } GUILayout.EndHorizontal(); } int num8 = itemWindowTotal - (itemWindowFirst + itemWindowVisible); if (num8 > 0) { GUILayout.Space((float)num8 * 32f); } GUILayout.EndScrollView(); GUILayout.Label(Loc.T("items.count", itemWindowTotal), _dimLabelStyle, Array.Empty()); } private List FilteredCreatures() { string q = DebounceSearch(_creatureSearch, ref _creatureSearchApplied, ref _creatureSearchLastSeen, ref _creatureSearchDirtyAt); string text = $"{_creatureCat}|{q}|{_creatureSort}"; if (_filteredCreaturesCache != null && text == _creatureFilterKey) { return _filteredCreaturesCache; } IEnumerable source = _creatureIndex; if (_creatureCat == "Bosses") { source = source.Where((CreatureEntry e) => e.Boss); } else if (_creatureCat == "Tamable") { source = source.Where((CreatureEntry e) => e.Tamable); } else if (_creatureCat != "All") { source = source.Where((CreatureEntry e) => e.Faction == _creatureCat); } if (!string.IsNullOrEmpty(q)) { source = source.Where((CreatureEntry e) => e.Display.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0 || e.Name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0); } IOrderedEnumerable source2 = (string.IsNullOrEmpty(q) ? source.OrderBy((CreatureEntry _) => 0) : (from e in source orderby MatchRank(e.Display, e.Name, q), e.Display.Length select e)); _filteredCreaturesCache = (_creatureSort switch { 1 => source2.ThenByDescending((CreatureEntry e) => e.Display, StringComparer.OrdinalIgnoreCase), 2 => source2.ThenBy((CreatureEntry e) => e.Faction).ThenBy((CreatureEntry e) => e.Display, StringComparer.OrdinalIgnoreCase), _ => source2.ThenBy((CreatureEntry e) => e.Display, StringComparer.OrdinalIgnoreCase), }).ToList(); _creatureFilterKey = text; return _filteredCreaturesCache; } private static string CreatureCatLabel(string cat) { return cat switch { "All" => Loc.T("common.all"), "Bosses" => Loc.T("cre.bosses"), "Tamable" => Loc.T("cre.tamable"), _ => cat, }; } private void DrawCreaturesTab() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Invalid comparison between Unknown and I4 //IL_0711: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_072a: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_09c3: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) EnsureLocalizedLabels(); if (_creatureIndex == null) { GUILayout.Label(Loc.T("cre.db_not_loaded"), _labelStyle, Array.Empty()); return; } List list = _creatureCats; if (list == null) { list = new List { "All", "Bosses", "Tamable" }; list.AddRange(from f in _creatureIndex.Select((CreatureEntry e) => e.Faction).Distinct() orderby f select f); _creatureCats = list; } for (int num = 0; num < 2; num++) { GUILayout.BeginHorizontal(Array.Empty()); int num2 = (list.Count + 1) / 2; for (int num3 = num * num2; num3 < Mathf.Min(list.Count, (num + 1) * num2); num3++) { if (GUILayout.Toggle(_creatureCat == list[num3], CreatureCatLabel(list[num3]), _catStyle, Array.Empty()) && _creatureCat != list[num3]) { _creatureCat = list[num3]; _creatureScroll = Vector2.zero; } } GUILayout.EndHorizontal(); } GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("common.search"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) }); _creatureSearch = GUILayout.TextField(_creatureSearch, _textFieldStyle, Array.Empty()); GUILayout.Label(Loc.T("cre.count"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(45f) }); int.TryParse(GUILayout.TextField(_creatureCount.ToString(), _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }), out _creatureCount); GUILayout.Label(Loc.T("cre.stars"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(40f) }); if (int.TryParse(GUILayout.TextField((_creatureLevel - 1).ToString(), _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }), out var result)) { _creatureLevel = Mathf.Clamp(result, 0, 10) + 1; } _spawnAtCrosshair = GUILayout.Toggle(_spawnAtCrosshair, " " + Loc.T("cre.at_crosshair"), _toggleStyle, Array.Empty()); DropdownButton("creatureSort", Loc.T("common.sort"), _creatureSortLabels, _creatureSort, 150f); GUILayout.EndHorizontal(); DropdownOptions("creatureSort", _creatureSortLabels, ref _creatureSort, 150f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("cre.pet_name"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(60f) }); _petName = GUILayout.TextField(_petName, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button(Loc.T("cre.undo"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(120f) })) { SrvRpc("AP_SrvUndo"); Message(Loc.T("cre.undo_requested")); } GUILayout.Label(Loc.T("cre.arena", _arenaA ?? "?", _arenaB ?? "?"), _labelStyle, Array.Empty()); if (GUILayout.Button(Loc.T("cre.fight"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(60f) }) && _arenaA != null && _arenaB != null) { Vector3 val = SpawnPos(8f); SendServerSpawn(1, _arenaA, val + Vector3.left * 6f, _arenaCountA, 1, tamed: false); SendServerSpawn(1, _arenaB, val + Vector3.right * 6f, _arenaCountB, 1, tamed: false); Message(Loc.T("cre.arena_started", _arenaCountA, _arenaA, _arenaCountB, _arenaB)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("cre.preset"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(45f) }); _presetName = GUILayout.TextField(_presetName, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }); foreach (KeyValuePair item in PresetRows()) { if (!GUILayout.Button(item.Key, _buttonStyle, Array.Empty())) { continue; } string[] array = item.Value.Split(new char[1] { ';' }); for (int num4 = 0; num4 < array.Length; num4++) { string[] array2 = array[num4].Split(new char[1] { ':' }); if (array2.Length >= 3 && int.TryParse(array2[1], out var result2) && int.TryParse(array2[2], out var result3)) { SendServerSpawn(1, array2[0], SpawnPos(4f), result2, result3, tamed: false); } } Message(Loc.T("cre.preset_spawned", item.Key)); } GUILayout.EndHorizontal(); GUILayout.Space(6f); float num5 = ListView(360f); if ((int)Event.current.type == 8 || _creWindowList == null) { _creWindowList = FilteredCreatures(); _creWindowTotal = _creWindowList.Count; _creWindowFirst = Mathf.Clamp(Mathf.FloorToInt(_creatureScroll.y / 32f) - 1, 0, Mathf.Max(0, _creWindowTotal)); _creWindowVisible = Mathf.Max(0, Mathf.Min(_creWindowTotal - _creWindowFirst, Mathf.CeilToInt(num5 / 32f) + 3)); } List creWindowList = _creWindowList; int creWindowTotal = _creWindowTotal; int creWindowFirst = _creWindowFirst; int creWindowVisible = _creWindowVisible; _creatureScroll = GUILayout.BeginScrollView(_creatureScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num5) }); if (creWindowFirst > 0) { GUILayout.Space((float)creWindowFirst * 32f); } for (int num6 = creWindowFirst; num6 < creWindowFirst + creWindowVisible; num6++) { CreatureEntry creatureEntry = creWindowList[num6]; GUILayout.BeginHorizontal((num6 % 2 == 0) ? _rowEven : _rowOdd, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); GUILayout.Label(creatureEntry.Display, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); GUILayout.Label(creatureEntry.Name + (creatureEntry.Boss ? (" " + Loc.T("cre.tag_boss")) : "") + (creatureEntry.Tamable ? (" " + Loc.T("cre.tag_tamable")) : ""), _dimCellStyle, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("A", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(26f) })) { _arenaA = creatureEntry.Name; _arenaCountA = Math.Max(1, _creatureCount); } if (GUILayout.Button("B", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(26f) })) { _arenaB = creatureEntry.Name; _arenaCountB = Math.Max(1, _creatureCount); } if (GUILayout.Button(Loc.T("cre.save"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) }) && !string.IsNullOrEmpty(_presetName)) { string text = $"{creatureEntry.Name}:{Math.Max(1, _creatureCount)}:{_creatureLevel}"; Dictionary dictionary = ParseKv(_spawnPresetsCfg.Value); dictionary[_presetName] = ((dictionary.TryGetValue(_presetName, out var value) && !string.IsNullOrEmpty(value)) ? (value + ";" + text) : text); _spawnPresetsCfg.Value = JoinKv(dictionary); ((BaseUnityPlugin)this).Config.Save(); Message(Loc.T("cre.preset_saved", _presetName)); } if (GUILayout.Button(Loc.T("cre.spawn"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(60f) })) { SendServerSpawn(1, creatureEntry.Name, SpawnPos(), Math.Max(1, _creatureCount), _creatureLevel, tamed: false); Message(Loc.T("cre.msg_requested", creatureEntry.Display)); } if (creatureEntry.Tamable && GUILayout.Button(Loc.T("cre.tame"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(55f) })) { SendServerSpawn(1, creatureEntry.Name, SpawnPos(), Math.Max(1, _creatureCount), _creatureLevel, tamed: true, _petName); Message(Loc.T("cre.msg_requested_tamed", creatureEntry.Display)); } GUILayout.EndHorizontal(); } int num7 = creWindowTotal - (creWindowFirst + creWindowVisible); if (num7 > 0) { GUILayout.Space((float)num7 * 32f); } GUILayout.EndScrollView(); GUILayout.Label(Loc.T("cre.count_total", creWindowTotal), _dimLabelStyle, Array.Empty()); } private void DrawBossesTab() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) DrawSection(Loc.T("boss.section")); GUILayout.Label(Loc.T("boss.hint"), _dimLabelStyle, Array.Empty()); _bossScroll = GUILayout.BeginScrollView(_bossScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(Mathf.Min(ListView(140f), (float)BossList.Length * 28f + 8f)) }); (string, string, string, int)[] bossList = BossList; for (int i = 0; i < bossList.Length; i++) { var (text, text2, text3, num) = bossList[i]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(text2, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); GUILayout.Label(text, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); GUILayout.FlexibleSpace(); if (GUILayout.Button(Loc.T("boss.offering", num, text3), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(230f) })) { SendServerGive(SelfUid(), text3, num, 1); Message(Loc.T("items.msg_requested", num, text3)); } if (GUILayout.Button(Loc.T("cre.spawn"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) })) { SendServerSpawn(1, text, SpawnPos(6f), 1, 1, tamed: false); Message(Loc.T("boss.msg_requested", text2)); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); DrawSection(Loc.T("boss.raids")); GUILayout.Label(Loc.T("boss.raids_hint"), _dimLabelStyle, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); int num2 = 0; string[] raidEvents = RaidEvents; foreach (string text4 in raidEvents) { if (GUILayout.Button(text4, _buttonStyle, Array.Empty())) { SrvRpc("AP_SrvEvent", text4, ((Component)LocalPlayer).transform.position); Message(Loc.T("boss.msg_event", text4)); } if (++num2 % 5 == 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); } } GUILayout.EndHorizontal(); } private void EnsureBaseStats() { if (!(_baseWalk >= 0f) && !((Object)(object)LocalPlayer == (Object)null)) { _baseWalk = ((Character)LocalPlayer).m_walkSpeed; _baseRun = ((Character)LocalPlayer).m_runSpeed; _baseSwim = ((Character)LocalPlayer).m_swimSpeed; _baseJump = ((Character)LocalPlayer).m_jumpForce; _baseWeight = LocalPlayer.m_maxCarryWeight; _basePickup = LocalPlayer.m_autoPickupRange; } } private static string OnOff(bool on) { if (!on) { return Loc.T("common.off"); } return Loc.T("common.on"); } private unsafe void DrawPlayerTab() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_083b: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_0ae3: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0e54: Unknown result type (might be due to invalid IL or missing references) //IL_0e6c: Unknown result type (might be due to invalid IL or missing references) //IL_0e71: Unknown result type (might be due to invalid IL or missing references) //IL_0b01: Unknown result type (might be due to invalid IL or missing references) //IL_0b47: Unknown result type (might be due to invalid IL or missing references) //IL_0bab: Unknown result type (might be due to invalid IL or missing references) //IL_0bdd: Unknown result type (might be due to invalid IL or missing references) //IL_0c0f: Unknown result type (might be due to invalid IL or missing references) //IL_0c41: Unknown result type (might be due to invalid IL or missing references) //IL_0c73: Unknown result type (might be due to invalid IL or missing references) //IL_0ccc: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = LocalPlayer; EnsureBaseStats(); _playerScroll = GUILayout.BeginScrollView(_playerScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(ListView(100f)) }); DrawSection(Loc.T("player.toggles")); bool flag = GUILayout.Toggle(_god, " " + Loc.T("player.god"), _toggleStyle, Array.Empty()); if (flag != _god) { _god = flag; localPlayer.SetGodMode(_god); Message(Loc.T("player.msg_god", OnOff(_god))); } bool flag2 = GUILayout.Toggle(_ghost, " " + Loc.T("player.ghost"), _toggleStyle, Array.Empty()); if (flag2 != _ghost) { _ghost = flag2; localPlayer.SetGhostMode(_ghost); Message(Loc.T("player.msg_ghost", OnOff(_ghost))); } bool flag3 = GUILayout.Toggle(_fly, " " + Loc.T("player.fly"), _toggleStyle, Array.Empty()); if (flag3 != _fly) { _fly = flag3; Player.m_debugMode = true; localPlayer.ToggleDebugFly(); Message(_fly ? Loc.T("player.msg_fly_on") : Loc.T("player.msg_fly_off")); } bool flag4 = GUILayout.Toggle(_noCost, " " + Loc.T("player.free_build"), _toggleStyle, Array.Empty()); if (flag4 != _noCost) { _noCost = flag4; localPlayer.SetNoPlacementCost(_noCost); Message(Loc.T("player.msg_free_build", OnOff(_noCost))); } bool flag5 = GUILayout.Toggle(_noStamina, " " + Loc.T("player.no_stamina"), _toggleStyle, Array.Empty()); if (flag5 != _noStamina) { _noStamina = flag5; NoStaminaFlag = flag5; Message(Loc.T("player.msg_no_stamina", OnOff(flag5))); } bool flag6 = GUILayout.Toggle(_oneHitKill, " " + Loc.T("player.one_hit"), _toggleStyle, Array.Empty()); if (flag6 != _oneHitKill) { _oneHitKill = flag6; OneHitKillFlag = flag6; Message(Loc.T("player.msg_one_hit", OnOff(flag6))); } bool flag7 = GUILayout.Toggle(_infiniteWeight, " " + Loc.T("player.inf_weight"), _toggleStyle, Array.Empty()); if (flag7 != _infiniteWeight) { _infiniteWeight = flag7; localPlayer.m_maxCarryWeight = (flag7 ? 100000f : _baseWeight); Message(Loc.T("player.msg_inf_weight", OnOff(flag7))); } DrawSection(Loc.T("player.multipliers")); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("player.speed", _speedMult.ToString("0.0")), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(90f) }); float num = GUILayout.HorizontalSlider(_speedMult, 1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); if (Math.Abs(num - _speedMult) > 0.05f) { _speedMult = num; ((Character)localPlayer).m_walkSpeed = _baseWalk * _speedMult; ((Character)localPlayer).m_runSpeed = _baseRun * _speedMult; ((Character)localPlayer).m_swimSpeed = _baseSwim * _speedMult; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("player.jump", _jumpMult.ToString("0.0")), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(90f) }); float num2 = GUILayout.HorizontalSlider(_jumpMult, 1f, 5f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); if (Math.Abs(num2 - _jumpMult) > 0.05f) { _jumpMult = num2; ((Character)localPlayer).m_jumpForce = _baseJump * _jumpMult; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("player.pickup", _pickupRange.ToString("0")), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(90f) }); float num3 = GUILayout.HorizontalSlider(_pickupRange, 2f, 30f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); if (Math.Abs(num3 - _pickupRange) > 0.3f) { _pickupRange = num3; localPlayer.m_autoPickupRange = _pickupRange; } GUILayout.EndHorizontal(); DrawSection(Loc.T("player.quick_actions")); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Loc.T("player.full_heal"), _buttonStyle, Array.Empty())) { ((Character)localPlayer).Heal(((Character)localPlayer).GetMaxHealth(), true); Message(Loc.T("player.msg_healed")); } if (GUILayout.Button(Loc.T("player.full_stamina"), _buttonStyle, Array.Empty())) { ((Character)localPlayer).AddStamina(((Character)localPlayer).GetMaxStamina()); Message(Loc.T("player.msg_stamina")); } if (GUILayout.Button(Loc.T("player.full_eitr"), _buttonStyle, Array.Empty())) { ((Character)localPlayer).AddEitr(((Character)localPlayer).GetMaxEitr()); Message(Loc.T("player.msg_eitr")); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Loc.T("player.repair_all"), _buttonStyle, Array.Empty())) { foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { allItem.m_durability = allItem.GetMaxDurability(); } Message(Loc.T("player.msg_repaired")); } if (GUILayout.Button(Loc.T("player.clear_se"), _buttonStyle, Array.Empty())) { ((Character)localPlayer).GetSEMan().RemoveAllStatusEffects(false); Message(Loc.T("player.msg_se_cleared")); } if (GUILayout.Button(Loc.T("player.fix_broken"), _buttonStyle, Array.Empty())) { List list = (from i in ((Humanoid)localPlayer).GetInventory().GetAllItems() where i.m_shared.m_icons == null || i.m_shared.m_icons.Length == 0 select i).ToList(); foreach (ItemData item in list) { ((Humanoid)localPlayer).GetInventory().RemoveItem(item); } Message(Loc.T("player.msg_fixed_broken", list.Count)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Loc.T("player.tp_death"), _buttonStyle, Array.Empty())) { string[] array = _lastDeathCfg.Value.Split(new char[1] { ',' }); if (array.Length == 3 && float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { ((Character)localPlayer).TeleportTo(new Vector3(result, result2 + 0.5f, result3), ((Component)localPlayer).transform.rotation, true); Message(Loc.T("player.msg_tp_death")); } else { Message(Loc.T("player.msg_no_death")); } } GUILayout.Label(string.IsNullOrEmpty(_lastDeathCfg.Value) ? Loc.T("player.no_death_yet") : Loc.T("player.last_death", _lastDeathCfg.Value), _dimLabelStyle, Array.Empty()); GUILayout.EndHorizontal(); DrawSection(Loc.T("player.skills")); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Loc.T("player.skills_plus10"), _buttonStyle, Array.Empty())) { ChangeSkills(10f); } if (GUILayout.Button(Loc.T("player.skills_100"), _buttonStyle, Array.Empty())) { SetSkills(100f); } if (GUILayout.Button(Loc.T("player.skills_reset"), _buttonStyle, Array.Empty())) { SetSkills(0f); } GUILayout.EndHorizontal(); _showSkills = GUILayout.Toggle(_showSkills, " " + Loc.T("player.show_skills"), _toggleStyle, Array.Empty()); if (_showSkills) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("player.apply_to"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(105f) }); if (GUILayout.Button(SkillTargetLabel(), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(160f) })) { CycleSkillTarget(); } GUILayout.Label(Loc.T("player.custom"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(55f) }); _skillCustom = GUILayout.TextField(_skillCustom, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }); GUILayout.EndHorizontal(); if (_skillTargetId != 0L) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("player.private_note"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(105f) }); _skillMsg = GUILayout.TextField(_skillMsg, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) }); GUILayout.EndHorizontal(); GUILayout.Label(Loc.T("player.private_note_hint"), _hintStyle, Array.Empty()); } Skills skills = ((Character)localPlayer).GetSkills(); _skillScroll = GUILayout.BeginScrollView(_skillScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(220f) }); SkillType[] allSkillTypes = AllSkillTypes; for (int num4 = 0; num4 < allSkillTypes.Length; num4++) { SkillType val = allSkillTypes[num4]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(((object)(*(SkillType*)(&val))/*cast due to .constrained prefix*/).ToString(), _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); GUILayout.Label(Loc.T("player.level_short", skills.GetSkillLevel(val).ToString("0.#")), _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(60f) }); GUILayout.FlexibleSpace(); if (GUILayout.Button("−10", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(44f) })) { RaiseSkill(val, -10f); } if (GUILayout.Button("−1", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(36f) })) { RaiseSkill(val, -1f); } if (GUILayout.Button("+1", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(36f) })) { RaiseSkill(val, 1f); } if (GUILayout.Button("+10", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(44f) })) { RaiseSkill(val, 10f); } if (GUILayout.Button("+100", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(52f) })) { RaiseSkill(val, 100f); } if (GUILayout.Button(Loc.T("player.custom_pm"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) })) { if (float.TryParse(_skillCustom, NumberStyles.Float, CultureInfo.InvariantCulture, out var result4) && result4 != 0f) { RaiseSkill(val, result4); } else { Message(Loc.T("player.msg_custom_hint")); } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } DrawSection(Loc.T("player.status_effects")); _showStatusEffects = GUILayout.Toggle(_showStatusEffects, " " + Loc.T("player.show_se"), _toggleStyle, Array.Empty()); if (_showStatusEffects && (Object)(object)ObjectDB.instance != (Object)null) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("common.search"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) }); _seSearch = GUILayout.TextField(_seSearch, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); GUILayout.Space(12f); GUILayout.Label(Loc.T("player.apply_to"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) }); if (GUILayout.Button(TargetLabel(ref _seTargetId), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(160f) })) { CycleTarget(ref _seTargetId); } GUILayout.EndHorizontal(); if (_seTargetId != 0L) { GUILayout.Label(Loc.T("player.se_target_hint"), _hintStyle, Array.Empty()); } List list2 = FilteredStatusEffects(); _seScroll = GUILayout.BeginScrollView(_seScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(200f) }); if (list2.Count == 0) { GUILayout.Label(Loc.T("player.no_se_match"), _dimLabelStyle, Array.Empty()); } else { int num5 = -1; for (int num6 = 0; num6 < list2.Count; num6++) { SeEntry seEntry = list2[num6]; if (seEntry.Bucket != num5) { num5 = seEntry.Bucket; GUILayout.Label(Loc.T(SeBucketKeys[seEntry.Bucket]), _headerStyle, Array.Empty()); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(seEntry.Display, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); GUILayout.Label(seEntry.Tooltip, _dimCellStyle, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(Loc.T("player.apply"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(60f) })) { if (_seTargetId == 0L) { ((Character)localPlayer).GetSEMan().AddStatusEffect(seEntry.Hash, true, 0, 0f); Message(Loc.T("player.msg_applied", seEntry.Display)); } else { SrvRpc("AP_SrvApplySE", _seTargetId, seEntry.Hash); Message(Loc.T("player.msg_applied_to", seEntry.Display, TargetLabel(ref _seTargetId))); } } GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); } GUILayout.EndScrollView(); } private unsafe void RaiseSkill(SkillType type, float amount) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (_skillTargetId == 0L) { ((Character)LocalPlayer).GetSkills().CheatRaiseSkill(((object)(*(SkillType*)(&type))/*cast due to .constrained prefix*/).ToString(), amount, false); Message(Loc.T("player.msg_skill_self", type, amount.ToString("0.#"))); return; } ZPackage val = new ZPackage(); val.Write(_skillTargetId); val.Write(((object)(*(SkillType*)(&type))/*cast due to .constrained prefix*/).ToString()); val.Write(amount); val.Write(_skillMsg ?? ""); SrvRpc("AP_SrvSkillRaise", val); Message(Loc.T("player.msg_skill_target", type, amount.ToString("0.#"), SkillTargetLabel())); } private string TargetLabel(ref long targetId) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (targetId == 0L) { return Loc.T("common.me"); } foreach (PlayerInfo item in OtherPlayers()) { if (PeerIdOf(item) == targetId) { return item.m_name; } } targetId = 0L; return Loc.T("common.me"); } private void CycleTarget(ref long targetId) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) List list = OtherPlayers(); if (list.Count == 0) { targetId = 0L; return; } if (targetId == 0L) { targetId = PeerIdOf(list[0]); return; } for (int i = 0; i < list.Count; i++) { if (PeerIdOf(list[i]) == targetId) { targetId = ((i + 1 < list.Count) ? PeerIdOf(list[i + 1]) : 0); return; } } targetId = 0L; } private string SkillTargetLabel() { return TargetLabel(ref _skillTargetId); } private void CycleSkillTarget() { CycleTarget(ref _skillTargetId); } private void ChangeSkills(float delta) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 foreach (SkillType value in Enum.GetValues(typeof(SkillType))) { if ((int)value != 0 && (int)value != 999) { ((Character)LocalPlayer).GetSkills().CheatRaiseSkill(((object)value/*cast due to .constrained prefix*/).ToString(), delta, true); } } Message(Loc.T("player.msg_skills_changed", delta)); } private void SetSkills(float value) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 Skills skills = ((Character)LocalPlayer).GetSkills(); foreach (SkillType value2 in Enum.GetValues(typeof(SkillType))) { if ((int)value2 != 0 && (int)value2 != 999) { skills.CheatResetSkill(((object)value2/*cast due to .constrained prefix*/).ToString()); if (value > 0f) { skills.CheatRaiseSkill(((object)value2/*cast due to .constrained prefix*/).ToString(), value, true); } } } Message(Loc.T("player.msg_skills_set", value)); } private static string TimeLabel(float t) { int num = Mathf.FloorToInt(t * 24f); int num2 = Mathf.FloorToInt((t * 24f - (float)num) * 60f); return $"{num:00}:{num2:00}"; } private void DrawWorldTab() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0916: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_082d: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0a95: Unknown result type (might be due to invalid IL or missing references) //IL_0d53: Unknown result type (might be due to invalid IL or missing references) _worldScroll = GUILayout.BeginScrollView(_worldScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(ListView(100f)) }); EnvMan instance = EnvMan.instance; DrawSection(Loc.T("world.time_weather")); GUILayout.BeginHorizontal(Array.Empty()); _timeSlider = GUILayout.HorizontalSlider(_timeSlider, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) }); GUILayout.Label(TimeLabel(_timeSlider), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) }); if (GUILayout.Button(Loc.T("world.set"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) }) && (Object)(object)instance != (Object)null) { instance.m_debugTimeOfDay = true; instance.m_debugTime = _timeSlider; _timeLocked = true; } if (_timeLocked && GUILayout.Button(Loc.T("world.release"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) }) && (Object)(object)instance != (Object)null) { instance.m_debugTimeOfDay = false; _timeLocked = false; } if (GUILayout.Button(Loc.T("world.skip_night"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) })) { SrvRpc("AP_SrvSkipNight"); Message(Loc.T("world.msg_skip_night")); } GUILayout.EndHorizontal(); GUILayout.Label(Loc.T("world.weather_hint"), _proseStyle, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); _weather = GUILayout.TextField(_weather, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); if (GUILayout.Button(Loc.T("player.apply"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) }) && (Object)(object)instance != (Object)null) { instance.m_debugEnv = _weather; Message(string.IsNullOrEmpty(_weather) ? Loc.T("world.msg_weather_reset") : Loc.T("world.msg_weather_forced", _weather)); } GUILayout.EndHorizontal(); DrawSection(Loc.T("world.wind")); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.wind_dir", _windAngle.ToString("0")), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) }); _windAngle = GUILayout.HorizontalSlider(_windAngle, 0f, 360f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); GUILayout.Label(Loc.T("world.wind_str", _windIntensity.ToString("0.0")), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(60f) }); _windIntensity = GUILayout.HorizontalSlider(_windIntensity, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button(Loc.T("world.set"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(45f) }) && (Object)(object)instance != (Object)null) { instance.SetDebugWind(_windAngle, _windIntensity); _windLocked = true; Message(Loc.T("world.msg_wind_set")); } if (_windLocked && GUILayout.Button(Loc.T("world.reset"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(55f) }) && (Object)(object)instance != (Object)null) { instance.ResetDebugWind(); _windLocked = false; Message(Loc.T("world.msg_wind_reset")); } GUILayout.EndHorizontal(); DrawSection(Loc.T("world.teleport")); GUILayout.Label(Loc.T("world.map_hint", _mapTpKey.Value), _hintStyle, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.to_player"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); List list = _othersSnapshot ?? (_othersSnapshot = OtherPlayers()); if (list.Count == 0) { GUILayout.Label(Loc.T("world.no_others"), _dimLabelStyle, Array.Empty()); } else { foreach (PlayerInfo item in list) { if (GUILayout.Button(item.m_name, _buttonStyle, Array.Empty())) { ((Character)LocalPlayer).TeleportTo(item.m_position + Vector3.up, ((Component)LocalPlayer).transform.rotation, true); Message(Loc.T("world.msg_tp_to", item.m_name)); } } } GUILayout.EndHorizontal(); if ((Object)(object)ZoneSystem.instance != (Object)null) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.bosses"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); bool flag = false; (string, string)[] quickJumps = QuickJumps; Vector3 world = default(Vector3); for (int i = 0; i < quickJumps.Length; i++) { var (text, text2) = quickJumps[i]; if (ZoneSystem.instance.GetLocationIcon(text2, ref world)) { flag = true; if (GUILayout.Button(text, _buttonStyle, Array.Empty())) { TeleportToWorld(world, text); } } } if (!flag) { GUILayout.Label(Loc.T("world.no_altars"), _dimLabelStyle, Array.Empty()); } GUILayout.EndHorizontal(); } Vector3 position = ((Component)LocalPlayer).transform.position; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.position"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); GUILayout.Label(Loc.T("world.now_at", position.x.ToString("0"), position.y.ToString("0"), position.z.ToString("0")), _dimLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(140f) }); GUILayout.Label("X:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(18f) }); _tpX = GUILayout.TextField(_tpX, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }); GUILayout.Label("Y:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(18f) }); _tpY = GUILayout.TextField(_tpY, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }); GUILayout.Label("Z:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(18f) }); _tpZ = GUILayout.TextField(_tpZ, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }); if (GUILayout.Button(Loc.T("world.go"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(40f) }) && float.TryParse(_tpX, out var result) && float.TryParse(_tpY, out var result2) && float.TryParse(_tpZ, out var result3)) { ((Character)LocalPlayer).TeleportTo(new Vector3(result, (result2 <= 0f) ? 200f : result2, result3), ((Component)LocalPlayer).transform.rotation, true); Message(Loc.T("world.msg_teleporting")); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.bookmark"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); _bookmarkName = GUILayout.TextField(_bookmarkName, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }); if (GUILayout.Button(Loc.T("world.save_here"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }) && !string.IsNullOrEmpty(_bookmarkName)) { Dictionary dictionary = ParseKv(_bookmarksCfg.Value); dictionary[_bookmarkName] = string.Format(CultureInfo.InvariantCulture, "{0:0.#},{1:0.#},{2:0.#}", position.x, position.y, position.z); _bookmarksCfg.Value = JoinKv(dictionary); ((BaseUnityPlugin)this).Config.Save(); Message(Loc.T("world.msg_bookmark_saved", _bookmarkName)); } GUILayout.EndHorizontal(); foreach (KeyValuePair item2 in BookmarkRows()) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(item2.Key, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); GUILayout.Label(item2.Value, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); if (GUILayout.Button(Loc.T("world.go"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(40f) })) { string[] array = item2.Value.Split(new char[1] { ',' }); if (array.Length == 3 && float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result4) && float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result5) && float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result6)) { ((Character)LocalPlayer).TeleportTo(new Vector3(result4, result5, result6), ((Component)LocalPlayer).transform.rotation, true); Message(Loc.T("world.msg_tp_to", item2.Key)); } } if (GUILayout.Button(Loc.T("world.del"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(40f) })) { Dictionary dictionary2 = ParseKv(_bookmarksCfg.Value); dictionary2.Remove(item2.Key); _bookmarksCfg.Value = JoinKv(dictionary2); ((BaseUnityPlugin)this).Config.Save(); } GUILayout.EndHorizontal(); } DrawSection(Loc.T("world.area_actions")); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.combat"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); if (GUILayout.Button(Loc.T("world.kill_50"), _buttonStyle, Array.Empty())) { KillNearby(50f, includeTamed: false); } if (ConfirmButton("killAll", Loc.T("world.kill_all"))) { KillNearby(100000f, includeTamed: false); } if (GUILayout.Button(Loc.T("world.tame_30"), _buttonStyle, Array.Empty())) { TameNearby(30f); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.cleanup"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); if (ConfirmButton("cleanupDrops", Loc.T("world.ground_items"))) { CleanupDrops(50f); } if (GUILayout.Button(Loc.T("world.repair_builds"), _buttonStyle, Array.Empty())) { RepairBuilds(50f); } if (ConfirmButton("clearTrees", Loc.T("world.clear_trees"))) { ClearTrees(20f); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("world.world"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(80f) }); if (GUILayout.Button(Loc.T("world.explore_map"), _buttonStyle, Array.Empty())) { Minimap instance2 = Minimap.instance; if (instance2 != null) { instance2.ExploreAll(); } Message(Loc.T("world.msg_map_explored")); } if (GUILayout.Button(Loc.T("world.ping_pos"), _buttonStyle, Array.Empty())) { Chat instance3 = Chat.instance; if (instance3 != null) { instance3.SendPing(((Component)LocalPlayer).transform.position); } Message(Loc.T("world.msg_pinged")); } bool flag2 = GUILayout.Toggle(_peaceful, " " + Loc.T("world.peaceful"), _toggleStyle, Array.Empty()); if (flag2 != _peaceful) { _peaceful = flag2; SrvRpc("AP_SrvPeaceful", _peaceful); Message(Loc.T("world.msg_peaceful", OnOff(_peaceful))); } GUILayout.EndHorizontal(); DrawSection(Loc.T("world.global_keys")); GUILayout.Label(Loc.T("world.global_keys_hint"), _hintStyle, Array.Empty()); if ((Object)(object)ZoneSystem.instance != (Object)null) { IEnumerable globalKeysLayout = _globalKeysLayout; foreach (string item3 in globalKeysLayout ?? ZoneSystem.instance.GetGlobalKeys()) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(item3, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); if (GUILayout.Button(Loc.T("world.remove"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) })) { ZoneSystem.instance.RemoveGlobalKey(item3); Message(Loc.T("world.msg_key_removed", item3)); } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(Array.Empty()); _newGlobalKey = GUILayout.TextField(_newGlobalKey, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); if (GUILayout.Button(Loc.T("world.add_key"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) }) && !string.IsNullOrEmpty(_newGlobalKey)) { ZoneSystem.instance.SetGlobalKey(_newGlobalKey); Message(Loc.T("world.msg_key_added", _newGlobalKey)); _newGlobalKey = ""; } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } private void KillNearby(float radius, bool includeTamed) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown Vector3 position = ((Component)LocalPlayer).transform.position; int num = 0; foreach (Character item in Character.GetAllCharacters().ToList()) { if (!((Object)(object)item == (Object)null) && !item.IsPlayer() && (includeTamed || !item.IsTamed()) && !(Vector3.Distance(((Component)item).transform.position, position) > radius)) { HitData val = new HitData(); val.m_damage.m_damage = 1E+10f; item.Damage(val); num++; } } Message(Loc.T("world.msg_killed", num)); } private void TameNearby(float radius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)LocalPlayer).transform.position; int num = 0; foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)(object)allCharacter == (Object)null) && !allCharacter.IsPlayer() && !allCharacter.IsTamed() && !(Vector3.Distance(((Component)allCharacter).transform.position, position) > radius) && !((Object)(object)((Component)allCharacter).GetComponent() == (Object)null)) { allCharacter.SetTamed(true); num++; } } Message(Loc.T("world.msg_tamed", num)); } private void CleanupDrops(float radius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)LocalPlayer).transform.position; int num = 0; ItemDrop[] array = Object.FindObjectsOfType(); foreach (ItemDrop val in array) { if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, position) > radius)) { ZNetView component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { component.ClaimOwnership(); component.Destroy(); num++; } } } Message(Loc.T("world.msg_drops_removed", num)); } private void RepairBuilds(float radius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)LocalPlayer).transform.position; int num = 0; WearNTear[] array = Object.FindObjectsOfType(); foreach (WearNTear val in array) { if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, position) > radius) && val.Repair()) { num++; } } Message(Loc.T("world.msg_repaired", num)); } private void ClearTrees(float radius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)LocalPlayer).transform.position; int num = 0; TreeBase[] array = Object.FindObjectsOfType(); foreach (TreeBase val in array) { if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, position) > radius)) { ZNetView component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { component.ClaimOwnership(); component.Destroy(); num++; } } } TreeLog[] array2 = Object.FindObjectsOfType(); foreach (TreeLog val2 in array2) { if (!((Object)(object)val2 == (Object)null) && !(Vector3.Distance(((Component)val2).transform.position, position) > radius)) { ZNetView component2 = ((Component)val2).GetComponent(); if (!((Object)(object)component2 == (Object)null) && component2.IsValid()) { component2.ClaimOwnership(); component2.Destroy(); num++; } } } Message(Loc.T("world.msg_trees_removed", num)); } private void DrawPlayersTab() { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0133: 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_01f8: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_0863: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06de: 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_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: 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_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNet.instance == (Object)null) { GUILayout.Label(Loc.T("players.not_connected"), _labelStyle, Array.Empty()); return; } DrawSection(Loc.T("players.broadcast_section")); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("players.broadcast"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) }); _broadcastText = GUILayout.TextField(_broadcastText, _textFieldStyle, Array.Empty()); if (GUILayout.Button(Loc.T("players.send_all"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(90f) }) && !string.IsNullOrEmpty(_broadcastText)) { SrvRpc("AP_SrvBroadcast", _broadcastText); Message(Loc.T("players.msg_broadcast_sent")); _broadcastText = ""; } if (GUILayout.Button(Loc.T("players.summon_all"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(95f) })) { foreach (PlayerInfo item in OtherPlayers()) { SummonPlayer(item); } Message(Loc.T("players.msg_summon_all")); } GUILayout.EndHorizontal(); DrawSection(Loc.T("players.connected")); _playersScroll = GUILayout.BeginScrollView(_playersScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(Mathf.Min(250f, ListView(330f))) }); foreach (PlayerInfo player in ZNet.instance.GetPlayerList()) { bool flag = (Object)(object)LocalPlayer != (Object)null && player.m_name == LocalPlayer.GetPlayerName(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(player.m_name + (flag ? (" " + Loc.T("players.you_suffix")) : ""), _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); GUILayout.Label($"({player.m_position.x:0}, {player.m_position.z:0})", _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); if (!flag) { if (GUILayout.Button(Loc.T("players.tp_to"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(50f) })) { ((Character)LocalPlayer).TeleportTo(player.m_position + Vector3.up, ((Component)LocalPlayer).transform.rotation, true); Message(Loc.T("world.msg_tp_to", player.m_name)); } if (GUILayout.Button(Loc.T("players.summon"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(65f) })) { SummonPlayer(player); } if (GUILayout.Button(Loc.T("players.watch"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(55f) })) { if (!_ghost) { _ghost = true; LocalPlayer.SetGhostMode(true); } if (!_fly) { _fly = true; Player.m_debugMode = true; LocalPlayer.ToggleDebugFly(); } ((Character)LocalPlayer).TeleportTo(player.m_position + Vector3.up * 8f, ((Component)LocalPlayer).transform.rotation, true); Message(Loc.T("players.msg_watching", player.m_name)); } if (GUILayout.Button(Loc.T("players.heal"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(45f) })) { SrvRpc("AP_SrvHeal", PeerIdOf(player)); Message(Loc.T("players.msg_healing", player.m_name)); } if (GUILayout.Button(Loc.T("players.map"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(45f) })) { Chat instance = Chat.instance; if (instance != null) { instance.SendPing(player.m_position); } Message(Loc.T("players.msg_pinged", player.m_name)); } if (GUILayout.Button("⚡", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(30f) })) { SendServerSpawn(1, "lightning", player.m_position, 1, 1, tamed: false); Message(Loc.T("players.msg_lightning", player.m_name)); } if (GUILayout.Button(Loc.T("players.inventory"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(75f) })) { _inspectPlayerName = player.m_name; _inspectTargetId = PeerIdOf(player); _inspectInventory = null; _inspectPending = true; _inspectRequestTime = Time.time; SrvRpc("AP_SrvReqInv", PeerIdOf(player)); } if (GUILayout.Button(Loc.T("players.kick"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(45f) })) { SrvRpc("AP_SrvKick", PeerIdOf(player)); Message(Loc.T("players.msg_kicked", player.m_name)); } if (ConfirmButton("ban:" + PeerIdOf(player), Loc.T("players.ban"), GUILayout.MinWidth(42f))) { SrvRpc("AP_SrvBan", PeerIdOf(player)); Message(Loc.T("players.msg_banned", player.m_name)); } } else if (GUILayout.Button(Loc.T("players.inventory"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(75f) })) { _inspectPlayerName = player.m_name; _inspectTargetId = PeerIdOf(player); _inspectInventory = null; _inspectPending = true; _inspectRequestTime = Time.time; SrvRpc("AP_SrvReqInv", PeerIdOf(player)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(20f); GUILayout.Label(Loc.T("players.note"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(40f) }); _playerNotes.TryGetValue(player.m_name, out var value); string text = GUILayout.TextField(value ?? "", _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); if (text != (value ?? "")) { _playerNotes[player.m_name] = text; _notesDirty = true; } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); DrawSection(Loc.T("players.inv_viewer")); GUILayout.Label(_inspectPlayerName ?? Loc.T("players.pick_player"), _labelStyle, Array.Empty()); if (_inspectPending) { GUILayout.Label((Time.time - _inspectRequestTime > 5f) ? Loc.T("players.no_response") : Loc.T("players.waiting"), _labelStyle, Array.Empty()); } else { if (_inspectInventory == null) { return; } _inspectScroll = GUILayout.BeginScrollView(_inspectScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(140f) }); foreach (var (text2, num, num2) in _inspectInventory) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(text2, _cellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); GUILayout.Label($"x{num}", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(60f) }); GUILayout.Label($"q{num2}", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(40f) }); GUILayout.FlexibleSpace(); if (GUILayout.Button(Loc.T("players.remove_1"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(75f) })) { RemoveFromInspected(text2, 1); } if (GUILayout.Button(Loc.T("players.remove_all"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(85f) })) { RemoveFromInspected(text2, num); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.Label(Loc.T("players.remove_hint"), _hintStyle, Array.Empty()); } } private void RemoveFromInspected(string itemName, int amount) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (_inspectTargetId != 0L && amount > 0) { ZPackage val = new ZPackage(); val.Write(_inspectTargetId); val.Write(itemName); val.Write(amount); SrvRpc("AP_SrvInvRemove", val); Message(Loc.T("players.msg_removing", amount, itemName, _inspectPlayerName)); } } private void SummonPlayer(PlayerInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ZPackage val = new ZPackage(); val.Write(PeerIdOf(info)); val.Write(((Component)LocalPlayer).transform.position + ((Component)LocalPlayer).transform.forward * 2f); SrvRpc("AP_SrvTeleport", val); Message(Loc.T("players.msg_summoning", info.m_name)); } private static int? ReflectCount(object instance, params string[] fieldNames) { if (instance == null) { return null; } foreach (string text in fieldNames) { try { if (AccessTools.Field(instance.GetType(), text)?.GetValue(instance) is ICollection collection) { return collection.Count; } } catch { } } return null; } private static string OrNa(int? v) { if (!v.HasValue) { return "n/a"; } return v.Value.ToString(); } private void RefreshServerStats() { int num = (((Object)(object)EnvMan.instance != (Object)null && (Object)(object)ZNet.instance != (Object)null) ? EnvMan.instance.GetDay(ZNet.instance.GetTimeSeconds()) : 0); int num2 = (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetPlayerList().Count : 0); int count = Character.GetAllCharacters().Count; int num3 = Mathf.RoundToInt(1f / Mathf.Max(0.0001f, Time.smoothDeltaTime)); _statsMain = Loc.T("srv.stats_line", num, num2, count, num3); int? v = ReflectCount(ZDOMan.instance, "m_objectsByID", "m_objectsByID_", "m_objects"); int? v2 = ReflectCount(ZoneSystem.instance, "m_zones", "m_loadedZones"); TimeSpan timeSpan = TimeSpan.FromSeconds(Time.realtimeSinceStartup); _statsLoad = Loc.T("srv.load_line", OrNa(v), OrNa(v2), $"{(int)timeSpan.TotalHours:00}:{timeSpan.Minutes:00}"); ZNetPeer val = (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetServerPeer() : null); _statsHost = ((val?.m_socket != null) ? Loc.T("srv.host", val.m_socket.GetHostName()) : ""); } private void DrawServerTab() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) _serverScroll = GUILayout.BeginScrollView(_serverScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(ListView(100f)) }); if (Time.realtimeSinceStartup >= _nextStatsRefresh) { _nextStatsRefresh = Time.realtimeSinceStartup + 0.25f; RefreshServerStats(); } DrawSection(Loc.T("srv.live_stats")); GUILayout.Label(_statsMain, _labelStyle, Array.Empty()); GUILayout.Label(_statsLoad, _labelStyle, Array.Empty()); if (_statsHost.Length > 0) { GUILayout.Label(_statsHost, _labelStyle, Array.Empty()); } GUILayout.Label(Loc.T("srv.versions", "2.3.0", _srvCompVersion ?? Loc.T("srv.no_reply")), _labelStyle, Array.Empty()); DrawSection(Loc.T("srv.unban_title")); GUILayout.BeginHorizontal(Array.Empty()); _unbanId = GUILayout.TextField(_unbanId, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); if (GUILayout.Button(Loc.T("srv.unban"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(70f) }) && !string.IsNullOrEmpty(_unbanId)) { SrvRpc("AP_SrvUnban", _unbanId); Message(Loc.T("srv.unban_requested", _unbanId)); _unbanId = ""; } GUILayout.EndHorizontal(); DrawSection(Loc.T("srv.joinlog_title")); if (_joinLog.Count == 0) { GUILayout.Label(Loc.T("common.nothing_yet"), _labelStyle, Array.Empty()); } int num = Math.Min(_joinLog.Count, 40); for (int i = 0; i < num; i++) { GUILayout.Label(_joinLog[i], _labelStyle, Array.Empty()); } GUILayout.EndScrollView(); } private void DrawSideWindow(int id) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type == 8) { _sideModeLayout = _sideMode; _bugStatusLayout = _bugStatus; _bugCoolLayout = Time.time < _nextBugSend; } SideMode sideModeLayout = _sideModeLayout; GUILayout.Space(12f); GUILayout.BeginHorizontal(Array.Empty()); bool flag = sideModeLayout == SideMode.WhatsNew; bool flag2 = sideModeLayout == SideMode.BugReport; if (GUILayout.Toggle(flag, Loc.T("side.whats_new"), _catStyle, Array.Empty()) && !flag) { _sideMode = SideMode.WhatsNew; } if (GUILayout.Toggle(flag2, Loc.T("side.bug_report"), _catStyle, Array.Empty()) && !flag2) { _sideMode = SideMode.BugReport; } GUILayout.FlexibleSpace(); if (GUILayout.Button("✕", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(30f) })) { _sideMode = SideMode.None; } GUILayout.EndHorizontal(); switch (sideModeLayout) { case SideMode.WhatsNew: DrawSection(Loc.T("side.version", "2.3.0")); _sideScroll = GUILayout.BeginScrollView(_sideScroll, Array.Empty()); GUILayout.Label("• The panel speaks your language: German, French, Spanish, Italian, Portuguese (BR), Polish, Dutch and Swedish. It follows Valheim's own language setting by default — change it under Settings → Language.\n\n• Smarter search: results are ranked by relevance, so typing \"iron\" puts Iron first instead of burying it alphabetically. Typing no longer re-sorts the whole list on every keystroke.\n\n• Multi-step undo: Undo spawn now steps back through your last 20 spawns instead of just one, and each admin has their own history — your undo can't delete someone else's work.\n\n• Destructive actions ask first: Kill ALL loaded, Ground items, Clear trees and Ban now need a second click to confirm.\n\n• Status effects for anyone: the status-effect browser now has the same Me/any-player target picker as the skill browser (needs companion 2.3.0 on the target).\n\n• Undo actually works on dedicated servers now — the destroy silently did nothing server-side unless the server owned the object.\n\n• Scrolling panel lists no longer zooms the vanilla camera (muted at the IL level, with startup verification in the log). ValheimPlus's separate FirstPerson zoom gets a best-effort mute too.\n\n• Layout survives big font sizes: labels never wrap mid-word and buttons no longer stretch across the row.\n\n• Server tab: added ZDOs loaded, zones loaded and session uptime.\n\n• Smoother: the panel does far less work per frame across every tab, and switches to a readable font automatically if the game's Norse font can't draw your language.\n\n• If the mod has been useful, there's now a \"Buy the developer a coffee\" button in Settings. Entirely optional — the mod is free and always will be.", _proseStyle, Array.Empty()); GUILayout.EndScrollView(); GUILayout.Label(Loc.T("side.whats_new_hint"), _hintStyle, Array.Empty()); break; case SideMode.BugReport: { DrawSection(Loc.T("side.describe")); _bugText = GUILayout.TextArea(_bugText, _textAreaStyle, (GUILayoutOption[])(object)new GUILayoutOption[3] { GUILayout.MinHeight(120f), GUILayout.MaxHeight(170f), GUILayout.ExpandHeight(false) }); _bugAttachShot = GUILayout.Toggle(_bugAttachShot, " " + Loc.T("side.attach"), _toggleStyle, Array.Empty()); GUILayout.Space(4f); bool flag3 = !string.IsNullOrEmpty(_bugWebhookCfg.Value); bool bugCoolLayout = _bugCoolLayout; GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(_bugSending ? Loc.T("side.sending") : Loc.T("side.send"), _buttonStyle, Array.Empty()) && !_bugSending && flag3 && !bugCoolLayout) { if (_bugText.Trim().Length < 10) { _bugStatus = Loc.T("side.describe_first"); } else { ((MonoBehaviour)this).StartCoroutine(SendBugReport()); } } if (GUILayout.Button(Loc.T("side.discord"), _buttonStyle, Array.Empty())) { Application.OpenURL("https://discord.gg/2RVn78hNrz"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); DrawCoffeeButton(200f); GUILayout.EndHorizontal(); if (!flag3) { GUILayout.Label(Loc.T("side.no_webhook"), _hintStyle, Array.Empty()); } else if (bugCoolLayout) { GUILayout.Label(Loc.T("side.cooldown", Mathf.Max(1, Mathf.CeilToInt(_nextBugSend - Time.time))), _dimLabelStyle, Array.Empty()); } if (_bugStatusLayout != null) { GUILayout.Label(_bugStatusLayout, _dimLabelStyle, Array.Empty()); } GUILayout.FlexibleSpace(); GUILayout.Label(Loc.T("side.privacy"), _hintStyle, Array.Empty()); break; } } } private IEnumerator SendBugReport() { _bugSending = true; _bugStatus = null; byte[] jpg = null; if (_bugAttachShot) { yield return (object)new WaitForEndOfFrame(); try { Texture2D val = new Texture2D(Screen.width, Screen.height, (TextureFormat)3, false); val.ReadPixels(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), 0, 0); val.Apply(); jpg = EncodeJpg(val); Object.Destroy((Object)(object)val); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Bug-report screenshot failed (sending without it): " + ex.Message)); } } string report = "**Bug report** — Advanced Admin Panel 2.3.0\nGame: " + GameVersionString() + " · Mode: " + SessionModeString() + "\nReporter: " + (((Object)(object)LocalPlayer != (Object)null) ? LocalPlayer.GetPlayerName() : "(not in game)") + "\n\n" + _bugText.Trim(); string text = _bugText.Trim().Split(new char[1] { '\n' })[0]; string title = "[2.3.0] " + (((Object)(object)LocalPlayer != (Object)null) ? LocalPlayer.GetPlayerName() : "unknown") + ": " + text; if (title.Length > 95) { title = title.Substring(0, 95) + "…"; } string url = _bugWebhookCfg.Value; Task task = Task.Run(() => PostToWebhook(url, title, report, jpg)); while (!task.IsCompleted) { yield return null; } _bugStatus = task.Result; if (task.Result != null && task.Result.StartsWith("Sent", StringComparison.Ordinal)) { _bugText = ""; _nextBugSend = Time.time + 60f; } _bugSending = false; } private static string PostToWebhook(string url, string threadName, string content, byte[] jpg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown try { ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; HttpClient val = new HttpClient(); try { MultipartFormDataContent val2 = new MultipartFormDataContent(); try { if (content.Length > 1900) { content = content.Substring(0, 1900) + "…"; } val2.Add((HttpContent)new StringContent("{\"content\":" + JsonString(content) + ",\"thread_name\":" + JsonString(threadName) + "}", Encoding.UTF8, "application/json"), "payload_json"); if (jpg != null) { ByteArrayContent val3 = new ByteArrayContent(jpg); ((HttpContent)val3).Headers.ContentType = new MediaTypeHeaderValue("image/jpeg"); val2.Add((HttpContent)(object)val3, "files[0]", "screenshot.jpg"); } HttpResponseMessage result = val.PostAsync(url, (HttpContent)(object)val2).GetAwaiter().GetResult(); return result.IsSuccessStatusCode ? Loc.T("side.sent_thanks") : Loc.T("side.rejected", (int)result.StatusCode); } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } catch (Exception ex) { return Loc.T("side.send_failed", ex.Message); } } private static string JsonString(string s) { StringBuilder stringBuilder = new StringBuilder("\""); foreach (char c in s) { switch (c) { case '"': stringBuilder.Append("\\\""); continue; case '\\': stringBuilder.Append("\\\\"); continue; case '\n': stringBuilder.Append("\\n"); continue; case '\t': stringBuilder.Append("\\t"); continue; case '\r': continue; } if (c < ' ') { StringBuilder stringBuilder2 = stringBuilder.Append("\\u"); int num = c; stringBuilder2.Append(num.ToString("x4")); } else { stringBuilder.Append(c); } } return stringBuilder.Append('"').ToString(); } private static byte[] EncodeJpg(Texture2D tex) { MethodInfo methodInfo = AccessTools.Method(AccessTools.TypeByName("UnityEngine.ImageConversion"), "EncodeToJPG", new Type[2] { typeof(Texture2D), typeof(int) }, (Type[])null); if (!(methodInfo != null)) { return null; } return (byte[])methodInfo.Invoke(null, new object[2] { tex, 85 }); } private static string GameVersionString() { try { return AccessTools.Method(AccessTools.TypeByName("Version"), "GetVersionString", Type.EmptyTypes, (Type[])null)?.Invoke(null, null)?.ToString() ?? Application.version; } catch { return "unknown"; } } private static string SessionModeString() { if (!((Object)(object)ZNet.instance == (Object)null)) { if (!ZNet.instance.IsServer()) { return "client on dedicated server"; } return "host / single-player"; } return "menu"; } private static Color WoodColor(int alphaPct) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) return new Color(0.118f, 0.082f, 0.055f, (float)Mathf.Clamp(alphaPct, 55, 100) / 100f); } private void ApplyFontSizes() { int num = Mathf.Clamp(_fontSizeLive, 10, 20); _labelStyle.fontSize = num; _buttonStyle.fontSize = num; _toggleStyle.fontSize = num; _textFieldStyle.fontSize = ((num != 13) ? num : 0); if (_textAreaStyle != null) { _textAreaStyle.fontSize = _textFieldStyle.fontSize; } _headerStyle.fontSize = num + 1; _windowStyle.fontSize = Mathf.Min(num + 2, 18); _tabStyle.fontSize = Mathf.Clamp(num + 1, 12, 15); _catStyle.fontSize = Mathf.Clamp(num - 1, 10, 14); _dimLabelStyle.fontSize = Mathf.Max(num - 1, 10); if (_cellStyle != null) { _cellStyle.fontSize = num; } if (_dimCellStyle != null) { _dimCellStyle.fontSize = Mathf.Max(num - 1, 10); } if (_hintStyle != null) { _hintStyle.fontSize = Mathf.Max(num - 1, 10); } if (_proseStyle != null) { _proseStyle.fontSize = num; } } private void ApplyPanelAlpha() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_texWood == (Object)null)) { _texWood.SetPixel(0, 0, WoodColor(_panelAlphaLive)); _texWood.Apply(); } } private void CommitUiSettings() { if (_fontSizeCfg != null && _panelAlphaCfg != null) { bool flag = false; if (_fontSizeCfg.Value != _fontSizeLive) { _fontSizeCfg.Value = _fontSizeLive; flag = true; } if (_panelAlphaCfg.Value != _panelAlphaLive) { _panelAlphaCfg.Value = _panelAlphaLive; flag = true; } if (flag) { ((BaseUnityPlugin)this).Config.Save(); } } } private void SelectFont(string choice) { if (!(_fontChoiceCfg.Value == choice)) { _fontChoiceCfg.Value = choice; _fontApplied = false; _fontTries = 0; _nextFontTry = 0f; } } private void DrawSettingsTab() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Invalid comparison between Unknown and I4 //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Invalid comparison between Unknown and I4 //IL_061f: Unknown result type (might be due to invalid IL or missing references) _settingsScroll = GUILayout.BeginScrollView(_settingsScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(ListView(100f)) }); DrawSection(Loc.T("set.appearance")); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("set.font"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(90f) }); string[] fontChoices = FontChoices; foreach (string text in fontChoices) { bool flag = _fontChoiceCfg.Value == text; if (GUILayout.Toggle(flag, text, _catStyle, Array.Empty()) && !flag) { SelectFont(text); } } GUILayout.EndHorizontal(); GUILayout.Label(Loc.T("set.font_hint"), _hintStyle, Array.Empty()); if (Loc.NeedsFallbackFont && _fontChoiceCfg.Value != "Default") { GUILayout.Label(Loc.T("set.font_fallback_note"), _hintStyle, Array.Empty()); } GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("set.font_size", _fontSizeLive), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(120f) }); int num = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_fontSizeLive, 10f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) })); if (GUILayout.Button("−", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(30f) })) { num = Mathf.Max(10, _fontSizeLive - 1); } if (GUILayout.Button("+", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(30f) })) { num = Mathf.Min(20, _fontSizeLive + 1); } GUILayout.EndHorizontal(); if (num != _fontSizeLive) { _fontSizeLive = num; ApplyFontSizes(); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("set.opacity", _panelAlphaLive), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(120f) }); int num2 = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_panelAlphaLive, 55f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) })); GUILayout.EndHorizontal(); if (num2 != _panelAlphaLive) { _panelAlphaLive = num2; ApplyPanelAlpha(); } GUILayout.Space(6f); bool flag2 = GUILayout.Toggle(_showLogoCfg.Value, " " + Loc.T("set.show_logo"), _toggleStyle, Array.Empty()); if (flag2 != _showLogoCfg.Value) { _showLogoCfg.Value = flag2; ((BaseUnityPlugin)this).Config.Save(); } GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Loc.T("set.language"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(90f) }); int selected = Mathf.Max(0, Array.IndexOf(Loc.MenuNames, _languageCfg.Value)); DropdownButton("language", "", Loc.MenuNames, selected, 200f); GUILayout.EndHorizontal(); if (DropdownOptions("language", Loc.MenuNames, ref selected, 200f)) { _languageCfg.Value = Loc.MenuNames[selected]; ((BaseUnityPlugin)this).Config.Save(); Loc.Refresh(_languageCfg.Value); _fontApplied = false; } GUILayout.Label(Loc.T("set.language_hint"), _hintStyle, Array.Empty()); DrawSection(Loc.T("set.behavior")); bool flag3 = GUILayout.Toggle(_cameraLockCfg.Value, " " + Loc.T("set.camera_lock"), _toggleStyle, Array.Empty()); if (flag3 != _cameraLockCfg.Value) { _cameraLockCfg.Value = flag3; ((BaseUnityPlugin)this).Config.Save(); } DrawSection(Loc.T("set.panel")); bool flag4 = GUILayout.Toggle(_autoWhatsNewCfg.Value, " " + Loc.T("set.auto_whats_new"), _toggleStyle, Array.Empty()); if (flag4 != _autoWhatsNewCfg.Value) { _autoWhatsNewCfg.Value = flag4; ((BaseUnityPlugin)this).Config.Save(); } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Loc.T("set.whats_new"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(150f) })) { _sideMode = SideMode.WhatsNew; } if (GUILayout.Button(Loc.T("set.report_bug"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(130f) })) { _sideMode = SideMode.BugReport; } GUILayout.EndHorizontal(); DrawSection(Loc.T("set.support")); GUILayout.BeginHorizontal(Array.Empty()); DrawCoffeeButton(240f); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Label(Loc.T("set.support_hint"), _hintStyle, Array.Empty()); DrawSection(Loc.T("set.hotkeys")); DrawRebindRow(Loc.T("set.key_toggle"), _toggleKey, 1); DrawRebindRow(Loc.T("set.key_map_tp"), _mapTpKey, 2); if (_rebindTargetLayout != 0) { GUILayout.Label(Loc.T("set.rebind_hint"), _headerStyle, Array.Empty()); } if (_rebindTarget != 0) { Event current = Event.current; if ((int)current.type == 4 && (int)current.keyCode != 0) { if ((int)current.keyCode != 27) { ((_rebindTarget == 1) ? _toggleKey : _mapTpKey).Value = current.keyCode; ((BaseUnityPlugin)this).Config.Save(); } _rebindTarget = 0; current.Use(); } else if ((int)current.type == 0 && current.button >= 2 && current.button <= 6) { ((_rebindTarget == 1) ? _toggleKey : _mapTpKey).Value = (KeyCode)(323 + current.button); ((BaseUnityPlugin)this).Config.Save(); _rebindTarget = 0; current.Use(); } } DrawSection(Loc.T("set.reset")); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Loc.T("set.reset_window"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(230f) })) { _windowRect = new Rect(60f, 60f, 740f, 680f); SaveWindowRect(); } if (GUILayout.Button(Loc.T("set.reset_appearance"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(160f) })) { _fontSizeLive = 13; _panelAlphaLive = 96; ApplyFontSizes(); ApplyPanelAlpha(); CommitUiSettings(); SelectFont(FontChoices[0]); } GUILayout.EndHorizontal(); GUILayout.Label(Loc.T("set.saved_hint"), _hintStyle, Array.Empty()); GUILayout.EndScrollView(); } private void DrawRebindRow(string label, ConfigEntry entry, int target) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label + ":", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(170f) }); GUILayout.Label($"[{entry.Value}]", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(100f) }); bool flag = _rebindTarget == target; if (GUILayout.Button(flag ? Loc.T("set.listening") : Loc.T("set.rebind"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(110f) })) { _rebindTarget = ((!flag) ? target : 0); } GUILayout.EndHorizontal(); } } internal static class Loc { private static readonly Dictionary Fallback = new Dictionary(StringComparer.Ordinal); private static Dictionary _active = new Dictionary(StringComparer.Ordinal); private static string _activeCode = "en"; private static bool _loaded; internal static readonly string[] Shipped = new string[9] { "en", "de", "fr", "es", "it", "pt-BR", "pl", "nl", "sv" }; internal static readonly string[] MenuNames = new string[10] { "Auto (game language)", "English", "Deutsch", "Français", "Español", "Italiano", "Português (BR)", "Polski", "Nederlands", "Svenska" }; private static readonly Dictionary GameLangToCode = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "English", "en" }, { "German", "de" }, { "French", "fr" }, { "Spanish", "es" }, { "Italian", "it" }, { "Portuguese_Brazilian", "pt-BR" }, { "Portuguese_European", "pt-BR" }, { "Polish", "pl" }, { "Dutch", "nl" }, { "Swedish", "sv" } }; internal static string ActiveCode => _activeCode; internal static bool NeedsFallbackFont { get; private set; } internal static void Refresh(string configChoice) { if (Fallback.Count == 0) { LoadInto(Fallback, "en"); } string text = ResolveCode(configChoice); if (!_loaded || !(text == _activeCode)) { _activeCode = text; _active = ((text == "en") ? Fallback : LoadNew(text)); _loaded = true; } } private static string ResolveCode(string configChoice) { if (!string.IsNullOrEmpty(configChoice)) { int num = Array.IndexOf(MenuNames, configChoice); if (num > 0 && num - 1 < Shipped.Length) { return Shipped[num - 1]; } } try { string text = ((Localization.instance != null) ? Localization.instance.GetSelectedLanguage() : null); if (!string.IsNullOrEmpty(text) && GameLangToCode.TryGetValue(text, out var value)) { return value; } } catch { } return "en"; } private static Dictionary LoadNew(string code) { Dictionary dictionary = new Dictionary(StringComparer.Ordinal); LoadInto(dictionary, code); return dictionary; } private static void LoadInto(Dictionary dict, string code) { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string n) => n.EndsWith("Localization." + code + ".txt", StringComparison.OrdinalIgnoreCase)); if (text != null) { using Stream stream = executingAssembly.GetManifestResourceStream(text); using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8); Parse(streamReader.ReadToEnd(), dict); } } catch (Exception ex) { Debug.LogWarning((object)("[AdminPanel] embedded locale '" + code + "' failed to load: " + ex.Message)); } try { string path = Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ".", "AdminPanel_Localization"), code + ".txt"); if (File.Exists(path)) { Parse(File.ReadAllText(path, Encoding.UTF8), dict); } } catch (Exception ex2) { Debug.LogWarning((object)("[AdminPanel] disk locale '" + code + "' failed to load: " + ex2.Message)); } } private static void Parse(string text, Dictionary dict) { if (string.IsNullOrEmpty(text)) { return; } string[] array = text.Split(new char[1] { '\n' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim('\r', ' ', '\t'); if (text2.Length == 0 || text2[0] == '#') { continue; } int num = text2.IndexOf('='); if (num > 0) { string text3 = text2.Substring(0, num).Trim(); string value = text2.Substring(num + 1).Trim().Replace("\\n", "\n"); if (text3.Length > 0) { dict[text3] = value; } } } } internal static string T(string key) { if (_active.TryGetValue(key, out var value)) { return value; } if (Fallback.TryGetValue(key, out var value2)) { return value2; } return key; } internal static string T(string key, params object[] args) { string text = T(key); if (args == null || args.Length == 0) { return text; } try { return string.Format(text, args); } catch (FormatException) { Debug.LogWarning((object)("[AdminPanel] locale '" + _activeCode + "' key '" + key + "' has a bad format string")); return text; } } internal static bool ResolveFontSafety(Font font, IEnumerable contentSamples) { NeedsFallbackFont = false; if ((Object)(object)font == (Object)null) { return false; } try { foreach (string item in EnumerateProbeText(contentSamples)) { if (string.IsNullOrEmpty(item)) { continue; } string text = item; foreach (char c in text) { if (c >= '\u0080' && !char.IsWhiteSpace(c) && !font.HasCharacter(c)) { NeedsFallbackFont = true; return true; } } } } catch { } return false; } private static IEnumerable EnumerateProbeText(IEnumerable contentSamples) { foreach (string value in _active.Values) { yield return value; } if (contentSamples == null) { yield break; } foreach (string contentSample in contentSamples) { yield return contentSample; } } } }