using 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("EnemyLocation")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EnemyLocation")] [assembly: AssemblyTitle("EnemyLocation")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 EnemyLocation { [BepInPlugin("wzk.lingxi.plugin.enemylocation", "Enemy Location", "1.0.4")] public class EnemyLocationPlugin : BaseUnityPlugin { public static ManualLogSource LoggerInstance; internal static ConfigEntry ConfigEnabled; internal static EnemyLocationTracker Tracker; private void Awake() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) LoggerInstance = ((BaseUnityPlugin)this).Logger; ConfigEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enable", true, "Enable enemy location on map"); Tracker = new EnemyLocationTracker(); new Harmony("wzk.lingxi.plugin.enemylocation").PatchAll(); LoggerInstance.LogInfo((object)"Enemy Location loaded."); } } internal class EnemyLocationTracker { private readonly Dictionary _enemyLocationList = new Dictionary(); public void AddEnemyLocation(EnemyParent enemy) { //IL_0064: 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) if (_enemyLocationList.ContainsKey(enemy) || GameDirector.instance.PlayerList.Count == 0) { return; } Enemy value = Traverse.Create((object)enemy).Field("Enemy").GetValue(); if (!((Object)(object)value == (Object)null)) { MapCustom val = ((Component)value).gameObject.AddComponent(); ((Object)val).name = "Enemy_Point_" + enemy.enemyName; val.color = Color.red; PlayerDeathHead value2 = Traverse.Create((object)GameDirector.instance.PlayerList[0]).Field("playerDeathHead").GetValue(); if ((Object)(object)value2?.mapCustom != (Object)null) { val.sprite = value2.mapCustom.sprite; } _enemyLocationList[enemy] = val; } } public bool RemoveEnemyLocation(EnemyParent enemy) { if (!_enemyLocationList.TryGetValue(enemy, out MapCustom value)) { return false; } MapCustomEntity value2 = Traverse.Create((object)value).Field("mapCustomEntity").GetValue(); if ((Object)(object)value2 != (Object)null) { Object.Destroy((Object)(object)((Component)value2).gameObject); } _enemyLocationList.Remove(enemy); return true; } } [HarmonyPatch(typeof(EnemyParent))] internal static class EnemyParentPatches { [HarmonyPatch("SpawnRPC")] [HarmonyPostfix] private static void EnemySpawn_POST(EnemyParent __instance) { if (EnemyLocationPlugin.ConfigEnabled.Value) { EnemyLocationPlugin.Tracker.AddEnemyLocation(__instance); } } [HarmonyPatch("DespawnRPC")] [HarmonyPostfix] private static void EnemyDespawn_POST(EnemyParent __instance) { if (EnemyLocationPlugin.ConfigEnabled.Value) { EnemyLocationPlugin.Tracker.RemoveEnemyLocation(__instance); } } } }