Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RepoMapX v1.0.2
RepoMapX.dll
Decompiled 6 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("You")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("RepoMapX")] [assembly: AssemblyTitle("RepoMapX")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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 RepoMapX { public class MapOverlay : MonoBehaviour { private const string MapCameraName = "Dirt Finder Map Camera"; private static float _nextCamSearch; private static readonly Dictionary<Color, GUIStyle> StyleCache = new Dictionary<Color, GUIStyle>(); private static Texture2D _solidWhite; private void Update() { if (Time.time < _nextCamSearch) { return; } _nextCamSearch = Time.time + 1f; Camera val = MarkerManager.MapCamera; if (!((Object)(object)val == (Object)null)) { return; } Camera[] array = Object.FindObjectsOfType<Camera>(true); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && ((Object)array[i]).name == "Dirt Finder Map Camera") { val = array[i]; break; } } MarkerManager.MapCamera = val; } private void OnGUI() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0096: 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_00bb: Unknown result type (might be due to invalid IL or missing references) if (!MarkerManager.InLevel) { return; } MapMode value = Settings.Mode.Value; if (value == MapMode.Hidden) { return; } Camera mapCamera = MarkerManager.MapCamera; if ((Object)(object)mapCamera == (Object)null) { return; } RenderTexture activeTexture = mapCamera.activeTexture; if ((Object)(object)activeTexture == (Object)null) { return; } Rect val = ComputeRect(value); if (!(((Rect)(ref val)).width <= 0f) && !(((Rect)(ref val)).height <= 0f)) { Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, Settings.Opacity.Value); GUI.DrawTexture(val, (Texture)(object)activeTexture, (ScaleMode)0, false); GUI.color = color; DrawOutline(val); if (Settings.ShowLabels.Value) { DrawLabels(mapCamera, val); } if (Settings.ShowLegend.Value) { DrawLegend(val); } } } private static Rect ComputeRect(MapMode mode) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) float num = 16f; if (mode == MapMode.Big) { float num2 = (float)Mathf.Min(Screen.width, Screen.height) * Settings.BigSizeFraction.Value; return new Rect(((float)Screen.width - num2) / 2f, ((float)Screen.height - num2) / 2f, num2, num2); } float value = Settings.CornerSize.Value; return (Rect)(Settings.Position.Value switch { MapPosition.TopLeft => new Rect(num, num, value, value), MapPosition.BottomLeft => new Rect(num, (float)Screen.height - value - num, value, value), MapPosition.BottomRight => new Rect((float)Screen.width - value - num, (float)Screen.height - value - num, value, value), _ => new Rect((float)Screen.width - value - num, num, value, value), }); } private static void DrawOutline(Rect rect) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) Texture2D val = SolidWhite(); GUI.color = new Color(1f, 1f, 1f, 0.85f); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 2f), (Texture)(object)val); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 2f, ((Rect)(ref rect)).width, 2f), (Texture)(object)val); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 2f, ((Rect)(ref rect)).height), (Texture)(object)val); GUI.DrawTexture(new Rect(((Rect)(ref rect)).xMax - 2f, ((Rect)(ref rect)).y, 2f, ((Rect)(ref rect)).height), (Texture)(object)val); GUI.color = Color.white; } private static void DrawLabels(Camera cam, Rect rect) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_033a: 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_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) if (Settings.ShowTeammates.Value) { List<(PlayerAvatar, bool, int)> playerEntries = MarkerManager.PlayerEntries; for (int i = 0; i < playerEntries.Count; i++) { var (val, flag, index) = playerEntries[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).transform == (Object)null)) { string text = "?"; try { text = SemiFunc.PlayerGetName(val); } catch { } if (string.IsNullOrEmpty(text)) { text = ((Object)val).name; } string text2 = (flag ? (text + "(你)") : text); Color color = (Color)(flag ? new Color(1f, 1f, 1f, 1f) : Settings.TeamColor(index)); DrawLabelAt(cam, rect, ((Component)val).transform.position, text2, color, flag); } } } if (Settings.ShowEnemies.Value && Settings.ShowEnemyNames.Value) { foreach (KeyValuePair<EnemyParent, MapCustom> enemyMarker in MarkerManager.EnemyMarkers) { EnemyParent key = enemyMarker.Key; if ((Object)(object)key == (Object)null || (Object)(object)((Component)key).gameObject == (Object)null) { continue; } Transform val2 = (((Object)(object)key.Enemy != (Object)null) ? ((Component)key.Enemy).transform : ((Component)key).transform); if (!((Object)(object)val2 == (Object)null)) { string text3 = Refl.Field<string>(key, new string[2] { "enemyName", "enemyNameDisplay" }); if (string.IsNullOrEmpty(text3) && (Object)(object)key.Enemy != (Object)null) { text3 = ((Object)key.Enemy).name; } if (string.IsNullOrEmpty(text3)) { text3 = "怪物"; } DrawLabelAt(cam, rect, val2.position, text3, Settings.EnemyColor, large: false); } } } if (Settings.ShowItems.Value) { List<ValuableObject> itemList = MarkerManager.ItemList; for (int j = 0; j < itemList.Count; j++) { ValuableObject val3 = itemList[j]; if ((Object)(object)val3 == (Object)null || (Object)(object)((Component)val3).transform == (Object)null) { continue; } string text4 = ItemDisplayName(val3); if (Settings.ShowItemValues.Value) { float num = Refl.Field<float>(val3, new string[2] { "dollarValueCurrent", "dollarValue" }); int num2 = Mathf.RoundToInt(num); if (num2 > 0) { text4 = text4 + " $" + num2; } } DrawLabelAt(cam, rect, ((Component)val3).transform.position, text4, Settings.ItemColor, large: false); } } if (Settings.ShowExtraction.Value) { List<ExtractionPoint> extractionList = MarkerManager.ExtractionList; for (int k = 0; k < extractionList.Count; k++) { ExtractionPoint val4 = extractionList[k]; if (!((Object)(object)val4 == (Object)null) && !((Object)(object)((Component)val4).transform == (Object)null)) { Vector3 val5 = cam.WorldToViewportPoint(((Component)val4).transform.position); if (val5.z > 0f && val5.x > -0.05f && val5.x < 1.05f && val5.y > -0.05f && val5.y < 1.05f) { float num3 = ((Rect)(ref rect)).x + val5.x * ((Rect)(ref rect)).width; float num4 = ((Rect)(ref rect)).y + (1f - val5.y) * ((Rect)(ref rect)).height; Color color2 = GUI.color; GUI.color = Settings.ExtractionColor; GUI.DrawTexture(new Rect(num3 - 4f, num4 - 4f, 8f, 8f), (Texture)(object)SolidWhite()); GUI.color = color2; } string text5 = Refl.Field<object>(val4, new string[1] { "currentState" })?.ToString() ?? ""; string text6 = (text5.Contains("Active", StringComparison.OrdinalIgnoreCase) ? "撤离点(激活)" : (text5.Contains("Idle", StringComparison.OrdinalIgnoreCase) ? "撤离点(未激活)" : ("撤离点" + ((text5.Length > 0) ? ("(" + text5 + ")") : "")))); DrawLabelAt(cam, rect, ((Component)val4).transform.position, text6, Settings.ExtractionColor, large: false); } } } if (!Settings.ShowCarts.Value) { return; } List<PhysGrabCart> cartList = MarkerManager.CartList; for (int l = 0; l < cartList.Count; l++) { PhysGrabCart val6 = cartList[l]; if (!((Object)(object)val6 == (Object)null) && !((Object)(object)((Component)val6).transform == (Object)null)) { string text7 = "推车"; int num5 = Refl.Field<int>(val6, new string[1] { "haulCurrent" }); if (num5 > 0) { text7 = text7 + " $" + num5; } DrawLabelAt(cam, rect, ((Component)val6).transform.position, text7, Settings.CartColor, large: false); } } } private static string ItemDisplayName(ValuableObject item) { string text = ((Object)item).name; if (text.StartsWith("Valuable", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(8); } if (text.EndsWith("(Clone)", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(0, text.Length - 7); } if (!string.IsNullOrWhiteSpace(text)) { return text.Trim(); } return "物品"; } private static void DrawLabelAt(Camera cam, Rect rect, Vector3 worldPos, string text, Color color, bool large) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(text)) { Vector3 val = cam.WorldToViewportPoint(worldPos); if (!(val.z <= 0f) && !(val.x < -0.05f) && !(val.x > 1.05f) && !(val.y < -0.05f) && !(val.y > 1.05f)) { float gx = ((Rect)(ref rect)).x + val.x * ((Rect)(ref rect)).width; float gy = ((Rect)(ref rect)).y + (1f - val.y) * ((Rect)(ref rect)).height; DrawEntry(gx, gy, text, color, large); } } } private static void DrawEntry(float gx, float gy, string text, Color color, bool large) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00be: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = StyleFor(color, large); GUIContent val2 = new GUIContent(text); Vector2 val3 = val.CalcSize(val2); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(gx - val3.x / 2f - 4f, gy - val3.y / 2f - 1f, val3.x + 8f, val3.y + 2f); Color color2 = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.62f); GUI.DrawTexture(val4, (Texture)(object)SolidWhite()); GUI.color = color2; GUI.Label(new Rect(gx - val3.x / 2f, gy - val3.y / 2f, val3.x, val3.y), val2, val); } private static GUIStyle StyleFor(Color color, bool large) { //IL_0005: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0049: 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) if (!StyleCache.TryGetValue(color, out var value)) { value = new GUIStyle(GUI.skin.label) { fontSize = (large ? 13 : 11), fontStyle = (FontStyle)1, alignment = (TextAnchor)4, wordWrap = false }; value.normal.textColor = color; StyleCache[color] = value; } return value; } private static void DrawLegend(Rect rect) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) int num = 7; float num2 = 132f; float num3 = (float)num * 17f + 8f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 8f, ((Rect)(ref rect)).y + 8f, num2, num3); GUI.color = new Color(0f, 0f, 0f, 0.55f); GUI.DrawTexture(val, (Texture)(object)SolidWhite()); GUI.color = Color.white; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1 }; val2.normal.textColor = Color.white; string[] array = new string[7] { "你自己", "队友", "怪物", "贵重物品", "撤离点", "推车", "阵亡队友" }; Color[] array2 = (Color[])(object)new Color[7] { Settings.SelfColor, Settings.TeamColor(0), Settings.EnemyColor, Settings.ItemColor, Settings.ExtractionColor, Settings.CartColor, Settings.DeadTeammateColor }; for (int i = 0; i < array.Length; i++) { float num4 = ((Rect)(ref val)).y + 6f + (float)i * 17f; GUI.color = array2[i]; GUI.DrawTexture(new Rect(((Rect)(ref val)).x + 8f, num4 + 3f, 9f, 9f), (Texture)(object)SolidWhite()); GUI.color = Color.white; GUI.Label(new Rect(((Rect)(ref val)).x + 22f, num4, ((Rect)(ref val)).width - 28f, 15f), array[i], val2); } } private static Texture2D SolidWhite() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_solidWhite == (Object)null) { _solidWhite = new Texture2D(1, 1); _solidWhite.SetPixel(0, 0, Color.white); _solidWhite.Apply(); } return _solidWhite; } } [HarmonyPatch(typeof(LevelGenerator))] public static class LevelGeneratorPatches { [HarmonyPatch("GenerateDone")] [HarmonyPostfix] private static void GenerateDonePostfix() { MarkerManager.OnLevelGenerated(); Plugin.Logger.LogInfo((object)"Level generated - RepoMapX markers refreshed"); } } [HarmonyPatch(typeof(EnemyParent))] public static class EnemyParentPatches { [HarmonyPatch("SpawnRPC")] [HarmonyPostfix] private static void SpawnRPCPostfix(EnemyParent __instance) { MarkerManager.OnEnemySpawned(__instance); } [HarmonyPatch("DespawnRPC")] [HarmonyPostfix] private static void DespawnRPCPostfix(EnemyParent __instance) { MarkerManager.OnEnemyDespawned(__instance); } } [HarmonyPatch(typeof(EnemyHealth))] public static class EnemyHealthPatches { [HarmonyPatch("DeathRPC")] [HarmonyPostfix] private static void DeathRPCPostfix(EnemyHealth __instance) { if (!((Object)(object)__instance == (Object)null)) { EnemyParent componentInParent = ((Component)__instance).GetComponentInParent<EnemyParent>(); if ((Object)(object)componentInParent != (Object)null) { MarkerManager.OnEnemyDespawned(componentInParent); } } } } [HarmonyPatch(typeof(PlayerAvatar))] public static class PlayerAvatarPatches { [HarmonyPatch("ReviveRPC")] [HarmonyPostfix] private static void ReviveRPCPostfix() { MarkerManager.OnPlayerStateChanged(); } [HarmonyPatch("PlayerDeathRPC")] [HarmonyPostfix] private static void PlayerDeathRPCPostfix() { MarkerManager.OnPlayerStateChanged(); } [HarmonyPatch("PlayerDeathDone")] [HarmonyPostfix] private static void PlayerDeathDonePostfix() { MarkerManager.OnPlayerDeathDone(); } } public static class MarkerManager { private static bool _inLevel; public static readonly Dictionary<EnemyParent, MapCustom> EnemyMarkers = new Dictionary<EnemyParent, MapCustom>(); public static readonly List<(PlayerAvatar avatar, bool isMe, int colorIndex)> PlayerEntries = new List<(PlayerAvatar, bool, int)>(); private static readonly Dictionary<PlayerAvatar, MapCustom> PlayerMarkers = new Dictionary<PlayerAvatar, MapCustom>(); public static readonly List<ValuableObject> ItemList = new List<ValuableObject>(); public static readonly List<ExtractionPoint> ExtractionList = new List<ExtractionPoint>(); public static readonly List<PhysGrabCart> CartList = new List<PhysGrabCart>(); private static readonly HashSet<ValuableObject> RegisteredValuables = new HashSet<ValuableObject>(); private static float _nextRefresh; private const float RefreshInterval = 2f; public static bool InLevel => _inLevel; public static Camera MapCamera { get; set; } public static bool HasMapCamera => (Object)(object)MapCamera != (Object)null; public static IEnumerable<EnemyParent> Enemies => EnemyMarkers.Keys; public static void OnSceneUnloaded() { _inLevel = false; RemoveAllMarkers(); ItemList.Clear(); ExtractionList.Clear(); CartList.Clear(); RegisteredValuables.Clear(); MapCamera = null; } public static void OnLevelGenerated() { _inLevel = true; _nextRefresh = 0f; } public static void Tick() { if (!_inLevel || Time.time < _nextRefresh) { return; } _nextRefresh = Time.time + 2f; try { Refresh(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"RepoMapX refresh failed: {arg}"); } } public static void Refresh() { if (Settings.ForceMapActive.Value && (Object)(object)Map.Instance != (Object)null && !Map.Instance.Active) { try { Map.Instance.ActiveSet(true); } catch (Exception ex) { Plugin.Logger.LogWarning((object)("Map.ActiveSet: " + ex.Message)); } } if (Settings.ZoomOutMap.Value && (Object)(object)MapCamera != (Object)null) { try { MapCamera.orthographicSize = Settings.FullMapZoom.Value; } catch (Exception ex2) { Plugin.Logger.LogWarning((object)("ZoomOut: " + ex2.Message)); } } if (Settings.ExploreAllRooms.Value) { RoomVolume[] array = Object.FindObjectsOfType<RoomVolume>(); for (int i = 0; i < array.Length; i++) { try { if ((Object)(object)array[i] != (Object)null && (Object)(object)((Component)array[i]).gameObject != (Object)null) { array[i].Explored = true; array[i].SetExplored(); } } catch (Exception ex3) { Plugin.Logger.LogWarning((object)("SetExplored: " + ex3.Message)); } } } if (Settings.ShowTeammates.Value) { UpdatePlayerMarkers(); } else { RemovePlayerMarkers(); } if (Settings.ShowEnemies.Value) { UpdateEnemyMarkers(); } else { RemoveEnemyMarkers(); } if (Settings.ShowItems.Value) { UpdateItemMarkers(); } else { RemoveItemMarkers(); } if (Settings.ShowExtraction.Value) { UpdateExtractionMarkers(); } else { RemoveExtractionMarkers(); } if (Settings.ShowCarts.Value) { UpdateCartMarkers(); } else { RemoveCartMarkers(); } } private static void UpdatePlayerMarkers() { //IL_00ae: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) PlayerEntries.Clear(); List<PlayerAvatar> list = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.PlayerList : null); if (list == null) { RemovePlayerMarkers(); return; } HashSet<PlayerAvatar> hashSet = new HashSet<PlayerAvatar>(); int num = 0; foreach (PlayerAvatar item2 in list) { if ((Object)(object)item2 == (Object)null || (Object)(object)((Component)item2).gameObject == (Object)null || !((Component)item2).gameObject.activeInHierarchy) { num++; continue; } hashSet.Add(item2); bool flag = (Object)(object)PlayerAvatar.instance != (Object)null && (Object)(object)item2 == (Object)(object)PlayerAvatar.instance; Color color = (flag ? Settings.SelfColor : Settings.TeamColor(num)); int item = num; num++; MapCustom val = ((Component)item2).GetComponent<MapCustom>(); if ((Object)(object)val == (Object)null) { try { val = ((Component)item2).gameObject.AddComponent<MapCustom>(); val.sprite = MarkerSprites.Circle(flag ? 12 : 10); val.color = color; val.Add(); } catch (Exception ex) { Plugin.Logger.LogWarning((object)("player marker: " + ex.Message)); continue; } } else { val.color = color; } PlayerMarkers[item2] = val; PlayerEntries.Add((item2, flag, item)); } RemoveStalePlayerMarkers(hashSet); } private static void RemoveStalePlayerMarkers(HashSet<PlayerAvatar> seen) { foreach (KeyValuePair<PlayerAvatar, MapCustom> playerMarker in PlayerMarkers) { if ((Object)(object)playerMarker.Key == (Object)null || (Object)(object)((Component)playerMarker.Key).gameObject == (Object)null || !seen.Contains(playerMarker.Key)) { SafeHideAndDestroy(playerMarker.Value); } } List<PlayerAvatar> list = new List<PlayerAvatar>(); foreach (KeyValuePair<PlayerAvatar, MapCustom> playerMarker2 in PlayerMarkers) { if ((Object)(object)playerMarker2.Key == (Object)null || (Object)(object)((Component)playerMarker2.Key).gameObject == (Object)null || !seen.Contains(playerMarker2.Key)) { list.Add(playerMarker2.Key); } } for (int i = 0; i < list.Count; i++) { PlayerMarkers.Remove(list[i]); } } private static void RemovePlayerMarkers() { foreach (KeyValuePair<PlayerAvatar, MapCustom> playerMarker in PlayerMarkers) { SafeHideAndDestroy(playerMarker.Value); } PlayerMarkers.Clear(); PlayerEntries.Clear(); } public static void OnPlayerStateChanged() { if (_inLevel) { UpdatePlayerMarkers(); RecolorDeathHeads(); } } public static void OnPlayerDeathDone() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!_inLevel) { return; } try { PlayerDeathHead[] array = Object.FindObjectsOfType<PlayerDeathHead>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] == (Object)null) { continue; } try { array[i].SeenSetRPC(true, default(PhotonMessageInfo)); } catch { } try { if ((Object)(object)array[i].mapCustom != (Object)null) { array[i].mapCustom.color = Settings.DeadTeammateColor; } } catch { } } } catch (Exception ex) { Plugin.Logger.LogWarning((object)("death heads: " + ex.Message)); } } private static void RecolorDeathHeads() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) try { PlayerDeathHead[] array = Object.FindObjectsOfType<PlayerDeathHead>(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null) && !((Object)(object)array[i].mapCustom == (Object)null)) { array[i].mapCustom.color = Settings.DeadTeammateColor; } } } catch (Exception ex) { Plugin.Logger.LogWarning((object)("death head color: " + ex.Message)); } } public static void OnEnemySpawned(EnemyParent ep) { if (_inLevel && !((Object)(object)ep == (Object)null) && !((Object)(object)((Component)ep).gameObject == (Object)null) && Settings.ShowEnemies.Value) { AddEnemyMarker(ep); } } public static void OnEnemyDespawned(EnemyParent ep) { if (!((Object)(object)ep == (Object)null)) { RemoveEnemyMarker(ep); } } private static void UpdateEnemyMarkers() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Invalid comparison between Unknown and I4 //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)EnemyDirector.instance == (Object)null || EnemyDirector.instance.enemiesSpawned == null) { RemoveEnemyMarkers(); return; } HashSet<EnemyParent> hashSet = new HashSet<EnemyParent>(); foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { if (!((Object)(object)item == (Object)null) && !((Object)(object)((Component)item).gameObject == (Object)null) && ((Behaviour)item).isActiveAndEnabled && item.Spawned && !((Object)(object)item.Enemy == (Object)null) && (!((Object)(object)item.Enemy.Health != (Object)null) || !item.Enemy.Health.dead) && (int)item.Enemy.CurrentState != 11 && (int)item.Enemy.CurrentState != 0) { hashSet.Add(item); AddEnemyMarker(item); } } RemoveStaleEnemyMarkers(hashSet); } private static void AddEnemyMarker(EnemyParent ep) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_007d: Unknown result type (might be due to invalid IL or missing references) if (EnemyMarkers.TryGetValue(ep, out var value) && (Object)(object)value != (Object)null) { value.color = Settings.EnemyColor; return; } try { MapCustom val = ((Component)ep.Enemy).GetComponent<MapCustom>(); if ((Object)(object)val == (Object)null) { val = ((Component)ep.Enemy).gameObject.AddComponent<MapCustom>(); val.autoAdd = false; int size = 10; try { float num = (((Object)(object)((Component)ep.Enemy).transform != (Object)null) ? ((Component)ep.Enemy).transform.localScale.y : 1f); size = Mathf.Max(6, Mathf.RoundToInt(Mathf.Clamp(num, 0.1f, 6f) * 10f)); } catch { } val.sprite = MarkerSprites.Circle(size); val.color = Settings.EnemyColor; val.Add(); } EnemyMarkers[ep] = val; } catch (Exception ex) { Plugin.Logger.LogWarning((object)("enemy marker: " + ex.Message)); } } private static void RemoveEnemyMarker(EnemyParent ep) { if (EnemyMarkers.TryGetValue(ep, out var value)) { SafeHideAndDestroy(value); EnemyMarkers.Remove(ep); } else if ((Object)(object)ep != (Object)null && (Object)(object)ep.Enemy != (Object)null) { MapCustom component = ((Component)ep.Enemy).GetComponent<MapCustom>(); if ((Object)(object)component != (Object)null) { SafeHideAndDestroy(component); } } } private static void RemoveStaleEnemyMarkers(HashSet<EnemyParent> seen) { List<EnemyParent> list = new List<EnemyParent>(); foreach (KeyValuePair<EnemyParent, MapCustom> enemyMarker in EnemyMarkers) { if ((Object)(object)enemyMarker.Key == (Object)null || (Object)(object)((Component)enemyMarker.Key).gameObject == (Object)null || !seen.Contains(enemyMarker.Key)) { SafeHideAndDestroy(enemyMarker.Value); list.Add(enemyMarker.Key); } } for (int i = 0; i < list.Count; i++) { EnemyMarkers.Remove(list[i]); } } private static void RemoveEnemyMarkers() { foreach (KeyValuePair<EnemyParent, MapCustom> enemyMarker in EnemyMarkers) { SafeHideAndDestroy(enemyMarker.Value); } EnemyMarkers.Clear(); } private static void UpdateItemMarkers() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) ItemList.Clear(); ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(); foreach (ValuableObject val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && ((Component)val).gameObject.activeInHierarchy && !(((object)val).GetType().Name == "PlayerDeathHead")) { RegisterValuableOnMap(val); ItemList.Add(val); } } MapValuable[] array2 = Object.FindObjectsOfType<MapValuable>(); for (int j = 0; j < array2.Length; j++) { try { array2[j].spriteRenderer.color = Settings.ItemColor; } catch { } } } private static void RegisterValuableOnMap(ValuableObject item) { if (RegisteredValuables.Contains(item)) { return; } try { item.discovered = true; try { item.Discover((State)0); } catch { } if ((Object)(object)Map.Instance != (Object)null) { Map.Instance.AddValuable(item); } } catch (Exception ex) { Plugin.Logger.LogWarning((object)("register valuable: " + ex.Message)); } RegisteredValuables.Add(item); } private static void RemoveItemMarkers() { ItemList.Clear(); } private static void UpdateExtractionMarkers() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) ExtractionList.Clear(); ExtractionPoint[] array = Object.FindObjectsOfType<ExtractionPoint>(true); foreach (ExtractionPoint val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && !val.isShop) { if (((Component)val).gameObject.activeInHierarchy) { EnsureDotMarker(((Component)val).gameObject, 9, Settings.ExtractionColor); } ExtractionList.Add(val); } } } private static void RemoveExtractionMarkers() { ExtractionList.Clear(); } private static void UpdateCartMarkers() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) CartList.Clear(); PhysGrabCart[] array = Object.FindObjectsOfType<PhysGrabCart>(); foreach (PhysGrabCart val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && ((Component)val).gameObject.activeInHierarchy && !val.isSmallCart) { EnsureDotMarker(((Component)val).gameObject, 9, Settings.CartColor); CartList.Add(val); } } } private static void RemoveCartMarkers() { CartList.Clear(); } private static void EnsureDotMarker(GameObject go, int size, Color color) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) MapCustom component = go.GetComponent<MapCustom>(); if ((Object)(object)component == (Object)null) { try { component = go.AddComponent<MapCustom>(); component.sprite = MarkerSprites.Circle(size); component.color = color; component.Add(); return; } catch (Exception ex) { Plugin.Logger.LogWarning((object)("dot marker on " + ((Object)go).name + ": " + ex.Message)); return; } } component.color = color; } private static void SafeHideAndDestroy(MapCustom mc) { if ((Object)(object)mc == (Object)null) { return; } try { mc.Hide(); if ((Object)(object)mc.mapCustomEntity != (Object)null && (Object)(object)mc.mapCustomEntity.spriteRenderer != (Object)null) { mc.mapCustomEntity.spriteRenderer.sprite = MarkerSprites.Clear(); } } catch { } try { Object.Destroy((Object)(object)mc); } catch { } } private static void RemoveAllMarkers() { RemovePlayerMarkers(); RemoveEnemyMarkers(); } } public static class MarkerSprites { private static readonly Dictionary<int, Sprite> CircleCache = new Dictionary<int, Sprite>(); private static Sprite _clear; public static Sprite Circle(int size) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) size = Mathf.Max(4, size); if (CircleCache.TryGetValue(size, out var value) && (Object)(object)value != (Object)null) { return value; } Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); float num = (float)(size - 1) / 2f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num2 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num, num)) / num; float num3 = Mathf.Clamp01((1f - num2) * (float)size * 0.5f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num3)); } } val.Apply(); value = Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 100f); CircleCache[size] = value; return value; } public static Sprite Clear() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_clear != (Object)null) { return _clear; } Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, new Color(0f, 0f, 0f, 0f)); val.Apply(); _clear = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f); return _clear; } } [BepInPlugin("You.RepoMapX", "RepoMapX", "1.0.2")] public class Plugin : BaseUnityPlugin { internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony Harmony { get; set; } private void Awake() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Settings.Init(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.AddComponent<MapOverlay>(); SceneManager.sceneUnloaded += OnSceneUnloaded; Harmony = new Harmony("You.RepoMapX"); Harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded!"); } private static void OnSceneUnloaded(Scene scene) { MarkerManager.OnSceneUnloaded(); } private void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if ((int)Settings.ToggleKey.Value != 0 && Input.GetKeyDown(Settings.ToggleKey.Value)) { Settings.CycleViewMode(); Logger.LogInfo((object)$"View mode: {Settings.Mode.Value}"); } MarkerManager.Tick(); } } public static class PluginInfo { public const string GUID = "You.RepoMapX"; public const string Name = "RepoMapX"; public const string Version = "1.0.2"; } public static class Refl { public static object Field(object target, params string[] names) { if (target == null) { return null; } Type type = target.GetType(); for (int i = 0; i < names.Length; i++) { try { FieldInfo field = type.GetField(names[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(target); } } catch { } } return null; } public static T Field<T>(object target, params string[] names) { object obj = Field(target, names); if (obj == null) { return default(T); } if (obj is T) { return (T)obj; } try { return (T)Convert.ChangeType(obj, typeof(T)); } catch { return default(T); } } } public enum MapPosition { TopLeft, TopRight, BottomLeft, BottomRight } public enum MapMode { Hidden, Corner, Big } public static class Settings { private static readonly Color[] TeamPalette = (Color[])(object)new Color[6] { new Color(0.3f, 0.6f, 1f, 1f), new Color(1f, 0.35f, 1f, 1f), new Color(0.2f, 0.95f, 1f, 1f), new Color(0.45f, 1f, 0.4f, 1f), new Color(1f, 0.55f, 0.2f, 1f), new Color(0.9f, 0.7f, 0.3f, 1f) }; public static ConfigEntry<MapMode> Mode { get; private set; } public static ConfigEntry<float> CornerSize { get; private set; } public static ConfigEntry<float> BigSizeFraction { get; private set; } public static ConfigEntry<float> Opacity { get; private set; } public static ConfigEntry<MapPosition> Position { get; private set; } public static ConfigEntry<bool> ShowEnemies { get; private set; } public static ConfigEntry<bool> ShowTeammates { get; private set; } public static ConfigEntry<bool> ShowItems { get; private set; } public static ConfigEntry<bool> ShowExtraction { get; private set; } public static ConfigEntry<bool> ShowCarts { get; private set; } public static ConfigEntry<bool> ShowLabels { get; private set; } public static ConfigEntry<bool> ShowEnemyNames { get; private set; } public static ConfigEntry<bool> ShowPlayerNames { get; private set; } public static ConfigEntry<bool> ShowItemValues { get; private set; } public static ConfigEntry<bool> ExploreAllRooms { get; private set; } public static ConfigEntry<bool> ForceMapActive { get; private set; } public static ConfigEntry<bool> ZoomOutMap { get; private set; } public static ConfigEntry<float> FullMapZoom { get; private set; } public static ConfigEntry<bool> ShowLegend { get; private set; } public static ConfigEntry<KeyCode> ToggleKey { get; private set; } public static Color SelfColor => new Color(1f, 1f, 1f, 1f); public static Color EnemyColor => new Color(1f, 0.25f, 0.2f, 1f); public static Color ItemColor => new Color(1f, 0.82f, 0.2f, 1f); public static Color ExtractionColor => new Color(0.2f, 1f, 0.35f, 1f); public static Color CartColor => new Color(1f, 0.55f, 0.1f, 1f); public static Color DeadTeammateColor => new Color(0.55f, 0.55f, 0.55f, 1f); public static void Init(ConfigFile cfg) { Mode = cfg.Bind<MapMode>("General", "Mode", MapMode.Corner, "地图显示模式: Hidden=关闭 Corner=角落小地图 Big=居中大地图(游戏中按 M 切换)"); CornerSize = cfg.Bind<float>("General", "CornerSize", 380f, "角落小地图边长(像素)"); BigSizeFraction = cfg.Bind<float>("General", "BigSizeFraction", 0.72f, "居中大地图占屏幕短边的比例(0.2 - 1.0)"); Opacity = cfg.Bind<float>("General", "Opacity", 0.88f, "地图透明度(0 - 1)"); Position = cfg.Bind<MapPosition>("General", "Position", MapPosition.TopRight, "角落小地图的位置"); ToggleKey = cfg.Bind<KeyCode>("General", "ToggleKey", (KeyCode)109, "切换地图显示模式的快捷键"); ShowEnemies = cfg.Bind<bool>("Markers", "ShowEnemies", true, "在图上标记怪物"); ShowTeammates = cfg.Bind<bool>("Markers", "ShowTeammates", true, "在图上标记队友"); ShowItems = cfg.Bind<bool>("Markers", "ShowItems", true, "在图上标记贵重物品"); ShowExtraction = cfg.Bind<bool>("Markers", "ShowExtraction", true, "在图上标记撤离点"); ShowCarts = cfg.Bind<bool>("Markers", "ShowCarts", true, "在图上标记推车(大推车,不含小拉车)"); ShowLabels = cfg.Bind<bool>("Labels", "ShowLabels", true, "显示文字标签(名称/价值)"); ShowEnemyNames = cfg.Bind<bool>("Labels", "ShowEnemyNames", true, "显示怪物名称"); ShowPlayerNames = cfg.Bind<bool>("Labels", "ShowPlayerNames", true, "显示队友名称"); ShowItemValues = cfg.Bind<bool>("Labels", "ShowItemValues", true, "显示物品价值($)"); ExploreAllRooms = cfg.Bind<bool>("Map", "ExploreAllRooms", true, "自动探索所有房间(地图上所有房间全亮)"); ForceMapActive = cfg.Bind<bool>("Map", "ForceMapActive", true, "强制保持地图相机开启(即使没买地图工具也显示)"); ZoomOutMap = cfg.Bind<bool>("Map", "ZoomOutMap", true, "把地图相机拉远,让整个关卡都显示在视野内(默认=全图)"); FullMapZoom = cfg.Bind<float>("Map", "FullMapZoom", 140f, "全图模式的相机正交尺寸(越大看得越全;大图调 160-200,小图 90-120)"); ShowLegend = cfg.Bind<bool>("Map", "ShowLegend", true, "显示颜色图例"); Constrain(BigSizeFraction, 0.2f, 1f); Constrain(Opacity, 0.1f, 1f); Constrain(CornerSize, 160f, 1200f); Constrain(FullMapZoom, 40f, 400f); } private static void Constrain(ConfigEntry<float> entry, float min, float max) { if (entry.Value < min) { entry.Value = min; } if (entry.Value > max) { entry.Value = max; } } public static void CycleViewMode() { Mode.Value = (MapMode)((int)(Mode.Value + 1) % 3); } public static Color TeamColor(int index) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (index < 0) { index = -index; } return TeamPalette[index % TeamPalette.Length]; } } }