using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using SCTCommon;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SCTHud.Minimap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SCTHud.Minimap")]
[assembly: AssemblyTitle("SCTHud.Minimap")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SCTCommon
{
internal static class Il2CppUtil
{
public static bool IsPlayer(Driller driller)
{
if (driller != null)
{
return (Object)(object)((Il2CppObjectBase)driller).TryCast<Player>() != (Object)null;
}
return false;
}
public static string Guid(BasePlugin plugin)
{
return MetadataHelper.GetMetadata((object)plugin).GUID;
}
public static IEnumerable<PluginInfo> Plugins()
{
if (IL2CPPChainloader.Instance == null)
{
yield break;
}
foreach (PluginInfo value in ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Values)
{
yield return value;
}
}
}
internal static class Safe
{
private static readonly ManualLogSource Log = Logger.CreateLogSource("SCT Safe");
private static readonly HashSet<string> Reported = new HashSet<string>();
public static void Run(string where, Action action)
{
try
{
action();
}
catch (Exception e)
{
Report(where, e);
}
}
public static bool Prefix(string where, Func<bool> prefix)
{
try
{
return prefix();
}
catch (Exception e)
{
Report(where, e);
return true;
}
}
private static void Report(string where, Exception e)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
if (Reported.Add(where + e.GetType().Name + e.Message))
{
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(where);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" : ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.GetType().Name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" : ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (ignoré, le jeu continue)\n");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.StackTrace);
}
Log.LogError(val);
}
}
}
internal static class Vanilla
{
private const string Key = "sct.vanilla";
public static bool Active
{
get
{
object data = AppDomain.CurrentDomain.GetData("sct.vanilla");
bool flag = default(bool);
int num;
if (data is bool)
{
flag = (bool)data;
num = 1;
}
else
{
num = 0;
}
return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
}
}
public static void Set(bool active)
{
AppDomain.CurrentDomain.SetData("sct.vanilla", active);
}
}
internal static class Lang
{
public static bool IsFrench
{
get
{
try
{
Locale selectedLocale = LocalizationSettings.SelectedLocale;
return ((selectedLocale != null) ? selectedLocale.Identifier.Code : null)?.StartsWith("fr", StringComparison.OrdinalIgnoreCase) ?? false;
}
catch (Exception)
{
return false;
}
}
}
public static string Pick(string fr, string en)
{
if (!IsFrench)
{
return en;
}
return fr;
}
}
internal enum ColorVision
{
Normal,
Protanopia,
Deuteranopia,
Tritanopia
}
internal static class Palette
{
public const string VisionKey = "sct.colorblind.vision";
public const string RedundantKey = "sct.colorblind.redundant";
private static readonly Color Black = C(0);
private static readonly Color Orange = C(15113984);
private static readonly Color SkyBlue = C(5682409);
private static readonly Color Green = C(40563);
private static readonly Color Yellow = C(15787074);
private static readonly Color Blue = C(29362);
private static readonly Color Vermillion = C(13983232);
private static readonly Color Purple = C(13400487);
private static readonly Color White = C(16777215);
private static readonly Color Grey = C(7237230);
public static ColorVision Vision
{
get
{
object data = AppDomain.CurrentDomain.GetData("sct.colorblind.vision");
if (data is int)
{
return (ColorVision)(int)data;
}
return ColorVision.Normal;
}
}
public static bool Adapted => Vision != ColorVision.Normal;
public static bool Redundant
{
get
{
if (Adapted)
{
object data = AppDomain.CurrentDomain.GetData("sct.colorblind.redundant");
bool flag = default(bool);
int num;
if (data is bool)
{
flag = (bool)data;
num = 1;
}
else
{
num = 0;
}
return num == 0 || flag;
}
return false;
}
}
private static bool RedGreen
{
get
{
if (Vision != ColorVision.Protanopia)
{
return Vision == ColorVision.Deuteranopia;
}
return true;
}
}
public static Color Good(Color usual)
{
//IL_001a: 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_000e: Unknown result type (might be due to invalid IL or missing references)
if (Adapted)
{
if (!RedGreen)
{
return Green;
}
return SkyBlue;
}
return usual;
}
public static Color Bad(Color usual)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
if (Adapted)
{
return Vermillion;
}
return usual;
}
public static Color Warning(Color usual)
{
//IL_001a: 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_000e: Unknown result type (might be due to invalid IL or missing references)
if (Adapted)
{
if (!RedGreen)
{
return Orange;
}
return Yellow;
}
return usual;
}
public static Color Danger(Color usual)
{
//IL_001f: 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_0013: Unknown result type (might be due to invalid IL or missing references)
if (Adapted)
{
if (!RedGreen)
{
return C(16719904);
}
return Vermillion;
}
return usual;
}
public static Color Accent(Color usual)
{
//IL_001a: 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_000e: Unknown result type (might be due to invalid IL or missing references)
if (Adapted)
{
if (!RedGreen)
{
return Purple;
}
return SkyBlue;
}
return usual;
}
public static string GoodHex(string usual = "80ff80")
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (!Adapted)
{
return usual;
}
return Hex(Good(White));
}
public static string BadHex(string usual = "ff8080")
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (!Adapted)
{
return usual;
}
return Hex(Bad(White));
}
public static string WarningHex(string usual = "ffcc66")
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (!Adapted)
{
return usual;
}
return Hex(Warning(White));
}
public static Color Ore(ResourceType type, Color usual)
{
//IL_0012: 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_004e: Expected I4, but got Unknown
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
if (!Adapted)
{
return usual;
}
bool flag = Vision == ColorVision.Tritanopia;
switch (type - 2)
{
case 9:
return Grey;
case 0:
if (!flag)
{
return Blue;
}
return Vermillion;
case 2:
return Orange;
case 4:
return White;
case 6:
if (!flag)
{
return Yellow;
}
return C(16756912);
case 8:
return SkyBlue;
case 10:
if (!flag)
{
return Purple;
}
return Blue;
case 11:
if (!flag)
{
return Green;
}
return C(8323072);
case 12:
if (!flag)
{
return Vermillion;
}
return Black;
default:
return usual;
}
}
public static Color Tier(int level, Color usual)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0041: 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_0091: Unknown result type (might be due to invalid IL or missing references)
if (!Adapted || level <= 0)
{
return usual;
}
Color[] array = (Color[])(object)((Vision != ColorVision.Tritanopia) ? new Color[4] { Blue, Orange, White, Yellow } : new Color[4] { SkyBlue, Vermillion, White, Purple });
return array[Mathf.Clamp(level, 1, array.Length) - 1];
}
public static Color Marker(int index, Color usual)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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_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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
if (!Adapted)
{
return usual;
}
Color[] array = (Color[])(object)((Vision != ColorVision.Tritanopia) ? new Color[5] { Yellow, SkyBlue, Orange, White, Purple } : new Color[5]
{
Vermillion,
White,
SkyBlue,
C(16756912),
Green
});
return array[Math.Abs(index) % array.Length];
}
public static float Blink(float speed = 3f)
{
if (!Redundant)
{
return 1f;
}
return 0.45f + 0.55f * Mathf.Abs(Mathf.Sin(Time.unscaledTime * speed));
}
public static string Hex(Color c)
{
//IL_000b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
return $"{Mathf.RoundToInt(Mathf.Clamp01(c.r) * 255f):X2}{Mathf.RoundToInt(Mathf.Clamp01(c.g) * 255f):X2}{Mathf.RoundToInt(Mathf.Clamp01(c.b) * 255f):X2}";
}
private static Color C(int rgb)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
return new Color((float)((rgb >> 16) & 0xFF) / 255f, (float)((rgb >> 8) & 0xFF) / 255f, (float)(rgb & 0xFF) / 255f);
}
}
}
namespace SCTHud
{
internal static class GameData
{
public static int Value(ResourceType type)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
Dictionary<ResourceType, int> resourceValues = ComputerManager.ResourceValues;
if (resourceValues == null || !resourceValues.ContainsKey(type))
{
return 0;
}
return resourceValues[type];
}
}
internal static class ImGui
{
public static GUIStyle TextureStyle(Texture2D texture)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_0010: Expected O, but got Unknown
//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_001b: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
GUIStyle val = new GUIStyle
{
border = new RectOffset(),
padding = new RectOffset(),
margin = new RectOffset()
};
val.normal.background = texture;
return val;
}
public static void DrawTexture(Rect rect, GUIStyle textureStyle)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
GUI.Box(rect, "", textureStyle);
}
public static GUIStyle BoxStyle(int fontSize, TextAnchor alignment)
{
//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_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
GUIStyle box = GUI.skin.box;
GUIStyle val = new GUIStyle
{
alignment = alignment,
richText = true,
fontSize = fontSize,
border = box.border,
padding = box.padding,
margin = box.margin,
wordWrap = box.wordWrap
};
val.normal.background = box.normal.background;
val.normal.textColor = box.normal.textColor;
return val;
}
}
}
namespace SCTHud.Minimap
{
[BepInPlugin("sct.hud.minimap", "SCT HUD - Mini-carte", "2.1.0")]
public class MinimapPlugin : BasePlugin
{
public const string Guid = "sct.hud.minimap";
public const string Name = "SCT HUD - Mini-carte";
public const string Version = "2.1.0";
internal static ManualLogSource Logger;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<Key> ToggleKey;
internal static ConfigEntry<int> Scale;
internal static bool Shown
{
get
{
if (Enabled.Value)
{
return !Vanilla.Active;
}
return false;
}
}
public override void Load()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
Enabled = ((BasePlugin)this).Config.Bind<bool>("MiniCarte", "Enabled", true, "Affiche la mini-carte (zones creusées, minerais révélés, bâtiments, joueur).");
ToggleKey = ((BasePlugin)this).Config.Bind<Key>("MiniCarte", "ToggleKey", (Key)27, "Touche pour afficher / masquer la mini-carte.");
Scale = ((BasePlugin)this).Config.Bind<int>("MiniCarte", "Scale", 2, new ConfigDescription("Taille d'un bloc en pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6), Array.Empty<object>()));
((BasePlugin)this).AddComponent<MinimapHud>();
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(8, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SCT HUD - Mini-carte");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("2.1.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" chargé");
}
log.LogInfo(val);
}
}
internal class MinimapHud : MonoBehaviour
{
private const float RefreshInterval = 0.5f;
private static readonly Color Solid = new Color(0.12f, 0.1f, 0.1f, 0.85f);
private static readonly Color Dug = new Color(0.55f, 0.5f, 0.45f, 0.85f);
private static readonly Color BuildColor = new Color(0.3f, 0.6f, 1f, 1f);
private static readonly Color PlayerColor = Color.white;
private static readonly Dictionary<ResourceType, Color> OreColors = new Dictionary<ResourceType, Color>
{
{
(ResourceType)11,
new Color(0.25f, 0.25f, 0.25f)
},
{
(ResourceType)2,
new Color(0.75f, 0.55f, 0.45f)
},
{
(ResourceType)4,
new Color(0.9f, 0.5f, 0.2f)
},
{
(ResourceType)6,
new Color(0.95f, 0.95f, 1f)
},
{
(ResourceType)8,
new Color(1f, 0.85f, 0.2f)
},
{
(ResourceType)10,
new Color(0.5f, 1f, 1f)
},
{
(ResourceType)12,
new Color(0.8f, 0.4f, 1f)
},
{
(ResourceType)13,
new Color(1f, 0.4f, 0.8f)
},
{
(ResourceType)14,
new Color(1f, 0.2f, 0.4f)
}
};
private Texture2D _texture;
private GUIStyle _mapStyle;
private GUIStyle _dotStyle;
private Color[] _pixels;
private int _width;
private int _height;
private float _nextRefresh;
private bool _visible = true;
private static readonly Color[] MarkerPalette = (Color[])(object)new Color[5]
{
new Color(1f, 0.85f, 0.2f),
new Color(0.3f, 0.9f, 1f),
new Color(1f, 0.45f, 0.8f),
new Color(0.5f, 1f, 0.4f),
new Color(1f, 0.55f, 0.2f)
};
public MinimapHud(IntPtr ptr)
: base(ptr)
{
}
private void Update()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
Keyboard current = Keyboard.current;
if (current != null && ((ButtonControl)current[MinimapPlugin.ToggleKey.Value]).wasPressedThisFrame)
{
_visible = !_visible;
}
if (!MinimapPlugin.Shown || !_visible || Time.unscaledTime < _nextRefresh || (Object)(object)BlockManager.Instance == (Object)null)
{
return;
}
_nextRefresh = Time.unscaledTime + 0.5f;
try
{
Redraw();
}
catch (Exception ex)
{
ManualLogSource logger = MinimapPlugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(13, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Mini-carte : ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val);
}
}
private void Redraw()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: 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)
int mapWidth = Const.MapWidth;
int mapHeight = Const.MapHeight;
if ((Object)(object)_texture == (Object)null || _width != mapWidth || _height != mapHeight)
{
_width = mapWidth;
_height = mapHeight;
_texture = new Texture2D(mapWidth, mapHeight, (TextureFormat)4, false)
{
filterMode = (FilterMode)0,
wrapMode = (TextureWrapMode)1
};
((Object)_texture).hideFlags = (HideFlags)61;
_mapStyle = null;
_pixels = (Color[])(object)new Color[mapWidth * mapHeight];
}
for (int i = 0; i < _pixels.Length; i++)
{
_pixels[i] = Solid;
}
Enumerator<Vector3Int, TileData> enumerator = BlockManager.Instance.TileDatas.Values.GetEnumerator();
while (enumerator.MoveNext())
{
TileData current = enumerator.Current;
Vector3Int position = current.position;
int x = ((Vector3Int)(ref position)).x;
int y = ((Vector3Int)(ref position)).y;
if (x >= 0 && y >= 0 && x < mapWidth && y < mapHeight)
{
_pixels[y * mapWidth + x] = ColorOf(current);
}
}
_texture.SetPixels(Il2CppStructArray<Color>.op_Implicit(_pixels));
_texture.Apply(false);
}
private static Color ColorOf(TileData tile)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected I4, but got Unknown
//IL_0029: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
TileType tileType = tile.tileType;
switch (tileType - 1)
{
case 1:
return Dug;
case 3:
case 4:
case 5:
return BuildColor;
case 0:
{
if (!tile.visibleOre || !OreColors.TryGetValue(tile.ResourceType, out var value))
{
return Solid;
}
return Palette.Ore(tile.ResourceType, value);
}
default:
return Solid;
}
}
private void OnGUI()
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: 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)
if (MinimapPlugin.Shown && _visible && !((Object)(object)_texture == (Object)null) && !((Object)(object)Game.Instance == (Object)null) && !((Object)(object)Game.Instance.player == (Object)null))
{
int value = MinimapPlugin.Scale.Value;
float num = _width * value;
Rect rect = default(Rect);
((Rect)(ref rect))..ctor(10f, (float)(Screen.height - 90 - _height * value), num, (float)(_height * value));
if (_mapStyle == null)
{
_mapStyle = ImGui.TextureStyle(_texture);
}
if (_dotStyle == null)
{
_dotStyle = ImGui.TextureStyle(Texture2D.whiteTexture);
}
ImGui.DrawTexture(rect, _mapStyle);
Vector3 position = ((Component)Game.Instance.player).transform.position;
float num2 = ((Rect)(ref rect)).x + position.x * (float)value;
float num3 = ((Rect)(ref rect)).y + ((float)_height - position.y) * (float)value;
Color color = GUI.color;
DrawMarkers(rect, value);
GUI.color = PlayerColor;
ImGui.DrawTexture(new Rect(num2 - 2f, num3 - 2f, 4f, 4f), _dotStyle);
GUI.color = color;
}
}
private void DrawMarkers(Rect rect, int scale)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
if (AppDomain.CurrentDomain.GetData("sct.markers") is int[] array)
{
for (int i = 0; i + 1 < array.Length; i += 2)
{
float num = ((Rect)(ref rect)).x + ((float)array[i] + 0.5f) * (float)scale;
float num2 = ((Rect)(ref rect)).y + ((float)(_height - array[i + 1]) - 0.5f) * (float)scale;
GUI.color = Color.black;
ImGui.DrawTexture(new Rect(num - 3f, num2 - 3f, 6f, 6f), _dotStyle);
GUI.color = Palette.Marker(i / 2, MarkerPalette[i / 2 % MarkerPalette.Length]);
ImGui.DrawTexture(new Rect(num - 2f, num2 - 2f, 4f, 4f), _dotStyle);
}
}
}
}
}