using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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 REPOLib.Modules; using SpawnItemInLevel; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.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; } } } internal class ConfigManager { public static Dictionary> ShopItemConfigs = new Dictionary>(); public static Dictionary> ValueItemConfigs = new Dictionary>(); public static Dictionary> ValueItemTypeConfigs = new Dictionary>(); public static ConfigEntry? BindKeyValueItem { get; private set; } public static ConfigEntry? BindKeyShopItem { get; private set; } public static ConfigEntry? ValueTop { get; private set; } public static ConfigEntry? ValueDown { get; private set; } public static ConfigEntry? isDebug { get; private set; } public static ConfigEntry? isOpen { get; private set; } public static ConfigEntry? ValueItemForceMode { get; private set; } public static void Initialize(ConfigFile configFile) { //IL_10e4: Unknown result type (might be due to invalid IL or missing references) //IL_10ee: Expected O, but got Unknown //IL_111a: Unknown result type (might be due to invalid IL or missing references) //IL_1124: Expected O, but got Unknown List> list = new List>(); List list2 = new List(7) { new CEVT("Tiny", "微小的", v3: true, "Cevt"), new CEVT("Small", "小的", v3: false, "Cevt"), new CEVT("Medium", "中的", v3: false, "Cevt"), new CEVT("Big", "大的", v3: false, "Cevt"), new CEVT("Wide", "宽的", v3: false, "Cevt"), new CEVT("Tall", "高的", v3: false, "Cevt"), new CEVT("VeryTall", "很高的", v3: false, "Cevt") }; List list3 = new List(119) { new CESI("Void Staff", "虚空法杖", v3: true, "v0.4"), new CESI("Roll Staff", "翻滚法杖", v3: true, "v0.4"), new CESI("Hauler", "搬运车", v3: true, "v0.4"), new CESI("Defibro", "除颤器", v3: true, "v0.4"), new CESI("Scout", "侦察兵", v3: true, "v0.4"), new CESI("Leaf Blower", "鼓风机", v3: true, "v0.4"), new CESI("Semibot Walkies", "半机械对讲机", v3: true, "v0.4"), new CESI("Zero Gravity Staff", "零重力法杖", v3: true, "v0.4"), new CESI("Tumble Launch Upgrade", "翻滚速度升级", v3: true, "Upgrade"), new CESI("Tumble Wings Upgrade", "翻滚翅膀升级", v3: true, "Upgrade"), new CESI("Crouch Rest Upgrade", "下蹲恢复升级", v3: true, "Upgrade"), new CESI("Sprint Speed Upgrade", "冲刺速度升级", v3: true, "Upgrade"), new CESI("Extra Jump Upgrade", "额外跳跃升级", v3: true, "Upgrade"), new CESI("Health Upgrade", "生命升级", v3: true, "Upgrade"), new CESI("Stamina Upgrade", "体力升级", v3: true, "Upgrade"), new CESI("Strength Upgrade", "力量升级", v3: true, "Upgrade"), new CESI("Range Upgrade", "抓取范围升级", v3: true, "Upgrade"), new CESI("Death Head Battery Upgrade", "头部电池升级", v3: true, "Upgrade"), new CESI("Map Player Count Upgrade", "地图玩家数量升级", v3: true, "Upgrade"), new CESI("Tumble Climb Upgrade", "翻滚抓取升级", v3: true, "Upgrade"), new CESI("Extra Life Upgrade", "额外生命升级", v3: true, "Upgrade"), new CESI("Item Resist Upgrade", "物品抗性升级", v3: true, "MoreUpgrades"), new CESI("Item Value Upgrade", "物品价值升级", v3: true, "MoreUpgrades"), new CESI("Autoscan Upgrade", "自动扫描升级", v3: true, "MoreUpgrades"), new CESI("Valuable Count Upgrade", "贵重物品数量升级", v3: true, "MoreUpgrades"), new CESI("Map Zoom Upgrade", "地图缩放升级", v3: true, "MoreUpgrades"), new CESI("Sprint Usage Upgrade", "冲刺消耗升级", v3: true, "MoreUpgrades"), new CESI("Recharge Drone", "充电无人机", v3: true, "Drone"), new CESI("Indestructible Drone", "无敌无人机", v3: true, "Drone"), new CESI("Zero Gravity Drone", "零重力无人机", v3: true, "Drone"), new CESI("Roll Drone", "滚动无人机", v3: true, "Drone"), new CESI("Feather Drone", "羽毛无人机", v3: true, "Drone"), new CESI("Large Health Pack (100)", "健康包(100)", v3: true, "Health Pack"), new CESI("Medium Health Pack (50)", "健康包(50)", v3: true, "Health Pack"), new CESI("Small Health Pack (25)", "健康包(25)", v3: true, "Health Pack"), new CESI("Sword", "剑", v3: true, "Weapon"), new CESI("Sledge Hammer", "大锤", v3: true, "Weapon"), new CESI("Inflatable Hammer", "充气锤", v3: true, "Weapon"), new CESI("Frying Pan", "铁锅", v3: true, "Weapon"), new CESI("Prodzap", "电击棒", v3: true, "Weapon"), new CESI("Baseball Bat", "棒球棒", v3: true, "Weapon"), new CESI("Grenade", "手榴弹", v3: true, "Weapon"), new CESI("Shockwave Grenade", "冲击波手榴弹", v3: true, "Weapon"), new CESI("Human Grenade", "人类手榴弹", v3: true, "Weapon"), new CESI("Duct Taped Grenades", "胶带手榴弹", v3: true, "Weapon"), new CESI("Stun Grenade", "眩晕手雷", v3: true, "Weapon"), new CESI("Tranq Gun", "麻醉枪", v3: true, "Weapon"), new CESI("Gun", "枪", v3: true, "Weapon"), new CESI("Shotgun", "霰弹枪", v3: true, "Weapon"), new CESI("Photon Blaster", "光子轰击器", v3: true, "Weapon"), new CESI("Boltzap", "电击弩", v3: true, "Weapon"), new CESI("Explosive Mine", "爆炸地雷", v3: true, "Weapon"), new CESI("Shockwave Mine", "冲击波地雷", v3: true, "Weapon"), new CESI("Trapzap", "电击陷阱", v3: true, "Weapon"), new CESI("Phase Bridge", "相位桥", v3: true, "Tool"), new CESI("C.A.R.T.", "C.A.R.T.手推车", v3: true, "Tool"), new CESI("POCKET C.A.R.T.", "迷你C.A.R.T.手推车", v3: true, "Tool"), new CESI("C.A.R.T. Laser", "C.A.R.T.激光炮", v3: true, "Tool"), new CESI("Zero Gravity Orb", "零重力球体", v3: true, "Tool"), new CESI("Duck Bucket", "鸭子桶", v3: true, "Tool"), new CESI("Valuable Tracker", "物品追踪器", v3: true, "Tool"), new CESI("Rubber Duck", "橡胶鸭", v3: true, "Tool"), new CESI("Extraction Tracker", "提取点追踪器", v3: true, "Tool"), new CESI("Energy Crystal", "能量晶体", v3: true, "Tool"), new CESI("Crowbar", "撬棍", v3: true, "SillyValuables"), new CESI("Energy Pistol", "能量手枪", v3: true, "SillyValuables"), new CESI("Lodestone Crossbow", "磁石十字弩", v3: true, "SillyValuables"), new CESI("Slushie Bomb", "冰沙炸弹", v3: true, "SillyValuables"), new CESI("Tech Scepter", "科技权杖", v3: true, "SillyValuables"), new CESI("Pickaxe", "稿子", v3: true, "SillyValuables"), new CESI("Baguette", "法棍面包", v3: true, "SillyValuables"), new CESI("Blerdly", "Blerdly 的戟", v3: true, "SillyValuables"), new CESI("Bloxiade", "Bloxiade(10 秒速度提升)", v3: true, "SillyValuables"), new CESI("Health Bloxy Cola (15)", "Bloxy 可乐(回血 15)", v3: true, "SillyValuables"), new CESI("Candy Bucket (100)", "糖果桶 (100)", v3: true, "SillyValuables"), new CESI("Chips for Noobs (100)", "新手薯片 (100)", v3: true, "SillyValuables"), new CESI("Comic Large Pencil", "漫画大铅笔", v3: true, "SillyValuables"), new CESI("Crimson Periastron", "深红权杖", v3: true, "SillyValuables"), new CESI("Devilsknife", "魔鬼之刃", v3: true, "SillyValuables"), new CESI("Exploding Pumpkin", "爆炸南瓜", v3: true, "SillyValuables"), new CESI("Fortune Healing Potion (65)", "幸运愈合药水 (65)", v3: true, "SillyValuables"), new CESI("Freeze Gun (Stun enemies for 5s)", "冷冻枪(眩晕敌人 5 秒)", v3: true, "SillyValuables"), new CESI("Golden AK47", "黄金 AK47", v3: true, "SillyValuables"), new CESI("Golden Deagle", "黄金沙鹰", v3: true, "SillyValuables"), new CESI("Guts shotgun", "内脏霰弹枪", v3: true, "SillyValuables"), new CESI("Halloween Hammer", "万圣节锤子", v3: true, "SillyValuables"), new CESI("Haunted Cheezburger", "幽灵芝士汉堡 [E](10 秒无敌模式)", v3: true, "SillyValuables"), new CESI("Healing Gun (Shoot to heal teammates)", "治疗枪(射击以治疗队友)", v3: true, "SillyValuables"), new CESI("Illumina", "光辉剑", v3: true, "SillyValuables"), new CESI("Stop Sign", "停车标志牌", v3: true, "SillyValuables"), new CESI("Explosive Snowball", "爆炸雪球", v3: true, "SillyValuables"), new CESI("Keyblade", "键刃", v3: true, "SillyValuables"), new CESI("M&M Peanut Chocolate Bag (50)", "M&M 花生巧克力袋 (50)", v3: true, "SillyValuables"), new CESI("Medkit (150)", "医疗箱 (150)", v3: true, "SillyValuables"), new CESI("Meowmere", "喵喵剑", v3: true, "SillyValuables"), new CESI("Beast Minigun", "兽神加特林", v3: true, "SillyValuables"), new CESI("Monster Energy (15)", "魔爪能量饮料 (15)", v3: true, "SillyValuables"), new CESI("Moon Stick", "月亮法杖", v3: true, "SillyValuables"), new CESI("Muffet Cereal Box (20)", "Muffet 麦片盒 (20)", v3: true, "SillyValuables"), new CESI("Nuclear Bomb", "核弹", v3: true, "SillyValuables"), new CESI("Roblox Paintball Gun", "Roblox 彩弹枪", v3: true, "SillyValuables"), new CESI("Pet Rock", "宠物石(这只宠物能轻易杀死怪物,但寿命很短)", v3: true, "SillyValuables"), new CESI("Pizza (40)", "披萨 (40)", v3: true, "SillyValuables"), new CESI("Rainbow Lucky Block", "彩虹幸运块(不知道里面是什么……)", v3: true, "SillyValuables"), new CESI("Rainbow Pistol", "彩虹手枪", v3: true, "SillyValuables"), new CESI("Riff Ripper", "Riff 破坏者", v3: true, "SillyValuables"), new CESI("Roblox Bomb", "Roblox 炸弹", v3: true, "SillyValuables"), new CESI("Roblox Rocket Launcher", "Roblox 火箭筒", v3: true, "SillyValuables"), new CESI("Shedletsky Gubby", "Shedletsky 长枪", v3: true, "SillyValuables"), new CESI("Spray Can", "喷漆罐", v3: true, "SillyValuables"), new CESI("Subspace Tripmine", "亚空间阔剑地雷", v3: true, "SillyValuables"), new CESI("Summit Shaper", "峰云", v3: true, "SillyValuables"), new CESI("Teddy Bloxpin", "泰迪熊(50% 几率满血复活,50% 几率死亡)", v3: true, "SillyValuables"), new CESI("The Moonlight Greatsword", "月光大剑", v3: true, "SillyValuables"), new CESI("True Knife", "真刀", v3: true, "SillyValuables"), new CESI("Turkey Leg (40)", "火鸡腿 (40)", v3: true, "SillyValuables"), new CESI("Ultraviolet Blaster", "紫外爆破枪", v3: true, "SillyValuables"), new CESI("Venomous Sniper", "剧毒狙击步枪(按 Z 瞄准)", v3: true, "SillyValuables"), new CESI("Water Balloon", "水气球", v3: true, "SillyValuables") }; List list4 = new List(23) { new CEVI("Valuable Wizard Love Potion", "巫师迷情药水", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Levitation Potion", "巫师悬浮药水", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Master Potion", "巫师大师药水", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Power Crystal", "巫师力量水晶", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Time Glass", "巫师沙漏", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Star Wand", "巫师星辰魔杖", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Dumgolfs Staff", "巫师顿尔夫法杖", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Sword", "巫师剑", v3: true, "Wizard Item"), new CEVI("Valuable Wizard Broom", "巫师扫帚", v3: true, "Wizard Item"), new CEVI("Valuable Museum Boombox", "博物馆音响", v3: true, "Museum Item"), new CEVI("Valuable Museum Egg", "博物馆蛋", v3: true, "Museum Item"), new CEVI("Valuable Museum Blender", "博物馆搅拌机", v3: true, "Museum Item"), new CEVI("Valuable Museum Traffic Light", "博物馆红绿灯", v3: true, "Museum Item"), new CEVI("Valuable Manor Uranium Mug", "庄园铀马克杯", v3: true, "Manor Item"), new CEVI("Valuable Manor Uranium Plate", "庄园铀盘子", v3: true, "Manor Item"), new CEVI("Valuable Manor Emerald Bracelet", "庄园翡翠手镯", v3: true, "Manor Item"), new CEVI("Valuable Manor Scream Doll", "庄园尖叫娃娃", v3: true, "Manor Item"), new CEVI("Valuable Manor Music Box", "庄园八音盒", v3: true, "Manor Item"), new CEVI("Valuable Arctic Flamethrower", "北极火焰喷射器", v3: true, "Arctic Item"), new CEVI("Valuable Arctic Flashlight", "北极手电筒", v3: true, "Arctic Item"), new CEVI("Valuable Arctic Fan", "北极风扇", v3: true, "Arctic Item"), new CEVI("Valuable Arctic Ice Saw", "北极冰锯", v3: true, "Arctic Item"), new CEVI("Valuable Arctic Barrel", "北极桶", v3: true, "Arctic Item") }; isOpen = configFile.Bind("Controls", "isOpen", false, "总开关"); isDebug = configFile.Bind("Controls", "isDebug", false, "调试模式"); ValueItemForceMode = configFile.Bind("Controls", "ValueItemForceMode", false, "锁定高价值物品模式"); ValueTop = configFile.Bind("Values", "随机物品价值上限", 50000, new ConfigDescription("随机物品价值上限", (AcceptableValueBase)(object)new AcceptableValueRange(100, 1000000), Array.Empty())); ValueDown = configFile.Bind("Values", "随机物品价值下限", 1000, new ConfigDescription("随机物品价值下限", (AcceptableValueBase)(object)new AcceptableValueRange(100, 1000000), Array.Empty())); BindKeyValueItem = configFile.Bind("Controls", "高价值物品生成按键绑定", (Key)34, "高价值物品生成按键绑定"); BindKeyShopItem = configFile.Bind("Controls", "商店物品生成按键绑定", (Key)21, "商店物品生成按键绑定"); foreach (CEVT item in list2) { list.Add(RegisterValueItemTypeConfig(configFile, item.key, item.value, item.desc, item.modName)); } foreach (CESI item2 in list3) { list.Add(RegisterShopItemConfig(configFile, item2.key, item2.value, item2.desc, item2.modName)); } foreach (CEVI item3 in list4) { list.Add(RegisterValueItemConfig(configFile, item3.key, item3.value, item3.desc, item3.modName)); } } private static ConfigEntry RegisterShopItemConfig(ConfigFile file, string key, bool defaultValue, string description, string modName) { ConfigEntry val = file.Bind(modName, key, defaultValue, description); ShopItemConfigs[key] = val; return val; } public static List GetShopItemAllowed() { List list = new List(); foreach (KeyValuePair> shopItemConfig in ShopItemConfigs) { if (shopItemConfig.Value.Value) { list.Add(shopItemConfig.Key); } } return list; } public static List GetValueItemAllowed() { List list = new List(); foreach (KeyValuePair> valueItemConfig in ValueItemConfigs) { if (valueItemConfig.Value.Value) { list.Add(valueItemConfig.Key); } } return list; } private static ConfigEntry RegisterValueItemTypeConfig(ConfigFile file, string key, bool defaultValue, string description, string modName) { ConfigEntry val = file.Bind(modName, key, defaultValue, description); ValueItemTypeConfigs[key] = val; return val; } private static ConfigEntry RegisterValueItemConfig(ConfigFile file, string key, bool defaultValue, string description, string modName) { ConfigEntry val = file.Bind(modName, key, defaultValue, description); ValueItemConfigs[key] = val; return val; } public static List GetValueItemAllowedType() { List list = new List(); foreach (KeyValuePair> valueItemTypeConfig in ValueItemTypeConfigs) { if (valueItemTypeConfig.Value.Value) { switch (valueItemTypeConfig.Key) { case "Tiny": list.Add((Type)0); break; case "Small": list.Add((Type)1); break; case "Medium": list.Add((Type)2); break; case "Big": list.Add((Type)3); break; case "Wide": list.Add((Type)4); break; case "Tall": list.Add((Type)5); break; case "VeryTall": list.Add((Type)6); break; } } } return list; } } namespace SpawnItemInLevel { internal class CESI { public string key; public string desc; public bool value; public string modName; public CESI(string v1, string v2, bool v3, string? modName = "Controls") { key = v1; desc = v2; value = v3; this.modName = modName; } } internal class CEVI { public string key; public string desc; public bool value; public string modName; public CEVI(string v1, string v2, bool v3, string? modName = "Controls") { key = v1; desc = v2; value = v3; this.modName = modName; } } internal class CEVT { public string key; public string desc; public bool value; public string modName; public CEVT(string v1, string v2, bool v3, string? modName = "Controls") { key = v1; desc = v2; value = v3; this.modName = modName; } } [BepInPlugin("Gs.SpawnItemInLevel", "Spawn Item In Level", "1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SpawnItemInLevel : BaseUnityPlugin { internal static SpawnItemInLevel Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)"Spawn Item In Level Has Loaded!"); } internal void Patch() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown ConfigManager.Initialize(((BaseUnityPlugin)this).Config); if (Harmony == null) { Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); } Harmony.PatchAll(); } internal void Unpatch() { Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } [HarmonyPatch(typeof(ShopManager))] internal static class SpawnManagerPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void KeyboardListener(ShopManager __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } } } internal class SpawnShopItemManager : MonoBehaviour { private static readonly ManualLogSource Logger = Logger.CreateLogSource("SpawnShopItem"); private static readonly Random random = new Random(); private void Update() { //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_0024: Unknown result type (might be due to invalid IL or missing references) if (ConfigManager.isOpen.Value) { Key value = ConfigManager.BindKeyShopItem.Value; if (((ButtonControl)Keyboard.current[value]).wasPressedThisFrame) { GenerateAndSpawnStoreItem(); } } } public void GenerateAndSpawnStoreItem() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (TryGetRandomItem(new List(), out Item item)) { Vector3 position = ((Component)PlayerAvatar.instance).transform.position + Vector3.up * 1f + ((Component)PlayerAvatar.instance).transform.forward * 1.5f; Quaternion identity = Quaternion.identity; SpawnItem(item, position, identity); } else { Logger.LogError((object)"无法获取有效的物品来生成。"); } } private static bool TryGetRandomItem(List? filterTypes, out Item item) { List filterTypes2 = filterTypes; item = null; if (StatsManager.instance?.itemDictionary == null) { Logger.LogError((object)"StatsManager 或 itemDictionary 未初始化"); return false; } List list = ((!filterTypes2.Any()) ? StatsManager.instance.itemDictionary.Values.Select((Item i) => i).ToList() : StatsManager.instance.itemDictionary.Values.Where((Item i) => filterTypes2.Contains(i.itemType)).ToList()); if (ConfigManager.isDebug.Value) { Logger.LogInfo((object)("所有商店物品:\n" + string.Join("\n", list.Select((Item i) => i.itemName)))); } List allowedSI = ConfigManager.GetShopItemAllowed(); if (ConfigManager.isDebug.Value) { Logger.LogInfo((object)("设置的商店物品:\n" + string.Join("\n", allowedSI))); } List list2 = new List(from i in list where (Object)(object)i != (Object)null && i.prefab != null where allowedSI.Contains(i.itemName) select i); if (allowedSI.Count == 0) { Logger.LogWarning((object)"筛选后没有符合条件的物品。从默认的物品集中随机获取。"); int index = random.Next(list.Count); item = list[index]; } else { int index2 = random.Next(list2.Count); item = list2[index2]; } Logger.LogInfo((object)("当前随机选中的商店物品: " + item.itemName)); return true; } private static GameObject SpawnItem(Item item, Vector3 position, Quaternion rotation) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_001f: Unknown result type (might be due to invalid IL or missing references) try { string text = "Items/" + ((Object)item).name; return (!SemiFunc.IsMultiplayer()) ? Object.Instantiate(item.prefab.Prefab, position, rotation) : PhotonNetwork.Instantiate(text, position, rotation, (byte)0, (object[])null); } catch (Exception ex) { Logger.LogError((object)("生成物品 " + item.itemName + " 时发生错误: " + ex.Message)); return null; } } } internal class SpawnValueItemManager : MonoBehaviour { private static readonly Random random = new Random(); private static readonly ManualLogSource Logger = Logger.CreateLogSource("SpawnValueItem"); private void Update() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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) if (!ConfigManager.isOpen.Value || !SemiFunc.RunIsLevel()) { return; } Key value = ConfigManager.BindKeyValueItem.Value; if (((ButtonControl)Keyboard.current[value]).wasPressedThisFrame) { PrefabRef prefab = (PrefabRef)((!ConfigManager.ValueItemForceMode.Value) ? ((object)(GetRandomValuablePrefab() ?? ((IEnumerable)Valuables.AllValuables).FirstOrDefault((Func)((PrefabRef x) => ((Object)x.Prefab).name.Contains("money", StringComparison.OrdinalIgnoreCase))))) : ((object)TryGetRandomItem())); SpawnItem(prefab); } } private void SpawnItem(PrefabRef prefab) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_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) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) ValuableObject val = ((prefab != null) ? prefab.Prefab.GetComponent() : null); if (!((Object)(object)val == (Object)null)) { Vector3 val2 = ((Component)PlayerAvatar.instance).transform.position + new Vector3(0f, 1f, 0f) + ((Component)PlayerAvatar.instance).transform.forward * 2f; if (ConfigManager.ValueTop.Value < ConfigManager.ValueDown.Value) { val.valuePreset.valueMax = ConfigManager.ValueDown.Value; val.valuePreset.valueMin = ConfigManager.ValueTop.Value; } else { val.valuePreset.valueMax = ConfigManager.ValueTop.Value; val.valuePreset.valueMin = ConfigManager.ValueDown.Value; } if (ConfigManager.isDebug.Value) { Logger.LogInfo((object)$"当前随机的高价值物品:{((Object)val).name}、价值:{val.dollarValueCurrent}、物品类型:{val.volumeType}"); } Valuables.SpawnValuable(prefab, val2, Quaternion.identity); } } private PrefabRef? GetRandomValuablePrefab() { if (Valuables.AllValuables == null || !Valuables.AllValuables.Any()) { return null; } List source = Valuables.AllValuables.ToList(); List list = ConfigManager.GetValueItemAllowedType(); if (!list.Any()) { Logger.LogInfo((object)"未开启高价值物品分类设置!将随机选择任意高价值物品"); PrefabRef val = source.ElementAt(random.Next(source.Count())); ValuableObject component = val.Prefab.GetComponent(); Logger.LogInfo((object)("选中的高价值物品:\n" + ((Object)component).name)); return val; } List source2 = (from v in source.Select(delegate(PrefabRef value) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) ValuableObject val4 = ((value != null) ? value.Prefab.GetComponent() : null); return list.Contains(val4.volumeType) ? value : null; }) where v != null select v).ToList(); if (ConfigManager.isDebug.Value) { int i = 1; List values = source2.Select(delegate(PrefabRef v) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) ValuableObject val3 = ((v != null) ? v.Prefab.GetComponent() : null); return $"[{i}]{((Object)val3).name}({val3.volumeType})"; }).ToList(); Logger.LogInfo((object)("所有的高价值物品:\n" + string.Join("\n", values))); } PrefabRef val2 = source2.ElementAt(random.Next(source2.Count())); ValuableObject component2 = val2.Prefab.GetComponent(); Logger.LogInfo((object)("选中的高价值物品:\n" + ((Object)component2).name)); return val2; } private static PrefabRef TryGetRandomItem() { PrefabRef result = null; if (StatsManager.instance?.itemDictionary == null) { Logger.LogError((object)"StatsManager 或 itemDictionary 未初始化"); return result; } List list = Valuables.AllValuables.ToList(); if (ConfigManager.isDebug.Value) { Logger.LogInfo((object)("所有高价值物品:\n" + string.Join("\n", list.Select((PrefabRef i) => i.prefabName)))); } List allowedVI = ConfigManager.GetValueItemAllowed(); if (ConfigManager.isDebug.Value) { Logger.LogInfo((object)("设置的高价值物品:\n" + string.Join("\n", allowedVI))); } List list2 = (from i in list where i != null && (Object)(object)i.Prefab != (Object)null where allowedVI.Contains(i.PrefabName) select i).ToList(); if (allowedVI.Count == 0) { Logger.LogWarning((object)"筛选后没有符合条件的物品。从默认的物品集中随机获取。"); int index = random.Next(list.Count); result = list[index]; } else { int index2 = random.Next(list2.Count); result = list2[index2]; } Logger.LogInfo((object)("当前随机选中的商店物品: " + result.PrefabName)); return result; } } }