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 HexResourceTracker v1.0.0
Plugins/HexResourceTracker.dll
Decompiled 6 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using HexResourceTracker.UI; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HexResourceTracker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HexResourceTracker")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8e0d6812-c80a-4f2c-a0a3-1a47b8270a86")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HexResourceTracker { internal class ResourceTrackerDragHandler : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler { private RectTransform _rectTransform; private Vector2 _startPanelPosition; private Vector2 _startMousePosition; private void Awake() { ref RectTransform rectTransform = ref _rectTransform; Transform parent = ((Component)this).transform.parent; rectTransform = (RectTransform)(object)((parent is RectTransform) ? parent : null); } public void OnBeginDrag(PointerEventData eventData) { //IL_0016: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rectTransform == (Object)null)) { _startPanelPosition = _rectTransform.anchoredPosition; _startMousePosition = eventData.position; } } public void OnDrag(PointerEventData eventData) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) if (!((Object)(object)_rectTransform == (Object)null)) { Vector2 val = eventData.position - _startMousePosition; _rectTransform.anchoredPosition = _startPanelPosition + val; } } } [BepInPlugin("com.hex.resourcetracker", "HexResourceTracker", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string PluginGuid = "com.hex.resourcetracker"; private const string PluginName = "HexResourceTracker"; private const string PluginVersion = "1.0.0"; private Harmony _harmonyInstance; internal static ManualLogSource Log; internal static Plugin Instance; private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; PluginConfig.Initialize(((BaseUnityPlugin)this).Config); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmonyInstance = new Harmony("com.hex.resourcetracker"); _harmonyInstance.PatchAll(executingAssembly); Log.LogInfo((object)"HexResourceTracker v1.0.0 loaded."); } private void OnDestroy() { Log.LogInfo((object)"HexResourceTracker v1.0.0 unloaded."); Harmony harmonyInstance = _harmonyInstance; if (harmonyInstance != null) { harmonyInstance.UnpatchSelf(); } _harmonyInstance = null; Instance = null; Log = null; } } internal static class PluginConfig { private const string GeneralSection = "General"; private const string ResourcesSection = "Resources To Track"; internal static readonly Dictionary<string, ConfigEntry<bool>> ResourceConfigs = new Dictionary<string, ConfigEntry<bool>>(); internal static ConfigEntry<bool> IsModEnabled { get; private set; } internal static void Initialize(ConfigFile config) { IsModEnabled = config.Bind<bool>("General", "Enable", true, "Enable or disable the HexResourceTracker mod."); BindResource(config, "Pickable_Mushroom", "Mushrooms"); BindResource(config, "Pickable_Dandelion", "Dandelions"); BindResource(config, "RaspberryBush", "Raspberries"); BindResource(config, "BlueberryBush", "Blueberries"); BindResource(config, "Pickable_Thistle", "Thistle"); BindResource(config, "Pickable_SeedCarrot", "Carrot Seeds"); BindResource(config, "Pickable_SeedTurnip", "Turnip Seeds"); BindResource(config, "Pickable_Flax_Wild", "Flax"); BindResource(config, "Pickable_Barley_Wild", "Barley"); BindResource(config, "CloudberryBush", "Cloudberries"); BindResource(config, "Pickable_Mushroom_JotunPuffs", "Jotun Puffs"); BindResource(config, "Pickable_Mushroom_Magecap", "Magecap"); } internal static bool IsResourceTrackingEnabled(string prefabName) { if (IsModEnabled.Value && ResourceConfigs.TryGetValue(prefabName, out var value)) { return value.Value; } return false; } private static void BindResource(ConfigFile config, string prefabName, string displayName) { ConfigEntry<bool> entry = config.Bind<bool>("Resources To Track", "Track " + displayName, true, "Enable or disable tracking for " + displayName + "."); entry.SettingChanged += delegate { ResourceTrackerMapOverlay.HandleResourceTrackingChanged(prefabName, entry.Value); ResourcePinManager.HandleResourceTrackingChanged(prefabName, entry.Value); }; ResourceConfigs[prefabName] = entry; } } internal static class ResourcePinManager { internal static readonly float ResourcePinSize = 20f; private const float ClusterRadius = 25f; private static readonly Dictionary<string, Sprite> ResourceSprites = new Dictionary<string, Sprite>(); private static readonly Dictionary<ZDOID, ResourcePinModel> ResourcePinByZdoId = new Dictionary<ZDOID, ResourcePinModel>(); private static readonly FieldInfo MPinUpdateRequired = AccessTools.Field(typeof(Minimap), "m_pinUpdateRequired"); internal static bool TryAddResourcePinFromPickable(Pickable pickable) { //IL_0081: 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) if ((Object)(object)pickable == (Object)null || (Object)(object)Minimap.instance == (Object)null || (Object)(object)pickable.m_itemPrefab == (Object)null) { return false; } ZNetView component = ((Component)pickable).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return false; } if (!pickable.CanBePicked()) { return false; } string pickablePrefabName = ((Object)((Component)pickable).gameObject).name.Replace("(Clone)", string.Empty).Trim(); if (!IsTrackedPickablePrefab(pickablePrefabName)) { return false; } ZDO zDO = component.GetZDO(); if (zDO == null) { return false; } return TryAddResourcePin(new ResourcePinModel(zDO.m_uid, pickablePrefabName, ((Object)pickable.m_itemPrefab).name, ((Component)pickable).transform.position, 25f)); } internal static bool TryAddResourcePin(ResourcePinModel model) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0048: 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_005f: 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) if (model == null || (Object)(object)Minimap.instance == (Object)null || model.ZdoId == ZDOID.None) { return false; } if (ResourcePinByZdoId.ContainsKey(model.ZdoId)) { return false; } if (HasNearbyResourcePin(model)) { return false; } PinData val = Minimap.instance.AddPin(model.Position, (PinType)8, string.Empty, false, false, 0L, default(PlatformUserID)); Sprite sprite = GetSprite(model.ItemPrefabName); if ((Object)(object)sprite != (Object)null) { val.m_icon = sprite; } model.Pin = val; ResourcePinByZdoId[model.ZdoId] = model; SetPinUpdateRequired(); return true; } internal static void HandleResourceTrackingChanged(string pickablePrefabName, bool isEnabled) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(pickablePrefabName)) { return; } if (!isEnabled) { List<ZDOID> list = new List<ZDOID>(); foreach (KeyValuePair<ZDOID, ResourcePinModel> item in ResourcePinByZdoId) { if (item.Value.PickablePrefabName == pickablePrefabName) { list.Add(item.Key); } } { foreach (ZDOID item2 in list) { RemoveResourcePin(item2); } return; } } if ((Object)(object)Minimap.instance == (Object)null) { return; } Pickable[] array = Object.FindObjectsByType<Pickable>((FindObjectsSortMode)0); foreach (Pickable val in array) { if (!((Object)(object)val == (Object)null) && !(((Object)((Component)val).gameObject).name.Replace("(Clone)", string.Empty).Trim() != pickablePrefabName)) { TryAddResourcePinFromPickable(val); } } } internal static void UpdateResourcePinVisuals(Minimap minimap) { if ((Object)(object)minimap == (Object)null) { return; } foreach (ResourcePinModel value in ResourcePinByZdoId.Values) { PinData pin = value.Pin; if (pin != null && !((Object)(object)pin.m_uiElement == (Object)null)) { if (value.ItemPrefabName == "TurnipSeeds" || value.ItemPrefabName == "CarrotSeeds" || value.ItemPrefabName == "Dandelion") { pin.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, 32f); pin.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, 32f); } else { pin.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, ResourcePinSize); pin.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, ResourcePinSize); } } } } internal static bool RemoveResourcePin(ZDOID zdoId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_004a: Unknown result type (might be due to invalid IL or missing references) if (zdoId == ZDOID.None) { return false; } if (!ResourcePinByZdoId.TryGetValue(zdoId, out var value)) { return false; } if (value.Pin != null && (Object)(object)Minimap.instance != (Object)null) { Minimap.instance.RemovePin(value.Pin); } ResourcePinByZdoId.Remove(zdoId); SetPinUpdateRequired(); return true; } internal static void ClearResourcePins() { foreach (ResourcePinModel item in new List<ResourcePinModel>(ResourcePinByZdoId.Values)) { if (item.Pin != null && (Object)(object)Minimap.instance != (Object)null) { Minimap.instance.RemovePin(item.Pin); } } ResourcePinByZdoId.Clear(); SetPinUpdateRequired(); } internal static bool RemoveClosestResourcePin(Vector3 position, float radius) { //IL_0021: 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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) ResourcePinModel resourcePinModel = null; float num = radius * radius; foreach (ResourcePinModel value in ResourcePinByZdoId.Values) { float num2 = value.Position.x - position.x; float num3 = value.Position.z - position.z; float num4 = num2 * num2 + num3 * num3; if (num4 <= num) { num = num4; resourcePinModel = value; } } if (resourcePinModel == null) { return false; } return RemoveResourcePin(resourcePinModel.ZdoId); } private static bool IsTrackedPickablePrefab(string pickablePrefabName) { return PluginConfig.IsResourceTrackingEnabled(pickablePrefabName); } private static bool HasNearbyResourcePin(ResourcePinModel model) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) float num = model.ClusterRadius * model.ClusterRadius; foreach (ResourcePinModel value in ResourcePinByZdoId.Values) { if (!(value.PickablePrefabName != model.PickablePrefabName)) { float num2 = value.Position.x - model.Position.x; float num3 = value.Position.z - model.Position.z; if (num2 * num2 + num3 * num3 <= num) { return true; } } } return false; } private static Sprite GetSprite(string prefabName) { if (string.IsNullOrWhiteSpace(prefabName)) { return null; } if (ResourceSprites.TryGetValue(prefabName, out var value)) { return value; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabName); if ((Object)(object)itemPrefab == (Object)null) { return null; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { return null; } Sprite icon = component.m_itemData.GetIcon(); ResourceSprites[prefabName] = icon; return icon; } private static void SetPinUpdateRequired() { if (!((Object)(object)Minimap.instance == (Object)null)) { MPinUpdateRequired.SetValue(Minimap.instance, true); } } } internal class ResourcePinModel { internal ZDOID ZdoId { get; } internal string PickablePrefabName { get; } internal string ItemPrefabName { get; } internal Vector3 Position { get; } internal float ClusterRadius { get; } internal PinData Pin { get; set; } public ResourcePinModel(ZDOID zdoid, string pickablePrefabName, string itemPrefabName, Vector3 position, float clusterRadius) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001e: Unknown result type (might be due to invalid IL or missing references) ZdoId = zdoid; PickablePrefabName = pickablePrefabName; ItemPrefabName = itemPrefabName; Position = position; ClusterRadius = clusterRadius; } } } namespace HexResourceTracker.UI { internal static class ResourceTrackerMapOverlay { private static GameObject _panel; private static readonly Dictionary<string, Toggle> ResourceToggles = new Dictionary<string, Toggle>(); internal static void Create() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0071: 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_009b: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_panel != (Object)null) && !((Object)(object)Minimap.instance == (Object)null) && !((Object)(object)Minimap.instance.m_largeRoot == (Object)null)) { _panel = new GameObject("HexResourceTrackerOverlay"); _panel.transform.SetParent(Minimap.instance.m_largeRoot.transform, false); RectTransform obj = _panel.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2(-20f, -50f); obj.sizeDelta = new Vector2(180f, 335f); ((Graphic)_panel.AddComponent<Image>()).color = new Color(0.22f, 0.16f, 0.1f, 0.75f); AddTitle(); AddResourceToggle("Pickable_Mushroom", "Mushrooms", -35f); AddResourceToggle("Pickable_Dandelion", "Dandelions", -60f); AddResourceToggle("RaspberryBush", "Raspberries", -85f); AddResourceToggle("BlueberryBush", "Blueberries", -110f); AddResourceToggle("Pickable_Thistle", "Thistle", -135f); AddResourceToggle("Pickable_SeedCarrot", "Carrot Seeds", -160f); AddResourceToggle("Pickable_SeedTurnip", "Turnip Seeds", -185f); AddResourceToggle("Pickable_Flax_Wild", "Flax", -210f); AddResourceToggle("Pickable_Barley_Wild", "Barley", -235f); AddResourceToggle("CloudberryBush", "Cloudberries", -260f); AddResourceToggle("Pickable_Mushroom_JotunPuffs", "Jotun Puffs", -285f); AddResourceToggle("Pickable_Mushroom_Magecap", "Magecap", -310f); } } internal static void HandleResourceTrackingChanged(string prefabName, bool isEnabled) { if (!string.IsNullOrWhiteSpace(prefabName) && ResourceToggles.TryGetValue(prefabName, out var value) && (Object)(object)value != (Object)null) { value.SetIsOnWithoutNotify(isEnabled); } } private static void AddTitle() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) //IL_00c1: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Title"); val.transform.SetParent(_panel.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.anchoredPosition = Vector2.zero; obj.sizeDelta = new Vector2(0f, 28f); Image obj2 = val.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0.1f, 0.07f, 0.04f, 0.95f); ((Graphic)obj2).raycastTarget = true; val.AddComponent<ResourceTrackerDragHandler>(); GameObject val2 = new GameObject("TitleText"); val2.transform.SetParent(val.transform, false); RectTransform obj3 = val2.AddComponent<RectTransform>(); obj3.anchorMin = Vector2.zero; obj3.anchorMax = Vector2.one; obj3.offsetMin = Vector2.zero; obj3.offsetMax = Vector2.zero; TextMeshProUGUI obj4 = val2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj4).font = Minimap.instance.m_biomeNameLarge.font; ((TMP_Text)obj4).text = "Track Resources"; ((TMP_Text)obj4).fontSize = 12f; ((TMP_Text)obj4).alignment = (TextAlignmentOptions)514; ((Graphic)obj4).color = Color.white; GameObject val3 = new GameObject("Separator"); val3.transform.SetParent(val.transform, false); RectTransform obj5 = val3.AddComponent<RectTransform>(); obj5.anchorMin = new Vector2(0f, 0f); obj5.anchorMax = new Vector2(1f, 0f); obj5.pivot = new Vector2(0.5f, 0f); obj5.sizeDelta = new Vector2(0f, 2f); ((Graphic)val3.AddComponent<Image>()).color = new Color(0.6f, 0.5f, 0.3f, 0.8f); } private static void AddResourceToggle(string prefabName, string displayName, float yPosition) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_004a: 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_0074: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00d8: 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_0102: 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_012b: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(prefabName + "_Toggle"); val.transform.SetParent(_panel.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.anchoredPosition = new Vector2(0f, yPosition); obj.sizeDelta = new Vector2(0f, 24f); Toggle val2 = val.AddComponent<Toggle>(); GameObject val3 = new GameObject("Background"); val3.transform.SetParent(val.transform, false); RectTransform obj2 = val3.AddComponent<RectTransform>(); obj2.anchorMin = new Vector2(0f, 0.5f); obj2.anchorMax = new Vector2(0f, 0.5f); obj2.pivot = new Vector2(0f, 0.5f); obj2.anchoredPosition = new Vector2(12f, 0f); obj2.sizeDelta = new Vector2(14f, 14f); Image val4 = val3.AddComponent<Image>(); ((Graphic)val4).color = Color.white; GameObject val5 = new GameObject("Checkmark"); val5.transform.SetParent(val3.transform, false); RectTransform obj3 = val5.AddComponent<RectTransform>(); obj3.anchorMin = Vector2.zero; obj3.anchorMax = Vector2.one; obj3.offsetMin = new Vector2(3f, 3f); obj3.offsetMax = new Vector2(-3f, -3f); Image val6 = val5.AddComponent<Image>(); ((Graphic)val6).color = Color.green; ((Selectable)val2).targetGraphic = (Graphic)(object)val4; val2.graphic = (Graphic)(object)val6; GameObject val7 = new GameObject("Label"); val7.transform.SetParent(val.transform, false); RectTransform obj4 = val7.AddComponent<RectTransform>(); obj4.anchorMin = new Vector2(0f, 0f); obj4.anchorMax = new Vector2(1f, 1f); obj4.offsetMin = new Vector2(34f, 0f); obj4.offsetMax = new Vector2(-10f, 0f); TextMeshProUGUI obj5 = val7.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj5).font = Minimap.instance.m_biomeNameLarge.font; ((TMP_Text)obj5).text = displayName; ((TMP_Text)obj5).fontSize = 14f; ((TMP_Text)obj5).alignment = (TextAlignmentOptions)513; ((Graphic)obj5).color = Color.white; bool value = PluginConfig.ResourceConfigs[prefabName].Value; val2.SetIsOnWithoutNotify(value); ResourceToggles[prefabName] = val2; ((UnityEvent<bool>)(object)val2.onValueChanged).AddListener((UnityAction<bool>)delegate(bool value2) { PluginConfig.ResourceConfigs[prefabName].Value = value2; }); } } } namespace HexResourceTracker.Patches { [HarmonyPatch(typeof(Minimap), "RemovePin", new Type[] { typeof(Vector3), typeof(float) })] internal static class PatchMinimapRemovePin { private static bool Prefix(Vector3 pos, float radius, ref bool __result) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!PluginConfig.IsModEnabled.Value) { return true; } if (ResourcePinManager.RemoveClosestResourcePin(pos, radius)) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(Minimap), "Start")] internal static class PatchMinimapStart { private static void Postfix() { if (PluginConfig.IsModEnabled.Value) { ResourceTrackerMapOverlay.Create(); } } } [HarmonyPatch(typeof(Pickable), "SetPicked")] internal static class PatchPickableSetPicked { private static void Prefix(Pickable __instance, bool picked, ref ZDOID __state) { //IL_000e: 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) //IL_0043: 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) if (!PluginConfig.IsModEnabled.Value) { return; } __state = ZDOID.None; if (!picked || (Object)(object)__instance == (Object)null) { return; } ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null)) { ZDO zDO = component.GetZDO(); if (zDO != null) { __state = zDO.m_uid; } } } private static void Postfix(Pickable __instance, bool picked, ZDOID __state) { //IL_0030: 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_003e: Unknown result type (might be due to invalid IL or missing references) if (!PluginConfig.IsModEnabled.Value) { return; } Plugin.Log.LogInfo((object)$"SetPicked Postfix: {((Object)__instance).name}, picked={picked}"); if (picked) { if (!(__state == ZDOID.None)) { ResourcePinManager.RemoveResourcePin(__state); } } else { Plugin.Log.LogInfo((object)("Restoring pin for " + ((Object)__instance).name)); ResourcePinManager.TryAddResourcePinFromPickable(__instance); } } } [HarmonyPatch(typeof(Pickable), "Awake")] internal static class PatchPickableAwake { private static void Postfix(Pickable __instance) { if (PluginConfig.IsModEnabled.Value) { ResourcePinManager.TryAddResourcePinFromPickable(__instance); } } } [HarmonyPatch(typeof(Minimap), "UpdatePins")] internal static class PatchMinimapUpdatePins { private static void Postfix(Minimap __instance) { if (PluginConfig.IsModEnabled.Value) { ResourcePinManager.UpdateResourcePinVisuals(__instance); } } } }