using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HideMapIcons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1e7743a2924e82e78bb1896e49c50b99ec37911c")]
[assembly: AssemblyProduct("HideMapIcons")]
[assembly: AssemblyTitle("HideMapIcons")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 HideMapIcons
{
[BepInPlugin("Slayer.HideMapIcons", "Hide Map Icons", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource? Log;
public static ConfigFile? BepInExConfig;
public static ConfigEntry<string>? RemovedMapKeywords;
public static ConfigEntry<string>? BlacklistMapKeywords;
private void Awake()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Hide Upgrade Map Icons Started");
BepInExConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, "HideMapIcons.cfg"), true);
RemovedMapKeywords = BepInExConfig.Bind<string>("General", "BlockedMapKeywords", "UPGRADE", "Comma-separated list of keywords to block map icons");
BlacklistMapKeywords = BepInExConfig.Bind<string>("General", "BlacklistMapKeywords", "", "Comma-separated list of keywords to blacklist map icons from removing, so if you put Stamina here but upgrade there, it will hide all upgrades except ones that contain \"stamina\"");
Harmony val = new Harmony("Slayer.HideMapIcons");
val.PatchAll();
}
}
[HarmonyPatch(typeof(Map), "AddCustom")]
public class Patch_Map_AddCustom
{
private static bool Prefix(MapCustom mapCustom, Sprite sprite, Color color)
{
string name = ((Object)mapCustom).name.ToUpper();
IEnumerable<string> source = from k in Plugin.RemovedMapKeywords.Value.Split(',')
select k.Trim().ToUpper() into k
where !string.IsNullOrEmpty(k)
select k;
IEnumerable<string> source2 = from k in Plugin.BlacklistMapKeywords.Value.Split(',')
select k.Trim().ToUpper() into k
where !string.IsNullOrEmpty(k)
select k;
ItemAttributes component = ((Component)mapCustom).gameObject.GetComponent<ItemAttributes>();
if ((Object)(object)component != (Object)null)
{
FieldInfo field = ((object)component).GetType().GetField("itemName", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
string text = field.GetValue(component) as string;
if (!string.IsNullOrEmpty(text))
{
name = text.ToUpper();
}
}
}
if (source.Any((string k) => name.Contains(k)) && !source2.Any((string k) => name.Contains(k)))
{
return false;
}
return true;
}
}
}