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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("EnemyPoint")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EnemyPoint")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1BB229CB-E03B-4010-A922-EFD160632355")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace EnemyPoint; [BepInPlugin("wzk.lingxi.plugin.enemylocation", "Enemy\u00a0Location", "1.0")] public class PatchClass : BaseUnityPlugin { public class EnemyLocationClass { private readonly Dictionary _enemyLocationList = new Dictionary(); public bool EnemyDespawn(EnemyParent enemy) { if (_enemyLocationList.TryGetValue(enemy, out var _)) { _enemyLocationList.Remove(enemy); return true; } return false; } public void AddEnemyLocation(EnemyParent enemy) { //IL_0066: 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) 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) { return; } MapCustom val = ((Component)value).gameObject.AddComponent(); ((Object)val).name = "Enemy_Point_" + enemy.enemyName; val.color = Color.red; Sprite val2 = null; Sprite[] array = Resources.FindObjectsOfTypeAll(); Sprite[] array2 = array; foreach (Sprite val3 in array2) { if (((Object)val3).name == "Map Icon Head") { val2 = val3; break; } } if ((Object)(object)val2 != (Object)null) { val.sprite = val2; } else { array2 = array; foreach (Sprite val4 in array2) { if (((Object)val4).name == "Map Icon Small") { val.sprite = val4; break; } } } _enemyLocationList[enemy] = val; } } private static ConfigEntry _configEntry; private static readonly ManualLogSource logger; public static EnemyLocationClass EnemyLocation; private void Awake() { EnemyLocation = new EnemyLocationClass(); _configEntry = ((BaseUnityPlugin)this).Config.Bind("General", "Enemy Location", true, "True is Enable Enemy Location"); Harmony.CreateAndPatchAll(typeof(PatchClass), (string)null); logger.LogInfo((object)"Plugin Enemy Location is loaded!"); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyParent), "SpawnRPC")] public static void EnemySpawn_POST(ref EnemyParent __instance) { if (_configEntry.Value) { while (GameDirector.instance.PlayerList.Count == 0) { } EnemyLocation.AddEnemyLocation(__instance); logger.LogInfo((object)"Add One Enemy Point"); } } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyParent), "DespawnRPC")] public static void EnemyDespawn_POST(ref EnemyParent __instance) { if (_configEntry.Value && EnemyLocation.EnemyDespawn(__instance)) { logger.LogInfo((object)"Remove One Enemy Point"); } } static PatchClass() { logger = Logger.CreateLogSource("Enemy Location"); } }