Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Odins Eye v0.3.0
OdinsEye.dll
Decompiled 10 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("OdinsEye")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.3.0.0")] [assembly: AssemblyInformationalVersion("0.3.0+aa865b465c1c6fb9dab7967c124474efcb8deef8")] [assembly: AssemblyProduct("OdinsEye")] [assembly: AssemblyTitle("OdinsEye")] [assembly: AssemblyVersion("0.3.0.0")] [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 OdinsEye { internal static class AdminTab { private const float Gap = 24f; private const float RowH = 26f; private static Vector2 _scroll; private static float _contentH = 600f; private static float _deleteRadius = 5f; private static float _fuel = 10f; private static float _players; private static float _terrainRadius = 10f; private static string _deleteName = ""; private static string _unban = ""; private const float RepairRange = 30f; internal static void Draw(Rect r) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, ((Rect)(ref r)).width - 20f, _contentH); _scroll = GUI.BeginScrollView(r, _scroll, val); float num = (((Rect)(ref val)).width - 24f) * 0.5f; float num2 = Left(0f, num); float num3 = Right(num + 24f, num); _contentH = Mathf.Max(num2, num3) + 8f; GUI.EndScrollView(); } private unsafe static float Left(float x, float w) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01da: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) float y = 0f; ZNet instance = ZNet.instance; Widgets.Header(x, ref y, w, "Server"); if ((Object)(object)instance != (Object)null) { Widgets.Note(x, ref y, w, "World: " + instance.GetWorldName() + " " + (instance.IsServer() ? "you are the host" : (Commands.IsAdmin ? "you are an admin" : "you are not an admin"))); } float num = (w - 6f) * 0.5f; Widgets.Command(new Rect(x, y, num, 26f), "Save world now", "save", null, adminOnly: true); Widgets.Command(new Rect(x + num + 6f, y, num, 26f), "List banned", "banned", null, adminOnly: true); y += 30f; GUI.SetNextControlName("OdinsEye_Unban"); _unban = GUI.TextField(new Rect(x, y, w - 110f, 26f), _unban ?? "", 64); bool enabled = GUI.enabled; GUI.enabled = enabled && !string.IsNullOrWhiteSpace(_unban); Widgets.Command(new Rect(x + w - 104f, y, 104f, 26f), "Unban", "unban " + (_unban ?? "").Trim(), null, adminOnly: true); GUI.enabled = enabled; y += 30f; Widgets.Note(x, ref y, w, "Unban takes a player ID or IP from the banned list"); y += 6f; Widgets.Header(x, ref y, w, "Players"); int num2 = 0; foreach (PlayerInfo item in Widgets.OtherPlayers()) { num2++; PlatformUserID id = item.m_userInfo.m_id; string text = ((object)(*(PlatformUserID*)(&id))/*cast due to .constrained prefix*/).ToString(); Ui.Label(new Rect(x, y, w - 170f, 24f), item.m_name, Ui.Small); Widgets.Command(new Rect(x + w - 164f, y, 80f, 23f), "Kick", "kick " + text, "Kick " + item.m_name + "?", adminOnly: true); Widgets.Command(new Rect(x + w - 80f, y, 80f, 23f), "Ban", "ban " + text, "Ban " + item.m_name + " from this server?", adminOnly: true); y += 26f; } if (num2 == 0) { Widgets.Note(x, ref y, w, "No other players here."); } y += 6f; Widgets.Header(x, ref y, w, "Difficulty"); Widgets.Note(x, ref y, w, "Enemies scale as if this many players were near"); _players = GUI.HorizontalSlider(new Rect(x, y + 8f, w - 100f, 16f), _players, 0f, 10f); int num3 = Mathf.RoundToInt(_players); Widgets.Command(new Rect(x + w - 90f, y, 90f, 26f), (num3 == 0) ? "Real" : $"{num3} players", "players " + num3); return y + 30f; } private static float Right(float x, float w) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) float y = 0f; ZoneSystem instance = ZoneSystem.instance; float num = (w - 6f) * 0.5f; Widgets.Header(x, ref y, w, "World rules"); bool flag = (Object)(object)instance != (Object)null && instance.GetGlobalKey((GlobalKeys)32); Widgets.Switch(new Rect(x, y + 4f, num, 24f), "Portals off", flag, "noportals", "noportals"); bool flag2 = (Object)(object)instance != (Object)null && instance.GetGlobalKey((GlobalKeys)31); Widgets.Switch(new Rect(x + num + 6f, y + 4f, num, 24f), "Map off", flag2, "nomap", "nomap"); y += 34f; Widgets.Header(x, ref y, w, "Map"); Widgets.Command(new Rect(x, y, num, 26f), "Reveal whole map", "exploremap"); Widgets.Command(new Rect(x + num + 6f, y, num, 26f), "Forget explored map", "resetmap", "Forget everything you've explored on the map?"); y += 30f; Widgets.Command(new Rect(x, y, w, 26f), "Clear cartography table data", "resetsharedmap", "Remove all shared map data from the cartography tables?"); y += 34f; Widgets.Header(x, ref y, w, "Delete around you"); Widgets.Note(x, ref y, w, "Removes everything nearby. No undo, back up first!"); _deleteRadius = GUI.HorizontalSlider(new Rect(x + 90f, y + 6f, w - 90f, 16f), _deleteRadius, 1f, 50f); Ui.Label(new Rect(x, y, 90f, 22f), $"Radius {Mathf.RoundToInt(_deleteRadius)} m", Ui.Small); y += 26f; GUI.SetNextControlName("OdinsEye_DeleteName"); _deleteName = GUI.TextField(new Rect(x, y, w - 130f, 26f), _deleteName ?? "", 40); string text = (_deleteName ?? "").Trim(); if (text.Length == 0) { Ui.Label(new Rect(x + 8f, y, w - 140f, 26f), "<color=#b9ad98>only names containing... (optional)</color>", Ui.Small); } int num2 = Mathf.RoundToInt(_deleteRadius); string text2 = text.Replace(' ', '_'); string line = ((text2.Length > 0) ? $"forcedelete {num2} {text2}" : $"forcedelete {num2}"); Widgets.Command(new Rect(x + w - 124f, y, 124f, 26f), "Delete", line, (text2.Length > 0) ? $"Delete every object whose name contains \"{text2}\" within {num2} m? There's no undo." : $"Delete EVERYTHING within {num2} m? There's no undo."); y += 34f; Widgets.Header(x, ref y, w, "Fires and lights"); _fuel = GUI.HorizontalSlider(new Rect(x + 90f, y + 6f, w - 200f, 16f), _fuel, 0f, 10f); Ui.Label(new Rect(x, y, 90f, 22f), $"Fuel {Mathf.RoundToInt(_fuel)}", Ui.Small); Widgets.Command(new Rect(x + w - 104f, y, 104f, 26f), "Set all", "setfuel " + Mathf.RoundToInt(_fuel).ToString(CultureInfo.InvariantCulture)); y += 30f; Widgets.CommandRow(x, ref y, w, new string[2] { "Put out fires", "Clear smoke" }, new string[2] { "stopfire", "stopsmoke" }); Widgets.Header(x, ref y, w, "Repair"); Widgets.Command(new Rect(x, y, num, 26f), "Your gear", "repairall"); if (Widgets.CheatButton(new Rect(x + num + 6f, y, num, 26f), $"Buildings within {30f:0} m")) { RepairBuildings(); } y += 30f; Widgets.Note(x, ref y, w, "Buildings include ships and carts."); if (Widgets.CheatButton(new Rect(x, y, num, 26f), $"Clear snow within {30f:0} m")) { Nearby.ClearSnow(); } y += 34f; Widgets.Header(x, ref y, w, "Undo terrain changes"); Widgets.Note(x, ref y, w, "Digging, raising, paths and cultivation go back to how the world made them. No undo."); _terrainRadius = GUI.HorizontalSlider(new Rect(x + 90f, y + 6f, w - 220f, 16f), _terrainRadius, 2f, 40f); Ui.Label(new Rect(x, y, 90f, 22f), $"Radius {Mathf.RoundToInt(_terrainRadius)} m", Ui.Small); if (Widgets.CheatButton(new Rect(x + w - 124f, y, 124f, 26f), "Restore ground")) { Nearby.UndoTerrain(Mathf.Round(_terrainRadius)); } return y + 30f; } private static void RepairBuildings() { //IL_001c: 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_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) GUIUtility.keyboardControl = 0; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Vector3 position = ((Component)localPlayer).transform.position; int num = 0; foreach (WearNTear allInstance in WearNTear.GetAllInstances()) { if ((Object)(object)allInstance != (Object)null && Vector3.Distance(((Component)allInstance).transform.position, position) <= 30f && allInstance.Repair()) { num++; } } Commands.LastCommand = "Repair buildings"; Commands.LastOutput = ((num == 0) ? "nothing needed repairing" : $"repaired {num} pieces"); ((Character)localPlayer).Message((MessageType)1, $"Repaired {num} pieces", 0, (Sprite)null, false); } } internal static class Back { private const int Max = 10; private static readonly List<Vector3> History = new List<Vector3>(); private static ZNet _for; private static bool _goingBack; internal static bool Any { get { if (Valid()) { return History.Count > 0; } return false; } } internal static Vector3 Last => History[History.Count - 1]; internal static string Line { get { //IL_000e: 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) if (!Any) { return null; } return $"goto {Last.x:0} {Last.z:0}"; } } private static bool Valid() { if ((Object)(object)ZNet.instance != (Object)(object)_for) { _for = ZNet.instance; History.Clear(); } if ((Object)(object)_for != (Object)null) { return (Object)(object)Player.m_localPlayer != (Object)null; } return false; } internal static void Remember(Vector3 from, Vector3 to) { //IL_000e: 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_0022: Unknown result type (might be due to invalid IL or missing references) if (!_goingBack && Valid() && !(Vector3.Distance(from, to) < 10f)) { History.Add(from); if (History.Count > 10) { History.RemoveAt(0); } } } internal static void Go() { //IL_0021: 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) if (Any && Commands.CanRun("goto")) { Player localPlayer = Player.m_localPlayer; _goingBack = true; bool flag; try { flag = ((Character)localPlayer).TeleportTo(Last, ((Component)localPlayer).transform.rotation, true); } finally { _goingBack = false; } Commands.LastCommand = "Back"; Commands.LastOutput = (flag ? "done" : "can't teleport again just yet"); if (flag) { History.RemoveAt(History.Count - 1); } } } } [HarmonyPatch(typeof(Player), "TeleportTo")] internal static class TeleportHistoryPatch { private static void Prefix(Player __instance, out Vector3 __state) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) __state = ((Component)__instance).transform.position; } private static void Postfix(Player __instance, Vector3 pos, bool __result, Vector3 __state) { //IL_0010: 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) if (__result && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { Back.Remember(__state, pos); } } } internal static class BuffsTab { private class Entry { internal StatusEffect Effect; internal string Name; internal string Search; } private const float DetailW = 300f; private const float Cell = 46f; private const float Gap = 14f; private const float SearchH = 28f; private const string SearchControl = "OdinsEye_BuffSearch"; private static readonly List<Entry> Entries = new List<Entry>(); private static readonly List<Entry> Powers = new List<Entry>(); private static readonly List<Entry> Shown = new List<Entry>(); private static ObjectDB _builtFor; private static string _search = ""; private static string _shownSearch; private static Entry _selected; private static Vector2 _scroll; internal static void Draw(Rect r) { //IL_003d: 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) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { Build(); DrawGrid(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width - 300f - 14f, ((Rect)(ref r)).height), localPlayer); DrawSide(new Rect(((Rect)(ref r)).xMax - 300f, ((Rect)(ref r)).y, 300f, ((Rect)(ref r)).height), localPlayer); } } private static void Build() { ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance == (Object)(object)_builtFor) { return; } _builtFor = instance; Entries.Clear(); Powers.Clear(); _selected = null; _shownSearch = null; foreach (StatusEffect statusEffect in instance.m_StatusEffects) { if (!((Object)(object)statusEffect == (Object)null) && !((Object)(object)statusEffect.m_icon == (Object)null) && !((Object)statusEffect).name.Contains(" ")) { string text = Localization.instance.Localize(statusEffect.m_name); if (string.IsNullOrEmpty(text) || text.StartsWith("$")) { text = ((Object)statusEffect).name; } Entry item = new Entry { Effect = statusEffect, Name = text, Search = (text + " " + ((Object)statusEffect).name).ToLowerInvariant() }; (((Object)statusEffect).name.StartsWith("GP_") ? Powers : Entries).Add(item); } } Entries.Sort((Entry a, Entry b) => string.CompareOrdinal(a.Name, b.Name)); } private static void Filter() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (_shownSearch == _search) { return; } _shownSearch = _search; Shown.Clear(); string text = _search.Trim().ToLowerInvariant(); foreach (Entry entry in Entries) { if (text.Length == 0 || entry.Search.Contains(text)) { Shown.Add(entry); } } _scroll = Vector2.zero; } private static void DrawGrid(Rect r, Player player) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) _search = Widgets.SearchField(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 28f), _search, "OdinsEye_BuffSearch", "Search status effects..."); Filter(); Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y + 28f + 6f, ((Rect)(ref r)).width, ((Rect)(ref r)).height - 28f - 6f); Ui.Inset(r2); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref r2)).x + 4f, ((Rect)(ref r2)).y + 4f, ((Rect)(ref r2)).width - 8f, ((Rect)(ref r2)).height - 8f); int num = Mathf.Max(1, Mathf.FloorToInt((((Rect)(ref val)).width - 18f) / 46f)); int num2 = (Shown.Count + num - 1) / num; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, (float)num * 46f, (float)num2 * 46f); SEMan sEMan = ((Character)player).GetSEMan(); _scroll = GUI.BeginScrollView(val, _scroll, val2); Rect val3 = default(Rect); for (int i = 0; i < Shown.Count; i++) { Entry entry = Shown[i]; ((Rect)(ref val3))..ctor((float)(i % num) * 46f, (float)(i / num) * 46f, 42f, 42f); if (GUI.Button(val3, new GUIContent("", "~" + entry.Name))) { _selected = entry; } Ui.Icon(new Rect(((Rect)(ref val3)).x + 6f, ((Rect)(ref val3)).y + 6f, ((Rect)(ref val3)).width - 12f, ((Rect)(ref val3)).height - 12f), entry.Effect.m_icon); if (entry == _selected) { Ui.Accent(new Rect(((Rect)(ref val3)).x + 3f, ((Rect)(ref val3)).yMax - 5f, ((Rect)(ref val3)).width - 6f, 2f), Ui.GoldColor); } else if (sEMan.HaveStatusEffect(entry.Effect.NameHash())) { Ui.Accent(new Rect(((Rect)(ref val3)).x + 3f, ((Rect)(ref val3)).yMax - 5f, ((Rect)(ref val3)).width - 6f, 2f), Ui.GoodColor); } } GUI.EndScrollView(); if (Shown.Count == 0) { Ui.Label(new Rect(((Rect)(ref val)).x + 8f, ((Rect)(ref val)).y + 4f, ((Rect)(ref val)).width, 24f), "<color=#b9ad98>Nothing matches.</color>", Ui.Small); } } private static void DrawSide(Rect r, Player player) { //IL_005f: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) float x = ((Rect)(ref r)).x; float width = ((Rect)(ref r)).width; float y = ((Rect)(ref r)).y; if (_selected == null) { GUI.Label(new Rect(x, y, width, 40f), "<color=#b9ad98>Pick a status effect to add it. Green ones are on you now.</color>", Widgets.Wrap); y += 44f; } else { StatusEffect effect = _selected.Effect; Ui.Icon(new Rect(x, y, 36f, 36f), effect.m_icon); Ui.Label(new Rect(x + 44f, y - 2f, width - 44f, 22f), "<b>" + _selected.Name + "</b>", Ui.Text); string text = ((effect.m_ttl > 0f) ? $"{Mathf.CeilToInt(effect.m_ttl / 60f)} min" : "until removed"); Ui.Label(new Rect(x + 44f, y + 18f, width - 44f, 20f), "<color=#b9ad98>" + ((Object)effect).name + ", " + text + "</color>", Ui.Small); y += 40f; string text2 = Ui.StripColor(Localization.instance.Localize(effect.m_tooltip)).Replace("\n", " "); if (!string.IsNullOrEmpty(text2)) { GUI.Label(new Rect(x, y, width, 52f), "<color=#b9ad98>" + text2 + "</color>", Widgets.Wrap); y += 54f; } Widgets.Command(new Rect(x, y, width * 0.5f - 3f, 26f), "Add to me", "addstatus " + ((Object)effect).name); } Widgets.Command(new Rect(x + width * 0.5f + 3f, y, width * 0.5f - 3f, 26f), "Clear all effects", "clearstatus"); y += 34f; DrawPowers(x, ref y, width, player); DrawFood(x, ref y, width, player); } private static void DrawPowers(float x, ref float y, float w, Player player) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) if (Powers.Count == 0) { return; } string guardianPowerName = player.GetGuardianPowerName(); string text = (string.IsNullOrEmpty(guardianPowerName) ? "none" : ((player.m_guardianPowerCooldown > 0f) ? $"cooldown {Mathf.CeilToInt(player.m_guardianPowerCooldown / 60f)} min" : "ready")); Ui.Label(new Rect(x, y, w, 26f), "<color=#e8c77e>Guardian power</color> <color=#b9ad98>(" + text + ")</color>", Ui.Text); y += 26f; float num = Mathf.Min(40f, (w - (float)(Powers.Count - 1) * 4f) / (float)Powers.Count); Rect r = default(Rect); for (int i = 0; i < Powers.Count; i++) { Entry entry = Powers[i]; ((Rect)(ref r))..ctor(x + (float)i * (num + 4f), y, num, num); Widgets.Command(r, "", "setpower " + ((Object)entry.Effect).name); Ui.Icon(new Rect(((Rect)(ref r)).x + 5f, ((Rect)(ref r)).y + 5f, ((Rect)(ref r)).width - 10f, ((Rect)(ref r)).height - 10f), entry.Effect.m_icon); if (((Object)entry.Effect).name == guardianPowerName) { Ui.Accent(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).yMax - 4f, ((Rect)(ref r)).width - 6f, 2f), Ui.GoldColor); } } y += num + 4f; Widgets.Note(x, ref y, w, "Picking one also resets its cooldown."); } private static void DrawFood(float x, ref float y, float w, Player player) { //IL_0009: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) Ui.Label(new Rect(x, y, w, 26f), "<color=#e8c77e>Food</color>", Ui.Text); y += 26f; List<Food> foods = player.GetFoods(); float num = x; if (foods.Count == 0) { Ui.Label(new Rect(x, y, 140f, 32f), "<color=#b9ad98>Nothing eaten.</color>", Ui.Small); } foreach (Food item2 in foods) { Rect r = new Rect(num, y + 2f, 28f, 28f); ItemData item = item2.m_item; Ui.Icon(r, (item != null) ? item.GetIcon() : null); Ui.Label(new Rect(num + 30f, y, 30f, 32f), string.Format("<color={0}>{1}m</color>", "#b9ad98", Mathf.CeilToInt(item2.m_time / 60f)), Ui.Small); num += 60f; } Widgets.Command(new Rect(x + w - 120f, y + 2f, 120f, 28f), "Empty stomach", "puke"); y += 36f; } } internal static class Cheats { private static readonly Dictionary<SkillType, float> Speeds = new Dictionary<SkillType, float>(); private static string _speedsFor; internal static bool Allowed => Commands.Access == Access.Ready; internal static Dictionary<SkillType, float> SkillSpeeds { get { string text = Plugin.SkillSpeeds.Value ?? ""; if (text == _speedsFor) { return Speeds; } _speedsFor = text; Speeds.Clear(); string[] array = text.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '=' }); if (array2.Length == 2 && int.TryParse(array2[0].Trim(), out var result) && float.TryParse(array2[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { Speeds[(SkillType)result] = Mathf.Max(0f, result2); } } return Speeds; } } internal static bool KeepSkills { get { if (Allowed) { return Plugin.KeepSkills.Value; } return false; } } internal static float XpMultiplier(SkillType skill) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!Allowed) { return 1f; } if (!SkillSpeeds.TryGetValue(skill, out var value)) { return Mathf.Max(0f, Plugin.XpMultiplier.Value); } return value; } internal static void SetSkillSpeed(SkillType skill, float? speed) { //IL_0025: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected I4, but got Unknown Dictionary<SkillType, float> dictionary = new Dictionary<SkillType, float>(SkillSpeeds); if (speed.HasValue) { dictionary[skill] = speed.Value; } else { dictionary.Remove(skill); } List<string> list = new List<string>(); foreach (KeyValuePair<SkillType, float> item in dictionary) { list.Add((int)item.Key + "=" + item.Value.ToString(CultureInfo.InvariantCulture)); } Plugin.SkillSpeeds.Value = string.Join(",", list.ToArray()); } internal static void ResetAll() { ConfigEntry<float>[] array = new ConfigEntry<float>[5] { Plugin.FunSize, Plugin.FunJump, Plugin.FunSpeed, Plugin.FunShip, Plugin.XpMultiplier }; foreach (ConfigEntry<float> obj in array) { obj.Value = (float)((ConfigEntryBase)obj).DefaultValue; } ConfigEntry<bool>[] array2 = new ConfigEntry<bool>[9] { Plugin.FunStamina, Plugin.FunNoWeight, Plugin.FunNoWear, Plugin.FunNoFall, Plugin.FunNightVision, Plugin.FunOneHit, Plugin.FunKnockback, Plugin.FunInstantCraft, Plugin.KeepSkills }; foreach (ConfigEntry<bool> obj2 in array2) { obj2.Value = (bool)((ConfigEntryBase)obj2).DefaultValue; } Plugin.SkillSpeeds.Value = ""; CreaturesTab.Frozen = false; Commands.LastCommand = "Back to normal"; Commands.LastOutput = "every Odin's Eye cheat is off"; } internal static bool IsLocal(Skills skills) { if ((Object)(object)Player.m_localPlayer != (Object)null) { return (Object)(object)skills == (Object)(object)((Character)Player.m_localPlayer).GetSkills(); } return false; } } [HarmonyPatch(typeof(Skills), "RaiseSkill")] internal static class XpMultiplierPatch { private static void Prefix(Skills __instance, SkillType skillType, ref float factor) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (Cheats.IsLocal(__instance)) { factor *= Cheats.XpMultiplier(skillType); } } } [HarmonyPatch(typeof(Skills), "OnDeath")] internal static class KeepSkillsPatch { private static bool Prefix(Skills __instance) { if (Cheats.KeepSkills) { return !Cheats.IsLocal(__instance); } return true; } } [HarmonyPatch(typeof(Player), "OnDeath")] internal static class PlayerDeathPatch { internal static bool Dying; private static void Prefix(Player __instance) { Dying = (Object)(object)__instance == (Object)(object)Player.m_localPlayer; } private static void Finalizer() { Dying = false; } } [HarmonyPatch(typeof(Skills), "Clear")] internal static class KeepSkillsResetPatch { private static bool Prefix(Skills __instance) { if (PlayerDeathPatch.Dying && Cheats.KeepSkills) { return !Cheats.IsLocal(__instance); } return true; } } internal enum Access { NoWorld, NotHost, DevCommandsOff, NeedsConfirm, Ready } internal static class Commands { private static readonly FieldRef<Dictionary<string, ConsoleCommand>> All = AccessTools.StaticFieldRefAccess<Dictionary<string, ConsoleCommand>>(AccessTools.Field(typeof(Terminal), "commands")); private static List<string> _captured; internal static string LastCommand; internal static string LastOutput; internal static Access Access { get { if ((Object)(object)ZNet.instance == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)Console.instance == (Object)null) { return Access.NoWorld; } if (!ZNet.instance.IsServer()) { return Access.NotHost; } if (!Terminal.m_cheat) { return Access.DevCommandsOff; } if (!Achievements.IsCheatedAtAll()) { return Access.NeedsConfirm; } return Access.Ready; } } internal static bool IsAdmin { get { if ((Object)(object)ZNet.instance != (Object)null) { return ZNet.instance.LocalPlayerIsAdminOrHost(); } return false; } } internal static bool CanRun(string name) { Console instance = Console.instance; if ((Object)(object)instance == (Object)null || name == null || !All.Invoke().TryGetValue(name.ToLowerInvariant(), out var value)) { return false; } if (value.IsCheat && !Achievements.IsCheatedAtAll()) { return false; } if (value.IsValid((Terminal)(object)instance, false)) { return true; } if (value.RemoteCommand && (Object)(object)ZNet.instance != (Object)null && !ZNet.instance.IsServer()) { return IsAdmin; } return false; } internal static List<string> Options(string name) { if (name == null || !All.Invoke().TryGetValue(name.ToLowerInvariant(), out var value)) { return new List<string>(); } try { return value.GetTabOptions() ?? new List<string>(); } catch (Exception) { return new List<string>(); } } internal static IEnumerable<ConsoleCommand> Visible() { foreach (ConsoleCommand value in All.Invoke().Values) { if (!value.IsSecret) { yield return value; } } } internal static ConsoleCommand Find(string name) { if (name == null || !All.Invoke().TryGetValue(name.ToLowerInvariant(), out var value)) { return null; } return value; } internal static bool Exists(string name) { if (name != null) { return All.Invoke().ContainsKey(name.ToLowerInvariant()); } return false; } internal static void Run(string line) { Console instance = Console.instance; if (!((Object)(object)instance == (Object)null)) { _captured = new List<string>(); try { ((Terminal)instance).TryRunCommand(line, false, false); } finally { LastCommand = line; LastOutput = ((_captured.Count > 0) ? string.Join(" ", _captured) : "done"); _captured = null; } Plugin.Log.LogInfo((object)(line + " -> " + LastOutput)); } } internal static void Capture(string text) { if (text != "Skill not found None") { _captured?.Add(text); } } } [HarmonyPatch(typeof(Terminal), "AddString", new Type[] { typeof(string) })] internal static class TerminalOutputPatch { private static void Prefix(string text) { Commands.Capture(text); } } internal static class CreaturesTab { private const float LeftW = 330f; private const float Gap = 20f; private const float RowH = 30f; private const float Range = 40f; internal static bool Frozen; private static readonly List<Character> Nearby = new List<Character>(); private static float _nextScan; private static Vector2 _scroll; private static readonly Action<Tameable> Tame = AccessTools.MethodDelegate<Action<Tameable>>(AccessTools.Method(typeof(Tameable), "Tame", (Type[])null, (Type[])null), (object)null, true); internal static void Draw(Rect r) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { DrawCommands(((Rect)(ref r)).x, ((Rect)(ref r)).y, 330f); DrawNearby(new Rect(((Rect)(ref r)).x + 330f + 20f, ((Rect)(ref r)).y, ((Rect)(ref r)).width - 330f - 20f, ((Rect)(ref r)).height), localPlayer); } } private static void DrawCommands(float x, float y, float w) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) Widgets.Header(x, ref y, w, "Around you"); Widgets.Command(new Rect(x, y, w, 26f), "Tame every tameable creature", "tame"); y += 30f; Widgets.Note(x, ref y, w, "The game tames every one that's loaded, not just nearby."); Widgets.Command(new Rect(x, y, w, 26f), "Make neutral creatures angry", "aggravate"); y += 30f; Widgets.Command(new Rect(x, y, w, 26f), "Kill tamed creatures", "killtame", "Kill every tamed creature nearby?"); y += 30f; Widgets.CheatPair(x, ref y, w, "Grow up young", OdinsEye.Nearby.GrowUpYoung, "Heal tames", OdinsEye.Nearby.HealTames); Widgets.Note(x, ref y, w, "Young wolves, boars, lox and askvins become adults."); y += 6f; Widgets.Header(x, ref y, w, "Behaviour"); bool flag = (Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGlobalKey((GlobalKeys)30); Widgets.Switch(new Rect(x, y + 2f, w, 24f), "Passive monsters", flag, "setkey PassiveMobs", "removekey PassiveMobs"); y += 28f; Widgets.Note(x, ref y, w, "World setting: monsters don't attack until you hit them."); Frozen = Widgets.CheatSwitch(new Rect(x, y + 2f, w, 24f), "Freeze creatures", Frozen) && Cheats.Allowed; y += 28f; Widgets.Note(x, ref y, w, "They stand still and do nothing. For building and screenshots."); } private static void DrawNearby(Rect r, Player player) { //IL_00e6: 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_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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_0080: Unknown result type (might be due to invalid IL or missing references) if (Time.time >= _nextScan) { _nextScan = Time.time + 0.5f; Nearby.Clear(); Vector3 p = ((Component)player).transform.position; foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter != (Object)null && !allCharacter.IsPlayer() && !allCharacter.IsDead() && Vector3.Distance(((Component)allCharacter).transform.position, p) <= 40f) { Nearby.Add(allCharacter); } } Nearby.Sort((Character a, Character b) => Vector3.Distance(((Component)a).transform.position, p).CompareTo(Vector3.Distance(((Component)b).transform.position, p))); } Ui.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 26f), string.Format("<color={0}>Within {1:0} m</color> <color={2}>({3})</color>", "#e8c77e", 40f, "#b9ad98", Nearby.Count), Ui.Text); Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y + 26f + 4f, ((Rect)(ref r)).width, ((Rect)(ref r)).height - 26f - 4f); Ui.Inset(r2); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref r2)).x + 4f, ((Rect)(ref r2)).y + 4f, ((Rect)(ref r2)).width - 8f, ((Rect)(ref r2)).height - 8f); if (Nearby.Count == 0) { Ui.Label(new Rect(((Rect)(ref val)).x + 6f, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 24f), "<color=#b9ad98>No creatures nearby.</color>", Ui.Small); return; } Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref val)).width - 20f, (float)Nearby.Count * 30f); _scroll = GUI.BeginScrollView(val, _scroll, val2); for (int num = 0; num < Nearby.Count; num++) { if ((Object)(object)Nearby[num] != (Object)null) { DrawRow(new Rect(0f, (float)num * 30f, ((Rect)(ref val2)).width, 27f), Nearby[num], player); } } GUI.EndScrollView(); } private static void DrawRow(Rect r, Character c, Player player) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00fa: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown string text = Localization.instance.Localize(c.m_name); int num = c.GetLevel() - 1; string text2 = ((num > 0) ? (" <color=#e8c77e>" + new string('*', num) + "</color>") : ""); string text3 = (c.IsTamed() ? " <color=#9be07a>tamed</color>" : ""); Ui.Label(new Rect(((Rect)(ref r)).x + 4f, ((Rect)(ref r)).y, ((Rect)(ref r)).width - 250f, ((Rect)(ref r)).height), text + text2 + text3, Ui.Small); float num2 = Vector3.Distance(((Component)c).transform.position, ((Component)player).transform.position); Ui.Bar(new Rect(((Rect)(ref r)).xMax - 240f, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.5f - 5f, 70f, 10f), c.GetHealthPercentage(), new Color(0.75f, 0.2f, 0.15f)); Ui.Label(new Rect(((Rect)(ref r)).xMax - 164f, ((Rect)(ref r)).y, 40f, ((Rect)(ref r)).height), string.Format("<color={0}>{1:0}m</color>", "#b9ad98", num2), Ui.Small); bool enabled = GUI.enabled; GUI.enabled = enabled && Cheats.Allowed; if (GUI.Button(new Rect(((Rect)(ref r)).xMax - 122f, ((Rect)(ref r)).y, 64f, ((Rect)(ref r)).height), new GUIContent(c.IsTamed() ? "Untame" : "Tame", "~Odin's Eye's own cheat: there's no console command for this."))) { SetTamed(c, !c.IsTamed()); } if (GUI.Button(new Rect(((Rect)(ref r)).xMax - 54f, ((Rect)(ref r)).y, 54f, ((Rect)(ref r)).height), new GUIContent("Kill", "~Odin's Eye's own cheat: there's no console command for this."))) { Kill(c); } GUI.enabled = enabled; } internal static void SetTamed(Character c, bool tamed) { ZNetView component = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid() && !component.IsOwner()) { component.ClaimOwnership(); } Tameable component2 = ((Component)c).GetComponent<Tameable>(); if (tamed && (Object)(object)component2 != (Object)null && Tame != null) { Tame(component2); } else { c.SetTamed(tamed); } } private static void Kill(Character c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //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) HitData val = new HitData(); val.m_damage.m_damage = c.GetMaxHealth() * 10f + 10000f; val.m_point = ((Component)c).transform.position; c.Damage(val); } } [HarmonyPatch] internal static class FreezeAIPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(BaseAI), "UpdateAI", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(MonsterAI), "UpdateAI", (Type[])null, (Type[])null); } private static bool Prefix(BaseAI __instance, ref bool __result) { if (!CreaturesTab.Frozen || !Cheats.Allowed) { return true; } __instance.StopMoving(); __result = false; return false; } } internal static class CustomTab { private class Suggestion { internal string Text; internal string Note; } private const float FormW = 280f; private const float Gap = 14f; private const float Cols = 3f; private const float RowH = 34f; private const string NameControl = "OdinsEye_ButtonName"; private const string LineControl = "OdinsEye_ButtonLine"; private static string _name = ""; private static string _line = ""; private static bool _editing; private static Vector2 _scroll; private const float SuggestH = 124f; private const float SuggestRowH = 20f; private const int MaxSuggestions = 5; private static bool _moveToEnd; private static int _moveToEndFrame; private static string _suggestedFor; private static List<Suggestion> _suggested = new List<Suggestion>(); internal static void Draw(Rect r) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) DrawButtons(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width - 280f - 14f, ((Rect)(ref r)).height)); DrawForm(new Rect(((Rect)(ref r)).xMax - 280f, ((Rect)(ref r)).y, 280f, ((Rect)(ref r)).height)); string nameOfFocusedControl = GUI.GetNameOfFocusedControl(); Menu.SearchFocused = nameOfFocusedControl == "OdinsEye_ButtonName" || nameOfFocusedControl == "OdinsEye_ButtonLine"; } private static void DrawButtons(Rect r) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown List<CustomButtons.Button> all = CustomButtons.All; Ui.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 200f, 26f), "<color=#e8c77e>Your buttons</color>", Ui.Text); if (all.Count > 0 && Widgets.Choice(new Rect(((Rect)(ref r)).xMax - 110f, ((Rect)(ref r)).y, 110f, 24f), _editing ? "Done" : "Remove...", _editing)) { _editing = !_editing; } float num = ((Rect)(ref r)).y + 26f + 4f; Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x, num, ((Rect)(ref r)).width, ((Rect)(ref r)).yMax - num); Ui.Inset(r2); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref r2)).x + 6f, ((Rect)(ref r2)).y + 6f, ((Rect)(ref r2)).width - 12f, ((Rect)(ref r2)).height - 12f); if (all.Count == 0) { GUI.Label(new Rect(((Rect)(ref val)).x + 4f, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 8f, 60f), "<color=#b9ad98>No buttons yet. Make one on the right: give it a name and the console line it runs.</color>", Widgets.Wrap); return; } float num2 = (((Rect)(ref val)).width - 20f - 12f) / 3f; int num3 = Mathf.CeilToInt((float)all.Count / 3f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref val)).width - 20f, (float)num3 * 34f); _scroll = GUI.BeginScrollView(val, _scroll, val2); Rect val3 = default(Rect); for (int i = 0; i < all.Count; i++) { CustomButtons.Button button = all[i]; ((Rect)(ref val3))..ctor((float)(i % 3) * (num2 + 6f), (float)(i / 3) * 34f, num2, 28f); if (_editing) { if (GUI.Button(val3, new GUIContent("<color=#ff6f55>Remove</color> " + button.Name, "~" + button.Line))) { CustomButtons.Remove(button); break; } } else { Run(val3, button.Name, button.Line); } } GUI.EndScrollView(); } private static void Run(Rect r, string label, string line) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown List<string> list = Split(line); bool flag = list.Count > 0 && list.All((string l) => Commands.CanRun(l.Split(new char[1] { ' ' })[0])); string text = list.Select((string l) => l.Split(new char[1] { ' ' })[0]).FirstOrDefault((string c) => !Commands.Exists(c)); string text2 = ((text != null) ? ("~\"" + text + "\" isn't a console command") : (flag ? line : ("~The game won't run this right now: " + line))); bool enabled = GUI.enabled; GUI.enabled = enabled && flag; bool num = GUI.Button(r, new GUIContent(label, text2)); GUI.enabled = enabled; if (!num) { return; } GUIUtility.keyboardControl = 0; foreach (string item in list) { Commands.Run(item); } } private static List<Suggestion> Suggestions(string line) { if (line == _suggestedFor) { return _suggested; } _suggestedFor = line; _suggested = FindSuggestions(line); return _suggested; } private static List<Suggestion> FindSuggestions(string line) { List<Suggestion> list = new List<Suggestion>(); string text = line.Substring(line.LastIndexOf(';') + 1).TrimStart(Array.Empty<char>()); int num = text.IndexOf(' '); if (num < 0) { Dictionary<string, ConsoleCommand> dictionary = new Dictionary<string, ConsoleCommand>(); foreach (ConsoleCommand item in Commands.Visible()) { dictionary[item.Command] = item; } { foreach (string item2 in Widgets.Matches(dictionary.Keys, text, 5, keepExact: true)) { ConsoleCommand val = dictionary[item2]; string text2 = val.Description; if (!Commands.CanRun(val.Command)) { text2 = (val.IsCheat ? "(needs dev commands) " : "(can't run here) ") + text2; } list.Add(new Suggestion { Text = val.Command, Note = text2 }); } return list; } } string name = text.Substring(0, num); string text3 = text.Substring(num + 1); if (text3.Contains(" ") || Commands.Find(name) == null) { return list; } foreach (string item3 in Widgets.Matches(Commands.Options(name), text3, 5, keepExact: false)) { list.Add(new Suggestion { Text = item3 }); } return list; } private static string UnknownEarlier(string line) { List<string> list = Split(line); bool flag = !line.TrimEnd(Array.Empty<char>()).EndsWith(";"); for (int i = 0; i < list.Count - (flag ? 1 : 0); i++) { string text = list[i].Split(new char[1] { ' ' })[0]; if (!Commands.Exists(text)) { return text; } } return null; } private static void Accept(string text) { string text2 = _line ?? ""; _line = text2[..(Mathf.Max(text2.LastIndexOf(' '), text2.LastIndexOf(';')) + 1)] + text + " "; GUI.FocusControl("OdinsEye_ButtonLine"); _moveToEnd = true; _moveToEndFrame = Time.frameCount; } private static void DrawSuggestions(Rect r) { //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) string text = _line ?? ""; List<Suggestion> list = Suggestions(text); string text2 = UnknownEarlier(text); if (list.Count > 0 && text2 != null) { GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 18f), "<color=#ff6f55>\"" + text2 + "\" isn't a console command.</color>", Widgets.Wrap); ((Rect)(ref r))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y + 20f, ((Rect)(ref r)).width, ((Rect)(ref r)).height - 20f); } if (list.Count == 0) { ConsoleCommand val = Commands.Find(text.Substring(text.LastIndexOf(';') + 1).Trim().Split(new char[1] { ' ' })[0]); string text3 = (from l in Split(text) select l.Split(new char[1] { ' ' })[0]).FirstOrDefault((string c) => !Commands.Exists(c)); string text4 = ((text3 != null) ? ("<color=#ff6f55>\"" + text3 + "\" isn't a console command.</color>") : ((val != null) ? ("<color=#e8c77e>" + val.Command + "</color> <color=#b9ad98>" + val.Description + "</color>") : "<color=#b9ad98>Start typing a console command: suggestions show up here. Tab takes the first one. Several at once: separate them with ;</color>")); GUI.Label(r, text4, Widgets.Wrap); return; } Ui.Inset(r); for (int num = 0; num < list.Count; num++) { Suggestion suggestion = list[num]; Rect val2 = new Rect(((Rect)(ref r)).x + 4f, ((Rect)(ref r)).y + 4f + (float)num * 23f, ((Rect)(ref r)).width - 8f, 20f); string text5 = ((suggestion.Note != null) ? (suggestion.Text + " <color=#b9ad98>" + suggestion.Note + "</color>") : suggestion.Text); if (GUI.Button(val2, new GUIContent(text5, "~Tab or click to use it"), Widgets.SuggestionStyle)) { Accept(suggestion.Text); } } } private static List<string> Split(string line) { return (from l in line.Split(new char[1] { ';' }) select l.Trim() into l where l.Length > 0 select l).ToList(); } private static void DrawForm(Rect r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Invalid comparison between Unknown and I4 //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Invalid comparison between Unknown and I4 //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown //IL_02a7: Unknown result type (might be due to invalid IL or missing references) Ui.Inset(r); float num = ((Rect)(ref r)).x + 10f; float num2 = ((Rect)(ref r)).width - 20f; float y = ((Rect)(ref r)).y + 8f; Widgets.Header(num, ref y, num2, "New button"); Ui.Label(new Rect(num, y, num2, 20f), "Name", Ui.Small); y += 20f; GUI.SetNextControlName("OdinsEye_ButtonName"); _name = GUI.TextField(new Rect(num, y, num2, 26f), _name ?? "", 30); y += 32f; Ui.Label(new Rect(num, y, num2, 20f), "Console line", Ui.Small); y += 20f; Event current = Event.current; if ((int)current.type == 4 && ((int)current.keyCode == 9 || current.character == '\t') && GUI.GetNameOfFocusedControl() == "OdinsEye_ButtonLine") { if ((int)current.keyCode == 9) { List<Suggestion> list = Suggestions(_line ?? ""); if (list.Count > 0) { Accept(list[0].Text); } } current.Use(); } GUI.SetNextControlName("OdinsEye_ButtonLine"); _line = GUI.TextField(new Rect(num, y, num2, 26f), _line ?? "", 200); if (_moveToEnd && Time.frameCount > _moveToEndFrame + 5) { _moveToEnd = false; } if (_moveToEnd && GUI.GetNameOfFocusedControl() == "OdinsEye_ButtonLine") { _moveToEnd = false; TextEditor val = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); val.text = _line; val.MoveTextEnd(); } y += 30f; DrawSuggestions(new Rect(num, y, num2, 124f)); y += 128f; bool enabled = GUI.enabled; GUI.enabled = enabled && Commands.LastCommand != null; if (GUI.Button(new Rect(num, y, num2, 26f), new GUIContent("Use the last command", "~" + Commands.LastCommand))) { _line = Commands.LastCommand; GUIUtility.keyboardControl = 0; } List<string> list2 = Split(_line); GUI.enabled = enabled && _name.Trim().Length > 0 && list2.Count > 0 && list2.All((string p) => Commands.Exists(p.Split(new char[1] { ' ' })[0])); if (GUI.Button(new Rect(num, y + 32f, num2, 30f), "Add button")) { CustomButtons.Add(_name.Trim(), string.Join("; ", Split(_line).ToArray())); _name = (_line = ""); GUIUtility.keyboardControl = 0; } GUI.enabled = enabled; } } internal static class CustomButtons { internal class Button { internal string Name; internal string Line; } private static readonly string FilePath = Path.Combine(Paths.ConfigPath, "OdinsEye.buttons.txt"); private static List<Button> _all; internal static List<Button> All { get { if (_all != null) { return _all; } _all = new List<Button>(); if (!File.Exists(FilePath)) { return _all; } string[] array = File.ReadAllLines(FilePath); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '\t' }); if (array2.Length == 2 && array2[0].Length > 0 && array2[1].Length > 0) { _all.Add(new Button { Name = array2[0], Line = array2[1] }); } } return _all; } } internal static void Add(string name, string line) { All.Add(new Button { Name = name.Replace('\t', ' '), Line = line.Replace('\t', ' ') }); Save(); } internal static void Remove(Button button) { All.Remove(button); Save(); } private static void Save() { try { File.WriteAllLines(FilePath, All.Select((Button b) => b.Name + "\t" + b.Line)); } catch (IOException ex) { Plugin.Log.LogWarning((object)("Couldn't save your buttons: " + ex.Message)); } } } internal class Fun : MonoBehaviour { private Ship _ship; private float _sailForce; private float _rowForce; private Player _player; private float _speed; private float _walk; private float _run; private float _crouch; private float _swim; private float _jump; private float _jumpForward; private bool _moved; private bool _scaled; private float _repairTimer; internal static float Size { get { if (!Cheats.Allowed) { return 1f; } return Plugin.FunSize.Value; } } internal static float Jump { get { if (!Cheats.Allowed) { return 1f; } return Plugin.FunJump.Value; } } internal static float Speed { get { if (!Cheats.Allowed) { return 1f; } return Plugin.FunSpeed.Value; } } internal static float ShipSpeed { get { if (!Cheats.Allowed) { return 1f; } return Plugin.FunShip.Value; } } internal static bool On(ConfigEntry<bool> entry) { if (entry.Value) { return Cheats.Allowed; } return false; } private void Update() { //IL_0142: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)(object)_player) { _moved = (_scaled = false); } _player = localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } float speed = Speed; float jump = Jump; bool flag = speed != 1f || jump != 1f; if (!_moved) { _speed = ((Character)localPlayer).m_speed; _walk = ((Character)localPlayer).m_walkSpeed; _run = ((Character)localPlayer).m_runSpeed; _crouch = ((Character)localPlayer).m_crouchSpeed; _swim = ((Character)localPlayer).m_swimSpeed; _jump = ((Character)localPlayer).m_jumpForce; _jumpForward = ((Character)localPlayer).m_jumpForceForward; } if (flag || _moved) { ((Character)localPlayer).m_speed = _speed * speed; ((Character)localPlayer).m_walkSpeed = _walk * speed; ((Character)localPlayer).m_runSpeed = _run * speed; ((Character)localPlayer).m_crouchSpeed = _crouch * speed; ((Character)localPlayer).m_swimSpeed = _swim * speed; ((Character)localPlayer).m_jumpForce = _jump * jump; ((Character)localPlayer).m_jumpForceForward = _jumpForward * jump; _moved = flag; } float size = Size; if (size != 1f || _scaled) { Vector3 val = Vector3.one * size; if (((Component)localPlayer).transform.localScale != val) { ((Component)localPlayer).transform.localScale = val; } _scaled = size != 1f; } UpdateShip(localPlayer.GetControlledShip()); _repairTimer -= Time.deltaTime; if (!(_repairTimer <= 0f) || !On(Plugin.FunNoWear)) { return; } _repairTimer = 0.5f; foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { if (allItem.m_shared.m_useDurability && allItem.m_durability < allItem.GetMaxDurability()) { allItem.m_durability = allItem.GetMaxDurability(); } } } private void UpdateShip(Ship ship) { if ((Object)(object)ship != (Object)(object)_ship) { if ((Object)(object)_ship != (Object)null) { _ship.m_sailForceFactor = _sailForce; _ship.m_backwardForce = _rowForce; } _ship = ship; if ((Object)(object)ship != (Object)null) { _sailForce = ship.m_sailForceFactor; _rowForce = ship.m_backwardForce; } } if (!((Object)(object)ship == (Object)null)) { float shipSpeed = ShipSpeed; ZNetView component = ((Component)ship).GetComponent<ZNetView>(); if (!Mathf.Approximately(shipSpeed, 1f) && (Object)(object)component != (Object)null && component.IsValid() && !component.IsOwner()) { component.ClaimOwnership(); } ship.m_sailForceFactor = _sailForce * shipSpeed; ship.m_backwardForce = _rowForce * shipSpeed; } } } [HarmonyPatch(typeof(Player), "UseStamina")] internal static class InfiniteStaminaPatch { private static bool Prefix(Player __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { return !Fun.On(Plugin.FunStamina); } return true; } } [HarmonyPatch(typeof(Player), "IsEncumbered")] internal static class NoWeightLimitPatch { private static void Postfix(Player __instance, ref bool __result) { if (__result && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Fun.On(Plugin.FunNoWeight)) { __result = false; } } } [HarmonyPatch(typeof(Character), "Damage")] internal static class HitPatch { private static bool Prefix(Character __instance, HitData hit) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 if (hit == null || !Cheats.Allowed) { return true; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return true; } if ((Object)(object)__instance == (Object)(object)localPlayer) { if ((int)hit.m_hitType == 3) { return !Plugin.FunNoFall.Value; } return true; } if (__instance.IsPlayer() || (Object)(object)hit.GetAttacker() != (Object)(object)localPlayer) { return true; } if (Plugin.FunOneHit.Value) { hit.m_damage.m_damage += __instance.GetMaxHealth() * 10f + 10000f; } if (Plugin.FunKnockback.Value) { hit.m_pushForce = Mathf.Max(hit.m_pushForce, 20f) * 10f; hit.m_staggerMultiplier *= 10f; } return true; } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")] internal static class InstantCraftingPatch { private static readonly FieldRef<InventoryGui, float> CraftTimer = AccessTools.FieldRefAccess<InventoryGui, float>("m_craftTimer"); private static void Prefix(InventoryGui __instance) { if (CraftTimer.Invoke(__instance) > 0f && Fun.On(Plugin.FunInstantCraft)) { CraftTimer.Invoke(__instance) = 1000f; } } } [HarmonyPatch(typeof(EnvMan), "SetEnv")] internal static class NightVisionPatch { private static readonly int AmbientColor = Shader.PropertyToID("_AmbientColor"); private static readonly Color Floor = new Color(0.55f, 0.55f, 0.6f); private static void Postfix() { //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_0015: 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_003f: 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_005f: 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) if (Fun.On(Plugin.FunNightVision)) { Color ambientLight = RenderSettings.ambientLight; ((Color)(ref ambientLight))..ctor(Mathf.Max(ambientLight.r, Floor.r), Mathf.Max(ambientLight.g, Floor.g), Mathf.Max(ambientLight.b, Floor.b), ambientLight.a); RenderSettings.ambientLight = ambientLight; Shader.SetGlobalColor(AmbientColor, ambientLight); } } } internal static class GameArt { private static Dictionary<string, Sprite> _sprites; private static readonly Dictionary<Sprite, Rect> UvCache = new Dictionary<Sprite, Rect>(); internal static Sprite Find(string name) { if (_sprites == null) { _sprites = new Dictionary<string, Sprite>(); Sprite[] array = Resources.FindObjectsOfTypeAll<Sprite>(); foreach (Sprite val in array) { if ((Object)(object)val != (Object)null && !_sprites.ContainsKey(((Object)val).name)) { _sprites[((Object)val).name] = val; } } } if (!_sprites.TryGetValue(name, out var value) || !((Object)(object)value != (Object)null)) { return null; } return value; } internal static bool UvRect(Sprite sprite, out Rect uv) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) uv = default(Rect); if ((Object)(object)sprite == (Object)null) { return false; } if (UvCache.TryGetValue(sprite, out uv)) { return ((Rect)(ref uv)).width > 0f; } bool flag = ComputeUvRect(sprite, out uv); if (UvCache.Count > 512) { UvCache.Clear(); } UvCache[sprite] = (Rect)(flag ? uv : default(Rect)); return flag; } private static bool ComputeUvRect(Sprite sprite, out Rect uv) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0051: 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_0061: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0074: 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: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) uv = default(Rect); if ((Object)(object)sprite == (Object)null || (Object)(object)sprite.texture == (Object)null) { return false; } if (sprite.packed && (int)sprite.packingRotation != 0) { return false; } Vector2[] uv2 = sprite.uv; if (uv2 == null || uv2.Length == 0) { return false; } Vector2 val = uv2[0]; Vector2 val2 = uv2[0]; Vector2[] array = uv2; foreach (Vector2 val3 in array) { val = Vector2.Min(val, val3); val2 = Vector2.Max(val2, val3); } uv = Rect.MinMaxRect(val.x, val.y, val2.x, val2.y); if (((Rect)(ref uv)).width > 0f) { return ((Rect)(ref uv)).height > 0f; } return false; } private static bool CoversRect(Sprite sprite) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003c: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0055: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) Vector2[] vertices = sprite.vertices; if (vertices == null || vertices.Length == 0) { return false; } Vector2 val = vertices[0]; Vector2 val2 = vertices[0]; Vector2[] array = vertices; foreach (Vector2 val3 in array) { val = Vector2.Min(val, val3); val2 = Vector2.Max(val2, val3); } Vector2 val4 = (val2 - val) * sprite.pixelsPerUnit; float x = val4.x; Rect rect = sprite.rect; if (Mathf.Abs(x - ((Rect)(ref rect)).width) <= 1.5f) { float y = val4.y; rect = sprite.rect; return Mathf.Abs(y - ((Rect)(ref rect)).height) <= 1.5f; } return false; } internal static Texture2D Copy(string name, out RectOffset border) { //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_003d: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a8: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_012a: Expected O, but got Unknown border = null; Sprite val = Find(name); if ((Object)(object)val == (Object)null || !UvRect(val, out var uv) || !CoversRect(val)) { return null; } Rect rect = val.rect; int num = Mathf.RoundToInt(((Rect)(ref rect)).width); rect = val.rect; int num2 = Mathf.RoundToInt(((Rect)(ref rect)).height); RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); try { Graphics.Blit((Texture)(object)val.texture, temporary, new Vector2(((Rect)(ref uv)).width, ((Rect)(ref uv)).height), new Vector2(((Rect)(ref uv)).x, ((Rect)(ref uv)).y)); RenderTexture.active = temporary; Texture2D val2 = new Texture2D(num, num2, (TextureFormat)4, false, false) { name = "OdinsEye_" + name, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; val2.ReadPixels(new Rect(0f, 0f, (float)num, (float)num2), 0, 0); val2.Apply(); Vector4 border2 = val.border; border = new RectOffset(Mathf.RoundToInt(border2.x), Mathf.RoundToInt(border2.z), Mathf.RoundToInt(border2.w), Mathf.RoundToInt(border2.y)); return val2; } catch (Exception ex) { Debug.LogWarning((object)("[Odin's Eye] Couldn't copy UI sprite " + name + ": " + ex.Message)); return null; } finally { RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } } internal static Texture2D Composite(Texture2D bottom, Texture2D top) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown if ((Object)(object)bottom == (Object)null || (Object)(object)top == (Object)null || ((Texture)bottom).width != ((Texture)top).width || ((Texture)bottom).height != ((Texture)top).height) { return null; } Color[] pixels = bottom.GetPixels(); Color[] pixels2 = top.GetPixels(); for (int i = 0; i < pixels.Length; i++) { float a = pixels2[i].a; pixels[i] = new Color(Mathf.Lerp(pixels[i].r, pixels2[i].r, a), Mathf.Lerp(pixels[i].g, pixels2[i].g, a), Mathf.Lerp(pixels[i].b, pixels2[i].b, a), Mathf.Max(pixels[i].a, a)); } Texture2D val = new Texture2D(((Texture)bottom).width, ((Texture)bottom).height, (TextureFormat)4, false, false) { wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; val.SetPixels(pixels); val.Apply(); return val; } } internal class Hotkeys : MonoBehaviour { private void Update() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || Plugin.IsTyping() || TextInput.IsVisible()) { return; } Press(Plugin.KeyGod, "God mode", "god"); Press(Plugin.KeyGhost, "Ghost mode", "ghost"); Press(Plugin.KeyFly, "Fly", "fly"); Press(Plugin.KeyNoCost, "No build cost", "nocost"); KeyboardShortcut value = Plugin.KeyBack.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { if (!Back.Any) { ((Character)localPlayer).Message((MessageType)1, "Odin's Eye: nowhere to go back to", 0, (Sprite)null, false); } else if (!Commands.CanRun("goto")) { ((Character)localPlayer).Message((MessageType)1, "Odin's Eye: cheats aren't on", 0, (Sprite)null, false); } else { Back.Go(); } } } private static void Press(ConfigEntry<KeyboardShortcut> key, string label, string line) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = key.Value; if (((KeyboardShortcut)(ref value)).IsDown() && Commands.Exists(line)) { Player localPlayer = Player.m_localPlayer; if (!Commands.CanRun(line)) { ((Character)localPlayer).Message((MessageType)1, "Odin's Eye: cheats aren't on", 0, (Sprite)null, false); return; } Commands.Run(line); ((Character)localPlayer).Message((MessageType)1, label + ": " + State(line, localPlayer), 0, (Sprite)null, false); } } private static string State(string line, Player player) { switch (line) { case "god": if (!((Character)player).InGodMode()) { return "off"; } return "on"; case "ghost": if (!((Character)player).InGhostMode()) { return "off"; } return "on"; case "fly": if (!((Character)player).IsDebugFlying()) { return "off"; } return "on"; case "nocost": if (!player.NoCostCheat()) { return "off"; } return "on"; default: return Ui.StripColor(Commands.LastOutput); } } } internal static class InspectTab { private class Line { internal string Key; internal string Value; } private const float LookRange = 60f; private const float RefreshInterval = 0.5f; private const float KeyW = 130f; private const float LineH = 22f; private static readonly List<Line> Lines = new List<Line>(); private static string _title; private static string _prefab; private static Character _creature; private static Vector3? _markA; private static Vector3? _markB; private static Nearby.Counts _counts; private static float _countedAt = -10f; private static float _refreshedAt = -10f; internal static void Draw(Rect r) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_017a: 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_0226: Unknown result type (might be due to invalid IL or missing references) if (Time.unscaledTime - _refreshedAt > 0.5f) { _refreshedAt = Time.unscaledTime; Read(); } float x = ((Rect)(ref r)).x; float y = ((Rect)(ref r)).y; float width = ((Rect)(ref r)).width; if (_title == null) { Widgets.Header(x, ref y, width, "Nothing in view"); Widgets.Note(x, ref y, width, $"Close the window, look at something within {60f:0} m, and open it again."); DrawAround(x, y + 10f, width); return; } Widgets.Header(x, ref y, width, _title); foreach (Line line in Lines) { Ui.Label(new Rect(x, y, 130f, 22f), "<color=#b9ad98>" + line.Key + "</color>", Ui.Small); Ui.Label(new Rect(x + 130f, y, width - 130f, 22f), line.Value, Ui.Small); y += 22f; } y += 10f; float num = 200f; if (GUI.Button(new Rect(x, y, num, 26f), "Copy prefab name")) { GUIUtility.systemCopyBuffer = _prefab; Commands.LastCommand = "copy"; Commands.LastOutput = _prefab + " copied"; } Widgets.Command(new Rect(x + num + 8f, y, num, 26f), "Spawn another", "spawn " + _prefab); y += 30f; if ((Object)(object)_creature != (Object)null) { Ui.Label(new Rect(x, y, 130f, 22f), "<color=#b9ad98>Stars</color>", Ui.Small); for (int i = 0; i <= 4; i++) { string label = ((i == _creature.GetLevel() - 1) ? string.Format("<color={0}><b>{1}</b></color>", "#e8c77e", i) : i.ToString()); if (Widgets.CheatButton(new Rect(x + 130f + (float)i * 44f, y, 40f, 26f), label)) { Nearby.SetStars(_creature, i); } } y += 30f; Widgets.Note(x, ref y, width, "The game spawns up to 2 stars; 3 and 4 are for testing."); } DrawAround(x, y + 6f, width); } private static void DrawAround(float x, float y, float w) { //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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { Vector3 position = ((Component)localPlayer).transform.position; Widgets.Header(x, ref y, w, "Around you"); Ui.Label(new Rect(x, y, 130f, 22f), "<color=#b9ad98>You</color>", Ui.Small); Ui.Label(new Rect(x + 130f, y, w - 130f, 22f), $"{position.x:0.0}, {position.z:0.0}, height {position.y:0.0}", Ui.Small); y += 22f; float num = 120f; if (GUI.Button(new Rect(x, y, num, 26f), "Mark A here")) { _markA = position; } if (GUI.Button(new Rect(x + num + 6f, y, num, 26f), "Mark B here")) { _markB = position; } string text; if (!_markA.HasValue || !_markB.HasValue) { text = ((!_markA.HasValue) ? "<color=#b9ad98>Mark a spot, walk, and read the distance.</color>" : string.Format("You to A <b>{0:0.0} m</b> <color={1}>({2:0.0} m flat)</color>", Vector3.Distance(position, _markA.Value), "#b9ad98", Utils.DistanceXZ(position, _markA.Value))); } else { Vector3 value = _markA.Value; Vector3 value2 = _markB.Value; text = string.Format("A to B <b>{0:0.0} m</b> <color={1}>({2:0.0} m flat, {3:+0.0;-0.0} m up)</color>", Vector3.Distance(value, value2), "#b9ad98", Utils.DistanceXZ(value, value2), value2.y - value.y); } Ui.Label(new Rect(x + num * 2f + 16f, y, w - num * 2f - 16f, 26f), text, Ui.Small); y += 30f; if (Time.unscaledTime - _countedAt > 1f) { _countedAt = Time.unscaledTime; _counts = Nearby.Count(30f); } Ui.Label(new Rect(x, y, 130f, 22f), string.Format("<color={0}>Within {1:0} m</color>", "#b9ad98", 30f), Ui.Small); Ui.Label(new Rect(x + 130f, y, w - 130f, 22f), $"{_counts.Pieces} pieces, {_counts.Drops} items on the ground, {_counts.Creatures} creatures, {_counts.Objects} objects in all", Ui.Small); } } private static void Read() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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) Lines.Clear(); _title = (_prefab = null); _creature = null; Transform val = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).transform : null); Player localPlayer = Player.m_localPlayer; if ((Object)(object)val == (Object)null || (Object)(object)localPlayer == (Object)null) { return; } GameObject val2 = null; Vector3 val3 = Vector3.zero; float num = float.MaxValue; RaycastHit[] array = Physics.RaycastAll(val.position, val.forward, 60f, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val4 = array[i]; if (!(((RaycastHit)(ref val4)).distance >= num) && !((Component)((RaycastHit)(ref val4)).collider).transform.IsChildOf(((Component)localPlayer).transform)) { num = ((RaycastHit)(ref val4)).distance; val3 = ((RaycastHit)(ref val4)).point; ZNetView componentInParent = ((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<ZNetView>(); Heightmap val5 = (((Object)(object)componentInParent == (Object)null) ? ((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<Heightmap>() : null); val2 = (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).gameObject : (((Object)(object)val5 != (Object)null) ? ((Component)val5).gameObject : ((Component)((Component)((RaycastHit)(ref val4)).collider).transform.root).gameObject)); } } if ((Object)(object)val2 == (Object)null) { return; } _prefab = Utils.GetPrefabName(val2); _title = (((Object)(object)val2.GetComponent<Heightmap>() != (Object)null) ? $"Terrain ({Heightmap.FindBiome(val3)})" : (NameOf(val2) ?? _prefab)); Add("Prefab", _prefab); Add("Kind", KindOf(val2)); Vector3 position = val2.transform.position; Add("Position", $"{position.x:0.0}, {position.y:0.0}, {position.z:0.0} ({Vector3.Distance(((Component)localPlayer).transform.position, val3):0.0} m away)"); ZNetView component = val2.GetComponent<ZNetView>(); ZDO val6 = (((Object)(object)component != (Object)null && component.IsValid()) ? component.GetZDO() : null); if (val6 != null) { long owner = val6.GetOwner(); string arg = ((owner == 0L) ? "no one" : ((owner == ZDOMan.GetSessionID()) ? "you" : "another player or the server")); Add("Network", string.Format("id {0}, owned by {1}{2}", val6.m_uid, arg, val6.Persistent ? "" : ", not saved")); } else { Add("Network", "not networked (part of the terrain or a location)"); } Piece component2 = val2.GetComponent<Piece>(); if ((Object)(object)component2 != (Object)null) { long creator = component2.GetCreator(); Add("Built by", (creator == 0L) ? "the world" : ((creator == localPlayer.GetPlayerID()) ? "you" : $"player {creator}")); } WearNTear component3 = val2.GetComponent<WearNTear>(); if ((Object)(object)component3 != (Object)null) { Add("Health", $"{component3.GetHealthPercentage() * 100f:0}%"); } Character component4 = val2.GetComponent<Character>(); if ((Object)(object)component4 != (Object)null && !component4.IsPlayer()) { _creature = component4; } if ((Object)(object)component4 != (Object)null) { Add("Health", $"{component4.GetHealth():0} / {component4.GetMaxHealth():0}"); Add("Level", (component4.GetLevel() > 1) ? $"{component4.GetLevel()} ({component4.GetLevel() - 1} star)" : "1 (no stars)"); Add("Faction", ((object)Unsafe.As<Faction, Faction>(ref component4.m_faction)/*cast due to .constrained prefix*/).ToString() + (component4.IsTamed() ? ", tamed" : "")); BaseAI component5 = val2.GetComponent<BaseAI>(); if ((Object)(object)component5 != (Object)null) { Character targetCreature = component5.GetTargetCreature(); Add("Mind", (component5.IsAlerted() ? "alerted" : "calm") + (((Object)(object)targetCreature != (Object)null) ? (", after " + Localization.instance.Localize(targetCreature.m_name)) : "")); } } else if (val6 != null && (Object)(object)val2.GetComponent<Destructible>() != (Object)null) { Add("Health", $"{val6.GetFloat(ZDOVars.s_health, val2.GetComponent<Destructible>().m_health):0}"); } } private static void Add(string key, string value) { Lines.Add(new Line { Key = key, Value = value }); } private static string NameOf(GameObject go) { Hoverable component = go.GetComponent<Hoverable>(); string text = ((component != null) ? component.GetHoverName() : null); if (string.IsNullOrEmpty(text)) { text = go.GetComponent<Piece>()?.m_name; } if (string.IsNullOrEmpty(text)) { text = go.GetComponent<Character>()?.m_name; } if (string.IsNullOrEmpty(text)) { text = go.GetComponent<ItemDrop>()?.m_itemData.m_shared.m_name; } if (!string.IsNullOrEmpty(text)) { return Localization.instance.Localize(text); } return null; } private static string KindOf(GameObject go) { if ((Object)(object)go.GetComponent<Character>() != (Object)null) { return "creature"; } if ((Object)(object)go.GetComponent<ItemDrop>() != (Object)null) { return "item"; } if ((Object)(object)go.GetComponent<Plant>() != (Object)null) { return "growing plant"; } if ((Object)(object)go.GetComponent<Pickable>() != (Object)null) { return "pickable"; } if ((Object)(object)go.GetComponent<Piece>() != (Object)null) { return "building piece"; } if ((Object)(object)go.GetComponent<TreeBase>() != (Object)null || (Object)(object)go.GetComponent<TreeLog>() != (Object)null) { return "tree"; } if ((Object)(object)go.GetComponent<MineRock>() != (Object)null || (Object)(object)go.GetComponent<MineRock5>() != (Object)null) { return "rock or ore"; } if ((Object)(object)go.GetComponent<Destructible>() != (Object)null) { return "destructible"; } if ((Object)(object)go.GetComponent<Heightmap>() != (Object)null) { return "terrain"; } return "object"; } } internal enum Tab { Player, Skills, Buffs, Spawn, World, Teleport, Creatures, Admin, Inspect, Custom } internal class Menu : MonoBehaviour { private const float W = 840f; private const float H = 560f; private const float Pad = 18f; private const float TitleH = 34f; private const float TabsH = 32f; private const float BannerH = 34f; private const float FooterH = 26f; private static readonly Tab[] Tabs = new Tab[10] { Tab.Player, Tab.Skills, Tab.Buffs, Tab.Spawn, Tab.World, Tab.Teleport, Tab.Creatures, Tab.Admin, Tab.Inspect, Tab.Custom }; internal static bool SearchFocused; private static Tab _tab; private static string _askText; private static string _askLine; private static bool _dragging; private static Vector2 _dragFrom; private static Vector2 _offset; private static readonly List<Tab> Visible = new List<Tab>(); private static string _hiddenFor; internal static bool IsOpen { get; private set; } internal static void Toggle() { if (IsOpen) { Close(); } else { Open(); } } internal static void Open() { //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) IsOpen = true; GUIUtility.keyboardControl = 0; _tab = Plugin.LastTab.Value; _offset = Plugin.WindowOffset.Value; } internal static void Close() { IsOpen = false; Search.Text = ""; SearchFocused = false; _askText = (_askLine = null); } internal static void Ask(string question, string line) { if (!Plugin.AskFirst.Value) { Commands.Run(line); return; } _askText = question; _askLine = line; } private void OnGUI() { //IL_0205: 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_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_002d: Invalid comparison between Unknown and I4 //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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Invalid comparison between Unknown and I4 //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen) { return; } GUISkin skin = GUI.skin; GUI.skin = Ui.Skin; float width; float height; Matrix4x4 matrix = Ui.BeginScaled(out width, out height); try { if ((int)Event.current.type == 4 && (int)Event.current.keyCode == 27) { Event.current.Use(); if (_askText != null) { _askText = (_askLine = null); } else if (Search.Showing) { Search.Text = ""; GUIUtility.keyboardControl = 0; } else { Close(); } return; } Rect val = default(Rect); ((Rect)(ref val))..ctor((width - 840f) * 0.5f + _offset.x, (height - 560f) * 0.5f + _offset.y, 840f, 560f); Rect val2 = Search.Box(new Rect(((Rect)(ref val)).x + 18f, ((Rect)(ref val)).y + 18f, ((Rect)(ref val)).width - 36f - 40f, 34f)); bool flag = _askText != null; bool flag2 = !flag && Search.Showing; if (!flag) { Drag(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val2)).x - 10f - ((Rect)(ref val)).x, 52f), width, height); } Event current = Event.current; EventType type = current.type; int num; if (flag2 && (current.isMouse || (int)type == 6)) { Rect val3 = Search.ResultsRect(val2); num = (((Rect)(ref val3)).Contains(current.mousePosition) ? 1 : 0); if (num != 0) { current.type = (EventType)11; } } else { num = 0; } SearchFocused = false; GUI.enabled = !flag; DrawWindow(val, val2); GUI.enabled = true; if (num != 0) { current.type = type; } if (Search.Focused) { SearchFocused = true; } if (GUIUtility.keyboardControl != 0 && string.IsNullOrEmpty(GUI.GetNameOfFocusedControl())) { GUIUtility.keyboardControl = 0; } if (flag2) { Search.DrawResults(val2); } if (flag) { DrawAsk(val); } } finally { GUI.matrix = matrix;