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 LandMine v1.0.0
REPO_LandMine.dll
Decompiled a year agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using REPOLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("REPO_LindMine")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("微软中国")] [assembly: AssemblyProduct("REPO_LindMine")] [assembly: AssemblyCopyright("Copyright © 微软中国 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("152f1952-fb63-4bba-8df8-c78766c08abd")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace REPO_LindMine; [BepInPlugin("com.Xiaohai.REPO.LindMine", "REPO.LindMine", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public AudioClip mineBeep; public GameObject landMindPrefeb; public const string version = "1.0.0"; public static Plugin instance; public static ManualLogSource logger; public ConfigEntry<int> landMineAmout; public ConfigEntry<int> landMinePlayerDamage; public ConfigEntry<int> landMineEnemyDamage; public ConfigEntry<float> explodeSize; public ConfigEntry<bool> DetectEnemyCollider; private void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) instance = this; logger = ((BaseUnityPlugin)this).Logger; logger.LogInfo((object)"地雷MOD加载成功,版本:1.0.0"); new Harmony("com.Xiaohai.REPO.LindMine").PatchAll(); LoadAB(); LoadConfig(); } private void LoadAB() { string location = Assembly.GetExecutingAssembly().Location; string directoryName = Path.GetDirectoryName(location); string text = Path.Combine(directoryName, "LandMine"); AssetBundle val = AssetBundle.LoadFromFile(text); mineBeep = val.LoadAsset<AudioClip>("MineBeep.ogg"); if ((Object)(object)mineBeep == (Object)null) { Debug.LogError((object)"加载音频资源 MineBeep.ogg 失败"); } landMindPrefeb = val.LoadAsset<GameObject>("LandMine.prefab"); if ((Object)(object)landMindPrefeb == (Object)null) { Debug.LogError((object)"加载预制体 LandMine.prefab 失败"); } landMindPrefeb.AddComponent<LandMine>(); NetworkPrefabs.RegisterNetworkPrefab(landMindPrefeb); Utilities.FixAudioMixerGroups(landMindPrefeb); } private void LoadConfig() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown landMineAmout = ((BaseUnityPlugin)this).Config.Bind<int>("深陷雷区", "地雷数量/", 25, new ConfigDescription("landMine Amout", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 150), Array.Empty<object>())); landMinePlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("深陷雷区", "玩家伤害", 80, new ConfigDescription("landMine Player Damage", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 999), Array.Empty<object>())); landMineEnemyDamage = ((BaseUnityPlugin)this).Config.Bind<int>("深陷雷区", "怪物伤害", 30, new ConfigDescription("landMine Enemy Damage", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 999), Array.Empty<object>())); DetectEnemyCollider = ((BaseUnityPlugin)this).Config.Bind<bool>("深陷雷区", "检测敌人碰撞体/Detect Enemy Collider?", true, new ConfigDescription("Detect Enemy Collider", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())); explodeSize = ((BaseUnityPlugin)this).Config.Bind<float>("深陷雷区", "地雷爆炸范围", 1.5f, new ConfigDescription("explode Size", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); } } [HarmonyPatch(typeof(LevelGenerator))] public class LevelGeneratorPatch { [HarmonyPostfix] [HarmonyPatch("GenerateDone")] private static void AfterLevelGenerated(LevelGenerator __instance) { //IL_0080: 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_0060: 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) if (!SemiFunc.IsMasterClientOrSingleplayer() || Plugin.instance.landMineAmout.Value <= 0 || !ShouldRunCustomLogic()) { return; } int value = Plugin.instance.landMineAmout.Value; int i; for (i = 0; i < value; i++) { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Instantiate(((Object)Plugin.instance.landMindPrefeb).name, GetRandomPoint(), Quaternion.identity, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(Plugin.instance.landMindPrefeb, GetRandomPoint(), Quaternion.identity); } } Plugin.logger.LogInfo((object)$"地雷数量: 应生成{value},实际生成{i}"); } public static Vector3 GetRandomPoint() { //IL_0030: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_00f1: 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_00ec: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_00aa: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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) LevelPoint[] array = Object.FindObjectsOfType<LevelPoint>(); if (array.Length == 0) { return Vector3.zero; } Transform transform = ((Component)array[Random.Range(0, array.Length)]).transform; Vector3 position = transform.position; Vector3 val = position; for (int i = 0; (float)i < 5f; i++) { if (!HasMineInArea(val, 0.5f)) { return val; } float num = ((i % 2 == 0) ? 1.5f : (-1.5f)); float num2 = ((i % 3 == 0) ? 1.5f : (-1.5f)); val = position + new Vector3((i % 2 == 0) ? num : 0f, 0f, (i % 2 != 0) ? num2 : 0f); Debug.DrawLine(position, val, Color.yellow, 2f); } Debug.LogWarning((object)"无法找到无地雷位置,返回原始点"); return position; } private static bool HasMineInArea(Vector3 position, float radius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) Collider[] array = (Collider[])(object)new Collider[10]; int num = Physics.OverlapSphereNonAlloc(position, radius, array); for (int i = 0; i < num; i++) { if (((Component)array[i]).gameObject.activeInHierarchy && (Object)(object)((Component)array[i]).GetComponentInParent<LandMine>() != (Object)null) { return true; } } return false; } private static bool ShouldRunCustomLogic() { RunManager instance = RunManager.instance; return (Object)(object)instance != (Object)null && instance.levels.Contains(instance.levelCurrent) && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelTutorial && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelShop && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelLobbyMenu; } } internal class LandMine : MonoBehaviour { private ParticleScriptExplosion particle; private float beepTimer = 0f; private AudioSource audio; private Light beepLight; private void Start() { particle = ((Component)this).gameObject.GetComponent<ParticleScriptExplosion>(); if ((Object)(object)particle == (Object)null) { Debug.LogError((object)"ParticlePrefabExplosion 组件缺失!", (Object)(object)this); return; } beepTimer = Time.time; beepLight = ((Component)this).gameObject.GetComponentInChildren<Light>(); audio = ((Component)this).gameObject.GetComponentInChildren<AudioSource>(); if ((Object)(object)audio == (Object)null) { Debug.LogError((object)"AudioSource 组件缺失!", (Object)(object)this); } else { audio.clip = Plugin.instance.mineBeep; } } private void OnTriggerExit(Collider other) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) bool value = Plugin.instance.DetectEnemyCollider.Value; bool flag = true; Enemy componentInChildren = ((Component)((Component)other).transform.parent.parent).GetComponentInChildren<Enemy>(); PlayerAvatar componentInParent = ((Component)other).GetComponentInParent<PlayerAvatar>(); if (!value && !flag) { Plugin.logger.LogInfo((object)"全局开关关闭,不触发任何爆炸"); return; } bool flag2 = (Object)(object)componentInChildren != (Object)null; bool flag3 = (Object)(object)componentInParent != (Object)null; if ((flag2 || flag3) && (!flag2 || value)) { particle.Spawn(((Component)this).transform.position, Plugin.instance.explodeSize.Value, Plugin.instance.landMinePlayerDamage.Value, Plugin.instance.landMineEnemyDamage.Value, 1f, false, false, 1f); Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Update() { if (Time.time - beepTimer >= 3f) { audio.Play(); ((Component)beepLight).gameObject.SetActive(true); beepTimer = Time.time; } if (!audio.isPlaying) { ((Component)beepLight).gameObject.SetActive(false); } } private void OnDestroy() { if ((Object)(object)beepLight != (Object)null) { Object.Destroy((Object)(object)((Component)beepLight).gameObject); } if ((Object)(object)audio != (Object)null) { audio.Stop(); Object.Destroy((Object)(object)audio); } if ((Object)(object)particle != (Object)null) { Object.Destroy((Object)(object)particle); } } }