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 BuildingInspector v0.3.1
BuildingInspector.dll
Decompiled 2 months 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GUIFramework; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("BuildingInspector")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f381c165c1fec8c6fb6d87fd5c59c279d331c575")] [assembly: AssemblyProduct("BuildingInspector")] [assembly: AssemblyTitle("BuildingInspector")] [assembly: AssemblyVersion("1.0.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 BuildingInspector { [BepInPlugin("Lanoz.BuildingInspector", "Building Inspector", "0.3.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BuildingInspector : BaseUnityPlugin { [HarmonyPatch(typeof(ConfigFile), "Save")] private static class ModConfigurationSavePatch { [HarmonyPostfix] private static void Postfix(ConfigFile __instance) { if (__instance == modConfiguration) { MoveDebugSectionToEnd(__instance); } } } private sealed class FlagNoteReceiver : MonoBehaviour, Hoverable { private ZNetView nview; private MeshRenderer clothRenderer; private int appliedCategory = -1; private void Awake() { //IL_00a7: 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) if (!FlagReceivers.Contains(this)) { FlagReceivers.Add(this); } nview = ((Component)this).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)nview)) { nview.Register<string>("BuildingInspector_SetFlagNote", (Action<long, string>)SetNoteRpc); nview.Register<int>("BuildingInspector_ChangeFlagCategory", (Action<long, int>)ChangeCategoryRpc); if (InspectorDebug.Enabled) { InspectorDebug.Write($"Flag RPC guards registered: flag={((nview.GetZDO() != null) ? nview.GetZDO().m_uid : ZDOID.None)}; role={InspectorDebug.Role}."); } } Transform val = ((Component)this).transform.Find("InspectionFlagPole/InspectionFlagCloth"); clothRenderer = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<MeshRenderer>() : null); ApplyPlayerCollisionIgnores(); } private void Update() { int categoryIndex = GetCategoryIndex(); if (categoryIndex >= 0 && categoryIndex != appliedCategory) { int prefabCategoryIndex = GetPrefabCategoryIndex(); if (appliedCategory < 0 && prefabCategoryIndex == categoryIndex) { appliedCategory = categoryIndex; return; } ApplyCategoryAppearance(categoryIndex); appliedCategory = categoryIndex; } } private void OnDestroy() { FlagReceivers.Remove(this); } public void IgnoreCollisionWith(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return; } Collider component = ((Component)this).GetComponent<Collider>(); if (!Object.op_Implicit((Object)(object)component)) { return; } Collider[] componentsInChildren = ((Component)player).GetComponentsInChildren<Collider>(); Collider[] array = componentsInChildren; foreach (Collider val in array) { if (Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)component) { Physics.IgnoreCollision(component, val, true); } } } private void ApplyPlayerCollisionIgnores() { Player[] array = Object.FindObjectsByType<Player>((FindObjectsSortMode)0); Player[] array2 = array; foreach (Player player in array2) { IgnoreCollisionWith(player); } } private int GetCategoryIndex() { ZDO val = (Object.op_Implicit((Object)(object)nview) ? nview.GetZDO() : null); if (val == null) { return -1; } int num = val.GetInt("BuildingInspector_FlagCategory", -1); return (num >= 0 && num < flagVariants.Length) ? num : GetPrefabCategoryIndex(); } public int GetEditorCategoryIndex() { return GetCategoryIndex(); } private int GetPrefabCategoryIndex() { ZDO val = (Object.op_Implicit((Object)(object)nview) ? nview.GetZDO() : null); ZNetScene instance = ZNetScene.instance; GameObject val2 = ((val != null && Object.op_Implicit((Object)(object)instance)) ? instance.GetPrefab(val.GetPrefab()) : null); if (!Object.op_Implicit((Object)(object)val2) || flagVariants == null) { return -1; } for (int i = 0; i < flagVariants.Length; i++) { if (string.Equals(((Object)val2).name, flagVariants[i].PrefabName, StringComparison.Ordinal)) { return i; } } return -1; } private string GetCategoryDisplayName() { int categoryIndex = GetCategoryIndex(); if (categoryIndex >= 0 && categoryIndex < labelNames.Count) { string text = (string.IsNullOrWhiteSpace(labelNames[categoryIndex].Value) ? $"Category {categoryIndex + 1}" : labelNames[categoryIndex].Value.Trim()); return "Inspection Flag - " + text; } Piece component = ((Component)this).GetComponent<Piece>(); return Object.op_Implicit((Object)(object)component) ? component.m_name : "Inspection Flag"; } private void ApplyCategoryAppearance(int categoryIndex) { //IL_002e: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)clothRenderer) && flagVariants != null && categoryIndex < flagVariants.Length) { Color color = flagVariants[categoryIndex].Color; color.a = Mathf.Min(color.a, 0.85f); ((Renderer)clothRenderer).material.color = color; } } public bool CanEditCategory() { if (!Object.op_Implicit((Object)(object)nview)) { nview = ((Component)this).GetComponent<ZNetView>(); } Piece val = (Object.op_Implicit((Object)(object)nview) ? ((Component)nview).GetComponent<Piece>() : null); ZDO val2 = (Object.op_Implicit((Object)(object)nview) ? nview.GetZDO() : null); long creatorId = GetCreatorId(); bool flag = Object.op_Implicit((Object)(object)val) && val.IsCreator(); return Object.op_Implicit((Object)(object)nview) && val2 != null && Object.op_Implicit((Object)(object)val) && creatorId != 0 && flag; } public string GetText() { string text = ((Object.op_Implicit((Object)(object)nview) && nview.GetZDO() != null) ? nview.GetZDO().GetString("BuildingInspector_FlagNote", string.Empty) : string.Empty); return LimitNoteLength(text); } public string GetHoverText() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Piece component = ((Component)this).GetComponent<Piece>(); string text = GetCategoryDisplayName(); string text2 = GetText(); if (!string.IsNullOrWhiteSpace(text2)) { text = text + "\n<color=#FFE080>Note:</color> " + text2; } if (ShouldShowInspectedBy()) { text = text + "\nInspected by: " + GetCreatorName(); } long creatorId = GetCreatorId(); return (Object.op_Implicit((Object)(object)nview) && nview.GetZDO() != null && Object.op_Implicit((Object)(object)component) && creatorId != 0L && component.IsCreator()) ? (text + $"\nPress [<color=yellow><b>{editNoteKey.Value}</b></color>] to edit flag") : (text + "\n<color=#AAAAAA>Only the player who placed this flag can edit its note.</color>"); } public string GetHoverName() { return GetCategoryDisplayName(); } public float GetHoverOffset() { return 0f; } private long GetCreatorId() { Piece val = (Object.op_Implicit((Object)(object)nview) ? ((Component)nview).GetComponent<Piece>() : null); return Object.op_Implicit((Object)(object)val) ? val.GetCreator() : 0; } public void SaveCreatorName(string creatorName) { Piece component = ((Component)this).GetComponent<Piece>(); ZDO val = (Object.op_Implicit((Object)(object)nview) ? nview.GetZDO() : null); long num = (Object.op_Implicit((Object)(object)component) ? component.GetCreator() : 0); if (Object.op_Implicit((Object)(object)component) && val != null && !string.IsNullOrWhiteSpace(creatorName) && Object.op_Implicit((Object)(object)Player.m_localPlayer) && Player.m_localPlayer.GetPlayerID() == num) { val.Set("BuildingInspector_FlagCreatorName", creatorName); } } private string GetCreatorName() { //IL_0160: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) ZDO val = (Object.op_Implicit((Object)(object)nview) ? nview.GetZDO() : null); string text = ((val != null) ? val.GetString("BuildingInspector_FlagCreatorName", string.Empty) : string.Empty); if (!string.IsNullOrWhiteSpace(text)) { return text; } long creatorId = GetCreatorId(); Player localPlayer = Player.m_localPlayer; bool flag = Object.op_Implicit((Object)(object)localPlayer) && localPlayer.GetPlayerID() == creatorId; if (creatorId == 0) { return "Odin"; } string text2 = string.Empty; if (flag) { string playerName = localPlayer.GetPlayerName(); if (!string.IsNullOrWhiteSpace(playerName)) { text2 = playerName; } } Player player = Player.GetPlayer(creatorId); if (string.IsNullOrWhiteSpace(text2) && Object.op_Implicit((Object)(object)player)) { string playerName2 = player.GetPlayerName(); if (!string.IsNullOrWhiteSpace(playerName2)) { text2 = playerName2; } } if (Object.op_Implicit((Object)(object)ZNet.instance)) { foreach (ZNetPeer peer in ZNet.instance.GetPeers()) { if (peer.m_playerID != creatorId) { continue; } foreach (PlayerInfo player2 in ZNet.instance.GetPlayerList()) { ZDOID characterID = player2.m_characterID; if (((ZDOID)(ref characterID)).Equals(peer.m_characterID) && string.IsNullOrWhiteSpace(text2) && !string.IsNullOrWhiteSpace(player2.m_name)) { text2 = player2.m_name; } } break; } } if (string.IsNullOrWhiteSpace(text2)) { return "Odin"; } if (val != null && Object.op_Implicit((Object)(object)nview) && nview.IsOwner()) { val.Set("BuildingInspector_FlagCreatorName", text2); } return text2; } public void RequestCategoryChange(int categoryIndex) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (categoryIndex < 0 || categoryIndex >= flagVariants.Length || !CanEditCategory()) { if (InspectorDebug.Enabled) { TraceFlagEdit("category request denied", (Object.op_Implicit((Object)(object)nview) && nview.GetZDO() != null) ? nview.GetZDO().m_uid : ZDOID.None, null, 0L, null, categoryIndex, (categoryIndex < 0 || categoryIndex >= flagVariants.Length) ? "CategoryOutOfRange" : "LocalCreatorCheckFailed", 0L); } } else { SendFlagEditRequest(nview.GetZDO(), null, categoryIndex); } } private void ChangeCategoryRpc(long sender, int categoryIndex) { if (InspectorDebug.Enabled) { InspectorDebug.Write($"Legacy category RPC denied: senderUID={sender}; category={categoryIndex}; " + "role=" + InspectorDebug.Role + "; reason=ObjectRoutedTransportDisabled."); } log.LogWarning((object)"Rejected legacy object-routed inspection flag category update."); } public void SetText(string text) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) Piece val = (Object.op_Implicit((Object)(object)nview) ? ((Component)nview).GetComponent<Piece>() : null); if (Object.op_Implicit((Object)(object)nview) && nview.GetZDO() != null && Object.op_Implicit((Object)(object)val) && val.IsCreator()) { SendFlagEditRequest(nview.GetZDO(), LimitNoteLength((text ?? string.Empty).Trim()), -1); } else if (InspectorDebug.Enabled) { TraceFlagEdit("note request denied", (Object.op_Implicit((Object)(object)nview) && nview.GetZDO() != null) ? nview.GetZDO().m_uid : ZDOID.None, null, 0L, text ?? string.Empty, -1, "LocalCreatorCheckFailedOrZdoUnavailable", 0L); } } private void SetNoteRpc(long sender, string text) { if (InspectorDebug.Enabled) { InspectorDebug.Write($"Legacy note RPC denied: senderUID={sender}; noteLength={text?.Length ?? 0}; " + "role=" + InspectorDebug.Role + "; reason=ObjectRoutedTransportDisabled."); } log.LogWarning((object)"Rejected legacy object-routed inspection flag note update."); } } [HarmonyPatch(typeof(Player), "Start")] private static class PlayerStartFlagCollisionPatch { [HarmonyPostfix] private static void Postfix(Player __instance) { foreach (FlagNoteReceiver flagReceiver in FlagReceivers) { if (Object.op_Implicit((Object)(object)flagReceiver)) { flagReceiver.IgnoreCollisionWith(__instance); } } } } private sealed class FlagVariant { public string DisplayName { get; } public string Description { get; } public string PrefabName { get; } public Color Color { get; } public Sprite Icon { get; set; } public FlagVariant(string displayName, string description, string prefabName, Color color) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) DisplayName = displayName; Description = description; PrefabName = prefabName; Color = color; } } [HarmonyPatch(typeof(Piece), "SetCreator")] private static class InspectionFlagCreatorNamePatch { [HarmonyPostfix] private static void Postfix(Piece __instance) { if (Object.op_Implicit((Object)(object)__instance)) { FlagNoteReceiver component = ((Component)__instance).GetComponent<FlagNoteReceiver>(); if (Object.op_Implicit((Object)(object)component)) { long creator = __instance.GetCreator(); Player localPlayer = Player.m_localPlayer; string creatorName = ((Object.op_Implicit((Object)(object)localPlayer) && localPlayer.GetPlayerID() == creator) ? localPlayer.GetPlayerName() : string.Empty); component.SaveCreatorName(creatorName); } } } } private sealed class PendingFlagEdit { public ZRpc RequestConnection; public ZDOID Target; public long CreatorId; public string Note; public int Category; public int Attempts; public long SentOwner; public float RetryAt; } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] private static class FlagEditConnectionPatch { [HarmonyPostfix] private static void Postfix(ZNetPeer __0) { __0.m_rpc.Register<ZDOID, string>("BuildingInspector_SetFlagNote", (Action<ZRpc, ZDOID, string>)delegate(ZRpc connection, ZDOID target, string note) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) QueueFlagEdit(connection, target, note ?? string.Empty, -1); }); __0.m_rpc.Register<ZDOID, int>("BuildingInspector_ChangeFlagCategory", (Action<ZRpc, ZDOID, int>)delegate(ZRpc connection, ZDOID target, int category) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) QueueFlagEdit(connection, target, null, category); }); __0.m_rpc.Register<ZPackage>("BuildingInspector_ApplyAuthorizedFlagEdit", (Action<ZRpc, ZPackage>)ReceiveAuthorizedFlagEdit); __0.m_rpc.Register<long, bool>("BuildingInspector_FlagEditResult", (Action<ZRpc, long, bool>)ReceiveFlagEditResult); if (InspectorDebug.Enabled) { InspectorDebug.Write($"RPC registered on connection: role={InspectorDebug.Role}; peerUID={__0.m_uid}."); } } } [HarmonyPatch(typeof(ZNet), "Awake")] private static class FlagEditWorldResetPatch { [HarmonyPostfix] private static void Postfix() { if (InspectorDebug.Enabled) { InspectorDebug.Write($"Network world initialized: pendingRequestsCleared={PendingFlagEdits.Count}."); } PendingFlagEdits.Clear(); } } [HarmonyPatch(typeof(ZNet), "Update")] private static class FlagEditRetryPatch { [HarmonyPostfix] private static void Postfix(ZNet __instance) { if (!__instance.IsServer() || PendingFlagEdits.Count == 0) { return; } List<long> list = null; foreach (KeyValuePair<long, PendingFlagEdit> pendingFlagEdit in PendingFlagEdits) { if (Time.unscaledTime >= pendingFlagEdit.Value.RetryAt) { if (list == null) { list = new List<long>(); } list.Add(pendingFlagEdit.Key); } } if (list == null) { return; } foreach (long item in list) { DispatchFlagEdit(item); } } } [HarmonyPatch(typeof(ZNet), "OpenServer")] private static class MultiplayerWorldOpenServerPatch { [HarmonyPostfix] private static void Postfix(ZNet __instance) { MarkMultiplayerWorldIfNeeded(__instance); } } [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] private static class PlacementGhostTiltPatch { [HarmonyPostfix] private static void Postfix(Player __instance) { AlignFlagToSurface(__instance); } } private sealed class SimpleFlagNoteAdapter : TextReceiver { public string GetText() { return originalNote ?? string.Empty; } public void SetText(string text) { if (flagEditorOpen && !usingNewFlagEditorUi && !simpleNoteClosing && Object.op_Implicit((Object)(object)simpleNoteField) && !((TMP_InputField)simpleNoteField).wasCanceled && !Input.GetKeyDown((KeyCode)27) && !WouldExceedSimpleNoteLimits(text ?? string.Empty)) { SaveFlagNote(text); } } } [HarmonyPatch(typeof(TextInput), "OnEnter")] private static class SimpleFlagNoteEnterPatch { [HarmonyPrefix] private static bool Prefix(TextInput __instance) { return CanSubmitSimpleFlagNote(__instance); } } [HarmonyPatch(typeof(TextInput), "OnInput")] private static class SimpleFlagNoteInputPatch { [HarmonyPrefix] private static bool Prefix(TextInput __instance) { if (!flagEditorOpen || usingNewFlagEditorUi || (Object)(object)__instance != (Object)(object)simpleNoteMenu) { return true; } __instance.OnEnter(); return false; } } [HarmonyPatch(typeof(TextInput), "Hide")] private static class SimpleFlagNoteHidePatch { [HarmonyPrefix] private static void Prefix(TextInput __instance) { if (flagEditorOpen && !usingNewFlagEditorUi && (Object)(object)__instance == (Object)(object)simpleNoteMenu) { simpleNoteClosing = true; } } [HarmonyPostfix] private static void Postfix(TextInput __instance) { if (flagEditorOpen && !usingNewFlagEditorUi && (Object)(object)__instance == (Object)(object)simpleNoteMenu) { CloseFlagEditor(); } } } private sealed class CategoryButtonHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public Button Button; public void OnPointerEnter(PointerEventData eventData) { SetHoverTint(hovered: true); } public void OnPointerExit(PointerEventData eventData) { SetHoverTint(hovered: false); } private void OnDisable() { SetHoverTint(hovered: false); } private void SetHoverTint(bool hovered) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Button)) { ColorBlock colors = ((Selectable)Button).colors; ((ColorBlock)(ref colors)).selectedColor = (hovered ? ((ColorBlock)(ref colors)).highlightedColor : ((ColorBlock)(ref colors)).normalColor); ((Selectable)Button).colors = colors; } } } [HarmonyPatch(typeof(Player), "TakeInput")] private static class FlagEditorTakeInputPatch { [HarmonyPrefix] private static bool Prefix(Player __instance, ref bool __result) { if (!flagEditorInputBlocked || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Player), "PlayerAttackInput")] private static class FlagEditorAttackInputPatch { [HarmonyPrefix] private static bool Prefix(Player __instance) { if (!flagEditorInputBlocked || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } return false; } } [CompilerGenerated] private static class <>O { public static OnValidateInput <0>__ValidateSimpleNoteInput; public static UnityAction <1>__SaveFlagEditor; public static UnityAction <2>__CloseFlagEditor; } public const string PluginGUID = "Lanoz.BuildingInspector"; public const string PluginName = "Building Inspector"; public const string PluginVersion = "0.3.1"; private static ManualLogSource log; private const int FlagVariantCount = 6; private static ConfigEntry<KeyboardShortcut> tiltForwardKey; private static ConfigEntry<KeyboardShortcut> tiltBackwardKey; private static ConfigEntry<KeyboardShortcut> tiltLeftKey; private static ConfigEntry<KeyboardShortcut> tiltRightKey; private static ConfigEntry<KeyboardShortcut> resetTiltKey; private static ConfigEntry<float> tiltStepDegrees; private static ConfigEntry<float> maxTiltDegrees; private static ConfigEntry<KeyboardShortcut> editNoteKey; private static ConfigEntry<bool> advancedFlagEditorUi; private static ConfigEntry<float> flagBlockRadius; private static ConfigEntry<bool> testFlagEnabled; private static ConfigFile modConfiguration; private static readonly List<ConfigEntry<string>> labelNames = new List<ConfigEntry<string>>(); private static readonly List<ConfigEntry<string>> labelDescriptions = new List<ConfigEntry<string>>(); private static readonly List<ConfigEntry<string>> labelColors = new List<ConfigEntry<string>>(); private static FlagVariant[] flagVariants; private static FlagVariant testFlagVariant; private static readonly List<FlagNoteReceiver> FlagReceivers = new List<FlagNoteReceiver>(); private static readonly List<Texture2D> IconTextures = new List<Texture2D>(); private static Texture2D clothTexture; private const string CreatorNameZdoKey = "BuildingInspector_FlagCreatorName"; private const string NoteRpcName = "BuildingInspector_SetFlagNote"; private const string NoteZdoKey = "BuildingInspector_FlagNote"; private const string ChangeCategoryRpcName = "BuildingInspector_ChangeFlagCategory"; private const string ApplyFlagEditRpcName = "BuildingInspector_ApplyAuthorizedFlagEdit"; private const string FlagEditResultRpcName = "BuildingInspector_FlagEditResult"; private const int MaxPendingFlagEdits = 128; private const int MaxFlagEditAttempts = 2; private const float FlagEditReplyTimeout = 2f; private static readonly Dictionary<long, PendingFlagEdit> PendingFlagEdits = new Dictionary<long, PendingFlagEdit>(); private static long nextFlagEditId; private const string FlagCategoryZdoKey = "BuildingInspector_FlagCategory"; private const string MultiplayerWorldGlobalKey = "BuildingInspector_MultiplayerWorld"; private static float tiltX; private static float tiltZ; private static float surfaceWheelRotation; private static GameObject lastTiltedGhost; private const int MaxNoteLength = 160; private const int MaxNoteLines = 5; private static bool flagEditorOpen; private static bool usingNewFlagEditorUi; private static bool simpleNoteClosing; private static TextInput simpleNoteMenu; private static GuiInputField simpleNoteField; private static TMP_Text simpleNoteMeasure; private static LineType previousSimpleLineType; private static int previousSimpleLineLimit; private static int previousSimpleCharacterLimit; private static OnValidateInput previousSimpleValidation; private static TextWrappingModes previousSimpleWrapping; private static TextOverflowModes previousSimpleOverflow; private static bool flagEditorInputBlocked; private static bool flagEditorInputUnblockPending; private static int flagEditorUnblockFrame; private static FlagNoteReceiver flagEditorTarget; private static GameObject flagEditorCanvas; private static GameObject flagEditorPanel; private static InputField flagEditorNoteField; private static Button[] flagEditorCategoryButtons; private static Image[] flagEditorCategoryButtonImages; private static string originalNote; private static int originalCategory; private static int draftCategory; private static CursorLockMode editorPreviousCursorLock; private static bool editorPreviousCursorVisible; private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Building Inspector loading..."); InitializeConfiguration(); InitializeDebugConfiguration(); if (InspectorDebug.Enabled) { InspectorDebug.Write("Initialization: version=0.3.1; registering Harmony patches and prefab event."); } new Harmony("Lanoz.BuildingInspector").PatchAll(typeof(BuildingInspector).Assembly); PrefabManager.OnVanillaPrefabsAvailable += RegisterInspectionFlag; } private void BindFlagVariants() { //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) int[] array = new int[6] { 1, 2, 3, 4, 5, 6 }; string[] array2 = new string[6] { "Problem", "Review", "Verified", "Other", "Structural", "Finish" }; string[] array3 = new string[6] { "A building issue was found.", "This part needs review.", "This part was inspected.", "Another inspection category.", "Structural work needs attention.", "Finishing work needs attention." }; string[] array4 = new string[6] { "#FA2E1F", "#FFE014", "#1FE633", "#1F80FF", "#A64DFF", "#F2F2F2" }; string[] array5 = new string[6] { "InspectionFlagRed", "InspectionFlagYellow", "InspectionFlagGreen", "InspectionFlagBlue", "InspectionFlagPurple", "InspectionFlagWhite" }; flagVariants = new FlagVariant[6]; Color white = default(Color); for (int i = 0; i < 6; i++) { int num = array[i]; labelNames.Add(((BaseUnityPlugin)this).Config.Bind<string>("Flag Labels", $"Label{num}Name", array2[i], "Display name for this flag category.")); labelDescriptions.Add(((BaseUnityPlugin)this).Config.Bind<string>("Flag Labels", $"Label{num}Description", array3[i], "Description shown in the build menu.")); labelColors.Add(((BaseUnityPlugin)this).Config.Bind<string>("Flag Labels", $"Label{num}Color", array4[i], "Flag color as a hex value, for example #FF0000.")); if (!ColorUtility.TryParseHtmlString(labelColors[i].Value, ref white)) { white = Color.white; ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Invalid color for Label{num}Color; using white."); } string text = (string.IsNullOrWhiteSpace(labelNames[i].Value) ? array2[i] : labelNames[i].Value.Trim()); string description = labelDescriptions[i].Value ?? string.Empty; flagVariants[i] = new FlagVariant("Inspection Flag - " + text, description, array5[i], white); } string text2 = BindTestFlagSetting("Name", "Configuration Test", "Display name for the optional test flag."); string text3 = BindTestFlagSetting("Description", "Temporary flag for testing label settings.", "Description for the optional test flag."); string text4 = BindTestFlagSetting("Color", "#FF00FF", "Hex color for the optional test flag, for example #FF00FF."); Color magenta = default(Color); if (!ColorUtility.TryParseHtmlString(text4, ref magenta)) { magenta = Color.magenta; ((BaseUnityPlugin)this).Logger.LogWarning((object)("Invalid Debug TestFlagColor '" + text4 + "'; using #FF00FF.")); } text2 = (string.IsNullOrWhiteSpace(text2) ? "Configuration Test" : text2.Trim()); testFlagVariant = new FlagVariant("[TEST] Inspection Flag - " + text2, text3 ?? string.Empty, "InspectionFlagConfigTest", magenta); } private string BindTestFlagSetting(string key, string defaultValue, string description) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown string value = ((BaseUnityPlugin)this).Config.Bind<string>("Test Flag", key, defaultValue, description).Value; string value2 = ((BaseUnityPlugin)this).Config.Bind<string>("Debug", "TestFlag" + key, value, description).Value; ((BaseUnityPlugin)this).Config.Remove(new ConfigDefinition("Test Flag", key)); return value2; } private void InitializeConfiguration() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown modConfiguration = ((BaseUnityPlugin)this).Config; tiltForwardKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Flag Rotation", "TiltForwardKey", new KeyboardShortcut((KeyCode)105, Array.Empty<KeyCode>()), "Tilt the flag forward."); tiltBackwardKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Flag Rotation", "TiltBackwardKey", new KeyboardShortcut((KeyCode)107, Array.Empty<KeyCode>()), "Tilt the flag backward."); tiltLeftKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Flag Rotation", "TiltLeftKey", new KeyboardShortcut((KeyCode)106, Array.Empty<KeyCode>()), "Tilt the flag to the left."); tiltRightKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Flag Rotation", "TiltRightKey", new KeyboardShortcut((KeyCode)108, Array.Empty<KeyCode>()), "Tilt the flag to the right."); resetTiltKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Flag Rotation", "ResetTiltKey", new KeyboardShortcut((KeyCode)277, Array.Empty<KeyCode>()), "Reset the flag tilt."); tiltStepDegrees = ((BaseUnityPlugin)this).Config.Bind<float>("Flag Rotation", "TiltStepDegrees", 15f, "Tilt change per key press in degrees."); maxTiltDegrees = ((BaseUnityPlugin)this).Config.Bind<float>("Flag Rotation", "MaxTiltDegrees", 60f, "Maximum tilt angle in either direction."); editNoteKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Flag Notes", "EditNoteKey", new KeyboardShortcut((KeyCode)110, Array.Empty<KeyCode>()), "Edit the note on the aimed inspection flag."); advancedFlagEditorUi = ((BaseUnityPlugin)this).Config.Bind<bool>("Flag Editor", "AdvancedUI", true, "Use the note and category editor. Disable for the original note-only menu. Changes apply the next time the editor opens; reload the config or restart after editing the file."); if (((BaseUnityPlugin)this).Config.Remove(new ConfigDefinition("Flag Categories", "ChangeCategoryKey"))) { ((BaseUnityPlugin)this).Config.Save(); } flagBlockRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Flag Placement", "BlockRadius", 0.2f, new ConfigDescription("Minimum spacing between placed inspection flags in meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 1f), Array.Empty<object>())); BindFlagVariants(); } private void InitializeDebugConfiguration() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown ConfigEntry<bool> setting = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Enabled", false, "Enable inspection editor and RPC diagnostics in LogOutput.log. Changes in memory apply immediately; reload the config or restart after editing the file."); InspectorDebug.Initialize(setting, ((BaseUnityPlugin)this).Logger); testFlagEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "TestFlagEnabled", false, "Register an isolated development/test flag for checking label configuration. Restart the game after changing this setting."); ((BaseUnityPlugin)this).Config.Bind<bool>("Test Flag", "Enabled", false, "Replaced by Debug.TestFlagEnabled."); ((BaseUnityPlugin)this).Config.Remove(new ConfigDefinition("Test Flag", "Enabled")); ((BaseUnityPlugin)this).Config.Save(); MoveDebugSectionToEnd(((BaseUnityPlugin)this).Config); } private static void MoveDebugSectionToEnd(ConfigFile configuration) { try { string configFilePath = configuration.ConfigFilePath; string text = File.ReadAllText(configFilePath, Encoding.UTF8); Match match = Regex.Match(text, "(?m)^\\[Debug\\][ \\t]*\\r?$"); if (match.Success) { Match match2 = Regex.Match(text.Substring(match.Index + match.Length), "(?m)^\\[[^\\r\\n]+\\][ \\t]*\\r?$"); if (match2.Success) { int num = match.Index + match.Length + match2.Index; string text2 = text.Substring(match.Index, num - match.Index); string text3 = text.Remove(match.Index, text2.Length); string text4 = (text.Contains("\r\n") ? "\r\n" : "\n"); File.WriteAllText(configFilePath, text3.TrimEnd('\r', '\n') + text4 + text4 + text2.TrimEnd('\r', '\n') + text4, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); } } } catch (Exception ex) { log.LogWarning((object)("Could not move Debug to the end of the mod configuration: " + ex.Message)); } } private void RegisterInspectionFlag() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterInspectionFlag; try { int num = AddInspectionFlags(); if (InspectorDebug.Enabled) { InspectorDebug.Write($"Prefab registration completed: count={num}."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Inspection Flags registered: {num}."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Building Inspector loaded!"); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to register Inspection Flag: {arg}"); } } private int AddInspectionFlags() { GameObject prefab = Cache.GetPrefab<GameObject>("wood_pole"); Renderer val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponentInChildren<Renderer>() : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.sharedMaterial)) { throw new InvalidOperationException("Could not find the vanilla wood_pole material."); } Piece component = prefab.GetComponent<Piece>(); if (!Object.op_Implicit((Object)(object)component)) { throw new InvalidOperationException("Could not find the Piece component on vanilla wood_pole."); } WearNTear component2 = prefab.GetComponent<WearNTear>(); if (!Object.op_Implicit((Object)(object)component2)) { throw new InvalidOperationException("Could not find the WearNTear component on vanilla wood_pole."); } Material sharedMaterial = val.sharedMaterial; int pieceLayer = LayerMask.NameToLayer("piece"); int num = 0; FlagVariant[] array = flagVariants; foreach (FlagVariant variant in array) { if (AddInspectionFlag(variant, sharedMaterial, component.m_placeEffect, component2, pieceLayer)) { num++; } } if (num != flagVariants.Length) { throw new InvalidOperationException($"Only {num} of {flagVariants.Length} Inspection Flags were registered."); } if (testFlagEnabled.Value && AddInspectionFlag(testFlagVariant, sharedMaterial, component.m_placeEffect, component2, pieceLayer)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Optional configuration test flag registered."); } List<Piece> list = new List<Piece>(); FlagVariant[] array2 = flagVariants; foreach (FlagVariant flagVariant in array2) { GameObject prefab2 = Cache.GetPrefab<GameObject>(flagVariant.PrefabName); Piece val2 = (Object.op_Implicit((Object)(object)prefab2) ? prefab2.GetComponent<Piece>() : null); if (Object.op_Implicit((Object)(object)val2)) { list.Add(val2); } } foreach (Piece item in list) { item.m_blockingPieces = list; item.m_blockRadius = Mathf.Clamp(flagBlockRadius.Value, 0.05f, 1f); } return num; } private bool AddInspectionFlag(FlagVariant variant, Material woodMaterial, EffectList placeEffect, WearNTear sourceWearNTear, int pieceLayer) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown GameObject val = PrefabManager.Instance.CreateEmptyPrefab(variant.PrefabName, true); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Jotunn could not create the " + variant.PrefabName + " prefab."); } val.transform.localScale = Vector3.one * 0.5f; val.AddComponent<Piece>(); val.AddComponent<FlagNoteReceiver>(); BoxCollider component = val.GetComponent<BoxCollider>(); if (!Object.op_Implicit((Object)(object)component)) { throw new InvalidOperationException("The InspectionFlag prefab has no root BoxCollider."); } MeshRenderer component2 = val.GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component2)) { ((Renderer)component2).enabled = false; } if (pieceLayer >= 0) { val.layer = pieceLayer; } component.center = new Vector3(0f, 0.68f, 0f); component.size = new Vector3(0.55f, 1.4f, 0.16f); ((Collider)component).isTrigger = false; GameObject val2 = AddPrimitive(val, (PrimitiveType)2, "InspectionFlagPole", new Vector3(0f, 0.34f, 0f), new Vector3(0.027f, 0.68f, 0.027f), woodMaterial, pieceLayer); AddClothSprite(val2, woodMaterial, variant, pieceLayer); WearNTear val3 = val.AddComponent<WearNTear>(); val3.m_new = val2; val3.m_worn = val2; val3.m_broken = val2; val3.m_noRoofWear = true; val3.m_noSupportWear = sourceWearNTear.m_noSupportWear; val3.m_supports = false; val3.m_staticPosition = sourceWearNTear.m_staticPosition; val3.m_materialType = sourceWearNTear.m_materialType; val3.m_health = sourceWearNTear.m_health; val3.m_autoCreateFragments = false; val3.m_fragmentRoots = Array.Empty<GameObject>(); PieceConfig val4 = new PieceConfig { Name = variant.DisplayName, Description = variant.Description, PieceTable = "Hammer", Category = "Inspection" }; val4.Icon = CreateFlagIcon(variant.Color, variant.PrefabName); if (!Object.op_Implicit((Object)(object)val4.Icon)) { throw new InvalidOperationException("Could not create an icon for " + variant.PrefabName + "."); } variant.Icon = val4.Icon; CustomPiece val5 = new CustomPiece(val, false, val4); val5.Piece.m_resources = Array.Empty<Requirement>(); val5.Piece.m_placeEffect = placeEffect; val5.Piece.m_canRotate = true; if (!PieceManager.Instance.AddPiece(val5)) { throw new InvalidOperationException("Jotunn's PieceManager rejected " + variant.PrefabName + "."); } return true; } private static GameObject AddPrimitive(GameObject parent, PrimitiveType type, string name, Vector3 localPosition, Vector3 localScale, Material material, int pieceLayer) { //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_0036: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(type); ((Object)val).name = name; val.transform.SetParent(parent.transform, false); val.transform.localPosition = localPosition; val.transform.localScale = localScale; if (pieceLayer >= 0) { val.layer = pieceLayer; } Collider component = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false; } Renderer component2 = val.GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component2)) { component2.sharedMaterial = material; } return val; } private static void AddClothSprite(GameObject pole, Material woodMaterial, FlagVariant variant, int pieceLayer) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_010f: 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_0117: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_008a: 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_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: 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_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07cc: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)clothTexture)) { clothTexture = new Texture2D(16, 16, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[256]; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { bool flag = j % 4 == 0; bool flag2 = i % 4 == 0; byte b = (byte)((flag && flag2) ? 236 : ((flag || flag2) ? 246 : byte.MaxValue)); array[i * 16 + j] = new Color32(b, b, b, byte.MaxValue); } } clothTexture.SetPixels32(array); clothTexture.Apply(false, true); ((Texture)clothTexture).filterMode = (FilterMode)1; } Material val = new Material(woodMaterial); ((Object)val).name = variant.PrefabName + "_ClothMaterial"; val.mainTexture = (Texture)(object)clothTexture; Color color = variant.Color; color.a = Mathf.Min(color.a, 0.85f); val.color = color; if (val.HasProperty("_Mode")) { val.SetFloat("_Mode", 2f); } if (val.HasProperty("_SrcBlend")) { val.SetInt("_SrcBlend", 5); } if (val.HasProperty("_DstBlend")) { val.SetInt("_DstBlend", 10); } if (val.HasProperty("_ZWrite")) { val.SetInt("_ZWrite", 0); } if (val.HasProperty("_Cull")) { val.SetInt("_Cull", 0); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0f); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color.black); } val.DisableKeyword("_EMISSION"); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.renderQueue = 3000; GameObject val2 = new GameObject("InspectionFlagCloth"); val2.transform.SetParent(pole.transform, false); MeshFilter val3 = (Object.op_Implicit((Object)(object)pole) ? pole.GetComponent<MeshFilter>() : null); Vector3 localScale = pole.transform.localScale; float num = Mathf.Max(Mathf.Abs(localScale.x), 0.0001f); float num2 = Mathf.Max(Mathf.Abs(localScale.y), 0.0001f); Bounds val4 = (Bounds)((Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.sharedMesh)) ? val3.sharedMesh.bounds : new Bounds(Vector3.zero, Vector3.one)); float num3 = 0.39f / num; float num4 = 0.24f / num2; float num5 = num4 * 0.5f; float num6 = Mathf.Max(Mathf.Abs(pole.transform.lossyScale.z), 0.0001f); float num7 = 0.003f / num6 * 0.5f; val2.transform.localPosition = new Vector3(0f - ((Bounds)(ref val4)).extents.x, ((Bounds)(ref val4)).max.y - num5, 0f); if (pieceLayer >= 0) { val2.layer = pieceLayer; } Mesh val5 = new Mesh(); ((Object)val5).name = "InspectionFlagClothMesh"; val5.vertices = (Vector3[])(object)new Vector3[24] { new Vector3(0f, 0f - num5, num7), new Vector3(num3, 0f - num5, num7), new Vector3(num3, num5, num7), new Vector3(0f, num5, num7), new Vector3(0f, 0f - num5, 0f - num7), new Vector3(num3, 0f - num5, 0f - num7), new Vector3(num3, num5, 0f - num7), new Vector3(0f, num5, 0f - num7), new Vector3(0f, 0f - num5, 0f - num7), new Vector3(0f, 0f - num5, num7), new Vector3(0f, num5, num7), new Vector3(0f, num5, 0f - num7), new Vector3(num3, 0f - num5, 0f - num7), new Vector3(num3, num5, 0f - num7), new Vector3(num3, num5, num7), new Vector3(num3, 0f - num5, num7), new Vector3(0f, num5, 0f - num7), new Vector3(0f, num5, num7), new Vector3(num3, num5, num7), new Vector3(num3, num5, 0f - num7), new Vector3(0f, 0f - num5, 0f - num7), new Vector3(0f, 0f - num5, num7), new Vector3(num3, 0f - num5, num7), new Vector3(num3, 0f - num5, 0f - num7) }; val5.uv = (Vector2[])(object)new Vector2[24] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f) }; val5.triangles = new int[36] { 0, 1, 2, 0, 2, 3, 4, 6, 5, 4, 7, 6, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23 }; val5.RecalculateNormals(); val5.RecalculateBounds(); val2.AddComponent<MeshFilter>().sharedMesh = val5; MeshRenderer val6 = val2.AddComponent<MeshRenderer>(); ((Renderer)val6).sharedMaterial = val; } private static Sprite CreateFlagIcon(Color flagColor, string iconName) { //IL_001e: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00aa: 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) Color32[] array = (Color32[])(object)new Color32[4096]; Color32 color = default(Color32); ((Color32)(ref color))..ctor((byte)112, (byte)75, (byte)42, byte.MaxValue); Color32 color2 = Color32.op_Implicit(flagColor); DrawRectangle(array, 64, 29, 13, 34, 54, color); DrawRectangle(array, 64, 19, 8, 44, 13, color); DrawRectangle(array, 64, 34, 43, 53, 55, color2); DrawRectangle(array, 64, 34, 39, 49, 43, color2); Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); val.SetPixels32(array); val.Apply(false, true); IconTextures.Add(val); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); ((Object)val2).name = iconName + "Icon"; return val2; } private static void DrawRectangle(Color32[] pixels, int textureSize, int xMin, int yMin, int xMax, int yMax, Color32 color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) for (int i = yMin; i < yMax; i++) { for (int j = xMin; j < xMax; j++) { pixels[i * textureSize + j] = color; } } } private static void TraceFlagEdit(string eventName, ZDOID target, ZRpc connection, long checkedCharacterId, string note, int category, string reason, long editId = 0L) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (InspectorDebug.Enabled) { ZNet instance = ZNet.instance; ZNetPeer val = ((Object.op_Implicit((Object)(object)instance) && connection != null) ? GetConnectionPeer(instance, connection) : null); if (Object.op_Implicit((Object)(object)instance) && !instance.IsServer() && connection == null && (eventName == "change applied" || eventName == "apply denied")) { val = instance.GetServerPeer(); } ZDO val2 = ((ZDOMan.instance != null) ? ZDOMan.instance.GetZDO(target) : null); long num = val?.m_uid ?? ((connection == null && Object.op_Implicit((Object)(object)instance) && ZDOMan.instance != null) ? ZNet.GetUID() : 0); InspectorDebug.Write(string.Format("Network {0}: operation={1}; request={2}; ", eventName, (note != null) ? "note" : "category", editId) + $"flag={target}; senderUID={num}; creator={((val2 != null) ? val2.GetLong(ZDOVars.s_creator, 0L) : 0)}; " + $"checkedCharacter={checkedCharacterId}; owner={((val2 != null) ? val2.GetOwner() : 0)}; " + $"role={InspectorDebug.Role}; noteLength={note?.Length ?? 0}; category={category}; reason={reason}."); } } private static string GetCreatorResolutionReason(ZRpc connection) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) ZNet instance = ZNet.instance; if (!Object.op_Implicit((Object)(object)instance) || !instance.IsServer()) { return "NotServer"; } if (connection == null) { return (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) ? "LocalPlayerUnavailable" : "LocalProfileIdUnavailable"; } ZNetPeer connectionPeer = GetConnectionPeer(instance, connection); if (connectionPeer == null || !connectionPeer.IsReady()) { return "SenderConnectionNotReady"; } ZDO val = ((ZDOMan.instance != null) ? ZDOMan.instance.GetZDO(connectionPeer.m_characterID) : null); if (val == null) { return "CharacterZdoNotReplicated"; } if (val.GetOwner() != connectionPeer.m_uid) { return "CharacterOwnerDoesNotMatchConnection"; } GameObject val2 = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab(val.GetPrefab()) : null); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.GetComponent<Player>())) { return "CharacterPrefabNotPlayer"; } return "CharacterProfileIdMissing"; } private static void SendFlagEditRequest(ZDO zdo, string note, int category) { //IL_006b: 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_0034: 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_012c: 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_00d3: Unknown result type (might be due to invalid IL or missing references) ZNet instance = ZNet.instance; if (zdo == null || !Object.op_Implicit((Object)(object)instance)) { if (InspectorDebug.Enabled) { TraceFlagEdit("send denied", zdo?.m_uid ?? ZDOID.None, null, 0L, note, category, (zdo == null) ? "FlagZdoUnavailable" : "NetworkUnavailable", 0L); } return; } if (InspectorDebug.Enabled) { TraceFlagEdit("sending request", zdo.m_uid, null, 0L, note, category, "ToServer", 0L); } if (instance.IsServer()) { QueueFlagEdit(null, zdo.m_uid, note, category); return; } ZNetPeer serverPeer = instance.GetServerPeer(); if (serverPeer != null) { if (note != null) { serverPeer.m_rpc.Invoke("BuildingInspector_SetFlagNote", new object[2] { zdo.m_uid, note }); } else { serverPeer.m_rpc.Invoke("BuildingInspector_ChangeFlagCategory", new object[2] { zdo.m_uid, category }); } } else if (InspectorDebug.Enabled) { TraceFlagEdit("send denied", zdo.m_uid, null, 0L, note, category, "ServerPeerUnavailable", 0L); } } private static long GetRequestCreatorId(ZRpc connection) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) ZNet instance = ZNet.instance; if (!Object.op_Implicit((Object)(object)instance) || !instance.IsServer()) { return 0L; } if (connection == null) { PlayerProfile val = (Object.op_Implicit((Object)(object)Game.instance) ? Game.instance.GetPlayerProfile() : null); return (Object.op_Implicit((Object)(object)Player.m_localPlayer) && val != null) ? val.GetPlayerID() : 0; } ZNetPeer connectionPeer = GetConnectionPeer(instance, connection); if (connectionPeer == null || !connectionPeer.IsReady()) { return 0L; } ZDO val2 = ((ZDOMan.instance != null) ? ZDOMan.instance.GetZDO(connectionPeer.m_characterID) : null); if (val2 != null) { GameObject val3 = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab(val2.GetPrefab()) : null); return (val2.GetOwner() == connectionPeer.m_uid && Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.GetComponent<Player>())) ? val2.GetLong(ZDOVars.s_playerID, 0L) : 0; } return connectionPeer.m_playerID; } private static ZNetPeer GetConnectionPeer(ZNet net, ZRpc connection) { foreach (ZNetPeer peer in net.GetPeers()) { if (peer.m_rpc == connection) { return peer; } } return null; } private static ZDO GetEditableFlagZdo(ZDOID target) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) ZDO val = ((ZDOMan.instance != null) ? ZDOMan.instance.GetZDO(target) : null); GameObject val2 = ((val != null && Object.op_Implicit((Object)(object)ZNetScene.instance)) ? ZNetScene.instance.GetPrefab(val.GetPrefab()) : null); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.GetComponent<FlagNoteReceiver>()) || flagVariants == null) { return null; } FlagVariant[] array = flagVariants; foreach (FlagVariant flagVariant in array) { if (((Object)val2).name == flagVariant.PrefabName) { return val; } } return (testFlagVariant != null && ((Object)val2).name == testFlagVariant.PrefabName) ? val : null; } private static void QueueFlagEdit(ZRpc connection, ZDOID target, string note, int category) { //IL_0008: 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_007d: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) long requestCreatorId = GetRequestCreatorId(connection); ZDO editableFlagZdo = GetEditableFlagZdo(target); ZNet instance = ZNet.instance; ZNetPeer val = ((Object.op_Implicit((Object)(object)instance) && connection != null) ? GetConnectionPeer(instance, connection) : null); bool flag = Object.op_Implicit((Object)(object)instance) && instance.IsServer() && ((connection == null) ? (requestCreatorId != 0) : (val != null && val.IsReady())); ZDO val2 = ((ZDOMan.instance != null) ? ZDOMan.instance.GetZDO(target) : null); if (InspectorDebug.Enabled) { TraceFlagEdit("request received", target, connection, requestCreatorId, note, category, "CheckingAuthorization", 0L); } if (!flag || (val2 != null && editableFlagZdo == null) || (editableFlagZdo != null && requestCreatorId != 0L && editableFlagZdo.GetLong(ZDOVars.s_creator, 0L) != requestCreatorId) || (note == null && (category < 0 || category >= 6)) || PendingFlagEdits.Count >= 128) { if (InspectorDebug.Enabled) { TraceFlagEdit("authorization denied", target, connection, requestCreatorId, note, category, (!flag) ? "ConnectionNotReadyOrNotServer" : ((val2 != null && editableFlagZdo == null) ? "UnsupportedFlagPrefab" : ((editableFlagZdo != null && requestCreatorId != 0L && editableFlagZdo.GetLong(ZDOVars.s_creator, 0L) != requestCreatorId) ? "CreatorMismatch" : ((note == null && (category < 0 || category >= 6)) ? "CategoryOutOfRange" : "PendingLimitReached"))), 0L); } log.LogWarning((object)"Rejected unauthorized inspection flag edit request."); return; } List<long> list = null; foreach (KeyValuePair<long, PendingFlagEdit> pendingFlagEdit2 in PendingFlagEdits) { if (requestCreatorId != 0L && pendingFlagEdit2.Value.CreatorId == requestCreatorId && ((ZDOID)(ref pendingFlagEdit2.Value.Target)).Equals(target) && pendingFlagEdit2.Value.Note != null == (note != null)) { if (list == null) { list = new List<long>(); } list.Add(pendingFlagEdit2.Key); } } if (list != null) { foreach (long item in list) { if (InspectorDebug.Enabled) { PendingFlagEdit pendingFlagEdit = PendingFlagEdits[item]; TraceFlagEdit("request superseded", pendingFlagEdit.Target, pendingFlagEdit.RequestConnection, pendingFlagEdit.CreatorId, pendingFlagEdit.Note, pendingFlagEdit.Category, "NewerEditOfSameField", item); } PendingFlagEdits.Remove(item); } } long num = ++nextFlagEditId; PendingFlagEdits.Add(num, new PendingFlagEdit { RequestConnection = connection, Target = target, CreatorId = requestCreatorId, Note = ((note == null) ? null : LimitNoteLength(note)), Category = category }); if (InspectorDebug.Enabled) { TraceFlagEdit("request queued", target, connection, requestCreatorId, note, category, (requestCreatorId == 0L) ? GetCreatorResolutionReason(connection) : ((editableFlagZdo == null) ? "WaitingForFlagZdo" : "Authorized"), num); } DispatchFlagEdit(num); } private static void DispatchFlagEdit(long editId) { //IL_001d: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_02df: 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) if (!PendingFlagEdits.TryGetValue(editId, out var value)) { return; } ZDO editableFlagZdo = GetEditableFlagZdo(value.Target); long requestCreatorId = GetRequestCreatorId(value.RequestConnection); ZDO val = ((ZDOMan.instance != null) ? ZDOMan.instance.GetZDO(value.Target) : null); if (value.Attempts >= 2 || (val != null && editableFlagZdo == null) || (requestCreatorId != 0L && value.CreatorId != 0L && requestCreatorId != value.CreatorId) || (editableFlagZdo != null && requestCreatorId != 0L && editableFlagZdo.GetLong(ZDOVars.s_creator, 0L) != requestCreatorId)) { if (InspectorDebug.Enabled) { TraceFlagEdit("request ended without applying", value.Target, value.RequestConnection, requestCreatorId, value.Note, value.Category, (value.Attempts >= 2) ? "RetryBudgetExhausted" : ((val != null && editableFlagZdo == null) ? "UnsupportedFlagPrefab" : ((requestCreatorId != 0L && value.CreatorId != 0L && requestCreatorId != value.CreatorId) ? "SenderCharacterChanged" : "CreatorMismatch")), editId); } PendingFlagEdits.Remove(editId); log.LogWarning((object)"Inspection flag edit expired or authorization changed."); return; } value.Attempts++; value.RetryAt = Time.unscaledTime + 2f; if (requestCreatorId == 0L || editableFlagZdo == null) { if (InspectorDebug.Enabled) { TraceFlagEdit("waiting for replication", value.Target, value.RequestConnection, requestCreatorId, value.Note, value.Category, (requestCreatorId == 0L) ? GetCreatorResolutionReason(value.RequestConnection) : "FlagZdoUnavailable", editId); } return; } value.CreatorId = requestCreatorId; if (InspectorDebug.Enabled && value.Attempts > 1) { TraceFlagEdit("retrying request", value.Target, value.RequestConnection, requestCreatorId, value.Note, value.Category, (value.SentOwner != editableFlagZdo.GetOwner()) ? "OwnerChanged" : "OwnerReplyMissingOrApplyRejected", editId); InspectorDebug.Write($"Retry ownership: request={editId}; flag={value.Target}; previousOwner={value.SentOwner}; currentOwner={editableFlagZdo.GetOwner()}."); } value.SentOwner = editableFlagZdo.GetOwner(); if (value.SentOwner == ZNet.GetUID()) { if (ApplyAuthorizedFlagEdit(value.Target, value.CreatorId, value.Note, value.Category)) { PendingFlagEdits.Remove(editId); } return; } ZNetPeer peer = ZNet.instance.GetPeer(value.SentOwner); if (peer == null || !peer.IsReady()) { if (InspectorDebug.Enabled) { TraceFlagEdit("owner unavailable", value.Target, value.RequestConnection, requestCreatorId, value.Note, value.Category, "OwnerPeerNotReady", editId); } return; } ZPackage val2 = new ZPackage(); val2.Write(editId); val2.Write(value.Target); val2.Write(value.CreatorId); val2.Write(value.Note != null); if (value.Note != null) { val2.Write(value.Note); } else { val2.Write(value.Category); } if (InspectorDebug.Enabled) { TraceFlagEdit("forwarding approval", value.Target, value.RequestConnection, requestCreatorId, value.Note, value.Category, "ToCurrentOwner", editId); } peer.m_rpc.Invoke("BuildingInspector_ApplyAuthorizedFlagEdit", new object[1] { val2 }); } private static bool ApplyAuthorizedFlagEdit(ZDOID target, long creatorId, string note, int category) { //IL_0001: 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) //IL_00db: Unknown result type (might be due to invalid IL or missing references) ZDO editableFlagZdo = GetEditableFlagZdo(target); if (editableFlagZdo == null || !editableFlagZdo.IsOwner() || creatorId == 0L || editableFlagZdo.GetLong(ZDOVars.s_creator, 0L) != creatorId || (note == null && (category < 0 || category >= 6))) { if (InspectorDebug.Enabled) { TraceFlagEdit("apply denied", target, null, creatorId, note, category, (editableFlagZdo == null) ? "FlagZdoUnavailableOrUnsupported" : ((!editableFlagZdo.IsOwner()) ? "NotCurrentOwner" : ((creatorId == 0L) ? "CreatorIdMissing" : ((editableFlagZdo.GetLong(ZDOVars.s_creator, 0L) != creatorId) ? "CreatorMismatch" : "CategoryOutOfRange"))), 0L); } return false; } if (note != null) { editableFlagZdo.Set("BuildingInspector_FlagNote", LimitNoteLength(note)); } else { editableFlagZdo.Set("BuildingInspector_FlagCategory", category); } if (InspectorDebug.Enabled) { TraceFlagEdit("change applied", target, null, creatorId, note, category, "Applied", 0L); } return true; } private static void ReceiveAuthorizedFlagEdit(ZRpc connection, ZPackage package) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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) ZNet instance = ZNet.instance; ZNetPeer val = ((Object.op_Implicit((Object)(object)instance) && !instance.IsServer()) ? instance.GetServerPeer() : null); if (val == null || val.m_rpc != connection) { if (InspectorDebug.Enabled) { InspectorDebug.Write("Approval denied: role=" + InspectorDebug.Role + "; reason=NotServerConnection."); } log.LogWarning((object)"Rejected inspection flag approval not sent by the server connection."); return; } long num = package.ReadLong(); ZDOID target = package.ReadZDOID(); long num2 = package.ReadLong(); bool flag = package.ReadBool(); string note = (flag ? package.ReadString() : null); int category = (flag ? (-1) : package.ReadInt()); if (InspectorDebug.Enabled) { TraceFlagEdit("approval received", target, connection, num2, note, category, "ServerConnectionVerified", num); } bool flag2 = ApplyAuthorizedFlagEdit(target, num2, note, category); connection.Invoke("BuildingInspector_FlagEditResult", new object[2] { num, flag2 }); } private static void ReceiveFlagEditResult(ZRpc connection, long editId, bool applied) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) ZNet instance = ZNet.instance; if (!Object.op_Implicit((Object)(object)instance) || !instance.IsServer()) { return; } ZNetPeer connectionPeer = GetConnectionPeer(instance, connection); if (connectionPeer == null || !connectionPeer.IsReady() || !PendingFlagEdits.TryGetValue(editId, out var value) || connectionPeer.m_uid != value.SentOwner) { if (InspectorDebug.Enabled) { InspectorDebug.Write($"Edit result ignored: request={editId}; role={InspectorDebug.Role}; reason=UnknownRequestOrUnexpectedConnection."); } return; } ZDO editableFlagZdo = GetEditableFlagZdo(value.Target); if (InspectorDebug.Enabled) { TraceFlagEdit("owner result received", value.Target, connection, value.CreatorId, value.Note, value.Category, (!applied) ? "OwnerRejectedApply" : ((editableFlagZdo == null) ? "FlagZdoUnavailable" : ((editableFlagZdo.GetOwner() != value.SentOwner) ? "OwnerChanged" : "AppliedAndConfirmed")), editId); } if (applied && editableFlagZdo != null && editableFlagZdo.GetOwner() == value.SentOwner) { PendingFlagEdits.Remove(editId); } else { DispatchFlagEdit(editId); } } private static bool ShouldShowInspectedBy() { ZoneSystem instance = ZoneSystem.instance; if (Object.op_Implicit((Object)(object)instance) && instance.GetGlobalKey("BuildingInspector_MultiplayerWorld")) { return true; } ZNet instance2 = ZNet.instance; if (!Object.op_Implicit((Object)(object)instance2)) { return false; } if (instance2.IsServer() && ZNet.IsOpenServer()) { MarkMultiplayerWorldIfNeeded(instance2); return true; } return !instance2.IsServer() && instance2.GetServerPeer() != null && Object.op_Implicit((Object)(object)instance) && instance.GetGlobalKey("BuildingInspector_MultiplayerWorld"); } private static void MarkMultiplayerWorldIfNeeded(ZNet net) { ZoneSystem instance = ZoneSystem.instance; if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)net) && net.IsServer() && ZNet.IsOpenServer() && !instance.GetGlobalKey("BuildingInspector_MultiplayerWorld")) { instance.SetGlobalKey("BuildingInspector_MultiplayerWorld"); } } private static void AlignFlagToSurface(Player player) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: 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_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) object? value = AccessTools.Field(typeof(Player), "m_placementGhost").GetValue(player); GameObject val = (GameObject)((value is GameObject) ? value : null); if (!Object.op_Implicit((Object)(object)val) || !((Object)val).name.StartsWith("InspectionFlag", StringComparison.Ordinal)) { lastTiltedGhost = null; return; } Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { return; } Ray val2 = main.ScreenPointToRay(new Vector3((float)Screen.width * 0.5f, (float)Screen.height * 0.5f)); FieldInfo fieldInfo = AccessTools.Field(typeof(Player), "m_placeRayMask"); int num = ((fieldInfo != null) ? ((int)fieldInfo.GetValue(player)) : (-5)); RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val2, ref val3, 50f, num, (QueryTriggerInteraction)1) || Vector3.Distance(((RaycastHit)(ref val3)).point, val.transform.position) > 1.75f) { return; } if ((Object)(object)val != (Object)(object)lastTiltedGhost) { tiltX = 0f; tiltZ = 0f; surfaceWheelRotation = 0f; } float axis = Input.GetAxis("Mouse ScrollWheel"); if (Mathf.Abs(axis) > 0.001f) { surfaceWheelRotation += Mathf.Sign(axis) * 22.5f; } Vector3 val4 = Vector3.ProjectOnPlane(((Component)main).transform.position - ((RaycastHit)(ref val3)).point, ((RaycastHit)(ref val3)).normal); if (((Vector3)(ref val4)).sqrMagnitude < 0.001f) { val4 = Vector3.ProjectOnPlane(-((Ray)(ref val2)).direction, ((RaycastHit)(ref val3)).normal); } if (((Vector3)(ref val4)).sqrMagnitude > 0.001f) { Quaternion val5 = Quaternion.LookRotation(((Vector3)(ref val4)).normalized, ((RaycastHit)(ref val3)).normal); val5 = Quaternion.AngleAxis(surfaceWheelRotation, ((RaycastHit)(ref val3)).normal) * val5; KeyboardShortcut value2 = tiltForwardKey.Value; if (((KeyboardShortcut)(ref value2)).IsDown()) { tiltX = Mathf.Clamp(tiltX + tiltStepDegrees.Value, 0f - maxTiltDegrees.Value, maxTiltDegrees.Value); } value2 = tiltBackwardKey.Value; if (((KeyboardShortcut)(ref value2)).IsDown()) { tiltX = Mathf.Clamp(tiltX - tiltStepDegrees.Value, 0f - maxTiltDegrees.Value, maxTiltDegrees.Value); } value2 = tiltLeftKey.Value; if (((KeyboardShortcut)(ref value2)).IsDown()) { tiltZ = Mathf.Clamp(tiltZ - tiltStepDegrees.Value, 0f - maxTiltDegrees.Value, maxTiltDegrees.Value); } value2 = tiltRightKey.Value; if (((KeyboardShortcut)(ref value2)).IsDown()) { tiltZ = Mathf.Clamp(tiltZ + tiltStepDegrees.Value, 0f - maxTiltDegrees.Value, maxTiltDegrees.Value); } value2 = resetTiltKey.Value; if (((KeyboardShortcut)(ref value2)).IsDown()) { tiltX = 0f; tiltZ = 0f; } val.transform.rotation = val5 * Quaternion.Euler(tiltX, 0f, tiltZ); val.transform.position = ((RaycastHit)(ref val3)).point; lastTiltedGhost = val; } } private static string LimitNoteLength(string text) { if (string.IsNullOrEmpty(text)) { return string.Empty; } int num = 0; StringBuilder stringBuilder = new StringBuilder(text.Length); foreach (char c in text) { if (c == '\r' || c == '\n') { stringBuilder.Append(c); } else if (num < 160) { num++; stringBuilder.Append(c); } } return stringBuilder.ToString(); } private bool WouldExceedNoteLimits(string text) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_008c: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (char c in text) { if (c != '\n' && c != '\r') { num++; } if (num > 160) { return true; } } Text textComponent = flagEditorNoteField.textComponent; if (!Object.op_Implicit((Object)(object)textComponent)) { return false; } TextGenerator val = new TextGenerator(); Rect rect = ((Graphic)textComponent).rectTransform.rect; TextGenerationSettings generationSettings = textComponent.GetGenerationSettings(((Rect)(ref rect)).size); generationSettings.generateOutOfBounds = true; generationSettings.updateBounds = true; generationSettings.horizontalOverflow = (HorizontalWrapMode)0; generationSettings.verticalOverflow = (VerticalWrapMode)1; val.Populate(text, generationSettings); int lineCount = val.lineCount; return lineCount > 5; } private char ValidateNoteInput(string text, int charIndex, char addedChar) { string text2 = text.Insert(charIndex, addedChar.ToString()); if (WouldExceedNoteLimits(text2)) { return '\0'; } return addedChar; } private static string DecodeSimpleNoteInput(string text) { return (text ?? string.Empty).Replace("\\n", "\n").Replace("\\t", "\t"); } private static bool WouldExceedSimpleNoteLimits(string text) { if (LimitNoteLength(text).Length != text.Length || !Object.op_Implicit((Object)(object)simpleNoteMeasure)) { return true; } return simpleNoteMeasure.GetTextInfo(text).lineCount > 5; } private static char ValidateSimpleNoteInput(string text, int charIndex, char addedChar) { if (previousSimpleValidation != null) { addedChar = previousSimpleValidation.Invoke(text, charIndex, addedChar); } if (addedChar == '\0') { return '\0'; } string text2 = text.Insert(charIndex, addedChar.ToString()); return (!WouldExceedSimpleNoteLimits(DecodeSimpleNoteInput(text2))) ? addedChar : '\0'; } private void Update() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) if (flagEditorOpen) { if (!Object.op_Implicit((Object)(object)flagEditorTarget) || !flagEditorTarget.CanEditCategory() || Input.GetKeyDown((KeyCode)27) || (!usingNewFlagEditorUi && (!Object.op_Implicit((Object)(object)simpleNoteMenu) || !Object.op_Implicit((Object)(object)simpleNoteMenu.m_panel) || !simpleNoteMenu.m_panel.activeSelf))) { CloseFlagEditor(); } return; } if (flagEditorInputUnblockPending) { if (Time.frameCount <= flagEditorUnblockFrame || Input.GetMouseButton(0) || Input.GetMouseButton(1)) { return; } GUIManager.BlockInput(false); flagEditorInputBlocked = false; flagEditorInputUnblockPending = false; } KeyboardShortcut value = editNoteKey.Value; if (!((KeyboardShortcut)(ref value)).IsDown()) { return; } if (InspectorDebug.Enabled) { InspectorDebug.Write("Editor open requested: role=" + InspectorDebug.Role + "."); } if (TextInput.IsVisible() || InventoryGui.IsVisible() || Menu.IsVisible() || Console.IsVisible() || StoreGui.IsVisible() || Minimap.IsOpen()) { if (InspectorDebug.Enabled) { InspectorDebug.Write("Editor open denied: reason=" + GetEditorUiBlockReason() + "."); } return; } Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { if (InspectorDebug.Enabled) { InspectorDebug.Write("Editor open denied: reason=CameraUnavailable."); } return; } Ray val = main.ScreenPointToRay(new Vector3((float)Screen.width * 0.5f, (float)Screen.height * 0.5f)); float num = (Object.op_Implicit((Object)(object)Player.m_localPlayer) ? Vector3.Distance(((Component)main).transform.position, ((Component)Player.m_localPlayer).transform.position) : 0f); float num2 = 6f + num; RaycastHit[] array = Physics.RaycastAll(val, num2, -5, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit first, RaycastHit second) => ((RaycastHit)(ref first)).distance.CompareTo(((RaycastHit)(ref second)).distance)); RaycastHit[] array2 = array; for (int num3 = 0; num3 < array2.Length; num3++) { RaycastHit val2 = array2[num3]; FlagNoteReceiver componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<FlagNoteReceiver>(); if (Object.op_Implicit((Object)(object)componentInParent)) { if (!componentInParent.CanEditCategory()) { if (InspectorDebug.Enabled) { LogEditorEvent(componentInParent, "denied", GetEditorDenialReason(componentInParent)); } } else { OpenFlagEditor(componentInParent); } return; } if (BlocksNoteRay(((RaycastHit)(ref val2)).collider)) { if (InspectorDebug.Enabled) { InspectorDebug.Write("Editor open denied: reason=RayBlockedByWorldCollider."); } return; } } if (InspectorDebug.Enabled) { InspectorDebug.Write("Editor open denied: reason=NoInspectionFlagInRay."); } } private void LateUpdate() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (flagEditorInputBlocked) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { localPlayer.SetControls(Vector3.zero, false, false, false, false, false, false, false, false, false, false, false); ((Character)localPlayer).SetMoveDir(Vector3.zero); ((Character)localPlayer).StopMovement(); } } } private void OpenFlagEditor(FlagNoteReceiver receiver) { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) if (flagEditorOpen || TextInput.IsVisible()) { return; } bool value = advancedFlagEditorUi.Value; if (Object.op_Implicit((Object)(object)receiver) && receiver.CanEditCategory()) { bool num; if (!value) { if (!Object.op_Implicit((Object)(object)TextInput.instance) || !Object.op_Implicit((Object)(object)TextInput.instance.m_inputField) || !Object.op_Implicit((Object)(object)TextInput.instance.m_panel)) { goto IL_0091; } num = !Object.op_Implicit((Object)(object)((TMP_InputField)TextInput.instance.m_inputField).textComponent); } else { num = !EnsureFlagEditorUi(); } if (!num) { flagEditorTarget = receiver; usingNewFlagEditorUi = value; originalNote = receiver.GetText(); originalCategory = receiver.GetEditorCategoryIndex(); draftCategory = originalCategory; if (value) { flagEditorNoteField.text = originalNote; UpdateFlagEditorCategorySelection(); flagEditorCanvas.SetActive(true); } flagEditorOpen = true; flagEditorInputBlocked = true; editorPreviousCursorLock = Cursor.lockState; editorPreviousCursorVisible = Cursor.visible; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; GUIManager.BlockInput(true); if (value) { EventSystem current = EventSystem.current; if (Object.op_Implicit((Object)(object)current)) { current.SetSelectedGameObject(((Component)flagEditorNoteField).gameObject); } flagEditorNoteField.ActivateInputField(); } else { OpenSimpleFlagEditor(); } if (InspectorDebug.Enabled) { InspectorDebug.Write("Editor UI opened: ui=" + (value ? "FlagEditor" : "SimpleNote") + "; role=" + InspectorDebug.Role + "."); LogEditorEvent(receiver, "opened", "Authorized"); } return; } } goto IL_0091; IL_0091: if (InspectorDebug.Enabled) { LogEditorEvent(receiver, "denied", (!Object.op_Implicit((Object)(object)receiver)) ? "TargetUnavailable" : ((!receiver.CanEditCategory()) ? GetEditorDenialReason(receiver) : "EditorUiUnavailable")); } } private void OpenSimpleFlagEditor() { //IL_0025: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown simpleNoteMenu = TextInput.instance; simpleNoteClosing = false; simpleNoteField = simpleNoteMenu.m_inputField; previousSimpleLineType = ((TMP_InputField)simpleNoteField).lineType; previousSimpleLineLimit = ((TMP_InputField)simpleNoteField).lineLimit; previousSimpleCharacterLimit = ((TMP_InputField)simpleNoteField).characterLimit; previousSimpleValidation = ((TMP_InputField)simpleNoteField).onValidateInput; previousSimpleWrapping = ((TMP_InputField)simpleNoteField).textComponent.textWrappingMode; previousSimpleOverflow = ((TMP_InputField)simpleNoteField).textComponent.overflowMode; ((TMP_InputField)simpleNoteField).lineType = (LineType)1; ((TMP_InputField)simpleNoteField).lineLimit = 0; ((TMP_InputField)simpleNoteField).textComponent.textWrappingMode = (TextWrappingModes)1; ((TMP_InputField)simpleNoteField).textComponent.overflowMode = (TextOverflowModes)0; simpleNoteMenu.RequestText((TextReceiver)(object)new SimpleFlagNoteAdapter(), "Inspection flag note", 0); simpleNoteMeasure = Object.Instantiate<TMP_Text>(((TMP_InputField)simpleNoteField).textComponent, ((TMP_InputField)simpleNoteField).textComponent.transform.parent); ((Object)((Component)simpleNoteMeasure).gameObject).name = "BuildingInspectorNoteMeasure"; ((Component)simpleNoteMeasure).gameObject.SetActive(false); GuiInputField obj = simpleNoteField; object obj2 = <>O.<0>__ValidateSimpleNoteInput; if (obj2 == null) { OnValidateInput val = ValidateSimpleNoteInput; <>O.<0>__ValidateSimpleNoteInput = val; obj2 = (object)val; } ((TMP_InputField)obj).onValidateInput = (OnValidateInput)obj2; } private static bool CanSubmitSimpleFlagNote(TextInput menu) { if (!flagEditorOpen || usingNewFlagEditorUi || (Object)(object)menu != (Object)(object)simpleNoteMenu) { return true; } if (simpleNoteClosing || !Object.op_Implicit((Object)(object)simpleNoteField) || ((TMP_InputField)simpleNoteField).wasCanceled || Input.GetKeyDown((KeyCode)27)) { return false; } if (!Object.op_Implicit((Object)(object)flagEditorTarget) || !flagEditorTarget.CanEditCategory()) { CloseFlagEditor(); return false; } if (WouldExceedSimpleNoteLimits(DecodeSimpleNoteInput(((TMP_InputField)simpleNoteField).text))) { simpleNoteField.ActivateInputField(); return false; } return true; } private static void RestoreSimpleFlagEditor() { //IL_0028: Unknown result type (might be due to inv