using System; 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 Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TooRed")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4+1cdd75b7ced8ac7bd7cf1b44beb3c7f1d3803cff")] [assembly: AssemblyProduct("MoreDefibro")] [assembly: AssemblyTitle("MoreDefibro")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 MoreDefibro { [HarmonyPatch(typeof(ShopManager), "ShopInitialize")] internal static class ShopInitializePatch { private static void Postfix(ShopManager __instance) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.RunIsShop() || !SemiFunc.IsMasterClientOrSingleplayer()) { return; } int num = MoreDefibro.MinSpawnCount.Value; int num2 = MoreDefibro.MaxSpawnCount.Value; if (num < 0 || num2 < 0 || num2 < num) { MoreDefibro.Logger.LogError((object)$"生成数量配置无效(min:{num}, max:{num2}),使用默认值"); num = 1; num2 = 4; } int num3 = Random.Range(num, num2 + 1); if (num3 <= 0) { MoreDefibro.DeBug("生成数量为0直接跳过"); } else { if (!StatsManager.instance.itemDictionary.TryGetValue("Item ReviveItem", out var value)) { return; } Transform extractionPoint = __instance.extractionPoint; MoreDefibro.DeBug($"正在生成{num3}个除颤器..."); Vector3 val = Vector3.ProjectOnPlane(extractionPoint.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.Cross(normalized, Vector3.up); bool flag = SemiFunc.IsMultiplayer(); for (int i = 0; i < num3; i++) { float num4 = 2f + (float)(i % 2) * 0.5f; float num5 = (float)(((i / 2 % 2 != 0) ? 1 : (-1)) * (i / 2 + 1)) * 0.4f; Vector3 val3 = extractionPoint.position + normalized * num4 + val2 * num5; val3.y = 0.5f; if ((Object)(object)((PrefabRef)(object)value.prefab)?.Prefab == (Object)null) { return; } if (flag) { PhotonNetwork.InstantiateRoomObject(((PrefabRef)(object)value.prefab).ResourcePath, val3, Quaternion.identity, (byte)0, (object[])null); } else { Object.Instantiate(((PrefabRef)(object)value.prefab).Prefab, val3, Quaternion.identity); } } MoreDefibro.DeBug("生成完毕"); } } } [HarmonyPatch(typeof(ItemAttributes), "GetValue")] internal static class GetValuePatch { private static void Prefix(ItemAttributes __instance) { if ((Object)(object)__instance.item != (Object)null && ((Object)__instance.item).name == "Item ReviveItem") { int num = MoreDefibro.MinPrice.Value; int num2 = MoreDefibro.MaxPrice.Value; if (num <= 0 || num2 <= 0 || num2 < num) { MoreDefibro.Logger.LogError((object)$"价格配置无效(min:{num}, max:{num2}),使用默认值"); num = 2; num2 = 10; } float itemValueMin = (float)num * 1000f / 4f; float itemValueMax = (float)num2 * 1000f / 4f; __instance.itemValueMin = itemValueMin; __instance.itemValueMax = itemValueMax; } } } [BepInPlugin("TooRed.MoreDefibro", "MoreDefibro", "1.0.4")] public class MoreDefibro : BaseUnityPlugin { internal static MoreDefibro Instance { get; private set; } internal static ManualLogSource Logger => Instance.Log; private ManualLogSource Log => ((BaseUnityPlugin)this).Logger; internal Harmony Harmony { get; set; } public static ConfigEntry MinPrice { get; private set; } public static ConfigEntry MaxPrice { get; private set; } public static ConfigEntry MinSpawnCount { get; private set; } public static ConfigEntry MaxSpawnCount { get; private set; } public static ConfigEntry DebugMode { get; private set; } private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown Instance = this; MinSpawnCount = ((BaseUnityPlugin)this).Config.Bind("Settings", "MinSpawnCount", 1, new ConfigDescription("最小生成数量", (AcceptableValueBase)(object)new AcceptableValueRange(0, 10), Array.Empty())); MaxSpawnCount = ((BaseUnityPlugin)this).Config.Bind("Settings", "MaxSpawnCount", 4, new ConfigDescription("最大生成数量", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); MinPrice = ((BaseUnityPlugin)this).Config.Bind("Settings", "MinPrice", 2, new ConfigDescription("最低价格(千)", (AcceptableValueBase)(object)new AcceptableValueRange(1, 30), Array.Empty())); MaxPrice = ((BaseUnityPlugin)this).Config.Bind("Settings", "MaxPrice", 10, new ConfigDescription("最高价格(千)", (AcceptableValueBase)(object)new AcceptableValueRange(10, 60), Array.Empty())); DebugMode = ((BaseUnityPlugin)this).Config.Bind("Settings", "DebugMode", false, new ConfigDescription("启用调试日志", (AcceptableValueBase)null, Array.Empty())); Patch(); Log.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_0019: 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) //IL_0020: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal static void DeBug(string message) { if (DebugMode.Value) { Logger.LogInfo((object)(message ?? "")); } } } }