using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using CesyriTools; using DM; using FhpSLib; using HarmonyLib; 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.UnitPlacement; using Landfall.TABS.Workshop; using Nothing; using SLMA; using TFBGames; using Unity.Entities; using UnityEngine; using UnityEngine.Events; using UnityTools; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Mod name")] [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 Nothing { public static class UManager { public static string modname; public static string modder; private static string com; private static AssetBundle assetBundle; public static List bases; private static readonly FieldInfo _unitDataHandlerField; public static Dictionary 已创建兵种; static UManager() { _unitDataHandlerField = typeof(Unit).GetField("dataHandler", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); modname = "SFT"; modder = "FhpSlime"; } public static void SetRiders(UnitBlueprint me, UnitBlueprint[] riders) { s.SetField(me, "Riders", (object)riders); } public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown if (unit.Entity.Name == "unit name") { unit.health = 114.514f; unit.holdinigWithTwoHands = false; SLMATool.UnitCost(unit, 320); unit.RightWeapon = (GameObject)SLMALoader.SDic["weapons"]["M16 - Automatic"]; unit.LeftWeapon = (GameObject)SLMALoader.SDic["weapons"]["M16 - Automatic"]; SetRiders(unit, (UnitBlueprint[])(object)new UnitBlueprint[1] { SLMATool.super组("Units")[2] }); } } public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if (unit.unitBlueprint.Entity.Name == "unit name") { Renderer[] componentsInChildren = cloth.GetComponentsInChildren(); 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) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (unit.unitBlueprint.Entity.Name == "unit name") { Transform transform = proj.transform; transform.localScale *= 3f; } } public static void EditCombatMoves(GameObject move, int index, Unit unit, LandfallContentDatabase db) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown if (unit.unitBlueprint.Entity.Name == "unit name" && Object.op_Implicit((Object)(object)move.GetComponentInChildren())) { move.GetComponentInChildren().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5] { new Keyframe(0f, 1f), new Keyframe(1f, -2f), new Keyframe(2f, 5f), new Keyframe(6f, -16f), new Keyframe(8f, 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 MC(LandfallContentDatabase db) { //IL_20f8: Unknown result type (might be due to invalid IL or missing references) //IL_2116: Expected O, but got Unknown //IL_215e: Unknown result type (might be due to invalid IL or missing references) //IL_2163: Unknown result type (might be due to invalid IL or missing references) //IL_2178: Unknown result type (might be due to invalid IL or missing references) //IL_217d: Unknown result type (might be due to invalid IL or missing references) //IL_219d: Unknown result type (might be due to invalid IL or missing references) //IL_254d: Unknown result type (might be due to invalid IL or missing references) //IL_25b8: Unknown result type (might be due to invalid IL or missing references) //IL_2637: Unknown result type (might be due to invalid IL or missing references) //IL_2748: Unknown result type (might be due to invalid IL or missing references) //IL_27ac: Unknown result type (might be due to invalid IL or missing references) //IL_2813: Unknown result type (might be due to invalid IL or missing references) //IL_2904: Unknown result type (might be due to invalid IL or missing references) //IL_2996: Unknown result type (might be due to invalid IL or missing references) //IL_2a20: Unknown result type (might be due to invalid IL or missing references) //IL_2ad0: Unknown result type (might be due to invalid IL or missing references) //IL_2b6e: Unknown result type (might be due to invalid IL or missing references) //IL_2bf0: Unknown result type (might be due to invalid IL or missing references) //IL_2c72: Unknown result type (might be due to invalid IL or missing references) //IL_2cf4: Unknown result type (might be due to invalid IL or missing references) //IL_2d76: Unknown result type (might be due to invalid IL or missing references) //IL_2df8: Unknown result type (might be due to invalid IL or missing references) //IL_2e7a: Unknown result type (might be due to invalid IL or missing references) //IL_2efc: Unknown result type (might be due to invalid IL or missing references) //IL_2f7e: Unknown result type (might be due to invalid IL or missing references) //IL_3000: Unknown result type (might be due to invalid IL or missing references) //IL_3082: Unknown result type (might be due to invalid IL or missing references) //IL_3104: Unknown result type (might be due to invalid IL or missing references) //IL_3186: Unknown result type (might be due to invalid IL or missing references) //IL_3208: Unknown result type (might be due to invalid IL or missing references) //IL_328a: Unknown result type (might be due to invalid IL or missing references) //IL_330c: Unknown result type (might be due to invalid IL or missing references) //IL_338e: Unknown result type (might be due to invalid IL or missing references) //IL_3410: Unknown result type (might be due to invalid IL or missing references) //IL_3492: Unknown result type (might be due to invalid IL or missing references) AssetBundle val = (assetBundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("minecraft"))); Faction faction = SLMATool.CreateFaction("MINECRAFT BLOCK", (UnitBlueprint[])null, 图标(val, "pack"), 954150000); Faction faction2 = SLMATool.CreateFaction("MINECRAFT UNIT", (UnitBlueprint[])null, 图标(val, "creeper_spawn_egg"), 954150001); MyModItems.GetInstance(); com = "======服饰======"; com = "====================================="; com = "======近战武器======"; com = "====================================="; UPool.MyPool.AddObject("木剑", val.LoadAsset("木剑"), true, (HideFlags)52, 图标(val, "wooden_sword"), 13800999, true).挥动武器(40f, 1f, 2f, 160f, 7f, 7f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 180f, 0.6f, 1f, 0f, (AnimationRig)1, 40f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 100f); UPool.MyPool.AddObject("石剑", val.LoadAsset("石剑"), true, (HideFlags)52, 图标(val, "stone_sword"), 13801000, true).挥动武器(52f, 1f, 2f, 170f, 7.5f, 7.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 190f, 0.6f, 1f, 0f, (AnimationRig)1, 42f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 110f); UPool.MyPool.AddObject("铁剑", val.LoadAsset("铁剑"), true, (HideFlags)52, 图标(val, "iron_sword"), 13801001, true).挥动武器(68f, 1f, 2f, 185f, 8.5f, 8.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 200f, 0.62f, 1f, 0f, (AnimationRig)1, 46f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.25f, 125f); UPool.MyPool.AddObject("铜剑", val.LoadAsset("铜剑"), true, (HideFlags)52, 图标(val, "copper_sword"), 13801002, true).挥动武器(62f, 1f, 2f, 180f, 8f, 8f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 195f, 0.6f, 1f, 0f, (AnimationRig)1, 44f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 118f); UPool.MyPool.AddObject("金剑", val.LoadAsset("金剑"), true, (HideFlags)52, 图标(val, "golden_sword"), 13801003, true).挥动武器(40f, 0.9f, 2f, 170f, 7f, 7f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 185f, 0.55f, 1f, 0f, (AnimationRig)1, 40f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.15f, 100f); UPool.MyPool.AddObject("钻石剑", val.LoadAsset("钻石剑"), true, (HideFlags)52, 图标(val, "diamond_sword"), 13801004, true).挥动武器(95f, 1f, 2f, 205f, 9.5f, 9.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 215f, 0.68f, 1f, 0f, (AnimationRig)1, 52f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.3f, 145f); UPool.MyPool.AddObject("下界合金剑", val.LoadAsset("下界合金剑"), true, (HideFlags)52, 图标(val, "netherite_sword"), 13801005, true).挥动武器(130f, 1.05f, 2f, 225f, 11f, 11f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 235f, 0.72f, 1f, 0f, (AnimationRig)1, 58f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.35f, 160f); UPool.MyPool.AddObject("木斧", val.LoadAsset("木斧"), true, (HideFlags)52, 图标(val, "wooden_axe"), 13801006, true).挥动武器(65f, 1.5f, 2f, 200f, 12f, 12f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 210f, 0.7f, 1f, 0f, (AnimationRig)1, 52f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.35f, 135f); UPool.MyPool.AddObject("石斧", val.LoadAsset("石斧"), true, (HideFlags)52, 图标(val, "stone_axe"), 13801007, true).挥动武器(78f, 1.55f, 2f, 210f, 13f, 13f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 220f, 0.72f, 1f, 0f, (AnimationRig)1, 55f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.4f, 145f); UPool.MyPool.AddObject("铁斧", val.LoadAsset("铁斧"), true, (HideFlags)52, 图标(val, "iron_axe"), 13801008, true).挥动武器(92f, 1.6f, 2f, 220f, 14f, 14f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 230f, 0.74f, 1f, 0f, (AnimationRig)1, 58f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.45f, 155f); UPool.MyPool.AddObject("铜斧", val.LoadAsset("铜斧"), true, (HideFlags)52, 图标(val, "copper_axe"), 13801009, true).挥动武器(86f, 1.55f, 2f, 215f, 13.5f, 13.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 225f, 0.72f, 1f, 0f, (AnimationRig)1, 56f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.4f); UPool.MyPool.AddObject("金斧", val.LoadAsset("金斧"), true, (HideFlags)52, 图标(val, "golden_axe"), 13801010, true).挥动武器(70f, 1.25f, 2f, 205f, 11f, 11f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 210f, 0.62f, 1f, 0f, (AnimationRig)1, 50f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.3f, 125f); UPool.MyPool.AddObject("钻石斧", val.LoadAsset("钻石斧"), true, (HideFlags)52, 图标(val, "diamond_axe"), 13801011, true).挥动武器(105f, 1.65f, 2f, 235f, 16f, 16f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 245f, 0.78f, 1f, 0f, (AnimationRig)1, 62f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.5f, 170f); UPool.MyPool.AddObject("下界合金斧", val.LoadAsset("下界合金斧"), true, (HideFlags)52, 图标(val, "netherite_axe"), 13801012, true).挥动武器(125f, 1.7f, 2f, 250f, 18f, 18f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 260f, 0.82f, 1f, 0f, (AnimationRig)1, 68f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.55f, 185f); UPool.MyPool.AddObject("木镐", val.LoadAsset("木镐"), true, (HideFlags)52, 图标(val, "wooden_pickaxe"), 13801013, true).挥动武器(25f, 1f, 2f, 165f, 8f, 8f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 185f, 0.5f, 1f, 0f, (AnimationRig)1, 40f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 105f); UPool.MyPool.AddObject("石镐", val.LoadAsset("石镐"), true, (HideFlags)52, 图标(val, "stone_pickaxe"), 13801014, true).挥动武器(32f, 1.05f, 2f, 175f, 8.5f, 8.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 195f, 0.52f, 1f, 0f, (AnimationRig)1, 42f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 110f); UPool.MyPool.AddObject("铁镐", val.LoadAsset("铁镐"), true, (HideFlags)52, 图标(val, "iron_pickaxe"), 13801015, true).挥动武器(42f, 1.1f, 2f, 185f, 9.5f, 9.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 205f, 0.55f, 1f, 0f, (AnimationRig)1, 45f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.25f, 120f); UPool.MyPool.AddObject("铜镐", val.LoadAsset("铜镐"), true, (HideFlags)52, 图标(val, "copper_pickaxe"), 13801016, true).挥动武器(39f, 1.05f, 2f, 180f, 9f, 9f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 200f, 0.53f, 1f, 0f, (AnimationRig)1, 44f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 115f); UPool.MyPool.AddObject("金镐", val.LoadAsset("金镐"), true, (HideFlags)52, 图标(val, "golden_pickaxe"), 13801017, true).挥动武器(28f, 0.85f, 2f, 170f, 7.5f, 7.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 180f, 0.45f, 1f, 0f, (AnimationRig)1, 38f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.15f, 100f); UPool.MyPool.AddObject("钻石镐", val.LoadAsset("钻石镐"), true, (HideFlags)52, 图标(val, "diamond_pickaxe"), 13801018, true).挥动武器(55f, 1.15f, 2f, 200f, 11f, 11f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 220f, 0.58f, 1f, 0f, (AnimationRig)1, 50f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.3f, 135f); UPool.MyPool.AddObject("下界合金镐", val.LoadAsset("下界合金镐"), true, (HideFlags)52, 图标(val, "netherite_pickaxe"), 13801019, true).挥动武器(70f, 1.2f, 2f, 215f, 13f, 13f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 235f, 0.62f, 1f, 0f, (AnimationRig)1, 55f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.35f); UPool.MyPool.AddObject("木铲", val.LoadAsset("木铲"), true, (HideFlags)52, 图标(val, "wooden_shovel"), 13801020, true).挥动武器(20f, 0.95f, 2f, 160f, 7.5f, 7.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 180f, 0.5f, 1f, 0f, (AnimationRig)1, 38f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 100f); UPool.MyPool.AddObject("石铲", val.LoadAsset("石铲"), true, (HideFlags)52, 图标(val, "stone_shovel"), 13801021, true).挥动武器(26f, 1f, 2f, 170f, 8f, 8f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 190f, 0.51f, 1f, 0f, (AnimationRig)1, 40f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 105f); UPool.MyPool.AddObject("铁铲", val.LoadAsset("铁铲"), true, (HideFlags)52, 图标(val, "iron_shovel"), 13801022, true).挥动武器(34f, 1.05f, 2f, 180f, 9f, 9f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 200f, 0.54f, 1f, 0f, (AnimationRig)1, 43f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.25f, 115f); UPool.MyPool.AddObject("铜铲", val.LoadAsset("铜铲"), true, (HideFlags)52, 图标(val, "copper_shovel"), 13801023, true).挥动武器(31f, 1f, 2f, 175f, 8.5f, 8.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 195f, 0.52f, 1f, 0f, (AnimationRig)1, 41f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 110f); UPool.MyPool.AddObject("金铲", val.LoadAsset("金铲"), true, (HideFlags)52, 图标(val, "golden_shovel"), 13801024, true).挥动武器(22f, 0.8f, 2f, 165f, 7f, 7f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 175f, 0.45f, 1f, 0f, (AnimationRig)1, 36f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.1f, 95f); UPool.MyPool.AddObject("钻石铲", val.LoadAsset("钻石铲"), true, (HideFlags)52, 图标(val, "diamond_shovel"), 13801025, true).挥动武器(45f, 1.1f, 2f, 195f, 10f, 10f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 210f, 0.57f, 1f, 0f, (AnimationRig)1, 48f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.3f, 130f); UPool.MyPool.AddObject("下界合金铲", val.LoadAsset("下界合金铲"), true, (HideFlags)52, 图标(val, "netherite_shovel"), 13801026, true).挥动武器(58f, 1.15f, 2f, 210f, 12f, 12f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 225f, 0.6f, 1f, 0f, (AnimationRig)1, 53f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.35f, 145f); UPool.MyPool.AddObject("木锄", val.LoadAsset("木锄"), true, (HideFlags)52, 图标(val, "wooden_hoe"), 13801027, true).挥动武器(16f, 0.85f, 2f, 155f, 6.5f, 6.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 175f, 0.48f, 1f, 0f, (AnimationRig)1, 35f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.1f, 90f); UPool.MyPool.AddObject("石锄", val.LoadAsset("石锄"), true, (HideFlags)52, 图标(val, "stone_hoe"), 13801028, true).挥动武器(21f, 0.9f, 2f, 165f, 7f, 7f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 180f, 0.5f, 1f, 0f, (AnimationRig)1, 37f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.1f, 95f); UPool.MyPool.AddObject("铁锄", val.LoadAsset("铁锄"), true, (HideFlags)52, 图标(val, "iron_hoe"), 13801029, true).挥动武器(28f, 0.95f, 2f, 175f, 8f, 8f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 190f, 0.52f, 1f, 0f, (AnimationRig)1, 40f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 105f); UPool.MyPool.AddObject("铜锄", val.LoadAsset("铜锄"), true, (HideFlags)52, 图标(val, "copper_hoe"), 13801030, true).挥动武器(25f, 0.9f, 2f, 170f, 7.5f, 7.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 185f, 0.5f, 1f, 0f, (AnimationRig)1, 39f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.15f, 100f); UPool.MyPool.AddObject("金锄", val.LoadAsset("金锄"), true, (HideFlags)52, 图标(val, "golden_hoe"), 13801031, true).挥动武器(18f, 0.75f, 2f, 160f, 6.5f, 6.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 170f, 0.43f, 1f, 0f, (AnimationRig)1, 34f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.05f, 85f); UPool.MyPool.AddObject("钻石锄", val.LoadAsset("钻石锄"), true, (HideFlags)52, 图标(val, "diamond_hoe"), 13801032, true).挥动武器(38f, 1f, 2f, 190f, 9.5f, 9.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 205f, 0.55f, 1f, 0f, (AnimationRig)1, 46f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.25f, 120f); UPool.MyPool.AddObject("下界合金锄", val.LoadAsset("下界合金锄"), true, (HideFlags)52, 图标(val, "netherite_hoe"), 13801033, true).挥动武器(50f, 1.05f, 2f, 205f, 11f, 11f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 220f, 0.58f, 1f, 0f, (AnimationRig)1, 52f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.3f, 140f); UPool.MyPool.AddObject("木矛", val.LoadAsset("木矛"), true, (HideFlags)52, 图标(val, "wooden_spear"), 13801034, true).挥动武器(50f, 1.2f, 5f, 210f, 8f, 8f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 200f, 0.55f, 1f, 0f, (AnimationRig)1, 43f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.25f, 115f, callAttackEffects: true, "SpearHoplite"); UPool.MyPool.AddObject("石矛", val.LoadAsset("石矛"), true, (HideFlags)52, 图标(val, "stone_spear"), 13801035, true).挥动武器(62f, 1.25f, 5f, 220f, 9f, 9f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 210f, 0.57f, 1f, 0f, (AnimationRig)1, 46f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.25f, 125f, callAttackEffects: true, "SpearHoplite"); UPool.MyPool.AddObject("铁矛", val.LoadAsset("铁矛"), true, (HideFlags)52, 图标(val, "iron_spear"), 13801036, true).挥动武器(76f, 1.3f, 5f, 230f, 10f, 10f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 220f, 0.6f, 1f, 0f, (AnimationRig)1, 49f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.3f, 135f, callAttackEffects: true, "SpearHoplite"); UPool.MyPool.AddObject("铜矛", val.LoadAsset("铜矛"), true, (HideFlags)52, 图标(val, "copper_spear"), 13801037, true).挥动武器(71f, 1.25f, 5f, 225f, 9.5f, 9.5f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 215f, 0.58f, 1f, 0f, (AnimationRig)1, 48f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.28f, 130f, callAttackEffects: true, "SpearHoplite"); UPool.MyPool.AddObject("金矛", val.LoadAsset("金矛"), true, (HideFlags)52, 图标(val, "golden_spear"), 13801038, true).挥动武器(55f, 1.05f, 5f, 215f, 8f, 8f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 200f, 0.5f, 1f, 0f, (AnimationRig)1, 43f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.2f, 110f, callAttackEffects: true, "SpearHoplite"); UPool.MyPool.AddObject("钻石矛", val.LoadAsset("钻石矛"), true, (HideFlags)52, 图标(val, "diamond_spear"), 13801039, true).挥动武器(92f, 1.35f, 5f, 245f, 11f, 11f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 235f, 0.63f, 1f, 0f, (AnimationRig)1, 53f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.35f, 150f, callAttackEffects: true, "SpearHoplite"); UPool.MyPool.AddObject("下界合金矛", val.LoadAsset("下界合金矛"), true, (HideFlags)52, 图标(val, "netherite_spear"), 13801040, true).挥动武器(120f, 1.4f, 5f, 265f, 13f, 13f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 255f, 0.68f, 1f, 0f, (AnimationRig)1, 60f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.4f, 170f, callAttackEffects: true, "SpearHoplite"); UPool.MyPool.AddObject("盾牌", val.LoadAsset("盾牌"), true, (HideFlags)52, 图标(val, "shield1"), 13801041, true).挥动武器(5f, 1.4f, 5f, 265f, 13f, 13f, 5f, 360f, 0f, setDirectionContinious: false, 0f, setDirectionContiniousDuringWindup: false, 0.05f, canDealDamageOutSideOfSwing: false, randomCooldown: true, startOnCooldown: false, useHitDirection: false, ignoreTeamMates: false, onlyOncePerData: false, hitFasterAfterDealDamage: true, auto: false, 0f, "", enableSwingAnimation: true, (AnimationRig)4, 5f, 0.68f, 1f, 0f, (AnimationRig)1, 60f, 0f, staticDamageValue: true, 1f, 0f, 0f, onlyCollideWithRigs: false, 1.4f, 170f, callAttackEffects: true, "HopliteShield"); com = "======抛射物======"; com = "====================================="; GameObject val2 = UPool.MyPool.AddObject("箭(有问题)", (GameObject)SLMALoader.SDic["projectiles"]["P_Bow"], true, (HideFlags)52, 图标(val, "箭"), 889990000, false); ChineseLibrary.子弹设置(val2, 25f, 200f); ProjectileMount projectileMount = val2.AddComponent(); projectileMount.资源包名称 = "minecraft"; projectileMount.资源包物品名称 = "箭"; projectileMount.物品大小 = 2.75f; projectileMount.物品位置 = new Vector3(0f, 0f, 0f); projectileMount.物品旋转 = new Vector3(0f, 0f, 0f); projectileMount.调试模式 = false; val2.TryChangeColor2(new Color(0f, 0f, 0f, 0f)); com = "======远程武器======"; com = "====================================="; UPool.MyPool.AddObject("弓", val.LoadAsset("弓(有问题)"), true, (HideFlags)52, 图标(val, "bow"), 156884000, false).射击武器(val2); com = "======组别======"; com = "====================================="; AddWeaponTag("木剑", "MINECRAFT WEAPONS"); AddWeaponTag("石剑", "MINECRAFT WEAPONS"); AddWeaponTag("铁剑", "MINECRAFT WEAPONS"); AddWeaponTag("铜剑", "MINECRAFT WEAPONS"); AddWeaponTag("金剑", "MINECRAFT WEAPONS"); AddWeaponTag("钻石剑", "MINECRAFT WEAPONS"); AddWeaponTag("下界合金剑", "MINECRAFT WEAPONS"); AddWeaponTag("木斧", "MINECRAFT WEAPONS"); AddWeaponTag("石斧", "MINECRAFT WEAPONS"); AddWeaponTag("铁斧", "MINECRAFT WEAPONS"); AddWeaponTag("铜斧", "MINECRAFT WEAPONS"); AddWeaponTag("金斧", "MINECRAFT WEAPONS"); AddWeaponTag("钻石斧", "MINECRAFT WEAPONS"); AddWeaponTag("下界合金斧", "MINECRAFT WEAPONS"); AddWeaponTag("木镐", "MINECRAFT WEAPONS"); AddWeaponTag("石镐", "MINECRAFT WEAPONS"); AddWeaponTag("铁镐", "MINECRAFT WEAPONS"); AddWeaponTag("铜镐", "MINECRAFT WEAPONS"); AddWeaponTag("金镐", "MINECRAFT WEAPONS"); AddWeaponTag("钻石镐", "MINECRAFT WEAPONS"); AddWeaponTag("下界合金镐", "MINECRAFT WEAPONS"); AddWeaponTag("木铲", "MINECRAFT WEAPONS"); AddWeaponTag("石铲", "MINECRAFT WEAPONS"); AddWeaponTag("铁铲", "MINECRAFT WEAPONS"); AddWeaponTag("铜铲", "MINECRAFT WEAPONS"); AddWeaponTag("金铲", "MINECRAFT WEAPONS"); AddWeaponTag("钻石铲", "MINECRAFT WEAPONS"); AddWeaponTag("下界合金铲", "MINECRAFT WEAPONS"); AddWeaponTag("木锄", "MINECRAFT WEAPONS"); AddWeaponTag("石锄", "MINECRAFT WEAPONS"); AddWeaponTag("铁锄", "MINECRAFT WEAPONS"); AddWeaponTag("铜锄", "MINECRAFT WEAPONS"); AddWeaponTag("金锄", "MINECRAFT WEAPONS"); AddWeaponTag("钻石锄", "MINECRAFT WEAPONS"); AddWeaponTag("下界合金锄", "MINECRAFT WEAPONS"); AddWeaponTag("木矛", "MINECRAFT WEAPONS"); AddWeaponTag("石矛", "MINECRAFT WEAPONS"); AddWeaponTag("铁矛", "MINECRAFT WEAPONS"); AddWeaponTag("铜矛", "MINECRAFT WEAPONS"); AddWeaponTag("金矛", "MINECRAFT WEAPONS"); AddWeaponTag("钻石矛", "MINECRAFT WEAPONS"); AddWeaponTag("下界合金矛", "MINECRAFT WEAPONS"); AddWeaponTag("盾牌", "MINECRAFT WEAPONS"); AddWeaponTag("弓", "MINECRAFT WEAPONS"); com = "======兵种======"; com = "====================================="; GameObject val3 = val.LoadAsset("盔甲架"); val3.AddComponent().死亡特效 = val.LoadAsset("MC死亡粒子"); 创建兵种("盔甲架", faction2, 图标(val, "armor_stand"), val3, 19412900u, 100f, 100u, 1f, 1.5f, 0f, 0f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 1f, 1f)); GameObject val4 = val.LoadAsset("TNT2"); val4.AddComponent(); 创建兵种("TNT", faction, 图标(val, "tnt"), val4, 19412901u, 100f, 200u, 1.275f, 1.325f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 1f, 1f)); GameObject val5 = val.LoadAsset("TNT2"); TNTBOOM tNTBOOM = val5.AddComponent(); tNTBOOM.maxDamage = 10000f; tNTBOOM.explosionRadius = 100f; 创建兵种("巨无霸TNT", faction, 图标(val, "tnt"), val5, 19412903u, 1f, 10000u, 20f, 1.325f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 1f, 1f)); GameObject val6 = val.LoadAsset("大史莱姆"); bool activeSelf = val6.activeSelf; val6.SetActive(false); GameObject val7 = Object.Instantiate(val6); GameObject val8 = Object.Instantiate(val6); GameObject val9 = Object.Instantiate(val6); if (activeSelf) { val6.SetActive(true); } val7.SetActive(false); val8.SetActive(false); val9.SetActive(false); val7.AddComponent().landDamage = 0f; val7.AddComponent().死亡特效 = val.LoadAsset("MC死亡粒子"); val8.AddComponent().landDamage = 12f; val8.AddComponent().死亡特效 = val.LoadAsset("MC死亡粒子"); val9.AddComponent().landDamage = 24f; 创建兵种("小史莱姆", faction2, 图标(val, "slime_spawn_egg"), val7, 19412904u, 1f, 25u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: false, new Vector3(1f, 1f, 1f)); val8.AddComponent().新兵种名字 = "小史莱姆"; 创建兵种("中史莱姆", faction2, 图标(val, "slime_spawn_egg"), val8, 19412905u, 70f, 100u, 2f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: false, new Vector3(1f, 1f, 1f)); val9.AddComponent().新兵种名字 = "中史莱姆"; 创建兵种("大史莱姆", faction2, 图标(val, "slime_spawn_egg"), val9, 19412906u, 55f, 525u, 4f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: false, new Vector3(0.9f, 0.9f, 0.9f)); GameObject val10 = val.LoadAsset("凋灵子弹"); withershoot_projectile withershoot_projectile = val10.AddComponent(); withershoot_projectile.命中特效 = val.LoadAsset("小爆炸"); withershoot_projectile.命中音效 = val.LoadAsset("boom"); withershoot_projectile.音效音量 = 0.1f; GameObject val11 = val.LoadAsset("凋灵11"); val11.AddComponent().死亡特效 = val.LoadAsset("MC死亡粒子"); val11.AddComponent(); val11.AddComponent(); val11.AddComponent(); withershoot withershoot = val11.AddComponent(); withershoot.发射音效 = val.LoadAsset("shoot"); withershoot.凋灵子弹预制体 = val10; 创建兵种("凋灵(未完善)", faction2, 图标(val, "wither_spawn"), val11, 19412999u, 1800f, 3000u, 1.5f, 50f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 1f, 1f)); GameObject val12 = val.LoadAsset("悦灵"); val12.AddComponent().死亡特效 = val.LoadAsset("MC死亡粒子"); val12.AddComponent(); val12.AddComponent(); val12.AddComponent(); 创建兵种("悦灵", faction2, 图标(val, "allay_spawn_egg"), val12, 19412910u, 50f, 150u, 1f, 1.325f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(0.85f, 0.85f, 0.85f)); GameObject val13 = val.LoadAsset("恼鬼"); val13.AddComponent().死亡特效 = val.LoadAsset("MC死亡粒子"); val13.AddComponent(); val13.AddComponent(); 创建兵种("恼鬼", faction2, 图标(val, "vex_spawn_egg"), val13, 19412911u, 50f, 150u, 1f, 1.325f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(0.85f, 0.85f, 0.85f)); CesyriWaterPlacementFix.Ensure(); uint num = 19412912u; waterplant.Register(num); Cesyribingzhong.Register(num); CesyriNEVER.Register(num); GameObject val14 = val.LoadAsset("船"); val14.AddComponent(); val14.AddComponent(); val14.AddComponent(); val14.AddComponent().死亡特效 = val.LoadAsset("MC死亡粒子"); 创建兵种("船", faction2, 图标(val, "oak_boat"), val14, num, 50f, 200u, 1f, 1.325f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(0.85f, 0.85f, 0.85f)); com = "======BLOCK======"; com = "====================================="; uint num2 = 450099999u; Cesyribingzhong.Register(num2); CesyriNEVER.Register(num2); GameObject val15 = val.LoadAsset("屏障方块"); val15.AddComponent(); val15.AddComponent(); val15.AddComponent(); 创建兵种("屏障方块(按下L可隐藏)", faction, 图标(val, "barrier"), val15, num2, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num3 = 450100000u; Cesyribingzhong.Register(num3); CesyriNEVER.Register(num3); GameObject val16 = val.LoadAsset("木板2"); val16.AddComponent(); val16.AddComponent(); 创建兵种("橡树木板", faction, 图标(val, "oak_planks"), val16, num3, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num4 = 450100001u; Cesyribingzhong.Register(num4); CesyriNEVER.Register(num4); GameObject val17 = val.LoadAsset("橡树木头2"); val17.AddComponent(); val17.AddComponent(); 创建兵种("橡树木头", faction, 图标(val, "oak_log"), val17, num4, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num5 = 450100002u; Cesyribingzhong.Register(num5); CesyriNEVER.Register(num5); GameObject val18 = val.LoadAsset("工作台2"); val18.AddComponent(); val18.AddComponent(); 创建兵种("工作台", faction, 图标(val, "crafting_table_front"), val18, num5, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num6 = 450100003u; Cesyribingzhong.Register(num6); CesyriNEVER.Register(num6); GameObject val19 = val.LoadAsset("熔炉2"); val19.AddComponent(); val19.AddComponent(); 创建兵种("熔炉", faction, 图标(val, "furnace_front"), val19, num6, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num7 = 450100004u; Cesyribingzhong.Register(num7); CesyriNEVER.Register(num7); GameObject val20 = val.LoadAsset("泥土2"); val20.AddComponent(); val20.AddComponent(); 创建兵种("泥土", faction, 图标(val, "dirt"), val20, num7, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num8 = 450100005u; Cesyribingzhong.Register(num8); CesyriNEVER.Register(num8); GameObject val21 = val.LoadAsset("草方块2"); val21.AddComponent(); val21.AddComponent(); 创建兵种("草方块", faction, 图标(val, "grass_block_side"), val21, num8, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num9 = 450100006u; Cesyribingzhong.Register(num9); CesyriNEVER.Register(num9); GameObject val22 = val.LoadAsset("圆石2"); val22.AddComponent(); val22.AddComponent(); 创建兵种("圆石", faction, 图标(val, "cobblestone"), val22, num9, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num10 = 450100007u; Cesyribingzhong.Register(num10); CesyriNEVER.Register(num10); GameObject val23 = val.LoadAsset("煤矿"); val23.AddComponent(); val23.AddComponent(); 创建兵种("煤矿", faction, 图标(val, "coal_ore"), val23, num10, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num11 = 450100008u; Cesyribingzhong.Register(num11); CesyriNEVER.Register(num11); GameObject val24 = val.LoadAsset("钻石矿"); val24.AddComponent(); val24.AddComponent(); 创建兵种("钻石矿", faction, 图标(val, "diamond_ore"), val24, num11, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num12 = 450100009u; Cesyribingzhong.Register(num12); CesyriNEVER.Register(num12); GameObject val25 = val.LoadAsset("铁矿"); val25.AddComponent(); val25.AddComponent(); 创建兵种("铁矿", faction, 图标(val, "iron_ore"), val25, num12, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num13 = 450100010u; Cesyribingzhong.Register(num13); CesyriNEVER.Register(num13); GameObject val26 = val.LoadAsset("铁块"); val26.AddComponent(); val26.AddComponent(); 创建兵种("铁块", faction, 图标(val, "iron_block"), val26, num13, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num14 = 450100011u; Cesyribingzhong.Register(num14); CesyriNEVER.Register(num14); GameObject val27 = val.LoadAsset("南瓜头"); val27.AddComponent(); val27.AddComponent(); 创建兵种("南瓜头", faction, 图标(val, "carved_pumpkin"), val27, num14, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num15 = 450100012u; Cesyribingzhong.Register(num15); CesyriNEVER.Register(num15); GameObject val28 = val.LoadAsset("绿宝石矿"); val28.AddComponent(); val28.AddComponent(); 创建兵种("绿宝石矿", faction, 图标(val, "emerald_ore"), val28, num15, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num16 = 450100013u; Cesyribingzhong.Register(num16); CesyriNEVER.Register(num16); GameObject val29 = val.LoadAsset("青金石矿"); val29.AddComponent(); val29.AddComponent(); 创建兵种("青金石矿", faction, 图标(val, "lapis_ore"), val29, num16, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num17 = 450100014u; Cesyribingzhong.Register(num17); CesyriNEVER.Register(num17); GameObject val30 = val.LoadAsset("桦木木板"); val30.AddComponent(); val30.AddComponent(); 创建兵种("桦木木板", faction, 图标(val, "birch_planks"), val30, num17, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num18 = 450100015u; Cesyribingzhong.Register(num18); CesyriNEVER.Register(num18); GameObject val31 = val.LoadAsset("桦木木头"); val31.AddComponent(); val31.AddComponent(); 创建兵种("桦木木头", faction, 图标(val, "birch_log"), val31, num18, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num19 = 450100016u; Cesyribingzhong.Register(num19); CesyriNEVER.Register(num19); GameObject val32 = val.LoadAsset("红石矿"); val32.AddComponent(); val32.AddComponent(); 创建兵种("红石矿", faction, 图标(val, "redstone_ore"), val32, num19, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); uint num20 = 450100017u; Cesyribingzhong.Register(num20); CesyriNEVER.Register(num20); GameObject val33 = val.LoadAsset("金矿"); val33.AddComponent(); val33.AddComponent(); 创建兵种("金矿", faction, 图标(val, "gold_ore"), val33, num20, 1f, 10u, 1f, 1f, 1f, 1f, null, null, holdinigWithTwoHands: false, (HideFlags)52, 静态兵种: true, new Vector3(1f, 0.85f, 1f)); com = "======翻译======"; com = "====================================="; 翻译哈.语言添加("木剑", "木剑#Wooden Sword#木の剣#Holzschwert#Épée en bois#Деревянный меч#Espada de madera#Spada di legno"); 翻译哈.语言添加("石剑", "石剑#Stone Sword#石の剣#Steinschwert#Épée en pierre#Каменный меч#Espada de piedra#Spada di pietra"); 翻译哈.语言添加("铜剑", "铜剑#Copper Sword#銅の剣#Kupferschwert#Épée en cuivre#Медный меч#Espada de cobre#Spada di rame"); 翻译哈.语言添加("铁剑", "铁剑#Iron Sword#鉄の剣#Eisenschwert#Épée en fer#Железный меч#Espada de hierro#Spada di ferro"); 翻译哈.语言添加("金剑", "金剑#Golden Sword#金の剣#Goldschwert#Épée en or#Золотой меч#Espada de oro#Spada d'oro"); 翻译哈.语言添加("钻石剑", "钻石剑#Diamond Sword#ダイヤモンドの剣#Diamantschwert#Épée en diamant#Алмазный меч#Espada de diamante#Spada di diamante"); 翻译哈.语言添加("下界合金剑", "下界合金剑#Netherite Sword#ネザライトの剣#Netherit-Schwert#Épée en netherite#Незеритовый меч#Espada de netherita#Spada di netherite"); 翻译哈.语言添加("木斧", "木斧#Wooden Axe#木の斧#Holzaxt#Hacha de madera#Деревянный топор#Hacha de madera#Ascia di legno"); 翻译哈.语言添加("石斧", "石斧#Stone Axe#石の斧#Steinaxt#Hacha de piedra#Каменный топор#Hacha de piedra#Ascia di pietra"); 翻译哈.语言添加("铜斧", "铜斧#Copper Axe#銅の斧#Kupferaxt#Hache en cuivre#Медный топор#Hacha de cobre#Ascia di rame"); 翻译哈.语言添加("铁斧", "铁斧#Iron Axe#鉄の斧#Eisenaxt#Hache en fer#Железный топор#Hacha de hierro#Ascia di ferro"); 翻译哈.语言添加("金斧", "金斧#Golden Axe#金の斧#Goldaxt#Hache en or#Золотой топор#Hacha de oro#Ascia d'oro"); 翻译哈.语言添加("钻石斧", "钻石斧#Diamond Axe#ダイヤモンドの斧#Diamantaxt#Hache en diamant#Алмазный топор#Hacha de diamante#Ascia di diamante"); 翻译哈.语言添加("下界合金斧", "下界合金斧#Netherite Axe#ネザライトの斧#Netherit-Axt#Hache en netherite#Незеритовый топор#Hacha de netherita#Ascia di netherite"); 翻译哈.语言添加("木镐", "木镐#Wooden Pickaxe#木のツルハシ#Holzspitzhacke#Pioche en bois#Деревянная кирка#Pico de madera#Piccone di legno"); 翻译哈.语言添加("石镐", "石镐#Stone Pickaxe#石のツルハシ#Steinspitzhacke#Pioche en pierre#Каменная кирка#Pico de piedra#Piccone di pietra"); 翻译哈.语言添加("铜镐", "铜镐#Copper Pickaxe#銅のツルハシ#Kupferspitzhacke#Pioche en cuivre#Медная кирка#Pico de cobre#Piccone di rame"); 翻译哈.语言添加("铁镐", "铁镐#Iron Pickaxe#鉄のツルハシ#Eisenspitzhacke#Pioche en fer#Железная кирка#Pico de hierro#Piccone di ferro"); 翻译哈.语言添加("金镐", "金镐#Golden Pickaxe#金のツルハシ#Goldspitzhacke#Pioche en or#Золотая кирка#Pico de oro#Piccone d'oro"); 翻译哈.语言添加("钻石镐", "钻石镐#Diamond Pickaxe#ダイヤモンドのツルハシ#Diamantspitzhacke#Pioche en diamant#Алмазная кирка#Pico de diamante#Piccone di diamante"); 翻译哈.语言添加("下界合金镐", "下界合金镐#Netherite Pickaxe#ネザライトのツルハシ#Netherit-Spitzhacke#Pioche en netherite#Незеритовая кирка#Pico de netherita#Piccone di netherite"); 翻译哈.语言添加("木锄", "木锄#Wooden Hoe#木のクワ#Holzhacke#Houe en bois#Деревянная мотыга#Azada de madera#Zappa di legno"); 翻译哈.语言添加("石锄", "石锄#Stone Hoe#石のクワ#Steinhacke#Houe en pierre#Каменная мотыга#Azada de piedra#Zappa di pietra"); 翻译哈.语言添加("铜锄", "铜锄#Copper Hoe#銅のクワ#Kupferhacke#Houe en cuivre#Медная мотыга#Azada de cobre#Zappa di rame"); 翻译哈.语言添加("铁锄", "铁锄#Iron Hoe#鉄のクワ#Eisenhacke#Houe en fer#Железная мотыга#Azada de hierro#Zappa di ferro"); 翻译哈.语言添加("金锄", "金锄#Golden Hoe#金のクワ#Goldhacke#Houe en or#Золотая мотыга#Azada de oro#Zappa d'oro"); 翻译哈.语言添加("钻石锄", "钻石锄#Diamond Hoe#ダイヤモンドのクワ#Diamanthacke#Houe en diamant#Алмазная мотыга#Azada de diamante#Zappa di diamante"); 翻译哈.语言添加("下界合金锄", "下界合金锄#Netherite Hoe#ネザライトのクワ#Netherit-Hacke#Houe en netherite#Незеритовая мотыга#Azada de netherita#Zappa di netherite"); 翻译哈.语言添加("木铲", "木铲#Wooden Shovel#木のシャベル#Holzschaufel#Pelle en bois#Деревянная лопата#Pala de madera#Pala di legno"); 翻译哈.语言添加("石铲", "石铲#Stone Shovel#石のシャベル#Steinschaufel#Pelle en pierre#Каменная лопата#Pala de piedra#Pala di pietra"); 翻译哈.语言添加("铜铲", "铜铲#Copper Shovel#銅のシャベル#Kupferschaufel#Pelle en cuivre#Медная лопата#Pala de cobre#Pala di rame"); 翻译哈.语言添加("铁铲", "铁铲#Iron Shovel#鉄のシャベル#Eisenschaufel#Pelle en fer#Железная лопата#Pala de hierro#Pala di ferro"); 翻译哈.语言添加("金铲", "金铲#Golden Shovel#金のシャベル#Goldschaufel#Pelle en or#Золотая лопата#Pala de oro#Pala d'oro"); 翻译哈.语言添加("钻石铲", "钻石铲#Diamond Shovel#ダイヤモンドのシャベル#Diamantschaufel#Pelle en diamant#Алмазная лопата#Pala de diamante#Pala di diamante"); 翻译哈.语言添加("下界合金铲", "下界合金铲#Netherite Shovel#ネザライトのシャベル#Netheritschaufel#Pelle en netherite#Незеритовая лопата#Pala de netherita#Pala di netherite"); 翻译哈.语言添加("木矛", "木矛#Wooden Spear#木の槍#Holzspeer#Lance en bois#Деревянное копьё#Lanza de madera#Lancia di legno"); 翻译哈.语言添加("石矛", "石矛#Stone Spear#石の槍#Steinspeer#Lance en pierre#Каменное копьё#Lanza de piedra#Lancia di pietra"); 翻译哈.语言添加("铜矛", "铜矛#Copper Spear#銅の槍#Kupferspeer#Lance en cuivre#Медное копьё#Lanza de cobre#Lancia di rame"); 翻译哈.语言添加("铁矛", "铁矛#Iron Spear#鉄の槍#Eisenspeer#Lance en fer#Железное копьё#Lanza de hierro#Lancia di ferro"); 翻译哈.语言添加("金矛", "金矛#Golden Spear#金の槍#Goldspeer#Lance en or#Золотое копьё#Lanza de oro#Lancia d'oro"); 翻译哈.语言添加("钻石矛", "钻石矛#Diamond Spear#ダイヤモンドの槍#Diamantspeer#Lance en diamant#Алмазное копьё#Lanza de diamante#Lancia di diamante"); 翻译哈.语言添加("下界合金矛", "下界合金矛#Netherite Spear#ネザライトの槍#Netheritspeer#Lance en netherite#Незеритовое копьё#Lanza de netherita#Lancia di netherite"); 翻译哈.语言添加("盾牌", "盾牌#Shield#盾#Schild#Bouclier#Щит#Escudo#Scudo"); 翻译哈.语言添加("盔甲架", "盔甲架#Armor Stand#防具立て#Rüstungsständer#Porte-armure#Стойка для брони#Soporte para armaduras#Supporto per armature"); 翻译哈.语言添加("MINECRAFT", "我的世界#MINECRAFT#MINECRAFT#MINECRAFT#MINECRAFT#MINECRAFT#MINECRAFT#MINECRAFT"); 翻译哈.语言添加("TNT", "TNT#TNT#TNT#TNT#TNT#TNT#TNT#TNT"); 翻译哈.语言添加("MINECRAFT UNIT", "我的世界单位#Minecraft Units#マインクラフトユニット#Minecraft-Einheiten#Unités Minecraft#Юниты Minecraft#Unidades de Minecraft#Unità Minecraft"); 翻译哈.语言添加("MINECRAFT WEAPONS", "我的世界武器#Minecraft Weapons#マインクラフト武器#Minecraft-Waffen#Armes Minecraft#Оружие Minecraft#Armas de Minecraft#Armi Minecraft"); 翻译哈.语言添加("MINECRAFT BLOCK", "我的世界方块#Minecraft Blocks#マインクラフトブロック#Minecraft-Blöcke#Blocs Minecraft#Блоки Minecraft#Bloques de Minecraft#Blocchi Minecraft"); 翻译哈.语言添加("巨无霸TNT", "巨无霸TNT#Mega TNT#巨大TNT#Mega-TNT#Méga TNT#Мега TNT#Mega TNT#Mega TNT"); 翻译哈.语言添加("小史莱姆", "小史莱姆#Small Slime#小さいスライム#Kleiner Schleim#Petit Slime#Маленький слизень#Slime pequeño#Slime piccolo"); 翻译哈.语言添加("中史莱姆", "中史莱姆#Medium Slime#中サイズのスライム#Mittlerer Schleim#Slime moyen#Средний слизень#Slime mediano#Slime medio"); 翻译哈.语言添加("大史莱姆", "大史莱姆#Large Slime#大きなスライム#Großer Schleim#Grand Slime#Большой слизень#Slime grande#Slime grande"); 翻译哈.语言添加("凋灵(未完善)", "凋灵(未完善)#Wither (Incomplete)#ウィザー(未完成)#Wither (Unvollständig)#Wither (Incomplet)#Иссушитель (Не завершён)#Wither (Incompleto)#Wither (Incompleto)"); 翻译哈.语言添加("悦灵", "悦灵#Allay#アレイ#Allay#Allay#Алей#Allay#Allay"); 翻译哈.语言添加("恼鬼", "恼鬼#Vex#ヴェックス#Vex#Vex#Вредина#Vex#Vex"); 翻译哈.语言添加("船", "船#Boat#ボート#Boot#Bateau#Лодка#Barca#Barca"); 翻译哈.语言添加("屏障方块(按下L可隐藏)", "屏障方块(按下L可隐藏)#Barrier Block (Press L to hide)#バリアブロック(Lで非表示)#Barrierblock (L drücken zum Verstecken)#Bloc barrière (Appuyez sur L pour cacher)#Барьерный блок (Нажмите L, чтобы скрыть)#Bloque barrera (Presiona L para ocultar)#Blocco barriera (Premi L per nascondere)"); 翻译哈.语言添加("橡树木板", "橡树木板#Oak Planks#オークの板材#Eichenholzbretter#Planches de chêne#Дубовые доски#Tablas de roble#Assi di quercia"); 翻译哈.语言添加("青金石矿", "青金石矿#Lapis Lazuli Ore#ラピスラズリ鉱石#Lapislazuli-Erz#Minerai de lapis-lazuli#Лазуритовая руда#Mena de lapislázuli#Minerale di lapislazzuli"); 翻译哈.语言添加("桦木木板", "桦木木板#Birch Planks#シラカバの板材#Birkenholzbretter#Planches de bouleau#Берёзовые доски#Tablas de abedul#Assi di betulla"); 翻译哈.语言添加("桦木木头", "桦木木头#Birch Log#シラカバの原木#Birkenstamm#Bûche de bouleau#Берёзовое бревно#Tronco de abedul#Tronco di betulla"); 翻译哈.语言添加("红石矿", "红石矿#Redstone Ore#レッドストーン鉱石#Redstone-Erz#Minerai de redstone#Редстоуновая руда#Mena de redstone#Minerale di redstone"); 翻译哈.语言添加("金矿", "金矿#Gold Ore#金鉱石#Golderz#Minerai d'or#Золотая руда#Mena de oro#Minerale d'oro"); 翻译哈.语言添加("橡树木头", "橡树木头#Oak Log#オークの原木#Eichenstamm#Bûche de chêne#Дубовое бревно#Tronco de roble#Tronco di quercia"); 翻译哈.语言添加("工作台", "工作台#Crafting Table#作業台#Werkbank#Établi#Верстак#Mesa de trabajo#Banco da lavoro"); 翻译哈.语言添加("泥土", "泥土#Dirt#土#Erde#Terre#Земля#Tierra#Terra"); 翻译哈.语言添加("熔炉", "熔炉#Furnace#かまど#Ofen#Fourneau#Печь#Horno#Fornace"); 翻译哈.语言添加("草方块", "草方块#Grass Block#草ブロック#Grasblock#Bloc d'herbe#Блок травы#Bloque de césped#Blocco d'erba"); 翻译哈.语言添加("圆石", "圆石#Cobblestone#丸石#Bruchstein#Pierres#Булыжник#Roca#Ciottoli"); 翻译哈.语言添加("煤矿", "煤矿#Coal Ore#石炭鉱石#Kohleerz#Minerai de charbon#Угольная руда#Mena de carbón#Minerale di carbone"); 翻译哈.语言添加("钻石矿", "钻石矿#Diamond Ore#ダイヤモンド鉱石#Diamanterz#Minerai de diamant#Алмазная руда#Mena de diamante#Minerale di diamante"); 翻译哈.语言添加("铁矿", "铁矿#Iron Ore#鉄鉱石#Eisenerz#Minerai de fer#Железная руда#Mena de hierro#Minerale di ferro"); 翻译哈.语言添加("铁块", "铁块#Block of Iron#鉄ブロック#Eisenblock#Bloc de fer#Железный блок#Bloque de hierro#Blocco di ferro"); 翻译哈.语言添加("南瓜头", "南瓜头#Carved Pumpkin#くり抜かれたカボチャ#Geschnitzter Kürbis#Citrouille sculptée#Вырезанная тыква#Calabaza tallada#Zucca intagliata"); 翻译哈.语言添加("绿宝石矿", "绿宝石矿#Emerald Ore#エメラルド鉱石#Smaragderz#Minerai d'émeraude#Изумрудная руда#Mena de esmeralda#Minerale di smeraldo"); 翻译哈.语言添加("弓(有问题)", "弓(有问题)#Bow (Bugged)#弓(問題あり)#Bogen (Fehlerhaft)#Arc (Problème)#Лук (Проблема)#Arco (Con problemas)#Arco (Problema)"); 翻译哈.语言添加("箭(有问题)", "箭(有问题)#Arrow (Bugged)#矢(問題あり)#Pfeil (Fehlerhaft)#Flèche (Problème)#Стрела (Проблема)#Flecha (Con problemas)#Freccia (Problema)"); } public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown Debug.Log((object)weapon); if (unit.unitBlueprint.Entity.Name == "unit name") { MeshRenderer[] componentsInChildren = weapon.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).materials = (Material[])(object)new Material[1] { (Material)SLMALoader.SDic["materials"]["Glow_Neon_Red_212484"] }; } range.numberOfObjects = 3; range.spread = 12f; } } public static Sprite 图标(AssetBundle assetBundle, string chaisi = "") { return assetBundle.LoadAsset(chaisi); } public static void Add衣服Tag(string clothName, string tagValue = "衣服") { //IL_0071: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = UPool.MyPool.GetObject(clothName); if ((Object)(object)val != (Object)null) { CharacterItem val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.GetComponentInChildren(); } if ((Object)(object)val2 != (Object)null) { val2.tags = new List { new Tag { tagType = (TagType)0, value = tagValue } }; } else { val2 = val.AddComponent(); val2.tags = new List { new Tag { tagType = (TagType)0, value = tagValue } }; } } } catch (Exception) { } } public static void AddWeaponTag(string weaponName, string tagValue = "武器") { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = UPool.MyPool.GetObject(weaponName); if ((Object)(object)val != (Object)null) { CharacterItem componentInChildren = val.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.tags = new List { new Tag { tagType = (TagType)0, value = tagValue } }; } } } catch (Exception) { } } public static void AddSkillTag(string skillName, string tagValue = "技能") { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = UPool.MyPool.GetObject(skillName); if ((Object)(object)val != (Object)null) { CharacterItem val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.GetComponentInChildren(); } if ((Object)(object)val2 != (Object)null) { val2.tags = new List { new Tag { tagType = (TagType)0, value = tagValue } }; } } } catch (Exception) { } } public static void TryChangeColor2(this GameObject gameObject, Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.SetColor("_Color", color); val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.EnableKeyword("_ALPHABLEND_ON"); val.renderQueue = 3000; if (Object.op_Implicit((Object)(object)gameObject.GetComponentInChildren())) { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren(); foreach (Renderer val2 in componentsInChildren) { val2.material = val; List list = new List(); Material[] materials = val2.materials; for (int j = 0; j < materials.Length; j++) { _ = materials[j]; list.Add(val); } val2.materials = list.ToArray(); } } if (Object.op_Implicit((Object)(object)gameObject.GetComponentInChildren())) { TeamColor[] componentsInChildren2 = gameObject.GetComponentsInChildren(); foreach (TeamColor obj in componentsInChildren2) { obj.blueMaterial = val; obj.redMaterial = val; } } } internal static void SetUnitDataHandler(Unit u, DataHandler dh) { if (!((Object)(object)u == (Object)null)) { u.data = dh; if (_unitDataHandlerField != null) { _unitDataHandlerField.SetValue(u, dh); } } } public static float SanitizeF(float val, float def, float min, float max) { if (float.IsNaN(val) || float.IsInfinity(val)) { val = def; } if (val < min) { val = min; } if (val > max) { val = max; } return val; } public static Vector3 SanitizeV3(Vector3 v, Vector3 def) { //IL_0000: 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_000d: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (float.IsNaN(v.x) || float.IsInfinity(v.x)) { v.x = def.x; } if (float.IsNaN(v.y) || float.IsInfinity(v.y)) { v.y = def.y; } if (float.IsNaN(v.z) || float.IsInfinity(v.z)) { v.z = def.z; } return v; } public static object MakeFloat3(float x, float y, float z) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) Type type = Type.GetType("Unity.Mathematics.float3, Unity.Mathematics"); if (type == null) { return (object)new Vector3(x, y, z); } object obj = Activator.CreateInstance(type); FieldInfo field = type.GetField("x", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field2 = type.GetField("y", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field3 = type.GetField("z", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (field != null) { field.SetValue(obj, x); } if (field2 != null) { field2.SetValue(obj, y); } if (field3 != null) { field3.SetValue(obj, z); } } catch { } return obj; } public static void 确保标记组件齐全(GameObject unitRoot, bool 静态兵种, Vector3 碰撞箱大小) { //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0373: 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_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: 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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0747: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_09fd: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0b52: Unknown result type (might be due to invalid IL or missing references) //IL_0b5d: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0b75: Unknown result type (might be due to invalid IL or missing references) //IL_0b80: Expected O, but got Unknown //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_0785: 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_0d80: Unknown result type (might be due to invalid IL or missing references) //IL_0d8b: Expected O, but got Unknown //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0da3: Unknown result type (might be due to invalid IL or missing references) //IL_0dae: Expected O, but got Unknown //IL_0baa: Unknown result type (might be due to invalid IL or missing references) //IL_0bb5: Expected O, but got Unknown //IL_0dc6: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Expected O, but got Unknown //IL_0bcd: Unknown result type (might be due to invalid IL or missing references) //IL_0bd8: Expected O, but got Unknown //IL_08d8: Unknown result type (might be due to invalid IL or missing references) //IL_0bf0: Unknown result type (might be due to invalid IL or missing references) //IL_0bfb: Expected O, but got Unknown //IL_0c13: Unknown result type (might be due to invalid IL or missing references) //IL_0c1e: Expected O, but got Unknown //IL_0e18: Unknown result type (might be due to invalid IL or missing references) //IL_0e23: Expected O, but got Unknown //IL_08fe: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)unitRoot == (Object)null) { return; } Unit component = unitRoot.GetComponent(); if ((Object)(object)component != (Object)null) { FieldInfo field = typeof(Unit).GetField("m_placementSquare", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(component); if (value != null) { Type type = value.GetType(); FieldInfo field2 = type.GetField("m_size", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field3 = type.GetField("m_offset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Vector3 val = (Vector3)((field2 != null) ? field2.GetValue(value) : ((object)Vector3.zero)); Vector3 val2 = (Vector3)((field3 != null) ? field3.GetValue(value) : ((object)Vector3.zero)); bool flag = ((Vector3)(ref val)).sqrMagnitude < 0.01f || ((Vector3)(ref 碰撞箱大小)).sqrMagnitude > 0.0001f; bool flag2 = ((Vector3)(ref val2)).sqrMagnitude < 0.001f; if (flag || flag2) { Vector3 val3 = val; Bounds bounds; if (flag) { if (((Vector3)(ref 碰撞箱大小)).sqrMagnitude > 0.0001f) { val3 = 碰撞箱大小; } else { ((Vector3)(ref val3))..ctor(1.5f, 2.5f, 1.5f); MeshFilter componentInChildren = unitRoot.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMesh != (Object)null) { bounds = componentInChildren.sharedMesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; if (size.x > 0.2f && size.y > 0.2f && size.z > 0.2f && size.x < 10f && size.y < 15f && size.z < 10f) { val3 = size * 1.2f; } } } val3.x = Mathf.Clamp(val3.x, 0.5f, 8f); val3.y = Mathf.Clamp(val3.y, 0.5f, 12f); val3.z = Mathf.Clamp(val3.z, 0.5f, 8f); if (field2 != null) { field2.SetValue(value, val3); } } if (flag2) { Vector3 val4 = default(Vector3); if (((Vector3)(ref 碰撞箱大小)).sqrMagnitude > 0.0001f) { ((Vector3)(ref val4))..ctor(0f, val3.y * 0.5f, 0f); } else { ((Vector3)(ref val4))..ctor(0f, val3.y * 0.5f, 0f); Renderer componentInChildren2 = unitRoot.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { Transform transform = unitRoot.transform; bounds = componentInChildren2.bounds; Vector3 val5 = transform.InverseTransformPoint(((Bounds)(ref bounds)).center); ((Vector3)(ref val4))..ctor(val5.x, val5.y, val5.z); } } if (field3 != null) { field3.SetValue(value, val4); } } field.SetValue(component, value); } } } } if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject.GetComponent() == (Object)null) { ((Component)component).gameObject.AddComponent(); } DataHandler componentInChildren3 = unitRoot.GetComponentInChildren(true); if ((Object)(object)component != (Object)null) { TeamHolder val6 = unitRoot.GetComponentInChildren(true); if ((Object)(object)val6 == (Object)null) { GameObject val7 = new GameObject("TeamHolder"); val7.transform.SetParent(((Component)component).transform, false); val7.transform.localPosition = Vector3.zero; val6 = val7.AddComponent(); } val6.getRootTeamOnAwake = true; val6.team = component.Team; val6.spawner = ((Component)component).gameObject; if ((Object)(object)componentInChildren3 != (Object)null) { componentInChildren3.team = component.Team; } } if ((Object)(object)unitRoot.GetComponent() == (Object)null) { unitRoot.AddComponent(); } if ((Object)(object)unitRoot.GetComponent() == (Object)null) { unitRoot.AddComponent(); } if ((Object)(object)unitRoot.GetComponent() == (Object)null) { unitRoot.AddComponent(); } if ((Object)(object)component != (Object)null) { DataHandler componentInChildren4 = unitRoot.GetComponentInChildren(true); GeneralInput componentInChildren5 = unitRoot.GetComponentInChildren(true); WeaponHandler componentInChildren6 = unitRoot.GetComponentInChildren(true); Hip componentInChildren7 = unitRoot.GetComponentInChildren(); Head componentInChildren8 = unitRoot.GetComponentInChildren(); HoldingHandler componentInChildren9 = unitRoot.GetComponentInChildren(true); SetUnitDataHandler(component, componentInChildren4); component.Input = componentInChildren5; component.WeaponHandler = componentInChildren6; if ((Object)(object)componentInChildren7 != (Object)null) { component.Hip = ((Component)componentInChildren7).transform; } if ((Object)(object)componentInChildren8 != (Object)null) { component.Head = ((Component)componentInChildren8).transform; } component.holdingHandler = componentInChildren9; if ((Object)(object)componentInChildren4 != (Object)null) { Torso componentInChildren10 = unitRoot.GetComponentInChildren(); if ((Object)(object)componentInChildren10 != (Object)null) { Rigidbody component2 = ((Component)componentInChildren10).GetComponent(); if ((Object)(object)component2 != (Object)null) { componentInChildren4.mainRig = component2; FieldInfo field4 = typeof(DataHandler).GetField("mainRig", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field4 != null) { field4.SetValue(componentInChildren4, component2); } } } else if ((Object)(object)componentInChildren4.mainRig == (Object)null) { Rigidbody componentInChildren11 = unitRoot.GetComponentInChildren(); if ((Object)(object)componentInChildren11 != (Object)null) { componentInChildren4.mainRig = componentInChildren11; } } componentInChildren4.Dead = false; } } if ((Object)(object)component != (Object)null) { Transform transform2 = ((Component)component).transform; if ((Object)(object)((Component)transform2).GetComponentInChildren(true) == (Object)null) { GameObject val8 = new GameObject("Direction"); val8.transform.SetParent(transform2, false); val8.transform.localPosition = Vector3.zero; val8.transform.localRotation = Quaternion.identity; val8.AddComponent(); } if ((Object)(object)((Component)transform2).GetComponentInChildren(true) == (Object)null) { GameObject val9 = new GameObject("GroundedMovementDirection"); val9.transform.SetParent(transform2, false); val9.transform.localPosition = Vector3.zero; val9.transform.localRotation = Quaternion.identity; val9.AddComponent(); } } CurveAnimation[] componentsInChildren = unitRoot.GetComponentsInChildren(true); if (componentsInChildren != null && componentsInChildren.Length != 0) { CurveAnimation[] array = componentsInChildren; foreach (CurveAnimation val10 in array) { if (!((Object)(object)val10 == (Object)null)) { bool flag3 = true; if ((Object)(object)val10.animationData == (Object)null) { flag3 = false; } else if (val10.animationData.animations == null || val10.animationData.animations.Length == 0) { flag3 = false; } Rigidbody val11 = ((Component)val10).GetComponent(); if ((Object)(object)val11 == (Object)null) { val11 = ((Component)val10).GetComponentInParent(); } if ((Object)(object)val11 == (Object)null) { flag3 = false; } if ((Object)(object)((Component)val10).GetComponentInParent() == (Object)null) { flag3 = false; } if ((Object)(object)((Component)val10).GetComponentInParent() == (Object)null) { flag3 = false; } if ((Object)(object)unitRoot.GetComponentInChildren() == (Object)null) { flag3 = false; } if ((Object)(object)unitRoot.GetComponentInChildren() == (Object)null) { flag3 = false; } if (!flag3) { Object.DestroyImmediate((Object)(object)val10); } } } } GravityHandler[] componentsInChildren2 = unitRoot.GetComponentsInChildren(true); if (componentsInChildren2 != null && componentsInChildren2.Length != 0) { FieldInfo field5 = typeof(GravityHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field6 = typeof(GravityHandler).GetField("rigidbodyHolder", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); GravityHandler[] array2 = componentsInChildren2; foreach (GravityHandler val12 in array2) { if (!((Object)(object)val12 == (Object)null)) { bool flag4 = true; DataHandler val13 = ((!(field5 != null)) ? ((DataHandler)null) : ((DataHandler)field5.GetValue(val12))); if ((Object)(object)val13 == (Object)null) { flag4 = false; } else if ((Object)(object)val13.mainRig == (Object)null) { flag4 = false; } if ((Object)((!(field6 != null)) ? ((RigidbodyHolder)null) : ((RigidbodyHolder)field6.GetValue(val12))) == (Object)null) { flag4 = false; } if ((Object)(object)val12.gravityData == (Object)null) { flag4 = false; } if (!flag4) { Object.DestroyImmediate((Object)(object)val12); } } } } StepHandler[] componentsInChildren3 = unitRoot.GetComponentsInChildren(true); if (componentsInChildren3 != null && componentsInChildren3.Length != 0) { FieldInfo field7 = typeof(StepHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field8 = typeof(StepHandler).GetField("hip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field9 = typeof(StepHandler).GetField("kneeLeft", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field10 = typeof(StepHandler).GetField("kneeRight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field11 = typeof(StepHandler).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); StepHandler[] array3 = componentsInChildren3; foreach (StepHandler val14 in array3) { if (!((Object)(object)val14 == (Object)null)) { bool flag5 = true; if ((Object)((!(field7 != null)) ? ((DataHandler)null) : ((DataHandler)field7.GetValue(val14))) == (Object)null) { flag5 = false; } if ((Object)((!(field8 != null)) ? ((Transform)null) : ((Transform)field8.GetValue(val14))) == (Object)null) { flag5 = false; } if ((Object)((!(field9 != null)) ? ((Transform)null) : ((Transform)field9.GetValue(val14))) == (Object)null) { flag5 = false; } if ((Object)((!(field10 != null)) ? ((Transform)null) : ((Transform)field10.GetValue(val14))) == (Object)null) { flag5 = false; } if ((Object)(object)val14.stepData == (Object)null || val14.stepData.steps == null || val14.stepData.steps.Length == 0) { flag5 = false; } if ((Object)((!(field11 != null)) ? ((AnimationHandler)null) : ((AnimationHandler)field11.GetValue(val14))) == (Object)null) { flag5 = false; } if (!flag5) { Object.DestroyImmediate((Object)(object)val14); } } } } StandingHandler[] componentsInChildren4 = unitRoot.GetComponentsInChildren(true); if (componentsInChildren4 != null && componentsInChildren4.Length != 0) { FieldInfo field12 = typeof(StandingHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field13 = typeof(StandingHandler).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); StandingHandler[] array4 = componentsInChildren4; foreach (StandingHandler val15 in array4) { if (!((Object)(object)val15 == (Object)null)) { bool flag6 = true; if ((Object)((!(field12 != null)) ? ((DataHandler)null) : ((DataHandler)field12.GetValue(val15))) == (Object)null) { flag6 = false; } if ((Object)((!(field13 != null)) ? ((AnimationHandler)null) : ((AnimationHandler)field13.GetValue(val15))) == (Object)null) { flag6 = false; } if ((Object)(object)val15.standingData == (Object)null || val15.rigsToLift == null || val15.rigsToLift.Length == 0) { flag6 = false; } if (!flag6) { Object.DestroyImmediate((Object)(object)val15); } } } } Balance[] componentsInChildren5 = unitRoot.GetComponentsInChildren(true); if (componentsInChildren5 != null && componentsInChildren5.Length != 0) { FieldInfo field14 = typeof(Balance).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field15 = typeof(Balance).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field16 = typeof(Balance).GetField("kneeLeft", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field17 = typeof(Balance).GetField("kneeRight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field18 = typeof(Balance).GetField("torso", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field19 = typeof(Balance).GetField("hip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Balance[] array5 = componentsInChildren5; foreach (Balance val16 in array5) { if (!((Object)(object)val16 == (Object)null)) { bool flag7 = true; if (field14 != null && (Object)(DataHandler)field14.GetValue(val16) == (Object)null) { flag7 = false; } if (field15 != null && (Object)(AnimationHandler)field15.GetValue(val16) == (Object)null) { flag7 = false; } if ((Object)(object)val16.balanceData == (Object)null) { flag7 = false; } if (field16 != null && (Object)(Transform)field16.GetValue(val16) == (Object)null) { flag7 = false; } if (field17 != null && (Object)(Transform)field17.GetValue(val16) == (Object)null) { flag7 = false; } if (field18 != null && (Object)(Transform)field18.GetValue(val16) == (Object)null) { flag7 = false; } if (field19 != null && (Object)(Transform)field19.GetValue(val16) == (Object)null) { flag7 = false; } if (!flag7) { Object.DestroyImmediate((Object)(object)val16); } } } } RotationHandler[] componentsInChildren6 = unitRoot.GetComponentsInChildren(true); if (componentsInChildren6 != null && componentsInChildren6.Length != 0) { RotationHandler[] array6 = componentsInChildren6; foreach (RotationHandler val17 in array6) { if (!((Object)(object)val17 == (Object)null)) { bool flag8 = true; Torso componentInChildren12 = unitRoot.GetComponentInChildren(); Hip componentInChildren13 = unitRoot.GetComponentInChildren(); if ((Object)(object)componentInChildren12 == (Object)null || (Object)(object)((Component)componentInChildren12).GetComponent() == (Object)null) { flag8 = false; } if ((Object)(object)componentInChildren13 == (Object)null || (Object)(object)((Component)componentInChildren13).GetComponent() == (Object)null) { flag8 = false; } if (!flag8) { Object.DestroyImmediate((Object)(object)val17); } } } } MovementHandler[] componentsInChildren7 = unitRoot.GetComponentsInChildren(true); if (componentsInChildren7 != null && componentsInChildren7.Length != 0) { FieldInfo field20 = typeof(MovementHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field21 = typeof(MovementHandler).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field22 = typeof(MovementHandler).GetField("rigidbodyHolder", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field23 = typeof(MovementHandler).GetField("input", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MovementHandler[] array7 = componentsInChildren7; foreach (MovementHandler val18 in array7) { if (!((Object)(object)val18 == (Object)null)) { bool flag9 = true; if (field20 != null && (Object)(DataHandler)field20.GetValue(val18) == (Object)null) { flag9 = false; } if (field21 != null && (Object)(AnimationHandler)field21.GetValue(val18) == (Object)null) { flag9 = false; } if (field22 != null && (Object)(RigidbodyHolder)field22.GetValue(val18) == (Object)null) { flag9 = false; } if ((Object)(object)val18.movementData == (Object)null || val18.movementData.moves == null || val18.movementData.moves.Length == 0) { flag9 = false; } if (field23 != null && (Object)(GeneralInput)field23.GetValue(val18) == (Object)null) { flag9 = false; } if (!flag9) { Object.DestroyImmediate((Object)(object)val18); } } } } AnimationJoint[] componentsInChildren8 = unitRoot.GetComponentsInChildren(true); if (componentsInChildren8 == null || componentsInChildren8.Length == 0) { return; } AnimationJoint[] array8 = componentsInChildren8; foreach (AnimationJoint val19 in array8) { if (!((Object)(object)val19 == (Object)null)) { bool flag10 = true; if ((Object)(object)val19.animationData == (Object)null || val19.animationData.joints == null || val19.animationData.joints.Length == 0) { flag10 = false; } if ((Object)(object)((Component)val19).GetComponent() == (Object)null) { flag10 = false; } if ((Object)(object)((Component)val19).GetComponentInParent() == (Object)null) { flag10 = false; } if (!flag10) { Object.DestroyImmediate((Object)(object)val19); } } } } public static GameObject 一键完善兵种(GameObject unitBasePrefab, HideFlags hideFlags, bool 静态兵种, Vector3 碰撞箱大小) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)unitBasePrefab == (Object)null) { return null; } 确保标记组件齐全(unitBasePrefab, 静态兵种, 碰撞箱大小); return unitBasePrefab; } public static GameObject 注册并完善兵种(string 兵种名, GameObject 原始UnitBasePrefab, Sprite 图标, uint GUID, HideFlags hideFlags, bool 静态兵种, Vector3 碰撞箱大小) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)原始UnitBasePrefab == (Object)null) { return null; } GameObject obj = UPool.MyPool.AddObject(兵种名, 原始UnitBasePrefab, true, hideFlags, 图标, (int)GUID, true); 确保标记组件齐全(obj, 静态兵种, 碰撞箱大小); return obj; } public static UnitBlueprint 创建兵种(string 兵种名, Faction faction, Sprite 图标, GameObject 原始UnitBasePrefab, uint GUID, float health, uint forceCost, float sizeMultiplier, float massMultiplier, float movementSpeedMuiltiplier, float damageMultiplier, GameObject rightWeapon, GameObject leftWeapon, bool holdinigWithTwoHands, HideFlags hideFlags, bool 静态兵种, Vector3 碰撞箱大小) { //IL_0034: 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) UnitBlueprint val = SLMATool.CreateUnit(兵种名, (UnitBlueprint)null, faction, 图标); val.m_props = (GameObject[])(object)new GameObject[0]; val.RightWeapon = rightWeapon; val.LeftWeapon = leftWeapon; val.holdinigWithTwoHands = holdinigWithTwoHands; val.UnitBase = 注册并完善兵种(兵种名, 原始UnitBasePrefab, 图标, GUID, hideFlags, 静态兵种, 碰撞箱大小); val.health = health; val.forceCost = forceCost; val.sizeMultiplier = sizeMultiplier; val.massMultiplier = massMultiplier; val.movementSpeedMuiltiplier = movementSpeedMuiltiplier; val.damageMultiplier = damageMultiplier; val.Validate(); if (已创建兵种 == null) { 已创建兵种 = new Dictionary(); } 已创建兵种[兵种名] = val; return val; } public static void quebao转接1(GameObject unitRoot) { //IL_0004: 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) 确保标记组件齐全(unitRoot, 静态兵种: true, default(Vector3)); } public static GameObject 转接1(GameObject unitBasePrefab, HideFlags hideFlags = (HideFlags)52) { //IL_000f: 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) if ((Object)(object)unitBasePrefab == (Object)null) { return null; } 确保标记组件齐全(unitBasePrefab, 静态兵种: true, default(Vector3)); return unitBasePrefab; } public static GameObject wsbz转接1(string 兵种名, GameObject 原始UnitBasePrefab, Sprite 图标, uint GUID = 0u, HideFlags hideFlags = (HideFlags)52) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return 注册并完善兵种(兵种名, 原始UnitBasePrefab, 图标, GUID, hideFlags, 静态兵种: true, default(Vector3)); } public static UnitBlueprint cjbz转接1(string 兵种名, Faction faction, Sprite 图标, GameObject 原始UnitBasePrefab, uint GUID = 0u, float health = 100f, uint forceCost = 100u, float sizeMultiplier = 1.2f, float massMultiplier = 1.5f, float movementSpeedMuiltiplier = 1f, float damageMultiplier = 1f, GameObject rightWeapon = null, GameObject leftWeapon = null, bool holdinigWithTwoHands = false, HideFlags hideFlags = (HideFlags)52) { //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_0023: Unknown result type (might be due to invalid IL or missing references) return 创建兵种(兵种名, faction, 图标, 原始UnitBasePrefab, GUID, health, forceCost, sizeMultiplier, massMultiplier, movementSpeedMuiltiplier, damageMultiplier, rightWeapon, leftWeapon, holdinigWithTwoHands, hideFlags, 静态兵种: true, default(Vector3)); } public static void quebao转接2(GameObject unitRoot, bool 静态兵种) { //IL_0004: 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) 确保标记组件齐全(unitRoot, 静态兵种, default(Vector3)); } public static GameObject 转接2(GameObject unitBasePrefab, HideFlags hideFlags, bool 静态兵种) { //IL_000f: 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) if ((Object)(object)unitBasePrefab == (Object)null) { return null; } 确保标记组件齐全(unitBasePrefab, 静态兵种, default(Vector3)); return unitBasePrefab; } public static GameObject wsbz转接2(string 兵种名, GameObject 原始UnitBasePrefab, Sprite 图标, uint GUID, HideFlags hideFlags, bool 静态兵种) { //IL_0004: 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_0010: Unknown result type (might be due to invalid IL or missing references) return 注册并完善兵种(兵种名, 原始UnitBasePrefab, 图标, GUID, hideFlags, 静态兵种, default(Vector3)); } public static UnitBlueprint cjbz转接2(string 兵种名, Faction faction, Sprite 图标, GameObject 原始UnitBasePrefab, uint GUID, float health, uint forceCost, float sizeMultiplier, float massMultiplier, float movementSpeedMuiltiplier, float damageMultiplier, GameObject rightWeapon, GameObject leftWeapon, bool holdinigWithTwoHands, HideFlags hideFlags, bool 静态兵种) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return 创建兵种(兵种名, faction, 图标, 原始UnitBasePrefab, GUID, health, forceCost, sizeMultiplier, massMultiplier, movementSpeedMuiltiplier, damageMultiplier, rightWeapon, leftWeapon, holdinigWithTwoHands, hideFlags, 静态兵种, default(Vector3)); } } [BepInPlugin("MCAAA", "MCAAA", "1.0.0")] internal class Loader : BaseUnityPlugin { private void Awake() { ((MonoBehaviour)this).StartCoroutine("call"); } private IEnumerator call() { yield return (object)new WaitUntil((Func)(() => (Object)(object)Object.FindObjectOfType() != (Object)null)); yield return (object)new WaitUntil((Func)(() => ServiceLocator.GetService() != null)); yield return (object)new WaitForSecondsRealtime(0.3f); SLMALoader.GetInstance(); LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase; UManager.MC(landfallContentDatabase); new Harmony(UManager.modname).PatchAll(); GOSLMA.EditWeapons = ((GOSLMA.EditWeapons == null) ? new Action(UManager.EditWeapons) : ((Action)Delegate.Combine(new Action(UManager.EditWeapons), GOSLMA.EditWeapons))); GOSLMA.EditClothes = ((GOSLMA.EditClothes == null) ? new Action(UManager.EditClothes) : ((Action)Delegate.Combine(new Action(UManager.EditClothes), GOSLMA.EditClothes))); GOSLMA.EditCombatMoves = ((GOSLMA.EditCombatMoves == null) ? new Action(UManager.EditCombatMoves) : ((Action)Delegate.Combine(new Action(UManager.EditCombatMoves), GOSLMA.EditCombatMoves))); GOSLMA.CodeAfterSpawn = ((GOSLMA.CodeAfterSpawn == null) ? new Action(UManager.CodeAfterSpawn) : ((Action)Delegate.Combine(new Action(UManager.CodeAfterSpawn), GOSLMA.CodeAfterSpawn))); GOSLMA.EditProjectiles = ((GOSLMA.EditProjectiles == null) ? new Action(UManager.EditProjectiles) : ((Action)Delegate.Combine(new Action(UManager.EditProjectiles), GOSLMA.EditProjectiles))); UnitBlueprint[] array = Resources.FindObjectsOfTypeAll(); for (int num = 0; num < array.Length; num++) { UManager.EditBlueprint(array[num], landfallContentDatabase); } Debug.Log((object)("加载我的世界 load Minecraft" + UManager.modname + " 成功 Successfully")); Debug.Log((object)(UManager.modname + "is made in SFT by FhpSlime")); Debug.Log((object)(UManager.modder + "wished you a pleasant trip")); } } } public class Item : MonoBehaviour { public enum kind { Weapon, Cloth, Skill, Unit, Projectile, Other } public string name; public kind Kind; } namespace Nothing { public class MyModItems : MonoBehaviour { private static Dictionary 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(); 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; } } } namespace CesyriTools { internal static class 翻译哈 { public static void 语言添加(string key, string trans) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(trans)) { return; } string[] array = trans.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 8) { return; } for (int i = 0; i < array.Length; i++) { if (string.IsNullOrWhiteSpace(array[i])) { return; } } try { Dictionary dictionary = new Dictionary(); dictionary.Add(0, (Language)7); dictionary.Add(1, (Language)0); dictionary.Add(2, (Language)8); dictionary.Add(3, (Language)3); dictionary.Add(4, (Language)1); dictionary.Add(5, (Language)6); dictionary.Add(6, (Language)4); dictionary.Add(7, (Language)2); FieldInfo field = typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic); if (field == null || !(field.GetValue(null) is Dictionary> dictionary2)) { return; } foreach (Language value in dictionary.Values) { if (!dictionary2.ContainsKey(value)) { return; } } for (int j = 0; j < dictionary.Count; j++) { Language key2 = dictionary[j]; if (!dictionary2[key2].ContainsKey(key)) { dictionary2[key2].Add(key, array[j]); } } field.SetValue(null, dictionary2); } catch { } } } public class SpawnModle : MonoBehaviour { public enum 类型 { 头部, 胸部, 本体, 左手, 右手, 左腿, 右腿, 左脚, 右脚, 左臂, 右臂 } public Vector3 lpos; public Vector3 rot; public 类型 位置; public float 大小; public GameObject childprefab; public UnityEvent 生成完成事件 = new UnityEvent(); private Unit unit; public GameObject spawnedObject; public void Start() { unit = ((Component)this).GetComponentInParent(); if ((Object)(object)unit == (Object)null) { Transform parent = ((Component)this).transform.parent; while ((Object)(object)parent != (Object)null && (Object)(object)unit == (Object)null) { unit = ((Component)parent).GetComponent(); parent = parent.parent; } } MeshFilter[] componentsInChildren = ((Component)this).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)((Component)componentsInChildren[i]).gameObject); } if ((Object)(object)childprefab == (Object)null) { Debug.LogError((object)"SpawnModle: childprefab 未设置!", (Object)(object)this); return; } Spawn(); if ((Object)(object)unit != (Object)null) { Outline componentInChildren = ((Component)unit).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { OtherLibrary.SetField(componentInChildren, "isInit", (object)false); } } } public void Spawn() { //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)childprefab == (Object)null) { Debug.LogError((object)"SpawnModle: childprefab 为 null,无法生成对象!", (Object)(object)this); return; } Transform val = null; switch (位置) { case 类型.头部: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.head != (Object)null) { val = ((Component)unit.data.head).transform; } break; case 类型.胸部: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.torso != (Object)null) { val = ((Component)unit.data.torso).transform; } break; case 类型.本体: val = ((Component)this).transform; break; case 类型.左手: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.leftHand != (Object)null) { val = ((Component)unit.data.leftHand).transform; } break; case 类型.右手: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.rightHand != (Object)null) { val = ((Component)unit.data.rightHand).transform; } break; case 类型.左腿: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.legLeft != (Object)null) { val = ((Component)unit.data.legLeft).transform; } break; case 类型.右腿: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.legRight != (Object)null) { val = ((Component)unit.data.legRight).transform; } break; case 类型.左脚: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.footLeft != (Object)null) { val = ((Component)unit.data.footLeft).transform; } break; case 类型.右脚: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.footRight != (Object)null) { val = ((Component)unit.data.footRight).transform; } break; case 类型.左臂: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.leftArm != (Object)null) { val = ((Component)unit.data.leftArm).transform; } break; case 类型.右臂: if ((Object)(object)unit != (Object)null && (Object)(object)unit.data.rightArm != (Object)null) { val = ((Component)unit.data.rightArm).transform; } break; } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)string.Concat("SpawnModle: parent 为 null,位置类型:", 位置, ",使用本体位置"), (Object)(object)this); val = ((Component)this).transform; } try { GameObject val2 = Object.Instantiate(childprefab); val2.transform.SetParent(val); val2.transform.localPosition = lpos; Transform transform = val2.transform; transform.localScale *= 大小; val2.transform.localRotation = Quaternion.Euler(rot); if ((Object)(object)val2.GetComponent() == (Object)null) { Debug.Log((object)("SpawnModle: 自动添加 Projectile 组件到:" + ((Object)val2).name)); val2.AddComponent(); } spawnedObject = val2; Debug.Log((object)("SpawnModle: 成功生成对象:" + ((Object)val2).name)); if (生成完成事件 != null) { 生成完成事件.Invoke(); } } catch (Exception ex) { Debug.LogError((object)("SpawnModle: 生成对象时出错:" + ex.Message), (Object)(object)this); } } } public class ban : MonoBehaviour { private void Start() { try { ((MonoBehaviour)this).StartCoroutine(延迟处理()); } catch (Exception) { Debug.LogError((object)"bug222222"); } } private IEnumerator 延迟处理() { yield return null; yield return null; yield return null; Move[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } yield return null; } private void Awake() { Move[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; } } } } namespace UnityTools { public class body3xuanzhuan : MonoBehaviour { private Transform body3; private Quaternion originalRotation; private bool initialized; public float minAngle; public float maxAngle; public float speed; public float smooth; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(Initialize()); } private IEnumerator Initialize() { yield return null; yield return null; FindBody(); if ((Object)(object)body3 == (Object)null) { Debug.Log((object)"body3: No body3 found"); yield break; } originalRotation = body3.localRotation; initialized = true; Debug.Log((object)"body3 rotation initialized"); } private void FindBody() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name.Contains("body3")) { body3 = val; break; } } } private void LateUpdate() { //IL_0042: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (initialized && !((Object)(object)body3 == (Object)null)) { float num = Mathf.PingPong(Time.time * speed, 1f); float num2 = Mathf.Lerp(minAngle, maxAngle, num); Quaternion val = originalRotation * Quaternion.Euler(num2, 0f, 0f); body3.localRotation = Quaternion.Lerp(body3.localRotation, val, Time.deltaTime * smooth); } } public body3xuanzhuan() { minAngle = -60f; maxAngle = -20f; speed = 0.75f; smooth = 15f; } } public class head3_head2_rotation : MonoBehaviour { public float 旋转速度 = 5f; public float 搜索范围 = 30f; private Transform head3; private Transform head2; private Unit unit; private GameStateManager m_manager; private bool 战斗开始; private Transform head1; private List 当前锁定目标 = new List(); private void Start() { unit = ((Component)this).GetComponentInParent(); m_manager = ServiceLocator.GetService(); if (m_manager != null) { m_manager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(初始化()); } private IEnumerator 初始化() { yield return null; yield return null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "head1") { head1 = val; } if (((Object)val).name == "head2") { head2 = val; } if (((Object)val).name == "head3") { head3 = val; } } Debug.Log((object)("head1:" + ((Object)(object)head1 != (Object)null) + " head2:" + ((Object)(object)head2 != (Object)null) + " head3:" + ((Object)(object)head3 != (Object)null))); } private void OnDestroy() { if (m_manager != null) { m_manager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState 新状态) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)新状态 == 1) { 战斗开始 = true; } } private void LateUpdate() { //IL_004b: 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_007d: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (!战斗开始 || (Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null) { return; } 当前锁定目标.Clear(); if ((Object)(object)head1 != (Object)null) { Unit val = 寻找最近敌人(head1.position); if ((Object)(object)val != (Object)null) { 当前锁定目标.Add(val); 平滑转向(head1, val.data.mainRig.position); } } if ((Object)(object)head2 != (Object)null) { Unit val2 = 寻找最近敌人(head2.position); if ((Object)(object)val2 != (Object)null) { 当前锁定目标.Add(val2); 平滑转向(head2, val2.data.mainRig.position); } } if ((Object)(object)head3 != (Object)null) { Unit val3 = 寻找最近敌人(head3.position); if ((Object)(object)val3 != (Object)null) { 当前锁定目标.Add(val3); 平滑转向(head3, val3.data.mainRig.position); } } } private void 平滑转向(Transform bone, Vector3 target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) Vector3 val = target - bone.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { Quaternion val2 = Quaternion.LookRotation(val); val2 *= Quaternion.Euler(0f, 180f, 0f); bone.rotation = Quaternion.Slerp(bone.rotation, val2, Time.deltaTime * 旋转速度); } } private Unit 寻找最近敌人(Vector3 搜索中心) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(搜索中心, 搜索范围); TeamHolder component = ((Component)unit).GetComponent(); Unit result = null; float num = float.MaxValue; Collider[] array2 = array; for (int i = 0; i < array2.Length; i++) { Unit componentInParent = ((Component)array2[i]).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent == (Object)(object)unit || (Object)(object)componentInParent.data == (Object)null || componentInParent.data.Dead || 当前锁定目标.Contains(componentInParent)) { continue; } TeamHolder component2 = ((Component)componentInParent).GetComponent(); bool flag = false; if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null) { flag = component.team == component2.team; } if (!flag) { float num2 = Vector3.Distance(搜索中心, componentInParent.data.mainRig.position); if (num2 < num) { num = num2; result = componentInParent; } } } return result; } } public class Wing_flap_animation : MonoBehaviour { private Transform right_wing; private Transform right_wing_tip; private Transform left_wing; private Transform left_wing_tip; private Quaternion rightWingOriginal; private Quaternion rightTipOriginal; private Quaternion leftWingOriginal; private Quaternion leftTipOriginal; private bool initialized; [Header("翅膀扇动角度")] public float minAngle = -25f; public float maxAngle = 15f; [Header("扇动速度")] public float speed = 1.5f; [Header("平滑程度")] public float smooth = 8f; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(Initialize()); } private IEnumerator Initialize() { yield return null; yield return null; FindWing(); if ((Object)(object)right_wing == (Object)null) { Debug.Log((object)"right_wing 未找到"); } if ((Object)(object)left_wing == (Object)null) { Debug.Log((object)"left_wing 未找到"); } if ((Object)(object)right_wing != (Object)null) { rightWingOriginal = right_wing.localRotation; } if ((Object)(object)right_wing_tip != (Object)null) { rightTipOriginal = right_wing_tip.localRotation; } if ((Object)(object)left_wing != (Object)null) { leftWingOriginal = left_wing.localRotation; } if ((Object)(object)left_wing_tip != (Object)null) { leftTipOriginal = left_wing_tip.localRotation; } initialized = true; Debug.Log((object)"翅膀动画初始化完成"); } private void FindWing() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "right_wing") { right_wing = val; } if (((Object)val).name == "right_wing_tip") { right_wing_tip = val; } if (((Object)val).name == "left_wing") { left_wing = val; } if (((Object)val).name == "left_wing_tip") { left_wing_tip = val; } } } private void LateUpdate() { //IL_0042: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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) if (initialized) { float num = Mathf.PingPong(Time.time * speed, 1f); float num2 = Mathf.Lerp(minAngle, maxAngle, num); if ((Object)(object)right_wing != (Object)null) { Quaternion val = rightWingOriginal * Quaternion.Euler(0f, 0f, num2); right_wing.localRotation = Quaternion.Lerp(right_wing.localRotation, val, Time.deltaTime * smooth); } if ((Object)(object)left_wing != (Object)null) { Quaternion val2 = leftWingOriginal * Quaternion.Euler(0f, 0f, 0f - num2); left_wing.localRotation = Quaternion.Lerp(left_wing.localRotation, val2, Time.deltaTime * smooth); } if ((Object)(object)right_wing_tip != (Object)null) { Quaternion val3 = rightTipOriginal * Quaternion.Euler(0f, 0f, num2 * 0.6f); right_wing_tip.localRotation = Quaternion.Lerp(right_wing_tip.localRotation, val3, Time.deltaTime * smooth); } if ((Object)(object)left_wing_tip != (Object)null) { Quaternion val4 = leftTipOriginal * Quaternion.Euler(0f, 0f, (0f - num2) * 0.6f); left_wing_tip.localRotation = Quaternion.Lerp(left_wing_tip.localRotation, val4, Time.deltaTime * smooth); } } } } public class Enderdragon_tail_animation : MonoBehaviour { private Transform[] tails = (Transform[])(object)new Transform[12]; private Quaternion[] originalRotation = (Quaternion[])(object)new Quaternion[12]; private bool initialized; [Header("尾巴摆动设置")] public float 摆动速度 = 1.5f; public float 最大角度 = 35f; public float 平滑 = 8f; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(Initialize()); } private IEnumerator Initialize() { yield return null; yield return null; FindTails(); for (int i = 0; i < 12; i++) { if ((Object)(object)tails[i] != (Object)null) { originalRotation[i] = tails[i].localRotation; } } if ((Object)(object)tails[0] != (Object)null) { Vector3 localEulerAngles = tails[0].localEulerAngles; localEulerAngles.y = -180f; tails[0].localRotation = Quaternion.Euler(localEulerAngles); originalRotation[0] = tails[0].localRotation; } initialized = true; Debug.Log((object)"末影龙尾巴初始化完成"); } private void FindTails() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { for (int j = 1; j <= 12; j++) { if (((Object)val).name == "tail" + j) { tails[j - 1] = val; break; } } } } private void LateUpdate() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00b1: Unknown result type (might be due to invalid IL or missing references) if (!initialized) { return; } float num = Mathf.Sin(Time.time * 摆动速度); for (int i = 0; i < 12; i++) { if (!((Object)(object)tails[i] == (Object)null)) { float num2 = (float)(i + 1) / 12f; _ = 最大角度; float num3 = Mathf.Sin(Time.time * 摆动速度 + (float)i * 0.35f) * 最大角度 * num2; Quaternion val = originalRotation[i] * Quaternion.Euler(0f, num3, 0f); tails[i].localRotation = Quaternion.Lerp(tails[i].localRotation, val, Time.deltaTime * 平滑); } } } } public class Jaw_animation : MonoBehaviour { private Transform jaw; private Quaternion originalRotation; private bool initialized; [Header("下颚张合设置")] public float 张开角度 = -50f; public float 闭合角度 = -15f; [Header("速度")] public float speed = 1.2f; [Header("平滑")] public float smooth = 8f; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(Initialize()); } private IEnumerator Initialize() { yield return null; yield return null; FindJaw(); if ((Object)(object)jaw == (Object)null) { Debug.Log((object)"jaw 未找到"); yield break; } originalRotation = jaw.localRotation; initialized = true; Debug.Log((object)"jaw 初始化完成"); } private void FindJaw() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "jaw") { jaw = val; break; } } } private void LateUpdate() { //IL_0042: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (initialized && !((Object)(object)jaw == (Object)null)) { float num = Mathf.PingPong(Time.time * speed, 1f); float num2 = Mathf.Lerp(闭合角度, 张开角度, num); Quaternion val = originalRotation * Quaternion.Euler(num2 - 闭合角度, 0f, 0f); jaw.localRotation = Quaternion.Lerp(jaw.localRotation, val, Time.deltaTime * smooth); } } } public class Neck_rotation : MonoBehaviour { public float 搜索范围 = 30f; public float 旋转速度 = 5f; private Transform[] necks = (Transform[])(object)new Transform[5]; private Unit unit; private GameStateManager m_manager; private bool 战斗开始; private void Start() { unit = ((Component)this).GetComponentInParent(); m_manager = ServiceLocator.GetService(); if (m_manager != null) { m_manager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(初始化()); } private IEnumerator 初始化() { yield return null; yield return null; FindNecks(); Debug.Log((object)"neck查找完成"); } private void FindNecks() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { for (int j = 1; j <= 5; j++) { if (((Object)val).name == "neck" + j) { necks[j - 1] = val; } } } } private void OnDestroy() { if (m_manager != null) { m_manager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { 战斗开始 = true; } } private void LateUpdate() { //IL_0047: 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_006a: Unknown result type (might be due to invalid IL or missing references) if (!战斗开始 || (Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null) { return; } Unit val = 寻找最近敌人(); if ((Object)(object)val == (Object)null) { return; } Vector3 position = val.data.mainRig.position; for (int i = 0; i < necks.Length; i++) { if ((Object)(object)necks[i] != (Object)null) { 转向(necks[i], position); } } } private void 转向(Transform bone, Vector3 target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001c: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) Vector3 val = target - bone.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { Quaternion val2 = Quaternion.LookRotation(val) * Quaternion.Euler(0f, 180f, 0f); bone.rotation = Quaternion.Slerp(bone.rotation, val2, Time.deltaTime * 旋转速度); } } private Unit 寻找最近敌人() { //IL_0010: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(unit.data.mainRig.position, 搜索范围); TeamHolder component = ((Component)unit).GetComponent(); Unit result = null; float num = float.MaxValue; Collider[] array2 = array; for (int i = 0; i < array2.Length; i++) { Unit componentInParent = ((Component)array2[i]).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent == (Object)(object)unit || (Object)(object)componentInParent.data == (Object)null || componentInParent.data.Dead) { continue; } TeamHolder component2 = ((Component)componentInParent).GetComponent(); if (!((Object)(object)component != (Object)null) || !((Object)(object)component2 != (Object)null) || component.team != component2.team) { float num2 = Vector3.Distance(unit.data.mainRig.position, componentInParent.data.mainRig.position); if (num2 < num) { num = num2; result = componentInParent; } } } return result; } } } namespace CesyriTools { public class 禁止描边 : MonoBehaviour { private Outline 描边组件; private void Start() { 禁用描边(); } private void Awake() { 描边组件 = ((Component)this).GetComponent(); } private void 禁用描边() { if ((Object)(object)描边组件 != (Object)null) { ((Behaviour)描边组件).enabled = false; 描边组件.OutlineWidth = 0f; } Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; for (int j = 0; j < materials.Length; j++) { if ((Object)(object)materials[j] != (Object)null && ((Object)materials[j]).name.ToLower().Contains("outline")) { materials[j].SetFloat("_OutlineWidth", 0f); } } } } } } namespace UnityTools { public class White_Head : Head { public float 旋转速度 = 5f; public float 搜索范围 = 30f; private Transform head3; private Transform head2; private Unit unit; private GameStateManager m_manager; private bool 战斗开始; private Transform head1; private List 当前锁定目标 = new List(); private void Start() { unit = ((Component)this).GetComponentInParent(); m_manager = ServiceLocator.GetService(); if (m_manager != null) { m_manager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(初始化()); } private IEnumerator 初始化() { yield return null; yield return null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "head1") { head1 = val; } if (((Object)val).name == "head2") { head2 = val; } if (((Object)val).name == "head3") { head3 = val; } } Debug.Log((object)("head1:" + ((Object)(object)head1 != (Object)null) + " head2:" + ((Object)(object)head2 != (Object)null) + " head3:" + ((Object)(object)head3 != (Object)null))); } private void OnDestroy() { if (m_manager != null) { m_manager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState 新状态) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)新状态 == 1) { 战斗开始 = true; } } private void LateUpdate() { //IL_004b: 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_007d: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (!战斗开始 || (Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null) { return; } 当前锁定目标.Clear(); if ((Object)(object)head1 != (Object)null) { Unit val = 寻找最近敌人(head1.position); if ((Object)(object)val != (Object)null) { 当前锁定目标.Add(val); 平滑转向(head1, val.data.mainRig.position); } } if ((Object)(object)head2 != (Object)null) { Unit val2 = 寻找最近敌人(head2.position); if ((Object)(object)val2 != (Object)null) { 当前锁定目标.Add(val2); 平滑转向(head2, val2.data.mainRig.position); } } if ((Object)(object)head3 != (Object)null) { Unit val3 = 寻找最近敌人(head3.position); if ((Object)(object)val3 != (Object)null) { 当前锁定目标.Add(val3); 平滑转向(head3, val3.data.mainRig.position); } } } private void 平滑转向(Transform bone, Vector3 target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) Vector3 val = target - bone.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { Quaternion val2 = Quaternion.LookRotation(val); val2 *= Quaternion.Euler(0f, 180f, 0f); bone.rotation = Quaternion.Slerp(bone.rotation, val2, Time.deltaTime * 旋转速度); } } private Unit 寻找最近敌人(Vector3 搜索中心) { //IL_0000: 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) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) Collider[] array = Physics.OverlapSphere(搜索中心, 搜索范围); Unit result = null; float num = float.MaxValue; Collider[] array2 = array; for (int i = 0; i < array2.Length; i++) { Unit componentInParent = ((Component)array2[i]).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)unit) && !((Object)(object)componentInParent.data == (Object)null) && !componentInParent.data.Dead && !((Object)(object)componentInParent.data.mainRig == (Object)null) && componentInParent.Team != unit.Team && !当前锁定目标.Contains(componentInParent)) { float num2 = Vector3.Distance(搜索中心, componentInParent.data.mainRig.position); if (num2 < num) { num = num2; result = componentInParent; } } } return result; } } [DefaultExecutionOrder(-1000)] public class WitherMovementAI : MonoBehaviour { public float moveSpeed; private Unit unit; private Unit target; private bool battleStarted; public float heightOffset; public float floatingHeight; public float floatingSpeed; private GameStateManager gameStateManager; private float flyHeight; public float followDistance; public float rotateSpeed; public float scanInterval; private float scanTimer; private Transform unitTransform; private DataHandler dataHandler; private Rigidbody[] rigidbodies; private Transform directionObjectTransform; private Transform groundedDirObjectTransform; private void Start() { gameStateManager = ServiceLocator.GetService(); Rigidbody val = null; if ((Object)(object)dataHandler != (Object)null) { val = dataHandler.mainRig; if ((Object)(object)val != (Object)null) { val.constraints = (RigidbodyConstraints)112; val.isKinematic = true; val.useGravity = false; } } rigidbodies = ((Component)this).GetComponentsInChildren(true); Rigidbody[] array = rigidbodies; foreach (Rigidbody val2 in array) { if (!((Object)(object)val2 == (Object)(object)val)) { val2.useGravity = false; val2.isKinematic = true; val2.constraints = (RigidbodyConstraints)126; } } if (gameStateManager != null) { gameStateManager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(Initialize()); } private void OnDestroy() { if (gameStateManager != null) { gameStateManager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { battleStarted = true; } } public WitherMovementAI() { moveSpeed = 3.8f; heightOffset = 3f; floatingHeight = 0.35f; floatingSpeed = 1.5f; followDistance = 2.5f; rotateSpeed = 2f; scanInterval = 1f; } private IEnumerator Initialize() { yield return null; yield return null; if ((Object)(object)unitTransform != (Object)null) { flyHeight = unitTransform.position.y; } else { flyHeight = ((Component)this).transform.position.y; } if ((Object)(object)dataHandler == (Object)null) { dataHandler = ((Component)this).GetComponentInChildren(); } } private void LateUpdate() { //IL_00a8: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00f2: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) if (!battleStarted || (Object)(object)unit == (Object)null || (Object)(object)unitTransform == (Object)null) { return; } scanTimer += Time.deltaTime; if (scanTimer >= scanInterval) { scanTimer = 0f; target = FindNearestEnemy(); } if (!((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !((Object)(object)target.data.mainRig == (Object)null)) { Vector3 position = target.data.mainRig.position; Vector3 val = unitTransform.position - position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } val = ((Vector3)(ref val)).normalized * followDistance; Vector3 val2 = position + val; val2.y = flyHeight + heightOffset; val2.y += Mathf.Sin(Time.time * floatingSpeed) * floatingHeight; unitTransform.position = Vector3.MoveTowards(unitTransform.position, val2, moveSpeed * Time.deltaTime); Vector3 val3 = position - unitTransform.position; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude > 0.01f) { Quaternion val4 = Quaternion.LookRotation(val3); unitTransform.rotation = Quaternion.Slerp(unitTransform.rotation, val4, rotateSpeed * Time.deltaTime); } } } private Unit FindNearestEnemy() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0092: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType(); Unit result = null; float num = float.MaxValue; Unit[] array2 = array; foreach (Unit val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)unit) && !((Object)(object)val.data == (Object)null) && !val.data.Dead && !((Object)(object)val.data.mainRig == (Object)null) && val.Team != unit.Team) { float num2 = Vector3.Distance(unitTransform.position, val.data.mainRig.position); if (num2 < num) { num = num2; result = val; } } } return result; } private void FixedUpdate() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) if (battleStarted && (Object)(object)dataHandler != (Object)null && (Object)(object)unitTransform != (Object)null) { Transform transform = ((Component)dataHandler.mainRig).transform; if ((Object)(object)transform != (Object)null) { transform.position = unitTransform.position; transform.rotation = unitTransform.rotation; } if ((Object)(object)dataHandler.head != (Object)null && (Object)(object)((Component)dataHandler.head).transform != (Object)null) { ((Component)dataHandler.head).transform.position = unitTransform.position + Vector3.up * 0.5f; ((Component)dataHandler.head).transform.rotation = unitTransform.rotation; } if ((Object)(object)dataHandler.hip != (Object)null && (Object)(object)((Component)dataHandler.hip).transform != (Object)null) { ((Component)dataHandler.hip).transform.position = unitTransform.position; ((Component)dataHandler.hip).transform.rotation = unitTransform.rotation; } if ((Object)(object)directionObjectTransform != (Object)null) { directionObjectTransform.position = unitTransform.position; directionObjectTransform.rotation = unitTransform.rotation; } if ((Object)(object)groundedDirObjectTransform != (Object)null) { groundedDirObjectTransform.position = unitTransform.position; groundedDirObjectTransform.rotation = unitTransform.rotation; } } } private void Awake() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) unit = ((Component)this).GetComponentInParent(); GameObject unitRootGo = (((Object)(object)unit != (Object)null) ? ((Component)unit).gameObject : ((Component)this).gameObject); if ((Object)(object)unit != (Object)null) { unitTransform = ((Component)unit).transform; } dataHandler = ((Component)this).GetComponentInChildren(); Func obj = delegate(Type t) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) Component componentInChildren4 = unitRootGo.GetComponentInChildren(t, true); if ((Object)(object)componentInChildren4 != (Object)null) { return componentInChildren4; } GameObject val6 = new GameObject(t.Name); val6.transform.SetParent(unitRootGo.transform, false); val6.transform.localPosition = Vector3.zero; return val6.AddComponent(t); }; Component val = obj(typeof(DirectionObject)); directionObjectTransform = val.transform; Component val2 = obj(typeof(GroundedDirectionObject)); groundedDirObjectTransform = val2.transform; if ((Object)(object)unitRootGo.GetComponentInChildren(true) == (Object)null) { GameObject val3 = new GameObject("Head"); val3.transform.SetParent(unitRootGo.transform, false); val3.transform.localPosition = Vector3.up * 0.5f; val3.AddComponent(); } Component val4 = obj(typeof(Torso)); if ((Object)(object)val4.GetComponent() == (Object)null) { Rigidbody obj2 = val4.gameObject.AddComponent(); obj2.isKinematic = true; obj2.useGravity = false; obj2.mass = 1f; } Component val5 = obj(typeof(Hip)); if ((Object)(object)val5.GetComponent() == (Object)null) { Rigidbody obj3 = val5.gameObject.AddComponent(); obj3.isKinematic = true; obj3.useGravity = false; obj3.mass = 1f; } obj(typeof(HandLeft)); obj(typeof(HandRight)); if ((Object)(object)dataHandler != (Object)null) { FieldInfo field = typeof(DataHandler).GetField("characterForwardObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(dataHandler, val.transform); } FieldInfo field2 = typeof(DataHandler).GetField("groundedMovementDirectionObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(dataHandler, val2.transform); } } RotationHandler componentInChildren = unitRootGo.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren); } GravityHandler componentInChildren2 = unitRootGo.GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren2); } GroundChecker componentInChildren3 = unitRootGo.GetComponentInChildren(true); if ((Object)(object)componentInChildren3 != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren3); } } } } namespace CesyriTools { public class yanjingColor : MonoBehaviour { public Color eyeColor = Color.white; public Color pupilColor = Color.black; public bool continuousUpdate = true; private void Start() { ApplyColors(); } private void Update() { if (continuousUpdate) { ApplyColors(); } } public void ApplyColors() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) GooglyEye[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (GooglyEye val in componentsInChildren) { if (!((Object)(object)val != (Object)null)) { continue; } Renderer component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.material != (Object)null) { if (component.material.HasProperty("_Color")) { component.material.color = eyeColor; } else if (component.material.HasProperty("_BaseColor")) { component.material.SetColor("_BaseColor", eyeColor); } } if (!((Object)(object)val.pupil != (Object)null)) { continue; } Renderer component2 = ((Component)val.pupil).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.material != (Object)null) { if (component2.material.HasProperty("_Color")) { component2.material.color = pupilColor; } else if (component2.material.HasProperty("_BaseColor")) { component2.material.SetColor("_BaseColor", pupilColor); } } } } } } namespace UnityTools { public class MCdiediedie : MonoBehaviour { private Unit unit; private bool 已死亡; [Header("死亡效果设置")] public GameObject 死亡特效; public float 倒下时间 = 0.35f; public float 消失时间 = 0.8f; public float 倒下角度 = 90f; private void Start() { unit = ((Component)this).GetComponentInParent(); } private void Update() { if (!已死亡 && (Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && unit.data.Dead) { 已死亡 = true; ((MonoBehaviour)this).StartCoroutine(死亡动画()); } } private IEnumerator 死亡动画() { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val.material != (Object)null) { val.material = new Material(val.material); if (val.material.HasProperty("_Color")) { Color color = val.material.color; val.material.color = new Color(Mathf.Lerp(color.r, 1f, 0.25f), Mathf.Lerp(color.g, 0.5f, 0.25f), Mathf.Lerp(color.b, 0.5f, 0.25f), color.a); } } } Quaternion start = ((Component)this).transform.rotation; Quaternion end = start * Quaternion.Euler(0f, 0f, (Random.value > 0.5f) ? 倒下角度 : (0f - 倒下角度)); float time = 0f; while (time < 倒下时间) { time += Time.deltaTime; float num = Mathf.SmoothStep(0f, 1f, time / 倒下时间); ((Component)this).transform.rotation = Quaternion.Slerp(start, end, num); yield return null; } ((Component)this).transform.rotation = end; yield return (object)new WaitForSeconds(消失时间 - 倒下时间); if ((Object)(object)死亡特效 != (Object)null) { Vector3 position = ((Component)this).transform.position; if ((Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && (Object)(object)unit.data.mainRig != (Object)null) { position = unit.data.mainRig.position; } Object.Destroy((Object)(object)Object.Instantiate(死亡特效, position, Quaternion.identity), 3f); } componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Collider[] componentsInChildren2 = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.Destroy((Object)(object)componentsInChildren2[i]); } if ((Object)(object)unit != (Object)null && (Object)(object)((Component)unit).gameObject != (Object)(object)((Component)this).gameObject) { Object.Destroy((Object)(object)((Component)this).gameObject, 2f); } } } public class withershoot : MonoBehaviour { private Unit unit; private GameStateManager m_manager; private Transform head1; private Transform head2; private Transform head3; private AudioSource 音频源; private bool 战斗开始; private bool 已死亡; [Header("凋灵攻击设置")] public GameObject 凋灵子弹预制体; public AudioClip 发射音效; public float 发射音量; public float 子弹速度; public float 搜索范围; private void Start() { unit = ((Component)this).GetComponentInParent(); m_manager = ServiceLocator.GetService(); if (m_manager != null) { m_manager.GameStateChanged += OnGameStateChanged; } 创建音频源(); ((MonoBehaviour)this).StartCoroutine(初始化()); } private void OnDestroy() { if (m_manager != null) { m_manager.GameStateChanged -= OnGameStateChanged; } } private void Update() { if (!已死亡 && (Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && unit.data.Dead) { 已死亡 = true; ((MonoBehaviour)this).StopAllCoroutines(); } } private void OnGameStateChanged(GameState 状态) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)状态 == 1) { 战斗开始 = true; } } private IEnumerator 主头攻击() { while (true) { yield return (object)new WaitForSeconds(5f); if (战斗开始 && !已死亡 && (Object)(object)head1 != (Object)null) { 发射凋灵子弹(head1, 蓝色: true); } } } private void 发射凋灵子弹(Transform head, bool 蓝色) { //IL_0016: 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_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)凋灵子弹预制体 == (Object)null) { return; } GameObject val = Object.Instantiate(凋灵子弹预制体, head.position, head.rotation * Quaternion.Euler(0f, 180f, 0f)); withershoot_projectile component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.设置攻击者(unit); } 播放发射音效(head.position); Rigidbody component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { Unit val2 = 寻找最近敌人(head.position); Vector3 val4; if ((Object)(object)val2 != (Object)null && (Object)(object)val2.data != (Object)null && (Object)(object)val2.data.mainRig != (Object)null) { Vector3 val3 = val2.data.mainRig.position - head.position; val4 = ((Vector3)(ref val3)).normalized; } else { val4 = Quaternion.Euler(0f, 180f, 0f) * head.forward; } component2.velocity = val4 * 子弹速度; } if (蓝色) { Renderer componentInChildren = val.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Material val5 = new Material(componentInChildren.material); val5.color = new Color(0.25f, 0.75f, 1f); if (val5.HasProperty("_EmissionColor")) { val5.EnableKeyword("_EMISSION"); val5.SetColor("_EmissionColor", new Color(0.15f, 0.6f, 1f) * 1.5f); } componentInChildren.material = val5; } } Object.Destroy((Object)(object)val, 6f); } private void 创建音频源() { 音频源 = ((Component)this).gameObject.AddComponent(); 音频源.spatialBlend = 1f; 音频源.rolloffMode = (AudioRolloffMode)1; 音频源.minDistance = 1f; 音频源.maxDistance = 30f; try { SoundPlayer service = ServiceLocator.GetService(); if (!((Object)(object)service != (Object)null)) { return; } GameObject val = 获取字段(service, "defaultSource"); if ((Object)(object)val != (Object)null) { AudioSource component = val.GetComponent(); if ((Object)(object)component != (Object)null) { 音频源.outputAudioMixerGroup = component.outputAudioMixerGroup; } } } catch { } } private void 播放发射音效(Vector3 position) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown if (!((Object)(object)发射音效 == (Object)null)) { GameObject val = new GameObject("WitherShootAudio"); val.transform.position = position; AudioSource obj = val.AddComponent(); obj.outputAudioMixerGroup = 音频源.outputAudioMixerGroup; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.clip = 发射音效; obj.volume = 发射音量; obj.Play(); Object.Destroy((Object)val, 发射音效.length + 0.5f); } } private T 获取字段(object obj, string name) { if (obj == null) { return default(T); } FieldInfo field = obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return default(T); } object value = field.GetValue(obj); if (value is T) { return (T)value; } return default(T); } public withershoot() { 发射音量 = 0.3f; 子弹速度 = 20f; 搜索范围 = 30f; } private IEnumerator 初始化() { yield return null; yield return null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "head1") { head1 = val; } if (((Object)val).name == "head2") { head2 = val; } if (((Object)val).name == "head3") { head3 = val; } } Debug.Log((object)("head1:" + ((Object)(object)head1 != (Object)null) + " head2:" + ((Object)(object)head2 != (Object)null) + " head3:" + ((Object)(object)head3 != (Object)null))); ((MonoBehaviour)this).StartCoroutine(head2攻击()); ((MonoBehaviour)this).StartCoroutine(head3攻击()); ((MonoBehaviour)this).StartCoroutine(主头攻击()); } private IEnumerator head2攻击() { while (true) { yield return (object)new WaitForSeconds(Random.Range(2f, 3f)); if (战斗开始 && !已死亡 && (Object)(object)head2 != (Object)null) { 发射凋灵子弹(head2, 蓝色: false); } } } private IEnumerator head3攻击() { while (true) { yield return (object)new WaitForSeconds(Random.Range(2f, 3f)); if (战斗开始 && !已死亡 && (Object)(object)head3 != (Object)null) { 发射凋灵子弹(head3, 蓝色: false); } } } private Unit 寻找最近敌人(Vector3 搜索中心) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) Collider[] array = Physics.OverlapSphere(搜索中心, 搜索范围); Unit result = null; float num = float.MaxValue; Collider[] array2 = array; for (int i = 0; i < array2.Length; i++) { Unit componentInParent = ((Component)array2[i]).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)unit) && !((Object)(object)componentInParent.data == (Object)null) && !componentInParent.data.Dead && !((Object)(object)componentInParent.data.mainRig == (Object)null) && componentInParent.Team != unit.Team) { float num2 = Vector3.Distance(搜索中心, componentInParent.data.mainRig.position); if (num2 < num) { num = num2; result = componentInParent; } } } return result; } } public class withershoot_projectile : MonoBehaviour { public float 伤害; public GameObject 命中特效; public AudioClip 命中音效; public float 音效音量; private Unit 攻击者; private bool 已命中; private AudioSource 音频源; private void Start() { 创建音频源(); } public void 设置攻击者(Unit unit) { 攻击者 = unit; } private void OnCollisionEnter(Collision collision) { Unit componentInParent = collision.gameObject.GetComponentInParent(); 处理命中(componentInParent); } private void OnTriggerEnter(Collider other) { Unit componentInParent = ((Component)other).GetComponentInParent(); 处理命中(componentInParent); } private void 处理命中(Unit target) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (!已命中 && !((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !target.data.Dead && (!((Object)(object)攻击者 != (Object)null) || (!((Object)(object)target == (Object)(object)攻击者) && target.Team != 攻击者.Team))) { 已命中 = true; Vector3 val = target.data.mainRig.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; ((Damagable)target.data.healthHandler).TakeDamage(伤害, normalized, 攻击者, (DamageType)0); if ((Object)(object)命中特效 != (Object)null) { Object.Destroy((Object)(object)Object.Instantiate(命中特效, target.data.mainRig.position, Quaternion.identity), 3f); } 播放命中音效(); Object.Destroy((Object)(object)((Component)this).gameObject); } } private void 创建音频源() { 音频源 = ((Component)this).gameObject.AddComponent(); 音频源.spatialBlend = 1f; 音频源.rolloffMode = (AudioRolloffMode)1; 音频源.minDistance = 1f; 音频源.maxDistance = 30f; try { SoundPlayer service = ServiceLocator.GetService(); if (!((Object)(object)service != (Object)null)) { return; } GameObject val = 获取字段(service, "defaultSource"); if ((Object)(object)val != (Object)null) { AudioSource component = val.GetComponent(); if ((Object)(object)component != (Object)null) { 音频源.outputAudioMixerGroup = component.outputAudioMixerGroup; } } } catch { } } private void 播放命中音效() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown if (!((Object)(object)命中音效 == (Object)null)) { GameObject val = new GameObject("WitherHitAudio"); val.transform.position = ((Component)this).transform.position; AudioSource obj = val.AddComponent(); obj.outputAudioMixerGroup = 音频源.outputAudioMixerGroup; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.clip = 命中音效; obj.volume = 音效音量; obj.Play(); Object.Destroy((Object)val, 命中音效.length + 0.5f); } } private T 获取字段(object obj, string name) { if (obj == null) { return default(T); } FieldInfo field = obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return default(T); } object value = field.GetValue(obj); if (value is T) { return (T)value; } return default(T); } public withershoot_projectile() { 伤害 = 75f; 音效音量 = 0.8f; } } public class DragonFlightAI : MonoBehaviour { private enum State { Flying, Diving } public float flyHeight = 15f; public float circleRadius = 20f; public float flySpeed = 10f; public float diveSpeed = 35f; public float searchRange = 50f; public float waitTime = 5f; public float attackCooldown = 20f; public float turnSpeed = 0.8f; public float maxRoll = 15f; public float scanInterval = 1f; private Unit unit; private Transform unitTransform; private Unit target; private GameStateManager gameStateManager; private bool battleStarted; private Vector3 center; private float flyY; private float angle; private float timer; private float cooldownTimer; private float scanTimer; private State state; private void Start() { //IL_005b: 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_006c: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) unit = ((Component)this).GetComponentInParent(); if ((Object)(object)unit != (Object)null) { unitTransform = ((Component)unit).transform; center = unitTransform.position; flyY = unitTransform.position.y; } else { center = ((Component)this).transform.position; flyY = ((Component)this).transform.position.y; } gameStateManager = ServiceLocator.GetService(); if (gameStateManager != null) { gameStateManager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(Initialize()); } private void OnDestroy() { if (gameStateManager != null) { gameStateManager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { battleStarted = true; } } private IEnumerator Initialize() { yield return null; yield return null; if ((Object)(object)unitTransform != (Object)null) { center = unitTransform.position; flyY = unitTransform.position.y; } angle = Random.Range(0f, 360f); } private void LateUpdate() { if (!battleStarted || (Object)(object)unit == (Object)null || (Object)(object)unitTransform == (Object)null) { return; } if (cooldownTimer > 0f) { cooldownTimer -= Time.deltaTime; } switch (state) { case State.Flying: FlyAround(); timer += Time.deltaTime; scanTimer += Time.deltaTime; if (scanTimer >= scanInterval) { scanTimer = 0f; target = FindNearestEnemy(); } if (timer >= waitTime && cooldownTimer <= 0f && (Object)(object)target != (Object)null) { state = State.Diving; timer = 0f; } break; case State.Diving: DiveAttack(); break; } } private void FlyAround() { //IL_0021: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) angle += Time.deltaTime * flySpeed / circleRadius; Vector3 val = center + new Vector3(Mathf.Cos(angle) * circleRadius, flyY + Mathf.Sin(Time.time * 2f) * 2f, Mathf.Sin(angle) * circleRadius); unitTransform.position = Vector3.Lerp(unitTransform.position, val, Time.deltaTime * 2f); Vector3 direction = val - unitTransform.position; SmoothLook(direction, useRoll: true); } private void DiveAttack() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || target.data.Dead || (Object)(object)target.data.mainRig == (Object)null) { FinishDive(); return; } Vector3 direction = target.data.mainRig.position - unitTransform.position; if (((Vector3)(ref direction)).sqrMagnitude > 0.01f) { Transform obj = unitTransform; obj.position += ((Vector3)(ref direction)).normalized * diveSpeed * Time.deltaTime; SmoothLook(direction, useRoll: false); } if (Vector3.Distance(unitTransform.position, target.data.mainRig.position) < 2f) { FinishDive(); } } private void FinishDive() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) target = null; cooldownTimer = attackCooldown; center = unitTransform.position; flyY = unitTransform.position.y; angle = Random.Range(0f, 360f); state = State.Flying; } private void SmoothLook(Vector3 direction, bool useRoll) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0090: 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_00a2: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!(((Vector3)(ref direction)).sqrMagnitude < 0.001f)) { Quaternion val = Quaternion.LookRotation(direction) * Quaternion.Euler(0f, 180f, 0f); if (useRoll) { float num = Mathf.Clamp((0f - Mathf.DeltaAngle(unitTransform.eulerAngles.y, ((Quaternion)(ref val)).eulerAngles.y)) * 0.5f, 0f - maxRoll, maxRoll); val *= Quaternion.Euler(0f, 0f, num); } unitTransform.rotation = Quaternion.Slerp(unitTransform.rotation, val, turnSpeed * Time.deltaTime); } } private Unit FindNearestEnemy() { //IL_006a: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType(); Unit result = null; float num = searchRange; Unit[] array2 = array; foreach (Unit val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)unit) && !((Object)(object)val.data == (Object)null) && !val.data.Dead && !((Object)(object)val.data.mainRig == (Object)null) && val.Team != unit.Team) { float num2 = Vector3.Distance(unitTransform.position, val.data.mainRig.position); if (num2 < num) { num = num2; result = val; } } } return result; } } public class ehunshoot : MonoBehaviour { public GameObject ProjectilePrefab; public AudioClip ShootSound; public float ShootVolume = 1f; public float ProjectileSpeed = 20f; public float SearchRange = 50f; private Unit unit; private GameStateManager gameStateManager; private bool battleStarted; private bool dead; private Transform body1; private Material originalMaterial; private Material evilMaterial1; private Material evilMaterial2; private readonly List currentTargets = new List(); private void Start() { unit = ((Component)this).GetComponentInParent(); gameStateManager = ServiceLocator.GetService(); if (gameStateManager != null) { gameStateManager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(Initialize()); } private void OnDestroy() { if (gameStateManager != null) { gameStateManager.GameStateChanged -= OnGameStateChanged; } } private void Update() { if (!dead && (Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && unit.data.Dead) { dead = true; ((MonoBehaviour)this).StopAllCoroutines(); } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { battleStarted = true; } } private IEnumerator Initialize() { yield return null; yield return null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "body_1") { body1 = val; break; } } if ((Object)(object)body1 != (Object)null) { Renderer component = ((Component)body1).GetComponent(); if ((Object)(object)component != (Object)null) { originalMaterial = component.material; } } evilMaterial1 = FindMaterial("恶魂1"); evilMaterial2 = FindMaterial("恶魂2"); ((MonoBehaviour)this).StartCoroutine(ShootLoop()); } private IEnumerator ShootLoop() { while (true) { yield return (object)new WaitForSeconds(4f); if (battleStarted && !dead) { Shoot(); } } } private void Shoot() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ProjectilePrefab == (Object)null || (Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null || unit.data.Dead) { return; } Unit val = FindNearestEnemy(((Component)this).transform.position); GameObject obj = Object.Instantiate(ProjectilePrefab, ((Component)this).transform.position, ((Component)this).transform.rotation * Quaternion.Euler(0f, 180f, 0f)); PlayShootSound(((Component)this).transform.position); Rigidbody component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { Vector3 val3; if ((Object)(object)val != (Object)null && (Object)(object)val.data != (Object)null && (Object)(object)val.data.mainRig != (Object)null) { Vector3 val2 = val.data.mainRig.position - ((Component)this).transform.position; val3 = ((Vector3)(ref val2)).normalized; } else { val3 = Quaternion.Euler(0f, 180f, 0f) * ((Component)this).transform.forward; } component.velocity = val3 * ProjectileSpeed; } ((MonoBehaviour)this).StartCoroutine(ChangeMaterial()); Object.Destroy((Object)(object)obj, 6f); } private IEnumerator ChangeMaterial() { if ((Object)(object)body1 == (Object)null) { yield break; } Renderer renderer = ((Component)body1).GetComponent(); if (!((Object)(object)renderer == (Object)null)) { if ((Object)(object)evilMaterial2 != (Object)null) { renderer.material = evilMaterial2; } yield return (object)new WaitForSeconds(0.75f); if ((Object)(object)evilMaterial1 != (Object)null) { renderer.material = evilMaterial1; } else if ((Object)(object)originalMaterial != (Object)null) { renderer.material = originalMaterial; } } } private void PlayShootSound(Vector3 position) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown if (!((Object)(object)ShootSound == (Object)null)) { GameObject val = new GameObject("EhunShootAudio"); val.transform.position = position; AudioSource obj = val.AddComponent(); obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 1f; obj.maxDistance = 30f; obj.clip = ShootSound; obj.volume = ShootVolume; obj.Play(); Object.Destroy((Object)val, ShootSound.length + 0.5f); } } private Unit FindNearestEnemy(Vector3 searchCenter) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(searchCenter, SearchRange); TeamHolder component = ((Component)unit).GetComponent(); Unit result = null; float num = float.MaxValue; for (int i = 0; i < array.Length; i++) { Unit componentInParent = ((Component)array[i]).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent == (Object)(object)unit || (Object)(object)componentInParent.data == (Object)null || componentInParent.data.Dead || currentTargets.Contains(componentInParent)) { continue; } TeamHolder component2 = ((Component)componentInParent).GetComponent(); bool flag = false; if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null) { flag = component.team == component2.team; } if (!flag && !((Object)(object)componentInParent.data.mainRig == (Object)null)) { float num2 = Vector3.Distance(searchCenter, componentInParent.data.mainRig.position); if (num2 < num) { num = num2; result = componentInParent; } } } return result; } private Material FindMaterial(string materialName) { Material[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && ((Object)array[i]).name == materialName) { return array[i]; } } return null; } private T GetField(object obj, string name) { if (obj == null) { return default(T); } FieldInfo field = obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return default(T); } object value = field.GetValue(obj); if (value is T) { return (T)value; } return default(T); } } public class ehunjiojio : MonoBehaviour { private Transform[] tentacles = (Transform[])(object)new Transform[9]; private void Start() { for (int i = 0; i < 9; i++) { GameObject val = GameObject.Find("tentacle" + (i + 1)); if ((Object)(object)val != (Object)null) { tentacles[i] = val.transform; } } for (int j = 0; j < 9; j++) { if ((Object)(object)tentacles[j] != (Object)null) { ((MonoBehaviour)this).StartCoroutine(RotateLoop(tentacles[j])); } } } private IEnumerator RotateLoop(Transform tentacle) { while (true) { float target = Random.Range(-50f, -35f); float duration = Random.Range(1.25f, 2f); yield return RotateTo(tentacle, target, duration); float target2 = Random.Range(-20f, -10f); float duration2 = Random.Range(1.25f, 2f); yield return RotateTo(tentacle, target2, duration2); } } private IEnumerator RotateTo(Transform tentacle, float target, float duration) { float timer = 0f; float startAngle = tentacle.localEulerAngles.x; if (startAngle > 180f) { startAngle -= 360f; } while (timer < duration) { timer += Time.deltaTime; float num = timer / duration; Vector3 localEulerAngles = tentacle.localEulerAngles; localEulerAngles.x = Mathf.Lerp(startAngle, target, num); tentacle.localRotation = Quaternion.Euler(localEulerAngles); yield return null; } Vector3 localEulerAngles2 = tentacle.localEulerAngles; localEulerAngles2.x = target; tentacle.localRotation = Quaternion.Euler(localEulerAngles2); } } public class ehunAI : MonoBehaviour { private Unit unit; private Unit target; private Transform unitTransform; private GameStateManager gameStateManager; private DataHandler dataHandler; private Rigidbody[] rigidbodies; private bool battleStarted; private float scanTimer; private float flyHeight; private float randomHeight; private float randomTimer; public float moveSpeed = 1.2f; public float rotateSpeed = 1.5f; public float scanInterval = 1f; public float followDistance = 8f; public float heightOffset = 5f; public float floatingHeight = 1f; public float floatingSpeed = 0.5f; public float rotateOffset = 180f; private void Start() { unit = ((Component)this).GetComponentInParent(); if ((Object)(object)unit != (Object)null) { unitTransform = ((Component)unit).transform; } gameStateManager = ServiceLocator.GetService(); dataHandler = ((Component)this).GetComponentInChildren(); Rigidbody val = null; if ((Object)(object)dataHandler != (Object)null) { val = dataHandler.mainRig; if ((Object)(object)val != (Object)null) { val.constraints = (RigidbodyConstraints)112; val.isKinematic = true; val.useGravity = false; } } rigidbodies = ((Component)this).GetComponentsInChildren(true); Rigidbody[] array = rigidbodies; foreach (Rigidbody val2 in array) { if ((Object)(object)val2 != (Object)(object)val) { val2.useGravity = false; val2.isKinematic = true; val2.constraints = (RigidbodyConstraints)126; } } if (gameStateManager != null) { gameStateManager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(Initialize()); } private void OnDestroy() { if (gameStateManager != null) { gameStateManager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { battleStarted = true; } } private IEnumerator Initialize() { yield return null; yield return null; if ((Object)(object)unitTransform != (Object)null) { flyHeight = unitTransform.position.y; } else { flyHeight = ((Component)this).transform.position.y; } randomHeight = Random.Range(0f - floatingHeight, floatingHeight); if ((Object)(object)dataHandler == (Object)null) { dataHandler = ((Component)this).GetComponentInChildren(); } } private Unit FindNearestEnemy() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0092: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType(); Unit result = null; float num = float.MaxValue; Unit[] array2 = array; foreach (Unit val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)unit) && !((Object)(object)val.data == (Object)null) && !val.data.Dead && !((Object)(object)val.data.mainRig == (Object)null) && val.Team != unit.Team) { float num2 = Vector3.Distance(unitTransform.position, val.data.mainRig.position); if (num2 < num) { num = num2; result = val; } } } return result; } private void FixedUpdate() { //IL_0046: 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) if (battleStarted && (Object)(object)dataHandler != (Object)null && (Object)(object)unitTransform != (Object)null) { Transform transform = ((Component)dataHandler.mainRig).transform; if ((Object)(object)transform != (Object)null) { transform.position = unitTransform.position; transform.rotation = unitTransform.rotation; } } } private void LateUpdate() { //IL_00a8: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) if (!battleStarted || (Object)(object)unit == (Object)null || (Object)(object)unitTransform == (Object)null) { return; } scanTimer += Time.deltaTime; if (scanTimer >= scanInterval) { scanTimer = 0f; target = FindNearestEnemy(); } if (!((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !((Object)(object)target.data.mainRig == (Object)null)) { Vector3 position = target.data.mainRig.position; Vector3 val = unitTransform.position - position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = position + val * followDistance; randomTimer += Time.deltaTime; if (randomTimer > 2f) { randomTimer = 0f; randomHeight = Random.Range(0f - floatingHeight, floatingHeight); } val2.y = flyHeight + heightOffset + randomHeight; unitTransform.position = Vector3.MoveTowards(unitTransform.position, val2, moveSpeed * Time.deltaTime); Vector3 val3 = position - unitTransform.position; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude > 0.01f) { Quaternion val4 = Quaternion.LookRotation(val3) * Quaternion.Euler(0f, rotateOffset, 0f); unitTransform.rotation = Quaternion.Slerp(unitTransform.rotation, val4, rotateSpeed * Time.deltaTime); } } } } } namespace Nothing { public static class MeleeWeaponExt { private static GameObject _原版近战模板; private static GameObject 原版近战模板 { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown if ((Object)(object)_原版近战模板 == (Object)null) { try { _原版近战模板 = (GameObject)SLMALoader.SDic["weapons"]["Gladius"]; } catch { } if ((Object)(object)_原版近战模板 == (Object)null) { try { _原版近战模板 = (GameObject)SLMALoader.SDic["weapons"]["Sword"]; } catch { } } } return _原版近战模板; } } private static AnimationCurve CopyCurve(AnimationCurve src) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if (src == null) { return null; } return new AnimationCurve(src.keys); } public static void 挥动武器(this GameObject weapon, float damage = 80f, float cooldown = 0.8f, float range = 2f, float curveForce = 260f, float impactForce = 1f, float massCap = 5f, float impactMultiplier = 1f, float maxAngle = 360f, float collisionCooldown = 0.4f, bool setDirectionContinious = false, float directionContiniousLerp = 0f, bool setDirectionContiniousDuringWindup = false, float yTargetOffset = 0f, bool canDealDamageOutSideOfSwing = false, bool randomCooldown = true, bool startOnCooldown = false, bool useHitDirection = false, bool ignoreTeamMates = false, bool onlyOncePerData = false, bool hitFasterAfterDealDamage = true, bool auto = false, float soundDelay = 0f, string soundRef = "", bool enableSwingAnimation = true, AnimationRig swingRig = (AnimationRig)4, float swingForce = 240f, float swingTime = 0.5f, float swingChance = 1f, float upwardsModifier = 0f, AnimationRig bodyRig = (AnimationRig)1, float bodyForce = 80f, float minVelocity = 1f, bool staticDamageValue = false, float enemyMassPow = 1f, float selfDamageMultiplier = 0f, float teamDamage = 0.1f, bool onlyCollideWithRigs = false, float screenShakeMultiplier = 1f, float requiredPowerToParry = 150f, bool callAttackEffects = true, string 模板名 = "Sword_Squire") { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_0711: Expected O, but got Unknown //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_0930: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_0949: Unknown result type (might be due to invalid IL or missing references) //IL_095d: Unknown result type (might be due to invalid IL or missing references) //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_097b: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_0993: Unknown result type (might be due to invalid IL or missing references) //IL_099a: Expected O, but got Unknown //IL_09ac: Unknown result type (might be due to invalid IL or missing references) //IL_09b1: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: 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_09de: Unknown result type (might be due to invalid IL or missing references) //IL_09e3: 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_09f6: Unknown result type (might be due to invalid IL or missing references) //IL_09fb: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Expected O, but got Unknown //IL_0a02: Unknown result type (might be due to invalid IL or missing references) //IL_0a09: Expected O, but got Unknown //IL_0a0c: Unknown result type (might be due to invalid IL or missing references) //IL_0a13: Unknown result type (might be due to invalid IL or missing references) //IL_0a15: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_0a51: Unknown result type (might be due to invalid IL or missing references) //IL_0a58: Expected O, but got Unknown //IL_0a5b: Unknown result type (might be due to invalid IL or missing references) //IL_0a62: Unknown result type (might be due to invalid IL or missing references) //IL_0a64: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)weapon == (Object)null) { return; } MeleeWeaponSpawn[] components = weapon.GetComponents(); foreach (MeleeWeaponSpawn val in components) { if ((Object)(object)val.objectToSpawn == (Object)null) { Object.DestroyImmediate((Object)(object)val); } } Rigidbody component = weapon.GetComponent(); Holdable component2 = weapon.GetComponent(); MeleeWeapon val2 = weapon.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = weapon.AddComponent(); } CollisionWeapon val3 = weapon.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = weapon.AddComponent(); } WeaponForceAnimation val4 = weapon.GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = weapon.AddComponent(); } GameObject val5 = null; try { val5 = (GameObject)SLMALoader.SDic["weapons"][模板名]; } catch { } if ((Object)(object)val5 == (Object)null && 模板名 != "Sword_Squire") { try { val5 = (GameObject)SLMALoader.SDic["weapons"]["Sword_Squire"]; } catch { } } if ((Object)(object)val5 != (Object)null) { Rigidbody component3 = val5.GetComponent(); if ((Object)(object)component3 != (Object)null && (Object)(object)component != (Object)null) { component.mass = component3.mass; component.drag = component3.drag; component.angularDrag = component3.angularDrag; component.useGravity = component3.useGravity; component.isKinematic = component3.isKinematic; component.maxAngularVelocity = component3.maxAngularVelocity; component.interpolation = component3.interpolation; component.collisionDetectionMode = component3.collisionDetectionMode; component.constraints = component3.constraints; } Holdable component4 = val5.GetComponent(); if ((Object)(object)component4 != (Object)null && (Object)(object)component2 != (Object)null) { if (component4.jointData != null && component2.jointData != null) { component2.jointData.angularDrive = component4.jointData.angularDrive; component2.jointData.limit = component4.jointData.limit; } if (component4.pidData != null && component2.pidData != null) { component2.pidData.disableForceDuringSwing = component4.pidData.disableForceDuringSwing; component2.pidData.disableTorqueDuringSwing = component4.pidData.disableTorqueDuringSwing; component2.pidData.proportionalForce = component4.pidData.proportionalForce; component2.pidData.proportionalTorque = component4.pidData.proportionalTorque; component2.pidData.holdingForceMultiplier = component4.pidData.holdingForceMultiplier; component2.pidData.holdingTorqueMultiplier = component4.pidData.holdingTorqueMultiplier; component2.pidData.capAngle = component4.pidData.capAngle; component2.pidData.extraUpPerMeter = component4.pidData.extraUpPerMeter; } component2.ignoreDissarm = component4.ignoreDissarm; component2.useAlternaticeForIceGiant = component4.useAlternaticeForIceGiant; component2.iceGiantRelativePosition = component4.iceGiantRelativePosition; component2.holdingVariationCurve = CopyCurve(component4.holdingVariationCurve); if (component4.holdableData != null && component2.holdableData != null) { component2.holdableData.relativePosition = component4.holdableData.relativePosition; component2.holdableData.forwardRotation = component4.holdableData.forwardRotation; component2.holdableData.upRotation = component4.holdableData.upRotation; component2.holdableData.lookAtTargetWhenWithin = component4.holdableData.lookAtTargetWhenWithin; component2.holdableData.extraGrabDistance = component4.holdableData.extraGrabDistance; component2.holdableData.setRotation = component4.holdableData.setRotation; component2.holdableData.snapConnect = component4.holdableData.snapConnect; } } MeleeWeapon component5 = val5.GetComponent(); if ((Object)(object)component5 != (Object)null) { val2.forceCurve = CopyCurve(component5.forceCurve); val2.curveForce = component5.curveForce; ((Weapon)val2).internalCooldown = ((Weapon)component5).internalCooldown; ((Weapon)val2).maxRange = ((Weapon)component5).maxRange; ((Weapon)val2).maxAngle = ((Weapon)component5).maxAngle; ((Weapon)val2).randomCooldown = ((Weapon)component5).randomCooldown; ((Weapon)val2).startOnCooldown = ((Weapon)component5).startOnCooldown; val2.requiredPowerToParry = component5.requiredPowerToParry; val2.setDirectionContinious = component5.setDirectionContinious; val2.directionContiniousLerp = component5.directionContiniousLerp; val2.setDirectionContiniousDuringWindup = component5.setDirectionContiniousDuringWindup; val2.yTargetOffset = component5.yTargetOffset; val2.canDealDamageOutSideOfSwing = component5.canDealDamageOutSideOfSwing; val2.soundDelay = component5.soundDelay; ((Weapon)val2).callAttackEffects = ((Weapon)component5).callAttackEffects; ((Weapon)val2).auto = ((Weapon)component5).auto; } CollisionWeapon component6 = val5.GetComponent(); if ((Object)(object)component6 != (Object)null) { val3.damage = component6.damage; val3.impactMultiplier = component6.impactMultiplier; val3.onImpactForce = component6.onImpactForce; val3.massCap = component6.massCap; val3.useHitDirection = component6.useHitDirection; val3.ignoreTeamMates = component6.ignoreTeamMates; val3.onlyOncePerData = component6.onlyOncePerData; val3.hitFasterAfterDealDamage = component6.hitFasterAfterDealDamage; val3.cooldown = component6.cooldown; val3.minVelocity = component6.minVelocity; val3.enemyMassPow = component6.enemyMassPow; val3.teamDamage = component6.teamDamage; val3.staticDamageValue = component6.staticDamageValue; val3.selfDamageMultiplier = component6.selfDamageMultiplier; val3.screenShakeMultiplier = component6.screenShakeMultiplier; val3.callEffectsOn = component6.callEffectsOn; val3.playSoundWhenHitNonRigidbodies = component6.playSoundWhenHitNonRigidbodies; } WeaponForceAnimation component7 = val5.GetComponent(); if ((Object)(object)component7 != (Object)null) { val4.upwardsModifier = component7.upwardsModifier; val4.immunityTime = component7.immunityTime; } else { val4.upwardsModifier = 0f; val4.immunityTime = 0.05f; } } else { if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = false; component.drag = 1f; component.angularDrag = 1f; component.mass = 3f; component.maxAngularVelocity = 250f; } if ((Object)(object)component2 != (Object)null) { if (component2.jointData != null) { component2.jointData.angularDrive = 1f; component2.jointData.limit = 90f; } if (component2.pidData != null) { component2.pidData.disableForceDuringSwing = true; component2.pidData.disableTorqueDuringSwing = true; } } val2.forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[6] { new Keyframe(0f, 0f), new Keyframe(0.15f, 0.5f), new Keyframe(0.35f, 1f), new Keyframe(0.6f, 0.8f), new Keyframe(0.85f, 0.3f), new Keyframe(1f, 0f) }); val2.curveForce = 100f; ((Weapon)val2).internalCooldown = 0.8f; ((Weapon)val2).maxRange = 2f; ((Weapon)val2).maxAngle = 360f; ((Weapon)val2).randomCooldown = true; val2.requiredPowerToParry = 100f; val2.setDirectionContinious = false; val2.directionContiniousLerp = 0f; val2.setDirectionContiniousDuringWindup = false; val2.yTargetOffset = 0f; val2.SoundRef = ""; val2.soundDelay = 0f; val2.canDealDamageOutSideOfSwing = false; ((Weapon)val2).auto = false; val2.swingAction = null; val3.damage = 80f; val3.impactMultiplier = 1f; val3.onImpactForce = 1f; val3.massCap = 5f; val3.useHitDirection = false; val3.ignoreTeamMates = false; val3.onlyOncePerData = false; val3.hitFasterAfterDealDamage = true; val3.cooldown = 0.4f; val3.callEffectsOn = (CallEffectsOn)2; val3.playSoundWhenHitNonRigidbodies = true; } ((Weapon)val2).internalCooldown = cooldown; ((Weapon)val2).maxRange = range; val2.curveForce = curveForce; ((Weapon)val2).randomCooldown = randomCooldown; ((Weapon)val2).startOnCooldown = startOnCooldown; ((Weapon)val2).maxAngle = maxAngle; val2.setDirectionContinious = setDirectionContinious; val2.directionContiniousLerp = directionContiniousLerp; val2.setDirectionContiniousDuringWindup = setDirectionContiniousDuringWindup; val2.yTargetOffset = yTargetOffset; val2.canDealDamageOutSideOfSwing = canDealDamageOutSideOfSwing; val2.SoundRef = soundRef; val2.soundDelay = soundDelay; ((Weapon)val2).auto = auto; val2.requiredPowerToParry = requiredPowerToParry; ((Weapon)val2).callAttackEffects = callAttackEffects; val2.swingAction = null; val3.damage = damage; val3.impactMultiplier = impactMultiplier; val3.onImpactForce = impactForce; val3.massCap = massCap; val3.useHitDirection = useHitDirection; val3.ignoreTeamMates = ignoreTeamMates; val3.onlyOncePerData = onlyOncePerData; val3.hitFasterAfterDealDamage = hitFasterAfterDealDamage; val3.cooldown = collisionCooldown; val3.minVelocity = minVelocity; val3.staticDamageValue = staticDamageValue; val3.enemyMassPow = enemyMassPow; val3.selfDamageMultiplier = selfDamageMultiplier; val3.teamDamage = teamDamage; val3.onlyCollideWithRigs = onlyCollideWithRigs; val3.screenShakeMultiplier = screenShakeMultiplier; if (!enableSwingAnimation) { val4.animations = (SpellAnimation[])(object)new SpellAnimation[0]; } else { AnimationCurve rigAnimationCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5] { new Keyframe(0f, 0.6f), new Keyframe(swingTime * 0.15f, 1.5f), new Keyframe(swingTime * 0.4f, 1f), new Keyframe(swingTime * 0.7f, 0.4f), new Keyframe(swingTime, 0f) }); AnimationCurve rigAnimationCurve2 = new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 0.2f), new Keyframe(swingTime * 0.2f, 1f), new Keyframe(swingTime * 0.5f, 0.6f), new Keyframe(swingTime, 0f) }); SpellAnimation val6 = new SpellAnimation(); val6.animationDirection = (SpawnRotation)0; val6.animationRig = swingRig; val6.animationDelay = 0f; val6.rigAnimationForce = swingForce; val6.rigAnimationCurve = rigAnimationCurve; val6.setDirectionContinious = true; val6.invertForceIfLeft = false; if (bodyForce > 0.01f) { SpellAnimation val7 = new SpellAnimation(); val7.animationDirection = (SpawnRotation)0; val7.animationRig = bodyRig; val7.animationDelay = 0f; val7.rigAnimationForce = bodyForce; val7.rigAnimationCurve = rigAnimationCurve2; val7.setDirectionContinious = false; val7.invertForceIfLeft = false; val4.animations = (SpellAnimation[])(object)new SpellAnimation[2] { val6, val7 }; } else { val4.animations = (SpellAnimation[])(object)new SpellAnimation[1] { val6 }; } } val4.upwardsModifier = upwardsModifier; val4.chance = swingChance; } } public class MeleeDirectionFixer : MonoBehaviour { public MeleeWeapon melee; public Transform forcePoint; public DataHandler data; public Rigidbody rig; public Holdable holdable; public bool gravityWasApplied; private void Start() { if ((Object)(object)data == (Object)null) { data = ((Component)this).GetComponentInParent(); } if ((Object)(object)forcePoint == (Object)null) { forcePoint = (((Object)(object)((Component)this).GetComponentInChildren() != (Object)null) ? ((Component)((Component)this).GetComponentInChildren()).transform : ((Component)this).transform); } if ((Object)(object)holdable == (Object)null) { holdable = ((Component)this).GetComponent(); } } private void Update() { if ((Object)(object)data != (Object)null && data.Dead && !gravityWasApplied && (Object)(object)rig != (Object)null) { gravityWasApplied = true; rig.useGravity = true; rig.isKinematic = false; rig.drag = 1f; rig.angularDrag = 1f; } } private void FixedUpdate() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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)melee == (Object)null || !melee.isSwinging) { return; } if ((Object)(object)data == (Object)null) { data = ((Component)this).GetComponentInParent(); } if (!((Object)(object)data == (Object)null) && !((Object)(object)data.targetMainRig == (Object)null) && !data.Dead) { Vector3 val = (((Object)(object)forcePoint != (Object)null) ? forcePoint.position : ((Component)this).transform.position); Vector3 val2 = data.targetMainRig.position - val; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.001f) { melee.SetSpecificSwingDirection(((Vector3)(ref val2)).normalized); } } } } [DefaultExecutionOrder(-2000)] public class UnitAutoFix : MonoBehaviour { private void Awake() { //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) GameObject unitRoot = (((Object)(object)((Component)this).GetComponentInParent() != (Object)null) ? ((Component)((Component)this).GetComponentInParent()).gameObject : ((Component)this).gameObject); Func func = delegate(Type t) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) Component componentInChildren6 = unitRoot.GetComponentInChildren(t, true); if (!((Object)(object)componentInChildren6 != (Object)null)) { GameObject val5 = new GameObject(t.Name); val5.transform.SetParent(unitRoot.transform, false); val5.transform.localPosition = Vector3.zero; Component result = val5.AddComponent(t); if (t == typeof(KneeLeft) || t == typeof(KneeRight)) { if ((Object)(object)val5.GetComponent() == (Object)null) { Rigidbody obj = val5.AddComponent(); obj.isKinematic = true; obj.useGravity = false; obj.mass = 1f; } if ((Object)(object)val5.GetComponent() == (Object)null) { val5.AddComponent(); } } return result; } return componentInChildren6; }; func(typeof(DirectionObject)); func(typeof(GroundedDirectionObject)); func(typeof(KneeLeft)); func(typeof(KneeRight)); DataHandler componentInChildren = unitRoot.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { FieldInfo field = typeof(DataHandler).GetField("characterForwardObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(componentInChildren, func(typeof(DirectionObject)).transform); } FieldInfo field2 = typeof(DataHandler).GetField("groundedMovementDirectionObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(componentInChildren, func(typeof(GroundedDirectionObject)).transform); } if ((Object)(object)componentInChildren.mainRig == (Object)null) { Torso componentInChildren2 = unitRoot.GetComponentInChildren(); Rigidbody val = (((Object)(object)componentInChildren2 != (Object)null) ? ((Component)componentInChildren2).GetComponent() : null); if ((Object)(object)val == (Object)null) { val = unitRoot.GetComponentInChildren(); } if ((Object)(object)val != (Object)null) { FieldInfo field3 = typeof(DataHandler).GetField("mainRig", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(componentInChildren, val); } } } GameObject gameObject = ((Component)componentInChildren).gameObject; if ((Object)(object)gameObject.GetComponent() == (Object)null) { gameObject.AddComponent(); } bool flag = (Object)(object)unitRoot.GetComponentInChildren(true) != (Object)null; bool flag2 = (Object)(object)gameObject.GetComponent() == (Object)null; StandingHandler component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (flag || flag2 || (Object)(object)component.standingData == (Object)null || component.rigsToLift == null || component.rigsToLift.Length == 0)) { Object.DestroyImmediate((Object)(object)component); } Balance component2 = gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null && (flag || flag2 || (Object)(object)component2.balanceData == (Object)null)) { Object.DestroyImmediate((Object)(object)component2); } } Unit component3 = unitRoot.GetComponent(); if ((Object)(object)component3 != (Object)null) { FieldInfo field4 = typeof(Unit).GetField("m_placementSquare", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field4 != null) { object value = field4.GetValue(component3); Type type = value.GetType(); FieldInfo field5 = type.GetField("m_size", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Vector3 val2 = (Vector3)(field5?.GetValue(value) ?? ((object)Vector3.zero)); if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { FieldInfo field6 = type.GetField("m_offset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); ? val3; if (!((Object)(object)unitRoot.GetComponentInChildren() != (Object)null)) { val3 = new Vector3(1.5f, 2.5f, 1.5f); } else { Bounds bounds = unitRoot.GetComponentInChildren().bounds; val3 = ((Bounds)(ref bounds)).size; } Vector3 val4 = (Vector3)val3; val4 = Vector3.Max(val4, new Vector3(1f, 1f, 1f)); if (field5 != null) { field5.SetValue(value, val4); } if (field6 != null) { field6.SetValue(value, (object)new Vector3(0f, val4.y * 0.5f, 0f)); } field4.SetValue(component3, value); } } } if ((Object)(object)unitRoot.GetComponentInChildren(true) != (Object)null) { RotationHandler componentInChildren3 = unitRoot.GetComponentInChildren(true); if ((Object)(object)componentInChildren3 != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren3); } GravityHandler componentInChildren4 = unitRoot.GetComponentInChildren(true); if ((Object)(object)componentInChildren4 != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren4); } GroundChecker componentInChildren5 = unitRoot.GetComponentInChildren(true); if ((Object)(object)componentInChildren5 != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren5); } } } } [DefaultExecutionOrder(-2000)] public class CesyriUnitAutoFix : MonoBehaviour { private void Awake() { //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Expected O, but got Unknown //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Expected O, but got Unknown //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Expected O, but got Unknown //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Expected O, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Expected O, but got Unknown //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Expected O, but got Unknown //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Expected O, but got Unknown //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0857: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Expected O, but got Unknown //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Expected O, but got Unknown //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_0885: Expected O, but got Unknown //IL_089d: Unknown result type (might be due to invalid IL or missing references) //IL_08a8: Expected O, but got Unknown //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Expected O, but got Unknown //IL_0a66: Unknown result type (might be due to invalid IL or missing references) //IL_0a6b: Unknown result type (might be due to invalid IL or missing references) //IL_0a79: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Unknown result type (might be due to invalid IL or missing references) //IL_0a89: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0ad6: Unknown result type (might be due to invalid IL or missing references) //IL_0adb: Unknown result type (might be due to invalid IL or missing references) //IL_0ae9: Unknown result type (might be due to invalid IL or missing references) //IL_0aef: Unknown result type (might be due to invalid IL or missing references) //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0aff: Unknown result type (might be due to invalid IL or missing references) GameObject val = (((Object)(object)((Component)this).GetComponentInParent() != (Object)null) ? ((Component)((Component)this).GetComponentInParent()).gameObject : ((Component)this).gameObject); DataHandler componentInChildren = val.GetComponentInChildren(true); if ((Object)(object)componentInChildren == (Object)null) { return; } Torso componentInChildren2 = val.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { Rigidbody component = ((Component)componentInChildren2).GetComponent(); if ((Object)(object)component != (Object)null) { componentInChildren.mainRig = component; FieldInfo field = typeof(DataHandler).GetField("mainRig", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(componentInChildren, component); } } } else if ((Object)(object)componentInChildren.mainRig == (Object)null) { Rigidbody componentInChildren3 = val.GetComponentInChildren(); if ((Object)(object)componentInChildren3 != (Object)null) { componentInChildren.mainRig = componentInChildren3; } } componentInChildren.Dead = false; Unit component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { if ((Object)(object)((Component)component2).gameObject.GetComponent() == (Object)null) { ((Component)component2).gameObject.AddComponent(); } TeamHolder val2 = val.GetComponentInChildren(true); if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("TeamHolder"); val3.transform.SetParent(((Component)component2).transform, false); val3.transform.localPosition = Vector3.zero; val2 = val3.AddComponent(); } val2.getRootTeamOnAwake = true; val2.team = component2.Team; val2.spawner = ((Component)component2).gameObject; componentInChildren.team = component2.Team; GeneralInput componentInChildren4 = val.GetComponentInChildren(true); WeaponHandler componentInChildren5 = val.GetComponentInChildren(true); Hip componentInChildren6 = val.GetComponentInChildren(); Head componentInChildren7 = val.GetComponentInChildren(); HoldingHandler componentInChildren8 = val.GetComponentInChildren(true); UManager.SetUnitDataHandler(component2, componentInChildren); component2.Input = componentInChildren4; component2.WeaponHandler = componentInChildren5; if ((Object)(object)componentInChildren6 != (Object)null) { component2.Hip = ((Component)componentInChildren6).transform; } if ((Object)(object)componentInChildren7 != (Object)null) { component2.Head = ((Component)componentInChildren7).transform; } component2.holdingHandler = componentInChildren8; } if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } CurveAnimation[] componentsInChildren = val.GetComponentsInChildren(true); if (componentsInChildren != null && componentsInChildren.Length != 0) { CurveAnimation[] array = componentsInChildren; foreach (CurveAnimation val4 in array) { if (!((Object)(object)val4 == (Object)null)) { bool flag = true; if ((Object)(object)val4.animationData == (Object)null || val4.animationData.animations == null || val4.animationData.animations.Length == 0) { flag = false; } if ((Object)(object)((Component)val4).GetComponentInParent() == (Object)null) { flag = false; } if ((Object)(object)((Component)val4).GetComponentInParent() == (Object)null) { flag = false; } if ((Object)(object)val.GetComponentInChildren() == (Object)null) { flag = false; } if ((Object)(object)val.GetComponentInChildren() == (Object)null) { flag = false; } if (!flag) { Object.DestroyImmediate((Object)(object)val4); } } } } GravityHandler[] componentsInChildren2 = val.GetComponentsInChildren(true); if (componentsInChildren2 != null && componentsInChildren2.Length != 0) { FieldInfo field2 = typeof(GravityHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field3 = typeof(GravityHandler).GetField("rigidbodyHolder", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); GravityHandler[] array2 = componentsInChildren2; foreach (GravityHandler val5 in array2) { if (!((Object)(object)val5 == (Object)null)) { bool flag2 = true; DataHandler val6 = ((!(field2 != null)) ? ((DataHandler)null) : ((DataHandler)field2.GetValue(val5))); if ((Object)(object)val6 == (Object)null || (Object)(object)val6.mainRig == (Object)null) { flag2 = false; } if ((Object)((!(field3 != null)) ? ((RigidbodyHolder)null) : ((RigidbodyHolder)field3.GetValue(val5))) == (Object)null) { flag2 = false; } if ((Object)(object)val5.gravityData == (Object)null) { flag2 = false; } if (!flag2) { Object.DestroyImmediate((Object)(object)val5); } } } } StepHandler[] componentsInChildren3 = val.GetComponentsInChildren(true); if (componentsInChildren3 != null && componentsInChildren3.Length != 0) { FieldInfo field4 = typeof(StepHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field5 = typeof(StepHandler).GetField("hip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field6 = typeof(StepHandler).GetField("kneeLeft", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field7 = typeof(StepHandler).GetField("kneeRight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field8 = typeof(StepHandler).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); StepHandler[] array3 = componentsInChildren3; foreach (StepHandler val7 in array3) { if ((Object)(object)val7 == (Object)null) { continue; } bool flag3 = true; if (field4 != null) { if ((Object)(DataHandler)field4.GetValue(val7) == (Object)null) { flag3 = false; } } else { flag3 = false; } if (field5 != null && (Object)(Transform)field5.GetValue(val7) == (Object)null) { flag3 = false; } if (field6 != null && (Object)(Transform)field6.GetValue(val7) == (Object)null) { flag3 = false; } if (field7 != null && (Object)(Transform)field7.GetValue(val7) == (Object)null) { flag3 = false; } if ((Object)(object)val7.stepData == (Object)null || val7.stepData.steps == null || val7.stepData.steps.Length == 0) { flag3 = false; } if (field8 != null && (Object)(AnimationHandler)field8.GetValue(val7) == (Object)null) { flag3 = false; } if (!flag3) { Object.DestroyImmediate((Object)(object)val7); } } } StandingHandler[] componentsInChildren4 = val.GetComponentsInChildren(true); if (componentsInChildren4 != null && componentsInChildren4.Length != 0) { FieldInfo field9 = typeof(StandingHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field10 = typeof(StandingHandler).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); StandingHandler[] array4 = componentsInChildren4; foreach (StandingHandler val8 in array4) { if (!((Object)(object)val8 == (Object)null)) { bool flag4 = true; if (field9 != null && (Object)(DataHandler)field9.GetValue(val8) == (Object)null) { flag4 = false; } if (field10 != null && (Object)(AnimationHandler)field10.GetValue(val8) == (Object)null) { flag4 = false; } if ((Object)(object)val8.standingData == (Object)null || val8.rigsToLift == null || val8.rigsToLift.Length == 0) { flag4 = false; } if (!flag4) { Object.DestroyImmediate((Object)(object)val8); } } } } Balance[] componentsInChildren5 = val.GetComponentsInChildren(true); if (componentsInChildren5 != null && componentsInChildren5.Length != 0) { FieldInfo field11 = typeof(Balance).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field12 = typeof(Balance).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Balance[] array5 = componentsInChildren5; foreach (Balance val9 in array5) { if (!((Object)(object)val9 == (Object)null)) { bool flag5 = true; if (field11 != null && (Object)(DataHandler)field11.GetValue(val9) == (Object)null) { flag5 = false; } if (field12 != null && (Object)(AnimationHandler)field12.GetValue(val9) == (Object)null) { flag5 = false; } if ((Object)(object)val9.balanceData == (Object)null) { flag5 = false; } if (!flag5) { Object.DestroyImmediate((Object)(object)val9); } } } } RotationHandler[] componentsInChildren6 = val.GetComponentsInChildren(true); if (componentsInChildren6 != null && componentsInChildren6.Length != 0) { RotationHandler[] array6 = componentsInChildren6; foreach (RotationHandler val10 in array6) { if (!((Object)(object)val10 == (Object)null)) { Torso componentInChildren9 = val.GetComponentInChildren(); Hip componentInChildren10 = val.GetComponentInChildren(); if ((Object)(object)componentInChildren9 == (Object)null || (Object)(object)((Component)componentInChildren9).GetComponent() == (Object)null || (Object)(object)componentInChildren10 == (Object)null || (Object)(object)((Component)componentInChildren10).GetComponent() == (Object)null) { Object.DestroyImmediate((Object)(object)val10); } } } } MovementHandler[] componentsInChildren7 = val.GetComponentsInChildren(true); if (componentsInChildren7 != null && componentsInChildren7.Length != 0) { FieldInfo field13 = typeof(MovementHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field14 = typeof(MovementHandler).GetField("anim", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field15 = typeof(MovementHandler).GetField("rigidbodyHolder", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MovementHandler[] array7 = componentsInChildren7; foreach (MovementHandler val11 in array7) { if (!((Object)(object)val11 == (Object)null)) { bool flag6 = true; if (field13 != null && (Object)(DataHandler)field13.GetValue(val11) == (Object)null) { flag6 = false; } if (field14 != null && (Object)(AnimationHandler)field14.GetValue(val11) == (Object)null) { flag6 = false; } if (field15 != null && (Object)(RigidbodyHolder)field15.GetValue(val11) == (Object)null) { flag6 = false; } if ((Object)(object)val11.movementData == (Object)null || val11.movementData.moves == null || val11.movementData.moves.Length == 0) { flag6 = false; } if (!flag6) { Object.DestroyImmediate((Object)(object)val11); } } } } AnimationJoint[] componentsInChildren8 = val.GetComponentsInChildren(true); if (componentsInChildren8 != null && componentsInChildren8.Length != 0) { AnimationJoint[] array8 = componentsInChildren8; foreach (AnimationJoint val12 in array8) { if (!((Object)(object)val12 == (Object)null)) { bool flag7 = true; if ((Object)(object)val12.animationData == (Object)null || val12.animationData.joints == null || val12.animationData.joints.Length == 0) { flag7 = false; } if ((Object)(object)((Component)val12).GetComponent() == (Object)null) { flag7 = false; } if ((Object)(object)((Component)val12).GetComponentInParent() == (Object)null) { flag7 = false; } if (!flag7) { Object.DestroyImmediate((Object)(object)val12); } } } } RotationSpring[] componentsInChildren9 = val.GetComponentsInChildren(true); if (componentsInChildren9 != null && componentsInChildren9.Length != 0) { RotationSpring[] array9 = componentsInChildren9; foreach (RotationSpring val13 in array9) { if (!((Object)(object)val13 == (Object)null) && ((Object)(object)val13.connectedTo == (Object)null || (Object)(object)val13.centerOfMass == (Object)null)) { Object.DestroyImmediate((Object)(object)val13); } } } DataHandler[] componentsInChildren10 = val.GetComponentsInChildren(true); if (componentsInChildren10 == null || componentsInChildren10.Length == 0) { return; } DataHandler[] array10 = componentsInChildren10; foreach (DataHandler val14 in array10) { if ((Object)(object)val14 == (Object)null) { continue; } Transform root = ((Component)val14).transform.root; if ((Object)(object)val14.characterForwardObject == (Object)null) { DirectionObject val15 = ((Component)root).GetComponentInChildren(true); if ((Object)(object)val15 == (Object)null) { GameObject val16 = new GameObject("Direction"); val16.transform.SetParent(root, false); val16.transform.localPosition = Vector3.zero; val16.transform.localRotation = Quaternion.identity; val15 = val16.AddComponent(); } val14.characterForwardObject = ((Component)val15).transform; } if ((Object)(object)val14.groundedMovementDirectionObject == (Object)null) { GroundedDirectionObject val17 = ((Component)root).GetComponentInChildren(true); if ((Object)(object)val17 == (Object)null) { GameObject val18 = new GameObject("GroundedMovementDirection"); val18.transform.SetParent(root, false); val18.transform.localPosition = Vector3.zero; val18.transform.localRotation = Quaternion.identity; val17 = val18.AddComponent(); } val14.groundedMovementDirectionObject = ((Component)val17).transform; } } } } [DefaultExecutionOrder(-1500)] public class CesyriDHGuard : MonoBehaviour { private int m_frames; private DataHandler m_cachedDH; private FieldInfo m_fwd; private FieldInfo m_grounded; private FieldInfo m_head; private FieldInfo m_mainRig; private FieldInfo m_footL; private FieldInfo m_footR; private FieldInfo m_handL; private FieldInfo m_handR; private FieldInfo m_armL; private FieldInfo m_armR; private FieldInfo m_unitHasPridPos; private GameObject m_dhRoot; private bool m_isSlimeUnit; private void Awake() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown m_cachedDH = ((Component)this).GetComponentInChildren(true); if ((Object)(object)m_cachedDH == (Object)null) { Object.Destroy((Object)(object)this); return; } GameObject val = (m_dhRoot = (((Object)(object)((Component)m_cachedDH).transform.root != (Object)null) ? ((Component)((Component)m_cachedDH).transform.root).gameObject : ((Component)m_cachedDH).gameObject)); Transform val2 = val.transform.Find("Rigidbodies"); if ((Object)(object)val2 != (Object)null) { Transform val3 = val2.Find("slime"); if ((Object)(object)val3 == (Object)null) { val3 = val2.Find("Slime"); } if ((Object)(object)val3 == (Object)null) { foreach (Transform item in val2) { Transform val4 = item; if (!((Object)(object)val4 == (Object)null) && ((Object)val4).name.IndexOf("slime", StringComparison.OrdinalIgnoreCase) >= 0) { val3 = val4; break; } } } if ((Object)(object)val3 != (Object)null || (Object)(object)val.GetComponentInChildren(true) != (Object)null) { m_isSlimeUnit = true; } } else if ((Object)(object)val.GetComponentInChildren(true) != (Object)null) { m_isSlimeUnit = true; } if (m_isSlimeUnit) { m_frames = 120; Object.Destroy((Object)(object)this); return; } m_fwd = typeof(DataHandler).GetField("characterForwardObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_grounded = typeof(DataHandler).GetField("groundedMovementDirectionObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_head = typeof(DataHandler).GetField("head", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_mainRig = typeof(DataHandler).GetField("mainRig", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_footL = typeof(DataHandler).GetField("footLeft", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_footR = typeof(DataHandler).GetField("footRight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_handL = typeof(DataHandler).GetField("leftHand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_handR = typeof(DataHandler).GetField("rightHand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_armL = typeof(DataHandler).GetField("leftArm", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_armR = typeof(DataHandler).GetField("rightArm", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); m_unitHasPridPos = typeof(Unit).GetField("hasPridictedPos", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } private void LateUpdate() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Expected O, but got Unknown //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Expected O, but got Unknown //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Expected O, but got Unknown m_frames++; if ((Object)(object)m_cachedDH == (Object)null) { Object.Destroy((Object)(object)this); return; } if (!m_cachedDH.Dead) { m_cachedDH.Dead = false; } if (m_frames != 1) { if (m_frames > 120) { Object.Destroy((Object)(object)this); } return; } GameObject val = m_dhRoot ?? (((Object)(object)((Component)m_cachedDH).transform.root != (Object)null) ? ((Component)((Component)m_cachedDH).transform.root).gameObject : ((Component)m_cachedDH).gameObject); Component componentInChildren = val.GetComponentInChildren(typeof(DirectionObject), true); if (m_fwd != null && (Object)(object)componentInChildren != (Object)null && (Object)(Transform)m_fwd.GetValue(m_cachedDH) == (Object)null) { m_fwd.SetValue(m_cachedDH, componentInChildren.transform); } Component componentInChildren2 = val.GetComponentInChildren(typeof(GroundedDirectionObject), true); if (m_grounded != null && (Object)(object)componentInChildren2 != (Object)null && (Object)(Transform)m_grounded.GetValue(m_cachedDH) == (Object)null) { m_grounded.SetValue(m_cachedDH, componentInChildren2.transform); } Component componentInChildren3 = val.GetComponentInChildren(typeof(Head), true); if (m_head != null && (Object)(object)componentInChildren3 != (Object)null && (Object)(Transform)m_head.GetValue(m_cachedDH) == (Object)null) { m_head.SetValue(m_cachedDH, componentInChildren3.transform); } Component componentInChildren4 = val.GetComponentInChildren(typeof(KneeLeft), true); if (m_footL != null && (Object)(object)componentInChildren4 != (Object)null && (Object)(Transform)m_footL.GetValue(m_cachedDH) == (Object)null) { m_footL.SetValue(m_cachedDH, componentInChildren4.transform); } Component componentInChildren5 = val.GetComponentInChildren(typeof(KneeRight), true); if (m_footR != null && (Object)(object)componentInChildren5 != (Object)null && (Object)(Transform)m_footR.GetValue(m_cachedDH) == (Object)null) { m_footR.SetValue(m_cachedDH, componentInChildren5.transform); } Component componentInChildren6 = val.GetComponentInChildren(typeof(HandLeft), true); if (m_handL != null && (Object)(object)componentInChildren6 != (Object)null && (Object)(Transform)m_handL.GetValue(m_cachedDH) == (Object)null) { m_handL.SetValue(m_cachedDH, componentInChildren6.transform); } Component componentInChildren7 = val.GetComponentInChildren(typeof(HandRight), true); if (m_handR != null && (Object)(object)componentInChildren7 != (Object)null && (Object)(Transform)m_handR.GetValue(m_cachedDH) == (Object)null) { m_handR.SetValue(m_cachedDH, componentInChildren7.transform); } Component componentInChildren8 = val.GetComponentInChildren(typeof(ArmLeft), true); if (m_armL != null && (Object)(object)componentInChildren8 != (Object)null && (Object)(Transform)m_armL.GetValue(m_cachedDH) == (Object)null) { m_armL.SetValue(m_cachedDH, componentInChildren8.transform); } Component componentInChildren9 = val.GetComponentInChildren(typeof(ArmRight), true); if (m_armR != null && (Object)(object)componentInChildren9 != (Object)null && (Object)(Transform)m_armR.GetValue(m_cachedDH) == (Object)null) { m_armR.SetValue(m_cachedDH, componentInChildren9.transform); } Torso componentInChildren10 = val.GetComponentInChildren(); if ((Object)(object)componentInChildren10 != (Object)null) { Rigidbody component = ((Component)componentInChildren10).GetComponent(); if ((Object)(object)component != (Object)null && m_mainRig != null) { m_mainRig.SetValue(m_cachedDH, component); } } else if (m_mainRig != null && (Object)(Rigidbody)m_mainRig.GetValue(m_cachedDH) == (Object)null) { Rigidbody componentInChildren11 = val.GetComponentInChildren(); if ((Object)(object)componentInChildren11 != (Object)null) { m_mainRig.SetValue(m_cachedDH, componentInChildren11); } } Unit component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { UManager.SetUnitDataHandler(component2, m_cachedDH); component2.Input = val.GetComponentInChildren(true); component2.WeaponHandler = val.GetComponentInChildren(true); Hip componentInChildren12 = val.GetComponentInChildren(); Head componentInChildren13 = val.GetComponentInChildren(); if ((Object)(object)componentInChildren12 != (Object)null) { component2.Hip = ((Component)componentInChildren12).transform; } if ((Object)(object)componentInChildren13 != (Object)null) { component2.Head = ((Component)componentInChildren13).transform; } component2.holdingHandler = val.GetComponentInChildren(true); try { FieldInfo field = typeof(Unit).GetField("targetingPriorityMultiplier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { float num = (float)field.GetValue(component2); float num2 = UManager.SanitizeF(num, 1f, 0.1f, 100f); if (num2 != num) { field.SetValue(component2, num2); } } FieldInfo field2 = typeof(Unit).GetField("thickness", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { float num3 = (float)field2.GetValue(component2); float num4 = UManager.SanitizeF(num3, 1f, 0.1f, 10f); if (num4 != num3) { field2.SetValue(component2, num4); } } FieldInfo field3 = typeof(Unit).GetField("m_AttackDistance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 != null) { float num5 = (float)field3.GetValue(component2); float num6 = UManager.SanitizeF(num5, 1.5f, 0.1f, 200f); if (num6 != num5) { field3.SetValue(component2, num6); } } FieldInfo field4 = typeof(Unit).GetField("m_PreferedDistance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field4 != null) { float num7 = (float)field4.GetValue(component2); float num8 = UManager.SanitizeF(num7, 0.9f, 0.1f, 200f); if (num8 != num7) { field4.SetValue(component2, num8); } } if ((Object)(object)m_cachedDH != (Object)null) { m_cachedDH.health = UManager.SanitizeF(m_cachedDH.health, 100f, 1f, 99999f); m_cachedDH.maxHealth = UManager.SanitizeF(m_cachedDH.maxHealth, m_cachedDH.health, 1f, 99999f); if (m_cachedDH.maxHealth < m_cachedDH.health) { m_cachedDH.maxHealth = m_cachedDH.health; } } if (m_unitHasPridPos != null) { try { m_unitHasPridPos.SetValue(component2, false); } catch { } } } catch { } } if (m_frames > 120) { Object.Destroy((Object)(object)this); } } } [DefaultExecutionOrder(-3000)] public class CesyriFinalTargetSync : MonoBehaviour { private int m_frames; private Unit m_unit; private UnitAPI m_unitAPI; private bool m_isFinalized; private static MethodInfo _mUnitAPIInitializeECSUnit; private static FieldInfo _mUnitIsUnitCopy; private static Type _cachedGameObjectEntityType; private static MethodInfo _mAddUnitToTeam; private static FieldInfo _mTeamUnitsField; private static FieldInfo _mAllUnitsField; private static FieldInfo _mTeamSystemUnitsDict; private static FieldInfo _fUnitAPIm_unitData; private static FieldInfo _fUnitAPIm_input; private static FieldInfo _fUnitAPIm_goEntity; private static FieldInfo _fUnitAPIm_movementHandler; private static PropertyInfo _pGOEEntityManager; private static PropertyInfo _pGOEEntity; private static MethodInfo _openAddComponentDataT; private static MethodInfo _openAddSharedComponentDataT; private static MethodInfo _openEMAddComponentCT; private static MethodInfo _openHasComponentT; private static MethodInfo _openRemoveComponentT; private static MethodInfo _staticComponentTypeCreateT; private static Type _cachedComponentType; private static MethodInfo _openGetCD; private static MethodInfo _openSetCD; private DataHandler m_cachedDH; private Torso m_cachedTorso; private GeneralInput m_cachedGI; private DirectionObject m_cachedDir; private Hip m_cachedHip; private static Type GetGameObjectEntityType() { if (_cachedGameObjectEntityType != null) { return _cachedGameObjectEntityType; } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type type = assembly.GetType("Unity.Entities.GameObjectEntity", throwOnError: false); if (type != null) { _cachedGameObjectEntityType = type; break; } } catch { } } return _cachedGameObjectEntityType; } private static Type GetComponentType() { if (_cachedComponentType != null) { return _cachedComponentType; } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type type = assembly.GetType("Unity.Entities.ComponentType", throwOnError: false); if (type != null) { _cachedComponentType = type; break; } } catch { } } return _cachedComponentType; } private static MethodInfo FindEntityMgrGenericMethod(string name, int genericParamCount, int paramCount) { Type gameObjectEntityType = GetGameObjectEntityType(); if (gameObjectEntityType == null) { return null; } if (_pGOEEntityManager == null) { _pGOEEntityManager = gameObjectEntityType.GetProperty("EntityManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_pGOEEntityManager == null) { return null; } MethodInfo[] methods = _pGOEEntityManager.PropertyType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != name) && methodInfo.IsGenericMethodDefinition && methodInfo.GetGenericArguments().Length == genericParamCount && methodInfo.GetParameters().Length == paramCount) { return methodInfo; } } return null; } private static TeamSystem GetTeamSystem() { Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { type = assembly.GetType("Unity.Entities.World", throwOnError: false); if (type != null) { break; } } catch { } } if (type == null) { return null; } PropertyInfo property = type.GetProperty("Active", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { return null; } object value = property.GetValue(null, null); if (value == null) { return null; } MethodInfo methodInfo = null; MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo2 in methods) { if (methodInfo2.Name == "GetOrCreateManager" && methodInfo2.IsGenericMethodDefinition && methodInfo2.GetParameters().Length == 0) { methodInfo = methodInfo2; break; } } if (methodInfo == null) { return null; } object? obj2 = methodInfo.MakeGenericMethod(typeof(TeamSystem)).Invoke(value, null); return (TeamSystem)((obj2 is TeamSystem) ? obj2 : null); } private static bool IsUnitRegisteredInTeamSystem(Unit unit, Team team) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) TeamSystem teamSystem = GetTeamSystem(); if (teamSystem == null) { return false; } if (_mTeamUnitsField == null) { _mTeamUnitsField = typeof(TeamSystem).GetField("m_teamUnits", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_mAllUnitsField == null) { _mAllUnitsField = typeof(TeamSystem).GetField("m_allUnits", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_mTeamUnitsField == null || _mAllUnitsField == null) { return false; } Dictionary> dictionary = _mTeamUnitsField.GetValue(teamSystem) as Dictionary>; List list = _mAllUnitsField.GetValue(teamSystem) as List; bool num = dictionary != null && dictionary.ContainsKey(team) && dictionary[team].Contains(unit); bool flag = list?.Contains(unit) ?? false; return num && flag; } private static bool TryGetEMAndEntity(Unit unit, out object em, out object entity) { em = null; entity = null; Type gameObjectEntityType = GetGameObjectEntityType(); if (gameObjectEntityType == null) { return false; } Component component = ((Component)unit).GetComponent(gameObjectEntityType); if ((Object)(object)component == (Object)null) { return false; } if (_pGOEEntityManager == null) { _pGOEEntityManager = gameObjectEntityType.GetProperty("EntityManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_pGOEEntity == null) { _pGOEEntity = gameObjectEntityType.GetProperty("Entity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_pGOEEntityManager == null || _pGOEEntity == null) { return false; } em = _pGOEEntityManager.GetValue(component, null); entity = _pGOEEntity.GetValue(component, null); if (em != null) { return entity != null; } return false; } private static bool IsEntityRegisteredInTeamSystemECS(Unit unit) { TeamSystem teamSystem = GetTeamSystem(); if (teamSystem == null) { return false; } if (_mTeamSystemUnitsDict == null) { _mTeamSystemUnitsDict = typeof(TeamSystem).GetField("Units", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_mTeamSystemUnitsDict == null) { return false; } if (!TryGetEMAndEntity(unit, out var _, out var entity)) { return false; } if (_mTeamSystemUnitsDict.GetValue(teamSystem) is IDictionary dictionary) { return dictionary.Contains(entity); } return false; } private static bool EntityHasUnitTag(Unit unit) { if (!TryGetEMAndEntity(unit, out var em, out var entity)) { return false; } Type typeFromHandle = typeof(UnitTag); if (_openHasComponentT == null) { _openHasComponentT = FindEntityMgrGenericMethod("HasComponent", 1, 1); } if (_openHasComponentT == null) { return false; } try { return (bool)_openHasComponentT.MakeGenericMethod(typeFromHandle).Invoke(em, new object[1] { entity }); } catch { return false; } } private static bool ForceRegisterUnitToTeamSystem(Unit unit, Team team) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) TeamSystem teamSystem = GetTeamSystem(); if (teamSystem == null) { return false; } if (_mAddUnitToTeam == null) { _mAddUnitToTeam = typeof(TeamSystem).GetMethod("AddUnitToTeam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_mAddUnitToTeam == null) { return false; } bool flag = (Object)(object)unit.unitBlueprint != (Object)null && unit.unitBlueprint.excludeFromWinCondition; try { _mAddUnitToTeam.Invoke(teamSystem, new object[3] { unit, team, flag }); return true; } catch (Exception) { return false; } } private static bool TryFullTeamSystemAddUnit(Unit unit, DataHandler dh, Team team) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) TeamSystem teamSystem = GetTeamSystem(); if (teamSystem == null) { return false; } if (!TryGetEMAndEntity(unit, out var _, out var entity)) { return false; } MethodInfo method = typeof(TeamSystem).GetMethod("AddUnit", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[8] { entity.GetType(), typeof(GameObject), typeof(Transform), typeof(Rigidbody), typeof(DataHandler), typeof(Team), typeof(Unit), typeof(bool) }, null); if (method == null) { return false; } bool flag = (Object)(object)unit.unitBlueprint != (Object)null && unit.unitBlueprint.excludeFromWinCondition; Rigidbody val = (((Object)(object)dh != (Object)null && (Object)(object)dh.mainRig != (Object)null) ? dh.mainRig : ((Component)unit).GetComponentInChildren()); try { method.Invoke(teamSystem, new object[8] { entity, ((Component)unit).gameObject, ((Component)unit).gameObject.transform, val, dh, team, unit, flag }); return true; } catch (Exception) { return false; } } private static bool DoManualECSRegistration(Unit unit, DataHandler dh, Team correctTeam) { //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Unknown result type (might be due to invalid IL or missing references) //IL_09c7: Unknown result type (might be due to invalid IL or missing references) //IL_09ce: Unknown result type (might be due to invalid IL or missing references) //IL_09d5: Unknown result type (might be due to invalid IL or missing references) //IL_09ec: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_09fa: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) if (!TryGetEMAndEntity(unit, out var em, out var entity)) { return false; } if (_openAddComponentDataT == null) { _openAddComponentDataT = FindEntityMgrGenericMethod("AddComponentData", 1, 2); } if (_openAddSharedComponentDataT == null) { _openAddSharedComponentDataT = FindEntityMgrGenericMethod("AddSharedComponentData", 1, 2); } if (_openRemoveComponentT == null) { _openRemoveComponentT = FindEntityMgrGenericMethod("RemoveComponent", 1, 1); } if (_staticComponentTypeCreateT == null || _cachedComponentType == null) { Type componentType = GetComponentType(); if (componentType != null) { MethodInfo[] methods = componentType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "Create" && methodInfo.IsGenericMethodDefinition && methodInfo.GetGenericArguments().Length == 1 && methodInfo.GetParameters().Length == 0) { _staticComponentTypeCreateT = methodInfo; break; } } } } if (_openEMAddComponentCT == null) { MethodInfo[] methods = em.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo2 in methods) { if (methodInfo2.Name == "AddComponent" && !methodInfo2.IsGenericMethodDefinition) { ParameterInfo[] parameters = methodInfo2.GetParameters(); if (parameters.Length == 2 && parameters[0].ParameterType.Name == "Entity" && parameters[1].ParameterType.FullName != null && parameters[1].ParameterType.FullName.Contains("ComponentType")) { _openEMAddComponentCT = methodInfo2; break; } } } } bool flag = _openEMAddComponentCT != null && _staticComponentTypeCreateT != null; bool flag2 = _openAddComponentDataT != null; bool flag3 = _openAddSharedComponentDataT != null; if (!flag2 && !flag && !flag3) { return false; } Vector3 position = ((Component)unit).transform.position; Rigidbody val = (((Object)(object)dh != (Object)null && (Object)(object)dh.mainRig != (Object)null) ? dh.mainRig : ((Component)unit).GetComponentInChildren()); if ((Object)(object)val != (Object)null) { position = val.position; } position = UManager.SanitizeV3(position, ((Component)unit).transform.position); Vector3 val2 = position; Hip componentInChildren = ((Component)unit).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)((Component)componentInChildren).transform != (Object)null) { val2 = UManager.SanitizeV3(((Component)componentInChildren).transform.position, position); } float val3 = (((Object)(object)dh != (Object)null) ? dh.health : 100f); float val4 = (((Object)(object)dh != (Object)null) ? dh.maxHealth : 100f); val3 = UManager.SanitizeF(val3, 100f, 1f, 99999f); val4 = UManager.SanitizeF(val4, val3, 1f, 99999f); if (val4 < val3) { val4 = val3; } float val5 = 1.5f; float val6 = 0.9f; PropertyInfo property = typeof(Unit).GetProperty("AttackDistance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); PropertyInfo property2 = typeof(Unit).GetProperty("PreferedDistance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (property != null) { val5 = (float)property.GetValue(unit, null); } if (property2 != null) { val6 = (float)property2.GetValue(unit, null); } } catch { } val5 = UManager.SanitizeF(val5, 1.5f, 0.1f, 200f); val6 = UManager.SanitizeF(val6, 0.9f, 0.1f, 200f); if (val6 > val5) { val6 = val5; } float val7 = 1f; FieldInfo field = typeof(Unit).GetField("thickness", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { try { val7 = (float)field.GetValue(unit); } catch { } } val7 = UManager.SanitizeF(val7, 1f, 0.1f, 10f); float val8 = 1f; FieldInfo field2 = typeof(Unit).GetField("targetingPriorityMultiplier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { try { val8 = (float)field2.GetValue(unit); } catch { } } val8 = UManager.SanitizeF(val8, 1f, 0.1f, 100f); int err = 0; StringBuilder stringBuilder = new StringBuilder(); Func func = delegate(Type t, object[] kvpairs) { object obj8 = Activator.CreateInstance(t); for (int j = 0; j + 1 < kvpairs.Length; j += 2) { string name = (string)kvpairs[j]; object value = kvpairs[j + 1]; FieldInfo field3 = t.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 == null) { PropertyInfo property3 = t.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property3 != null && property3.CanWrite) { property3.SetValue(obj8, value, null); } } else { field3.SetValue(obj8, value); } } return obj8; }; if (flag) { Type[] array = new Type[1] { typeof(UnitTag) }; foreach (Type type in array) { try { object obj4 = _staticComponentTypeCreateT.MakeGenericMethod(type).Invoke(null, null); _openEMAddComponentCT.Invoke(em, new object[2] { entity, obj4 }); } catch (Exception ex) { err++; stringBuilder.Append("Tag(").Append(type.Name).Append("):") .Append(ex.Message) .Append("; "); } } } if (_openRemoveComponentT != null) { Type[] array = new Type[2] { typeof(IsDead), typeof(IsInPool) }; foreach (Type type2 in array) { try { _openRemoveComponentT.MakeGenericMethod(type2).Invoke(em, new object[1] { entity }); } catch { } } } if (flag3) { try { Type typeFromHandle = typeof(Team); object obj6 = func(typeFromHandle, new object[2] { "Value", correctTeam }); _openAddSharedComponentDataT.MakeGenericMethod(typeFromHandle).Invoke(em, new object[2] { entity, obj6 }); } catch (Exception ex2) { err++; stringBuilder.Append("Shared.Team:").Append(ex2.Message).Append("; "); } } if (flag2) { AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(HipPosition), func(typeof(HipPosition), new object[2] { "Value", UManager.MakeFloat3(val2.x, val2.y, val2.z) })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(PredictedPosition), func(typeof(PredictedPosition), new object[2] { "Value", UManager.MakeFloat3(val2.x, val2.y, val2.z) })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(WeaponPosition), func(typeof(WeaponPosition), new object[2] { "Value", UManager.MakeFloat3(val2.x, val2.y, val2.z) })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(TargetPriority), func(typeof(TargetPriority), new object[2] { "Value", val8 })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(TargetThickness), func(typeof(TargetThickness), new object[2] { "Value", val7 })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(BeingTargetedBy), func(typeof(BeingTargetedBy), new object[2] { "Value", 0f })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(EnemyLeastWeightTargeting), func(typeof(EnemyLeastWeightTargeting), new object[0])); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(GroundPosition), func(typeof(GroundPosition), new object[2] { "Value", UManager.MakeFloat3(position.x, position.y, position.z) })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(Range), func(typeof(Range), new object[4] { "AttackRange", val5, "PreferredRange", val6 })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(Health), func(typeof(Health), new object[4] { "CurrentHealth", val3, "MaxHealth", val4 })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(Velocity), func(typeof(Velocity), new object[2] { "Value", UManager.MakeFloat3(0f, 0f, 0f) })); Vector3 val9 = UManager.SanitizeV3(((Component)unit).transform.forward, Vector3.forward); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(Direction), func(typeof(Direction), new object[6] { "LastValue", UManager.MakeFloat3(val9.x, val9.y, val9.z), "Value", UManager.MakeFloat3(val9.x, val9.y, val9.z), "AngleToDirection", 0f })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(HasTargetTag), func(typeof(HasTargetTag), new object[0])); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(IsTarget), func(typeof(IsTarget), new object[0])); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(TargetData), func(typeof(TargetData), new object[6] { "DistanceToTarget", 0f, "TargetInPreferredRange", 0, "TargetInAttackRange", 0 })); float val10 = 100f; if ((Object)(object)unit.unitBlueprint != (Object)null) { try { val10 = unit.unitBlueprint.GetUnitCost(true); } catch { } } val10 = UManager.SanitizeF(val10, 100f, 1f, 100000f); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(UnitCost), func(typeof(UnitCost), new object[2] { "Value", val10 })); AddCD(ref err, stringBuilder, em, entity, _openAddComponentDataT, typeof(ConfusedMovement), func(typeof(ConfusedMovement), new object[2] { "Value", UManager.MakeFloat3(0f, 0f, 0f) })); } return err < 8; } private static void AddCD(ref int err, StringBuilder errors, object em, object entity, MethodInfo addT, Type compType, object componentInstance) { try { addT.MakeGenericMethod(compType).Invoke(em, new object[2] { entity, componentInstance }); } catch (Exception ex) { err++; errors.Append(compType.Name).Append(":").Append(ex.Message) .Append("; "); } } private void Awake() { m_unit = ((Component)this).GetComponent(); if ((Object)(object)m_unit == (Object)null) { Object.Destroy((Object)(object)this); return; } m_unitAPI = ((Component)this).GetComponent(); if ((Object)(object)m_unitAPI == (Object)null) { m_unitAPI = ((Component)this).gameObject.AddComponent(); } if (_mUnitAPIInitializeECSUnit == null) { _mUnitAPIInitializeECSUnit = typeof(UnitAPI).GetMethod("InitializeECSUnit", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_mUnitIsUnitCopy == null) { _mUnitIsUnitCopy = typeof(Unit).GetField("isUnitCopy", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_fUnitAPIm_unitData == null) { _fUnitAPIm_unitData = typeof(UnitAPI).GetField("m_unitData", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_fUnitAPIm_input == null) { _fUnitAPIm_input = typeof(UnitAPI).GetField("m_input", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_fUnitAPIm_goEntity == null) { _fUnitAPIm_goEntity = typeof(UnitAPI).GetField("m_goEntity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_fUnitAPIm_movementHandler == null) { _fUnitAPIm_movementHandler = typeof(UnitAPI).GetField("m_movementHandler", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } GeneralInput componentInChildren = ((Component)m_unit).GetComponentInChildren(true); if (!((Object)(object)componentInChildren != (Object)null)) { return; } m_unit.Input = componentInChildren; if (_fUnitAPIm_input != null) { object? value = _fUnitAPIm_input.GetValue(m_unitAPI); bool flag = value == null; Object val; if ((val = (Object)((value is Object) ? value : null)) != (Object)null) { flag = val == (Object)null; } if (flag) { _fUnitAPIm_input.SetValue(m_unitAPI, componentInChildren); } } if ((Object)(object)componentInChildren.Direction == (Object)null) { DirectionObject componentInChildren2 = ((Component)m_unit).GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren.Direction = ((Component)componentInChildren2).transform; } } } private void Update() { //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: 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_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) m_frames++; if ((Object)(object)m_unit == (Object)null || (Object)(object)m_unitAPI == (Object)null) { Object.Destroy((Object)(object)this); return; } if ((Object)(object)m_cachedDH == (Object)null) { m_cachedDH = ((Component)m_unit).GetComponentInChildren(true); } DataHandler cachedDH = m_cachedDH; if ((Object)(object)cachedDH != (Object)null && cachedDH.Dead) { Object.Destroy((Object)(object)this); return; } if ((Object)(object)cachedDH != (Object)null) { if ((Object)(object)m_cachedTorso == (Object)null) { m_cachedTorso = ((Component)m_unit).GetComponentInChildren(); } Torso cachedTorso = m_cachedTorso; if ((Object)(object)cachedTorso != (Object)null) { Rigidbody component = ((Component)cachedTorso).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)cachedDH.mainRig != (Object)(object)component) { cachedDH.mainRig = component; } } else if ((Object)(object)cachedDH.mainRig == (Object)null) { Rigidbody componentInChildren = ((Component)m_unit).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { cachedDH.mainRig = componentInChildren; } } if ((Object)(object)m_unit.data == (Object)null) { UManager.SetUnitDataHandler(m_unit, cachedDH); } } if (!m_isFinalized || m_frames % 6 == 0) { SyncTeamSystemMainRig(m_unit, cachedDH); } if ((Object)(object)m_cachedGI == (Object)null) { m_cachedGI = ((Component)m_unit).GetComponentInChildren(true); } GeneralInput cachedGI = m_cachedGI; if ((Object)(object)cachedGI != (Object)null) { m_unit.Input = cachedGI; if (_fUnitAPIm_input != null) { object? value = _fUnitAPIm_input.GetValue(m_unitAPI); bool flag = value == null; Object val; if ((val = (Object)((value is Object) ? value : null)) != (Object)null) { flag = val == (Object)null; } if (flag) { _fUnitAPIm_input.SetValue(m_unitAPI, cachedGI); } } if ((Object)(object)cachedGI.Direction == (Object)null) { if ((Object)(object)m_cachedDir == (Object)null) { m_cachedDir = ((Component)m_unit).GetComponentInChildren(true); } DirectionObject cachedDir = m_cachedDir; if ((Object)(object)cachedDir != (Object)null) { cachedGI.Direction = ((Component)cachedDir).transform; } } } if ((Object)(object)cachedDH != (Object)null && (Object)(object)cachedDH.characterForwardObject == (Object)null) { if ((Object)(object)m_cachedDir == (Object)null) { m_cachedDir = ((Component)m_unit).GetComponentInChildren(true); } DirectionObject val2 = m_cachedDir; if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("DirectionObject"); val3.transform.SetParent(((Component)m_unit).transform, false); val3.transform.localPosition = Vector3.zero; val3.transform.forward = Vector3.forward; val2 = (m_cachedDir = val3.AddComponent()); } cachedDH.characterForwardObject = ((Component)val2).transform; GeneralInput cachedGI2 = m_cachedGI; if ((Object)(object)cachedGI2 != (Object)null && (Object)(object)cachedGI2.Direction == (Object)null) { cachedGI2.Direction = ((Component)val2).transform; } } RemoveEcsTagsEveryFrame(m_unit, m_isFinalized); DataHandler cachedDH2 = m_cachedDH; if (!m_isFinalized || m_frames % 6 == 0) { SyncTeamSystemMainRig(m_unit, cachedDH2); } Vector3 position = ((Component)m_unit).transform.position; if ((Object)(object)cachedDH2 != (Object)null && (Object)(object)cachedDH2.mainRig != (Object)null) { position = cachedDH2.mainRig.position; } Vector3 hipPos = position; if ((Object)(object)m_cachedHip == (Object)null) { m_cachedHip = ((Component)m_unit).GetComponentInChildren(); } Hip cachedHip = m_cachedHip; if ((Object)(object)cachedHip != (Object)null && (Object)(object)((Component)cachedHip).transform != (Object)null) { hipPos = ((Component)cachedHip).transform.position; } SyncECSPositionsEveryFrame(m_unit, position, hipPos); _ = m_frames; _ = 3; if (m_frames >= 5 && !m_isFinalized && (TryFinishUnitAPISetup() || m_frames >= 40)) { m_isFinalized = true; } } private static void SyncTeamSystemMainRig(Unit unit, DataHandler dh) { //IL_0075: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown if ((Object)(object)dh == (Object)null || (Object)(object)dh.mainRig == (Object)null) { return; } try { Type typeFromHandle = typeof(TeamSystem); object orCreateManager = World.Active.GetOrCreateManager(); if (orCreateManager == null) { return; } FieldInfo field = typeFromHandle.GetField("Units", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return; } IDictionary dictionary = (IDictionary)field.GetValue(orCreateManager); if (dictionary == null || !TryGetEMAndEntity(unit, out var _, out var entity)) { return; } Entity val = (Entity)entity; if (dictionary.Contains(val)) { object obj = dictionary[val]; Type type = obj.GetType(); FieldInfo field2 = type.GetField("MainRig", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null && (Object)(Rigidbody)field2.GetValue(obj) != (Object)(object)dh.mainRig) { field2.SetValue(obj, dh.mainRig); } FieldInfo field3 = type.GetField("UnitData", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 != null && (Object)(DataHandler)field3.GetValue(obj) != (Object)(object)dh) { field3.SetValue(obj, dh); } } } catch { } } private static Team? GetEntityTeamSharedValue(Unit unit) { //IL_0178: Unknown result type (might be due to invalid IL or missing references) if (!TryGetEMAndEntity(unit, out var em, out var entity)) { return null; } if (_openHasComponentT == null) { _openHasComponentT = FindEntityMgrGenericMethod("HasComponent", 1, 1); } if (_openHasComponentT == null) { return null; } Type typeFromHandle = typeof(Team); Team? result; try { if (!(bool)_openHasComponentT.MakeGenericMethod(typeFromHandle).Invoke(em, new object[1] { entity })) { return null; } MethodInfo methodInfo = null; MethodInfo[] methods = em.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo2 in methods) { if (methodInfo2.Name == "GetSharedComponentData" && methodInfo2.IsGenericMethodDefinition && methodInfo2.GetGenericArguments().Length == 1 && methodInfo2.GetParameters().Length == 1 && methodInfo2.GetParameters()[0].ParameterType.Name == "Entity") { methodInfo = methodInfo2; break; } } if (methodInfo == null) { result = null; } else { object obj = methodInfo.MakeGenericMethod(typeFromHandle).Invoke(em, new object[1] { entity }); FieldInfo field = typeFromHandle.GetField("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field == null)) { return (Team)field.GetValue(obj); } result = null; } } catch { result = null; } return result; } private static string CheckTargetFilterComponents(Unit unit) { if (!TryGetEMAndEntity(unit, out var em, out var entity)) { return "NO-GOE"; } if (_openHasComponentT == null) { _openHasComponentT = FindEntityMgrGenericMethod("HasComponent", 1, 1); } if (_openHasComponentT == null) { return "NO-REF"; } Type[] obj = new Type[6] { typeof(HipPosition), typeof(PredictedPosition), typeof(TargetPriority), typeof(TargetThickness), typeof(BeingTargetedBy), typeof(UnitTag) }; StringBuilder stringBuilder = new StringBuilder(); Type[] array = obj; foreach (Type type in array) { try { bool flag = (bool)_openHasComponentT.MakeGenericMethod(type).Invoke(em, new object[1] { entity }); stringBuilder.Append(flag ? '1' : '0'); } catch { stringBuilder.Append('?'); } } return stringBuilder.ToString(); } private static int SanitizeECSComponentsPostHoc(Unit unit, Vector3 fallbackPos) { //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Unknown result type (might be due to invalid IL or missing references) if (!TryGetEMAndEntity(unit, out var em, out var entity)) { return -1; } if (_openHasComponentT == null) { _openHasComponentT = FindEntityMgrGenericMethod("HasComponent", 1, 1); } MethodInfo methodInfo = null; MethodInfo methodInfo2 = null; if (_openHasComponentT == null) { return 0; } MethodInfo[] methods = em.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo3 in methods) { if (methodInfo3.Name == "GetComponentData" && methodInfo3.IsGenericMethodDefinition && methodInfo3.GetGenericArguments().Length == 1 && methodInfo3.GetParameters().Length == 1 && methodInfo3.GetParameters()[0].ParameterType.Name == "Entity") { methodInfo = methodInfo3; } if (methodInfo3.Name == "SetComponentData" && methodInfo3.IsGenericMethodDefinition && methodInfo3.GetGenericArguments().Length == 1 && methodInfo3.GetParameters().Length == 2 && methodInfo3.GetParameters()[0].ParameterType.Name == "Entity") { methodInfo2 = methodInfo3; } } if (methodInfo == null || methodInfo2 == null) { return -2; } int num = 0; try { Type typeFromHandle = typeof(TargetPriority); if ((bool)_openHasComponentT.MakeGenericMethod(typeFromHandle).Invoke(em, new object[1] { entity })) { object obj = methodInfo.MakeGenericMethod(typeFromHandle).Invoke(em, new object[1] { entity }); FieldInfo field = typeFromHandle.GetField("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { float num2 = (float)field.GetValue(obj); float num3 = UManager.SanitizeF(num2, 1f, 0.1f, 100f); if (num3 != num2) { field.SetValue(obj, num3); methodInfo2.MakeGenericMethod(typeFromHandle).Invoke(em, new object[2] { entity, obj }); num++; } } } } catch { } try { Type typeFromHandle2 = typeof(TargetThickness); if ((bool)_openHasComponentT.MakeGenericMethod(typeFromHandle2).Invoke(em, new object[1] { entity })) { object obj3 = methodInfo.MakeGenericMethod(typeFromHandle2).Invoke(em, new object[1] { entity }); FieldInfo field2 = typeFromHandle2.GetField("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { float num4 = (float)field2.GetValue(obj3); float num5 = UManager.SanitizeF(num4, 1f, 0.1f, 10f); if (num5 != num4) { field2.SetValue(obj3, num5); methodInfo2.MakeGenericMethod(typeFromHandle2).Invoke(em, new object[2] { entity, obj3 }); num++; } } } } catch { } try { Type typeFromHandle3 = typeof(Health); if ((bool)_openHasComponentT.MakeGenericMethod(typeFromHandle3).Invoke(em, new object[1] { entity })) { object obj5 = methodInfo.MakeGenericMethod(typeFromHandle3).Invoke(em, new object[1] { entity }); FieldInfo field3 = typeFromHandle3.GetField("CurrentHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field4 = typeFromHandle3.GetField("MaxHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); bool flag = false; if (field3 != null) { float num6 = (float)field3.GetValue(obj5); float num7 = UManager.SanitizeF(num6, 100f, 1f, 99999f); if (num7 != num6) { field3.SetValue(obj5, num7); flag = true; } } if (field4 != null) { float num8 = (float)field4.GetValue(obj5); float num9 = ((field3 != null) ? ((float)field3.GetValue(obj5)) : 100f); float num10 = UManager.SanitizeF(num8, num9, 1f, 99999f); if (num10 < num9) { num10 = num9; } if (num10 != num8) { field4.SetValue(obj5, num10); flag = true; } } if (flag) { methodInfo2.MakeGenericMethod(typeFromHandle3).Invoke(em, new object[2] { entity, obj5 }); num++; } } } catch { } try { Type typeFromHandle4 = typeof(Range); if ((bool)_openHasComponentT.MakeGenericMethod(typeFromHandle4).Invoke(em, new object[1] { entity })) { object obj7 = methodInfo.MakeGenericMethod(typeFromHandle4).Invoke(em, new object[1] { entity }); FieldInfo field5 = typeFromHandle4.GetField("AttackRange", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field6 = typeFromHandle4.GetField("PreferredRange", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); bool flag2 = false; if (field5 != null) { float num11 = (float)field5.GetValue(obj7); float num12 = UManager.SanitizeF(num11, 1.5f, 0.1f, 200f); if (num12 != num11) { field5.SetValue(obj7, num12); flag2 = true; } } if (field6 != null) { float num13 = (float)field6.GetValue(obj7); float num14 = UManager.SanitizeF(num13, 0.9f, 0.1f, 200f); if (num14 != num13) { field6.SetValue(obj7, num14); flag2 = true; } } if (flag2) { methodInfo2.MakeGenericMethod(typeFromHandle4).Invoke(em, new object[2] { entity, obj7 }); num++; } } } catch { } Type[] array = new Type[3] { typeof(HipPosition), typeof(PredictedPosition), typeof(GroundPosition) }; foreach (Type type in array) { try { if (!(bool)_openHasComponentT.MakeGenericMethod(type).Invoke(em, new object[1] { entity })) { continue; } object obj9 = methodInfo.MakeGenericMethod(type).Invoke(em, new object[1] { entity }); FieldInfo field7 = type.GetField("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field7 == null) { continue; } object value = field7.GetValue(obj9); if (value == null) { continue; } Type type2 = value.GetType(); FieldInfo field8 = type2.GetField("x", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field9 = type2.GetField("y", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field10 = type2.GetField("z", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field8 == null) && !(field9 == null) && !(field10 == null)) { float num15 = (float)field8.GetValue(value); float num16 = (float)field9.GetValue(value); float num17 = (float)field10.GetValue(value); float num18 = ((float.IsNaN(num15) || float.IsInfinity(num15)) ? fallbackPos.x : num15); float num19 = ((float.IsNaN(num16) || float.IsInfinity(num16)) ? fallbackPos.y : num16); float num20 = ((float.IsNaN(num17) || float.IsInfinity(num17)) ? fallbackPos.z : num17); if (num18 != num15 || num19 != num16 || num20 != num17) { field8.SetValue(value, num18); field9.SetValue(value, num19); field10.SetValue(value, num20); field7.SetValue(obj9, value); methodInfo2.MakeGenericMethod(type).Invoke(em, new object[2] { entity, obj9 }); num++; } } } catch { } } return num; } private static string GetFloatDbgSnapshot(Unit unit) { if (!TryGetEMAndEntity(unit, out var em, out var entity)) { return "NO-GOE"; } if (_openHasComponentT == null) { _openHasComponentT = FindEntityMgrGenericMethod("HasComponent", 1, 1); } MethodInfo getCD = null; if (_openHasComponentT == null) { return "NO-HAS"; } MethodInfo[] methods = em.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "GetComponentData" && methodInfo.IsGenericMethodDefinition && methodInfo.GetGenericArguments().Length == 1 && methodInfo.GetParameters().Length == 1 && methodInfo.GetParameters()[0].ParameterType.Name == "Entity") { getCD = methodInfo; break; } } if (getCD == null) { return "NO-GET"; } StringBuilder stringBuilder = new StringBuilder(); Func func = delegate(Type ct, string fname) { float? result; try { if (!(bool)_openHasComponentT.MakeGenericMethod(ct).Invoke(em, new object[1] { entity })) { return (float?)null; } object obj3 = getCD.MakeGenericMethod(ct).Invoke(em, new object[1] { entity }); FieldInfo field5 = ct.GetField(fname, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field5 == null)) { return (float)field5.GetValue(obj3); } result = null; } catch { result = null; } return result; }; float? num = func(typeof(TargetPriority), "Value"); stringBuilder.Append("TPRI=").Append((!num.HasValue) ? "?" : ((float.IsNaN(num.Value) || float.IsInfinity(num.Value)) ? "NaN!" : num.Value.ToString("F3"))).Append(" "); float? num2 = func(typeof(TargetThickness), "Value"); stringBuilder.Append("TTHK=").Append((!num2.HasValue) ? "?" : ((float.IsNaN(num2.Value) || float.IsInfinity(num2.Value)) ? "NaN!" : num2.Value.ToString("F3"))).Append(" "); try { Type typeFromHandle = typeof(HipPosition); if ((bool)_openHasComponentT.MakeGenericMethod(typeFromHandle).Invoke(em, new object[1] { entity })) { object obj = getCD.MakeGenericMethod(typeFromHandle).Invoke(em, new object[1] { entity }); FieldInfo field = typeFromHandle.GetField("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(obj); if (value != null) { Type type = value.GetType(); FieldInfo field2 = type.GetField("x", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field3 = type.GetField("y", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field4 = type.GetField("z", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null && field3 != null && field4 != null) { float arg = (float)field2.GetValue(value); float arg2 = (float)field3.GetValue(value); float arg3 = (float)field4.GetValue(value); Func func2 = (float v) => (!float.IsNaN(v) && !float.IsInfinity(v)) ? v.ToString("F1") : "NaN!"; stringBuilder.Append("HIP=").Append(func2(arg)).Append(",") .Append(func2(arg2)) .Append(",") .Append(func2(arg3)); } } } } } catch { } float? num3 = func(typeof(Range), "AttackRange"); stringBuilder.Append(" AR=").Append((!num3.HasValue) ? "?" : ((float.IsNaN(num3.Value) || float.IsInfinity(num3.Value)) ? "NaN!" : num3.Value.ToString("F2"))); return stringBuilder.ToString(); } private bool TryFinishUnitAPISetup() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) Team team = m_unit.Team; DataHandler componentInChildren = ((Component)m_unit).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.team = team; } TeamHolder componentInChildren2 = ((Component)m_unit).GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.team = team; componentInChildren2.spawner = ((Component)m_unit).gameObject; } object value; if (_mUnitIsUnitCopy != null && (value = _mUnitIsUnitCopy.GetValue(m_unit)) is bool) { _ = (bool)value; } bool flag = IsUnitRegisteredInTeamSystem(m_unit, team); bool flag2 = IsEntityRegisteredInTeamSystemECS(m_unit); bool flag3 = EntityHasUnitTag(m_unit); string text = CheckTargetFilterComponents(m_unit); bool flag4 = text.IndexOf('0') >= 0 || text.IndexOf('?') >= 0; if (!flag3 || !flag2 || flag4) { if (_mUnitAPIInitializeECSUnit != null) { try { _mUnitAPIInitializeECSUnit.Invoke(m_unitAPI, null); } catch { } } DoManualECSRegistration(m_unit, componentInChildren, team); if (!flag2) { TryFullTeamSystemAddUnit(m_unit, componentInChildren, team); } if (!flag) { ForceRegisterUnitToTeamSystem(m_unit, team); } flag = IsUnitRegisteredInTeamSystem(m_unit, team); flag2 = IsEntityRegisteredInTeamSystemECS(m_unit); flag3 = EntityHasUnitTag(m_unit); text = CheckTargetFilterComponents(m_unit); } else if (!flag) { ForceRegisterUnitToTeamSystem(m_unit, team); flag = IsUnitRegisteredInTeamSystem(m_unit, team); } _ = ((Component)m_unit).transform.position; Hip componentInChildren3 = ((Component)m_unit).GetComponentInChildren(); if ((Object)(object)componentInChildren3 != (Object)null && (Object)(object)((Component)componentInChildren3).transform != (Object)null) { _ = ((Component)componentInChildren3).transform.position; } Rigidbody val = (((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.mainRig != (Object)null) ? componentInChildren.mainRig : ((Component)m_unit).GetComponentInChildren()); if ((Object)(object)val != (Object)null && val.position != Vector3.zero) { _ = val.position; } Team? entityTeamSharedValue = GetEntityTeamSharedValue(m_unit); CheckTargetFilterComponents(m_unit); bool flag5 = entityTeamSharedValue.HasValue && entityTeamSharedValue.Value == team; if (flag && flag2 && flag3) { m_isFinalized = true; } if ((Object)(object)componentInChildren != (Object)null) { Torso componentInChildren4 = ((Component)m_unit).GetComponentInChildren(); if ((Object)(object)componentInChildren4 != (Object)null) { Rigidbody component = ((Component)componentInChildren4).GetComponent(); if ((Object)(object)component != (Object)null) { componentInChildren.mainRig = component; } } else if ((Object)(object)componentInChildren.mainRig == (Object)null) { Rigidbody componentInChildren5 = ((Component)m_unit).GetComponentInChildren(); if ((Object)(object)componentInChildren5 != (Object)null) { componentInChildren.mainRig = componentInChildren5; } } componentInChildren.Dead = false; } UManager.SetUnitDataHandler(m_unit, componentInChildren); GeneralInput componentInChildren6 = ((Component)m_unit).GetComponentInChildren(true); if ((Object)(object)componentInChildren6 != (Object)null) { m_unit.Input = componentInChildren6; } m_unit.WeaponHandler = ((Component)m_unit).GetComponentInChildren(true); Hip componentInChildren7 = ((Component)m_unit).GetComponentInChildren(); Head componentInChildren8 = ((Component)m_unit).GetComponentInChildren(); if ((Object)(object)componentInChildren7 != (Object)null) { m_unit.Hip = ((Component)componentInChildren7).transform; } if ((Object)(object)componentInChildren8 != (Object)null) { m_unit.Head = ((Component)componentInChildren8).transform; } m_unit.holdingHandler = ((Component)m_unit).GetComponentInChildren(true); return flag && flag2 && flag3 && flag5; } private static void EnsureGetSetCDMethods(object em) { if (_openGetCD != null && _openSetCD != null) { return; } MethodInfo[] methods = em.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "GetComponentData" && methodInfo.IsGenericMethodDefinition && methodInfo.GetGenericArguments().Length == 1 && methodInfo.GetParameters().Length == 1 && methodInfo.GetParameters()[0].ParameterType.Name == "Entity") { _openGetCD = methodInfo; } if (methodInfo.Name == "SetComponentData" && methodInfo.IsGenericMethodDefinition && methodInfo.GetGenericArguments().Length == 1 && methodInfo.GetParameters().Length == 2 && methodInfo.GetParameters()[0].ParameterType.Name == "Entity") { _openSetCD = methodInfo; } } } private static void SyncECSPositionsEveryFrame(Unit unit, Vector3 mainRigPos, Vector3 hipPos) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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) if (!TryGetEMAndEntity(unit, out var em, out var entity)) { return; } if (_openHasComponentT == null) { _openHasComponentT = FindEntityMgrGenericMethod("HasComponent", 1, 1); } if (!(_openHasComponentT == null)) { EnsureGetSetCDMethods(em); if (!(_openGetCD == null) && !(_openSetCD == null)) { WriteECSPosition(em, entity, typeof(HipPosition), hipPos); WriteECSPosition(em, entity, typeof(PredictedPosition), hipPos); WriteECSPosition(em, entity, typeof(WeaponPosition), hipPos); WriteECSPosition(em, entity, typeof(GroundPosition), mainRigPos); } } } private static void WriteECSPosition(object em, object entity, Type compType, Vector3 pos) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) try { if (!(bool)_openHasComponentT.MakeGenericMethod(compType).Invoke(em, new object[1] { entity })) { return; } object obj = _openGetCD.MakeGenericMethod(compType).Invoke(em, new object[1] { entity }); FieldInfo field = compType.GetField("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return; } object value = field.GetValue(obj); if (value != null) { Type type = value.GetType(); FieldInfo field2 = type.GetField("x", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field3 = type.GetField("y", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field4 = type.GetField("z", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field2 == null) && !(field3 == null) && !(field4 == null)) { field2.SetValue(value, pos.x); field3.SetValue(value, pos.y); field4.SetValue(value, pos.z); field.SetValue(obj, value); _openSetCD.MakeGenericMethod(compType).Invoke(em, new object[2] { entity, obj }); } } } catch { } } private static void RemoveEcsTagsEveryFrame(Unit unit, bool isFinalized) { if ((Object)(object)unit == (Object)null) { return; } DataHandler componentInChildren = ((Component)unit).GetComponentInChildren(true); bool flag = (Object)(object)componentInChildren != (Object)null && componentInChildren.Dead; if ((isFinalized && !flag) || !TryGetEMAndEntity(unit, out var em, out var entity)) { return; } if (_openHasComponentT == null) { _openHasComponentT = FindEntityMgrGenericMethod("HasComponent", 1, 1); } if (_openHasComponentT == null) { return; } if (_openRemoveComponentT == null) { _openRemoveComponentT = FindEntityMgrGenericMethod("RemoveComponent", 1, 1); } if (_openRemoveComponentT == null) { return; } List list = new List { typeof(IsInPool) }; if (!flag) { list.Add(typeof(IsDead)); } foreach (Type item in list) { try { if ((bool)_openHasComponentT.MakeGenericMethod(item).Invoke(em, new object[1] { entity })) { _openRemoveComponentT.MakeGenericMethod(item).Invoke(em, new object[1] { entity }); } } catch { } } } } } namespace UnityTools { public class TNTBOOM : MonoBehaviour { public GameObject boomGo; public GameObject tntGo; public Vector3 originalScale; private AudioSource audioSrc; private GameStateManager gsManager; private bool triggered; private ParticleSystem boomFx; [Header("Damage")] public float maxDamage; public float explosionRadius; [Range(0f, 1f)] public float minDamageRatio; public bool friendlyFire; public LayerMask hitMask; private IEnumerator ScaleTo(Vector3 target, float duration) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Vector3 start = tntGo.transform.localScale; float t = 0f; while (t < duration) { t += Time.deltaTime; float num = Mathf.Clamp01(t / duration); tntGo.transform.localScale = Vector3.Lerp(start, target, num); yield return null; } tntGo.transform.localScale = target; } private void KillSelf() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) Unit componentInParent = ((Component)this).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent.data == (Object)null) && !componentInParent.data.Dead) { ((Damagable)componentInParent.data.healthHandler).TakeDamage(componentInParent.data.health, Vector3.up, componentInParent, (DamageType)0); } } public TNTBOOM() { //IL_0007: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) originalScale = Vector3.one; maxDamage = 400f; explosionRadius = 7f; minDamageRatio = 0.15f; hitMask = LayerMask.op_Implicit(-1); } private void Start() { FindObjects(); SetupAudio(); gsManager = ServiceLocator.GetService(); if (gsManager != null) { gsManager.GameStateChanged += OnGameStateChanged; } } private void OnDestroy() { if (gsManager != null) { gsManager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1 && !triggered) { triggered = true; ((MonoBehaviour)this).StartCoroutine(TNTSequence()); } } private void FindObjects() { //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) Transform val = ((Component)this).transform.Find("boom"); if ((Object)(object)val != (Object)null) { boomGo = ((Component)val).gameObject; boomFx = ((Component)val).GetComponent(); audioSrc = ((Component)val).GetComponent(); if ((Object)(object)boomFx != (Object)null) { boomFx.Stop(true, (ParticleSystemStopBehavior)0); } ((Component)val).gameObject.SetActive(false); } Transform val2 = ((Component)this).transform.Find("Rigidbodies/TNT"); if ((Object)(object)val2 != (Object)null) { tntGo = ((Component)val2).gameObject; originalScale = tntGo.transform.localScale; } } private void SetupAudio() { if ((Object)(object)audioSrc == (Object)null) { return; } audioSrc.playOnAwake = false; audioSrc.loop = false; audioSrc.spatialBlend = 1f; audioSrc.rolloffMode = (AudioRolloffMode)1; audioSrc.minDistance = 1f; audioSrc.maxDistance = 30f; try { SoundPlayer service = ServiceLocator.GetService(); if (!((Object)(object)service != (Object)null)) { return; } GameObject fieldValue = GetFieldValue(service, "defaultSource"); if ((Object)(object)fieldValue != (Object)null) { AudioSource component = fieldValue.GetComponent(); if ((Object)(object)component != (Object)null) { audioSrc.outputAudioMixerGroup = component.outputAudioMixerGroup; } } } catch { } } private IEnumerator TNTSequence() { if (!((Object)(object)tntGo == (Object)null)) { Vector3 baseScale = originalScale; Vector3 bumpScale = baseScale * 1.05f; Vector3 finalScale = baseScale * 1.25f; for (int i = 0; i < 3; i++) { yield return ScaleTo(bumpScale, 0.15f); yield return ScaleTo(baseScale, 0.15f); } yield return ScaleTo(finalScale, 0.4f); Vector3 center = (((Object)(object)tntGo != (Object)null) ? tntGo.transform.position : ((Component)this).transform.position); ApplyDamage(center); if ((Object)(object)tntGo != (Object)null) { tntGo.SetActive(false); } if ((Object)(object)boomGo != (Object)null) { boomGo.SetActive(true); } if ((Object)(object)boomFx != (Object)null) { boomFx.Stop(true, (ParticleSystemStopBehavior)0); boomFx.Play(true); } if ((Object)(object)audioSrc != (Object)null) { audioSrc.Play(); } KillSelf(); } } private T GetFieldValue(object obj, string name) { if (obj == null) { return default(T); } FieldInfo field = obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return default(T); } object value = field.GetValue(obj); if (value is T) { return (T)value; } return default(T); } private void ApplyDamage(Vector3 center) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(center, explosionRadius, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1); HashSet hashSet = new HashSet(); Unit componentInParent = ((Component)this).GetComponentInParent(); Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)val == (Object)null) { continue; } Unit componentInParent2 = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent2 == (Object)null || hashSet.Contains(componentInParent2)) { continue; } hashSet.Add(componentInParent2); if (!((Object)(object)componentInParent2.data == (Object)null) && !componentInParent2.data.Dead && (!((Object)(object)componentInParent != (Object)null) || (!((Object)(object)componentInParent2 == (Object)(object)componentInParent) && (friendlyFire || componentInParent2.Team != componentInParent.Team)))) { Vector3 position = componentInParent2.data.mainRig.position; float num = Mathf.Clamp01(Vector3.Distance(center, position) / Mathf.Max(0.001f, explosionRadius)); float num2 = Mathf.Lerp(1f, minDamageRatio, num); float num3 = Mathf.Max(0f, maxDamage * num2); Vector3 val2 = position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; try { ((Damagable)componentInParent2.data.healthHandler).TakeDamage(num3, normalized, componentInParent, (DamageType)0); } catch { } } } } } [DefaultExecutionOrder(-900)] public class SlimeMoveAI : MonoBehaviour { private Unit m_unit; private GameStateManager m_gameStateManager; private bool m_battleStarted; private Transform m_targetTransform; [Header("Bounce")] public float bounceInterval; public float jumpDuration; public float jumpHeight; public float bounceReach; public float stopDistance; public float scanInterval; private Unit m_target; private int m_state; private float m_scanTimer; private float m_cooldownTimer; private float m_jumpTimer; private Vector3 m_jumpStartPos; private Vector3 m_jumpTargetPos; [Header("Squash")] public float jumpSquashPhase; public float jumpStretchY; public float jumpStretchXZ; public float landSquashPhase; public float landSquashY; public float landSquashXZ; public float scaleRecoverSpeed; private Vector3 m_originalScale; private bool m_scaleRecovered; public float rotationSpeed; [Header("Land Damage")] public float landDamage; public float landDamageRadius; private Transform m_forwardObj; private void Awake() { m_unit = ((Component)this).GetComponentInParent(); GameObject val = (((Object)(object)m_unit != (Object)null) ? ((Component)m_unit).gameObject : ((Component)this).gameObject); m_targetTransform = val.transform; } private void Start() { //IL_0007: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 m_originalScale = m_targetTransform.localScale; if ((Object)(object)m_unit != (Object)null && (Object)(object)m_unit.data != (Object)null && (Object)(object)m_unit.data.characterForwardObject != (Object)null) { m_forwardObj = m_unit.data.characterForwardObject; } m_gameStateManager = ServiceLocator.GetService(); if (m_gameStateManager != null) { if ((int)m_gameStateManager.GameState == 1) { m_battleStarted = true; } m_gameStateManager.GameStateChanged += OnGameStateChanged; } } private void OnDestroy() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (m_gameStateManager != null) { m_gameStateManager.GameStateChanged -= OnGameStateChanged; } if ((Object)(object)m_targetTransform != (Object)null) { m_targetTransform.localScale = m_originalScale; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { m_battleStarted = true; } } public SlimeMoveAI() { bounceInterval = 1.2f; jumpDuration = 0.7f; jumpHeight = 2.5f; bounceReach = 2.5f; stopDistance = 1f; scanInterval = 1f; rotationSpeed = 6f; jumpSquashPhase = 0.15f; jumpStretchY = 0.3f; jumpStretchXZ = 0.2f; landSquashPhase = 0.15f; landSquashY = 0.4f; landSquashXZ = 0.3f; scaleRecoverSpeed = 8f; landDamage = 25f; landDamageRadius = 1.5f; } private void Update() { //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) if (!m_battleStarted || (Object)(object)m_unit == (Object)null || (Object)(object)m_targetTransform == (Object)null) { return; } m_scanTimer += Time.deltaTime; if (m_scanTimer >= scanInterval) { m_scanTimer = 0f; m_target = FindNearestEnemy(); } if (m_state == 0 && (Object)(object)m_target != (Object)null && (Object)(object)m_target.data != (Object)null && (Object)(object)m_target.data.mainRig != (Object)null) { SmoothRotateToTarget(); } if (m_state == 0) { if (!m_scaleRecovered) { m_targetTransform.localScale = Vector3.Lerp(m_targetTransform.localScale, m_originalScale, scaleRecoverSpeed * Time.deltaTime); if (Vector3.SqrMagnitude(m_targetTransform.localScale - m_originalScale) < 0.0004f) { m_targetTransform.localScale = m_originalScale; m_scaleRecovered = true; } } m_cooldownTimer += Time.deltaTime; if (m_cooldownTimer >= bounceInterval) { StartBounce(); } } else if (m_state == 1) { m_jumpTimer += Time.deltaTime; float num = Mathf.Clamp01(m_jumpTimer / jumpDuration); Vector3 position = default(Vector3); position.x = Mathf.Lerp(m_jumpStartPos.x, m_jumpTargetPos.x, num); position.z = Mathf.Lerp(m_jumpStartPos.z, m_jumpTargetPos.z, num); position.y = m_jumpStartPos.y + jumpHeight * Mathf.Sin(num * (float)Math.PI); m_targetTransform.position = position; SmoothRotateToTarget(); Vector3 originalScale = m_originalScale; if (num < jumpSquashPhase) { float num2 = Mathf.Sin(num / jumpSquashPhase * (float)Math.PI); originalScale.x = m_originalScale.x * (1f - jumpStretchXZ * num2); originalScale.z = m_originalScale.z * (1f - jumpStretchXZ * num2); originalScale.y = m_originalScale.y * (1f + jumpStretchY * num2); } else if (num > 1f - landSquashPhase) { float num3 = Mathf.Sin((num - (1f - landSquashPhase)) / landSquashPhase * (float)Math.PI); originalScale.x = m_originalScale.x * (1f + landSquashXZ * num3); originalScale.z = m_originalScale.z * (1f + landSquashXZ * num3); originalScale.y = m_originalScale.y * (1f - landSquashY * num3); } m_targetTransform.localScale = originalScale; if (num >= 1f) { m_targetTransform.position = m_jumpTargetPos; ApplyLandDamage(); m_state = 0; m_cooldownTimer = 0f; m_scaleRecovered = false; } } } private void StartBounce() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_014c: 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_0067: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (m_jumpStartPos = m_targetTransform.position); Vector3 jumpTargetPos = val; if ((Object)(object)m_target != (Object)null && (Object)(object)m_target.data != (Object)null && (Object)(object)m_target.data.mainRig != (Object)null) { Vector3 val2 = m_target.data.mainRig.position - val; val2.y = 0f; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > stopDistance && ((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { val2 /= magnitude; float num = Mathf.Min(magnitude * 0.5f, bounceReach); jumpTargetPos = val + val2 * num; } else { Vector3 forward = m_targetTransform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f) { ((Vector3)(ref forward)).Normalize(); jumpTargetPos = val + forward * 0.4f; } } } else { Vector3 forward2 = m_targetTransform.forward; forward2.y = 0f; if (((Vector3)(ref forward2)).sqrMagnitude > 0.0001f) { ((Vector3)(ref forward2)).Normalize(); jumpTargetPos = val + forward2 * 0.4f; } } jumpTargetPos.y = val.y; m_jumpTargetPos = jumpTargetPos; m_jumpTimer = 0f; m_state = 1; } private Unit FindNearestEnemy() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType(); Unit result = null; float num = float.MaxValue; Vector3 position = m_targetTransform.position; foreach (Unit val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)m_unit) && !((Object)(object)val.data == (Object)null) && !val.data.Dead && !((Object)(object)val.data.mainRig == (Object)null) && (!((Object)(object)m_unit != (Object)null) || val.Team != m_unit.Team)) { Vector3 val2 = position - val.data.mainRig.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } private void ApplyLandDamage() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) Vector3 position = m_targetTransform.position; Unit val = FindNearestEnemyAt(position, landDamageRadius); if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || val.data.Dead || (Object)(object)val.data.mainRig == (Object)null) { return; } Vector3 val2 = val.data.mainRig.position - position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { ((Vector3)(ref val2)).Normalize(); } else { val2 = m_targetTransform.forward; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { ((Vector3)(ref val2)).Normalize(); } else { val2 = Vector3.forward; } } try { ((Damagable)val.data.healthHandler).TakeDamage(landDamage, val2, m_unit, (DamageType)0); } catch { } } private Unit FindNearestEnemyAt(Vector3 center, float radius) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType(); Unit result = null; float num = float.MaxValue; float num2 = radius * radius; foreach (Unit val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)m_unit) && !((Object)(object)val.data == (Object)null) && !val.data.Dead && !((Object)(object)val.data.mainRig == (Object)null) && (!((Object)(object)m_unit != (Object)null) || val.Team != m_unit.Team)) { Vector3 val2 = center - val.data.mainRig.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude <= num2 && sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } private void SmoothRotateToTarget() { //IL_004a: 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_005a: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_target == (Object)null || (Object)(object)m_target.data == (Object)null || (Object)(object)m_target.data.mainRig == (Object)null) { return; } Vector3 val = m_target.data.mainRig.position - m_targetTransform.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude <= 0.0001f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); float y = ((Quaternion)(ref val2)).eulerAngles.y; if ((Object)(object)m_forwardObj != (Object)null) { float num = Mathf.LerpAngle(m_forwardObj.eulerAngles.y, y, rotationSpeed * Time.deltaTime); m_forwardObj.rotation = Quaternion.Euler(0f, num, 0f); } else { float num2 = Mathf.LerpAngle(m_targetTransform.eulerAngles.y, y, rotationSpeed * Time.deltaTime); m_targetTransform.rotation = Quaternion.Euler(0f, num2, 0f); } } } } } namespace Nothing { [DefaultExecutionOrder(-200)] public class CesyriBasicChaser : MonoBehaviour { public float maxMoveSpeed = 4f; public float acceleration = 14f; public float turnLerp = 6f; public float idleDecay = 3f; public float scanInterval = 0.5f; public bool useDownforce = true; public float downForce = 12f; public float stickThreshold = 0.5f; private Unit m_unit; private DataHandler m_data; private Rigidbody m_mainRb; private Unit m_target; private Vector3 m_desiredDir; private float m_scanTimer; private bool m_battleStarted; private GameStateManager m_gs; private void Awake() { m_unit = ((Component)this).GetComponentInParent(); m_data = ((Component)this).GetComponentInParent(); m_gs = ServiceLocator.GetService(); if (m_gs != null) { m_gs.GameStateChanged += OnGameStateChanged; } } private void OnDestroy() { if (m_gs != null) { m_gs.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { m_battleStarted = true; } } private void Start() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 if (m_gs != null && (int)m_gs.GameState == 1) { m_battleStarted = true; } if ((Object)(object)m_data != (Object)null && (Object)(object)m_data.mainRig != (Object)null) { m_mainRb = m_data.mainRig; } } private void LateUpdate() { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if (!m_battleStarted || (Object)(object)m_unit == (Object)null || (Object)(object)m_data == (Object)null || m_data.Dead) { return; } m_scanTimer += Time.deltaTime; if (m_scanTimer >= scanInterval) { m_scanTimer = 0f; m_target = FindNearestEnemy(); } if ((Object)(object)m_mainRb == (Object)null && (Object)(object)m_data != (Object)null) { m_mainRb = m_data.mainRig; } if ((Object)(object)m_mainRb == (Object)null) { return; } if ((Object)(object)m_target != (Object)null && (Object)(object)m_target.data != (Object)null && (Object)(object)m_target.data.mainRig != (Object)null && !m_target.data.Dead) { Vector3 position = m_mainRb.position; Vector3 val = m_target.data.mainRig.position - position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { ((Vector3)(ref val)).Normalize(); m_desiredDir = Vector3.Lerp(m_desiredDir, val, turnLerp * Time.deltaTime); if (((Vector3)(ref m_desiredDir)).sqrMagnitude > 0.0001f) { ((Vector3)(ref m_desiredDir)).Normalize(); } } } else { m_desiredDir = Vector3.Lerp(m_desiredDir, Vector3.zero, idleDecay * Time.deltaTime); } } private void FixedUpdate() { //IL_0047: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (m_battleStarted && !((Object)(object)m_mainRb == (Object)null) && !((Object)(object)m_data == (Object)null) && !m_data.Dead && !(((Vector3)(ref m_desiredDir)).sqrMagnitude <= 0.0001f)) { Vector3 val = m_desiredDir * maxMoveSpeed; Vector3 velocity = m_mainRb.velocity; Vector3 val2 = val - new Vector3(velocity.x, 0f, velocity.z); float num = acceleration * Time.fixedDeltaTime; if (((Vector3)(ref val2)).sqrMagnitude > num * num) { val2 = ((Vector3)(ref val2)).normalized * num; } m_mainRb.AddForce(val2, (ForceMode)2); if (useDownforce && Mathf.Abs(velocity.y) < stickThreshold) { m_mainRb.AddForce(Vector3.down * downForce, (ForceMode)5); } } } private Unit FindNearestEnemy() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType(); Unit result = null; float num = float.MaxValue; Vector3 val = (((Object)(object)m_mainRb != (Object)null) ? m_mainRb.position : ((Component)this).transform.position); foreach (Unit val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)m_unit) && !((Object)(object)val2.data == (Object)null) && !val2.data.Dead && !((Object)(object)val2.data.mainRig == (Object)null) && (!((Object)(object)m_unit != (Object)null) || val2.Team != m_unit.Team)) { float num2 = Vector3.SqrMagnitude(val - val2.data.mainRig.position); if (num2 < num) { num = num2; result = val2; } } } return result; } } public class CesyriUnitRootFollower : MonoBehaviour { private struct MarkerRec { public Transform Target; public Vector3 LocalPos; public Quaternion LocalRot; public Rigidbody Rb; } private Unit m_unit; private DataHandler m_data; private Transform m_root; private Rigidbody m_rootRb; private Vector3 m_rootLocalOffsetPos; private Quaternion m_rootLocalOffsetRot; private bool m_syncRoot; private bool m_initialized; private bool m_battleStarted; private GameStateManager m_gs; private readonly List m_markers = new List(16); private void Awake() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown GameObject gameObject = ((Component)this).gameObject; Transform val = gameObject.transform.Find("Rigidbodies"); bool flag = false; if ((Object)(object)val != (Object)null) { Transform val2 = val.Find("slime"); if ((Object)(object)val2 == (Object)null) { val2 = val.Find("Slime"); } if ((Object)(object)val2 == (Object)null) { foreach (Transform item in val) { Transform val3 = item; if (!((Object)(object)val3 == (Object)null) && ((Object)val3).name.IndexOf("slime", StringComparison.OrdinalIgnoreCase) >= 0) { val2 = val3; break; } } } if ((Object)(object)val2 != (Object)null) { flag = true; } } if (!flag && (Object)(object)gameObject.GetComponentInChildren(true) != (Object)null) { flag = true; } if (flag) { Object.Destroy((Object)(object)this); return; } m_unit = ((Component)this).GetComponentInParent(); m_data = ((Component)this).GetComponentInParent(); m_root = (((Object)(object)m_unit != (Object)null) ? ((Component)m_unit).transform : ((Component)this).transform.root); m_gs = ServiceLocator.GetService(); if (m_gs != null) { m_gs.GameStateChanged += OnGameStateChanged; } } private void Start() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 InitializeOffsets(); if (m_gs != null && (int)m_gs.GameState == 1) { m_battleStarted = true; } } private void OnDestroy() { if (m_gs != null) { m_gs.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { m_battleStarted = true; } } private void LateUpdate() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_008b: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //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_00f2: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (!m_battleStarted || (Object)(object)m_data == (Object)null || (Object)(object)m_data.mainRig == (Object)null || (Object)(object)m_root == (Object)null) { return; } if (!m_initialized) { InitializeOffsets(); } Transform transform = ((Component)m_data.mainRig).transform; Vector3 position = transform.position; Quaternion rotation = transform.rotation; if (m_syncRoot) { Vector3 val = position + rotation * m_rootLocalOffsetPos; Quaternion val2 = rotation * m_rootLocalOffsetRot; if ((Object)(object)m_rootRb != (Object)null) { m_rootRb.MovePosition(val); m_rootRb.MoveRotation(val2); } else { m_root.SetPositionAndRotation(val, val2); } } for (int i = 0; i < m_markers.Count; i++) { MarkerRec markerRec = m_markers[i]; if (!((Object)(object)markerRec.Target == (Object)null)) { Vector3 val3 = position + rotation * markerRec.LocalPos; Quaternion val4 = rotation * markerRec.LocalRot; Rigidbody rb = markerRec.Rb; if ((Object)(object)rb != (Object)null) { rb.MovePosition(val3); rb.MoveRotation(val4); } else { markerRec.Target.SetPositionAndRotation(val3, val4); } } } } private void InitializeOffsets() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if (!((Object)(object)m_data == (Object)null) && !((Object)(object)m_data.mainRig == (Object)null) && !((Object)(object)m_root == (Object)null)) { Transform transform = ((Component)m_data.mainRig).transform; Quaternion val = Quaternion.Inverse(transform.rotation); m_rootLocalOffsetPos = val * (m_root.position - transform.position); m_rootLocalOffsetRot = val * m_root.rotation; m_rootRb = ((Component)m_root).GetComponent(); m_syncRoot = m_root != transform; m_markers.Clear(); HashSet hashSet = new HashSet(); hashSet.Add(transform); if (m_syncRoot) { hashSet.Add(m_root); } TryAddMarker(typeof(Torso), transform, hashSet); TryAddMarker(typeof(Hip), transform, hashSet); TryAddMarker(typeof(Head), transform, hashSet); TryAddMarker(typeof(KneeLeft), transform, hashSet); TryAddMarker(typeof(KneeRight), transform, hashSet); TryAddMarker(typeof(HandLeft), transform, hashSet); TryAddMarker(typeof(HandRight), transform, hashSet); TryAddMarker(typeof(ArmLeft), transform, hashSet); TryAddMarker(typeof(ArmRight), transform, hashSet); DirectionObject componentInChildren = ((Component)m_root).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null && !hashSet.Contains(((Component)componentInChildren).transform)) { AddMarker(((Component)componentInChildren).transform, transform); } GroundedDirectionObject componentInChildren2 = ((Component)m_root).GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null && !hashSet.Contains(((Component)componentInChildren2).transform)) { AddMarker(((Component)componentInChildren2).transform, transform); } m_initialized = m_markers.Count >= 0; } } private void TryAddMarker(Type t, Transform mainTx, HashSet skip) { Component val = (((Object)(object)m_root != (Object)null) ? ((Component)m_root).GetComponentInChildren(t, true) : null); if (!((Object)(object)val == (Object)null) && !skip.Contains(val.transform)) { AddMarker(val.transform, mainTx); } } private void AddMarker(Transform target, Transform mainTx) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) Quaternion val = Quaternion.Inverse(mainTx.rotation); MarkerRec item = new MarkerRec { Target = target, LocalPos = val * (target.position - mainTx.position), LocalRot = val * target.rotation, Rb = ((Component)target).GetComponent() }; m_markers.Add(item); } } } namespace UnityTools { public class RigidbodyDelayedEnable : MonoBehaviour { private struct RigidbodyState { public Rigidbody body; public bool wasKinematic; } [Tooltip("禁用持续时间(秒),到达后恢复 Rigidbody 原状态")] public float delay = 0.2f; [Tooltip("是否一并禁用子物体身上的 Rigidbody")] public bool includeChildren = true; private void Awake() { Rigidbody[] array = CollectRigidbodies(); if (array.Length == 0) { Object.Destroy((Object)(object)this); return; } RigidbodyState[] array2 = new RigidbodyState[array.Length]; for (int i = 0; i < array.Length; i++) { Rigidbody val = array[i]; array2[i] = new RigidbodyState { body = val, wasKinematic = val.isKinematic }; val.isKinematic = true; } ((MonoBehaviour)this).StartCoroutine(RestoreAfterDelay(array2)); } private Rigidbody[] CollectRigidbodies() { if (includeChildren) { return ((Component)this).GetComponentsInChildren(true); } Rigidbody component = ((Component)this).GetComponent(); if (!((Object)(object)component != (Object)null)) { return (Rigidbody[])(object)new Rigidbody[0]; } return (Rigidbody[])(object)new Rigidbody[1] { component }; } private IEnumerator RestoreAfterDelay(RigidbodyState[] states) { yield return (object)new WaitForSeconds(delay); for (int i = 0; i < states.Length; i++) { Rigidbody body = states[i].body; if (!((Object)(object)body == (Object)null)) { body.isKinematic = states[i].wasKinematic; } } Object.Destroy((Object)(object)this); } } public class SlimeDIED : MonoBehaviour { public Vector3 偏移1 = new Vector3(1f, 0f, 0f); public Vector3 偏移2 = new Vector3(-1f, 0f, 0f); public bool 自毁原兵种 = true; private Unit m_unit; private DataHandler m_data; private Transform m_targetTransform; private GameStateManager m_gs; private bool m_battleStarted; private bool m_triggered; public string 新兵种名字 = ""; public Vector3 偏移3 = new Vector3(0f, 0f, 1f); public Vector3 偏移4 = new Vector3(0f, 0f, -1f); [Header("Splitter")] public GameObject 新兵种; private void Awake() { m_unit = ((Component)this).GetComponentInParent(); if ((Object)(object)m_unit != (Object)null) { m_data = ((Component)m_unit).GetComponentInChildren(true); m_targetTransform = ((Component)m_unit).transform; } m_gs = ServiceLocator.GetService(); if (m_gs != null) { m_gs.GameStateChanged += OnGameStateChanged; } } private void Start() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 if (m_gs != null && (int)m_gs.GameState == 1) { m_battleStarted = true; } } private void OnDestroy() { if (m_gs != null) { m_gs.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { m_battleStarted = true; } } private void Update() { if (!m_triggered && m_battleStarted && !((Object)(object)m_unit == (Object)null) && !((Object)(object)m_data == (Object)null) && m_data.Dead) { m_triggered = true; SpawnSplit(); } } private void SpawnSplit() { //IL_0021: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_010f: 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_012c: 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) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)m_targetTransform != (Object)null) ? m_targetTransform.position : ((Component)this).transform.position); Quaternion val2 = (((Object)(object)m_targetTransform != (Object)null) ? m_targetTransform.rotation : ((Component)this).transform.rotation); Team val3 = (Team)((!((Object)(object)m_unit != (Object)null)) ? 1 : ((int)m_unit.Team)); Vector3 val4 = val; UnitBlueprint value = null; if (!string.IsNullOrEmpty(新兵种名字) && UManager.已创建兵种 != null) { UManager.已创建兵种.TryGetValue(新兵种名字, out value); } if ((Object)(object)value == (Object)null && !string.IsNullOrEmpty(新兵种名字)) { try { value = ContentDatabase.Instance().GetUserUnitBlueprintByExactName(新兵种名字); } catch { } } if ((Object)(object)value != (Object)null) { Unit val5 = default(Unit); value.Spawn(val4 + val2 * 偏移1, val2, val3, ref val5, 1f, false, true, 0, (UnitPoolInfo?)null); Unit val6 = default(Unit); value.Spawn(val4 + val2 * 偏移2, val2, val3, ref val6, 1f, false, true, 0, (UnitPoolInfo?)null); Unit val7 = default(Unit); value.Spawn(val4 + val2 * 偏移3, val2, val3, ref val7, 1f, false, true, 0, (UnitPoolInfo?)null); Unit val8 = default(Unit); value.Spawn(val4 + val2 * 偏移4, val2, val3, ref val8, 1f, false, true, 0, (UnitPoolInfo?)null); } else { GameObject val9 = 新兵种; if ((Object)(object)val9 == (Object)null && !string.IsNullOrEmpty(新兵种名字)) { val9 = UPool.MyPool.GetObject(新兵种名字); } if ((Object)(object)val9 == (Object)null) { Debug.LogError((object)("[SlimeDIED] 未找到预制体:" + 新兵种名字)); } else { SpawnFromPrefab(val9, val4 + val2 * 偏移1, val2, val3); SpawnFromPrefab(val9, val4 + val2 * 偏移2, val2, val3); SpawnFromPrefab(val9, val4 + val2 * 偏移3, val2, val3); SpawnFromPrefab(val9, val4 + val2 * 偏移4, val2, val3); } } if (自毁原兵种 && (Object)(object)m_unit != (Object)null && (Object)(object)((Component)m_unit).gameObject != (Object)null) { ((MonoBehaviour)this).StartCoroutine(DestroyNextFrame(((Component)m_unit).gameObject)); } } private void SpawnFromPrefab(GameObject prefab, Vector3 spawnPos, Quaternion rot, Team team) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(prefab, spawnPos, rot); val.SetActive(false); val.transform.SetParent((Transform)null); val.transform.localScale = prefab.transform.localScale; val.SetActive(true); Unit val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.GetComponentInChildren(true); } if ((Object)(object)val2 != (Object)null) { val2.InitializeUnit(team); val2.Team = team; UnitAPI component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = true; } } } private IEnumerator DestroyNextFrame(GameObject target) { yield return null; yield return null; if ((Object)(object)target != (Object)null) { Object.Destroy((Object)(object)target); } } } } namespace Nothing { public static class RangedWeaponExt { private static GameObject _原版远程模板; private static GameObject 原版远程模板 { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown if ((Object)(object)_原版远程模板 == (Object)null) { try { _原版远程模板 = (GameObject)SLMALoader.SDic["weapons"]["Longbow"]; } catch { } if ((Object)(object)_原版远程模板 == (Object)null) { try { _原版远程模板 = (GameObject)SLMALoader.SDic["weapons"]["Bow"]; } catch { } } } return _原版远程模板; } } public static void 射击武器(this GameObject weapon, GameObject projectile = null, float damage = 55f, float force = 800f, float cooldown = 1.2f, int magSize = 1, float spread = 3f, float fallTime = 0f, float projectileGravity = 15f, float spawnDelay = 0f, int numberOfObjects = 1, float clampRange = 50f, string soundRef = "", bool ignoreTeamMates = false, int allowedHits = 3, string 模板名 = "Longbow") { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0150: 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_0173: 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_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0376: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: 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_066c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)weapon == (Object)null) { return; } Rigidbody component = weapon.GetComponent(); Holdable component2 = weapon.GetComponent(); RangeWeapon val = weapon.GetComponent(); if ((Object)(object)val == (Object)null) { val = weapon.AddComponent(); } if ((Object)(object)projectile == (Object)null) { Debug.LogWarning((object)"[RangedWeaponExt] 没有投射物对象,远程武器无法工作"); return; } GameObject val2 = null; try { val2 = (GameObject)SLMALoader.SDic["weapons"][模板名]; } catch { } if ((Object)(object)val2 == (Object)null && 模板名 != "Longbow") { try { val2 = (GameObject)SLMALoader.SDic["weapons"]["Longbow"]; } catch { } } if ((Object)(object)val2 != (Object)null) { RangeWeapon component3 = val2.GetComponent(); if ((Object)(object)component3 != (Object)null && (Object)(object)val != (Object)null) { val.spawnDelay = component3.spawnDelay; val.magSize = component3.magSize; val.reloadTime = component3.reloadTime; val.spread = component3.spread; val.projectileSpeedSpread = component3.projectileSpeedSpread; val.shootRecoil = component3.shootRecoil; val.torsoRecoil = component3.torsoRecoil; val.clampRange = component3.clampRange; val.soundDelay = component3.soundDelay; } if ((Object)(object)weapon.GetComponentInChildren() == (Object)null) { Transform transform = new GameObject("ShootPosition").transform; transform.SetParent(weapon.transform, false); transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; transform.localScale = Vector3.one; ((Component)transform).gameObject.AddComponent(); } Holdable component4 = val2.GetComponent(); if ((Object)(object)component4 != (Object)null && (Object)(object)component2 != (Object)null) { if (component4.jointData != null && component2.jointData != null) { component2.jointData.angularDrive = component4.jointData.angularDrive; component2.jointData.limit = component4.jointData.limit; } if (component4.pidData != null && component2.pidData != null) { component2.pidData.disableForceDuringSwing = component4.pidData.disableForceDuringSwing; component2.pidData.proportionalForce = component4.pidData.proportionalForce; component2.pidData.proportionalTorque = component4.pidData.proportionalTorque; component2.pidData.holdingForceMultiplier = component4.pidData.holdingForceMultiplier; component2.pidData.holdingTorqueMultiplier = component4.pidData.holdingTorqueMultiplier; component2.pidData.capAngle = component4.pidData.capAngle; } component2.ignoreDissarm = component4.ignoreDissarm; if (component4.holdableData != null && component2.holdableData != null) { component2.holdableData.relativePosition = component4.holdableData.relativePosition; component2.holdableData.forwardRotation = component4.holdableData.forwardRotation; component2.holdableData.upRotation = component4.holdableData.upRotation; } } Rigidbody component5 = val2.GetComponent(); if ((Object)(object)component5 != (Object)null && (Object)(object)component != (Object)null) { component.mass = component5.mass; component.drag = component5.drag; component.angularDrag = component5.angularDrag; component.useGravity = component5.useGravity; component.isKinematic = component5.isKinematic; component.maxAngularVelocity = component5.maxAngularVelocity; component.collisionDetectionMode = component5.collisionDetectionMode; component.constraints = component5.constraints; } } else { if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = false; component.drag = 1f; component.angularDrag = 1f; component.mass = 1f; component.maxAngularVelocity = 250f; } if ((Object)(object)component2 != (Object)null && component2.jointData != null) { component2.jointData.angularDrive = 1f; component2.jointData.limit = 90f; } if ((Object)(object)weapon.GetComponentInChildren() == (Object)null) { Transform transform2 = new GameObject("ShootPosition").transform; transform2.SetParent(weapon.transform, false); transform2.localPosition = Vector3.zero; transform2.localRotation = Quaternion.identity; transform2.localScale = Vector3.one; ((Component)transform2).gameObject.AddComponent(); } } if ((Object)(object)val != (Object)null) { val.ObjectToSpawn = projectile; val.magSize = magSize; val.numberOfObjects = numberOfObjects; val.spawnDelay = spawnDelay; val.spread = spread; val.force = force; val.fallTime = fallTime; val.clampRange = clampRange; ((Weapon)val).maxRange = clampRange; ((Weapon)val).m_weaponType = (WeaponType)1; val.useRandomDelay = false; val.useSpawnDelayForEveryShot = false; val.reTargetPerShot = false; val.delayPerSpawn = 0f; val.extraSpreadInMelee = 0f; val.extraCDInMelee = 0f; val.maxProjectilesPerFrane = 10; val.rememberUnitThatSpawnedObject = false; val.willCopy = false; val.parentToMe = false; ((Weapon)val).internalCooldown = cooldown; val.spawnPosition = (SpawnPosition)0; val.spawnRotation = (SpawnRotation)0; val.positionOffset = Vector3.zero; val.randomPosition = 0f; val.randomX = 0f; val.randomY = 0f; val.randomZ = 0f; } ProjectileHit val3 = projectile.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = projectile.AddComponent(); } if ((Object)(object)val3 != (Object)null) { val3.damage = damage; val3.force = force; val3.ignoreTeamMates = ignoreTeamMates; val3.allowedHits = allowedHits; val3.lowMassCap = 10f; val3.shakeAmount = 1f; val3.hitStop = 0f; val3.setSpeedOnHit = 0f; val3.alwaysHitTeamMates = false; val3.stopAditionalHitsOnArmor = true; val3.allowRepeat = false; } if ((Object)(object)projectile.GetComponent() == (Object)null) { projectile.AddComponent(); } Rigidbody val4 = projectile.GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = projectile.AddComponent(); } if ((Object)(object)val4 != (Object)null) { val4.useGravity = false; val4.isKinematic = false; val4.interpolation = (RigidbodyInterpolation)0; val4.collisionDetectionMode = (CollisionDetectionMode)2; val4.mass = 1f; val4.drag = 0f; val4.constraints = (RigidbodyConstraints)112; } Collider val5 = projectile.GetComponent(); if ((Object)(object)val5 == (Object)null) { val5 = (Collider)(object)projectile.AddComponent(); ((SphereCollider)val5).radius = 0.1f; } if ((Object)(object)val5 != (Object)null) { val5.isTrigger = false; val5.enabled = true; } MoveTransform val6 = projectile.GetComponent(); if ((Object)(object)val6 == (Object)null) { val6 = projectile.AddComponent(); } if ((Object)(object)val6 != (Object)null) { val6.gravity = projectileGravity; val6.drag = 0f; val6.rotationFollowVelocity = true; val6.lateVelocityInit = false; } if ((Object)(object)projectile.GetComponent() == (Object)null) { projectile.AddComponent(); } if ((Object)(object)projectile.GetComponent() == (Object)null) { projectile.AddComponent(); } } public static void 远程武器_简易配置(this GameObject weapon, GameObject projectile, float damage = 50f, float projectileGravity = 15f, string 模板名 = "Longbow") { if (!((Object)(object)weapon == (Object)null) && !((Object)(object)projectile == (Object)null)) { weapon.射击武器(projectile, damage, 800f, 1f, 1, 3f, 0f, projectileGravity, 0f, 1, 50f, "", ignoreTeamMates: false, 3, 模板名); } } } public static class ProjectileExt { public static GameObject 抛射物设置(this GameObject projectile, float damage = 55f, float force = 200f, float gravity = 15f, float drag = 0f, float setSpeedOnHit = 0f, bool ignoreTeamMates = false, int allowedHits = 5, bool stickOnHit = true, bool destroyOnHit = false, string soundRef = "") { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)projectile == (Object)null) { return null; } if ((Object)(object)projectile.GetComponent() == (Object)null) { projectile.AddComponent(); } if ((Object)(object)projectile.GetComponent() == (Object)null) { projectile.AddComponent(); } Rigidbody val = projectile.GetComponent(); if ((Object)(object)val == (Object)null) { val = projectile.AddComponent(); } if ((Object)(object)val != (Object)null) { val.useGravity = false; val.isKinematic = false; val.interpolation = (RigidbodyInterpolation)0; val.collisionDetectionMode = (CollisionDetectionMode)2; val.mass = 1f; val.drag = 0f; val.constraints = (RigidbodyConstraints)112; } Collider val2 = projectile.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = (Collider)(object)projectile.AddComponent(); ((SphereCollider)val2).radius = 0.1f; } if ((Object)(object)val2 != (Object)null) { val2.isTrigger = false; val2.enabled = true; } ProjectileHit val3 = projectile.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = projectile.AddComponent(); } if ((Object)(object)val3 != (Object)null) { val3.damage = damage; val3.force = force; val3.setSpeedOnHit = setSpeedOnHit; val3.SoundRef = soundRef; val3.ignoreTeamMates = ignoreTeamMates; val3.allowedHits = allowedHits; val3.destroyOnHit = destroyOnHit; val3.lowMassCap = 10f; val3.shakeAmount = 1f; val3.hitStop = 0f; val3.blockPoweredNeeded = 0f; val3.alwaysHitTeamMates = false; val3.stopAditionalHitsOnArmor = true; val3.allowRepeat = false; val3.moveToHitPoint = true; val3.callEffectsBeforeDamage = false; val3.callEffectsOnArmor = true; val3.canHitOrgUnit = true; val3.stopOnMapHit = false; val3.deltaTime = false; } MoveTransform val4 = projectile.GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = projectile.AddComponent(); } if ((Object)(object)val4 != (Object)null) { val4.gravity = gravity; val4.drag = drag; val4.rotationFollowVelocity = true; val4.useYDrag = false; val4.lateVelocityInit = false; val4.UpdateVelMultiplier(1f); val4.projectileSpeedSpread = 0f; } if (stickOnHit) { ProjectileStick val5 = projectile.GetComponent(); if ((Object)(object)val5 == (Object)null) { val5 = projectile.AddComponent(); } if ((Object)(object)val5 != (Object)null) { ((Behaviour)val5).enabled = true; val5.hardStick = false; } } else { ProjectileStick component = projectile.GetComponent(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } } return projectile; } public static GameObject 抛射物_简易配置(this GameObject projectile, float damage = 55f, float gravity = 15f) { return projectile.抛射物设置(damage, 200f, gravity); } } public static class ClothingExt { public enum 服饰部位 { 头, 脖子, 肩膀, 身体, 手臂, 手腕, 手, 腰, 腿, 脚, 武器, 自定义 } public enum 装备位置 { 双方, 左, 右 } public static GameObject 服饰设置(this GameObject obj, 服饰部位 部位 = 服饰部位.头, 装备位置 装备位置 = 装备位置.双方, Vector3 位置偏移 = default(Vector3), Vector3 缩放 = default(Vector3), bool 显示在编辑器 = true) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //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_0053: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown if ((Object)(object)obj == (Object)null) { return null; } PropItem val = obj.GetComponent(); if ((Object)(object)val == (Object)null) { val = obj.AddComponent(); } SetGearType(obj, (GearType)Enum.ToObject(typeof(GearType), (int)部位)); SetShowInEditor(obj, 显示在编辑器); PropItemData val2 = new PropItemData(); val2.m_positionOffset = 位置偏移; val2.m_scale = ((缩放 == default(Vector3)) ? Vector3.one : 缩放); if (IsSymmetricPart(部位)) { val2.m_equip = (EquipType)Enum.ToObject(typeof(EquipType), (int)装备位置); } else { val2.m_equip = (EquipType)0; } val2.m_colors = new int[0]; val2.m_isTeamColor = new bool[0]; if ((Object)(object)val != (Object)null) { ((CharacterItem)val).PropData = val2; } DatabaseEntity component = obj.GetComponent(); if (component == null) { component = new DatabaseEntity((WorkshopContentType)5); component.Name = ((Object)obj).name; component.GenerateNewID(); SetEntity(obj, component); } return obj; } private static bool IsSymmetricPart(服饰部位 部位) { if ((uint)(部位 - 4) <= 2u || (uint)(部位 - 8) <= 2u) { return true; } return false; } public static GameObject 服饰_简易配置(this GameObject obj, 服饰部位 部位 = 服饰部位.头) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return obj.服饰设置(部位, 装备位置.双方, Vector3.zero, Vector3.one); } private static void SetGearType(GameObject obj, GearType gearType) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) FieldInfo field = typeof(CharacterItem).GetField("m_gearType", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { PropItem component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { field.SetValue(component, gearType); } } } private static void SetShowInEditor(GameObject obj, bool show) { FieldInfo field = typeof(CharacterItem).GetField("m_showInEditor", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { PropItem component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { field.SetValue(component, show); } } } private static void SetEntity(GameObject obj, DatabaseEntity entity) { FieldInfo field = typeof(CharacterItem).GetField("m_entity", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { PropItem component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { field.SetValue(component, entity); } } } } } namespace UnityTools { public class ProjectileMount : MonoBehaviour { public string 资源包物品名称; public float 物品大小; public Vector3 物品位置; public Vector3 物品旋转; public bool 调试模式; private GameObject 挂载的物品; private ProjectileHit 抛射物组件; private bool 初始化完成; [Header("设置")] public string 资源包名称 = "minecraft"; private static Dictionary 资源包缓存 = new Dictionary(); public bool 强制挂载 = true; public void Start() { 强制挂载 = true; 尝试初始化(); } private void 尝试初始化() { try { 抛射物组件 = ((Component)this).GetComponent(); if ((Object)(object)抛射物组件 == (Object)null) { Debug.LogError((object)"ProjectileMount: 未找到ProjectileHit组件"); return; } 隐藏抛射物(); 挂载物品(); 初始化完成 = true; if (调试模式) { Debug.Log((object)"ProjectileMount: 初始化完成"); } } catch (Exception ex) { Debug.LogError((object)("ProjectileMount: 初始化时出错: " + ex.Message)); } } private void 隐藏抛射物() { try { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Collider[] componentsInChildren2 = ((Component)this).GetComponentsInChildren(); for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].enabled = false; } if (调试模式) { Debug.Log((object)"ProjectileMount: 抛射物已隐藏"); } } catch (Exception ex) { Debug.LogError((object)("ProjectileMount: 隐藏抛射物时出错: " + ex.Message)); } } private void 挂载物品() { //IL_00a5: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) try { if (string.IsNullOrEmpty(资源包物品名称)) { Debug.LogError((object)"ProjectileMount: 资源包物品名称未设置"); return; } AssetBundle val = 获取资源包(); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("ProjectileMount: 无法加载资源包 " + 资源包名称)); return; } GameObject val2 = val.LoadAsset(资源包物品名称); if ((Object)(object)val2 == (Object)null) { Debug.LogError((object)("ProjectileMount: 无法从资源包加载物品 " + 资源包物品名称)); return; } 挂载的物品 = Object.Instantiate(val2, ((Component)this).transform); ((Object)挂载的物品).name = 资源包物品名称; 挂载的物品.transform.localPosition = 物品位置; 挂载的物品.transform.localRotation = Quaternion.Euler(物品旋转); 挂载的物品.transform.localScale = Vector3.one * 物品大小; MonoBehaviour[] components = 挂载的物品.GetComponents(); foreach (MonoBehaviour val3 in components) { if ((Object)(object)val3 != (Object)null) { string text = ((object)val3).GetType().Name.ToLower(); if (text.Contains("destroy") || text.Contains("timer") || text.Contains("life")) { Object.Destroy((Object)(object)val3); } } } if (调试模式) { Debug.Log((object)("ProjectileMount: 成功挂载物品 " + 资源包物品名称)); } } catch (Exception ex) { Debug.LogError((object)("ProjectileMount: 挂载物品时出错: " + ex.Message)); } } private void Update() { //IL_003f: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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) if (!初始化完成) { 尝试初始化(); } if (强制挂载 && (Object)(object)挂载的物品 != (Object)null) { 挂载的物品.SetActive(true); 挂载的物品.transform.localPosition = 物品位置; 挂载的物品.transform.localRotation = Quaternion.Euler(物品旋转); 挂载的物品.transform.localScale = Vector3.one * 物品大小; 挂载的物品.transform.SetParent(((Component)this).transform, false); 保持激活状态(); } } private void OnDestroy() { if ((Object)(object)挂载的物品 != (Object)null) { Object.Destroy((Object)(object)挂载的物品); } } public ProjectileMount() { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) 物品大小 = 1f; 物品位置 = Vector3.zero; 物品旋转 = Vector3.zero; } private AssetBundle 获取资源包() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown try { if (资源包缓存.ContainsKey(资源包名称) && (Object)(object)资源包缓存[资源包名称] != (Object)null) { if (调试模式) { Debug.Log((object)("ProjectileMount: 从缓存获取资源包 " + 资源包名称)); } return 资源包缓存[资源包名称]; } try { Type type = Type.GetType("wobuzhidaoMod.UManager, wobuzhidao"); if (type != null) { FieldInfo field = type.GetField("assetBundle", BindingFlags.Static | BindingFlags.NonPublic); if (field != null) { AssetBundle val = (AssetBundle)field.GetValue(null); if ((Object)(object)val != (Object)null) { 资源包缓存[资源包名称] = val; if (调试模式) { Debug.Log((object)"ProjectileMount: 通过反射获取资源包"); } return val; } } } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type2 in types) { FieldInfo[] fields = type2.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!(fieldInfo.FieldType == typeof(AssetBundle))) { continue; } try { AssetBundle val2 = (AssetBundle)fieldInfo.GetValue(null); if ((Object)(object)val2 != (Object)null) { 资源包缓存[资源包名称] = val2; if (调试模式) { Debug.Log((object)("ProjectileMount: 通过反射获取资源包 (类型: " + type2.Name + ")")); } return val2; } } catch { } } } } catch { } string[] array = new string[3] { Path.Combine(Application.dataPath, "..", "Mods", 资源包名称), Path.Combine(Application.dataPath, "..", "Mods", 资源包名称 + ".unity3d"), Path.Combine(Application.dataPath, "..", "Mods", 资源包名称 + ".assetbundle") }; foreach (string text in array) { if (!File.Exists(text)) { continue; } try { AssetBundle val3 = AssetBundle.LoadFromFile(text); if ((Object)(object)val3 != (Object)null) { 资源包缓存[资源包名称] = val3; if (调试模式) { Debug.Log((object)("ProjectileMount: 从文件加载资源包 " + text)); } return val3; } } catch (Exception ex) { Debug.LogWarning((object)("ProjectileMount: 从文件加载资源包时出错: " + ex.Message)); } } return null; } catch (Exception ex2) { Debug.LogError((object)("ProjectileMount: 获取资源包时出错: " + ex2.Message)); return null; } } private void 保持激活状态() { if ((Object)(object)挂载的物品 != (Object)null && !挂载的物品.activeSelf) { 挂载的物品.SetActive(true); } } } [DefaultExecutionOrder(-1000)] public class yuelingAI : MonoBehaviour { private Unit unit; private Unit target; private bool battleStarted; public float moveSpeed; public float heightOffset; public float followDistance; public float scanInterval; private GameStateManager gameStateManager; private float scanTimer; private Transform unitTransform; private DataHandler dataHandler; private void Start() { unit = ((Component)this).GetComponentInParent(); if ((Object)(object)unit != (Object)null) { unitTransform = ((Component)unit).transform; } else { unitTransform = ((Component)this).transform; } gameStateManager = ServiceLocator.GetService(); if (gameStateManager != null) { gameStateManager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(Initialize()); } private void OnDestroy() { if (gameStateManager != null) { gameStateManager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { battleStarted = true; } } private IEnumerator Initialize() { yield return null; yield return null; if ((Object)(object)unitTransform == (Object)null) { unitTransform = ((Component)this).transform; } if ((Object)(object)dataHandler == (Object)null) { dataHandler = ((Component)this).GetComponentInChildren(); } } private void LateUpdate() { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) if (!battleStarted || (Object)(object)unit == (Object)null || (Object)(object)unitTransform == (Object)null) { return; } scanTimer += Time.deltaTime; if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || target.data.Dead || (Object)(object)target.data.mainRig == (Object)null) { target = null; } if (scanTimer >= scanInterval || (Object)(object)target == (Object)null) { scanTimer = 0f; target = FindNearestAlly(); } if ((Object)(object)target == (Object)null) { return; } if ((Object)(object)target.data == (Object)null || target.data.Dead || (Object)(object)target.data.mainRig == (Object)null) { target = null; return; } Vector3 position = target.data.mainRig.position; Vector3 val = unitTransform.position - position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } val = ((Vector3)(ref val)).normalized * followDistance; Vector3 val2 = position + val; val2.y = position.y + heightOffset; unitTransform.position = Vector3.MoveTowards(unitTransform.position, val2, moveSpeed * Time.deltaTime); } private Unit FindNearestAlly() { //IL_006f: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType(); Unit result = null; float num = float.MaxValue; Unit[] array2 = array; foreach (Unit val in array2) { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)unit || (Object)(object)val.data == (Object)null || val.data.Dead || (Object)(object)val.data.mainRig == (Object)null || val.Team != unit.Team) { continue; } yuelingAI componentInChildren = ((Component)val).GetComponentInChildren(true); if (!((Object)(object)componentInChildren != (Object)null) || !((Object)(object)componentInChildren != (Object)(object)this)) { float num2 = Vector3.Distance(unitTransform.position, val.data.mainRig.position); if (num2 < num) { num = num2; result = val; } } } return result; } public yuelingAI() { moveSpeed = 3f; followDistance = 1f; heightOffset = 1f; scanInterval = 0.5f; } private void FixedUpdate() { //IL_005f: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_015a: Unknown result type (might be due to invalid IL or missing references) if (!battleStarted || !((Object)(object)dataHandler != (Object)null) || !((Object)(object)unitTransform != (Object)null)) { return; } if ((Object)(object)dataHandler.mainRig != (Object)null) { Transform transform = ((Component)dataHandler.mainRig).transform; if ((Object)(object)transform != (Object)null) { transform.position = unitTransform.position; transform.rotation = unitTransform.rotation; } } if ((Object)(object)dataHandler.head != (Object)null && (Object)(object)((Component)dataHandler.head).transform != (Object)null) { ((Component)dataHandler.head).transform.position = unitTransform.position + Vector3.up * 0.5f; ((Component)dataHandler.head).transform.rotation = unitTransform.rotation; } if ((Object)(object)dataHandler.hip != (Object)null && (Object)(object)((Component)dataHandler.hip).transform != (Object)null) { ((Component)dataHandler.hip).transform.position = unitTransform.position; ((Component)dataHandler.hip).transform.rotation = unitTransform.rotation; } } } public class yuelingchibang : MonoBehaviour { private Transform leftWing; private Transform rightWing; private Quaternion leftOriginalRotation; private Quaternion rightOriginalRotation; private bool initialized; public float minAngle; public float maxAngle; public float speed; public float smooth; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(Initialize()); } private IEnumerator Initialize() { yield return null; yield return null; FindWings(); if ((Object)(object)leftWing == (Object)null) { Debug.Log((object)"left_wing: No left_wing found"); } if ((Object)(object)rightWing == (Object)null) { Debug.Log((object)"right_wing: No right_wing found"); } if ((Object)(object)leftWing != (Object)null) { leftOriginalRotation = leftWing.localRotation; } if ((Object)(object)rightWing != (Object)null) { rightOriginalRotation = rightWing.localRotation; } initialized = true; } private void FindWings() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "left_wing") { leftWing = val; } else if (((Object)val).name == "right_wing") { rightWing = val; } if ((Object)(object)leftWing != (Object)null && (Object)(object)rightWing != (Object)null) { break; } } } private void LateUpdate() { //IL_0045: 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_005a: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (initialized) { float num = Mathf.PingPong(Time.time * speed, 1f); float num2 = Mathf.Lerp(minAngle, maxAngle, num); float num3 = 0f - num2; if ((Object)(object)leftWing != (Object)null) { Quaternion val = leftOriginalRotation * Quaternion.Euler(0f, num2, 0f); leftWing.localRotation = Quaternion.Lerp(leftWing.localRotation, val, Time.deltaTime * smooth); } if ((Object)(object)rightWing != (Object)null) { Quaternion val2 = rightOriginalRotation * Quaternion.Euler(0f, num3, 0f); rightWing.localRotation = Quaternion.Lerp(rightWing.localRotation, val2, Time.deltaTime * smooth); } } } public yuelingchibang() { minAngle = 30f; maxAngle = 60f; speed = 2.1f; smooth = 8f; } } public class yuelingAnimation : MonoBehaviour { private Transform leftArm; private Transform rightArm; private Transform head; private Transform allay; private ParticleSystem kkkParticle; private Quaternion leftOriginalRotation; private Quaternion rightOriginalRotation; private Quaternion headOriginalRotation; private Quaternion allayOriginalRotation; private Unit unit; private Unit target; private Unit animationTarget; private GameStateManager gameStateManager; private bool initialized; private bool battleStarted; private bool animating; private float cooldownTimer; public float xTime; public float yTime; public float healRange; public float cooldown; public float headRotateSpeed; public float allayRotateSpeed; private Transform sss; private AudioSource kkkAudio; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(Initialize()); } private IEnumerator Initialize() { yield return null; yield return null; FindObjects(); SetupAudio(); unit = ((Component)this).GetComponentInParent(); if ((Object)(object)kkkParticle != (Object)null) { kkkParticle.Stop(true, (ParticleSystemStopBehavior)0); ((Component)kkkParticle).gameObject.SetActive(false); } if ((Object)(object)leftArm != (Object)null) { leftOriginalRotation = leftArm.localRotation; } if ((Object)(object)rightArm != (Object)null) { rightOriginalRotation = rightArm.localRotation; } if ((Object)(object)head != (Object)null) { headOriginalRotation = head.localRotation; } if ((Object)(object)allay != (Object)null) { allayOriginalRotation = allay.localRotation; } initialized = true; gameStateManager = ServiceLocator.GetService(); if (gameStateManager != null) { gameStateManager.GameStateChanged += OnGameStateChanged; } initialized = true; if (battleStarted) { target = FindNearestAlly(); if ((Object)(object)target != (Object)null) { RotateAllay(target); RotateHead(target); } } } private void OnDestroy() { if (gameStateManager != null) { gameStateManager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)state == 1) { battleStarted = true; target = FindNearestAlly(); if ((Object)(object)target != (Object)null && !animating) { RotateAllay(target); RotateHead(target); } } } private void FindObjects() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "left_arm" && (Object)(object)leftArm == (Object)null) { leftArm = val; } if (((Object)val).name == "right_arm" && (Object)(object)rightArm == (Object)null) { rightArm = val; } if (((Object)val).name == "head" && (Object)(object)head == (Object)null) { head = val; } if (((Object)val).name == "allay" && (Object)(object)allay == (Object)null) { allay = val; } if (((Object)val).name == "KKK" && (Object)(object)kkkParticle == (Object)null) { kkkParticle = ((Component)val).GetComponent(); kkkAudio = ((Component)val).GetComponent(); if ((Object)(object)kkkParticle != (Object)null) { kkkParticle.Stop(true, (ParticleSystemStopBehavior)0); } if ((Object)(object)kkkAudio != (Object)null) { kkkAudio.playOnAwake = false; kkkAudio.loop = false; kkkAudio.Stop(); } ((Component)val).gameObject.SetActive(false); } if (((Object)val).name == "sss" && (Object)(object)sss == (Object)null) { sss = val; } } } private void Update() { if (!initialized || !battleStarted || (Object)(object)unit == (Object)null || (Object)(object)allay == (Object)null) { return; } cooldownTimer -= Time.deltaTime; target = FindNearestAlly(); if ((Object)(object)target != (Object)null) { RotateAllay(target); if (!animating) { RotateHead(target); } } if (!animating && (Object)(object)target != (Object)null && cooldownTimer <= 0f) { animationTarget = target; ((MonoBehaviour)this).StartCoroutine(PlayAnimation()); } } private Unit FindNearestAlly() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00cc: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, healRange); Unit result = null; float num = float.MaxValue; Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)val == (Object)null) { continue; } Unit componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)unit) && !((Object)(object)componentInParent.data == (Object)null) && !componentInParent.data.Dead && !((Object)(object)componentInParent.data.mainRig == (Object)null) && componentInParent.Team == unit.Team && !((Object)(object)((Component)componentInParent).GetComponentInChildren(true) != (Object)null)) { float num2 = Vector3.Distance(((Component)this).transform.position, componentInParent.data.mainRig.position); if (num2 < num) { num = num2; result = componentInParent; } } } return result; } private IEnumerator PlayAnimation() { if ((Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && unit.data.Dead) { animating = false; yield break; } animating = true; Vector3 animationStartPosition = ((Component)this).transform.localPosition; Quaternion leftStart = (((Object)(object)leftArm != (Object)null) ? leftArm.localRotation : Quaternion.identity); Quaternion rightStart = (((Object)(object)rightArm != (Object)null) ? rightArm.localRotation : Quaternion.identity); Quaternion headStart = (((Object)(object)head != (Object)null) ? head.localRotation : Quaternion.identity); Vector3 eulerAngles = ((Quaternion)(ref leftStart)).eulerAngles; Vector3 eulerAngles2 = ((Quaternion)(ref rightStart)).eulerAngles; Quaternion leftTarget = Quaternion.Euler(150f, eulerAngles.y, 40f); Quaternion rightTarget = Quaternion.Euler(150f, eulerAngles2.y, -40f); Quaternion headTarget = Quaternion.identity; Vector3 targetPosition = animationStartPosition + Vector3.up * 0.5f; Vector3 sssStartPosition = Vector3.zero; Vector3 sssTargetPosition = Vector3.zero; Vector3 sssStartScale = Vector3.one; Vector3 sssTargetScale = new Vector3(0.5f, 0.5f, 0.5f); if ((Object)(object)sss != (Object)null) { sssStartPosition = sss.localPosition; sssStartScale = sss.localScale; sssTargetPosition = sssStartPosition + Vector3.back * 0.25f; } float timer = 0f; while (timer < xTime) { timer += Time.deltaTime; float num = Mathf.Clamp01(timer / xTime); num = Mathf.SmoothStep(0f, 1f, num); if ((Object)(object)leftArm != (Object)null) { leftArm.localRotation = Quaternion.Slerp(leftStart, leftTarget, num); } if ((Object)(object)rightArm != (Object)null) { rightArm.localRotation = Quaternion.Slerp(rightStart, rightTarget, num); } if ((Object)(object)head != (Object)null) { head.localRotation = Quaternion.Slerp(headStart, headTarget, num); } ((Component)this).transform.localPosition = Vector3.Lerp(animationStartPosition, targetPosition, num); if ((Object)(object)sss != (Object)null) { sss.localPosition = Vector3.Lerp(sssStartPosition, sssTargetPosition, num); sss.localScale = Vector3.Lerp(sssStartScale, sssTargetScale, num); } yield return null; } if ((Object)(object)leftArm != (Object)null) { leftArm.localRotation = leftTarget; } if ((Object)(object)rightArm != (Object)null) { rightArm.localRotation = rightTarget; } if ((Object)(object)head != (Object)null) { head.localRotation = headTarget; } ((Component)this).transform.localPosition = targetPosition; if ((Object)(object)sss != (Object)null) { sss.localPosition = sssTargetPosition; sss.localScale = sssTargetScale; } if ((Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && !unit.data.Dead && (Object)(object)animationTarget != (Object)null && (Object)(object)animationTarget.data != (Object)null && !animationTarget.data.Dead && (Object)(object)animationTarget.data.mainRig != (Object)null && (Object)(object)animationTarget.data.healthHandler != (Object)null) { Vector3 val = animationTarget.data.mainRig.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; try { ((Damagable)animationTarget.data.healthHandler).TakeDamage(-100f, normalized, unit, (DamageType)0); } catch { } } if ((Object)(object)kkkParticle != (Object)null) { ((Component)kkkParticle).gameObject.SetActive(true); kkkParticle.Play(true); } if ((Object)(object)kkkAudio != (Object)null) { kkkAudio.Stop(); kkkAudio.Play(); } timer = 0f; while (timer < yTime) { timer += Time.deltaTime; float num2 = Mathf.Clamp01(timer / yTime); num2 = Mathf.SmoothStep(0f, 1f, num2); if ((Object)(object)leftArm != (Object)null) { leftArm.localRotation = Quaternion.Slerp(leftTarget, leftStart, num2); } if ((Object)(object)rightArm != (Object)null) { rightArm.localRotation = Quaternion.Slerp(rightTarget, rightStart, num2); } if ((Object)(object)head != (Object)null) { head.localRotation = Quaternion.Slerp(headTarget, headStart, num2); } ((Component)this).transform.localPosition = Vector3.Lerp(targetPosition, animationStartPosition, num2); if ((Object)(object)sss != (Object)null) { sss.localPosition = Vector3.Lerp(sssTargetPosition, sssStartPosition, num2); sss.localScale = Vector3.Lerp(sssTargetScale, sssStartScale, num2); } yield return null; } if ((Object)(object)leftArm != (Object)null) { leftArm.localRotation = leftStart; } if ((Object)(object)rightArm != (Object)null) { rightArm.localRotation = rightStart; } if ((Object)(object)head != (Object)null) { head.localRotation = headStart; } ((Component)this).transform.localPosition = animationStartPosition; if ((Object)(object)sss != (Object)null) { sss.localPosition = sssStartPosition; sss.localScale = sssStartScale; } animating = false; cooldownTimer = cooldown; animationTarget = null; target = FindNearestAlly(); if ((Object)(object)target != (Object)null) { RotateAllay(target); RotateHead(target); } } public yuelingAnimation() { xTime = 1f; yTime = 1f; healRange = 3f; cooldown = 3f; cooldownTimer = 3f; headRotateSpeed = 5f; allayRotateSpeed = 5f; } private void RotateAllay(Unit target) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || target.data.Dead || (Object)(object)target.data.mainRig == (Object)null || (Object)(object)allay == (Object)null) { return; } Vector3 val = target.data.mainRig.position - allay.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { Transform parent = allay.parent; Vector3 val2 = (((Object)(object)parent != (Object)null) ? parent.InverseTransformDirection(((Vector3)(ref val)).normalized) : ((Vector3)(ref val)).normalized); val2.y = 0f; if (!(((Vector3)(ref val2)).sqrMagnitude < 0.001f)) { float num = Mathf.Atan2(val2.x, val2.z) * 57.29578f; Vector3 eulerAngles = ((Quaternion)(ref allayOriginalRotation)).eulerAngles; Quaternion val3 = Quaternion.Euler(eulerAngles.x, eulerAngles.y + num, eulerAngles.z); allay.localRotation = Quaternion.Slerp(allay.localRotation, val3, Time.deltaTime * allayRotateSpeed); } } } private void RotateHead(Unit target) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_007c: 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_0096: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) if (!((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !target.data.Dead && !((Object)(object)target.data.mainRig == (Object)null) && !((Object)(object)head == (Object)null)) { Vector3 val = target.data.mainRig.position - head.position; Transform parent = head.parent; Vector3 val2 = (((Object)(object)parent != (Object)null) ? parent.InverseTransformDirection(val) : val); if (!(((Vector3)(ref val2)).sqrMagnitude < 0.001f)) { Quaternion val3 = Quaternion.LookRotation(val2); val3 = Quaternion.Euler(0f - ((Quaternion)(ref val3)).eulerAngles.x, ((Quaternion)(ref val3)).eulerAngles.y + 180f, ((Quaternion)(ref val3)).eulerAngles.z); head.localRotation = Quaternion.Slerp(head.localRotation, val3, Time.deltaTime * headRotateSpeed); } } } private void SetupAudio() { if ((Object)(object)kkkAudio == (Object)null) { return; } kkkAudio.playOnAwake = false; kkkAudio.loop = false; kkkAudio.spatialBlend = 1f; kkkAudio.rolloffMode = (AudioRolloffMode)1; kkkAudio.minDistance = 1f; kkkAudio.maxDistance = 30f; try { SoundPlayer service = ServiceLocator.GetService(); if (!((Object)(object)service != (Object)null)) { return; } FieldInfo field = typeof(SoundPlayer).GetField("defaultSource", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null)) { return; } object? value = field.GetValue(service); GameObject val = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val != (Object)null) { AudioSource component = val.GetComponent(); if ((Object)(object)component != (Object)null) { kkkAudio.outputAudioMixerGroup = component.outputAudioMixerGroup; } } } catch { } } } [DefaultExecutionOrder(-1000)] public class VexMovementTest : MonoBehaviour { public float moveSpeed = 1.2f; public float rotateSpeed = 4f; public float orbitDistance = 5f; public float orbitHeight = 2f; public float randomMoveRange = 2f; public float changePositionTime = 4.5f; public float chargeInterval = 5f; public float chargeSpeed = 14f; public float chargeEndDistance = 5f; public float floatingHeight = 0.35f; public float floatingSpeed = 1.2f; public float armAnimationSpeed = 6f; public float armSwingAngle = 12f; public float armSwingSpeed = 2f; public float chargeDamage = 100f; public float hitDistance = 0.8f; public float searchRange = 100f; private Unit unit; private Unit target; private bool battleStarted; private bool charging; private bool hitTargetThisCharge; private bool firstScanFinished; private GameStateManager gameStateManager; private DataHandler dataHandler; private Transform unitTransform; private Transform leftArm; private Transform rightArm; private Quaternion leftArmOriginalRotation; private Quaternion rightArmOriginalRotation; private Vector3 targetPosition; private Vector3 chargeDirection; private float positionTimer; private float chargeTimer; private float floatingOffset; private bool dead; private void Start() { unit = ((Component)this).GetComponentInParent(); if ((Object)(object)unit != (Object)null) { unitTransform = ((Component)unit).transform; } else { unitTransform = ((Component)this).transform; } dataHandler = ((Component)this).GetComponentInChildren(); FindObjects(); floatingOffset = Random.Range(0f, 6.28f); gameStateManager = ServiceLocator.GetService(); if (gameStateManager != null) { gameStateManager.GameStateChanged += OnGameStateChanged; } ((MonoBehaviour)this).StartCoroutine(Initialize()); } private void OnDestroy() { if (gameStateManager != null) { gameStateManager.GameStateChanged -= OnGameStateChanged; } } private void OnGameStateChanged(GameState state) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if (!IsDead() && (int)state == 1 && !battleStarted) { battleStarted = true; ((MonoBehaviour)this).StartCoroutine(DelayedFirstScan()); } } private IEnumerator DelayedFirstScan() { yield return (object)new WaitForSeconds(Random.Range(0f, 0.2f)); if (IsDead() || !battleStarted || (Object)(object)unit == (Object)null || (Object)(object)unitTransform == (Object)null) { yield break; } target = FindNearestEnemy(); if (!IsDead()) { firstScanFinished = true; positionTimer = 0f; chargeTimer = 0f; if ((Object)(object)target != (Object)null) { SelectNewPosition(); } } } private IEnumerator Initialize() { yield return null; if (IsDead()) { yield break; } yield return null; if (!IsDead()) { if ((Object)(object)unitTransform == (Object)null) { unitTransform = ((Component)this).transform; } if ((Object)(object)dataHandler == (Object)null) { dataHandler = ((Component)this).GetComponentInChildren(); } } } private void FindObjects() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0071: Unknown result type (might be due to invalid IL or missing references) Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "left_arm" && (Object)(object)leftArm == (Object)null) { leftArm = val; leftArmOriginalRotation = val.localRotation; } if (((Object)val).name == "right_arm" && (Object)(object)rightArm == (Object)null) { rightArm = val; rightArmOriginalRotation = val.localRotation; } } } private void Update() { //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01c4: Unknown result type (might be due to invalid IL or missing references) if (IsDead() || !battleStarted || !firstScanFinished || (Object)(object)unit == (Object)null || (Object)(object)unitTransform == (Object)null) { return; } if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || target.data.Dead || (Object)(object)target.data.mainRig == (Object)null) { charging = false; target = FindNearestEnemy(); if (IsDead()) { return; } positionTimer = 0f; chargeTimer = 0f; if ((Object)(object)target != (Object)null) { SelectNewPosition(); } } if (IsDead()) { return; } if ((Object)(object)target == (Object)null) { UpdateArmSwing(); return; } if (charging) { UpdateCharge(); return; } positionTimer += Time.deltaTime; chargeTimer += Time.deltaTime; UpdateArmSwing(); if (positionTimer >= changePositionTime) { positionTimer = 0f; SelectNewPosition(); } if (chargeTimer >= chargeInterval) { StartCharge(); return; } float num = Mathf.Sin(Time.time * floatingSpeed + floatingOffset) * floatingHeight; Vector3 val = targetPosition; val.y += num; Vector3 val2 = val - unitTransform.position; if (((Vector3)(ref val2)).sqrMagnitude > 0.001f) { unitTransform.position = Vector3.MoveTowards(unitTransform.position, val, moveSpeed * Time.deltaTime); } LookAtTarget(); } private Unit FindNearestEnemy() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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) if (IsDead() || (Object)(object)unit == (Object)null || (Object)(object)unitTransform == (Object)null) { return null; } Collider[] array = Physics.OverlapSphere(unitTransform.position, searchRange); Unit result = null; float num = float.MaxValue; Collider[] array2 = array; foreach (Collider val in array2) { if (IsDead()) { return null; } if ((Object)(object)val == (Object)null) { continue; } Unit componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)unit) && !((Object)(object)componentInParent.data == (Object)null) && !componentInParent.data.Dead && !((Object)(object)componentInParent.data.mainRig == (Object)null) && componentInParent.Team != unit.Team) { Vector3 val2 = componentInParent.data.mainRig.position - unitTransform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = componentInParent; } } } return result; } private void SelectNewPosition() { //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (!IsDead() && !((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !target.data.Dead && !((Object)(object)target.data.mainRig == (Object)null)) { Vector3 val = Random.insideUnitSphere; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); float num = orbitDistance + Random.Range(0f - randomMoveRange, randomMoveRange); if (num < 1f) { num = 1f; } Vector3 val2 = val * num; val2.y += orbitHeight + Random.Range(0f - randomMoveRange, randomMoveRange); targetPosition = target.data.mainRig.position + val2; } } private void StartCharge() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) if (!IsDead() && !((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !target.data.Dead && !((Object)(object)target.data.mainRig == (Object)null)) { Vector3 val = target.data.mainRig.position - unitTransform.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { chargeDirection = ((Vector3)(ref val)).normalized; charging = true; hitTargetThisCharge = false; chargeTimer = 0f; } } } private void UpdateCharge() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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) if (IsDead()) { return; } if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || target.data.Dead || (Object)(object)target.data.mainRig == (Object)null) { charging = false; target = FindNearestEnemy(); if (!IsDead() && (Object)(object)target != (Object)null) { SelectNewPosition(); } return; } Vector3 position = unitTransform.position; Vector3 val = position + chargeDirection * chargeSpeed * Time.deltaTime; unitTransform.position = val; if (((Vector3)(ref chargeDirection)).sqrMagnitude > 0.001f) { Quaternion val2 = Quaternion.LookRotation(chargeDirection); unitTransform.rotation = Quaternion.Slerp(unitTransform.rotation, val2, Time.deltaTime * rotateSpeed); } UpdateChargeArm(); if (!hitTargetThisCharge && !IsDead()) { Vector3 position2 = target.data.mainRig.position; if (Vector3.Distance(ClosestPointOnSegment(position, val, position2), position2) <= hitDistance) { DamageTarget(); } } if (!IsDead() && Vector3.Distance(unitTransform.position, target.data.mainRig.position) >= chargeEndDistance) { charging = false; positionTimer = 0f; chargeTimer = 0f; SelectNewPosition(); } } private Vector3 ClosestPointOnSegment(Vector3 start, Vector3 end, Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_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_0021: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Vector3 val = end - start; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < 0.0001f) { return start; } float num = Vector3.Dot(point - start, val) / sqrMagnitude; num = Mathf.Clamp01(num); return start + val * num; } private void DamageTarget() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!IsDead() && !hitTargetThisCharge && !((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !target.data.Dead && !((Object)(object)target.data.healthHandler == (Object)null)) { try { ((Damagable)target.data.healthHandler).TakeDamage(chargeDamage, chargeDirection, unit, (DamageType)0); } catch { } hitTargetThisCharge = true; } } private void UpdateArmSwing() { //IL_0036: 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_003c: 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_004a: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!IsDead()) { float num = Mathf.Sin(Time.time * armSwingSpeed) * armSwingAngle; if ((Object)(object)leftArm != (Object)null) { Vector3 eulerAngles = ((Quaternion)(ref leftArmOriginalRotation)).eulerAngles; Quaternion val = Quaternion.Euler(eulerAngles.x + num, eulerAngles.y, eulerAngles.z); leftArm.localRotation = Quaternion.Slerp(leftArm.localRotation, val, Time.deltaTime * armAnimationSpeed); } if ((Object)(object)rightArm != (Object)null) { Vector3 eulerAngles2 = ((Quaternion)(ref rightArmOriginalRotation)).eulerAngles; Quaternion val2 = Quaternion.Euler(eulerAngles2.x - num, eulerAngles2.y, eulerAngles2.z); rightArm.localRotation = Quaternion.Slerp(rightArm.localRotation, val2, Time.deltaTime * armAnimationSpeed); } } } private void UpdateChargeArm() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (!IsDead()) { if ((Object)(object)rightArm != (Object)null) { Vector3 eulerAngles = ((Quaternion)(ref rightArmOriginalRotation)).eulerAngles; Quaternion val = Quaternion.Euler(150f, eulerAngles.y, eulerAngles.z); rightArm.localRotation = Quaternion.Slerp(rightArm.localRotation, val, Time.deltaTime * armAnimationSpeed); } if ((Object)(object)leftArm != (Object)null) { leftArm.localRotation = Quaternion.Slerp(leftArm.localRotation, leftArmOriginalRotation, Time.deltaTime * armAnimationSpeed); } } } private void LookAtTarget() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (!IsDead() && !((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null) && !target.data.Dead && !((Object)(object)target.data.mainRig == (Object)null)) { Vector3 val = target.data.mainRig.position - unitTransform.position; if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); unitTransform.rotation = Quaternion.Slerp(unitTransform.rotation, val2, Time.deltaTime * rotateSpeed); } } } private void FixedUpdate() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (IsDead() || !battleStarted || !((Object)(object)dataHandler != (Object)null) || !((Object)(object)unitTransform != (Object)null)) { return; } if ((Object)(object)dataHandler.mainRig != (Object)null) { Transform transform = ((Component)dataHandler.mainRig).transform; if ((Object)(object)transform != (Object)null) { transform.position = unitTransform.position; transform.rotation = unitTransform.rotation; } } if ((Object)(object)dataHandler.head != (Object)null && (Object)(object)((Component)dataHandler.head).transform != (Object)null) { ((Component)dataHandler.head).transform.position = unitTransform.position + Vector3.up * 0.5f; ((Component)dataHandler.head).transform.rotation = unitTransform.rotation; } if ((Object)(object)dataHandler.hip != (Object)null && (Object)(object)((Component)dataHandler.hip).transform != (Object)null) { ((Component)dataHandler.hip).transform.position = unitTransform.position; ((Component)dataHandler.hip).transform.rotation = unitTransform.rotation; } } private bool IsDead() { if (dead) { return true; } if ((Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null) { return false; } if (unit.data.Dead) { dead = true; target = null; charging = false; firstScanFinished = false; return true; } return false; } } } namespace CesyriTools { public class waterplant : MonoBehaviour { private GameObject m_unitRoot; private List m_selfColliders; private List m_waterColliders; private bool m_applied; private float m_pendingRetryTimer; private float m_periodicCheckTimer; private static readonly HashSet s_allowedGuids = new HashSet(); public static bool IsWaterAllowedForBlueprint(UnitBlueprint bp) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bp == (Object)null) { return false; } if (bp.Entity != null && s_allowedGuids.Contains(bp.Entity.GUID.m_ID)) { return true; } if ((Object)(object)bp.UnitBase != (Object)null) { return (Object)(object)bp.UnitBase.GetComponentInChildren(true) != (Object)null; } return false; } private void Awake() { CesyriWaterPlacementFix.Ensure(); m_unitRoot = (((Object)(object)((Component)this).GetComponentInParent() != (Object)null) ? ((Component)((Component)this).GetComponentInParent()).gameObject : ((Component)this).gameObject); m_selfColliders = new List(); m_waterColliders = new List(); m_pendingRetryTimer = 0f; } private void Start() { TryApplyIgnoreCollision(); } private void Update() { if (m_applied) { m_periodicCheckTimer += Time.unscaledDeltaTime; if (m_periodicCheckTimer >= 1f) { m_periodicCheckTimer = 0f; TryApplyIgnoreCollision(); } } else { m_pendingRetryTimer += Time.unscaledDeltaTime; if (m_pendingRetryTimer >= 0.2f) { m_pendingRetryTimer = 0f; TryApplyIgnoreCollision(); } } } private void TryApplyIgnoreCollision() { m_selfColliders.Clear(); if ((Object)(object)m_unitRoot != (Object)null) { m_selfColliders.AddRange(m_unitRoot.GetComponentsInChildren(true)); } if (m_selfColliders.Count == 0) { return; } m_waterColliders.Clear(); Water[] array = Object.FindObjectsOfType(); if (array != null && array.Length != 0) { for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] == (Object)null) { continue; } Collider component = ((Component)array[i]).GetComponent(); if ((Object)(object)component != (Object)null) { m_waterColliders.Add(component); } Collider[] componentsInChildren = ((Component)array[i]).GetComponentsInChildren(true); if (componentsInChildren == null) { continue; } for (int j = 0; j < componentsInChildren.Length; j++) { if (!m_waterColliders.Contains(componentsInChildren[j])) { m_waterColliders.Add(componentsInChildren[j]); } } } } if (m_waterColliders.Count == 0) { return; } for (int k = 0; k < m_selfColliders.Count; k++) { Collider val = m_selfColliders[k]; if ((Object)(object)val == (Object)null) { continue; } for (int l = 0; l < m_waterColliders.Count; l++) { Collider val2 = m_waterColliders[l]; if (!((Object)(object)val2 == (Object)null)) { Physics.IgnoreCollision(val, val2, true); } } } m_applied = true; } private void OnDestroy() { if (m_selfColliders == null || m_waterColliders == null) { return; } for (int i = 0; i < m_selfColliders.Count; i++) { Collider val = m_selfColliders[i]; if ((Object)(object)val == (Object)null) { continue; } for (int j = 0; j < m_waterColliders.Count; j++) { Collider val2 = m_waterColliders[j]; if (!((Object)(object)val2 == (Object)null)) { Physics.IgnoreCollision(val, val2, false); } } } } public static void Register(uint guid) { s_allowedGuids.Add((int)guid); } } public class CesyriWaterPlacementFix : MonoBehaviour { private static CesyriWaterPlacementFix s_instance; private int m_waterLayer = -1; private int m_waterLayerMask; private bool m_waitingPlacement; private bool m_cursorReady; private float m_retryTimer; private int m_retryCount; private PlacementCursor m_cursor; private int m_originalInvalidMask; private int m_lastBlueprintId = -1; private bool m_lastAllowed; private int m_originalUnitMask; private float m_waterRescanTimer; private Dictionary m_waterLayerBackup; private bool m_subscribed; private float m_subscribeRetryTimer; public static void Ensure() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (!((Object)(object)s_instance != (Object)null)) { GameObject val = new GameObject("CesyriWaterPlacementFixGlobal"); Object.DontDestroyOnLoad((Object)val); s_instance = val.AddComponent(); } } private void Awake() { if ((Object)(object)s_instance != (Object)null && (Object)(object)s_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } s_instance = this; Physics.queriesHitTriggers = true; m_waterLayer = LayerMask.NameToLayer("Water"); m_waterLayerMask = 1 << m_waterLayer; m_waterLayerBackup = new Dictionary(); m_subscribeRetryTimer = 0f; TrySubscribe(); } private void OnDestroy() { if ((Object)(object)s_instance == (Object)(object)this) { s_instance = null; } RestoreAllWaterLayers(); GameStateManager service = ServiceLocator.GetService(); if (service != null && m_subscribed) { service.GameStateChanged -= OnGameStateChanged; } m_subscribed = false; } private void OnGameStateChanged(GameState state) { //IL_0000: 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_0037: Invalid comparison between Unknown and I4 if ((int)state == 0) { m_retryTimer = 0f; m_retryCount = 0; m_waitingPlacement = true; m_cursorReady = false; m_waterRescanTimer = 0f; SwitchWaterObjectsToWaterLayer(); } else if ((int)state == 1) { m_waitingPlacement = false; m_cursorReady = false; RestoreAllWaterLayers(); } } private void Update() { if (m_waterLayer < 0) { return; } if (!m_subscribed) { m_subscribeRetryTimer += Time.unscaledDeltaTime; if (m_subscribeRetryTimer >= 0.5f) { m_subscribeRetryTimer = 0f; TrySubscribe(); } } else if (!m_cursorReady) { if (!m_waitingPlacement) { return; } m_retryTimer += Time.unscaledDeltaTime; if (m_retryTimer >= 0.3f) { m_retryTimer = 0f; m_retryCount++; TryResolveCursor(); if (m_retryCount >= 20) { m_waitingPlacement = false; } } } else { m_waterRescanTimer += Time.unscaledDeltaTime; if (m_waterRescanTimer >= 2f) { m_waterRescanTimer = 0f; SwitchWaterObjectsToWaterLayer(); } UpdateMasksByBlueprint(); } } private void TryResolveCursor() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) PlacementCursor val = null; GameModeService service = ServiceLocator.GetService(); if ((Object)(object)service != (Object)null && service.CurrentGameMode != null && service.CurrentGameMode.Brush != null) { val = service.CurrentGameMode.Brush.Cursor; } if ((Object)(object)val == (Object)null) { val = Object.FindObjectOfType(); } if (!((Object)(object)val == (Object)null)) { m_cursor = val; LayerMask val2 = m_cursor.PrimaryActionMask; int num = ((LayerMask)(ref val2)).value | m_waterLayerMask; val2 = m_cursor.PrimaryActionMask; if (num != ((LayerMask)(ref val2)).value) { m_cursor.PrimaryActionMask = LayerMask.op_Implicit(num); } val2 = m_cursor.InvalidUnitPlacementMask; m_originalInvalidMask = ((LayerMask)(ref val2)).value; val2 = m_cursor.UnitMask; m_originalUnitMask = ((LayerMask)(ref val2)).value; m_lastBlueprintId = -1; m_lastAllowed = false; m_cursorReady = true; } } private void UpdateMasksByBlueprint() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_cursor == (Object)null) { m_cursorReady = false; return; } GameModeService service = ServiceLocator.GetService(); UnitPlacementBrush val = (((Object)(object)service != (Object)null && service.CurrentGameMode != null) ? service.CurrentGameMode.Brush : null); UnitBlueprint val2 = ((val != null) ? val.UnitToSpawn : null); int num = (((Object)(object)val2 != (Object)null && val2.Entity != null) ? val2.Entity.GUID.m_ID : (-2)); if (num == m_lastBlueprintId) { return; } m_lastBlueprintId = num; bool flag = (Object)(object)val2 != (Object)null && waterplant.IsWaterAllowedForBlueprint(val2); if (flag != m_lastAllowed) { m_lastAllowed = flag; int num2; int num3; if (flag) { num2 = m_originalInvalidMask & ~m_waterLayerMask; num3 = m_originalUnitMask & ~m_waterLayerMask; } else { num2 = m_originalInvalidMask | m_waterLayerMask; num3 = m_originalUnitMask | m_waterLayerMask; } int platformLayerMaskValue = Cesyribingzhong.GetPlatformLayerMaskValue(); num2 &= ~platformLayerMaskValue; num3 &= ~platformLayerMaskValue; m_cursor.InvalidUnitPlacementMask = LayerMask.op_Implicit(num2); FieldInfo field = typeof(PlacementCursor).GetField("m_unitMask", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(m_cursor, LayerMask.op_Implicit(num3)); } } } private void SwitchWaterObjectsToWaterLayer() { Water[] array = Object.FindObjectsOfType(); if (array == null) { return; } HashSet hashSet = new HashSet(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] == (Object)null) { continue; } GameObject gameObject = ((Component)array[i]).gameObject; hashSet.Add(gameObject); if (!m_waterLayerBackup.ContainsKey(gameObject)) { m_waterLayerBackup.Add(gameObject, gameObject.layer); } if (gameObject.layer != m_waterLayer) { gameObject.layer = m_waterLayer; } Transform[] componentsInChildren = gameObject.GetComponentsInChildren(true); if (componentsInChildren == null) { continue; } for (int j = 0; j < componentsInChildren.Length; j++) { GameObject gameObject2 = ((Component)componentsInChildren[j]).gameObject; if ((Object)(object)gameObject2 == (Object)null) { continue; } Collider component = gameObject2.GetComponent(); if ((Object)(object)component != (Object)null && component.enabled) { if (!m_waterLayerBackup.ContainsKey(gameObject2)) { m_waterLayerBackup.Add(gameObject2, gameObject2.layer); } if (gameObject2.layer != m_waterLayer) { gameObject2.layer = m_waterLayer; } hashSet.Add(gameObject2); } } } List list = null; foreach (KeyValuePair item in m_waterLayerBackup) { if (!hashSet.Contains(item.Key)) { if (list == null) { list = new List(); } list.Add(item.Key); } } if (list != null) { for (int k = 0; k < list.Count; k++) { m_waterLayerBackup.Remove(list[k]); } } } private void RestoreAllWaterLayers() { if (m_waterLayerBackup == null || m_waterLayerBackup.Count == 0) { return; } List list = new List(m_waterLayerBackup.Keys); for (int i = 0; i < list.Count; i++) { GameObject val = list[i]; if (!((Object)(object)val == (Object)null)) { val.layer = m_waterLayerBackup[val]; } } m_waterLayerBackup.Clear(); } private void TrySubscribe() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) GameStateManager service = ServiceLocator.GetService(); if (service != null && !m_subscribed) { service.GameStateChanged += OnGameStateChanged; m_subscribed = true; if ((int)service.GameState == 0) { OnGameStateChanged((GameState)0); } } } } public class Cesyribingzhong : MonoBehaviour { internal static readonly List s_all = new List(); private static readonly HashSet s_registeredGuids = new HashSet(); private static int s_platformLayer = -1; private GameObject m_platformGo; private BoxCollider m_platformCollider; private float m_cooldown; private static bool s_isPlacementPhase = false; private bool m_baseDisabledForPlacement; private Dictionary m_baseColliderBackup; public BoxCollider PlatformCollider => m_platformCollider; public static bool HasRegisteredUnits => s_registeredGuids.Count > 0; public static bool IsPlacementPhase { get { return s_isPlacementPhase; } set { s_isPlacementPhase = value; } } public static void Register(uint guid) { s_registeredGuids.Add((int)guid); EnsureWatcher(); } public static bool IsRegistered(int guidId) { return s_registeredGuids.Contains(guidId); } public static Cesyribingzhong FindByPlatformGameObject(GameObject platformGo) { if ((Object)(object)platformGo == (Object)null) { return null; } List list = s_all; for (int i = 0; i < list.Count; i++) { Cesyribingzhong cesyribingzhong = list[i]; if (!((Object)(object)cesyribingzhong == (Object)null) && (Object)(object)cesyribingzhong.m_platformGo == (Object)(object)platformGo) { return cesyribingzhong; } } return null; } public static int GetPlatformLayer() { if (s_platformLayer == -1) { int num = LayerMask.NameToLayer("Map"); if (num < 0) { num = LayerMask.NameToLayer("Ground"); } if (num < 0) { num = LayerMask.NameToLayer("Default"); } if (num < 0) { num = 0; } s_platformLayer = num; } return s_platformLayer; } public static int GetPlatformLayerMaskValue() { return 1 << GetPlatformLayer(); } private static void EnsureWatcher() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CesyriStackableWatcher.Instance == (Object)null) { GameObject val = (GameObject)(((object)GameObject.Find("__CesyriTools")) ?? ((object)new GameObject("__CesyriTools"))); if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } } } private void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) s_all.Add(this); m_baseColliderBackup = new Dictionary(); CesyriWaterPlacementFix.Ensure(); int platformLayer = GetPlatformLayer(); m_platformGo = new GameObject("CesyriStackPlatform"); m_platformGo.layer = platformLayer; m_platformGo.transform.SetParent(((Component)this).transform, false); m_platformCollider = m_platformGo.AddComponent(); ((Collider)m_platformCollider).isTrigger = false; Bounds val = CalculateBounds(((Component)this).gameObject); Vector3 size = ((Bounds)(ref val)).size; size.y = 0.2f; size.x = Mathf.Max(size.x, 0.4f); size.z = Mathf.Max(size.z, 0.4f); m_platformCollider.size = size; float num = ((Bounds)(ref val)).max.y - ((Component)this).transform.position.y + 0.02f - size.y * 0.5f; Vector3 center = default(Vector3); ((Vector3)(ref center))..ctor(0f, num, 0f); m_platformCollider.center = center; m_cooldown = 0f; m_baseDisabledForPlacement = false; ((Collider)m_platformCollider).enabled = false; EnsureWatcher(); } private void OnDestroy() { s_all.Remove(this); SetBaseDisabled(wantDisabled: false); if ((Object)(object)m_platformGo != (Object)null) { Object.Destroy((Object)(object)m_platformGo); m_platformGo = null; } } private void Update() { if (m_cooldown > 0f) { m_cooldown -= Time.deltaTime; } bool flag = m_cooldown <= 0f && s_isPlacementPhase; if ((Object)(object)m_platformCollider != (Object)null) { ((Collider)m_platformCollider).enabled = flag; } bool flag2 = flag; if (flag2 != m_baseDisabledForPlacement) { SetBaseDisabled(flag2); } } public void StartCooldown(float seconds) { if (m_baseDisabledForPlacement) { SetBaseDisabled(wantDisabled: false); } if (seconds > 0f) { m_cooldown = Mathf.Max(m_cooldown, seconds); } } private static Bounds CalculateBounds(GameObject root) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) Renderer[] componentsInChildren = root.GetComponentsInChildren(true); bool flag = false; Bounds result = default(Bounds); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!(val is ParticleSystemRenderer)) { if (!flag) { result = val.bounds; flag = true; } else { ((Bounds)(ref result)).Encapsulate(val.bounds); } } } if (!flag) { ((Bounds)(ref result))..ctor(root.transform.position, new Vector3(0.4f, 1.8f, 0.4f)); } return result; } private void SetBaseDisabled(bool wantDisabled) { m_baseDisabledForPlacement = wantDisabled; Collider[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren(true); Collider[] array; if (wantDisabled) { m_baseColliderBackup.Clear(); array = componentsInChildren; foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && (Object)(object)val != (Object)(object)m_platformCollider && val.enabled) { m_baseColliderBackup[val] = true; val.enabled = false; } } return; } array = componentsInChildren; foreach (Collider val2 in array) { if (!((Object)(object)val2 == (Object)null) && (Object)(object)val2 != (Object)(object)m_platformCollider) { if (m_baseColliderBackup.TryGetValue(val2, out var value)) { val2.enabled = value; } else if (!val2.enabled) { val2.enabled = true; } } } m_baseColliderBackup.Clear(); } public static Cesyribingzhong FindByWorldPosition(Vector3 pos) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) List list = s_all; for (int i = 0; i < list.Count; i++) { Cesyribingzhong cesyribingzhong = list[i]; if (!((Object)(object)cesyribingzhong == (Object)null) && (Object)(object)cesyribingzhong.m_platformCollider != (Object)null) { Bounds bounds = ((Collider)cesyribingzhong.m_platformCollider).bounds; if (((Bounds)(ref bounds)).Contains(pos)) { return cesyribingzhong; } } } return null; } } public class CesyriStackableWatcher : MonoBehaviour { private static Type s_unitType; private static MethodInfo s_unitFindMethod; private static MethodInfo s_guidGetter; private static FieldInfo s_guidIdField; private static CesyriStackableWatcher s_instance; private float m_injectTimer = 0.05f; private static Type s_svcLocatorType; private static Type s_gameStateMgrType; private static MethodInfo s_gameStateGetMethod; private static MethodInfo s_gameStatePropGetter; private static bool s_getServiceFail; private static MethodInfo s_cursorFindMethod; private static bool s_cursorFindFail; private static bool s_patched; private float m_globalCooldown; private static Dictionary s_neverUnitCache = new Dictionary(); private static bool s_spawnPatched; private static bool s_initPatched; public static CesyriStackableWatcher Instance => s_instance; private void Awake() { if ((Object)(object)s_instance != (Object)null && (Object)(object)s_instance != (Object)(object)this) { Object.Destroy((Object)(object)this); return; } s_instance = this; TryPatch(); } private void OnDestroy() { if ((Object)(object)s_instance != (Object)null) { s_instance = null; Cesyribingzhong.IsPlacementPhase = false; } } private void Update() { RefreshPlacementPhase(); m_globalCooldown -= Time.deltaTime; if (m_globalCooldown < 0f) { m_globalCooldown = 0f; } m_injectTimer -= Time.deltaTime; if (m_injectTimer <= 0f) { m_injectTimer = 0.15f; InjectRegisteredUnits(); } } private void InjectRegisteredUnits() { if (!Cesyribingzhong.HasRegisteredUnits) { return; } if (s_unitFindMethod == null) { Type type = Type.GetType("Landfall.TABS.Unit, Assembly-CSharp"); if (type == null) { return; } s_unitType = type; PropertyInfo property = type.GetProperty("GUID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { return; } s_guidGetter = property.GetGetMethod(nonPublic: true); if (s_guidGetter == null) { return; } FieldInfo field = property.PropertyType.GetField("m_ID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return; } s_guidIdField = field; MethodInfo method = typeof(Object).GetMethod("FindObjectsOfType", new Type[0]); if (method == null) { return; } s_unitFindMethod = method.MakeGenericMethod(type); } Array array; try { array = (Array)s_unitFindMethod.Invoke(null, null); } catch { return; } if (array == null) { return; } foreach (object item in array) { Component val = (Component)((item is Component) ? item : null); if ((Object)(object)val == (Object)null) { continue; } int guidId; try { object obj2 = s_guidGetter.Invoke(item, null); if (obj2 == null) { continue; } guidId = (int)s_guidIdField.GetValue(obj2); goto IL_0137; } catch { } continue; IL_0137: if (Cesyribingzhong.IsRegistered(guidId) && (Object)(object)val.GetComponent() == (Object)null) { val.gameObject.AddComponent(); } } } private void RefreshPlacementPhase() { bool isPlacementPhase = false; try { if (s_svcLocatorType == null) { s_svcLocatorType = Type.GetType("ServiceLocator, Assembly-CSharp"); MethodInfo methodInfo = ((s_svcLocatorType != null) ? s_svcLocatorType.GetMethod("GetService", new Type[0]) : null); if (methodInfo == null) { s_getServiceFail = true; } else { Type type = Type.GetType("Landfall.TABS.GameState.GameStateManager, Assembly-CSharp"); if (type == null) { s_getServiceFail = true; } else { s_gameStateMgrType = type; s_gameStateGetMethod = methodInfo.MakeGenericMethod(type); PropertyInfo property = type.GetProperty("GameState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { s_getServiceFail = true; } else { s_gameStatePropGetter = property.GetGetMethod(nonPublic: true); if (s_gameStatePropGetter == null) { s_getServiceFail = true; } } } } } if (!s_getServiceFail && s_gameStateGetMethod != null) { object obj = s_gameStateGetMethod.Invoke(null, null); if (obj != null && s_gameStatePropGetter != null) { object obj2 = s_gameStatePropGetter.Invoke(obj, null); if (obj2 != null && obj2.ToString() == "PlacementState") { isPlacementPhase = true; } } } } catch { s_getServiceFail = true; } if (s_getServiceFail) { try { if (s_cursorFindMethod == null && !s_cursorFindFail) { Type type2 = Type.GetType("Landfall.TABS.UnitPlacement.PlacementCursor, Assembly-CSharp"); if (type2 == null) { s_cursorFindFail = true; } else { MethodInfo method = typeof(Object).GetMethod("FindObjectsOfType", new Type[0]); if (method == null) { s_cursorFindFail = true; } else { s_cursorFindMethod = method.MakeGenericMethod(type2); } } } if (!s_cursorFindFail && s_cursorFindMethod != null && s_cursorFindMethod.Invoke(null, null) is Array { Length: >0 } array) { object? value = array.GetValue(0); Component val = (Component)((value is Component) ? value : null); if ((Object)(object)val != (Object)null && val.gameObject.activeInHierarchy) { isPlacementPhase = true; } } } catch { s_cursorFindFail = true; } } Cesyribingzhong.IsPlacementPhase = isPlacementPhase; } private void TryPatch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (!s_patched) { Harmony harmony = new Harmony("CesyriTools.MainPatch"); PatchStackPlacement(harmony); PatchNEVER(harmony); s_patched = true; } } private static void PrimaryActionOnObject_Postfix(GameObject go, Vector3 worldPosition) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (Cesyribingzhong.s_all.Count == 0) { return; } Cesyribingzhong cesyribingzhong = Cesyribingzhong.FindByWorldPosition(worldPosition); if ((Object)(object)cesyribingzhong != (Object)null) { if ((Object)(object)s_instance != (Object)null) { s_instance.m_globalCooldown = 1f; } cesyribingzhong.StartCooldown(1f); } } private void PatchStackPlacement(Harmony harmony) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown Type type = Type.GetType("Landfall.TABS.UnitPlacement.BrushBehaviourBase, Assembly-CSharp"); if (type == null) { return; } MethodInfo method = type.GetMethod("PrimaryActionOnObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(method == null)) { MethodInfo method2 = typeof(CesyriStackableWatcher).GetMethod("PrimaryActionOnObject_Prefix", BindingFlags.Static | BindingFlags.NonPublic); MethodInfo method3 = typeof(CesyriStackableWatcher).GetMethod("PrimaryActionOnObject_Postfix", BindingFlags.Static | BindingFlags.NonPublic); HarmonyMethod val = null; if (method2 != null) { val = new HarmonyMethod(method2); } HarmonyMethod val2 = null; if (method3 != null) { val2 = new HarmonyMethod(method3); } harmony.Patch((MethodBase)method, val, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private void PatchNEVER(Harmony harmony) { PatchSpawn(harmony); PatchInitializeECSUnit(harmony); } private static void InitializeECSUnit_Prefix(object __instance) { try { Component unitFromAPI = GetUnitFromAPI(__instance); if ((Object)(object)unitFromAPI == (Object)null) { return; } bool flag = CesyriNEVER.HasRegisteredUnits && CheckNEVERByGuid(unitFromAPI); if (!flag && (Object)(object)unitFromAPI.GetComponent() != (Object)null) { flag = true; } if (flag) { int instanceID = ((Object)unitFromAPI).GetInstanceID(); s_neverUnitCache[instanceID] = unitFromAPI; FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "forceSupressFromWinCondition"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, true); } } } catch { } } private static bool CheckNEVERByGuid(Component unitComp) { if (s_guidGetter == null) { PropertyInfo property = ((object)unitComp).GetType().GetProperty("GUID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { return false; } s_guidGetter = property.GetGetMethod(nonPublic: true); if (s_guidGetter == null) { return false; } } object obj = s_guidGetter.Invoke(unitComp, null); if (obj == null) { return false; } if (s_guidIdField == null) { FieldInfo[] fields = obj.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < fields.Length; i++) { if (fields[i].Name == "m_ID") { s_guidIdField = fields[i]; break; } } if (s_guidIdField == null) { return false; } } return CesyriNEVER.IsRegistered((int)s_guidIdField.GetValue(obj)); } private static void Spawn_Prefix(object __instance) { try { Type type = __instance.GetType(); GameObject val = null; string[] array = new string[7] { "UnitBase", "m_unitBase", "Prefab", "m_prefab", "UnitPrefab", "m_unitPrefab", "BasePrefab" }; for (int i = 0; i < array.Length; i++) { PropertyInfo property = type.GetProperty(array[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.PropertyType == typeof(GameObject)) { object? value = property.GetValue(__instance, null); val = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val != (Object)null) { break; } } FieldInfo field = type.GetField(array[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(GameObject)) { object? value2 = field.GetValue(__instance); val = (GameObject)((value2 is GameObject) ? value2 : null); if ((Object)(object)val != (Object)null) { break; } } } if ((Object)(object)val == (Object)null) { PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.PropertyType == typeof(GameObject)) { object? value3 = propertyInfo.GetValue(__instance, null); GameObject val2 = (GameObject)((value3 is GameObject) ? value3 : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.GetComponent() != (Object)null) { val = val2; break; } } } } if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent() == (Object)null) { return; } PropertyInfo property2 = type.GetProperty("forceNoRandomSize", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property2 != null) { property2.SetValue(__instance, true, null); return; } FieldInfo fieldInfo = AccessTools.Field(type, "forceNoRandomSize"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, true); } } catch { } } private static void InitializeECSUnit_Postfix(object __instance) { try { Component unitFromAPI = GetUnitFromAPI(__instance); if ((Object)(object)unitFromAPI == (Object)null) { return; } int instanceID = ((Object)unitFromAPI).GetInstanceID(); bool flag = s_neverUnitCache.ContainsKey(instanceID); if (!flag && (Object)(object)unitFromAPI.GetComponent() != (Object)null) { flag = true; } if (flag) { s_neverUnitCache.Remove(instanceID); FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "forceSupressFromWinCondition"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, true); } SetECSTeam(__instance); } } catch { } } private static Component GetUnitFromAPI(object apiInstance) { Type type = apiInstance.GetType(); string[] array = new string[12] { "m_unit", "m_Unit", "unit", "Unit", "m_unitObject", "m_unitComponent", "m_unitBehaviour", "unitObject", "unitComponent", "unitBehaviour", "m_targetUnit", "targetUnit" }; for (int i = 0; i < array.Length; i++) { FieldInfo fieldInfo = AccessTools.Field(type, array[i]); if (!(fieldInfo != null)) { continue; } object value = fieldInfo.GetValue(apiInstance); if (value == null) { continue; } Object val = (Object)((value is Object) ? value : null); if (val != (Object)null) { Component val2 = (Component)(object)((val is Component) ? val : null); if ((Object)(object)val2 != (Object)null) { return val2; } } } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (!(propertyInfo.PropertyType == typeof(Component)) && !(propertyInfo.PropertyType == typeof(Object))) { continue; } try { object value2 = propertyInfo.GetValue(apiInstance, null); if (value2 != null) { Component val3 = (Component)((value2 is Component) ? value2 : null); if ((Object)(object)val3 != (Object)null) { return val3; } } } catch { } } return null; } private void PatchSpawn(Harmony harmony) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown Type type = Type.GetType("Landfall.TABS.UnitBlueprint, Assembly-CSharp"); if (type == null) { return; } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method = typeof(CesyriStackableWatcher).GetMethod("Spawn_Prefix", BindingFlags.Static | BindingFlags.NonPublic); if (method == null) { return; } MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Spawn") { HarmonyMethod val = new HarmonyMethod(method); harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } s_spawnPatched = true; } private void PatchInitializeECSUnit(Harmony harmony) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown Type type = Type.GetType("Landfall.TABS.AI.UnitAPI, Assembly-CSharp"); if (type == null) { return; } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo methodInfo = null; MethodInfo[] array = methods; foreach (MethodInfo methodInfo2 in array) { if (methodInfo2.Name == "InitializeECSUnit" && methodInfo2.GetParameters().Length == 0) { methodInfo = methodInfo2; break; } } if (methodInfo == null) { array = methods; foreach (MethodInfo methodInfo3 in array) { if (methodInfo3.Name == "InitializeECSUnit") { methodInfo = methodInfo3; break; } } } if (!(methodInfo == null)) { MethodInfo method = typeof(CesyriStackableWatcher).GetMethod("InitializeECSUnit_Prefix", BindingFlags.Static | BindingFlags.NonPublic); if (method != null) { HarmonyMethod val = new HarmonyMethod(method); harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method2 = typeof(CesyriStackableWatcher).GetMethod("InitializeECSUnit_Postfix", BindingFlags.Static | BindingFlags.NonPublic); if (method2 != null) { HarmonyMethod val2 = new HarmonyMethod(method2); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } s_initPatched = true; } } private static bool PrimaryActionOnObject_Prefix() { if ((Object)(object)s_instance != (Object)null && s_instance.m_globalCooldown > 0f) { return false; } return true; } private static void SetECSTeam(object apiInstance) { try { Type type = Type.GetType("Landfall.TABS.AI.Components.Team, Assembly-CSharp"); if (type == null) { return; } FieldInfo field = type.GetField("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return; } object obj = Activator.CreateInstance(type); field.SetValue(obj, 99); FieldInfo field2 = apiInstance.GetType().GetField("m_goEntity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); object obj2 = null; if (field2 != null) { obj2 = field2.GetValue(apiInstance); } if (obj2 == null) { Component unitFromAPI = GetUnitFromAPI(apiInstance); if ((Object)(object)unitFromAPI != (Object)null) { Type type2 = Type.GetType("Unity.Entities.GameObjectEntity, Unity.Entities"); if (type2 == null) { type2 = Type.GetType("Unity.Entities.GameObjectEntity, Unity"); } if (type2 == null) { return; } obj2 = unitFromAPI.gameObject.GetComponent(type2); } } if (obj2 == null) { return; } Type type3 = obj2.GetType(); PropertyInfo property = type3.GetProperty("Entity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { return; } object value = property.GetValue(obj2, null); if (value == null) { return; } PropertyInfo property2 = type3.GetProperty("EntityManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property2 == null) { return; } object value2 = property2.GetValue(obj2, null); if (value2 == null) { return; } Type type4 = value2.GetType(); value.GetType(); MethodInfo[] methods = type4.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo methodInfo = null; MethodInfo[] array = methods; foreach (MethodInfo methodInfo2 in array) { if (methodInfo2.Name == "SetSharedComponentData" && methodInfo2.IsGenericMethodDefinition && methodInfo2.GetParameters().Length == 2) { methodInfo = methodInfo2; break; } } if (!(methodInfo == null)) { methodInfo.MakeGenericMethod(type).Invoke(value2, new object[2] { value, obj }); } } catch { } } } public class CesyriNEVER : MonoBehaviour { private static readonly HashSet s_registeredGuids = new HashSet(); public static bool HasRegisteredUnits => s_registeredGuids.Count > 0; public static void Register(uint guid) { s_registeredGuids.Add((int)guid); EnsureWatcher(); } public static bool IsRegistered(int guidId) { return s_registeredGuids.Contains(guidId); } private static void EnsureWatcher() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CesyriStackableWatcher.Instance == (Object)null) { GameObject val = (GameObject)(((object)GameObject.Find("__CesyriTools")) ?? ((object)new GameObject("__CesyriTools"))); if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } } } } } namespace UnityTools { public class PingzhangToggle : MonoBehaviour { private bool hidden; private Transform pingzhang; private void Start() { pingzhang = ((Component)this).transform.Find("pingzhang"); } private void Update() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)108) && !((Object)(object)pingzhang == (Object)null)) { hidden = !hidden; if (hidden) { pingzhang.localScale = Vector3.zero; } else { pingzhang.localScale = Vector3.one; } } } } }