Decompiled source of MovingDay v1.0.1
AskaMovingDay.dll
Decompiled 18 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Fusion; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Microsoft.CodeAnalysis; using SSSGame; using SSSGame.Controllers; using SSSGame.InputContext; using SSSGame.Network; using SSSGame.Render; using SSSGame.UI; using SandSailorStudio.Localization; using SandSailorStudio.UI; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("AskaMovingDay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: AssemblyInformationalVersion("1.0.1+be397203888b23b18914a97a2fda0759900b5994")] [assembly: AssemblyProduct("Aska Moving Day")] [assembly: AssemblyTitle("AskaMovingDay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AskaMovingDay { internal static class AnnexOverlay { private enum ClearSample { Resolved, Rejected, Unavailable } private sealed class Clone { internal GameObject Object; internal Renderer Renderer; internal Il2CppReferenceArray<Material> Natural; internal Il2CppReferenceArray<Material> Blocked; } private sealed class Box { internal GameObject Object; internal Renderer Renderer; internal List<Clone> Clones; } private const string Prefix = "[MovingDay][overlay]"; private const string BoxNamePrefix = "MovingDayAnnexGhost:"; private const string CloneNamePrefix = "MovingDayAnnexGhost:mesh:"; private const string InvalidMaterialMarker = "InvalidPlacement"; private static readonly Color ClearTint = new Color(0.15f, 0.85f, 0.25f, 1f); private static readonly Color BlockedTint = new Color(1f, 0.2f, 0.15f, 0.42f); private static readonly string[] ColourProperties = new string[5] { "_BaseColor", "_Color", "_TintColor", "_UnlitColor", "_MainColor" }; private static readonly List<Box> Boxes = new List<Box>(); private static Material _clearMaterial; private static Material _blockedMaterial; private static Transform _parent; private static Transform _structureRoot; private static GameObject _preview; private static bool _clearPending; private static int _lastClearAttemptFrame = -1; private static string _clearOrigin = "<unresolved>"; private static string _blockedOrigin = "<unresolved>"; private static int _previewLayer = -1; private static int _materialSourceLayer = -1; private static string _materialSourceObject = "<none>"; private static bool _failureLogged; private static bool _sampleFailureLogged; private static bool _lodFailOpenLogged; private static bool _fallbackLogged; internal static bool IsReady { get; private set; } internal static bool Begin(GameObject preview) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown Reset(); try { if ((Object)(object)preview == (Object)null) { return false; } Transform transform = preview.transform; if ((Object)(object)transform == (Object)null) { return false; } _previewLayer = ReadLayer(preview); _structureRoot = ResolveStructureRoot(); if (!TryResolveMaterials(preview)) { return false; } _parent = transform; IsReady = true; return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(118, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" the annex overlay could not be started ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") - no annex boxes are drawn on this move, and the move itself is unaffected."); } log.LogWarning(val); Reset(); return false; } } internal static void Add(string name, GameObject annexRoot, Vector3 localPosition, Quaternion localRotation, Vector3 localScale) { //IL_008a: 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_008c: Unknown result type (might be due to invalid IL or missing references) Box box = new Box(); Boxes.Add(box); if (!IsReady) { return; } try { if (BuildClones(box, name, annexRoot) > 0) { ApplyCloneMaterials(box, blocked: false); return; } } catch (Exception ex) { ReportFailure($"cloning the geometry of annex '{name}' threw ({ex.Message}); it falls back to a plain box"); DestroyClones(box); } AddCube(box, name, localPosition, localRotation, localScale); } private static void AddCube(Box box, string name, Vector3 localPosition, Quaternion localRotation, Vector3 localScale) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; try { val = GameObject.CreatePrimitive((PrimitiveType)3); if ((Object)(object)val == (Object)null) { ReportFailure("a primitive cube could not be created"); return; } if (!StripColliders(val)) { Object.DestroyImmediate((Object)(object)val); return; } ((Object)val).name = "MovingDayAnnexGhost:" + (name ?? "<unnamed>"); ApplyLayer(val); Transform transform = val.transform; transform.SetParent(_parent, false); transform.localPosition = localPosition; transform.localRotation = localRotation; transform.localScale = localScale; Renderer component = (Renderer)(object)val.GetComponent<MeshRenderer>(); if ((Object)(object)component == (Object)null) { ReportFailure("the cube for annex '" + name + "' has no MeshRenderer"); Object.DestroyImmediate((Object)(object)val); return; } ApplyMaterial(component, blocked: false); component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; component.lightProbeUsage = (LightProbeUsage)0; component.reflectionProbeUsage = (ReflectionProbeUsage)0; box.Object = val; box.Renderer = component; } catch (Exception ex) { ReportFailure($"building the box for annex '{name}' threw ({ex.Message})"); try { if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)val); } } catch { } box.Object = null; box.Renderer = null; } } private static int BuildClones(Box box, string name, GameObject annexRoot) { if ((Object)(object)annexRoot == (Object)null) { NoteNoGeometry(name, "the annex has no live GameObject to read geometry from"); return 0; } if ((Object)(object)_structureRoot == (Object)null) { NoteNoGeometry(name, "the moving structure's root transform could not be resolved, so no clone could be posed"); return 0; } Il2CppArrayBase<MeshRenderer> componentsInChildren = annexRoot.GetComponentsInChildren<MeshRenderer>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { NoteNoGeometry(name, "it has no MeshRenderer anywhere under it"); return 0; } HashSet<IntPtr> hashSet = BuildLodRejectSet(annexRoot, name); int length = componentsInChildren.Length; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; for (int i = 0; i < length; i++) { try { MeshRenderer val = componentsInChildren[i]; if ((Object)(object)val == (Object)null) { num8++; continue; } if (!((Renderer)val).enabled) { num2++; continue; } GameObject gameObject = ((Component)val).gameObject; if ((Object)(object)gameObject == (Object)null || !gameObject.activeInHierarchy) { num3++; continue; } if (hashSet.Contains(((Il2CppObjectBase)val).Pointer)) { num4++; continue; } MeshFilter component = gameObject.GetComponent<MeshFilter>(); if ((Object)(object)component == (Object)null) { num5++; continue; } Mesh sharedMesh = component.sharedMesh; if ((Object)(object)sharedMesh == (Object)null) { num6++; continue; } Il2CppReferenceArray<Material> sharedMaterials = ((Renderer)val).sharedMaterials; if (sharedMaterials == null || ((Il2CppArrayBase<Material>)(object)sharedMaterials).Length == 0) { num7++; continue; } Clone clone = BuildClone(name, val, gameObject, sharedMesh, sharedMaterials); if (clone != null) { if (box.Clones == null) { box.Clones = new List<Clone>(length); } box.Clones.Add(clone); num++; } } catch (Exception ex) { num8++; ReportFailure($"cloning one renderer of annex '{name}' threw ({ex.Message}); that part is not drawn"); } } if (num == 0) { NoteNoGeometry(name, $"all {length} of its MeshRenderer(s) were refused - {num2} disabled, {num3} inactive, {num4} on a non-zero LOD level, {num5} with no MeshFilter, {num6} with a null sharedMesh, {num7} with no materials, {num8} unreadable"); } return num; } private static Clone BuildClone(string annexName, MeshRenderer source, GameObject owner, Mesh mesh, Il2CppReferenceArray<Material> natural) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; try { Transform transform = ((Component)source).transform; if ((Object)(object)transform == (Object)null) { return null; } val = new GameObject("MovingDayAnnexGhost:mesh:" + (annexName ?? "<unnamed>") + ":" + SafeName((Object)(object)owner)); if ((Object)(object)val == (Object)null) { return null; } MeshFilter val2 = AddComponent<MeshFilter>(val); if ((Object)(object)val2 == (Object)null) { ReportFailure("a MeshFilter could not be added to a geometry clone of annex '" + annexName + "'"); Object.DestroyImmediate((Object)(object)val); return null; } MeshRenderer val3 = AddComponent<MeshRenderer>(val); if ((Object)(object)val3 == (Object)null) { ReportFailure("a MeshRenderer could not be added to a geometry clone of annex '" + annexName + "'"); Object.DestroyImmediate((Object)(object)val); return null; } val2.sharedMesh = mesh; ApplyLayer(val); Transform transform2 = val.transform; transform2.SetParent(_parent, false); Matrix4x4 val4 = _structureRoot.worldToLocalMatrix * transform.localToWorldMatrix; Vector4 column = ((Matrix4x4)(ref val4)).GetColumn(3); transform2.localPosition = new Vector3(column.x, column.y, column.z); transform2.localRotation = ((Matrix4x4)(ref val4)).rotation; transform2.localScale = ((Matrix4x4)(ref val4)).lossyScale; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; ((Renderer)val3).lightProbeUsage = (LightProbeUsage)0; ((Renderer)val3).reflectionProbeUsage = (ReflectionProbeUsage)0; return new Clone { Object = val, Renderer = (Renderer)(object)val3, Natural = natural, Blocked = BuildBlockedMaterials(((Il2CppArrayBase<Material>)(object)natural).Length) }; } catch (Exception ex) { ReportFailure($"building a geometry clone for annex '{annexName}' threw ({ex.Message}); that part is not drawn"); try { if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)val); } } catch { } return null; } } private static Il2CppReferenceArray<Material> BuildBlockedMaterials(int slots) { Material blockedMaterial = _blockedMaterial; if ((Object)(object)blockedMaterial == (Object)null || slots <= 0) { return null; } Il2CppReferenceArray<Material> val = new Il2CppReferenceArray<Material>((long)slots); for (int i = 0; i < slots; i++) { ((Il2CppArrayBase<Material>)(object)val)[i] = blockedMaterial; } return val; } private static HashSet<IntPtr> BuildLodRejectSet(GameObject annexRoot, string annexName) { HashSet<IntPtr> hashSet = new HashSet<IntPtr>(); try { Il2CppArrayBase<LODGroup> componentsInChildren = annexRoot.GetComponentsInChildren<LODGroup>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return hashSet; } for (int i = 0; i < componentsInChildren.Length; i++) { try { LODGroup val = componentsInChildren[i]; if ((Object)(object)val == (Object)null) { continue; } Il2CppReferenceArray<LOD> lODs = val.GetLODs(); if (lODs == null || ((Il2CppArrayBase<LOD>)(object)lODs).Length == 0) { NoteLodFailOpen(annexName, "LODGroup.GetLODs() described no levels"); continue; } for (int j = 1; j < ((Il2CppArrayBase<LOD>)(object)lODs).Length; j++) { LOD val2 = ((Il2CppArrayBase<LOD>)(object)lODs)[j]; if (val2 == null) { continue; } Il2CppReferenceArray<Renderer> renderers = val2.renderers; if (renderers == null) { continue; } for (int k = 0; k < ((Il2CppArrayBase<Renderer>)(object)renderers).Length; k++) { Renderer val3 = ((Il2CppArrayBase<Renderer>)(object)renderers)[k]; if ((Object)(object)val3 != (Object)null) { hashSet.Add(((Il2CppObjectBase)val3).Pointer); } } } } catch (Exception ex) { NoteLodFailOpen(annexName, "reading one LODGroup threw (" + ex.Message + ")"); } } return hashSet; } catch (Exception ex2) { NoteLodFailOpen(annexName, "walking the LODGroups threw (" + ex2.Message + ")"); return new HashSet<IntPtr>(); } } private static T AddComponent<T>(GameObject host) where T : Object { try { Component val = host.AddComponent(Il2CppType.Of<T>()); return ((Object)(object)val == (Object)null) ? default(T) : ((Il2CppObjectBase)val).TryCast<T>(); } catch (Exception ex) { ReportFailure($"adding a {typeof(T).Name} to a geometry clone threw ({ex.Message})"); return default(T); } } private static void ApplyCloneMaterials(Box box, bool blocked) { List<Clone> clones = box.Clones; if (clones == null) { return; } for (int i = 0; i < clones.Count; i++) { Clone clone = clones[i]; if (clone == null) { continue; } Renderer renderer = clone.Renderer; if ((Object)(object)renderer == (Object)null) { continue; } Il2CppReferenceArray<Material> val = (blocked ? clone.Blocked : clone.Natural); if (val == null || ((Il2CppArrayBase<Material>)(object)val).Length == 0) { if (renderer.enabled) { renderer.enabled = false; } continue; } Material val2 = ((Il2CppArrayBase<Material>)(object)val)[0]; Material sharedMaterial = renderer.sharedMaterial; bool num; if (!((Object)(object)sharedMaterial == (Object)null)) { if (!((Object)(object)val2 != (Object)null)) { goto IL_00ac; } num = ((Il2CppObjectBase)sharedMaterial).Pointer == ((Il2CppObjectBase)val2).Pointer; } else { num = (Object)(object)val2 == (Object)null; } if (!num) { goto IL_00ac; } goto IL_00b4; IL_00ac: renderer.sharedMaterials = val; goto IL_00b4; IL_00b4: if (!renderer.enabled) { renderer.enabled = true; } } } private static void DestroyClones(Box box) { List<Clone> clones = box.Clones; box.Clones = null; if (clones == null) { return; } for (int i = 0; i < clones.Count; i++) { Clone clone = clones[i]; if (clone != null) { GameObject obj = clone.Object; clone.Object = null; clone.Renderer = null; clone.Natural = null; clone.Blocked = null; DestroyOverlayObject(obj, "an annex geometry clone"); } } } private static Transform ResolveStructureRoot() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown try { MoveSession activeSession = MovingDayTool.ActiveSession; if (activeSession == null) { return null; } Structure target = activeSession.Target; if ((Object)(object)target == (Object)null) { return null; } return ((Component)target).transform; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(112, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" the moving structure's root transform could not be read ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") - the annexes fall back to plain boxes on this move."); } log.LogWarning(val); return null; } } private static void NoteNoGeometry(string annexName, string reason) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (!_fallbackLogged) { _fallbackLogged = true; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(195, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" annex '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(annexName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' yielded no drawable geometry ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), so it falls back to a plain box. A degraded box is better than an invisible annex. Validation and the move itself are unaffected (logged once per move)."); } log.LogInfo(val); } } private static void NoteLodFailOpen(string annexName, string reason) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (!_lodFailOpenLogged) { _lodFailOpenLogged = true; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(233, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" the LOD filter could not read the LODGroups of annex '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(annexName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") - it FAILS OPEN, so every renderer under that group is drawn and the annex may be drawn with its lower LOD levels stacked on top of it. Cosmetic only (logged once per move)."); } log.LogInfo(val); } } internal static void SetBlocked(int index, bool blocked) { if (index < 0 || index >= Boxes.Count) { return; } if (_clearPending) { RetryClearMaterial(); } Box box = Boxes[index]; if (box == null) { return; } try { if (box.Clones != null && box.Clones.Count > 0) { ApplyCloneMaterials(box, blocked); return; } Renderer renderer = box.Renderer; if (!((Object)(object)renderer == (Object)null)) { ApplyMaterial(renderer, blocked); } } catch (Exception ex) { ReportFailure("recolouring an annex box threw (" + ex.Message + ")"); } } private static void ApplyMaterial(Renderer renderer, bool blocked) { Material val = (blocked ? _blockedMaterial : _clearMaterial); if ((Object)(object)val == (Object)null) { if (renderer.enabled) { renderer.enabled = false; } return; } Material sharedMaterial = renderer.sharedMaterial; if ((Object)(object)sharedMaterial == (Object)null || ((Il2CppObjectBase)sharedMaterial).Pointer != ((Il2CppObjectBase)val).Pointer) { renderer.sharedMaterial = val; } if (!renderer.enabled) { renderer.enabled = true; } } private static void RetryClearMaterial() { try { int frameCount = Time.frameCount; if (frameCount != _lastClearAttemptFrame) { _lastClearAttemptFrame = frameCount; if (TryResolveClearMaterial() == ClearSample.Resolved) { _clearPending = false; } } } catch { } } internal static void Reset() { for (int i = 0; i < Boxes.Count; i++) { Box box = Boxes[i]; if (box != null) { DestroyClones(box); GameObject obj = box.Object; box.Object = null; box.Renderer = null; DestroyOverlayObject(obj, "an annex box"); } } Boxes.Clear(); DestroyMaterial(ref _clearMaterial); DestroyMaterial(ref _blockedMaterial); _parent = null; _preview = null; _structureRoot = null; _clearPending = false; _lastClearAttemptFrame = -1; _clearOrigin = "<unresolved>"; _blockedOrigin = "<unresolved>"; _previewLayer = -1; _materialSourceLayer = -1; _materialSourceObject = "<none>"; IsReady = false; _failureLogged = false; _sampleFailureLogged = false; _lodFailOpenLogged = false; _fallbackLogged = false; } private static bool TryResolveMaterials(GameObject preview) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) _preview = preview; Material ghostValidationMaterial = GhostSession.GhostValidationMaterial; if ((Object)(object)ghostValidationMaterial != (Object)null) { string value = DescribeSource(ghostValidationMaterial); _blockedMaterial = new Material(ghostValidationMaterial); if ((Object)(object)_blockedMaterial == (Object)null) { _blockedOrigin = "<none> - copying the game's validation material produced nothing. Blocked annexes draw no box."; } else { _blockedOrigin = $"a copy of the game's OWN ValidationPlacementTool.validationMaterial '{SafeName((Object)(object)ghostValidationMaterial)}' (shader '{SafeShaderName(ghostValidationMaterial)}'), used UNTINTED - it is the game's invalid-placement material and already carries its own colour.{value}"; } } else { _blockedOrigin = "<none> - ValidationPlacementTool.validationMaterial was not reachable. Blocked annexes draw no box."; } ClearSample clearSample = TryResolveClearMaterial(); _clearPending = clearSample != ClearSample.Resolved; switch (clearSample) { case ClearSample.Rejected: _clearOrigin = "DEFERRED - the ghost is showing the game's invalid-placement material right now, and sampling it would make every legal annex red. Retried on later frames. Until then a clear annex draws no box."; break; case ClearSample.Unavailable: _clearOrigin = "not resolved - the preview offered no material to sample. Retried on later frames, and until then a clear annex draws no box."; break; } if ((Object)(object)_blockedMaterial != (Object)null || (Object)(object)_clearMaterial != (Object)null || clearSample == ClearSample.Rejected) { LogSources(); return true; } string found; Shader val = FindFallbackShader(out found); bool flag = default(bool); if ((Object)(object)val == (Object)null) { ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(228, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" no material could be built for the annex boxes (the preview's own renderers, the game's validation material and every fallback shader were all unreachable) - NO annex boxes are drawn on this move. The move itself is unaffected."); } log.LogWarning(val2); return false; } _clearMaterial = new Material(val); _blockedMaterial = new Material(val); if ((Object)(object)_clearMaterial == (Object)null || (Object)(object)_blockedMaterial == (Object)null) { DestroyMaterial(ref _clearMaterial); DestroyMaterial(ref _blockedMaterial); ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(117, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" a material could not be built from shader '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(found); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' - NO annex boxes are drawn on this move. The move itself is unaffected."); } log2.LogWarning(val2); return false; } string value2 = DescribeSource(_clearMaterial); string value3 = Prepare(_clearMaterial, ClearTint); string text = Prepare(_blockedMaterial, BlockedTint); _clearPending = false; _clearOrigin = $"a fallback shader found by name, '{found}', TINTED green (neither the game's validation material nor the preview's own renderers were reachable). {value3}{value2}"; _blockedOrigin = "a fallback shader found by name, '" + found + "', TINTED red (same source as the clear material). " + text; LogSources(); return true; } private static ClearSample TryResolveClearMaterial() { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown try { GameObject preview = _preview; if ((Object)(object)preview == (Object)null) { return ClearSample.Unavailable; } Material val = TakePreviewMaterial(preview); if ((Object)(object)val == (Object)null) { return ClearSample.Unavailable; } if (IsInvalidPlacementMaterial(val)) { return ClearSample.Rejected; } Material val2 = new Material(val); if ((Object)(object)val2 == (Object)null) { return ClearSample.Unavailable; } _clearMaterial = val2; _clearOrigin = $"a copy of the ghost preview's OWN natural material '{SafeName((Object)(object)val)}' (shader '{SafeShaderName(val)}', from '{_materialSourceObject}'), used UNTINTED so a clear annex reads in the structure's own natural colour, as the game's own main ghost does.{DescribeSource(val)}"; return ClearSample.Resolved; } catch (Exception ex) { if (!_sampleFailureLogged) { _sampleFailureLogged = true; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(153, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" resolving the annex overlay's clear material threw ("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(") - clear annexes draw no box (logged once per move). Validation and the move itself are unaffected."); } log.LogWarning(val3); } return ClearSample.Unavailable; } } private static bool IsInvalidPlacementMaterial(Material sampled) { try { if ((Object)(object)sampled == (Object)null) { return false; } string text = SafeName((Object)(object)sampled); if (!string.IsNullOrEmpty(text) && text.IndexOf("InvalidPlacement", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } Material ghostValidationMaterial = GhostSession.GhostValidationMaterial; if ((Object)(object)ghostValidationMaterial != (Object)null && ((Il2CppObjectBase)sampled).Pointer == ((Il2CppObjectBase)ghostValidationMaterial).Pointer) { return true; } return false; } catch { return true; } } private static void LogSources() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" annex box CLEAR material: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(_clearOrigin); } log.LogInfo(val); ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(29, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" annex box BLOCKED material: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(_blockedOrigin); } log2.LogInfo(val); ManualLogSource log3 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(82, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" annex box layers: preview root layer="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LayerText(_previewLayer)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", material source renderer layer="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LayerText(_materialSourceLayer)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (from '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(_materialSourceObject); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("')."); } log3.LogInfo(val); } private static string DescribeSource(Material material) { return string.Empty; } private static Material TakePreviewMaterial(GameObject preview) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown _materialSourceLayer = -1; _materialSourceObject = "<none>"; try { if ((Object)(object)preview == (Object)null) { return null; } Il2CppArrayBase<Renderer> componentsInChildren = preview.GetComponentsInChildren<Renderer>(true); if (componentsInChildren == null) { return null; } for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val = componentsInChildren[i]; if ((Object)(object)val == (Object)null || !val.enabled) { continue; } GameObject gameObject = ((Component)val).gameObject; if ((Object)(object)gameObject == (Object)null || !gameObject.activeInHierarchy) { continue; } string text = SafeName((Object)(object)gameObject); if (string.IsNullOrEmpty(text) || !text.StartsWith("MovingDayAnnexGhost:", StringComparison.Ordinal)) { Material sharedMaterial = val.sharedMaterial; if (!((Object)(object)sharedMaterial == (Object)null)) { _materialSourceLayer = gameObject.layer; _materialSourceObject = text; return sharedMaterial; } } } } catch (Exception ex) { if (!_sampleFailureLogged) { _sampleFailureLogged = true; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(118, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" reading a material off the ghost preview's own renderers threw ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") - clear annexes draw no box (logged once per move)."); } log.LogWarning(val2); } } return null; } private static Shader FindFallbackShader(out string found) { string[] array = new string[5] { "Sprites/Default", "Hidden/Internal-Colored", "Legacy Shaders/Transparent/Diffuse", "Universal Render Pipeline/Unlit", "Unlit/Color" }; for (int i = 0; i < array.Length; i++) { try { Shader val = Shader.Find(array[i]); if ((Object)(object)val != (Object)null) { found = array[i]; return val; } } catch { } } found = null; return null; } private static string Prepare(Material material, Color colour) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); List<string> list2 = new List<string>(); try { for (int i = 0; i < ColourProperties.Length; i++) { if (!material.HasProperty(ColourProperties[i])) { list2.Add(ColourProperties[i]); continue; } material.SetColor(ColourProperties[i], colour); list.Add(ColourProperties[i]); } if (list.Count == 0) { material.color = colour; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(110, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" tinting an annex box material threw ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") - the boxes are drawn in whatever colour the material already carried."); } log.LogWarning(val); return "colour probe threw (" + ex.Message + ")."; } if (list.Count == 0) { return "NO colour property exists on this material (absent: " + Join(list2) + ") - it CANNOT show green versus red, and Material.color was the only thing left to try. If the boxes draw but are all one colour, this line is the reason."; } return $"colour properties set: {Join(list)}; absent: {Join(list2)}."; } private static string Join(List<string> names) { if (names.Count != 0) { return string.Join(", ", names); } return "<none>"; } private static void DestroyMaterial(ref Material material) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Material val = material; material = null; if ((Object)(object)val == (Object)null) { return; } try { Object.Destroy((Object)(object)val); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(43, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" destroying an annex box material threw ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")."); } log.LogWarning(val2); } } private static void ApplyLayer(GameObject cube) { try { if (!((Object)(object)cube == (Object)null) && _previewLayer >= 0) { SetLayerRecursively(cube.transform, _previewLayer); } } catch { } } private static void SetLayerRecursively(Transform transform, int layer) { if (!((Object)(object)transform == (Object)null)) { ((Component)transform).gameObject.layer = layer; for (int i = 0; i < transform.childCount; i++) { SetLayerRecursively(transform.GetChild(i), layer); } } } private static int ReadLayer(GameObject obj) { try { return ((Object)(object)obj == (Object)null) ? (-1) : obj.layer; } catch { return -1; } } private static string LayerText(int layer) { if (layer < 0) { return "<unknown>"; } try { string value = LayerMask.LayerToName(layer); return string.IsNullOrEmpty(value) ? $"{layer} ('<unnamed>')" : $"{layer} ('{value}')"; } catch { return layer.ToString(); } } private static bool StripColliders(GameObject cube) { try { Il2CppArrayBase<Collider> components = cube.GetComponents<Collider>(); if (components != null) { for (int i = 0; i < components.Length; i++) { Collider val = components[i]; if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)val); } } } Il2CppArrayBase<Collider> components2 = cube.GetComponents<Collider>(); if (components2 != null && components2.Length > 0) { ReportFailure($"{components2.Length} collider(s) could not be removed from an annex box"); return false; } return true; } catch (Exception ex) { ReportFailure("removing the collider from an annex box threw (" + ex.Message + ")"); return false; } } private static void DestroyOverlayObject(GameObject obj, string what) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if ((Object)(object)obj == (Object)null) { return; } try { obj.SetActive(false); obj.transform.SetParent((Transform)null, false); Object.Destroy((Object)(object)obj); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(75, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" destroying "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" threw ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") - it may stay visible until the preview is despawned."); } log.LogWarning(val); } } private static void ReportFailure(string reason) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (!_failureLogged) { _failureLogged = true; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(111, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][overlay]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - that annex is not drawn in the ghost. Validation and the move itself are unaffected (logged once per move)."); } log.LogWarning(val); } } private static string SafeName(Object obj) { try { return (obj == (Object)null) ? "<null>" : obj.name; } catch { return "<unnamed>"; } } private static string SafeShaderName(Material material) { try { if ((Object)(object)material == (Object)null) { return "<null>"; } Shader shader = material.shader; return ((Object)(object)shader == (Object)null) ? "<no shader>" : ((Object)shader).name; } catch { return "<unreadable>"; } } } internal static class ArmingReport { internal static int Armed; internal static int Attempted; internal static bool TryPatch(Harmony harmony, MethodBase target, string label, HarmonyMethod prefix = null, HarmonyMethod postfix = null) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown Attempted++; bool flag = default(bool); if (target == null) { ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[arm-fail] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(label); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": target method not found"); } log.LogWarning(val); return false; } try { harmony.Patch(target, prefix, postfix, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Armed++; ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(8, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[armed] "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(label); } log2.LogInfo(val2); return true; } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; bool flag2 = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(13, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[arm-fail] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(label); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log3.LogWarning(val); return false; } } internal static void LogTotal() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(28, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MovingDay] armed "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Armed); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Attempted); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" patches."); } log.LogInfo(val); } } public static class CharacterSpawnPatch { private static bool _attachFailureLogged; internal static Character LocalCharacter { get; private set; } public static void Spawned(Character __instance) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown bool flag = default(bool); try { if (!__instance.IsPlayer() || ((NetworkBehaviour)__instance).GetLocalAuthorityMask() != 1) { return; } LocalCharacter = __instance; if (!((Object)(object)((Component)__instance).GetComponentInChildren<MovingDayTool>() != (Object)null)) { GameObject val = new GameObject("MovingDay_Tool"); val.transform.SetParent(((Component)__instance).gameObject.transform, false); val.AddComponent<MovingDayTool>(); ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[MovingDay] tool attached to local player '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)((Component)__instance).gameObject).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'."); } log.LogInfo(val2); } } catch (Exception ex) { if (!_attachFailureLogged) { _attachFailureLogged = true; ManualLogSource log2 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(154, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[MovingDay] attaching the tool to the local player threw - Moving Day will do nothing this session, and this is reported once rather than once per spawn: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex); } log2.LogError(val3); } } } } internal static class CommitEngine { private const string Prefix = "[MovingDay][commit]"; internal static bool TryMove(MoveSession session, Vector3 position, Quaternion rotation, out string failReason) { //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Expected O, but got Unknown //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Expected O, but got Unknown //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Expected O, but got Unknown //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Expected O, but got Unknown //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); if (session == null) { failReason = "the move was lost before it could be applied"; ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" refused: there is no move session."); } log.LogWarning(val); return false; } string displayName = session.DisplayName; if (!session.IsTargetAlive()) { failReason = "the structure no longer exists"; ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(60, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" refused for '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': the target is gone, dismantled or inactive."); } log2.LogWarning(val); return false; } if (!SessionGate.IsLocalPlayerMaster(out var reason)) { failReason = reason; ManualLogSource log3 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(18, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" refused for '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log3.LogWarning(val); return false; } if (!PoseMath.IsUsable(position)) { failReason = "the confirmed position could not be used"; ManualLogSource log4 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(63, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" refused for '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': the confirmed position "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Fmt(position)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is not a finite point."); } log4.LogWarning(val); return false; } if (!PoseMath.IsUsable(rotation)) { failReason = "the confirmed rotation could not be used"; ManualLogSource log5 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(73, 6, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" refused for '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': the confirmed rotation ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(rotation.x); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(rotation.y); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(rotation.z); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(rotation.w); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") is not a usable quaternion."); } log5.LogWarning(val); return false; } Structure target = session.Target; Transform transform; try { transform = ((Component)target).transform; } catch (Exception ex) { failReason = "the structure could not be read"; ManualLogSource log6 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(29, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" reading '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' transform threw: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex); } log6.LogError(val2); return false; } bool flag2 = default(bool); if ((Object)(object)transform == (Object)null) { failReason = "the structure could not be read"; ManualLogSource log7 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" refused for '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': it has no transform."); } log7.LogWarning(val); return false; } Vector3 val3 = SafeTransformPosition(transform); ManualLogSource log8 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(62, 5, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" moving '"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("': before GetPosition()="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(SafeStructurePosition(target)); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", transform.position="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(Fmt(val3)); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", euler="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(Fmt(SafeEuler(transform))); } log8.LogInfo(val4); ManualLogSource log9 = Plugin.Log; val4 = new BepInExInfoLogInterpolatedStringHandler(26, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" target pose: pos="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(Fmt(position)); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", euler="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(Fmt(((Quaternion)(ref rotation)).eulerAngles)); } log9.LogInfo(val4); List<Occupants.Occupant> occupants = Occupants.Collect(target, displayName); try { transform.SetPositionAndRotation(position, rotation); } catch (Exception ex2) { failReason = "the game refused the new position"; ManualLogSource log10 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(37, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" SetPositionAndRotation on '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' threw: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex2); } log10.LogError(val2); return false; } Vector3 val5 = SafeTransformPosition(transform); Vector3 val6 = val5 - val3; ManualLogSource log11 = Plugin.Log; val4 = new BepInExInfoLogInterpolatedStringHandler(60, 5, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" moved '"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(displayName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("': after GetPosition()="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(SafeStructurePosition(target)); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", transform.position="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(Fmt(val5)); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", euler="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(Fmt(SafeEuler(transform))); } log11.LogInfo(val4); ManualLogSource log12 = Plugin.Log; val4 = new BepInExInfoLogInterpolatedStringHandler(37, 4, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" delta="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(Fmt(val6)); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" (distance "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(((Vector3)(ref val6)).magnitude, "F2"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("m, height change "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(val6.y, "F2"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("m)"); } log12.LogInfo(val4); Occupants.Reseat(occupants, displayName); failReason = null; return true; } private static Vector3 SafeTransformPosition(Transform transform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) try { return transform.position; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(35, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" reading transform.position threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); return Vector3.zero; } } private static Vector3 SafeEuler(Transform transform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) try { Quaternion rotation = transform.rotation; return ((Quaternion)(ref rotation)).eulerAngles; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(39, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][commit]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" reading the transform rotation threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); return Vector3.zero; } } private static string SafeStructurePosition(Structure structure) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) try { return Fmt(structure.GetPosition()); } catch (Exception ex) { return "<threw: " + ex.Message + ">"; } } private static string Fmt(Vector3 v) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) return $"({v.x:F2},{v.y:F2},{v.z:F2})"; } } internal static class ConfirmDialog { private const string ConfirmCaptionKey = "common.confirm"; private const string CancelCaptionKey = "common.cancel"; private const string Prefix = "[MovingDay][dialog]"; private const float VanishGraceSeconds = 5f; private static Action<ConfirmActionMenu> _confirmHandler; private static Action<ConfirmActionMenu> _cancelHandler; private static Action _onConfirm; private static Action _onCancel; private static Menu _menu; private static bool _tracking; private static float _lastAliveAt; internal static bool TryOpen(string title, string message, Structure prefabSource, Action onConfirm, Action onCancel) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00e5: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Expected O, but got Unknown //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Expected O, but got Unknown Close(); if (onConfirm == null || onCancel == null) { return false; } MenuManager instance; try { instance = MenuManager.Instance; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(37, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" reading MenuManager.Instance threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); return false; } bool flag2 = default(bool); if ((Object)(object)instance == (Object)null) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(68, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" there is no MenuManager - the confirmation dialog cannot be opened."); } log2.LogWarning(val2); return false; } ConfirmActionMenu val3 = ResolvePrefab(instance, prefabSource); if ((Object)(object)val3 == (Object)null) { ManualLogSource log3 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(90, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" no ConfirmActionMenu prefab could be resolved - the confirmation dialog cannot be opened."); } log3.LogWarning(val2); return false; } ConfirmActionMenuParameters val4; try { val4 = new ConfirmActionMenuParameters { Title = title, Message = message, ConfirmMessage = "common.confirm", CancelMessage = "common.cancel", CloseOnConfirm = true, HideCancelButton = false, DontCloseOnEscape = false }; } catch (Exception ex2) { ManualLogSource log4 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(45, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" building the confirmation parameters threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex2); } log4.LogError(val); return false; } _onConfirm = onConfirm; _onCancel = onCancel; _confirmHandler = HandleConfirm; _cancelHandler = HandleCancel; try { val4.OnConfirm = DelegateSupport.ConvertDelegate<Action<ConfirmActionMenu>>((Delegate)_confirmHandler); val4.OnCancel = DelegateSupport.ConvertDelegate<Action<ConfirmActionMenu>>((Delegate)_cancelHandler); } catch (Exception ex3) { ManualLogSource log5 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(48, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" converting the confirm/cancel callbacks threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex3); } log5.LogError(val); Forget(); return false; } Menu val5; try { val5 = instance.OpenMenuPrefab((Menu)(object)val3, (MenuParameters)(object)val4); } catch (Exception ex4) { ManualLogSource log6 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(40, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" opening the confirmation dialog threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex4); } log6.LogError(val); Forget(); return false; } if ((Object)(object)val5 == (Object)null) { ManualLogSource log7 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(72, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" OpenMenuPrefab returned nothing - the confirmation dialog did not open."); } log7.LogWarning(val2); Forget(); return false; } _menu = val5; _tracking = true; _lastAliveAt = SafeNow(); ManualLogSource log8 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(30, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" opened: title='"); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(title); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("', message='"); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(message); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("'."); } log8.LogInfo(val6); if (!RawTextRenders(title)) { ManualLogSource log9 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(156, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" the localizer does not pass unknown keys through, so the dialog's own title and message may not read as written - repeating the question as a notification."); } log9.LogWarning(val2); Hud.Notify(message); } return true; } internal static bool HasVanished() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (!_tracking) { return false; } float num = SafeNow(); bool flag; try { flag = (Object)(object)_menu != (Object)null && _menu.IsActive; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(35, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" reading the dialog's state threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); flag = false; } if (flag) { _lastAliveAt = num; return false; } return num - _lastAliveAt > 5f; } internal static void Forget() { _tracking = false; _menu = null; _onConfirm = null; _onCancel = null; } internal static void Close() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (!_tracking) { Forget(); return; } Menu menu = _menu; Forget(); if ((Object)(object)menu == (Object)null) { return; } try { MenuManager instance = MenuManager.Instance; if ((Object)(object)instance != (Object)null) { instance.CloseMenu(menu); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(40, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" closing the confirmation dialog threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } private static void HandleConfirm(ConfirmActionMenu menu) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Action onConfirm = _onConfirm; Forget(); bool flag = default(bool); try { ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" confirmed by the player."); } log.LogInfo(val); onConfirm?.Invoke(); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(34, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" handling the confirmation threw: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex); } log2.LogError(val2); } } private static void HandleCancel(ConfirmActionMenu menu) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Action onCancel = _onCancel; Forget(); bool flag = default(bool); try { ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" declined by the player."); } log.LogInfo(val); onCancel?.Invoke(); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(34, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" handling the cancellation threw: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex); } log2.LogError(val2); } } private static ConfirmActionMenu ResolvePrefab(MenuManager manager, Structure prefabSource) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown bool flag = default(bool); try { ConfirmActionMenu prefab = manager.GetPrefab<ConfirmActionMenu>(); if ((Object)(object)prefab != (Object)null) { return prefab; } ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(111, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" MenuManager has no registered ConfirmActionMenu prefab - falling back to the structure's own dismantle dialog."); } log.LogInfo(val); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(109, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" MenuManager.GetPrefab<ConfirmActionMenu>() failed ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") - falling back to the structure's own dismantle dialog."); } log2.LogWarning(val2); } try { if ((Object)(object)prefabSource != (Object)null) { ConfirmActionMenu confirmDismantleMenu = prefabSource._confirmDismantleMenu; if ((Object)(object)confirmDismantleMenu != (Object)null) { return confirmDismantleMenu; } } } catch (Exception ex2) { ManualLogSource log3 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(56, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" reading the structure's dismantle dialog prefab threw: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex2); } log3.LogError(val3); } return null; } private static bool RawTextRenders(string sample) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (string.IsNullOrEmpty(sample)) { return true; } bool flag3 = default(bool); try { LocalizationManager instance = LocalizationManager.Instance; BepInExInfoLogInterpolatedStringHandler val; if ((Object)(object)instance == (Object)null) { ManualLogSource log = Plugin.Log; bool flag = default(bool); val = new BepInExInfoLogInterpolatedStringHandler(108, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" there is no LocalizationManager to check raw-text rendering against - assuming the text renders as written."); } log.LogInfo(val); return true; } string text = instance.Loc(sample, false); bool flag2 = string.Equals(text, sample, StringComparison.Ordinal); ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(54, 4, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" raw-text check: Loc(\""); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(sample); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\") -> \""); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\" (renders as written: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(flag2 ? "yes" : "NO"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")."); } log2.LogInfo(val); return flag2; } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(27, 2, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" the raw-text check threw: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex); } log3.LogError(val2); return true; } } private static float SafeNow() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown try { return Time.unscaledTime; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(26, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("[MovingDay][dialog]"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" reading the clock threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); return 0f; } } } internal static class GhostSession { private sealed class PendingInjection { internal ICollection<Collider> Collection { get; } internal List<Collider> Added { get; } internal PendingInjection(ICollection<Collider> collection, List<Collider> added) { Collection = collection; Added = added; } } private static readonly Collider[] NoColliders = (Collider[])(object)new Collider[0]; private static PlayerBuilder _builder; private static bool _live; private static bool _starting; private static bool _ending; private static bool _gameLeftBuildMode; private static Collider[] _exempt = NoColliders; private static readonly HashSet<IntPtr> _exemptPointers = new HashSet<IntPtr>(); private static bool _injectionFailureLogged; private static bool _injectionCapLogged; private static readonly List<PendingInjection> _pendingInjections = new List<PendingInjection>(); private const int MaxPendingInjections = 32; private static float _seedYaw; private static bool _haveSeedYaw; private static bool _seedApplied; private static int _seedWaitFrames; private const int MaxSeedWaitFrames = 30; private static float _seedWritten; private static bool _seedVerifyPending; private static AnchorPointPlacementTool _seededTool; private static float _priorAngle; private static AnchorPointPlacement _seededPlacement; private static Quaternion _priorPlacementRotation; private const float SeedDriftTolerance = 1f; internal static bool IsLive => _live; internal static StructurePreviewData GhostPreviewData { get { if (!_live) { return null; } try { PlayerBuilder builder = _builder; return ((Object)(object)builder == (Object)null) ? null : builder.previewData; } catch { return null; } } } internal static Material GhostValidationMaterial { get { if (!_live) { return null; } try { PlayerBuilder builder = _builder; PlacementTool val = (((Object)(object)builder == (Object)null) ? null : builder._placementTool); if ((Object)(object)val == (Object)null) { return null; } ValidationPlacementTool val2 = ((Il2CppObjectBase)val).TryCast<ValidationPlacementTool>(); return ((Object)(object)val2 == (Object)null) ? null : val2.validationMaterial; } catch { return null; } } } internal static bool Begin(MoveSession session) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Invalid comparison between Unknown and I4 //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Invalid comparison between Unknown and I4 //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02a7: Unknown result type (might be due to invalid IL or missing references) if (_live) { Plugin.Log.LogWarning((object)"[MovingDay] a ghost placement session was already live - ending it before starting another."); End(); } _gameLeftBuildMode = false; if (session == null) { return false; } Structure target = session.Target; if ((Object)(object)target == (Object)null) { Plugin.Log.LogWarning((object)"[MovingDay] the move target is gone - ghost placement cannot start."); return false; } StructureTemplate template; try { template = target.Template; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MovingDay] reading the move target's template threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); return false; } if ((Object)(object)template == (Object)null) { Plugin.Log.LogWarning((object)"[MovingDay] the move target has no build template - ghost placement cannot start."); return false; } PlayerBuilder val2 = ResolveBuilder(); if ((Object)(object)val2 == (Object)null) { return false; } bool flag2 = default(bool); BepInExInfoLogInterpolatedStringHandler val3; try { State currentState = val2.CurrentState; if ((int)currentState != 0) { ManualLogSource log2 = Plugin.Log; val3 = new BepInExInfoLogInterpolatedStringHandler(91, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[MovingDay] the player is already in build state "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<State>(currentState); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" - not starting a ghost placement session."); } log2.LogInfo(val3); return false; } } catch (Exception ex2) { ManualLogSource log3 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(54, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MovingDay] reading the player builder's state threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex2); } log3.LogError(val); return false; } CaptureExemptColliders(session); ShellValidation.CaptureAtGhostStart(target); CaptureRotationSeed(target); _builder = val2; _live = true; _starting = true; try { ((StructureBuilder)val2).StructureTemplate = template; State currentState2 = val2.CurrentState; if ((int)currentState2 == 1) { Plugin.Log.LogInfo((object)"[MovingDay] template setter entered placement itself - skipping explicit _StartBuilding()."); } else if ((int)currentState2 == 0) { Plugin.Log.LogInfo((object)"[MovingDay] template setter did not change state - calling _StartBuilding()."); val2._StartBuilding(); } else { ManualLogSource log4 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(110, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[MovingDay] the template setter left the player builder in state "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<State>(currentState2); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" - not calling _StartBuilding() on top of it."); } log4.LogWarning(val4); } } catch (Exception ex3) { ManualLogSource log5 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(57, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MovingDay] starting the game's placement session threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex3); } log5.LogError(val); _starting = false; Abandon(val2); return false; } _starting = false; State currentState3; try { currentState3 = val2.CurrentState; } catch (Exception ex4) { ManualLogSource log6 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(57, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MovingDay] re-reading the player builder's state threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex4); } log6.LogError(val); Abandon(val2); return false; } if ((int)currentState3 != 1) { ManualLogSource log7 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(115, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[MovingDay] _StartBuilding() left the player builder in state "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<State>(currentState3); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", expected PLACEMENT - ghost placement did not start."); } log7.LogWarning(val4); Abandon(val2); return false; } ManualLogSource log8 = Plugin.Log; val3 = new BepInExInfoLogInterpolatedStringHandler(83, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[MovingDay] ghost placement started ("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(_exemptPointers.Count); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" collider(s) exempt from the footprint check)."); } log8.LogInfo(val3); return true; } internal static void End() { if (_ending) { return; } _ending = true; try { bool gameLeftBuildMode = _gameLeftBuildMode; _gameLeftBuildMode = false; if (!_live) { _builder = null; _starting = false; ClearExemptColliders(); return; } _live = false; _starting = false; PlayerBuilder builder = _builder; _builder = null; ClearExemptColliders(); if (gameLeftBuildMode) { Plugin.Log.LogInfo((object)"[MovingDay] ghost placement ended by the game's own build-mode exit."); } else { EndBuilding(builder); } RepairLeakedInputContext(builder); } finally { _ending = false; } } internal static void NoteBuildModeLeftByGame() { _gameLeftBuildMode = true; } internal static void Tick() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (!_live || _starting) { return; } try { VerifyRotationSeed(); ApplyRotationSeed(); } catch (Exception ex) { _seedApplied = true; _seedVerifyPending = false; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(98, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MovingDay] seeding the ghost's opening rotation threw - the ghost keeps the game's own rotation: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } private static void CaptureRotationSeed(Structure target) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown try { _seedYaw = ((Component)target).transform.eulerAngles.y; _haveSeedYaw = true; } catch (Exception ex) { _haveSeedYaw = false; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(100, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MovingDay] the move target's yaw could not be read, so the ghost opens at the game's own rotation: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } private static void ApplyRotationSeed() { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_00b6: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (_seedApplied || !_haveSeedYaw) { return; } PlayerBuilder builder = _builder; AnchorPointPlacementTool val = (((Object