Decompiled source of SpellBrigadeMinimap v1.0.1
SpellBrigadeMinimap.dll
Decompiled 20 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Numerics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Microsoft.CodeAnalysis; using SpellBrigadeMinimap.Core; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.UI; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("SpellBrigadeMinimap")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8e697a6b6a3b3dfd3f8983ab1f5f2a1b0fa03c5c")] [assembly: AssemblyProduct("SpellBrigadeMinimap")] [assembly: AssemblyTitle("SpellBrigadeMinimap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SpellBrigadeMinimap { internal static class DebugImages { private static string runStamp = "run"; public static void BeginRun() { runStamp = DateTime.Now.ToString("yyyyMMdd-HHmmss"); } public static void Save(string name, PixelBuffer img) { if (img != null && Mod.Settings.SaveDebugImages.Value) { Write(runStamp + "-" + name + ".png", delegate(string path) { File.WriteAllBytes(path, PngWriter.Encode(img)); }); } } public static void SaveText(string name, string text) { if (text != null && Mod.Settings.SaveDebugImages.Value) { Write(runStamp + "-" + name + ".txt", delegate(string path) { File.WriteAllText(path, text); }); } } private static void Write(string fileName, Action<string> write) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown try { string text = Path.Combine(Paths.BepInExRootPath, "minimap-debug"); Directory.CreateDirectory(text); string text2 = Path.Combine(text, fileName); write(text2); ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(6, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Saved "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2); } log.LogInfo(val); } catch (Exception e) { LogOnce.Error("saving a debug file", e); } } } internal sealed class HudAvoider { private const float RefreshSeconds = 3f; private const float ScanSeconds = 0.25f; private const float MaxPieceShare = 0.4f; private const float MoveSpeed = 900f; private const int MaxLogs = 20; private readonly HudClearance clearance = new HudClearance(1f, 1.5f, 0f, float.MaxValue); private readonly List<Graphic> candidates = new List<Graphic>(); private readonly List<(long, ScreenBox)> boxes = new List<(long, ScreenBox)>(); private readonly Il2CppStructArray<Vector3> corners = new Il2CppStructArray<Vector3>(4L); private readonly HashSet<string> logged = new HashSet<string>(); private float nextRefresh; private float nextScan; private float target; private float current; private int logs; public void Reset() { clearance.Reset(); candidates.Clear(); nextRefresh = (nextScan = (target = (current = 0f))); } public float Tick(float now, float dt, ScreenBox home, bool bottomCorner, Canvas own, float scale, float gap, float maxMove) { try { if (now >= nextRefresh) { nextRefresh = now + 3f; Refresh(in home, own); } if (now >= nextScan) { nextScan = now + 0.25f; boxes.Clear(); foreach (Graphic candidate in candidates) { if (Visible(candidate) && TryBox(candidate, out var box)) { boxes.Add((((Il2CppObjectBase)candidate).Pointer.ToInt64(), box)); } } float num = clearance.Update(now, in home, bottomCorner, boxes); float num2 = ((num > 0f) ? Math.Min(num / scale + gap, maxMove) : 0f); if (num2 > target + 0.5f) { LogCause(in home, bottomCorner, num2); } target = num2; } } catch (Exception e) { LogOnce.Error("keeping the minimap clear of the game's HUD", e); target = 0f; } current = Mathf.MoveTowards(current, target, 900f * dt); return current; } private void Refresh(in ScreenBox home, Canvas own) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 candidates.Clear(); float num = (home.YMax - home.YMin) * 1.5f; ScreenBox o = new ScreenBox(home.XMin - num, home.YMin - num, home.XMax + num, home.YMax + num); Il2CppArrayBase<Canvas> val = Object.FindObjectsOfType<Canvas>(); for (int i = 0; i < val.Length; i++) { Canvas val2 = val[i]; if ((Object)(object)val2 == (Object)null || !((Behaviour)val2).isActiveAndEnabled || !val2.isRootCanvas || (int)val2.renderMode == 2 || ((Object)(object)own != (Object)null && ((Il2CppObjectBase)val2).Pointer == ((Il2CppObjectBase)own).Pointer)) { continue; } Il2CppArrayBase<Graphic> componentsInChildren = ((Component)val2).GetComponentsInChildren<Graphic>(false); for (int j = 0; j < componentsInChildren.Length; j++) { Graphic val3 = componentsInChildren[j]; if (!((Object)(object)val3 == (Object)null) && TryBox(val3, out var box) && box.Overlaps(in o) && !((Object)(object)((Component)val3).GetComponentInParent<ScreenPointer>() != (Object)null)) { candidates.Add(val3); } } } } private static bool Visible(Graphic g) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)g == (Object)null || !((Behaviour)g).isActiveAndEnabled || g.color.a < 0.1f) { return false; } CanvasRenderer canvasRenderer = g.canvasRenderer; if ((Object)(object)canvasRenderer != (Object)null && canvasRenderer.cull) { return false; } Il2CppArrayBase<CanvasGroup> componentsInParent = ((Component)g).GetComponentsInParent<CanvasGroup>(); float num = 1f; for (int i = 0; i < componentsInParent.Length; i++) { CanvasGroup val = componentsInParent[i]; if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled) { num *= val.alpha; if (val.ignoreParentGroups) { break; } } } return num >= 0.1f; } private bool TryBox(Graphic g, out ScreenBox box) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) box = default(ScreenBox); Canvas canvas = g.canvas; if ((Object)(object)canvas == (Object)null) { return false; } g.rectTransform.GetWorldCorners(corners); Camera val = (((int)canvas.renderMode == 1) ? canvas.worldCamera : null); float num = float.MaxValue; float num2 = float.MaxValue; float num3 = float.MinValue; float num4 = float.MinValue; for (int i = 0; i < 4; i++) { Vector2 val2 = (((Object)(object)val != (Object)null) ? RectTransformUtility.WorldToScreenPoint(val, ((Il2CppArrayBase<Vector3>)(object)corners)[i]) : Vector2.op_Implicit(((Il2CppArrayBase<Vector3>)(object)corners)[i])); num = Math.Min(num, val2.x); num3 = Math.Max(num3, val2.x); num2 = Math.Min(num2, val2.y); num4 = Math.Max(num4, val2.y); } float num5 = num3 - num; float num6 = num4 - num2; if (num5 < 4f || num6 < 4f || num5 > (float)Screen.width * 0.4f || num6 > (float)Screen.height * 0.4f) { return false; } box = new ScreenBox(num, num2, num3, num4); return true; } private void LogCause(in ScreenBox home, bool bottomCorner, float units) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown if (logs >= 20) { return; } List<string> list = new List<string>(); foreach (Graphic candidate in candidates) { if (Visible(candidate) && TryBox(candidate, out var box) && box.Overlaps(in home) && !(bottomCorner ? (box.CenterY > home.CenterY) : (box.CenterY < home.CenterY))) { Transform transform = ((Component)candidate).transform; string item = (((Object)(object)transform.parent != (Object)null) ? (((Object)transform.parent).name + "/" + ((Object)transform).name) : ((Object)transform).name); if (!list.Contains(item)) { list.Add(item); } } } string text = string.Join(", ", list); if (list.Count != 0 && logged.Add(text)) { logs++; ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(38, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Moving the minimap "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(units, "0"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" units "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(bottomCorner ? "up" : "down"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to clear: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("."); } log.LogInfo(val2); } } } internal sealed class IconPool { private readonly RectTransform parent; private readonly List<Image> images = new List<Image>(); private int used; public IconPool(RectTransform parent) { this.parent = parent; } public void Begin() { used = 0; } public void Place(Sprite sprite, Color color, Vector2 position, float size, float rotation) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) Image val; if (used < images.Count) { val = images[used]; } else { val = UiBuilder.NewImage("Icon", (Transform)(object)parent); images.Add(val); } used++; if ((Object)(object)val.sprite != (Object)(object)sprite) { val.sprite = sprite; } if (((Graphic)val).color != color) { ((Graphic)val).color = color; } RectTransform rectTransform = ((Graphic)val).rectTransform; rectTransform.anchoredPosition = position; rectTransform.sizeDelta = new Vector2(size, size); ((Transform)rectTransform).localEulerAngles = new Vector3(0f, 0f, rotation); if (!((Behaviour)val).enabled) { ((Behaviour)val).enabled = true; } } public void End() { for (int i = used; i < images.Count; i++) { if (((Behaviour)images[i]).enabled) { ((Behaviour)images[i]).enabled = false; } } } } internal static class LevelSnapshot { private const int Supersample = 4; private const int MaxTextureSide = 2048; private const float CameraHeight = 12f; private const int UiLayer = 5; private static readonly Rgba CoverageKey = new Rgba(byte.MaxValue, 0, byte.MaxValue); private static bool fogLogged; private static bool gradingLogged; private static bool layersLogged; public static PixelBuffer CaptureLevel(float originX, float originZ, int cellsW, int cellsH, float cellSize, float groundY, IList<Renderer> alsoHide = null) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (!fogLogged) { fogLogged = true; try { ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Scene fog is "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(RenderSettings.fog ? "on" : "off"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } catch { } } int num = SupersampleFor(cellsW, cellsH); List<Renderer> hidden = new List<Renderer>(); List<VolumeComponent> lensEffectsOff = new List<VolumeComponent>(); return PixelBuffer.Downsample(RenderTopDown(originX, originZ, cellsW, cellsH, cellSize, groundY, num, GameLayers(), Color.black, delegate(Camera cam) { HideMovingThings(hidden); if (alsoHide != null) { foreach (Renderer item in alsoHide) { if ((Object)(object)item != (Object)null && item.enabled) { item.enabled = false; hidden.Add(item); } } } DisableLensEffects(lensEffectsOff); UseGameColourGrading(cam); }, delegate { foreach (Renderer item2 in hidden) { if ((Object)(object)item2 != (Object)null) { item2.enabled = true; } } foreach (VolumeComponent item3 in lensEffectsOff) { if ((Object)(object)item3 != (Object)null) { item3.active = true; } } }), cellsW * num, cellsH * num, num); } private static int GameLayers() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown int num = -33; try { Camera main = Camera.main; if ((Object)(object)main != (Object)null && (main.cullingMask & num & 1) != 0) { num &= main.cullingMask; } if (!layersLogged) { layersLogged = true; List<int> list = new List<int>(); for (int i = 0; i < 32; i++) { if ((num & (1 << i)) == 0) { list.Add(i); } } ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Level picture skips layers "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(string.Join(", ", list)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (as the game camera does)."); } log.LogInfo(val); } } catch (Exception e) { LogOnce.Error("reading the game camera's layers", e); } return num; } public static int FreeLayer() { bool[] array = new bool[32]; Il2CppArrayBase<Renderer> val = Object.FindObjectsOfType<Renderer>(); for (int i = 0; i < val.Length; i++) { if ((Object)(object)val[i] != (Object)null) { array[((Component)val[i]).gameObject.layer] = true; } } for (int num = 31; num >= 8; num--) { if (!array[num]) { return num; } } return -1; } public static T OnLayer<T>(IEnumerable<GameObject> objects, int layer, Func<T> body) { List<(GameObject, int)> list = new List<(GameObject, int)>(); try { foreach (GameObject @object in objects) { if (!((Object)(object)@object == (Object)null)) { list.Add((@object, @object.layer)); @object.layer = layer; } } return body(); } finally { foreach (var (val, layer2) in list) { if ((Object)(object)val != (Object)null) { val.layer = layer2; } } } } public static float[] CaptureCoverage(float originX, float originZ, int cellsW, int cellsH, float cellSize, float groundY, int layer) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) int num = SupersampleFor(cellsW, cellsH); return PixelBuffer.CoverageOfNonKey(RenderTopDown(originX, originZ, cellsW, cellsH, cellSize, groundY, num, 1 << layer, new Color(1f, 0f, 1f, 1f), null, null), cellsW * num, cellsH * num, num, CoverageKey, 24); } private static int SupersampleFor(int cellsW, int cellsH) { int num = 4; while (num > 1 && (cellsW * num > 2048 || cellsH * num > 2048)) { num--; } return num; } private static byte[] RenderTopDown(float originX, float originZ, int cellsW, int cellsH, float cellSize, float groundY, int ss, int cullingMask, Color background, Action<Camera> before, Action after) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0084: 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_00de: Unknown result type (might be due to invalid IL or missing references) int num = cellsW * ss; int num2 = cellsH * ss; float num3 = (float)cellsW * cellSize; float num4 = (float)cellsH * cellSize; RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 24, (RenderTextureFormat)0); GameObject val = new GameObject("SpellBrigadeMinimap_Snapshot"); Camera val2 = null; try { val2 = val.AddComponent<Camera>(); ((Behaviour)val2).enabled = false; val2.orthographic = true; val2.orthographicSize = num4 * 0.5f; val2.aspect = num3 / num4; val2.nearClipPlane = 0.3f; val2.farClipPlane = 92f; val2.clearFlags = (CameraClearFlags)2; val2.backgroundColor = background; val2.cullingMask = cullingMask; val2.targetTexture = temporary; val.transform.position = new Vector3(originX + num3 * 0.5f, groundY + 12f, originZ + num4 * 0.5f); val.transform.rotation = Quaternion.Euler(90f, 0f, 0f); try { before?.Invoke(val2); val2.Render(); } finally { after?.Invoke(); } return ReadBack(temporary, num, num2); } finally { if ((Object)(object)val2 != (Object)null) { val2.targetTexture = null; } Object.Destroy((Object)(object)val); RenderTexture.ReleaseTemporary(temporary); } } public static PixelBuffer CaptureGameView(int width, out Matrix4x4 clipToWorld) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) clipToWorld = Matrix4x4.Identity; Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return null; } float num = ((main.pixelHeight > 0) ? ((float)main.pixelWidth / (float)main.pixelHeight) : 1.7777778f); int num2 = Math.Max(1, (int)((float)width / num)); RenderTexture temporary = RenderTexture.GetTemporary(width, num2, 24, (RenderTextureFormat)0); RenderTexture targetTexture = main.targetTexture; try { main.targetTexture = temporary; main.Render(); if (!Matrix4x4.Invert(ToNumerics(main.worldToCameraMatrix) * ToNumerics(main.projectionMatrix), out clipToWorld)) { clipToWorld = Matrix4x4.Identity; } main.targetTexture = targetTexture; return PixelBuffer.Downsample(ReadBack(temporary, width, num2), width, num2, 1); } finally { main.targetTexture = targetTexture; RenderTexture.ReleaseTemporary(temporary); } } private static Matrix4x4 ToNumerics(Matrix4x4 m) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) return new Matrix4x4(m.m00, m.m10, m.m20, m.m30, m.m01, m.m11, m.m21, m.m31, m.m02, m.m12, m.m22, m.m32, m.m03, m.m13, m.m23, m.m33); } private static byte[] ReadBack(RenderTexture rt, int w, int h) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) RenderTexture active = RenderTexture.active; Texture2D val = null; try { RenderTexture.active = rt; val = new Texture2D(w, h, (TextureFormat)4, false); val.ReadPixels(new Rect(0f, 0f, (float)w, (float)h), 0, 0, false); RenderTexture.active = active; Il2CppStructArray<Color32> pixels = val.GetPixels32(); if (((Il2CppArrayBase<Color32>)(object)pixels).Length < w * h) { throw new InvalidOperationException($"expected {w * h} pixels, got {((Il2CppArrayBase<Color32>)(object)pixels).Length}"); } byte[] array = new byte[w * h * 4]; Marshal.Copy(IntPtr.Add(((Il2CppObjectBase)pixels).Pointer, 4 * IntPtr.Size), array, 0, array.Length); return array; } finally { RenderTexture.active = active; if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } private static void UseGameColourGrading(Camera cam) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown try { UniversalAdditionalCameraData universalAdditionalCameraData = CameraExtensions.GetUniversalAdditionalCameraData(cam); universalAdditionalCameraData.renderPostProcessing = true; Camera main = Camera.main; if ((Object)(object)main != (Object)null) { UniversalAdditionalCameraData universalAdditionalCameraData2 = CameraExtensions.GetUniversalAdditionalCameraData(main); universalAdditionalCameraData.volumeLayerMask = universalAdditionalCameraData2.volumeLayerMask; universalAdditionalCameraData.volumeTrigger = (((Object)(object)universalAdditionalCameraData2.volumeTrigger != (Object)null) ? universalAdditionalCameraData2.volumeTrigger : ((Component)main).transform); if (!gradingLogged) { gradingLogged = true; ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(64, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Game camera post-processing is "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(universalAdditionalCameraData2.renderPostProcessing ? "on" : "off"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("; using it for the level picture."); } log.LogInfo(val); } } CameraExtensions.UpdateVolumeStack(cam, universalAdditionalCameraData); } catch (Exception e) { LogOnce.Error("using the game's colour grading for the level picture", e); } } private static void DisableLensEffects(List<VolumeComponent> disabled) { try { Il2CppArrayBase<Volume> val = Object.FindObjectsOfType<Volume>(); for (int i = 0; i < val.Length; i++) { Volume val2 = val[i]; if ((Object)(object)val2 == (Object)null || !((Behaviour)val2).isActiveAndEnabled) { continue; } VolumeProfile val3 = (val2.HasInstantiatedProfile() ? val2.profile : val2.sharedProfile); if ((Object)(object)val3 == (Object)null || val3.components == null) { continue; } List<VolumeComponent> components = val3.components; for (int j = 0; j < components.Count; j++) { VolumeComponent val4 = components[j]; if (!((Object)(object)val4 == (Object)null) && val4.active && IsLensEffect(val4)) { val4.active = false; disabled.Add(val4); } } } } catch (Exception e) { LogOnce.Error("turning off lens effects for the level picture", e); } } private static bool IsLensEffect(VolumeComponent c) { if (!((Object)(object)((Il2CppObjectBase)c).TryCast<Vignette>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)c).TryCast<DepthOfField>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)c).TryCast<MotionBlur>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)c).TryCast<ChromaticAberration>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)c).TryCast<LensDistortion>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)c).TryCast<PaniniProjection>() != (Object)null)) { return (Object)(object)((Il2CppObjectBase)c).TryCast<FilmGrain>() != (Object)null; } return true; } private static void HideMovingThings(List<Renderer> hidden) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown HashSet<IntPtr> keep = new HashSet<IntPtr>(); try { Il2CppArrayBase<River> val = Object.FindObjectsOfType<River>(); for (int i = 0; i < val.Length; i++) { LineRenderer val2 = (((Object)(object)val[i] != (Object)null) ? val[i].riverRenderer : null); if ((Object)(object)val2 != (Object)null) { keep.Add(((Il2CppObjectBase)val2).Pointer); } } } catch (Exception e) { LogOnce.Error("finding the river for the level picture", e); } int num = 0; try { Il2CppArrayBase<Tornado> val3 = Object.FindObjectsOfType<Tornado>(); for (int j = 0; j < val3.Length; j++) { if ((Object)(object)val3[j] != (Object)null) { HideUnder((Component)(object)val3[j]); num++; } } } catch (Exception e2) { LogOnce.Error("hiding tornadoes for the level picture", e2); } if (num > 0 || keep.Count > 0) { ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(49, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Level picture: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" tornadoes hidden, "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(keep.Count); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" river(s) kept."); } log.LogInfo(val4); } try { GameplayPlayerManager instance = Singleton<GameplayPlayerManager>.Instance; if ((Object)(object)instance != (Object)null) { List<GameplayPlayer> alivePlayers = instance.AlivePlayers; if (alivePlayers != null) { for (int k = 0; k < alivePlayers.Count; k++) { HideUnder((Component)(object)alivePlayers[k]); } } List<PlayerGhost> playerGhosts = instance.PlayerGhosts; if (playerGhosts != null) { for (int l = 0; l < playerGhosts.Count; l++) { HideUnder((Component)(object)playerGhosts[l]); } } } List<Enemy> allEnemies = Enemy.AllEnemies; if (allEnemies != null) { for (int m = 0; m < allEnemies.Count; m++) { HideUnder((Component)(object)allEnemies[m]); } } } catch (Exception e3) { LogOnce.Error("hiding players and enemies for the level picture", e3); } HideAll<ParticleSystemRenderer>(); HideAll<TrailRenderer>(); HideAll<LineRenderer>(); HideAll<VFXRenderer>(); void Hide(Renderer r) { if (!((Object)(object)r == (Object)null) && r.enabled && !keep.Contains(((Il2CppObjectBase)r).Pointer)) { r.enabled = false; hidden.Add(r); } } void HideAll<T>() where T : Renderer { try { Il2CppArrayBase<T> val5 = Object.FindObjectsOfType<T>(); for (int n = 0; n < val5.Length; n++) { Hide((Renderer)(object)val5[n]); } } catch (Exception e4) { LogOnce.Error("hiding " + typeof(T).Name + " for the level picture", e4); } } void HideUnder(Component root) { if (!((Object)(object)root == (Object)null)) { Il2CppArrayBase<Renderer> componentsInChildren = root.GetComponentsInChildren<Renderer>(true); for (int n = 0; n < componentsInChildren.Length; n++) { Hide(componentsInChildren[n]); } } } } } public class MinimapBehaviour : MonoBehaviour { private const float ZoomStep = 1.25f; private const float SettleSeconds = 1f; private const float SettleFallbackSeconds = 6f; private const float SpawnPointRetrySeconds = 1f; private MinimapView view; private readonly WorldScanner scanner = new WorldScanner(); private readonly NavMeshMapper mapper = new NavMeshMapper(); private readonly MoreEventsBridge bridge = new MoreEventsBridge(); private readonly ObjectiveDiscovery discovery = new ObjectiveDiscovery(); private readonly List<EventMarker> markers = new List<EventMarker>(); private IntPtr runPtr; private float radius; private float runStartedAt = -1f; private float groundedSince = -1f; private float nextSpawnPointSearch; private Vector3? spawnPoint; private bool hidden; public MinimapBehaviour(IntPtr ptr) : base(ptr) { } private void Start() { radius = Mod.Settings.Radius.Value; try { view = new MinimapView(Mod.Settings); view.SetVisible(show: false); } catch (Exception e) { LogOnce.Error("building the minimap UI", e); } } private void LateUpdate() { if (view == null) { return; } try { Tick(); } catch (Exception e) { LogOnce.Error("drawing the minimap", e); view.SetVisible(show: false); } } private void Tick() { //IL_00fb: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) MinimapConfig settings = Mod.Settings; float unscaledTime = Time.unscaledTime; HandleKeys(settings); RunManager instance = NetworkSingleton<RunManager>.Instance; if ((Object)(object)instance == (Object)null) { if (runPtr != IntPtr.Zero) { EndRun(); } view.SetVisible(show: false); return; } if (((Il2CppObjectBase)instance).Pointer != runPtr) { StartRun(instance); } scanner.Tick(unscaledTime, settings.ShowEnemies.Value, settings.ShowObjectives.Value || settings.ShowPickups.Value, settings.ShowMapFeatures.Value); discovery.Tick(unscaledTime, scanner.Pois); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(scanner.Center.X, scanner.CenterY, scanner.Center.Y); Vector3 point; if (scanner.HasCenter) { mapper.SeedNear(unscaledTime, val); } else if (TryFindSpawnPoint(unscaledTime, out point)) { mapper.SeedNear(unscaledTime, point); } bool runHasStarted = instance.runHasStarted; if (runHasStarted && runStartedAt < 0f) { runStartedAt = unscaledTime; } if (scanner.HasCenter && mapper.IsOnGround(val)) { if (groundedSince < 0f) { groundedSince = unscaledTime; } } else { groundedSince = -1f; } bool viewSettled = runHasStarted && ((groundedSince >= 0f && unscaledTime - groundedSince >= 1f) || unscaledTime - runStartedAt >= 6f); if (mapper.Tick(unscaledTime, viewSettled, val)) { view.SetMap(mapper.Map); } if (!runHasStarted || !scanner.HasCenter || !settings.Enabled.Value || hidden || Time.timeScale == 0f) { view.SetVisible(show: false); return; } if (settings.ShowMoreEvents.Value) { bridge.Collect(markers); } else { markers.Clear(); } view.SetVisible(show: true); view.Render(scanner, markers, discovery, settings.RotateWithCamera.Value ? CameraYaw() : 0f, radius); } private bool TryFindSpawnPoint(float now, out Vector3 point) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!spawnPoint.HasValue && now >= nextSpawnPointSearch) { nextSpawnPointSearch = now + 1f; ObjectiveSpawnPoint val = Object.FindObjectOfType<ObjectiveSpawnPoint>(); if ((Object)(object)val != (Object)null) { spawnPoint = ((Component)val).transform.position; } } point = spawnPoint.GetValueOrDefault(); return spawnPoint.HasValue; } private void StartRun(RunManager rm) { EndRun(); runPtr = ((Il2CppObjectBase)rm).Pointer; scanner.ResetRun(rm); DebugImages.BeginRun(); runStartedAt = (groundedSince = -1f); spawnPoint = null; nextSpawnPointSearch = 0f; MinimapConfig settings = Mod.Settings; radius = Mathf.Clamp(settings.Radius.Value, settings.MinRadius.Value, settings.MaxRadius.Value); } private void EndRun() { runPtr = IntPtr.Zero; view.SetMap(null); mapper.Reset(); discovery.Reset(); } private void HandleKeys(MinimapConfig cfg) { Keyboard current = Keyboard.current; if (current != null) { if (Pressed(current, cfg.ToggleKey.Value)) { hidden = !hidden; } if (Pressed(current, cfg.ZoomInKey.Value)) { radius = Mathf.Max(cfg.MinRadius.Value, radius / 1.25f); } if (Pressed(current, cfg.ZoomOutKey.Value)) { radius = Mathf.Min(cfg.MaxRadius.Value, radius * 1.25f); } } } private static bool Pressed(Keyboard kb, string keyName) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(keyName) || !Enum.TryParse<Key>(keyName, ignoreCase: true, out Key result) || (int)result == 0) { return false; } KeyControl val = kb[result]; if (val != null) { return ((ButtonControl)val).wasPressedThisFrame; } return false; } private static float CameraYaw() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if (!((Object)(object)main != (Object)null)) { return 0f; } return ((Component)main).transform.eulerAngles.y; } } internal enum ScreenCorner { TopLeft, TopRight, BottomLeft, BottomRight } internal enum MapShape { Round, Square } internal enum MapStyle { Pixelated, Flat } internal sealed class MinimapConfig { public readonly ConfigEntry<bool> Enabled; public readonly ConfigEntry<string> ToggleKey; public readonly ConfigEntry<string> ZoomInKey; public readonly ConfigEntry<string> ZoomOutKey; public readonly ConfigEntry<ScreenCorner> Corner; public readonly ConfigEntry<MapShape> Shape; public readonly ConfigEntry<MapStyle> Style; public readonly ConfigEntry<bool> HighlightObstacles; public readonly ConfigEntry<bool> TrimOutsideArena; public readonly ConfigEntry<bool> PaintFromGameView; public readonly ConfigEntry<bool> LiftDarkGround; public readonly ConfigEntry<string> ObstacleKeywords; public readonly ConfigEntry<string> TintKeywords; public readonly ConfigEntry<float> Size; public readonly ConfigEntry<float> Margin; public readonly ConfigEntry<float> BottomOffset; public readonly ConfigEntry<float> Opacity; public readonly ConfigEntry<float> Radius; public readonly ConfigEntry<float> MinRadius; public readonly ConfigEntry<float> MaxRadius; public readonly ConfigEntry<float> BigEnemyHealth; public readonly ConfigEntry<bool> RotateWithCamera; public readonly ConfigEntry<bool> AvoidGameHud; public readonly ConfigEntry<bool> ShowEnemies; public readonly ConfigEntry<bool> ShowObjectives; public readonly ConfigEntry<bool> ShowPickups; public readonly ConfigEntry<bool> ShowTeammates; public readonly ConfigEntry<bool> ShowMoreEvents; public readonly ConfigEntry<bool> ShowMapFeatures; public readonly ConfigEntry<bool> HideUndiscoveredObjectives; public readonly ConfigEntry<bool> SaveDebugImages; public MinimapConfig(ConfigFile f) { //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Expected O, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Expected O, but got Unknown //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Expected O, but got Unknown //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Expected O, but got Unknown //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Expected O, but got Unknown Enabled = f.Bind<bool>("General", "Enabled", true, "Show the minimap during runs."); ToggleKey = f.Bind<string>("General", "ToggleKey", "M", "Key that hides or shows the minimap (Unity Input System key name, e.g. M, Tab, F6)."); ZoomInKey = f.Bind<string>("General", "ZoomInKey", "Equals", "Key that zooms in."); ZoomOutKey = f.Bind<string>("General", "ZoomOutKey", "Minus", "Key that zooms out."); Corner = f.Bind<ScreenCorner>("Layout", "Corner", ScreenCorner.BottomRight, "Screen corner for the minimap."); Shape = f.Bind<MapShape>("Layout", "Shape", MapShape.Round, "Round or square minimap."); Style = f.Bind<MapStyle>("Look", "Style", MapStyle.Pixelated, "Pixelated: a pixel-art picture of the level itself, taken at the start of each run. Flat: plain colours for ground and obstacles."); HighlightObstacles = f.Bind<bool>("Look", "HighlightObstacles", true, "Pixelated style: draw a rim around obstacles (rocks, trees, walls) so they stand out."); TrimOutsideArena = f.Bind<bool>("Look", "TrimOutsideArena", true, "Hide the ground beyond the arena's walls (where enemies come from). Turn off if a map loses parts it shouldn't."); PaintFromGameView = f.Bind<bool>("Look", "PaintFromGameView", false, "Experimental: recolour the minimap every few seconds with what the game camera shows. Off by default: the map keeps changing while you play."); ObstacleKeywords = f.Bind<string>("Look", "ObstacleKeywords", "rock,boulder,border,wall,cliff,pillar,stone,volcano,vulcano", "Scenery at least 1 unit tall whose material, mesh or object name contains one of these words is drawn as an obstacle (things you can't walk through), even if the game keeps its collider elsewhere. Pebbles, grass, bushes, flowers and trees never count. Comma-separated."); LiftDarkGround = f.Bind<bool>("Look", "LiftDarkGround", true, "Pixelated style: brighten the darkest patches of ground toward the map's lighter ground, so only obstacles are near-black. Helps on the fire and astral maps."); TintKeywords = f.Bind<string>("Look", "TintKeywords", "deathbush:962434", "Pixelated style: scenery whose material, mesh or object name contains the word is coloured on the map, as word:RRGGBB. Comma-separated (e.g. deathbush:962434)."); if (TintKeywords.Value == "deathbush:C8343C") { TintKeywords.Value = "deathbush:962434"; } Size = f.Bind<float>("Layout", "Size", 220f, new ConfigDescription("Side length in pixels at 1080p.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 600f), Array.Empty<object>())); Margin = f.Bind<float>("Layout", "Margin", 16f, new ConfigDescription("Gap from the screen edges in pixels at 1080p.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>())); BottomOffset = f.Bind<float>("Layout", "BottomOffset", 30f, new ConfigDescription("Extra gap below the minimap in a bottom corner, so it sits above the game's text bar (pixels at 1080p).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 400f), Array.Empty<object>())); AvoidGameHud = f.Bind<bool>("Layout", "AvoidGameHud", true, "Move the minimap out of the way of the game's HUD in its corner (collected artifacts, the revive counter, other mods' panels), and back when they're gone."); Opacity = f.Bind<float>("Layout", "Opacity", 0.85f, new ConfigDescription("Opacity of the whole minimap.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 1f), Array.Empty<object>())); Radius = f.Bind<float>("View", "Radius", 40f, new ConfigDescription("World units shown from the center to the edge when a run starts.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 500f), Array.Empty<object>())); MinRadius = f.Bind<float>("View", "MinRadius", 15f, new ConfigDescription("Closest zoom (world units).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 500f), Array.Empty<object>())); MaxRadius = f.Bind<float>("View", "MaxRadius", 120f, new ConfigDescription("Farthest zoom (world units).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 1000f), Array.Empty<object>())); RotateWithCamera = f.Bind<bool>("View", "RotateWithCamera", true, "Turn the map so up on the minimap is up on screen. Off = world-fixed."); ShowEnemies = f.Bind<bool>("Layers", "ShowEnemies", true, "Enemy dots: red for small enemies, orange for bigger ones, purple for mini-bosses (elites, the Hydra's healers, the Hoarder); bosses get their own icon."); BigEnemyHealth = f.Bind<float>("Layers", "BigEnemyHealth", 3f, new ConfigDescription("An enemy is drawn as a bigger (orange) one when its base health is at least this many times that of the swarm (the weakest common enemy).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.5f, 50f), Array.Empty<object>())); ShowObjectives = f.Bind<bool>("Layers", "ShowObjectives", true, "Objectives, the boss, downed teammates and danger pings."); ShowPickups = f.Bind<bool>("Layers", "ShowPickups", true, "Artifact, health and magnet pickups the game points at."); ShowTeammates = f.Bind<bool>("Layers", "ShowTeammates", true, "Other players."); ShowMoreEvents = f.Bind<bool>("Layers", "ShowMoreEvents", true, "MoreEvents targets and zones (only when MoreEvents is installed)."); ShowMapFeatures = f.Bind<bool>("Layers", "ShowMapFeatures", true, "Geysers on the ice map (yellow bursts), tornadoes on the fire map (following them as they move) and teleport portals (bright when open)."); HideUndiscoveredObjectives = f.Bind<bool>("Layers", "HideUndiscoveredObjectives", true, "Only show an objective once someone in the party has had it on screen. Discoveries are shared with other players who run this mod, through the host."); SaveDebugImages = f.Bind<bool>("Debug", "SaveDebugImages", false, "Save the level picture, the game-view colour sample and the finished minimap as PNGs in BepInEx/minimap-debug each run."); } } internal sealed class MinimapView { private const int DotTextureSize = 192; private const float DotOutline = 1.2f; private static readonly float[] RankRadius = new float[3] { 1.85f, 2.6f, 3.3f }; private static readonly Rgba[] RankColor = new Rgba[3] { new Rgba(235, 64, 52), new Rgba(byte.MaxValue, 150, 40), new Rgba(180, 90, byte.MaxValue) }; private const float BossSize = 26f; private static readonly Rgba EnemyOutline = new Rgba(20, 20, 22, 235); private const float SquareBorder = 2f; private static readonly Color FrameColor = new Color(0.85f, 0.88f, 0.95f, 0.9f); private static readonly Color Background = new Color(0.09f, 0.09f, 0.1f, 0.92f); private static readonly Color BadgeColor = new Color(0.08f, 0.08f, 0.09f, 0.95f); private static readonly Color Cream = new Color(0.99215686f, 0.972549f, 0.80784315f, 1f); private static readonly Color HealthColor = new Color(0.95f, 0.25f, 0.3f, 1f); private static readonly Color ObjectiveColor = new Color(1f, 0.85f, 0.3f, 1f); private static readonly Color BossColor = new Color(0.8f, 0.2f, 1f, 1f); private static readonly Color DownedColor = new Color(1f, 0.35f, 0.35f, 1f); private static readonly Color DangerColor = new Color(1f, 0.3f, 0.2f, 1f); private static readonly Color PickupColor = new Color(0.5f, 1f, 0.6f, 1f); private static readonly Color PortalOpen = new Color(0.62f, 0.99f, 0.98f, 1f); private static readonly Color PortalClosed = new Color(0.62f, 0.99f, 0.98f, 0.35f); private const float GeyserSize = 16f; private const float SpentGeyserSize = 14f; private const float EruptingGeyserSize = 19f; private const float PortalSize = 18f; private const float TornadoSize = 18f; private readonly MinimapConfig cfg; private readonly GameObject root; private readonly RectTransform frame; private readonly RectTransform panel; private readonly RectTransform mapRoot; private readonly Image frameImg; private readonly Image panelImg; private readonly Image bezel; private readonly RectMask2D squareMask; private readonly Mask roundMask; private readonly CanvasGroup group; private readonly RawImage layout; private readonly IconPool zones; private readonly IconPool icons; private readonly Image you; private readonly PixelBuffer dotPixels = new PixelBuffer(192, 192); private readonly List<(float x, float y, int rank)> dotSpots = new List<(float, float, int)>(); private readonly Texture2D dotTexture; private readonly Sprite disc; private readonly Sprite ring; private readonly Sprite arrow; private readonly Sprite diamond; private readonly Sprite roundShape; private readonly Sprite badgeRing; private readonly Sprite burst; private readonly Sprite burstErupting; private readonly Sprite burstSpent; private readonly Sprite portal; private readonly Sprite tornado; private readonly Sprite boss; private readonly Sprite ghost; private readonly HashSet<ulong> knownGroups = new HashSet<ulong>(); private const float GhostSize = 16f; private const float PillarSize = 18f; private static readonly Color PillarIdle = new Color(0.36f, 0.62f, 1f, 1f); private static readonly Color PillarCorrect = new Color(0.36f, 0.95f, 0.45f, 1f); private static readonly Color PillarWrong = new Color(1f, 0.32f, 0.3f, 1f); private BakedMap map; private bool visible = true; private bool dotsEmpty; private bool round; private float panelInset = 2f; private float lastSize = -1f; private float lastMargin = -1f; private float lastBottomOffset = -1f; private float lastLift = -1f; private float lift; private readonly HudAvoider hud = new HudAvoider(); private readonly Canvas canvas; private const float HudGap = 8f; private const float MaxHudMoveShare = 0.45f; private ScreenCorner lastCorner = (ScreenCorner)(-1); private MapShape lastShape = (MapShape)(-1); public MinimapView(MinimapConfig cfg) { //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) this.cfg = cfg; disc = SpriteFactory.ToSprite(ShapeSprites.Disc(32, 0.12f)); ring = SpriteFactory.ToSprite(ShapeSprites.Ring(128, 0.03f)); arrow = SpriteFactory.ToSprite(ShapeSprites.Arrow(32)); diamond = SpriteFactory.ToSprite(ShapeSprites.Diamond(32, 0.1f)); roundShape = SpriteFactory.ToSprite(ShapeSprites.Disc(256, 0f)); badgeRing = SpriteFactory.ToSprite(ShapeSprites.Ring(64, 0.12f)); burst = SpriteFactory.ToSprite(ShapeSprites.Burst(48)); burstErupting = SpriteFactory.ToSprite(ShapeSprites.Burst(48, new Rgba(byte.MaxValue, 140, 30), new Rgba(214, 80, 12))); burstSpent = SpriteFactory.ToSprite(ShapeSprites.Burst(48, new Rgba(150, 152, 158), new Rgba(112, 114, 120))); portal = SpriteFactory.ToSprite(ShapeSprites.Portal(48)); tornado = SpriteFactory.ToSprite(ShapeSprites.Tornado(48)); boss = SpriteFactory.ToSprite(ShapeSprites.BossSkull(64, new Rgba(222, 58, 58))); ghost = SpriteFactory.ToSprite(ShapeSprites.Ghost(48)); root = new GameObject("SpellBrigadeMinimap"); Object.DontDestroyOnLoad((Object)(object)root); canvas = root.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 300; CanvasScaler obj = root.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.matchWidthOrHeight = 1f; frameImg = UiBuilder.NewImage("Frame", root.transform); ((Graphic)frameImg).color = FrameColor; frame = ((Graphic)frameImg).rectTransform; group = ((Component)frame).gameObject.AddComponent<CanvasGroup>(); group.blocksRaycasts = false; group.interactable = false; panelImg = UiBuilder.NewImage("Panel", (Transform)(object)frame); ((Graphic)panelImg).color = Background; panel = ((Graphic)panelImg).rectTransform; UiBuilder.Stretch(panel, 2f); squareMask = ((Component)panel).gameObject.AddComponent<RectMask2D>(); roundMask = ((Component)panel).gameObject.AddComponent<Mask>(); roundMask.showMaskGraphic = true; mapRoot = UiBuilder.NewRect("MapRoot", (Transform)(object)panel); layout = UiBuilder.NewRawImage("Layout", (Transform)(object)mapRoot); ((Behaviour)layout).enabled = false; zones = new IconPool(UiBuilder.NewRect("Zones", (Transform)(object)panel)); RawImage obj2 = UiBuilder.NewRawImage("Enemies", (Transform)(object)panel); UiBuilder.Stretch(((Graphic)obj2).rectTransform, 0f); dotTexture = SpriteFactory.ToTexture(dotPixels, (FilterMode)1, keepReadable: true); obj2.texture = (Texture)(object)dotTexture; icons = new IconPool(UiBuilder.NewRect("Icons", (Transform)(object)panel)); you = UiBuilder.NewImage("You", (Transform)(object)panel); you.sprite = arrow; ((Graphic)you).rectTransform.sizeDelta = new Vector2(18f, 18f); bezel = UiBuilder.NewImage("Bezel", (Transform)(object)frame); bezel.sprite = SpriteFactory.ToSprite(ShapeSprites.Bezel(384)); UiBuilder.Stretch(((Graphic)bezel).rectTransform, 0f); ApplyLayout(); } public void SetVisible(bool show) { if (show != visible) { visible = show; root.SetActive(show); } } public void SetMap(BakedMap baked) { map = baked; layout.texture = (Texture)(object)baked?.Texture; ((Behaviour)layout).enabled = baked != null; } public void Render(WorldScanner s, List<EventMarker> markers, ObjectiveDiscovery discovery, float yaw, float radius) { //IL_00d3: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) lift = (cfg.AvoidGameHud.Value ? hud.Tick(Time.unscaledTime, Time.unscaledDeltaTime, HomeScreenBox(out var bottom), bottom, canvas, Mathf.Max(0.01f, canvas.scaleFactor), 8f, 486f) : 0f); ApplyLayout(); group.alpha = cfg.Opacity.Value; float num = (cfg.Size.Value - 2f * panelInset) * 0.5f; MapView view = new MapView(s.Center, yaw, radius, num); float scale = view.Scale; ((Transform)mapRoot).localEulerAngles = new Vector3(0f, 0f, yaw); if (map != null) { RectTransform rectTransform = ((Graphic)layout).rectTransform; rectTransform.sizeDelta = new Vector2(map.WorldWidth * scale, map.WorldHeight * scale); float num2 = map.OriginX + map.WorldWidth * 0.5f - s.Center.X; float num3 = map.OriginZ + map.WorldHeight * 0.5f - s.Center.Y; rectTransform.anchoredPosition = new Vector2(num2 * scale, num3 * scale); } zones.Begin(); if (cfg.ShowMoreEvents.Value) { foreach (EventMarker marker in markers) { if (marker.Zone && marker.Radius > 0f) { zones.Place(ring, marker.Color, ToUnity(MapMath.WorldToPanel(in view, marker.Pos)), marker.Radius * 2f * scale, 0f); } } } if (cfg.ShowMapFeatures.Value) { foreach (GeyserDot geyser in s.Geysers) { if (geyser.State != GeyserState.Erupting) { DrawFeature(zones, (geyser.State == GeyserState.Ready) ? burst : burstSpent, Color.white, geyser.Pos, in view, (geyser.State == GeyserState.Ready) ? 16f : 14f); } } } zones.End(); DrawEnemies(s, in view); icons.Begin(); if (cfg.ShowMapFeatures.Value) { foreach (FeatureDot feature in s.Features) { if (feature.Kind == FeatureKind.Portal) { DrawFeature(icons, portal, feature.Active ? PortalOpen : PortalClosed, feature.Pos, in view, 18f); } } } if (cfg.ShowMapFeatures.Value) { foreach (Vector2 tornado in s.Tornadoes) { DrawFeature(icons, this.tornado, Color.white, tornado, in view, 18f); } float unscaledTime = Time.unscaledTime; foreach (GeyserDot geyser2 in s.Geysers) { if (geyser2.State == GeyserState.Erupting) { DrawFeature(icons, burstErupting, Color.white, geyser2.Pos, in view, 19f, new Vector2(Mathf.Sin(unscaledTime * 53f) * 1.3f, Mathf.Cos(unscaledTime * 61f) * 1.1f), Mathf.Sin(unscaledTime * 41f) * 7f); } } } knownGroups.Clear(); foreach (Poi poi in s.Pois) { if ((Object)(object)poi.Pillar != (Object)null && (discovery.IsKnown(poi.Key) || discovery.IsKnown(poi.GroupKey))) { knownGroups.Add(poi.GroupKey); } } foreach (Poi poi2 in s.Pois) { if (poi2.Kind != PoiKind.Boss || s.Bosses.Count <= 0 || !cfg.ShowEnemies.Value) { DrawPoi(poi2, in view, discovery); } } if (cfg.ShowEnemies.Value) { foreach (Vector2 boss in s.Bosses) { DrawPoint(this.boss, Color.white, MapMath.WorldToPanel(in view, boss), 26f, num, clamp: true); } } if (cfg.ShowMoreEvents.Value) { foreach (EventMarker marker2 in markers) { if (!marker2.Zone) { DrawPoint(diamond, marker2.Color, MapMath.WorldToPanel(in view, marker2.Pos), 16f, num, clamp: true); } } } if (cfg.ShowTeammates.Value) { foreach (PlayerDot player in s.Players) { DrawPoint(player.Ghost ? ghost : disc, player.Color, MapMath.WorldToPanel(in view, player.Pos), player.Ghost ? 16f : 13f, num, clamp: true); } } icons.End(); ((Transform)((Graphic)you).rectTransform).localEulerAngles = new Vector3(0f, 0f, MapMath.HeadingToPanelAngle(s.Facing, yaw)); } private void DrawEnemies(WorldScanner s, in MapView view) { bool flag = false; dotPixels.Clear(); if (cfg.ShowEnemies.Value) { float num = 192f / (2f * view.HalfSize); dotSpots.Clear(); foreach (EnemyDot enemy in s.Enemies) { Vector2 vector = MapMath.WorldToPanel(in view, enemy.Pos); if (MapMath.IsInside(vector, view.HalfSize)) { flag = true; float num2 = (vector.X + view.HalfSize) * num; float num3 = (vector.Y + view.HalfSize) * num; int num4 = Mathf.Min((int)enemy.Rank, RankRadius.Length - 1); dotSpots.Add((num2, num3, num4)); dotPixels.FillCircle(num2, num3, RankRadius[num4] + 1.2f, EnemyOutline); } } for (int i = 0; i < RankRadius.Length; i++) { foreach (var dotSpot in dotSpots) { var (cx, cy, _) = dotSpot; if (dotSpot.rank == i) { dotPixels.FillCircle(cx, cy, RankRadius[i], RankColor[i]); } } } } if (flag || !dotsEmpty) { SpriteFactory.Upload(dotTexture, dotPixels, keepReadable: true); dotsEmpty = !flag; } } private void DrawPoi(Poi poi, in MapView view, ObjectiveDiscovery discovery) { //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Invalid comparison between Unknown and I4 //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)poi.Target == (Object)null) { return; } bool flag = poi.Kind == PoiKind.Pickup || poi.Kind == PoiKind.Health; if (flag ? (!cfg.ShowPickups.Value) : (!cfg.ShowObjectives.Value)) { return; } bool flag2 = discovery.IsKnown(poi.Key) || ((Object)(object)poi.Pillar != (Object)null && knownGroups.Contains(poi.GroupKey)); if (poi.Kind == PoiKind.Objective && cfg.HideUndiscoveredObjectives.Value && !flag2) { return; } Vector3 position = poi.Target.position; Vector2 vector = MapMath.WorldToPanel(in view, new Vector2(position.x, position.z)); if ((Object)(object)poi.Pillar != (Object)null) { if (round ? MapMath.IsInsideCircle(vector, view.HalfSize) : MapMath.IsInside(vector, view.HalfSize)) { Color val = PillarIdle; try { OrderObjectiveInteractableState state = poi.Pillar.state; val = (((int)state == 1) ? PillarCorrect : (((int)state == 2) ? PillarWrong : PillarIdle)); } catch { } Vector2 position2 = ToUnity(vector); icons.Place(disc, BadgeColor, position2, 18f, 0f); icons.Place(badgeRing, val, position2, 18f, 0f); if ((Object)(object)poi.Sprite != (Object)null) { icons.Place(poi.Sprite, Color.Lerp(val, Color.white, 0.35f), position2, 11.88f, 0f); } else { icons.Place(disc, val, position2, 9f, 0f); } } } else if (flag) { if (round ? MapMath.IsInsideCircle(vector, view.HalfSize) : MapMath.IsInside(vector, view.HalfSize)) { bool num = poi.Kind == PoiKind.Health; float num2 = (num ? 24f : 18f); Vector2 position3 = ToUnity(vector); icons.Place(disc, BadgeColor, position3, num2, 0f); if (num) { icons.Place(badgeRing, Cream, position3, num2, 0f); } if ((Object)(object)poi.Sprite != (Object)null) { icons.Place(poi.Sprite, poi.Color, position3, num2 * 0.7f, 0f); } else { icons.Place(disc, KindColor(poi.Kind), position3, num2 * 0.5f, 0f); } } } else { Sprite sprite = (((Object)(object)poi.Sprite != (Object)null) ? poi.Sprite : diamond); Color color = (((Object)(object)poi.Sprite != (Object)null) ? poi.Color : KindColor(poi.Kind)); float size = ((poi.Kind == PoiKind.Boss) ? 24f : 20f); DrawPoint(sprite, color, vector, size, view.HalfSize, poi.ClampToEdge); } } private void DrawFeature(IconPool pool, Sprite sprite, Color color, Vector2 world, in MapView view, float size, Vector2 shake = default(Vector2), float tilt = 0f) { //IL_0033: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Vector2 v = MapMath.WorldToPanel(in view, world); if (round ? MapMath.IsInsideCircle(v, view.HalfSize) : MapMath.IsInside(v, view.HalfSize)) { pool.Place(sprite, color, ToUnity(v) + shake, size, tilt); } } private void DrawPoint(Sprite sprite, Color color, Vector2 p, float size, float half, bool clamp) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ce: Unknown result type (might be due to invalid IL or missing references) if (round ? MapMath.IsInsideCircle(p, half) : MapMath.IsInside(p, half)) { icons.Place(sprite, color, ToUnity(p), size, 0f); } else if (clamp) { Vector2 clamped; float angleDegrees; Vector2 clamped2; float angleDegrees2; if (round) { MapMath.ClampToCircle(p, half, size * 0.5f + 8f, out clamped, out angleDegrees); MapMath.ClampToCircle(p, half, 5f, out clamped2, out angleDegrees2); } else { MapMath.ClampToEdge(p, half, size * 0.5f + 8f, out clamped, out angleDegrees); MapMath.ClampToEdge(p, half, 5f, out clamped2, out angleDegrees2); } icons.Place(sprite, color, ToUnity(clamped), size * 0.8f, 0f); icons.Place(arrow, color, ToUnity(clamped2), 10f, angleDegrees - 90f); } } private static Color KindColor(PoiKind kind) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) return (Color)(kind switch { PoiKind.Boss => BossColor, PoiKind.Downed => DownedColor, PoiKind.Danger => DangerColor, PoiKind.Pickup => PickupColor, PoiKind.Health => HealthColor, _ => ObjectiveColor, }); } private void ApplyLayout() { //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) MapShape value = cfg.Shape.Value; float value2 = cfg.Size.Value; float value3 = cfg.Margin.Value; float value4 = cfg.BottomOffset.Value; ScreenCorner value5 = cfg.Corner.Value; if (value != lastShape || value2 != lastSize || value3 != lastMargin || value4 != lastBottomOffset || value5 != lastCorner || lift != lastLift) { lastShape = value; lastSize = value2; lastMargin = value3; lastBottomOffset = value4; lastCorner = value5; lastLift = lift; round = value == MapShape.Round; ((Behaviour)frameImg).enabled = !round; panelImg.sprite = (round ? roundShape : null); ((Behaviour)roundMask).enabled = round; ((Behaviour)squareMask).enabled = !round; ((Behaviour)bezel).enabled = round; panelInset = (round ? Mathf.Max(1f, value2 * 0.05f - 1f) : 2f); UiBuilder.Stretch(panel, panelInset); bool flag = value5 == ScreenCorner.TopRight || value5 == ScreenCorner.BottomRight; bool flag2 = value5 == ScreenCorner.TopLeft || value5 == ScreenCorner.TopRight; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(flag ? 1f : 0f, flag2 ? 1f : 0f); frame.anchorMin = val; frame.anchorMax = val; frame.pivot = val; frame.anchoredPosition = new Vector2(flag ? (0f - value3) : value3, flag2 ? (0f - (value3 + lift)) : (value3 + value4 + lift)); frame.sizeDelta = new Vector2(value2, value2); } } private ScreenBox HomeScreenBox(out bool bottom) { ScreenCorner value = cfg.Corner.Value; bool num = value == ScreenCorner.TopRight || value == ScreenCorner.BottomRight; bottom = value == ScreenCorner.BottomLeft || value == ScreenCorner.BottomRight; float num2 = Mathf.Max(0.01f, canvas.scaleFactor); float num3 = cfg.Size.Value * num2; float num4 = cfg.Margin.Value * num2; float num5 = (cfg.Margin.Value + cfg.BottomOffset.Value) * num2; float num6 = Screen.width; float num7 = Screen.height; float num8 = (num ? (num6 - num4 - num3) : num4); float num9 = (bottom ? num5 : (num7 - num4 - num3)); return new ScreenBox(num8, num9, num8 + num3, num9 + num3); } private static Vector2 ToUnity(Vector2 v) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector2(v.X, v.Y); } } internal static class Mod { internal static ManualLogSource Log; internal static MinimapConfig Settings; } internal static class LogOnce { private static readonly HashSet<string> seen = new HashSet<string>(); public static void Warn(string key, string message) { if (Mod.Log != null && seen.Add(key)) { Mod.Log.LogWarning((object)message); } } public static void Error(string where, Exception e) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown string item = where + ":" + e.GetType().FullName + ":" + e.Message; if (Mod.Log != null && seen.Add(item)) { ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(2, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(where); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(e); } log.LogError(val); } } } internal struct EventMarker { public Vector2 Pos; public float Radius; public Color Color; public bool Zone; } internal sealed class MoreEventsBridge { private const int KindRing = 0; private const int KindFollow = 1; private const int KindSafe = 3; private bool resolved; private bool available; private FieldInfo current; private FieldInfo markers; private FieldInfo kind; private FieldInfo pos; private FieldInfo radius; private FieldInfo netId; private FieldInfo color; public void Collect(List<EventMarker> output) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) output.Clear(); if (!resolved) { Resolve(); } if (!available) { return; } try { object value = current.GetValue(null); if (value == null || !(markers.GetValue(value) is IList list)) { return; } foreach (object item in list) { if (item == null) { continue; } int num = Convert.ToInt32(kind.GetValue(item)); Color val = (Color)color.GetValue(item); val.a = 1f; if (num == 1) { if (TryNetworkObjectPosition((ulong)netId.GetValue(item), out var position)) { output.Add(new EventMarker { Pos = new Vector2(position.x, position.z), Color = val }); } } else { Vector3 val2 = (Vector3)pos.GetValue(item); output.Add(new EventMarker { Pos = new Vector2(val2.x, val2.z), Radius = (float)radius.GetValue(item), Color = val, Zone = (num == 0 || num == 3) }); } } } catch (Exception e) { available = false; LogOnce.Error("reading MoreEvents markers (event markers turned off)", e); } } private static bool TryNetworkObjectPosition(ulong id, out Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) position = default(Vector3); NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.SpawnManager == null) { return false; } Dictionary<ulong, NetworkObject> spawnedObjects = singleton.SpawnManager.SpawnedObjects; if (spawnedObjects == null || !spawnedObjects.ContainsKey(id)) { return false; } NetworkObject val = spawnedObjects[id]; if ((Object)(object)val == (Object)null) { return false; } position = ((Component)val).transform.position; return true; } private void Resolve() { resolved = true; Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "MoreEvents"); if (assembly == null) { Mod.Log.LogInfo((object)"MoreEvents isn't installed; event markers are off."); return; } current = assembly.GetType("MoreEvents.Net")?.GetField("Current", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); markers = assembly.GetType("MoreEvents.EventState")?.GetField("Markers", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); Type type = assembly.GetType("MoreEvents.Marker"); kind = type?.GetField("Kind", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); pos = type?.GetField("Pos", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); radius = type?.GetField("Radius", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); netId = type?.GetField("NetId", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); color = type?.GetField("Color", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); available = current != null && markers != null && kind != null && pos != null && radius != null && netId != null && color != null; if (available) { Mod.Log.LogInfo((object)"MoreEvents found; showing its event markers."); } else { LogOnce.Warn("moreevents-shape", "MoreEvents is installed but its marker fields changed; event markers are off."); } } } internal sealed class BakedMap { public Texture2D Texture; public float OriginX; public float OriginZ; public float WorldWidth; public float WorldHeight; public void Destroy() { if ((Object)(object)Texture != (Object)null) { Object.Destroy((Object)(object)Texture); } Texture = null; } } internal sealed class NavMeshMapper { private sealed class MapTint { public float[] Cover; public Rgba Color; public float Strength; public Rgba? Edge; } private const int GridSize = 768; private const float CellSize = 1f; private const float ProbeRange = 3f; private const float MaxCellOffset = 0.6f; private const float SeedSearchRange = 60f; private const float GroundedTolerance = 1.5f; private const int NavMeshAllAreas = -1; private const double FrameBudgetMs = 2.0; private const int ProbesPerSlice = 64; private const int Padding = 2; private const int ArtPadding = 12; private const float PreviewSeconds = 1f; private const float RetrySeconds = 2f; private const int MaxRetries = 10; private const int GameViewWidth = 480; private const float Trim = 0.05f; private const int MinObstacleCells = 3; private const int ArenaSealRadius = 2; private const float MaxTintShift = 6f; private const int CalmRadius = 5; private const float CalmStrength = 0.8f; private const float CalmLift = 0.7f; private const float SolidHeight = 1f; private const float RayStartHeight = 30f; private const float MaxSolidShare = 0.6f; private const int PhysicsMask = -33; private const float SolidCoverage = 0.5f; private const float PaintSeconds = 2.5f; private const float PaintMinSamples = 3f; private const float OccluderHeight = 4f; private const float LiftFloor = 0.8f; private const float LiftKeep = 0.3f; private const float TintCoverage = 0.3f; private const float TintStrength = 0.85f; private const float RiverStrength = 0.55f; private const int RiverMinDiff = 4; private static readonly Rgba RiverWater = new Rgba(132, 124, 200); private static readonly Rgba RiverBank = new Rgba(214, 204, 240); private static readonly MapPalette FlatPalette = new MapPalette(new Rgba(58, 66, 74), new Rgba(253, 248, 206), new Rgba(34, 37, 42), new Rgba(16, 16, 18)); private static readonly MapPalette ArtPalette = new MapPalette(default(Rgba), new Rgba(253, 248, 206), new Rgba(16, 16, 18), new Rgba(16, 16, 18)); private static readonly GroundProbe Probe = ProbeNavMesh; private static bool usePhysics = true; private static int solidCells; private static readonly int[] solidLayers = new int[32]; private WalkableFlood flood; private CellClass[] classes; private SceneryScan scenery; private PixelBuffer rawArt; private PixelBuffer baseArt; private List<MapTint> tints; private ViewPainter painter; private CropRect artCrop; private float floodStarted; private float nextPreview; private float nextRetry; private float nextPaint; private int retries; private int probes; private double busyMs; private bool failed; private bool radarLogged; private bool artFailed; private bool artShown; private bool savedFinal; public BakedMap Map { get; private set; } public void Reset() { flood = null; classes = null; scenery = null; rawArt = (baseArt = null); tints = null; painter = null; retries = 0; failed = (radarLogged = (artFailed = (artShown = (savedFinal = false)))); usePhysics = true; Map?.Destroy(); Map = null; } public void SeedNear(float now, Vector3 near) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (failed) { return; } try { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(near, ref val, 60f, -1)) { Vector3 position = ((NavMeshHit)(ref val)).position; if (flood == null) { flood = new WalkableFlood(768, 1f, position.x, position.z); floodStarted = now; nextRetry = now + 2f; probes = 0; busyMs = 0.0; solidCells = 0; Array.Clear(solidLayers, 0, solidLayers.Length); } if (flood.StateAt(position.x, position.z) == CellState.Unknown) { flood.Seed(position.x, position.z, position.y); } } } catch (Exception e) { failed = true; LogOnce.Error("reading the NavMesh (showing radar mode)", e); } } public bool IsOnGround(Vector3 p) { //IL_000e: 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_0023: Unknown result type (might be due to invalid IL or missing references) if (flood != null && flood.TryGroundHeight(p.x, p.z, out var y)) { return Math.Abs(p.y - y) <= 1.5f; } return false; } public bool Tick(float now, bool viewSettled, Vector3 player) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (failed || flood == null) { return false; } try { if (!flood.HasWork) { if (flood.WalkableCount == 0) { RetryOrGiveUp(now); return false; } if (rawArt == null || !viewSettled) { return false; } if (!artShown) { artShown = true; nextPaint = now + 2.5f; return ShowArt(player); } if (painter != null && Mod.Settings.PaintFromGameView.Value && now >= nextPaint) { nextPaint = now + 2.5f; return PaintGameView(player); } return false; } Stopwatch stopwatch = Stopwatch.StartNew(); while (flood.HasWork && stopwatch.Elapsed.TotalMilliseconds < 2.0) { probes += flood.Step(64, Probe); } busyMs += stopwatch.Elapsed.TotalMilliseconds; if (!flood.HasWork) { if (usePhysics && (float)solidCells > (float)(flood.WalkableCount + solidCells) * 0.6f) { Mod.Log.LogWarning((object)($"{solidCells} of {flood.WalkableCount + solidCells} ground cells are under solid scenery; " + "that looks wrong (an invisible ceiling?), so the map is redone from the NavMesh alone.")); usePhysics = false; flood = null; return false; } scenery = ScanScenery(); classes = ClassifyArena(SolidSceneryCells()); bool result = Replace(MapPainter.Paint(flood, classes, in FlatPalette, 2), (FilterMode)1); LogFinished(now); TakePicture(); return result; } if (now >= nextPreview) { nextPreview = now + 1f; return Replace(MapPainter.Paint(flood, null, in FlatPalette, 2), (FilterMode)1); } return false; } catch (Exception e) { failed = true; LogOnce.Error("building the minimap (showing radar mode)", e); return false; } } private SceneryScan ScanScenery() { if (!MapPainter.TryCrop(flood, 12, out var crop)) { return null; } try { float num = flood.OriginX + (float)crop.X * 1f; float num2 = flood.OriginZ + (float)crop.Y * 1f; return SceneryScan.Run(num, num2, num + (float)crop.Width * 1f, num2 + (float)crop.Height * 1f, Mod.Settings.ObstacleKeywords.Value, Mod.Settings.TintKeywords.Value, Mod.Settings.SaveDebugImages.Value); } catch (Exception e) { LogOnce.Error("looking at the scenery", e); return null; } } private bool[] SolidSceneryCells() { //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown if (scenery == null || scenery.Solid.Count == 0 || !MapPainter.TryCrop(flood, 12, out var crop)) { return null; } try { int layer = LevelSnapshot.FreeLayer(); if (layer < 0) { LogOnce.Warn("no-free-layer", "No unused layer to render scenery on; obstacles come from the NavMesh and physics only."); return null; } float ox = flood.OriginX + (float)crop.X * 1f; float oz = flood.OriginZ + (float)crop.Y * 1f; float[] array = LevelSnapshot.OnLayer(scenery.Solid.Select((Renderer r) => ((Component)r).gameObject), layer, () => LevelSnapshot.CaptureCoverage(ox, oz, crop.Width, crop.Height, 1f, flood.MaxHeight, layer)); int size = flood.Size; int num = 0; bool[] array2 = new bool[size * size]; PixelBuffer pixelBuffer = new PixelBuffer(crop.Width, crop.Height); for (int num2 = 0; num2 < crop.Height; num2++) { for (int num3 = 0; num3 < crop.Width; num3++) { if (!(array[num2 * crop.Width + num3] < 0.5f)) { array2[(crop.Y + num2) * size + crop.X + num3] = true; pixelBuffer.SetPixel(num3, num2, Rgba.White); num++; } } } DebugImages.Save("0b-solid-scenery", pixelBuffer); ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Solid scenery covers "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cells."); } log.LogInfo(val); return array2; } catch (Exception e) { LogOnce.Error("finding solid scenery", e); return null; } } private CellClass[] ClassifyArena(bool[] solid) { bool[] array = null; if (Mod.Settings.TrimOutsideArena.Value) { array = ArenaFinder.FindOuterBand(flood, 2, out var kept, solid); Mod.Log.LogInfo((object)((array != null) ? $"Arena walls found: keeping {kept:P0} of the NavMesh, the rest is beyond the walls." : $"No enclosing arena wall found (arena would keep {kept:P0}); showing all of the NavMesh.")); } bool[] array2 = array; if (solid != null) { array2 = (bool[])solid.Clone(); if (array != null) { for (int i = 0; i < array2.Length; i++) { ref bool reference = ref array2[i]; reference |= array[i]; } } } CellClass[] array3 = MapPainter.Classify(flood, 3, array2); SaveCellMap(array3, array); return array3; } private void SaveCellMap(CellClass[] cls, bool[] band) { if (!Mod.Settings.SaveDebugImages.Value || !MapPainter.TryCrop(flood, 2, out var crop)) { return; } PixelBuffer pixelBuffer = new PixelBuffer(crop.Width, crop.Height); int size = flood.Size; for (int i = 0; i < crop.Height; i++) { for (int j = 0; j < crop.Width; j++) { int num = (crop.Y + i) * size + crop.X + j; Rgba c = ((band != null && band[num]) ? new Rgba(60, 110, 200) : ((cls[num] == CellClass.Walkable) ? new Rgba(150, 150, 150) : ((cls[num] == CellClass.Obstacle) ? new Rgba(150, 90, 40) : Rgba.Clear))); pixelBuffer.SetPixel(j, i, c); } } DebugImages.Save("0-cells", pixelBuffer); } private void RetryOrGiveUp(float now) { if (retries >= 10) { if (!radarLogged) { radarLogged = true; Mod.Log.LogWarning((object)"No NavMesh ground found around the player; showing radar mode (dots without a layout)."); } } else if (!(now < nextRetry)) { retries++; flood = null; } } private void TakePicture() { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown rawArt = (baseArt = null); tints = null; painter = null; bool flag = (artShown = (savedFinal = false)); if (artFailed || Mod.Settings.Style.Value != MapStyle.Pixelated || !MapPainter.TryCrop(flood, 12, out artCrop)) { return; } float num = flood.OriginX + (float)artCrop.X * 1f; float num2 = flood.OriginZ + (float)artCrop.Y * 1f; try { Stopwatch stopwatch = Stopwatch.StartNew(); rawArt = LevelSnapshot.CaptureLevel(num, num2, artCrop.Width, artCrop.Height, 1f, flood.MaxHeight, scenery?.Effects); DebugImages.Save("1-level-picture", rawArt); ManualLogSource log = Mod.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Captured level picture: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(artCrop.Width); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" x "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(artCrop.Height); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" pixels in "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<long>(stopwatch.ElapsedMilliseconds); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ms."); } log.LogInfo(val); } catch (Exception e) { artFailed = true; LogOnce.Error("taking the level picture (keeping the flat map)", e); return; } tints = CaptureTints(num, num2); } private List<MapTint> CaptureTints(float ox, float oz) { //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown List<MapTint> list = new List<MapTint>(); if (scenery == null) { return list; } List<(IEnumerable<Renderer>, string, Rgba, float, Rgba?)> list2 = new List<(IEnumerable<Renderer>, string, Rgba, float, Rgba?)>(); foreach (SceneryScan.TintGroup tint in scenery.Tints) { if (tint.Renderers.Count > 0) { list2.Add((tint.Renderers, tint.Word, tint.Color, 0.85f, null)); } } if (scenery.Rivers.Count > 0) { list2.Add((scenery.Rivers, "river", RiverWater, 0.55f, RiverBank)); } if (list2.Count == 0) { return list; } try { int layer = LevelSnapshot.FreeLayer(); if (layer < 0) { return list; } PixelBuffer pixelBuffer = new PixelBuffer(artCrop.Width, artCrop.Height); bool flag = default(bool); foreach (var item in list2) { float[] array = LevelSnapshot.OnLayer(from r in item.Item1 where (Object)(object)r != (Object)null select ((Component)r).gameObject, layer, () => LevelSnapshot.CaptureCoverage(ox, oz, artCrop.Width, artCrop.Height, 1f, flood.MaxHeight, layer)); if (item.Item5.HasValue) { List<Renderer> list3 = new List<Renderer>(item.Item1); if (scenery.Effects != null) { list3.AddRange(scenery.Effects); } PixelBuffer pixelBuffer2 = LevelSnapshot.CaptureLevel(ox, oz, artCrop.Width, artCrop.Height, 1f, flood.MaxHeight, list3); DebugImages.Save("1c-without-river", pixelBuffer2); array = ArtFilter.VisibleOnly(array, rawArt, pixelBuffer2, 0.3f, 4); } int num = 0; for (int num2 = 0; num2 < array.Length; num2++) { if (array[num2] >= 0.3f) { num++; pixelBuffer.SetPixel(num2 % artCrop.Width, num2 / artCrop.Width, item.Item3); } } ManualLogSource log = Mod.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Tint '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.Item2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' covers "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cells."); } log.LogInfo(val); if (num > 0) { list.Add(new MapTint { Cover = array, Color = item.Item3, Strength = item.Item4, Edge = item.Item5 }); } } DebugImages.Save("1b-tints", pixelBuffer); } catch (Exception e) { LogOnce.Error("finding tinted scenery and the river", e); } return list; } private bool ShowArt(Vector3 player) { //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown baseArt = rawArt; PixelBuffer pixelBuffer = null; Matrix4x4 clipToWorld = default(Matrix4x4); try { pixelBuffer = LevelSnapshot.CaptureGameView(480, out clipToWorld); DebugImages.Save("2-game-view", pixelBuffer); if (pixelBuffer != null) { ColorStats to = ColorMatch.Measure(pixelBuffer, Paintable(pixelBuffer), 0.05f); int n = flood.Size; ColorStats from = ColorMatch.Measure(rawArt, (int x, int y) => classes[(artCrop.Y + y) * n + artCrop.X + x] != CellClass.Outside, 0.05f); if (to.Count > 100 && from.Count > 100) { baseArt = ColorMatch.Transfer(rawArt, in from, in to, 6f); ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Matched level picture colours. Picture: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ColorStats>(from); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". Game view: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ColorStats>(to); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } } } catch (Exception e) { LogOnce.Error("matching the level picture's colours (showing it unmatched)", e); } painter = new ViewPainter(artCrop.Width, artCrop.Height, flood.OriginX + (float)artCrop.X * 1f, flood.OriginZ + (float)artCrop.Y * 1f, 1f); if (pixelBuffer != null && Mod.Settings.PaintFromGameView.Value) { PaintInto(pixelBuffer, clipToWorld, player); } return Recompose(); } private bool PaintGameView(Vector3 player) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) try { Matrix4x4 clipToWorld; PixelBuffer pixelBuffer = LevelSnapshot.CaptureGameView(480, out clipToWorld); if (pixelBuffer == null) { return false; } PaintInto(pixelBuffer, clipToWorld, player); return Recompose(); } catch (Exception e) { painter = null; LogOnce.Error("painting the game view onto the minimap", e); return false; } } private void PaintInto(PixelBuffer view, Matrix4x4 clipToWorld, Vector3 player) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) float y; float groundY = (flood.TryGroundHeight(player.x, player.z, out y) ? y : player.y); int n = flood.Size; painter.AddView(view, clipToWorld, groundY, Paintable(view), (int cx, int cy) => classes[(artCrop.Y + cy) * n + artCrop.X + cx] != CellClass.Walkable, 4f); } private static Func<int, int, bool> Paintable(PixelBuffer view) { float cx = (float)view.Width * 0.5f; float cy = (float)view.Height * 0.5f; float rMin = (float)view.Height * 0.25f; float mx = (float)view.Width * 0.04f; float my = (float)view.Height * 0.04f; return delegate(int x, int y) { if ((float)x < mx || (float)x > (float)view.Width - mx || (float)y < my || (float)y > (float)view.Height - my) { return false; } float num = (float)x + 0.5f - cx; float num2 = (float)y + 0.5f - cy; if (num * num + num2 * num2 < rMin * rMin) { return false; } Rgba pixel = view.GetPixel(x, y); int num3 = Math.Max(pixel.R, Math.Max(pixel.G, pixel.B)); int num4 = Math.Min(pixel.R, Math.Min(pixel.G, pixel.B)); return num3 - num4 <= 110 && num3 <= 235; }; } private bool Recompose() { try { PixelBuffer pixelBuffer = baseArt; if (painter != null) { pixelBuffer = ArtFilter.Overlay(pixelBuffer, painter.Result(3f)); } pixelBuffer = ArtFilter.CalmGrass(pixelBuffer, 5, 0.8f, 0.7f); if (Mod.Settings.LiftDarkGround.Value) { int n = flood.Size; pixelBuffer = ArtFilter.LiftShadows(pixelBuffer, (int x, int y) => classes[(artCrop.Y + y) * n + artCrop.X + x] == CellClass.Walkable, 0.8f, 0.3f); } if (tints != null) { foreach (MapTint tint in tints) { pixelBuffer = ArtFilter.Tint(pixelBuffer, tint.Cover, 0.3f, tint.Color, tint.Strength, tint.Edge); } } PaintedMap paintedMap = MapPainter.PaintArt(flood, classes, pixelBuffer, in ArtPalette, artCrop, Mod.Settings.HighlightObstacles.Value); if (!savedFinal) { savedFinal = true; DebugImages.Save("3-level-picture-matched", pixelBuffer); DebugImages.Save("4-minimap", paintedMap.Image); } return Replace(paintedMap, (FilterMode)0); } catch (Exception e) { artFailed = true; LogOnce.Error("showing the level picture (keeping the flat map)", e); return false; } } private bool Replace(PaintedMap painted, FilterMode filter) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (painted == null) { return false; } BakedMap map = Map; Map = new BakedMap { Texture = SpriteFactory.ToTexture(painted.Image, filter, keepReadable: false), OriginX = painted.OriginX, OriginZ = painted.OriginZ, WorldWidth = painted.WorldWidth, WorldHeight = painted.WorldHeight }; map?.Destroy(); return true; } private void LogFinished(float now) { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown float num = (float)(flood.MaxX - flood.MinX + 1) * 1f; float num2 = (float)(flood.MaxY - flood.MinY + 1) * 1f; double num3 = ((probes > 0) ? (busyMs * 1000.0 / (double)probes) : 0.0); string text = string.Join(", ", from t in solidLayers.Select((int count, int layer) => (count: count, layer: layer)) where t.count > 0 orderby t.count descending select $"layer {t.layer}: {t.count}"); ManualLogSource log = Mod.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(141, 10, ref flag); if (flag) { ((BepInExLogIn