Decompiled source of Conquest Mode beta v0.0.2
rouge.dll
Decompiled 7 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BlockMoveOptimization; using ConquestCollect; using DM; using FhpSLib; using FhpSLib.BundleModCore; using HarmonyLib; using InControl; using Landfall.TABC; using Landfall.TABS; using Landfall.TABS.AI; using Landfall.TABS.AI.Components; using Landfall.TABS.AI.Components.Modifiers; using Landfall.TABS.AI.Components.Tags; using Landfall.TABS.AI.Systems; using Landfall.TABS.GameMode; using Landfall.TABS.GameState; using Landfall.TABS.Services; using Landfall.TABS.TeamEdge; using Landfall.TABS.UnitPlacement; using Landfall.TABS.WinConditions; using Landfall.TABS.Workshop; using Landfall.TABS_Input; using LevelCreator; using Newtonsoft.Json; using SLMA; using TFBGames; using TMPro; using Unity.Collections; using Unity.Entities; using Unity.Jobs; using Unity.Mathematics; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; using UnityEngine.UI; using buff; using huifu; using kaifz; using rouge; using shijian; using shijian.Events; using xiaohao; using yiwu; using zhuangbei; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Custom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("made in SFT by FhpSlime")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace rouge { public static class UManager { public static string modname; public static string modder; private static string com; public static SLMABundleMod bundleMod; public static SLMABundleMod bundleMod1; static UManager() { modname = "SFT"; modder = "FhpSlime"; } public static void SetRiders(UnitBlueprint me, UnitBlueprint[] riders) { } public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Expected O, but got Unknown //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Expected O, but got Unknown //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Expected O, but got Unknown //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0775: Expected O, but got Unknown //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Expected O, but got Unknown //IL_0e8e: Unknown result type (might be due to invalid IL or missing references) //IL_0e9e: Expected O, but got Unknown //IL_0f0a: Unknown result type (might be due to invalid IL or missing references) //IL_0f1a: Expected O, but got Unknown if (unit.Entity.Name == "UNIT_TRIBAL_THROWER_SPEAR") { SLMATool.UnitCost(unit, 120); unit.attackSpeedMultiplier = 1.5f; } if (unit.Entity.Name == "UNIT_TRIBAL_THROWER_BOULDER") { ((Weapon)UPool.MyPool.AddObject("shitou1", (GameObject)SLMALoader.SDic["weapons"]["Thrower_Boulder"], true, (HideFlags)52, (Sprite)null, 0, false).GetComponentInChildren<RangeWeapon>()).maxRange = 17f; SLMATool.UnitCost(unit, 250); unit.damageMultiplier = 2f; unit.attackSpeedMultiplier = 2f; unit.RightWeapon = UPool.MyPool.GetObject("shitou1"); } if (unit.Entity.Name == "UNIT_TRIBAL_BONEMAGE") { GameObject obj = UPool.MyPool.AddObject("gufa", (GameObject)SLMALoader.SDic["weapons"]["BoneStaff"], true, (HideFlags)52, (Sprite)null, 0, false); ((Weapon)obj.GetComponentInChildren<RangeWeapon>()).maxRange = 13f; ChineseLibrary.设置子弹(obj, bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("E_BoneSpell_3 Effects_VB")); SLMATool.UnitCost(unit, 800); unit.RightWeapon = UPool.MyPool.GetObject("gufa"); unit.health = 300f; unit.damageMultiplier = 3f; unit.attackSpeedMultiplier = 1f; } if (unit.Entity.Name == "UNIT_SUBUNITS_RAPTORRIDER") { unit.turnSpeed = 10f; unit.RightWeapon = bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("SpearRaptorrider_1 Weapons_VB 1"); unit.health = 350f; } if (unit.Entity.Name == "UNIT_ANCIENT_MINOTAUR") { SLMATool.UnitCost(unit, 1600); unit.health = 1350f; unit.m_props = (GameObject[])(object)new GameObject[1] { (GameObject)SLMALoader.SDic["clothes"]["Ancient_Minotaur_ShoulderPad"] }; unit.m_propData = (PropItemData[])(object)new PropItemData[1] { new PropItemData { m_scale = new Vector3(1f, 1f, 1f) } }; } if (unit.Entity.Name == "UNIT_SECRET_SAFE_THROWER") { GameObject val = UPool.MyPool.AddObject("xiufu", (GameObject)SLMALoader.SDic["bases"]["Safe"], true, (HideFlags)52, (Sprite)null, 0, true); val.AddComponent<CoinRewardOnDeath>(); unit.UnitBase = val; } if (unit.Entity.Name == "UNIT_SUBUNITS_DAVINCI") { GameObject val2 = UPool.MyPool.AddObject("111112fu17", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, (Sprite)null, 0, true); val2.AddComponent<NeverShowHealthBar>(); unit.health = 114514f; unit.UnitBase = val2; unit.targetingPriorityMultiplier = 0.001f; } if (unit.Entity.Name == "UNIT_RENAISSANCE_DAVINCITANK") { SLMATool.UnitCost(unit, 4000); unit.movementSpeedMuiltiplier = 1.5f; unit.targetingPriorityMultiplier = 1.2f; unit.health = 5000f; unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) }; unit.damageMultiplier = 10f; } if (unit.Entity.Name == "UNIT_SECRET_BALLOONER") { unit.targetingPriorityMultiplier = 0.5f; SLMATool.UnitCost(unit, 200); unit.health = 200f; } if (unit.Entity.Name == "UNIT_SECRET_TEACHER") { SLMATool.UnitCost(unit, 400); unit.health = 700f; unit.damageMultiplier = 2f; unit.targetingPriorityMultiplier = 0.8f; ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[1] { bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("SwordArtParry 1") }); } if (unit.Entity.Name == "UNIT_LEGACY_CHARIOT") { SLMATool.UnitCost(unit, 1600); unit.health = 1500f; } if (unit.Entity.Name == "UNIT_MEDIEVAL_KNIGHT") { SLMATool.UnitCost(unit, 800); unit.health = 1000f; } if (unit.Entity.Name == "UNIT_SUBUNITS_HORSE_CHARIOT") { unit.health = 1000f; } if (unit.Entity.Name == "UNIT_SECRET_CAVALRYONHORSE") { SLMATool.UnitCost(unit, 1800); unit.health = 1500f; } if (unit.Entity.Name == "UNIT_TRIBAL_CHIEFTAIN") { SLMATool.UnitCost(unit, 1500); unit.health = 1200f; unit.massMultiplier = 5f; unit.attackSpeedMultiplier = 2f; unit.movementSpeedMuiltiplier = 2f; unit.turnSpeed = 36f; unit.RightWeapon = bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("StoneAge_Axe_1 Weapons_VB"); unit.LeftWeapon = bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("StoneAge_Axe_1 Weapons_VB"); } if (unit.Entity.Name == "UNIT_FARMER_HAY") { unit.health = 400f; SLMATool.UnitCost(unit, 200); ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[4] { (GameObject)SLMALoader.SDic["clothes"]["Farmer_Shoes002"], (GameObject)SLMALoader.SDic["clothes"]["Farmer_Hair001"], bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("CP_pirate_barrel_upperarm001"), bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("CP_pirate_barrel_wrist001") }); ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[1] { bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("Hay") }); } if (unit.Entity.Name == "UNIT_FARMER_POTIONSELLER") { SLMATool.UnitCost(unit, 300); unit.RightWeapon = bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("Throw_Potion_1 Weapons_VB"); unit.LeftWeapon = bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("Throw_Potion_1 Weapons_VB"); unit.attackSpeedMultiplier = 2f; } if (unit.Entity.Name == "UNIT_FARMER_SCYTHE") { SLMATool.UnitCost(unit, 600); unit.health = 650f; unit.damageMultiplier = 2f; unit.massMultiplier = 5f; } if (unit.Entity.Name == "UNIT_FARMER_WHEELBARROW") { SLMATool.UnitCost(unit, 1000); unit.massMultiplier = 15f; unit.health = 400f; } if (unit.Entity.Name == "UNIT_SUBUNITS_PITCHFORK_WHEELBARROW") { unit.health = 400f; ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[4] { (GameObject)SLMALoader.SDic["clothes"]["Farmer_Shoes002"], (GameObject)SLMALoader.SDic["clothes"]["Farmer_Hair001"], bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("CP_pirate_barrel_upperarm001"), bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("CP_pirate_barrel_wrist001") }); ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[1] { bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("Hay") }); } if (unit.Entity.Name == "UNIT_SUBUNITS_TRAVELLER") { unit.health = 500f; } if (unit.Entity.Name == "UNIT_SUBUNITS_THROWER_WHEELBARROWAPPLE") { unit.attackSpeedMultiplier = 2f; unit.damageMultiplier = 4f; unit.health = 100f; } if (unit.Entity.Name == "UNIT_FARMER_SCARECROW") { unit.RightWeapon = bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("Thrower_Crow_1 Weapons_VB"); unit.LeftWeapon = bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("Thrower_Crow_1 Weapons_VB"); } if (unit.Entity.Name == "UNIT_SECRET_ICEMAGE") { SLMATool.UnitCost(unit, 800); unit.health = 200f; ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[1] { bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("Move_IceStorm 1") }); } if (unit.Entity.Name == "UNIT_TRIBAL_MAMMOTH") { SLMATool.UnitCost(unit, 2000); unit.health = 4000f; } if (unit.Entity.Name == "UNIT_SUBUNITS_CAVALRY_KNIGHT") { unit.health = 500f; } if (unit.Entity.Name == "UNIT_SECRET_CHUKONU") { SLMATool.UnitCost(unit, 350); unit.movementSpeedMuiltiplier = 1.2f; } if (unit.Entity.Name == "UNIT_SECRET_EXECUTIONER") { SLMATool.UnitCost(unit, 350); unit.health = 500f; } if (unit.Entity.Name == "UNIT_SECRET_BALLANDCHAIN") { SLMATool.UnitCost(unit, 350); unit.health = 500f; } if (unit.Entity.Name == "UNIT_SECRET_SHOUTER") { SLMATool.UnitCost(unit, 400); unit.health = 500f; } if (unit.Entity.Name == "UNIT_SECRET_MACESPINNER") { SLMATool.UnitCost(unit, 500); unit.health = 900f; } if (unit.Entity.Name == "UNIT_SECRET_NECROMANCER") { SLMATool.UnitCost(unit, 1200); unit.health = 900f; } if (unit.Entity.Name == "UNIT_SECRET_SOLARARCHITECT") { SLMATool.UnitCost(unit, 1200); unit.health = 900f; } if (unit.Entity.Name == "UNIT_SECRET_WHEELBARROW_FIRE") { SLMATool.UnitCost(unit, 1500); unit.massMultiplier = 15f; unit.health = 400f; } if (unit.Entity.Name == "UNIT_SECRET_BOMBCANNON") { SLMATool.UnitCost(unit, 1400); unit.damageMultiplier = 2f; } if (unit.Entity.Name == "UNIT_SECRET_VLAD") { SLMATool.UnitCost(unit, 1800); unit.health = 2000f; } if (unit.Entity.Name == "UNIT_SECRET_ARTEMIS") { SLMATool.UnitCost(unit, 5500); unit.damageMultiplier = 2f; } if (unit.Entity.Name == "UNIT_SECRET_CUPID") { SLMATool.UnitCost(unit, 500); unit.attackSpeedMultiplier = 1.5f; } if (unit.Entity.Name == "UNIT_SECRET_JESTER") { SLMATool.UnitCost(unit, 300); unit.targetingPriorityMultiplier = 0.3f; } if (unit.Entity.Name == "UNIT_SECRET_BANSHEE") { SLMATool.UnitCost(unit, 1100); unit.targetingPriorityMultiplier = 0.8f; } if (unit.Entity.Name == "UNIT_SECRET_TAEKWONDO") { SLMATool.UnitCost(unit, 400); unit.targetingPriorityMultiplier = 0.3f; } if (unit.Entity.Name == "UNIT_RENAISSANCE_BALLOON_ARCHER") { SLMATool.UnitCost(unit, 200); ChineseLibrary.设置子弹(unit.RightWeapon, bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("P_Bow_Balloon_1 Prefabs_VB 1")); unit.attackSpeedMultiplier = 1.5f; } if (unit.Entity.Name == "UNIT_RENAISSANCE_MUSKET") { unit.damageMultiplier = 1.5f; unit.attackSpeedMultiplier = 1.2f; } if (unit.Entity.Name == "UNIT_SUBUNITS_JOUSTER") { unit.health = 600f; } if (unit.Entity.Name == "UNIT_RENAISSANCE_JOUSTERONHORSE") { SLMATool.UnitCost(unit, 1000); unit.health = 800f; } if (unit.Entity.Name == "UNIT_SECRET_REDJADE") { SLMATool.UnitCost(unit, 4000); unit.health = 1000f; unit.massMultiplier = 5f; unit.attackSpeedMultiplier = 1.2f; unit.damageMultiplier = 1.5f; List<GameObject> list = unit.m_props.ToList(); if (list == null) { list = new List<GameObject>(); } list.Add(bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("CP_Asia_armorflag002")); unit.m_props = list.ToArray(); ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[5] { UPool.MyPool.GetObject("xiufu19"), bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("炎盾"), bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("红玉火龙卷"), bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("火焰场"), bundleMod.GetAssetBundle("balance").LoadAsset<GameObject>("SpinToWin_Red Jade 1") }); } if (unit.Entity.Name == "UNIT_SECRET_ULLR") { SLMATool.UnitCost(unit, 3000); unit.health = 1500f; ChineseLibrary.设置子弹(unit.RightWeapon, EmbeddedAssetBundleLoader.LoadPrefab("zhengfu", "P_AxeUllr 2")); ChineseLibrary.设置子弹(unit.LeftWeapon, EmbeddedAssetBundleLoader.LoadPrefab("zhengfu", "P_AxeUllr 2")); } if (unit.Entity.Name == "UNIT_WESTERN_QUICKDRAW") { SLMATool.UnitCost(unit, 1200); GameObject obj2 = UPool.MyPool.AddObject("xiufu3", (GameObject)SLMALoader.SDic["weapons"]["Quickdraw_Revolver_AgainstHip"], true, (HideFlags)52, (Sprite)null, 0, true); obj2.GetComponentInChildren<RangeWeapon>().useSpawnDelayForEveryShot = true; obj2.AddComponent<RangeWeaponAmmoFixer>(); unit.damageMultiplier = 2f; unit.RightWeapon = UPool.MyPool.GetObject("xiufu3"); } if (unit.Entity.Name == "UNIT_WESTERN_DEADEYE") { HoldableLookAtFixer holdableLookAtFixer = ((Component)UPool.MyPool.AddObject("xiufu6", (GameObject)SLMALoader.SDic["weapons"]["Winchester"], true, (HideFlags)52, (Sprite)null, 0, true).GetComponentInChildren<Holdable>()).gameObject.AddComponent<HoldableLookAtFixer>(); holdableLookAtFixer.enableFix = true; holdableLookAtFixer.returnSmoothTime = 0.2f; holdableLookAtFixer.returnThreshold = 0.5f; unit.RightWeapon = UPool.MyPool.GetObject("xiufu6"); } if (unit.Entity.Name == "UNIT_VIKING_ARCHER_ICE") { ChineseLibrary.设置子弹(unit.RightWeapon, EmbeddedAssetBundleLoader.LoadPrefab("zhengfu", "P_Bow_Ice 2")); } } public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown Debug.Log((object)"Hey"); if (unit.unitBlueprint.Entity.Name == "unit name") { Renderer[] componentsInChildren = cloth.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].materials = (Material[])(object)new Material[1] { (Material)SLMALoader.SDic["materials"]["Glow_Neon_Green_143734"] }; } } } public static void EditProjectiles(GameObject proj, ProjectileHit projhit, Unit unit, LandfallContentDatabase db) { } public static void EditCombatMoves(GameObject move, int index, Unit unit, LandfallContentDatabase db) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_00c1: Expected O, but got Unknown //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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 2) { move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5] { new Keyframe(0f, 0f), new Keyframe(1f, 1f), new Keyframe(2f, 1f), new Keyframe(0f, 0f), new Keyframe(0f, 0f) }); move.GetComponentInChildren<DodgeMove>().forceMultiplier = -1f; } if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 3) { move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5] { new Keyframe(-1f, 1f), new Keyframe(1f, 1f), new Keyframe(5f, 4f), new Keyframe(0f, 0f), new Keyframe(0f, 0f) }); move.GetComponentInChildren<DodgeMove>().forceMultiplier = -2f; } if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 4) { move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5] { new Keyframe(-1f, 1f), new Keyframe(1f, 1f), new Keyframe(5f, 4f), new Keyframe(0f, 0f), new Keyframe(0f, 0f) }); } } public static void CodeAfterSpawn(Unit unit, LandfallContentDatabase db) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (unit.unitBlueprint.Entity.Name == "unit name") { Transform head = unit.data.head; head.localScale *= 2f; } } public static void Init(LandfallContentDatabase db) { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject value in HelpLibrary.m_unitBases.Values) { if (Object.op_Implicit((Object)(object)value.GetComponentInChildren<SkinnedMeshRenderer>())) { SkinnedMeshRenderer[] componentsInChildren = value.GetComponentsInChildren<SkinnedMeshRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].updateWhenOffscreen = true; } } } AssetBundle val; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("balance")) { val = AssetBundle.LoadFromStream(stream); } if (Loader.BundleMode) { SLMABundleMod obj = SLMABundleMod.CreatSLMABundleMod("TestMod", "0.0.1"); obj.AddAssetBundle("balance", val); obj.Dev_mode = true; obj.LoadAssetBundle("balance"); bundleMod = obj; } ProjectileEntity[] array = Resources.FindObjectsOfTypeAll<ProjectileEntity>(); foreach (ProjectileEntity val2 in array) { ((Component)val2).gameObject.AddComponent<RaycastTrailSp>(); Debug.Log((object)val2); if (!Object.op_Implicit((Object)(object)((Component)val2).GetComponent<RaycastTrail>())) { RaycastTrailSp raycastTrailSp = ((Component)val2).gameObject.AddComponent<RaycastTrailSp>(); raycastTrailSp.mask = ((GameObject)SLMALoader.SDic["projectiles"]["P_FireBall"]).GetComponent<RaycastTrail>().mask; raycastTrailSp.radius = 0.5f; Debug.LogError((object)val2); } } com = "Bundle Mod Init"; com = "Bundle Mod Init"; MyModItems.GetInstance(); com = "——————————Fations and Units——————————"; com = "——————————Clothes——————————"; com = "——————————Weapons——————————"; com = "——————————Effects——————————"; com = "——————————Explosions——————————"; com = "——————————UnitBases——————————"; com = "——————————Projectiles——————————"; com = "——————————Moves——————————"; } public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db) { } public static void SetMoveConditionalValue(this ConditionalEventInstance gameObject, ConditionType type, ValueType valuet, float value) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0065: Expected O, but got Unknown bool flag = false; EventCondition[] conditions = gameObject.conditions; foreach (EventCondition val in conditions) { if (val.conditionType == type) { val.valueType = valuet; val.value = value; flag = true; } } if (!flag) { List<EventCondition> list = gameObject.conditions.ToList(); list.Add(new EventCondition { conditionType = type, valueType = valuet, value = value }); gameObject.conditions = list.ToArray(); } } public static List<UnitBlueprint> GetAllUnitBlueprints() { return ContentDatabase.Instance().GetAllUnitBlueprints().ToList(); } public static void EditBlueprint2(UnitBlueprint unit, LandfallContentDatabase db) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown if (unit.Entity.Name == "UNIT_SECRET_ULLR") { SLMATool.UnitCost(unit, 3000); ChineseLibrary.设置子弹(unit.RightWeapon, EmbeddedAssetBundleLoader.LoadPrefab("zhengfu", "P_AxeUllr 2")); ChineseLibrary.设置子弹(unit.LeftWeapon, EmbeddedAssetBundleLoader.LoadPrefab("zhengfu", "P_AxeUllr 2")); } if (unit.Entity.Name == "UNIT_SECRET_SAFE_THROWER") { GameObject val = UPool.MyPool.AddObject("xiufu", (GameObject)SLMALoader.SDic["bases"]["Safe"], true, (HideFlags)52, (Sprite)null, 0, true); val.AddComponent<CoinRewardOnDeath>(); unit.UnitBase = val; } if (unit.Entity.Name == "UNIT_WESTERN_QUICKDRAW") { SLMATool.UnitCost(unit, 1200); GameObject obj = UPool.MyPool.AddObject("xiufu3", (GameObject)SLMALoader.SDic["weapons"]["Quickdraw_Revolver_AgainstHip"], true, (HideFlags)52, (Sprite)null, 0, true); obj.GetComponentInChildren<RangeWeapon>().useSpawnDelayForEveryShot = true; obj.AddComponent<RangeWeaponAmmoFixer>(); unit.RightWeapon = UPool.MyPool.GetObject("xiufu3"); } if (unit.Entity.Name == "UNIT_WESTERN_DEADEYE") { HoldableLookAtFixer holdableLookAtFixer = ((Component)UPool.MyPool.AddObject("xiufu6", (GameObject)SLMALoader.SDic["weapons"]["Winchester"], true, (HideFlags)52, (Sprite)null, 0, true).GetComponentInChildren<Holdable>()).gameObject.AddComponent<HoldableLookAtFixer>(); holdableLookAtFixer.enableFix = true; holdableLookAtFixer.returnSmoothTime = 0.2f; holdableLookAtFixer.returnThreshold = 0.5f; unit.RightWeapon = UPool.MyPool.GetObject("xiufu6"); } if (unit.Entity.Name == "UNIT_VIKING_ARCHER_ICE") { ChineseLibrary.设置子弹(unit.RightWeapon, EmbeddedAssetBundleLoader.LoadPrefab("zhengfu", "P_Bow_Ice 2")); } } } [BepInPlugin("rouge", "rouge", "1.0.0")] internal class Loader : BaseUnityPlugin { public static bool BundleMode; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_001e: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_005a: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown GameObject val = new GameObject("ConquestMenuLoader") { hideFlags = (HideFlags)61 }; val.AddComponent<ConquestMenuLoader>(); Object.DontDestroyOnLoad((Object)val); GameObject val2 = new GameObject("ConquestSceneAutoLoader") { hideFlags = (HideFlags)61 }; val2.AddComponent<ConquestSceneAutoLoader>(); Object.DontDestroyOnLoad((Object)val2); GameObject val3 = new GameObject("ConquestRestartBattleDialog") { hideFlags = (HideFlags)61 }; val3.AddComponent<ConquestRestartBattleDialog>(); Object.DontDestroyOnLoad((Object)val3); GameObject val4 = new GameObject("HuifuInitializer") { hideFlags = (HideFlags)61 }; val4.AddComponent<HuifuInitializer>(); Object.DontDestroyOnLoad((Object)val4); ((MonoBehaviour)this).StartCoroutine("call"); } private IEnumerator call() { yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null)); yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null)); yield return (object)new WaitForSecondsRealtime(0.3f); SLMALoader.GetInstance(); LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase; UManager.Init(landfallContentDatabase); AddTargetableEffectExplosionTeamFix.ApplyPatches(); BlockMoveOptimizationPatches.ApplyPatches(); new Harmony(UManager.modname).PatchAll(); GOSLMA.EditWeapons = ((GOSLMA.EditWeapons == null) ? new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons) : ((Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons), GOSLMA.EditWeapons))); GOSLMA.EditClothes = ((GOSLMA.EditClothes == null) ? new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes) : ((Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes), GOSLMA.EditClothes))); GOSLMA.EditCombatMoves = ((GOSLMA.EditCombatMoves == null) ? new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves) : ((Action<GameObject, int, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves), GOSLMA.EditCombatMoves))); GOSLMA.CodeAfterSpawn = ((GOSLMA.CodeAfterSpawn == null) ? new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn) : ((Action<Unit, LandfallContentDatabase>)Delegate.Combine(new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn), GOSLMA.CodeAfterSpawn))); GOSLMA.EditProjectiles = ((GOSLMA.EditProjectiles == null) ? new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles) : ((Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles), GOSLMA.EditProjectiles))); UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>(); for (int i = 0; i < array.Length; i++) { UManager.EditBlueprint2(array[i], landfallContentDatabase); } Debug.Log((object)("Loaded " + UManager.modname + " Successfully")); Debug.Log((object)(UManager.modname + "is made in SFT by FhpSlime")); Debug.Log((object)(UManager.modder + "wished you a pleasant trip")); yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)ServiceLocator.GetService<GlobalSettingsHandler>() != (Object)null)); if (DeveloperSettings.IsDeveloperMode) { int num = (DeveloperSettings.IsDeveloperMode ? 1 : 0); CreateSettingGameplay(useLocalization: false, (SettingsType)0, "[Rogue] 开发者模式", num, num, new string[2] { "Disabled", "Enabled" }).OnValueChanged += OnDeveloperModeToggled; } } static Loader() { BundleMode = true; } private void OnDeveloperModeToggled(int newVal) { Debug.Log((object)$"[Rogue] 开发者模式 切换为: {DeveloperSettings.IsDeveloperMode = newVal > 0}"); } public static SettingsInstance CreateSettingGameplay(bool useLocalization, SettingsType type, string key, float defaultValue, float currentValue, string[] options = null, float min = 0f, float max = 1f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0028: 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_0038: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown SettingsInstance val = new SettingsInstance { localizeOptions = useLocalization, settingsType = type, m_settingsKey = key, settingName = key, toolTip = key, options = options, defaultValue = (int)defaultValue, currentValue = (int)currentValue, defaultSliderValue = defaultValue, currentSliderValue = currentValue, min = min, max = max }; GlobalSettingsHandler service = ServiceLocator.GetService<GlobalSettingsHandler>(); List<SettingsInstance> list = service.GameplaySettings.ToList(); list.Add(val); typeof(GlobalSettingsHandler).GetField("m_gameplaySettings", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(service, list.ToArray()); return val; } } } public class Item : MonoBehaviour { public enum kind { Weapon, Cloth, Skill, Unit, Projectile, Other } public string name; public kind Kind; } namespace rouge { public class MyModItems : MonoBehaviour { private static Dictionary<string, Item> items; private static MyModItems instance { get; set; } public static MyModItems GetInstance() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)instance == (Object)null) { instance = new GameObject("MyModItems").AddComponent<MyModItems>(); Object.DontDestroyOnLoad((Object)(object)instance); } return instance; } public void AddItem(Item item) { items.Add(item.name, item); } public Item GetItem(string name) { Item value = new Item { name = null, Kind = Item.kind.Other }; items.TryGetValue(name, out value); return value; } } } public class Example : MonoBehaviour { public GameObject prefab; private void Start() { if ((Object)(object)prefab != (Object)null) { Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(); if (componentsInChildren.Length > 1) { _ = componentsInChildren[1]; } } } } namespace ConquestCollect { [BepInPlugin("me.fern.collectfaction", "CollectFaction", "1.0.0")] public sealed class CollectFactionMain : BaseUnityPlugin { public struct CollectedUnit { public UnitBlueprint blueprint; public int count; } public const string modGUID = "me.fern.collectfaction"; public const string modName = "CollectFaction"; public const string modVersion = "1.0.0"; public static readonly string modPrefix; public readonly Harmony harmony = new Harmony("me.fern.collectfaction"); public static Dictionary<DatabaseID, int> CollectedUnits; public static ConfigEntry<string> SavedCollectJson; public static Faction CollectFaction; private void Start() { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown Debug.Log((object)"[CollectFaction] Start() 执行"); harmony.PatchAll(typeof(HuifuUnitDeathPatch)); Debug.Log((object)"[CollectFaction] 恢复站死亡单位补丁已注册"); harmony.PatchAll(typeof(CollectTransformUnitPatch)); Debug.Log((object)"[CollectFaction] 转变单位收集标记继承补丁已注册"); harmony.PatchAll(typeof(CollectTemporaryUnitDisplayPatch)); Debug.Log((object)"[CollectFaction] 临时单位显示补丁已注册"); harmony.PatchAll(typeof(AscensionMarkAddUnitPatch)); Debug.Log((object)"[CollectFaction] 飞升印记添加单位拦截补丁已注册"); harmony.PatchAll(typeof(AscensionMarkEquipUnitPatch)); Debug.Log((object)"[CollectFaction] 飞升印记赋予装备拦截补丁已注册"); try { harmony.PatchAll(typeof(EquipmentTransformUnitPatch)); Debug.Log((object)"[CollectFaction] 装备继承补丁已注册"); } catch (Exception ex) { Debug.LogWarning((object)("[CollectFaction] 装备继承补丁注册失败: " + ex.Message)); } SavedCollectJson = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CollectedUnits", "{}", (ConfigDescription)null); CollectFaction = ScriptableObject.CreateInstance<Faction>(); CollectFaction.m_entity = new DatabaseEntity((WorkshopContentType)4); CollectFaction.m_entity.SetSpriteIcon((Sprite)null); CollectFaction.m_entity.Name = "收集派系"; CollectFaction.m_entity.m_guid.m_ID = 888666777; CollectFaction.m_entity.m_guid.m_modID = 0; CollectFaction.Units = Array.Empty<UnitBlueprint>(); CollectFaction.CustomFactionColor = new CustomFactionColor { m_Color = Color.white }; CollectFaction.m_displayFaction = true; try { CollectedUnits = JsonConvert.DeserializeObject<Dictionary<DatabaseID, int>>(SavedCollectJson.Value); } catch { CollectedUnits = new Dictionary<DatabaseID, int>(); } UpdateFactionUnits(); ContentDatabase.Instance().LandfallContentDatabase.m_factions.Add(CollectFaction.m_entity.GUID, CollectFaction); ContentDatabase.Instance().AssetLoader.m_nonStreamableAssets.Add(CollectFaction.m_entity.GUID, (Object)CollectFaction); Debug.Log((object)"[CollectFaction] 派系注册完成"); } public static void UpdateFactionUnits() { //IL_0034: 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_013d: Unknown result type (might be due to invalid IL or missing references) List<UnitBlueprint> list = new List<UnitBlueprint>(); foreach (KeyValuePair<DatabaseID, int> collectedUnit in CollectedUnits) { UnitBlueprint unitBlueprint = ContentDatabase.Instance().GetUnitBlueprint(collectedUnit.Key); if ((Object)(object)unitBlueprint != (Object)null && collectedUnit.Value > 0) { list.Add(unitBlueprint); continue; } List<EquippedUnit> equippedUnits = EquipmentSystem.Instance.GetEquippedUnits(); EquippedUnit equippedUnit = equippedUnits.FirstOrDefault((EquippedUnit e) => (Object)(object)e.unitBlueprint != (Object)null && e.unitBlueprint.Entity.GUID.m_ID == collectedUnit.Key.m_ID && e.unitBlueprint.Entity.GUID.m_modID == collectedUnit.Key.m_modID); if (equippedUnit != null && collectedUnit.Value > 0) { list.Add(equippedUnit.unitBlueprint); Debug.Log((object)("[CollectFactionMain] UpdateFactionUnits: 添加自定义装备单位: " + equippedUnit.unitBlueprint.Entity.Name)); continue; } EquippedUnit equippedUnit2 = equippedUnits.FirstOrDefault((EquippedUnit e) => (Object)(object)e.unitBlueprint != (Object)null && e.unitBlueprint.Entity.Name.EndsWith("_test_equipment") && collectedUnit.Key.m_ID == e.unitBlueprint.Entity.GUID.m_ID && collectedUnit.Key.m_modID == e.unitBlueprint.Entity.GUID.m_modID); if (equippedUnit2 != null && collectedUnit.Value > 0) { list.Add(equippedUnit2.unitBlueprint); Debug.Log((object)("[CollectFactionMain] UpdateFactionUnits: 通过名称匹配添加装备单位: " + equippedUnit2.unitBlueprint.Entity.Name)); } else { Debug.LogWarning((object)$"[CollectFactionMain] UpdateFactionUnits: 无法找到单位蓝图,GUID: {collectedUnit.Key.m_modID}:{collectedUnit.Key.m_ID}"); } } CollectFaction.Units = list.ToArray(); } public static void Save() { SavedCollectJson.Value = JsonConvert.SerializeObject((object)CollectedUnits, (Formatting)0); } static CollectFactionMain() { modPrefix = "[CollectFaction] "; CollectedUnits = new Dictionary<DatabaseID, int>(); } public static void AddUnit(UnitBlueprint blueprint) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)blueprint == (Object)null)) { DatabaseID gUID = blueprint.m_entity.GUID; if (CollectedUnits.ContainsKey(gUID)) { CollectedUnits[gUID]++; } else { CollectedUnits[gUID] = 1; } UpdateFactionUnits(); Save(); } } public static void RemoveUnit(UnitBlueprint blueprint) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)blueprint == (Object)null) { return; } DatabaseID gUID = blueprint.m_entity.GUID; if (CollectedUnits.ContainsKey(gUID)) { CollectedUnits[gUID]--; Debug.Log((object)$"[CollectFactionMain] 移除单位 {blueprint.Entity.Name},GUID: {gUID.m_modID}:{gUID.m_ID},剩余数量: {CollectedUnits[gUID]}"); if (CollectedUnits[gUID] <= 0) { CollectedUnits.Remove(gUID); Debug.Log((object)$"[CollectFactionMain] 完全移除单位 {blueprint.Entity.Name},GUID: {gUID.m_modID}:{gUID.m_ID}"); } UpdateFactionUnits(); Save(); } } public static List<CollectedUnit> GetCollectedUnits() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) List<CollectedUnit> list = new List<CollectedUnit>(); foreach (KeyValuePair<DatabaseID, int> collectedUnit in CollectedUnits) { UnitBlueprint unitBlueprint = ContentDatabase.Instance().GetUnitBlueprint(collectedUnit.Key); if ((Object)(object)unitBlueprint != (Object)null && collectedUnit.Value > 0) { list.Add(new CollectedUnit { blueprint = unitBlueprint, count = collectedUnit.Value }); continue; } List<EquippedUnit> equippedUnits = EquipmentSystem.Instance.GetEquippedUnits(); EquippedUnit equippedUnit = equippedUnits.FirstOrDefault((EquippedUnit e) => (Object)(object)e.unitBlueprint != (Object)null && e.unitBlueprint.Entity.GUID.m_ID == collectedUnit.Key.m_ID && e.unitBlueprint.Entity.GUID.m_modID == collectedUnit.Key.m_modID); if (equippedUnit != null && collectedUnit.Value > 0) { list.Add(new CollectedUnit { blueprint = equippedUnit.unitBlueprint, count = collectedUnit.Value }); Debug.Log((object)("[CollectFactionMain] 从装备系统中找到自定义单位: " + equippedUnit.unitBlueprint.Entity.Name)); continue; } EquippedUnit equippedUnit2 = equippedUnits.FirstOrDefault((EquippedUnit e) => (Object)(object)e.unitBlueprint != (Object)null && e.unitBlueprint.Entity.Name.EndsWith("_test_equipment") && collectedUnit.Key.m_ID == e.unitBlueprint.Entity.GUID.m_ID && collectedUnit.Key.m_modID == e.unitBlueprint.Entity.GUID.m_modID); if (equippedUnit2 != null && collectedUnit.Value > 0) { list.Add(new CollectedUnit { blueprint = equippedUnit2.unitBlueprint, count = collectedUnit.Value }); Debug.Log((object)("[CollectFactionMain] 通过名称匹配找到装备单位: " + equippedUnit2.unitBlueprint.Entity.Name)); } else { Debug.LogWarning((object)$"[CollectFactionMain] 无法找到单位蓝图,GUID: {collectedUnit.Key.m_modID}:{collectedUnit.Key.m_ID}, 数量: {collectedUnit.Value}"); } } return list; } public static void ClearAllCollectedUnits() { Debug.Log((object)"[CollectFaction] 清空所有收集的单位"); CollectedUnits.Clear(); UpdateFactionUnits(); Save(); } } [HarmonyPatch(typeof(UnitButton), "OnPointerClick")] internal class PointerClickUnitButtonCollectPatch { private static bool Prefix(UnitButton __instance, PointerEventData eventData) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //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_003b: 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_0055: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_00b5: 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_00c4: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"[CollectFaction] PointerClickUnitButtonCollectPatch 执行"); if (__instance.m_placementUI is PlacementUI && (int)eventData.button == 1) { if (!DeveloperSettings.IsDeveloperMode) { return true; } DatabaseID unitID = __instance.UnitID; if (!CollectFactionMain.CollectedUnits.ContainsKey(unitID)) { CollectFactionMain.CollectedUnits[unitID] = 0; } CollectFactionMain.CollectedUnits[unitID]++; CollectFactionMain.UpdateFactionUnits(); CollectFactionMain.Save(); UnitButtonSetupPatchCollect.RefreshCollectCountBadge(__instance); PlayerCamerasManager service = ServiceLocator.GetService<PlayerCamerasManager>(); MainCam val = ((service != null) ? service.GetMainCam((Player)0) : null); Transform val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform : null); ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("UI/Click", 2f, val2.position + val2.forward * 25f, (MaterialType)0, (Transform)null, 2f); return false; } return true; } } [HarmonyPatch(typeof(PlacementUI), "Awake")] internal class PlacementUIPatchCollect { private static void Prefix(PlacementUI __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CollectIcon", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(__instance.unitLayoutGroup.m_Element.transform); val.AddComponent<Image>().sprite = null; RectTransform component = val.GetComponent<RectTransform>(); component.pivot = new Vector2(-0.5f, -0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta /= 3f; val.SetActive(false); } } [HarmonyPatch(typeof(UnitButton), "SetupUnit", new Type[] { typeof(UnitButtonData) })] internal class UnitButtonSetupPatchCollect { private static void Postfix(UnitButton __instance) { RefreshCollectCountBadge(__instance); } public static void RefreshCollectCountBadge(UnitButton __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) DatabaseID unitID = __instance.UnitID; int value = 0; CollectFactionMain.CollectedUnits.TryGetValue(unitID, out value); Transform val = ((Component)__instance).transform.Find("CollectCountBadge"); if ((Object)val != (Object)null) { Object.Destroy((Object)((Component)val).gameObject); } Transform val2 = ((Component)__instance).transform.Find("EquipmentBadge"); if ((Object)val2 != (Object)null) { Object.Destroy((Object)((Component)val2).gameObject); } if (value <= 0) { return; } GameObject val3 = new GameObject("CollectCountBadge", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(((Component)__instance).transform); ((Graphic)val3.AddComponent<Image>()).color = new Color(1f, 0.8f, 0.2f, 0.9f); RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(1f, 1f); component.anchoredPosition = new Vector2(-8f, -8f); component.sizeDelta = new Vector2(28f, 28f); TextMeshProUGUI obj = new GameObject("Text").AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).transform.SetParent(val3.transform); ((TMP_Text)obj).text = value.ToString(); ((TMP_Text)obj).fontSize = 18f; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((Graphic)obj).color = Color.black; RectTransform component2 = ((Component)obj).GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; UnitBlueprint unitBlueprint = ContentDatabase.Instance().GetUnitBlueprint(unitID); if ((Object)(object)unitBlueprint != (Object)null && (Object)(object)EquipmentSystem.Instance != (Object)null) { EquipmentData unitEquipment = EquipmentSystem.Instance.GetUnitEquipment(unitBlueprint); if (unitEquipment != null && (Object)(object)unitEquipment.icon != (Object)null) { GameObject val4 = new GameObject("EquipmentBadge", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(((Component)__instance).transform); Image obj2 = val4.AddComponent<Image>(); obj2.sprite = unitEquipment.icon; ((Graphic)obj2).color = new Color(1f, 1f, 1f, 0.9f); RectTransform component3 = val4.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(0f, 1f); component3.pivot = new Vector2(0f, 1f); component3.anchoredPosition = new Vector2(8f, -8f); component3.sizeDelta = new Vector2(24f, 24f); } } } } [HarmonyPatch(typeof(UnitPlacementBrush), "PlaceUnitInternal")] internal class CollectPlacementPatch { private static List<Unit> preUnits; private static bool Prefix(UnitBlueprint blueprint, Team team, Vector3 position, Quaternion rotation, bool addToLayout, RuntimeReference runtimeReference, bool costsBudget = true, bool campaignUnit = false, bool checkUserPlacementMaxUnits = false, int martianInstanceId = 0) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown Debug.Log((object)$"[CollectFaction] CollectPlacementPatch 执行 - 队伍: {team}, 战役单位: {campaignUnit}"); if ((int)team > 0 || campaignUnit) { Debug.Log((object)$"[CollectFaction] 跳过处理 - 队伍: {team}, 战役单位: {campaignUnit}"); return true; } if ((Object)(object)PlacementUI.Instance.selectedFactionButton == (Object)null || (Object)(object)PlacementUI.Instance.selectedFactionButton.faction != (Object)(object)CollectFactionMain.CollectFaction) { return true; } int value = 0; CollectFactionMain.CollectedUnits.TryGetValue(blueprint.Entity.GUID, out value); if (CollectFactionMain.CollectFaction.Units == null || !Array.Exists(CollectFactionMain.CollectFaction.Units, (UnitBlueprint u) => (Object)u == (Object)blueprint)) { Debug.Log((object)"[CollectFaction] 单位已不在收集派系,禁止放置"); return false; } if (value <= 0) { ModalPanel service = ServiceLocator.GetService<ModalPanel>(); if ((Object)service != (Object)null) { service.PopUp("收集派系单位已用尽!", (UnityAction)null, -1f, false, Array.Empty<string>()); } Debug.Log((object)"[CollectFaction] 数量为0,禁止继续放置单位,BlockPlacement已调用"); if ((Object)(object)PlacementUI.Instance != (Object)null && PlacementUI.Instance.m_unitPlacementBrush != null) { PlacementUI.Instance.m_unitPlacementBrush.BlockPlacement(); } if ((Object)(object)PlacementUI.Instance != (Object)null && (Object)(object)PlacementUI.Instance.m_selectedButton != (Object)null) { Debug.Log((object)"[CollectFaction] 数量为0,取消当前选中单位按钮"); PlacementUI.Instance.m_selectedButton.Deselect(); PlacementUI.Instance.m_selectedButton = null; } return false; } if (costsBudget) { GameModeService service2 = ServiceLocator.GetService<GameModeService>(); if ((Object)(object)service2 != (Object)null && service2.CurrentGameMode != null) { bool num = service2.CurrentGameMode.BattleBudget.CanAfford(team, (int)blueprint.GetUnitCost(true)); bool flag = (Object)(object)ServiceLocator.GetService<DebugService>() != (Object)null && ServiceLocator.GetService<DebugService>().HasUnlimitedUnitPoints; if (!num && !flag) { Debug.Log((object)$"[CollectFaction] 预算不足,无法放置单位: {blueprint.Entity.Name},需要: {(int)blueprint.GetUnitCost(true)},当前预算: {service2.CurrentGameMode.BattleBudget.GetBudget(team)}"); ModalPanel service3 = ServiceLocator.GetService<ModalPanel>(); if ((Object)service3 != (Object)null) { service3.PopUp("预算不足,无法放置单位!", (UnityAction)null, -1f, false, Array.Empty<string>()); } return false; } } else { Debug.LogWarning((object)"[CollectFaction] 无法获取GameModeService或CurrentGameMode,跳过预算检查"); } } CollectFactionMain.CollectedUnits[blueprint.Entity.GUID] = value - 1; CollectFactionMain.UpdateFactionUnits(); CollectFactionMain.Save(); if ((Object)(object)PlacementUI.Instance.selectedFactionButton != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton.faction == (Object)(object)CollectFactionMain.CollectFaction) { PlacementUI.Instance.RedrawFactionUnits(CollectFactionMain.CollectFaction); } Debug.Log((object)$"[CollectFaction] 收集派系单位放置成功: {blueprint.Entity.Name},剩余数量: {CollectFactionMain.CollectedUnits[blueprint.Entity.GUID]}"); return true; } private static void Postfix(UnitBlueprint blueprint, Team team, Vector3 position, Quaternion rotation, bool addToLayout, RuntimeReference runtimeReference, bool costsBudget = true, bool campaignUnit = false, bool checkUserPlacementMaxUnits = false, int martianInstanceId = 0) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Invalid comparison between Unknown and I4 //IL_0040: 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) if ((Object)(object)PlacementUI.Instance.selectedFactionButton != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton.faction == (Object)(object)CollectFactionMain.CollectFaction && (int)team == 0 && !campaignUnit) { Unit val = (from u in Object.FindObjectsOfType<Unit>() where (Object)(object)u.unitBlueprint == (Object)(object)blueprint select u).ToList().Except(preUnits).FirstOrDefault(); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject.GetComponent<CollectUnitTag>() == (Object)null) { ((Component)val).gameObject.AddComponent<CollectUnitTag>(); Debug.Log((object)$"[CollectFaction] 为玩家单位添加收集派系标签: {blueprint.Entity.Name}, 队伍: {team}, 战役单位: {campaignUnit}"); if (IsEquippedUnit(blueprint)) { ApplyEquipmentToUnit(val); } } } preUnits.Clear(); if ((int)team > 0 || campaignUnit) { return; } try { Type type = Type.GetType("zhuangbei.EquipmentSystem, Assembly-CSharp"); if (!(type != null)) { return; } PropertyInfo property = type.GetProperty("Instance"); if (!(property != null)) { return; } object value = property.GetValue(null); if (value != null) { MethodInfo method = type.GetMethod("RefreshUI"); if (method != null) { method.Invoke(value, null); Debug.Log((object)"[CollectFaction] 已刷新装备UI"); } } } catch (Exception ex) { Debug.LogWarning((object)("[CollectFaction] 刷新装备UI失败: " + ex.Message)); } } static CollectPlacementPatch() { preUnits = new List<Unit>(); } private static bool IsEquippedUnit(UnitBlueprint blueprint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)blueprint == (Object)null) { return false; } return blueprint.Entity.Name.Contains("_"); } private static void ApplyEquipmentToUnit(Unit unit) { try { Type type = Type.GetType("zhuangbei.EquipmentSystem, Assembly-CSharp"); if (!(type != null)) { return; } PropertyInfo property = type.GetProperty("Instance"); if (!(property != null)) { return; } object value = property.GetValue(null); if (value != null) { MethodInfo method = type.GetMethod("ApplyEquipmentToUnit"); if (method != null) { method.Invoke(value, new object[1] { unit }); Debug.Log((object)("[CollectFaction] 已为装备单位应用装备效果: " + unit.unitBlueprint.Entity.Name)); } } } catch (Exception ex) { Debug.LogWarning((object)("[CollectFaction] 应用装备效果失败: " + ex.Message)); } } } [HarmonyPatch(typeof(HealthHandler), "Die", new Type[] { typeof(Unit) })] internal class CollectUnitDeathPatch { private static void Postfix(HealthHandler __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) Unit component = ((Component)__instance).GetComponent<Unit>(); if ((Object)(object)component == (Object)null || (Object)component.unitBlueprint == (Object)null) { return; } if ((int)component.Team != 0) { Debug.Log((object)"[CollectFaction] 敌方单位死亡,不减少收集派系库存"); return; } if ((Object)(object)((Component)component).GetComponent<CollectUnitTag>() == (Object)null) { Debug.Log((object)"[CollectFaction] 单位不是收集派系单位,不减少库存"); return; } if (component.IsRider) { HandleRiderDeath(component); return; } RiderHolder component2 = ((Component)component).GetComponent<RiderHolder>(); if ((Object)(object)component2 != (Object)null && component2.riders != null && component2.riders.Count > 0) { HandleMountDeath(component, component2); } else { HandleNormalUnitDeath(component); } } private static void HandleRiderDeath(Unit riderUnit) { Debug.Log((object)("[CollectFaction] 骑手单位死亡: " + riderUnit.unitBlueprint.Entity.Name)); Mount component = ((Component)riderUnit).GetComponent<Mount>(); if ((Object)(object)component != (Object)null && component.IsMounted) { Unit val = component.OtherData?.unit; if ((Object)(object)val != (Object)null) { CheckCompleteUnitDeath(val); } } else { HandleNormalUnitDeath(riderUnit); } } private static void HandleMountDeath(Unit mountUnit, RiderHolder riderHolder) { Debug.Log((object)("[CollectFaction] 坐骑单位死亡: " + mountUnit.unitBlueprint.Entity.Name)); CheckCompleteUnitDeath(mountUnit); } private static void CheckCompleteUnitDeath(Unit mountUnit) { if (!mountUnit.data.Dead) { Debug.Log((object)("[CollectFaction] 坐骑 " + mountUnit.unitBlueprint.Entity.Name + " 仍然存活,不处理死亡")); return; } string name = mountUnit.unitBlueprint.Entity.Name; if (name == "UNIT_SECRET_SAFE_THROWER" || name.Contains("UNIT_SECRET_SAFE_THROWER")) { Debug.Log((object)("[CollectFaction] 特殊单位 " + name + " 坐骑死亡,直接进行普通单位移除处理")); HandleCompleteUnitDeath(mountUnit); return; } RiderHolder component = ((Component)mountUnit).GetComponent<RiderHolder>(); if ((Object)(object)component != (Object)null && component.riders != null) { bool flag = true; List<Unit> list = new List<Unit>(); foreach (GameObject rider in component.riders) { if ((Object)(object)rider != (Object)null) { Unit component2 = rider.GetComponent<Unit>(); if ((Object)(object)component2 != (Object)null && !component2.data.Dead) { flag = false; list.Add(component2); } } } if (flag) { Debug.Log((object)("[CollectFaction] 坐骑 " + mountUnit.unitBlueprint.Entity.Name + " 和所有骑手都已死亡,处理完整单位组合死亡")); HandleCompleteUnitDeath(mountUnit); return; } Debug.Log((object)("[CollectFaction] 坐骑 " + mountUnit.unitBlueprint.Entity.Name + " 死亡,但仍有存活的骑手: " + string.Join(", ", list.Select((Unit r) => r.unitBlueprint.Entity.Name)) + ",不处理死亡")); } else { Debug.Log((object)("[CollectFaction] 坐骑 " + mountUnit.unitBlueprint.Entity.Name + " 死亡且没有骑手,处理死亡")); HandleCompleteUnitDeath(mountUnit); } } private static void HandleCompleteUnitDeath(Unit mountUnit) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0081: Unknown result type (might be due to invalid IL or missing references) UnitBlueprint val = ((Component)mountUnit).GetComponent<CollectUnitTag>()?.GetInventoryBlueprint(mountUnit) ?? mountUnit.unitBlueprint; DatabaseID gUID = val.Entity.GUID; int value = 0; if (CollectFactionMain.CollectedUnits.TryGetValue(gUID, out value) && value >= 0) { if (IsEquippedUnit(val)) { HandleEquippedUnitDeath(mountUnit); return; } CollectFactionMain.CollectedUnits[gUID] = Mathf.Max(0, value - 1); CollectFactionMain.UpdateFactionUnits(); CollectFactionMain.Save(); Debug.Log((object)$"[CollectFaction] 完整单位组合死亡,减少库存: {val.Entity.Name}, 剩余: {CollectFactionMain.CollectedUnits[gUID]}"); RecordDeadUnitToRecorder(mountUnit); UpdatePlacementUI(); } } private static void HandleNormalUnitDeath(Unit unit) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0081: Unknown result type (might be due to invalid IL or missing references) UnitBlueprint val = ((Component)unit).GetComponent<CollectUnitTag>()?.GetInventoryBlueprint(unit) ?? unit.unitBlueprint; DatabaseID gUID = val.Entity.GUID; int value = 0; if (CollectFactionMain.CollectedUnits.TryGetValue(gUID, out value) && value >= 0) { if (IsEquippedUnit(val)) { HandleEquippedUnitDeath(unit); return; } CollectFactionMain.CollectedUnits[gUID] = Mathf.Max(0, value - 1); CollectFactionMain.UpdateFactionUnits(); CollectFactionMain.Save(); Debug.Log((object)$"[CollectFaction] 普通单位死亡,减少库存: {val.Entity.Name}, 剩余: {CollectFactionMain.CollectedUnits[gUID]}"); RecordDeadUnitToRecorder(unit); UpdatePlacementUI(); } } private static void RecordDeadUnitToRecorder(Unit unit) { try { Type type = Type.GetType("huifu.DeadUnitRecorder, Assembly-CSharp"); if (!(type != null)) { return; } PropertyInfo property = type.GetProperty("Instance"); if (!(property != null)) { return; } object value = property.GetValue(null); if (value != null) { MethodInfo method = type.GetMethod("RecordDeadUnit"); if (method != null) { UnitBlueprint val = ((Component)unit).GetComponent<CollectUnitTag>()?.GetInventoryBlueprint(unit) ?? unit.unitBlueprint; int unitPrice = GetUnitPrice(val); method.Invoke(value, new object[2] { val, unitPrice }); Debug.Log((object)$"[CollectFaction] 记录死亡单位到恢复站: {val.Entity.Name} (原始蓝图), 价格: {unitPrice}"); } } } catch (Exception ex) { Debug.LogWarning((object)("[CollectFaction] 记录死亡单位到恢复站失败: " + ex.Message)); } } private static int GetUnitPrice(UnitBlueprint unitBlueprint) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)unitBlueprint == (Object)null) { return 0; } int num = (int)unitBlueprint.GetUnitCost(true); if (unitBlueprint.useCustomCost && unitBlueprint.customCost > 0) { num = unitBlueprint.customCost; } if (num <= 0) { num = 400; } float num2 = (float)new Random(((object)unitBlueprint.Entity.GUID).GetHashCode()).Next(-20, 21) / 100f; int num3 = Mathf.RoundToInt((float)num * (1f + num2)); return Mathf.Max(50, Mathf.Min(5000, num3)); } private static void UpdatePlacementUI() { if ((Object)(object)PlacementUI.Instance != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton.faction == (Object)(object)CollectFactionMain.CollectFaction) { PlacementUI.Instance.RedrawFactionUnits(CollectFactionMain.CollectFaction); } } private static void HandleEquippedUnitDeath(Unit unit) { try { Type type = Type.GetType("zhuangbei.EquipmentSystem, Assembly-CSharp"); if (!(type != null)) { return; } PropertyInfo property = type.GetProperty("Instance"); if (!(property != null)) { return; } object value = property.GetValue(null); if (value != null) { MethodInfo method = type.GetMethod("ReturnEquipmentOnUnitDeath"); if (method != null) { method.Invoke(value, new object[1] { unit }); Debug.Log((object)("[CollectFaction] 已处理装备单位死亡: " + unit.unitBlueprint.Entity.Name)); } } } catch (Exception ex) { Debug.LogWarning((object)("[CollectFaction] 处理装备单位死亡失败: " + ex.Message)); } } private static bool IsEquippedUnit(UnitBlueprint unitBlueprint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)unitBlueprint == (Object)null) { return false; } return unitBlueprint.Entity.Name.Contains("_"); } } [HarmonyPatch(typeof(BaseGameMode), "OnEnterPlacementState")] internal class CollectReturnPatch { private static void Postfix() { CollectFactionMain.UpdateFactionUnits(); CollectFactionMain.Save(); if ((Object)(object)PlacementUI.Instance != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton.faction == (Object)(object)CollectFactionMain.CollectFaction) { PlacementUI.Instance.RedrawFactionUnits(CollectFactionMain.CollectFaction); } } } public class CollectUnitTag : MonoBehaviour { public UnitBlueprint originalBlueprint; public bool isTransformUnit; public void SetOriginalBlueprint(UnitBlueprint blueprint) { originalBlueprint = blueprint; isTransformUnit = true; } public UnitBlueprint GetInventoryBlueprint(Unit currentUnit) { if (isTransformUnit && (Object)(object)originalBlueprint != (Object)null) { return originalBlueprint; } return currentUnit?.unitBlueprint; } } [HarmonyPatch(typeof(UnitPlacementBrush), "RemoveUnitInternal")] internal class CollectRemovePatch { private static void Postfix(Unit unit, Team team) { //IL_00e8: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)unit == (Object)null) { Debug.Log((object)"[CollectRemovePatch] 单位为空,跳过处理"); return; } if ((Object)(object)unit.unitBlueprint == (Object)null) { Debug.Log((object)("[CollectRemovePatch] 单位 " + ((Object)unit).name + " 的蓝图为空,跳过处理")); return; } CollectUnitTag component = ((Component)unit).GetComponent<CollectUnitTag>(); if ((Object)(object)component == (Object)null) { Debug.Log((object)("[CollectRemovePatch] 单位 " + ((Object)unit).name + " (" + ((Object)unit.unitBlueprint).name + ") 没有CollectUnitTag组件,跳过处理")); return; } Debug.Log((object)("[CollectRemovePatch] 开始处理收集单位移除: " + ((Object)unit).name + " (" + ((Object)unit.unitBlueprint).name + ")")); DatabaseID gUID = (component?.GetInventoryBlueprint(unit) ?? unit.unitBlueprint).Entity.GUID; Debug.Log((object)$"[CollectRemovePatch] 单位GUID: {gUID.m_modID}:{gUID.m_ID}"); if (CollectFactionMain.CollectedUnits.ContainsKey(gUID)) { Debug.Log((object)$"[CollectRemovePatch] 找到收集单位,当前数量: {CollectFactionMain.CollectedUnits[gUID]}"); CollectFactionMain.CollectedUnits[gUID]++; Debug.Log((object)$"[CollectRemovePatch] 单位已返回收集派系,新数量: {CollectFactionMain.CollectedUnits[gUID]}"); CollectFactionMain.UpdateFactionUnits(); CollectFactionMain.Save(); if ((Object)(object)PlacementUI.Instance != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton != (Object)null && (Object)(object)PlacementUI.Instance.selectedFactionButton.faction == (Object)(object)CollectFactionMain.CollectFaction) { PlacementUI.Instance.RedrawFactionUnits(CollectFactionMain.CollectFaction); } } else { Debug.Log((object)$"[CollectRemovePatch] 未找到收集单位,GUID: {gUID.m_modID}:{gUID.m_ID}"); } if (IsEquippedUnit(unit.unitBlueprint)) { Debug.Log((object)("[CollectRemovePatch] 检测到装备单位被移除: " + unit.unitBlueprint.Entity.Name + ",开始处理装备返回")); HandleEquippedUnitRemoval(unit); } Object.Destroy((Object)(object)((Component)unit).GetComponent<CollectUnitTag>()); try { Type type = Type.GetType("zhuangbei.EquipmentSystem, Assembly-CSharp"); if (!(type != null)) { return; } PropertyInfo property = type.GetProperty("Instance"); if (!(property != null)) { return; } object value = property.GetValue(null); if (value != null) { MethodInfo method = type.GetMethod("RefreshUI"); if (method != null) { method.Invoke(value, null); Debug.Log((object)"[CollectRemovePatch] 已刷新装备UI"); } } } catch (Exception ex) { Debug.LogWarning((object)("[CollectRemovePatch] 刷新装备UI失败: " + ex.Message)); } } private static bool IsEquippedUnit(UnitBlueprint unitBlueprint) { if ((Object)(object)unitBlueprint == (Object)null) { return false; } return unitBlueprint.Entity.Name.Contains("_"); } private static void HandleEquippedUnitRemoval(Unit unit) { try { Type type = Type.GetType("zhuangbei.EquipmentSystem, Assembly-CSharp"); if (!(type != null)) { return; } PropertyInfo property = type.GetProperty("Instance"); if (!(property != null)) { return; } object value = property.GetValue(null); if (value != null) { MethodInfo method = type.GetMethod("ReturnEquipmentOnUnitDeath"); if (method != null) { method.Invoke(value, new object[1] { unit }); Debug.Log((object)("[CollectRemovePatch] 已处理装备单位移除: " + unit.unitBlueprint.Entity.Name)); } } } catch (Exception ex) { Debug.LogWarning((object)("[CollectRemovePatch] 处理装备单位移除失败: " + ex.Message)); } } } } public class ConquestRogueLikeMap : MonoBehaviour { [Serializable] public class NodeData { public int id; public string name; public int iconIndex; public Vector2 pos; public List<int> next = new List<int>(); public bool isVisited; public bool isAccessible; public bool isCurrentNode; } [Serializable] public class MapState { public List<List<NodeData>> layers; public Dictionary<int, NodeData> allNodes; public int currentPlayerNodeId = -1; public List<int> visitedNodeIds = new List<int>(); public int majorLayer = 1; } private string embeddedBundleName = "zhengfu"; private string[] iconNames = new string[7] { "营地", "精英战", "事件", "战斗", "恢复站", "BOSS", "宝箱" }; private Sprite[] icons; private string[] nodeNames = new string[7] { "营地", "精英战", "事件", "战斗", "恢复站", "BOSS", "宝箱" }; public List<List<NodeData>> layers = new List<List<NodeData>>(); private int layerCount = 20; private int[] nodesPerLayer; private float yStart = -1300f; private float yStep = 150f; private float xStep = 200f; private Dictionary<int, NodeData> allNodes = new Dictionary<int, NodeData>(); private int minNodes = 4; private int maxNodes = 5; public static MapState SavedState; public static bool ShouldRestoreState; public static string CurrentNodeType = "战斗"; private Dictionary<int, GameObject> nodeGameObjects = new Dictionary<int, GameObject>(); private Dictionary<string, GameObject> lineGameObjects = new Dictionary<string, GameObject>(); private GameObject exitButton; private GameObject confirmDialog; private float animationTime; private float animationSpeed = 2f; private float minScale = 0.8f; private float maxScale = 1.2f; public static bool hasLoadedSave = false; private GameObject battleSelectionDialog; private GameObject treasureChestRewardDialog; private List<string> availableTreasureItems = new List<string>(); private List<string> obtainedTreasureItems = new List<string>(); private GameObject bossFolderSelectionDialog; public static bool RogueLikeBattleSessionActive; public static int EliteBattleTreasureCount = 0; public static int CurrentMajorLayer = 1; private static readonly string[] BOSS_REWARD_ITEMS = new string[14] { "annihilation_engine", "ice_cream", "pandora_box", "star_chart", "rune_dome", "little_house", "prison_cage", "damocles_sword", "black_star", "slave_trader_collar", "void_gate", "cursed_blade", "blood_blade", "charged_gauntlet" }; public static bool BossRewardPending = false; public static bool IsEventBossReward = false; private static HashSet<string> encounteredBattleIds = new HashSet<string>(); private static string currentBattleFilePath = null; private void Start() { EnsureCamera(); LoadIconsFromEmbeddedBundle(); InitializeHealthSystem(); InitializeCoinSystem(); InitializeRewardSystem(); InitializeDialogSystem(); InitializeDeadUnitRecorder(); InitializeEventSystem(); InitializeEquipmentSystem(); InitializeBuffSystem(); InitializeRelicSystem(); InitializeConsumableSystem(); InitializePrisonCageSystem(); InitializeTreasureChestSystem(); InitializeBossBattleManager(); ((MonoBehaviour)this).StartCoroutine(CheckAndLoadSaveFile()); CheckAndShowEliteBattleTreasure(); CheckAndShowBossReward(); } private void LoadIconsFromEmbeddedBundle() { icons = EmbeddedAssetBundleLoader.LoadIcons(embeddedBundleName, iconNames); } private void BuildMapUI() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00e1: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_088e: Expected O, but got Unknown //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_0906: Unknown result type (might be due to invalid IL or missing references) //IL_092b: Unknown result type (might be due to invalid IL or missing references) //IL_0956: Unknown result type (might be due to invalid IL or missing references) //IL_099a: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09ca: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09f1: Unknown result type (might be due to invalid IL or missing references) //IL_09fb: Expected O, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Expected O, but got Unknown //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Expected O, but got Unknown //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_074f: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Expected O, but got Unknown //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Expected O, but got Unknown //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Expected O, but got Unknown //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Expected O, but got Unknown //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Expected O, but got Unknown //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Expected O, but got Unknown //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Expected O, but got Unknown //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Expected O, but got Unknown GameObject val = GameObject.Find("Canvas"); if ((Object)(object)val != (Object)null) { Debug.Log((object)"[ConquestRogueLikeMap] 清理旧的Canvas"); Object.DestroyImmediate((Object)(object)val); } GameObject val2 = new GameObject("Canvas", new Type[3] { typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); val2.GetComponent<Canvas>().renderMode = (RenderMode)0; CanvasScaler component10 = val2.GetComponent<CanvasScaler>(); component10.uiScaleMode = (ScaleMode)1; component10.referenceResolution = new Vector2(1920f, 1080f); GameObject val3 = new GameObject("MapScroll", new Type[3] { typeof(RectTransform), typeof(ScrollRect), typeof(Image) }); val3.transform.SetParent(val2.transform, false); ScrollRect component11 = val3.GetComponent<ScrollRect>(); RectTransform component12 = val3.GetComponent<RectTransform>(); component12.anchorMin = Vector2.zero; component12.anchorMax = Vector2.one; component12.offsetMin = Vector2.zero; component12.offsetMax = Vector2.zero; component11.vertical = true; component11.horizontal = false; component11.movementType = (MovementType)0; ((Graphic)val3.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f); GameObject val4 = new GameObject("Content", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(val3.transform, false); RectTransform component13 = val4.GetComponent<RectTransform>(); component13.anchorMin = new Vector2(0.5f, 1f); component13.anchorMax = new Vector2(0.5f, 1f); component13.pivot = new Vector2(0.5f, 1f); component13.anchoredPosition = Vector2.zero; component13.sizeDelta = new Vector2(800f, 1500f); component11.content = component13; foreach (List<NodeData> layer in layers) { foreach (NodeData item in layer) { foreach (int item2 in item.next) { if (allNodes.ContainsKey(item2)) { Vector2 pos = item.pos; Vector2 pos2 = allNodes[item2].pos; GameObject val5 = new GameObject($"Line{item.id}_{item2}", new Type[2] { typeof(RectTransform), typeof(Image) }); val5.transform.SetParent(val4.transform, false); ((Graphic)val5.GetComponent<Image>()).color = Color.gray; RectTransform component14 = val5.GetComponent<RectTransform>(); component14.sizeDelta = new Vector2(Vector2.Distance(pos, pos2), 8f); component14.anchoredPosition = (pos + pos2) / 2f; float num = Mathf.Atan2(pos2.y - pos.y, pos2.x - pos.x) * 57.29578f; ((Transform)component14).rotation = Quaternion.Euler(0f, 0f, num); string key = $"{item.id}_{item2}"; lineGameObjects[key] = val5; } } } } foreach (List<NodeData> layer2 in layers) { foreach (NodeData item3 in layer2) { GameObject val6 = new GameObject($"Node{item3.id}", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Button) }); val6.transform.SetParent(val4.transform, false); RectTransform component15 = val6.GetComponent<RectTransform>(); component15.sizeDelta = new Vector2(100f, 100f); component15.anchoredPosition = item3.pos; Image component16 = val6.GetComponent<Image>(); component16.sprite = icons[item3.iconIndex]; ((Graphic)component16).color = Color.white; Button component17 = val6.GetComponent<Button>(); int idx = item3.id; nodeGameObjects[idx] = val6; if (allNodes[idx].name == "营地") { ((UnityEvent)component17.onClick).AddListener((UnityAction)delegate { ExecuteAutoSaveBeforeNodeClick(idx, "营地", delegate { bool isDeveloperMode7 = DeveloperSettings.IsDeveloperMode; if (!allNodes[idx].isAccessible && !isDeveloperMode7) { Debug.LogWarning((object)$"节点 {idx} 不可访问"); } else if (allNodes[idx].isVisited && !isDeveloperMode7) { Debug.LogWarning((object)$"节点 {idx} 已访问,无法再次进入"); } else { Debug.Log((object)("点击了节点" + allNodes[idx].name + ",加载yingdi场景")); CurrentNodeType = allNodes[idx].name; MoveToNode(idx); ConquestRogueLikeMap conquestRogueLikeMap7 = Object.FindObjectOfType<ConquestRogueLikeMap>(); if ((Object)(object)conquestRogueLikeMap7 != (Object)null) { conquestRogueLikeMap7.SaveState(); } EmbeddedSceneLoader.LoadSceneFromEmbedded("zhengfumap", "yingdi"); } }); }); } else if (allNodes[idx].name == "战斗") { ((UnityEvent)component17.onClick).AddListener((UnityAction)delegate { ExecuteAutoSaveBeforeNodeClick(idx, "战斗", delegate { bool isDeveloperMode6 = DeveloperSettings.IsDeveloperMode; if (!allNodes[idx].isAccessible && !isDeveloperMode6) { Debug.LogWarning((object)$"节点 {idx} 不可访问"); } else { if (!allNodes[idx].isVisited || isDeveloperMode6) { Debug.Log((object)("点击了节点" + allNodes[idx].name + (isDeveloperMode6 ? "(开发者模式)" : "") + ",加载自定义关卡")); CurrentNodeType = allNodes[idx].name; MoveToNode(idx); try { ConquestRogueLikeMap conquestRogueLikeMap6 = Object.FindObjectOfType<ConquestRogueLikeMap>(); if ((Object)(object)conquestRogueLikeMap6 != (Object)null) { conquestRogueLikeMap6.SaveState(); } int layerIndexByNodeId2 = GetLayerIndexByNodeId(idx); string battlePathByLayer2 = GetBattlePathByLayer(layerIndexByNodeId2); Debug.Log((object)$"[ConquestRogueLikeMap] 战斗节点点击:节点ID={idx}, 层索引={layerIndexByNodeId2}, 大层数={CurrentMajorLayer}, 路径={battlePathByLayer2}"); string[] files3 = Directory.GetFiles(battlePathByLayer2, "*.totallyaccuratebattle"); Debug.Log((object)$"[ConquestRogueLikeMap] 在路径 {battlePathByLayer2} 中找到 {files3.Length} 个战役文件"); if (files3.Length == 0) { Debug.LogError((object)$"未找到任何totallyaccuratebattle文件在路径: {battlePathByLayer2},当前大层数: {CurrentMajorLayer}"); } else if (isDeveloperMode6) { ShowBattleSelectionDialog(files3, $"选择关卡 (第{layerIndexByNodeId2 + 1}层, 大层{CurrentMajorLayer})"); } else { string[] array3 = files3.Where((string f) => !encounteredBattleIds.Contains(f)).ToArray(); if (array3.Length == 0) { Debug.LogWarning((object)"[ConquestRogueLikeMap] 所有战役都已遇到,重置已遇到战役列表"); ResetEncounteredBattles(); array3 = files3; } Random random3 = new Random(); string text5 = array3[random3.Next(array3.Length)]; Debug.Log((object)$"[ConquestRogueLikeMap] 随机选择战役: {Path.GetFileName(text5)} (已遇到战役数: {encounteredBattleIds.Count})"); LoadBattleFromFile(text5); } return; } catch (Exception arg4) { Debug.LogError((object)$"加载随机关卡异常: {arg4}"); return; } } Debug.LogWarning((object)$"节点 {idx} 已访问,无法再次进入"); } }); }); } else if (allNodes[idx].name == "精英战") { ((UnityEvent)component17.onClick).AddListener((UnityAction)delegate { ExecuteAutoSaveBeforeNodeClick(idx, "精英战", delegate { bool isDeveloperMode5 = DeveloperSettings.IsDeveloperMode; if (!allNodes[idx].isAccessible && !isDeveloperMode5) { Debug.LogWarning((object)$"节点 {idx} 不可访问"); } else { if (!allNodes[idx].isVisited || isDeveloperMode5) { Debug.Log((object)("点击了节点" + allNodes[idx].name + (isDeveloperMode5 ? "(开发者模式)" : "") + ",加载精英战关卡")); CurrentNodeType = allNodes[idx].name; MoveToNode(idx); try { ConquestRogueLikeMap conquestRogueLikeMap5 = Object.FindObjectOfType<ConquestRogueLikeMap>(); if ((Object)(object)conquestRogueLikeMap5 != (Object)null) { conquestRogueLikeMap5.SaveState(); } string text4 = Path