Decompiled source of Powerful units v1.0.0
kejimod.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Xml; using BepInEx; using DM; using Landfall.TABS; using Landfall.TABS.AI.Components.Modifiers; using Landfall.TABS.UnitEditor; using ModdingForDummies.AssetManagement; using ModdingForDummies.TABSSimp; using SLMA; using Sirenix.Serialization; using TFBGames; using UnityEngine; using kejimod; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ModdingForDummies")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ModdingForDummies")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1619c49c-bc45-486c-bbca-6b52cef4f478")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ModdingForDummies { [BepInPlugin("kejimo1dd", "kejimod11", "1.0.0")] public class Launcher : BaseUnityPlugin { public Launcher() { Debug.Log((object)"OHHHHHHHHdfHH"); AssetImporter.Initialize(); new Main(); } } public class Main : Mod { private string comment; public Main() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0164: 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_01b2: 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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: 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_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Expected O, but got Unknown //IL_039c: Expected O, but got Unknown //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected O, but got Unknown //IL_03dc: Expected O, but got Unknown //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Expected O, but got Unknown //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Expected O, but got Unknown //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Expected O, but got Unknown //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Expected O, but got Unknown //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Expected O, but got Unknown //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Expected O, but got Unknown //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Expected O, but got Unknown //IL_0840: Unknown result type (might be due to invalid IL or missing references) //IL_084a: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Expected O, but got Unknown //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_08cb: Expected O, but got Unknown //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_0981: 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_09d3: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Expected O, but got Unknown //IL_0a93: Unknown result type (might be due to invalid IL or missing references) //IL_0a9d: Expected O, but got Unknown //IL_0b04: Unknown result type (might be due to invalid IL or missing references) //IL_0b18: Expected O, but got Unknown //IL_0b8a: Unknown result type (might be due to invalid IL or missing references) //IL_0b94: Unknown result type (might be due to invalid IL or missing references) //IL_0c0d: Unknown result type (might be due to invalid IL or missing references) //IL_0c21: Expected O, but got Unknown //IL_0c79: Unknown result type (might be due to invalid IL or missing references) //IL_0c83: Expected O, but got Unknown //IL_0c7e: Unknown result type (might be due to invalid IL or missing references) //IL_0c88: Expected O, but got Unknown //IL_0ca3: Unknown result type (might be due to invalid IL or missing references) //IL_0cad: Expected O, but got Unknown //IL_0ca8: Unknown result type (might be due to invalid IL or missing references) //IL_0cb2: Expected O, but got Unknown //IL_0ccd: Unknown result type (might be due to invalid IL or missing references) //IL_0cf3: Unknown result type (might be due to invalid IL or missing references) //IL_0d33: Unknown result type (might be due to invalid IL or missing references) //IL_0d47: Expected O, but got Unknown //IL_0d69: Unknown result type (might be due to invalid IL or missing references) //IL_0e31: Unknown result type (might be due to invalid IL or missing references) //IL_0e45: Expected O, but got Unknown //IL_1040: Unknown result type (might be due to invalid IL or missing references) //IL_104a: Expected O, but got Unknown //IL_10ba: Unknown result type (might be due to invalid IL or missing references) //IL_10ce: Expected O, but got Unknown //IL_1161: Unknown result type (might be due to invalid IL or missing references) //IL_1166: Unknown result type (might be due to invalid IL or missing references) //IL_116f: Expected O, but got Unknown //IL_1197: Unknown result type (might be due to invalid IL or missing references) //IL_11ab: Expected O, but got Unknown //IL_122b: Unknown result type (might be due to invalid IL or missing references) //IL_1231: Expected O, but got Unknown //IL_124c: Unknown result type (might be due to invalid IL or missing references) //IL_1252: Expected O, but got Unknown //IL_126d: Unknown result type (might be due to invalid IL or missing references) //IL_1273: Expected O, but got Unknown //IL_128e: Unknown result type (might be due to invalid IL or missing references) //IL_1294: Expected O, but got Unknown //IL_12af: Unknown result type (might be due to invalid IL or missing references) //IL_12b5: Expected O, but got Unknown //IL_1405: Unknown result type (might be due to invalid IL or missing references) //IL_140b: Expected O, but got Unknown //IL_1426: Unknown result type (might be due to invalid IL or missing references) //IL_142c: Expected O, but got Unknown //IL_1447: Unknown result type (might be due to invalid IL or missing references) //IL_144d: Expected O, but got Unknown //IL_1468: Unknown result type (might be due to invalid IL or missing references) //IL_146e: Expected O, but got Unknown //IL_1489: Unknown result type (might be due to invalid IL or missing references) //IL_148f: Expected O, but got Unknown //IL_14f6: Unknown result type (might be due to invalid IL or missing references) //IL_14fc: Expected O, but got Unknown //IL_1517: Unknown result type (might be due to invalid IL or missing references) //IL_151d: Expected O, but got Unknown //IL_1538: Unknown result type (might be due to invalid IL or missing references) //IL_153e: Expected O, but got Unknown //IL_157f: Unknown result type (might be due to invalid IL or missing references) //IL_1593: Expected O, but got Unknown //IL_15b0: Unknown result type (might be due to invalid IL or missing references) //IL_1605: Unknown result type (might be due to invalid IL or missing references) //IL_160a: Unknown result type (might be due to invalid IL or missing references) //IL_161c: Unknown result type (might be due to invalid IL or missing references) //IL_162e: Unknown result type (might be due to invalid IL or missing references) //IL_1640: Unknown result type (might be due to invalid IL or missing references) //IL_167e: Unknown result type (might be due to invalid IL or missing references) //IL_1683: Unknown result type (might be due to invalid IL or missing references) //IL_169f: Unknown result type (might be due to invalid IL or missing references) //IL_16ed: Unknown result type (might be due to invalid IL or missing references) //IL_16f7: Unknown result type (might be due to invalid IL or missing references) //IL_177d: Unknown result type (might be due to invalid IL or missing references) //IL_1783: Unknown result type (might be due to invalid IL or missing references) comment = "modsfgsfgjuia"; Mod.DEV_MODE = false; Assembly executingAssembly = Assembly.GetExecutingAssembly(); Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("kejimod.dzhishennnnjs"); AssetBundle val = AssetBundle.LoadFromStream(manifestResourceStream); Stream manifestResourceStream2 = executingAssembly.GetManifestResourceStream("kejimod.nihongpaixi"); AssetBundle val2 = AssetBundle.LoadFromStream(manifestResourceStream2); Texture2D val3 = val2.LoadAsset<Texture2D>("kejippp"); ((Texture)val3).filterMode = (FilterMode)0; Sprite val4 = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f)); Texture2D val5 = val2.LoadAsset<Texture2D>("jiguangta"); ((Texture)val5).filterMode = (FilterMode)0; Sprite val6 = Sprite.Create(val5, new Rect(0f, 0f, (float)((Texture)val5).width, (float)((Texture)val5).height), new Vector2(0.5f, 0.5f)); Texture2D val7 = val2.LoadAsset<Texture2D>("xingyunlieyan"); ((Texture)val7).filterMode = (FilterMode)0; Sprite val8 = Sprite.Create(val7, new Rect(0f, 0f, (float)((Texture)val7).width, (float)((Texture)val7).height), new Vector2(0.5f, 0.5f)); Texture2D val9 = val2.LoadAsset<Texture2D>("fuchouzhenn"); ((Texture)val9).filterMode = (FilterMode)0; Sprite val10 = Sprite.Create(val9, new Rect(0f, 0f, (float)((Texture)val9).width, (float)((Texture)val9).height), new Vector2(0.5f, 0.5f)); Texture2D val11 = val2.LoadAsset<Texture2D>("nihongjujuishou1"); ((Texture)val11).filterMode = (FilterMode)0; Sprite val12 = Sprite.Create(val11, new Rect(0f, 0f, (float)((Texture)val11).width, (float)((Texture)val11).height), new Vector2(0.5f, 0.5f)); Texture2D val13 = val2.LoadAsset<Texture2D>("leitaipaoo"); ((Texture)val13).filterMode = (FilterMode)0; Sprite val14 = Sprite.Create(val13, new Rect(0f, 0f, (float)((Texture)val13).width, (float)((Texture)val13).height), new Vector2(0.5f, 0.5f)); Texture2D val15 = val2.LoadAsset<Texture2D>("zhishengji"); ((Texture)val15).filterMode = (FilterMode)0; Sprite val16 = Sprite.Create(val15, new Rect(0f, 0f, (float)((Texture)val15).width, (float)((Texture)val15).height), new Vector2(0.5f, 0.5f)); Texture2D val17 = val2.LoadAsset<Texture2D>("tannk1"); ((Texture)val17).filterMode = (FilterMode)0; Sprite val18 = Sprite.Create(val17, new Rect(0f, 0f, (float)((Texture)val17).width, (float)((Texture)val17).height), new Vector2(0.5f, 0.5f)); Texture2D val19 = val2.LoadAsset<Texture2D>("anzhiemo"); ((Texture)val19).filterMode = (FilterMode)0; Sprite val20 = Sprite.Create(val19, new Rect(0f, 0f, (float)((Texture)val19).width, (float)((Texture)val19).height), new Vector2(0.5f, 0.5f)); SLMATool.CreateFaction("科技", (UnitBlueprint[])null, val4, 30025); UnitBlueprint val21 = SLMATool.CreateUnit("激光塔", (UnitBlueprint)null, (Faction)SLMATool.SLMADic["科技"], val6); UnitBlueprint val22 = SLMATool.CreateUnit("星云烈焰", (UnitBlueprint)null, (Faction)SLMATool.SLMADic["科技"], val8); UnitBlueprint val23 = SLMATool.CreateUnit("复仇者", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_RENAISSANCE_MUSKET"], (Faction)SLMATool.SLMADic["科技"], val10); UnitBlueprint val24 = SLMATool.CreateUnit("赛博狙击手", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_RENAISSANCE_MUSKET"], (Faction)SLMATool.SLMADic["科技"], val12); UnitBlueprint val25 = SLMATool.CreateUnit("擂台炮", (UnitBlueprint)null, (Faction)SLMATool.SLMADic["科技"], val14); UnitBlueprint val26 = SLMATool.CreateUnit("蓝鹰直升机", (UnitBlueprint)null, (Faction)SLMATool.SLMADic["科技"], val16); UnitBlueprint val27 = SLMATool.CreateUnit("无畏战车", (UnitBlueprint)null, (Faction)SLMATool.SLMADic["科技"], val18); UnitBlueprint val28 = SLMATool.CreateUnit("暗之恶魔", (UnitBlueprint)null, (Faction)SLMATool.SLMADic["科技"], val20); val21.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val21.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val21.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val22.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val22.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val22.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val23.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val23.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val23.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val24.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val24.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val24.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val25.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val25.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val25.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val26.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val26.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val26.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val27.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val27.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val27.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val28.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val28.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val28.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); GameObject val29 = UPool.MyPool.AddObject("老太战车1", val2.LoadAsset<GameObject>("hafukkkzhanche"), true, (HideFlags)52, (Sprite)null, 892332, true); ((Component)((Component)val29.transform.Find("Rigidbodies")).transform.Find("Top")).gameObject.AddComponent<炮弹发射>().poj1 = (GameObject)SLMALoader.SDic["projectiles"]["P_Rocket"]; GameObject val30 = UPool.MyPool.AddObject("老太战车2", val2.LoadAsset<GameObject>("jiqiangjjjqiaj"), true, (HideFlags)52, (Sprite)null, 892333, true); RangeWeapon componentInChildren = val30.GetComponentInChildren<RangeWeapon>(); ((Weapon)componentInChildren).attackSpeedM = ((Weapon)componentInChildren).attackSpeedM * 5f; val30.transform.localScale = new Vector3(0.5f, 0.5f, 0.8f); val27.RightWeapon = val30; val27.UnitBase = val29; val27.sizeMultiplier *= 0.5f; val27.health = 50000f; val27.massMultiplier *= 3f; val27.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) }; val27.forceCost = 11000u; val27.SetField<UnitBlueprint>("VoicePitch", 0.5f); GameObject val31 = UPool.MyPool.AddObject("直升机机炮子弹爆炸", (GameObject)SLMALoader.SDic["explosions"]["E_ExplosionSamuraiGiant"], true, (HideFlags)52, (Sprite)null, 792382, true); val31.GetComponentInChildren<Explosion>().ignoreRoot = true; ParticleSystemRenderer[] componentsInChildren = val31.GetComponentsInChildren<ParticleSystemRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).material = new Material((Material)SLMALoader.SDic["materials"]["M_viking_ice_Transparent"]) { color = new Color(3.5f, 1.5f, 0.3f, 0.8f) }; Transform transform = ((Component)componentsInChildren[i]).transform; transform.localScale *= 0.5f; } val31.AddComponent<三秒后消失2>(); GameObject val32 = UPool.MyPool.AddObject("直升机机炮子弹", (GameObject)SLMALoader.SDic["projectiles"]["P_Explosive_Bullet"], true, (HideFlags)52, (Sprite)null, 792381, true); val32.GetComponentInChildren<ProjectileHit>().objectsToSpawn = (ObjectToSpawn[])(object)new ObjectToSpawn[1] { new ObjectToSpawn { objectToSpawn = val31 } }; GameObject val33 = UPool.MyPool.AddObject("蓝鹰直升机机炮", val2.LoadAsset<GameObject>("jiqiangjjjqiaj"), true, (HideFlags)52, (Sprite)null, 791381, true); val33.AddComponent<武器跟随>(); val33.GetComponentInChildren<RangeWeapon>().ObjectToSpawn = val32; GameObject val34 = UPool.MyPool.AddObject("蓝鹰直升机模型", val.LoadAsset<GameObject>("ZHshengjiq"), true, (HideFlags)52, (Sprite)null, 792383, true); ((Component)val34.transform.Find("Rigidbodies").Find("Scale").Find("Base") .Find("luoxuanjiang")).gameObject.AddComponent<旋转111>().jiaodu = new Vector3(0f, 0f, 20f); ((Component)val34.transform.Find("Rigidbodies").Find("Scale").Find("Base") .Find("xiaoluoxuanjianf")).gameObject.AddComponent<旋转111>().jiaodu = new Vector3(0f, 0f, 20f); val34.AddComponent<直升机飞行>().PROJ1 = (GameObject)SLMALoader.SDic["projectiles"]["P_Rocket"]; ((Component)val34.transform.Find("Rigidbodies").Find("Scale").Find("Base")).GetComponentInChildren<Rigidbody>().angularDrag = 4f; Rigidbody componentInChildren2 = ((Component)val34.transform.Find("Rigidbodies").Find("Scale").Find("Base")).GetComponentInChildren<Rigidbody>(); componentInChildren2.mass *= 5f; val34.AddComponent<死亡爆炸>().explosion1 = (GameObject)SLMALoader.SDic["explosions"]["E_Leg_TankExplo"]; val26.UnitBase = val34; val26.RightWeapon = val33; val26.health = 400f; val26.forceCost = 6000u; val26.SetField<UnitBlueprint>("VoicePitch", 0.5f); GameObject val35 = UPool.MyPool.AddObject("爆炸船bom55231", (GameObject)SLMALoader.SDic["explosions"]["E_MagicMissileSmite"], true, (HideFlags)52, (Sprite)null, 892330, true); val35.AddComponent<paodangaicaizhi爆炸该>(); Explosion componentInChildren3 = val35.GetComponentInChildren<Explosion>(); componentInChildren3.radius *= 3f; val35.GetComponentInChildren<Explosion>().damage = 900f; val35.AddComponent<三秒后消失2>(); GameObject val36 = val2.LoadAsset<GameObject>("leitai"); val36.AddComponent<三秒后消失2擂台用>().计时 = 9f; val36.AddComponent<擂台登场>(); val36.AddComponent<paodangaicaizhi擂台该>(); Transform transform2 = val36.transform; transform2.localScale *= 0.5f; GameObject val37 = UPool.MyPool.AddObject("nihongdapao炮弹模型", val2.LoadAsset<GameObject>("nihongpaodan"), true, (HideFlags)52, (Sprite)null, 792380, true); val37.AddComponent<paodangaicaizhi>(); val37.AddComponent<生成擂台>().擂台模型 = val36; val37.GetComponentInChildren<生成擂台>().爆炸 = val35; GameObject val38 = UPool.MyPool.AddObject("擂台冠军模型", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, (Sprite)null, 792391, true); val38.AddComponent<三秒后消失2擂台用>().计时 = 9f; val38.AddComponent<秒后趋势>(); val38.AddComponent<paodangaicaizhi擂台该>(); TeamColor[] componentsInChildren2 = val38.GetComponentsInChildren<TeamColor>(); foreach (TeamColor val39 in componentsInChildren2) { val39.redMaterial = new Material((Material)SLMALoader.SDic["materials"]["M_viking_ice_Transparent"]); val39.blueMaterial = new Material((Material)SLMALoader.SDic["materials"]["M_viking_ice_Transparent"]); val39.redMaterial.color = new Color(8f, 1f, 1f, 0.2f); val39.blueMaterial.color = new Color(1f, 1f, 8f, 0.2f); } GameObject val40 = UPool.MyPool.AddObject("霓虹拳套", (GameObject)SLMALoader.SDic["weapons"]["Leg_SuperBoxer_W"], true, (HideFlags)52, (Sprite)null, 831923, true); val40.GetComponentInChildren<MeleeWeapon>().forceCurve = ((GameObject)SLMALoader.SDic["weapons"]["Leg_SuperP_W"]).GetComponentInChildren<MeleeWeapon>().forceCurve; ((Weapon)val40.GetComponentInChildren<MeleeWeapon>()).maxRange = 9f; UnitBlueprint val41 = SLMATool.CreateUnit("擂台冠军", (UnitBlueprint)null, (Faction)null, (Sprite)null); val41.SetField<UnitBlueprint>("VocalRef", "Misc Attack Vocals/Crow"); val41.SetField<UnitBlueprint>("DeathRef", "Misc Attack Vocals/Crow"); val41.SetField<UnitBlueprint>("footRef", "Misc Attack Vocals/Crow"); val41.RightWeapon = val40; val41.LeftWeapon = val40; val41.health = 999999f; val41.UnitBase = val38; val37.GetComponentInChildren<生成擂台>().unit4 = val41; GameObject val42 = UPool.MyPool.AddObject("nihongdapao", (GameObject)SLMALoader.SDic["weapons"]["CannonBallBomb"], true, (HideFlags)52, (Sprite)null, 792392, true); val42.GetComponentInChildren<RangeWeapon>().ObjectToSpawn = val37; GameObject val43 = UPool.MyPool.AddObject("nihongdapao模型", val2.LoadAsset<GameObject>("ninongdapzoa"), true, (HideFlags)52, (Sprite)null, 792390, true); ((Component)val43.transform.Find("Rigidbodies").Find("Scale").Find("Wheels") .Find("WheelFR") .Find("CP_Pirate_Cannon_Wheel_R") .Find("lunzi") .Find("huanxing")).gameObject.AddComponent<gaicaizhi>(); ((Component)val43.transform.Find("Rigidbodies").Find("Scale").Find("Wheels") .Find("WheelFL") .Find("CP_Pirate_Cannon_Wheel_L") .Find("lunzi") .Find("huanxing")).gameObject.AddComponent<gaicaizhi>(); ((Component)val43.transform.Find("Rigidbodies").Find("Scale").Find("Base") .Find("CP_Pirate_Cannon001") .Find("CP_Pirate_Cannon_Pipe") .Find("paohuai") .Find("paotouzhuangshi")).gameObject.AddComponent<gaicaizhi>(); GameObject val44 = UPool.MyPool.AddObject("nihongjiguangta模型", val2.LoadAsset<GameObject>("nihongjiguangta"), true, (HideFlags)52, (Sprite)null, 792393, true); ((Component)val44.transform.Find("Rigidbodies").Find("Base").Find("nihongjiguanmgtasssss") .Find("waihuan")).gameObject.AddComponent<gaicaizhi>(); ((Component)val44.transform.Find("Rigidbodies").Find("Base").Find("nihongjiguanmgtasssss") .Find("qiuqiuaa")).gameObject.AddComponent<gaicaizhi>(); val44.AddComponent<激光塔攻击>().project1 = (GameObject)SLMALoader.SDic["projectiles"]["P_GatlingGunNeon"]; val25.UnitBase = val43; val25.RightWeapon = val42; val25.forceCost = 4000u; val21.UnitBase = val44; val21.health = 100f; ChineseLibrary.技能设置(val21, (GameObject[])(object)new GameObject[0]); val21.forceCost = 100u; GameObject val45 = UPool.MyPool.AddObject("霓虹爆炸", (GameObject)SLMALoader.SDic["explosions"]["E_ExplosionSamuraiGiant"], true, (HideFlags)52, (Sprite)null, 792382, true); val45.GetComponentInChildren<Explosion>().ignoreRoot = true; val45.GetComponentInChildren<Explosion>().ignoreTeamMates = true; Explosion componentInChildren4 = val45.GetComponentInChildren<Explosion>(); componentInChildren4.radius *= 2f; val45.GetComponentInChildren<Explosion>().damage = 2000f; val45.AddComponent<paodangaicaizhi粒子该>(); GameObject val46 = UPool.MyPool.AddObject("穿透弹", val2.LoadAsset<GameObject>("nononchuantoudan"), true, (HideFlags)52, (Sprite)null, 792394, true); val46.AddComponent<paodangaicaizhi>(); val46.AddComponent<paodangaicaizhi粒子该>(); val46.GetComponentInChildren<ProjectileHit>().objectsToSpawn = (ObjectToSpawn[])(object)new ObjectToSpawn[1] { new ObjectToSpawn { objectToSpawn = val45 } }; GameObject val47 = UPool.MyPool.AddObject("霓虹狙击枪", (GameObject)SLMALoader.SDic["weapons"]["Kar98k"], true, (HideFlags)52, (Sprite)null, 792395, true); val47.GetComponentInChildren<RangeWeapon>().ObjectToSpawn = val46; val47.AddComponent<gaicaizhi霓虹狙击枪该>(); ((Weapon)val47.GetComponentInChildren<RangeWeapon>()).internalCooldown = 10f; val47.GetComponentInChildren<RangeWeapon>().reloadTime = 0f; RangeWeapon componentInChildren5 = val47.GetComponentInChildren<RangeWeapon>(); ((Weapon)componentInChildren5).maxRange = ((Weapon)componentInChildren5).maxRange * 2f; val24.RightWeapon = val47; val24.m_props = (GameObject[])(object)new GameObject[5] { (GameObject)SLMALoader.SDic["clothes"]["BulletProofVest005"], (GameObject)SLMALoader.SDic["clothes"]["Hoodie001"], (GameObject)SLMALoader.SDic["clothes"]["Boots001"], (GameObject)SLMALoader.SDic["clothes"]["Pants001 1"], (GameObject)SLMALoader.SDic["clothes"]["BionicEye001"] }; val24.forceCost = 3500u; GameObject rightWeapon = UPool.MyPool.AddObject("霓虹喷火器", val2.LoadAsset<GameObject>("pinhuoqiiiiii"), true, (HideFlags)52, (Sprite)null, 792397, true); GameObject val48 = UPool.MyPool.AddObject("星云烈焰", val2.LoadAsset<GameObject>("xingyunllllieyan"), true, (HideFlags)52, (Sprite)null, 494762, true); GameObject val49 = UPool.MyPool.AddObject("星云烈焰长袍", val2.LoadAsset<GameObject>("mofachangpao"), true, (HideFlags)52, (Sprite)null, 494763, true); GameObject val50 = UPool.MyPool.AddObject("大法师的帽子", val2.LoadAsset<GameObject>("xingyunfasgutou"), true, (HideFlags)52, (Sprite)null, 494764, true); GameObject unitBase = UPool.MyPool.AddObject("暗之恶魔模型", val2.LoadAsset<GameObject>("anzhimoguiwuexi"), true, (HideFlags)52, (Sprite)null, 494765, true); GameObject val51 = UPool.MyPool.AddObject("暗之恶魔武器", val2.LoadAsset<GameObject>("dakkkpwutexiao"), true, (HideFlags)52, (Sprite)null, 494766, true); GameObject val52 = UPool.MyPool.AddObject("暗之恶魔武器子弹", val2.LoadAsset<GameObject>("anmowuqiprojeee"), true, (HideFlags)52, (Sprite)null, 494767, true); val23.RightWeapon = rightWeapon; val23.m_props = (GameObject[])(object)new GameObject[5] { (GameObject)SLMALoader.SDic["clothes"]["BulletProofVest005"], (GameObject)SLMALoader.SDic["clothes"]["Hoodie001"], (GameObject)SLMALoader.SDic["clothes"]["Boots001"], (GameObject)SLMALoader.SDic["clothes"]["Pants001 1"], (GameObject)SLMALoader.SDic["clothes"]["BionicEye001"] }; val23.health = 1000f; val23.forceCost = 2700u; val22.RightWeapon = val48; val22.LeftWeapon = val48; val22.holdinigWithTwoHands = false; val22.m_props = (GameObject[])(object)new GameObject[5] { val49, val50, (GameObject)SLMALoader.SDic["clothes"]["good_gauntlet_pants001"], (GameObject)SLMALoader.SDic["clothes"]["Good_Timeninja_PTshoes001"], (GameObject)SLMALoader.SDic["clothes"]["WitchHat001"] }; val22.health = 500f; val22.forceCost = 2000u; GameObject val53 = UPool.MyPool.AddObject("暗之迷雾", (GameObject)SLMALoader.SDic["moves"]["Fog"], true, (HideFlags)52, (Sprite)null, 347121, true); val53.GetComponentInChildren<ParticleSystem>().startColor = new Color(0f, 0f, 0f, 0.1f); val53.GetComponentInChildren<ParticleSystem>().startLifetime = 5f; val53.GetComponentInChildren<ParticleSystem>().maxParticles = 8000; val53.GetComponentInChildren<ParticleSystem>().startSize = 1000f; ParticleSystem[] componentsInChildren3 = val53.GetComponentsInChildren<ParticleSystem>(); for (int k = 0; k < componentsInChildren3.Length; k++) { ForceOverLifetimeModule forceOverLifetime = componentsInChildren3[k].forceOverLifetime; ((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled = true; ((ForceOverLifetimeModule)(ref forceOverLifetime)).x = MinMaxCurve.op_Implicit(0f); ((ForceOverLifetimeModule)(ref forceOverLifetime)).y = MinMaxCurve.op_Implicit(0f); ((ForceOverLifetimeModule)(ref forceOverLifetime)).z = MinMaxCurve.op_Implicit(0f); } ParticleSystem[] componentsInChildren4 = val53.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val54 in componentsInChildren4) { ShapeModule shape = val53.GetComponentInChildren<ParticleSystem>().shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).box = new Vector3(1800f, 0f, 1800f); } val28.UnitBase = unitBase; ((Weapon)val51.GetComponentInChildren<RangeWeapon>()).internalCooldown = 50f; ((Weapon)val51.GetComponentInChildren<RangeWeapon>()).maxRange = 99999f; Transform transform3 = val52.transform; transform3.localScale *= 2f; val52.GetComponentInChildren<ProjectileHit>().damage = 900f; val51.AddComponent<暗魔攻击>().project1 = val52; val28.RightWeapon = val51; val28.LeftWeapon = val51; val28.health = 20000f; val28.sizeMultiplier *= 2f; val28.forceCost = 20000u; ChineseLibrary.技能设置(val28, (GameObject[])(object)new GameObject[1] { val53 }); val28.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(KeepRangedDistance) }; } } public static class Utilities { private static readonly string[] sanitizationFilter; private static readonly Dictionary<GearType, string[]> boneDictionary; public static readonly Quaternion blenderToUnity; public static readonly string rootPath; public static Dictionary<string, string> language; public static readonly ContentDatabase fullDatabase; public static readonly LandfallContentDatabase database; public static Explosion[] explosions; public static UnitEffectBase[] effects; public static Sprite[] sprites; public static readonly ModExplosion unitSpawner; public static readonly ModFaction baseFaction; static Utilities() { //IL_0236: 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_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) sanitizationFilter = new string[33] { "Icon_Legacy_", "Icons_128x128_", "Icons_", "Icon_", "CP_", "P_", "E_", " Prefabs_VB", " Effects_VB", "_1", "_2", "_3", " (1)", " (2)", " (3)", " (4)", " (5)", " (6)", "B_", "Move_", "Leg_", "1_", "12_", "15_", "6__", "7_", "14_", "2_", "8_", "10_", "16_", "5_", "3_" }; boneDictionary = new Dictionary<GearType, string[]> { { (GearType)0, new string[1] { "M_Head" } }, { (GearType)1, new string[1] { "M_Neck" } }, { (GearType)2, new string[2] { "M_Shoulder_Right", "M_Shoulder_Left" } }, { (GearType)3, new string[1] { "M_Torso" } }, { (GearType)4, new string[2] { "M_Arm_Right", "M_Arm_Left" } }, { (GearType)5, new string[2] { "M_Wrist_Right", "M_Wrist_Left" } }, { (GearType)7, new string[1] { "M_Waist" } }, { (GearType)8, new string[2] { "M_Leg_Right", "M_Leg_Left" } }, { (GearType)9, new string[2] { "M_Foot_Right", "M_Foot_Left" } } }; blenderToUnity = Quaternion.Euler(-90f, 0f, 0f); rootPath = Directory.GetParent(Assembly.GetExecutingAssembly().Location)?.ToString(); language = Localizer.GetLanguage((Language)0); fullDatabase = ContentDatabase.Instance(); database = ContentDatabase.Instance().LandfallContentDatabase; explosions = Resources.FindObjectsOfTypeAll<Explosion>(); effects = Resources.FindObjectsOfTypeAll<UnitEffectBase>(); sprites = Resources.FindObjectsOfTypeAll<Sprite>(); unitSpawner = new ModExplosion(Mod.PoolObject(new GameObject("UnitSpawner", new Type[1] { typeof(UnitSpawner) }))); List<string> source = (from z in (from z in language group z by z.Value into z where z.Count() > 1 select z).SelectMany((IGrouping<string, KeyValuePair<string, string>> z) => z) select z.Key).ToList(); Dictionary<string, int> dictionary = new Dictionary<string, int>(); foreach (string item in source.Where((string v) => language[v] != null && language[v] != string.Empty)) { if (!dictionary.ContainsKey(language[item])) { dictionary.Add(language[item], 1); continue; } dictionary[language[item]]++; language[item] = language[item] + " " + dictionary[language[item]]; } Faction val = Object.Instantiate<Faction>(GetFaction("Medieval")); val.Entity.GenerateNewID(); val.Entity.Name = "Base Faction"; val.Units = Array.Empty<UnitBlueprint>(); val.index = database.GetFactions().ToList().Count; val.m_FactionColor = HexColor("#888888"); val.m_displayFaction = false; AddFactionToDatabase(val); baseFaction = new ModFaction(val); if (Mod.DEV_MODE) { string text = Path.Combine(rootPath, "MFDPrints"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string contents = string.Join(Environment.NewLine, from GameObject weapon in database.GetWeapons() where (Object)(object)weapon != (Object)null select GetProperName(((CharacterItem)weapon.GetComponentInChildren<WeaponItem>()).Entity.Name)); File.WriteAllText(Path.Combine(text, "weapons.txt"), contents); string contents2 = string.Join(Environment.NewLine, from GameObject unitBase in database.GetUnitBases() where (Object)(object)unitBase != (Object)null select GetProperName(unitBase.GetComponentInChildren<Unit>().Entity.Name)); File.WriteAllText(Path.Combine(text, "bases.txt"), contents2); string contents3 = string.Join(Environment.NewLine, from GameObject clothing in database.GetCharacterProps() where (Object)(object)clothing != (Object)null select GetProperName(((CharacterItem)clothing.GetComponentInChildren<PropItem>()).Entity.Name)); File.WriteAllText(Path.Combine(text, "clothing.txt"), contents3); string contents4 = string.Join(Environment.NewLine, from IDatabaseEntity unit in database.GetUnitBlueprints() select GetProperName(unit.Entity.Name)); File.WriteAllText(Path.Combine(text, "unit.txt"), contents4); string contents5 = string.Join(Environment.NewLine, from IDatabaseEntity faction in database.GetFactions() select GetProperName(faction.Entity.Name)); File.WriteAllText(Path.Combine(text, "factions.txt"), contents5); string contents6 = string.Join(Environment.NewLine, from Explosion explosion in explosions where (Object)(object)explosion != (Object)null select GetProperName(((Object)((Component)explosion).gameObject).name)); File.WriteAllText(Path.Combine(text, "explosions.txt"), contents6); string contents7 = string.Join(Environment.NewLine, from UnitEffectBase effect in effects where (Object)(object)effect != (Object)null select GetProperName(((Object)((Component)effect).gameObject).name)); File.WriteAllText(Path.Combine(text, "effects.txt"), contents7); string contents8 = string.Join(Environment.NewLine, from GameObject projectile in database.GetProjectiles() select GetProperName(projectile.GetComponentInChildren<ProjectileEntity>().Entity.Name)); File.WriteAllText(Path.Combine(text, "projectiles.txt"), contents8); string contents9 = string.Join(Environment.NewLine, from GameObject move in database.GetCombatMoves() select GetProperName(((CharacterItem)move.GetComponentInChildren<SpecialAbility>()).Entity.Name)); File.WriteAllText(Path.Combine(text, "moves.txt"), contents9); string contents10 = string.Join(Environment.NewLine, from FactionIcon icon in fullDatabase.GetFactionIcons() select GetProperName(icon.Entity.Name)); File.WriteAllText(Path.Combine(text, "icons.txt"), contents10); string contents11 = string.Join(Environment.NewLine, from Sprite icon in Resources.FindObjectsOfTypeAll<Sprite>() select GetProperName(((Object)icon).name)); File.WriteAllText(Path.Combine(text, "iconsExtra.txt"), contents11); } } public static object CallMethod(this object o, string methodName, params object[] args) { MethodInfo method = o.GetType().GetMethod(methodName, (BindingFlags)(-1)); if (method != null) { return method.Invoke(o, args); } Debug.Log((object)("Call Method " + methodName + " nulled")); return null; } public static object GetField<T>(this T instance, string fieldName, BindingFlags flags = (BindingFlags)(-1)) { FieldInfo field = typeof(T).GetField(fieldName, flags); try { field.GetValue(instance); } catch { Debug.Log((object)$"(GetField) Failed to get field '{fieldName}' for object '{typeof(T)}'. Try using manual BindingFlags."); } return field.GetValue(instance); } public static void SetField<T>(this T instance, string fieldName, object newValue, BindingFlags flags = (BindingFlags)(-1)) { FieldInfo field = typeof(T).GetField(fieldName, flags); Debug.Log((object)field); try { field.SetValue(instance, newValue); } catch { Debug.Log((object)$"(SetField) Failed to set field '{fieldName}' for object '{typeof(T)}'. Try using manual BindingFlags."); } } public static Transform SetHideFlagsChildren(this Transform t, HideFlags hf = 52) { //IL_0017: 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) if (Object.op_Implicit((Object)(object)((Component)t).gameObject)) { ((Object)((Component)t).gameObject).hideFlags = hf; } if (t.childCount > 0) { for (int i = 0; i < t.childCount; i++) { t.GetChild(i).SetHideFlagsChildren(hf); } } return t; } public static Sprite CreateSprite(string path) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(path)) { return null; } if (!File.Exists(path)) { return null; } byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(1, 1); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)0; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f), 1f); } public static bool NullCheck(this object self, string flag = "Object") { Debug.Log((object)("[NULLCHECK] " + flag + " is " + ((self == null) ? "NULL" : "REAL") + "!")); return self == null; } public static T GetResourcesObj<T>(string obj) { Object[] source = Resources.FindObjectsOfTypeAll(typeof(T)); return (T)(object)((IEnumerable<Object>)source).FirstOrDefault((Func<Object, bool>)((Object x) => x.name.Contains(obj))); } public static string IncrementName(string name) { return name.Contains(";") ? (name.Split(new char[1] { ';' })[0] + int.Parse(name.Split(new char[1] { ';' })[1]) + 1) : (name + ";1"); } public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action) { foreach (T item in collection) { action(item); } } public static void ForEach<T>(this T[] array, Action<T> action) { foreach (T obj in array) { action(obj); } } public static Dictionary<V, U> Reverse<U, V>(this Dictionary<U, V> self) { Dictionary<V, U> dictionary = new Dictionary<V, U>(); foreach (U key in self.Keys) { dictionary[self[key]] = key; } return dictionary; } public static Color HexColor(string hexCode) { //IL_002c: 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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) hexCode = (hexCode.StartsWith("#") ? hexCode : ("#" + hexCode)).ToUpper(); Color result = default(Color); ColorUtility.TryParseHtmlString(hexCode, ref result); return result; } public static T FindVanillaObject<T>(IEnumerable<T> source, string name, Func<T, string> getName) { return source.FirstOrDefault((T o) => name == GetProperName(getName(o))); } public static string GetProperName(string name) { string text = null; if (language.ContainsKey(name)) { text = language[name]; } else { text = name; string[] array = sanitizationFilter; foreach (string oldValue in array) { text = text.Replace(oldValue, ""); } } return text; } public static string DeepString(this GameObject self) { string text = "\nGameObject '" + ((Object)self).name + "':\n{\n\tComponents:\n\t{\n"; text = string.Concat(text, string.Concat(from Component component in self.GetComponents<Component>() select "\t\t" + ((object)component).GetType().Name + "\n")); text += "\t}\n"; if (self.transform.childCount > 0) { text += "\tChildren:\n\t{\n"; text = string.Concat(text, string.Concat(from Transform child in (IEnumerable)self.transform select ((Component)child).gameObject.DeepString().Replace("\n", "\n\t\t"))); text += "\n\t}\n"; } return text + "}\n"; } public static void PlaceMeshOnBone(SkinnedMeshRenderer renderer, GameObject mesh, GearType gearType) { //IL_0006: 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_006b: Unknown result type (might be due to invalid IL or missing references) string text = boneDictionary[gearType][0]; Transform[] bones = renderer.bones; foreach (Transform val in bones) { if (((Object)val).name == text) { mesh.transform.parent = ((Component)val).transform; mesh.transform.localPosition = Vector3.zero; mesh.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); } } } public static void SetMeshRenderers(GameObject gameObject, bool enabled) { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Type type = ((object)componentsInChildren[i]).GetType(); if (type == typeof(MeshRenderer) || type == typeof(SkinnedMeshRenderer)) { componentsInChildren[i].enabled = enabled; } } } public static void SetObjectColor(GameObject colorObject, int index, Color color, float glow) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) Renderer[] bestRenderers = GetBestRenderers(colorObject); Renderer bestRenderer = GetBestRenderer(colorObject); bool flag = (Object)(object)colorObject.GetComponentInChildren<LODGroup>() != (Object)null; Dictionary<Color, Material> dictionary = new Dictionary<Color, Material>(); Material[] materials = bestRenderer.materials; Material val = new Material(Shader.Find("Standard")); val.color = color; if (glow > 0f) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", val.color * glow); } val.SetFloat("_Glossiness", 0f); if (!Object.op_Implicit((Object)(object)bestRenderer)) { return; } for (int j = 0; j < materials.Length; j++) { if (j == index) { dictionary[materials[j].color] = val; } } if (bestRenderers == null || bestRenderers.Length == 0) { return; } if (flag) { Renderer[] array = bestRenderers; foreach (Renderer val2 in array) { List<TeamColor> source = ((Component)val2).GetComponents<TeamColor>().ToList(); List<TeamColor> removed = new List<TeamColor>(); Material[] materials2 = val2.materials; List<Material> list = new List<Material>(); int i; for (i = 0; i < materials2.Length; i++) { Material val3 = null; if (dictionary.ContainsKey(materials2[i].color)) { val3 = dictionary[materials2[i].color]; } if ((Object)(object)val3 != (Object)null) { list.Add(val3); foreach (TeamColor item in source.Where((TeamColor tc) => !removed.Contains(tc) && tc.materialID == i)) { removed.Add(item); Object.DestroyImmediate((Object)(object)item); } } else { list.Add(materials2[i]); } } val2.materials = list.ToArray(); } return; } int num = 0; Renderer[] array2 = bestRenderers; foreach (Renderer val4 in array2) { Material[] materials3 = val4.materials; List<TeamColor> list2 = ((Component)val4).GetComponents<TeamColor>().ToList(); for (int m = 0; m < materials3.Length; m++) { if (num + m != index) { continue; } materials3[m] = val; foreach (TeamColor item2 in list2) { if (item2.materialID == m) { Object.DestroyImmediate((Object)(object)item2); } } } num++; val4.materials = materials3; } } public static void SetClothScale(ModClothing clothing, Vector3 scale) { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0118: 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_013c: 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_015f: 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_017c: 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_01a1: Unknown result type (might be due to invalid IL or missing references) GameObject internalObject = clothing.internalObject; if ((Object)(object)internalObject.GetComponentInChildren<MeshRenderer>() != (Object)null) { MeshRenderer[] componentsInChildren = internalObject.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { ((Component)val).transform.localScale = scale; } } if (!((Object)(object)internalObject.GetComponentInChildren<SkinnedMeshRenderer>() != (Object)null)) { return; } Vector3 localScale = internalObject.transform.localScale; SkinnedMeshRenderer[] componentsInChildren2 = internalObject.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { val2.sharedMesh = Object.Instantiate<Mesh>(val2.sharedMesh); Mesh sharedMesh = val2.sharedMesh; ((Object)sharedMesh).name = clothing.Name + "sharedmesh"; Vector3[] vertices = sharedMesh.vertices; if (vertices == null) { vertices = sharedMesh.vertices; } Debug.Log((object)("baseVertices " + vertices.Length)); Vector3[] array = (Vector3[])(object)new Vector3[vertices.Length]; for (int k = 0; k < array.Length; k++) { Vector3 val3 = vertices[k]; val3.x /= localScale.x; val3.y /= localScale.y; val3.z /= localScale.z; val3.x *= scale.x; val3.y *= scale.y; val3.z *= scale.z; array[k] = val3; } internalObject.transform.localScale = scale; sharedMesh.vertices = array; sharedMesh.RecalculateBounds(); val2.sharedMesh = sharedMesh; } } public static Renderer GetBestRenderer(GameObject gameObject, Type rendererType = null) { if (rendererType == null) { rendererType = typeof(Renderer); } else if (!rendererType.IsSubclassOf(typeof(Renderer))) { return null; } Renderer val = null; Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(); bool flag = false; Renderer[] array = componentsInChildren; foreach (Renderer val2 in array) { if (((object)val2).GetType() == rendererType || rendererType == typeof(Renderer)) { string name = ((Object)((Component)val2).gameObject).name; if (name.Contains("LOD0")) { val = val2; flag = true; } else if (name.Contains("CP_") && !flag) { val = val2; flag = true; } else if (name.ToLower().Contains(((Object)gameObject.gameObject).name.ToLower()) && !flag) { val = val2; } else if (!Object.op_Implicit((Object)(object)val) && name != "RightHand" && name != "LeftHand" && !flag) { val = val2; } } } return val; } public static Renderer[] GetBestRenderers(GameObject gameObject, Type rendererType = null) { if (rendererType == null) { rendererType = typeof(Renderer); } else if (!rendererType.IsSubclassOf(typeof(Renderer))) { return null; } Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(); List<Renderer> list = new List<Renderer>(); bool flag = false; LODGroup componentInChildren = gameObject.GetComponentInChildren<LODGroup>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { flag = true; list.AddRange(componentInChildren.GetLODs().SelectMany((LOD lod) => lod.renderers)); } Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!list.Contains(val) && (((object)val).GetType() == rendererType || rendererType == typeof(Renderer))) { string name = ((Object)gameObject).name; if (name.Contains("LOD") && ((Object)((Component)val).transform.parent).name.ToLower().Contains("base")) { list.Add(val); flag = true; } else if (name.Contains("LOD")) { list.Add(val); flag = true; } else if (name.Contains("CP_") && !flag) { list.Add(val); flag = true; } else if (name.ToLower().Contains(((Object)gameObject).name.ToLower()) && !flag) { list.Add(val); } else if (list.Count <= 0 && name != "RightHand" && name != "LeftHand" && !flag) { list.Add(val); } } } return list.ToArray(); } public static GameObject GetUnitBase(string name) { return FindVanillaObject(database.GetUnitBases(), name, (GameObject ub) => ub.GetComponentInChildren<Unit>().Entity.Name); } public static GameObject GetClothing(string name) { return FindVanillaObject(database.GetCharacterProps(), name, (GameObject c) => ((CharacterItem)c.GetComponentInChildren<PropItem>()).Entity.Name); } public static GameObject GetWeapon(string name) { return FindVanillaObject(database.GetWeapons(), name, (GameObject w) => ((CharacterItem)w.GetComponentInChildren<WeaponItem>()).Entity.Name); } public static GameObject GetMove(string name) { return FindVanillaObject(database.GetCombatMoves(), name, (GameObject m) => ((CharacterItem)m.GetComponentInChildren<SpecialAbility>()).Entity.Name); } public static GameObject GetProjectile(string name) { GameObject gameObject = FindVanillaObject(database.GetProjectiles(), name, (GameObject p) => p.GetComponent<ProjectileEntity>().Entity.Name).gameObject; return ((Object)(object)gameObject != (Object)null) ? gameObject.gameObject : null; } public static GameObject GetExplosion(string name) { Explosion val = FindVanillaObject(explosions, name, (Explosion e) => ((Object)((Component)e).gameObject).name); return ((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null; } public static UnitEffectBase GetEffect(string name) { return FindVanillaObject(effects, name, (UnitEffectBase e) => ((Object)((Component)e).gameObject).name); } public static Sprite GetIcon(string name) { FactionIcon val = FindVanillaObject(fullDatabase.GetFactionIcons(), name, (FactionIcon i) => i.Entity.Name); if ((Object)(object)val != (Object)null) { return val.Entity.SpriteIcon; } Sprite val2 = FindVanillaObject(AssetImporter.Sprites, name, (Sprite s) => ((Object)s).name); if ((Object)(object)val2 != (Object)null) { return val2; } return FindVanillaObject(sprites, name, (Sprite s) => ((Object)s).name); } public static UnitBlueprint GetUnit(string name) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) UnitBlueprint val = FindVanillaObject(database.GetUnitBlueprints(), name, (UnitBlueprint u) => u.Entity.Name); return ((Object)(object)val != (Object)null) ? database.GetUnitBlueprint(val.Entity.GUID) : null; } public static Faction GetFaction(string name) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) Faction val = FindVanillaObject(database.GetFactions(), name, (Faction f) => f.Entity.Name); return ((Object)(object)val != (Object)null) ? database.GetFaction(val.Entity.GUID) : null; } public static void AddUnitToDatabase(UnitBlueprint unit) { //IL_0059: 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_0085: Unknown result type (might be due to invalid IL or missing references) Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(fullDatabase.AssetLoader); Dictionary<DatabaseID, UnitBlueprint> dictionary2 = (Dictionary<DatabaseID, UnitBlueprint>)typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(database); if (!dictionary2.ContainsKey(unit.Entity.GUID)) { dictionary2.Add(unit.Entity.GUID, unit); dictionary.Add(unit.Entity.GUID, (Object)(object)unit); } typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(database, dictionary2); typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(fullDatabase.AssetLoader, dictionary); } public static void AddFactionToDatabase(Faction faction) { //IL_0059: 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_0085: Unknown result type (might be due to invalid IL or missing references) Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(fullDatabase.AssetLoader); Dictionary<DatabaseID, Faction> dictionary2 = (Dictionary<DatabaseID, Faction>)typeof(LandfallContentDatabase).GetField("m_factions", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(database); if (!dictionary2.ContainsKey(faction.Entity.GUID)) { dictionary2.Add(faction.Entity.GUID, faction); dictionary.Add(faction.Entity.GUID, (Object)(object)faction); } typeof(LandfallContentDatabase).GetField("m_factions", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(database, dictionary2); typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(fullDatabase.AssetLoader, dictionary); } public static GameObject GetModel(string name) { GameObject val = FindVanillaObject(AssetImporter.Models, name, (GameObject m) => ((Object)m.gameObject).name); return ((Object)(object)val != (Object)null) ? val.gameObject : null; } public static void SetFlagsChildren(Transform child, HideFlags flag) { //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) ((Object)((Component)child).gameObject).hideFlags = flag; for (int i = 0; i < child.childCount; i++) { SetFlagsChildren(child.GetChild(i), flag); } } } } namespace ModdingForDummies.TABSSimp { public abstract class Mod { private const string KEY_BASES = "bases"; private const string KEY_UNITS = "units"; private const string KEY_FACTIONS = "factions"; private const string KEY_WEAPONS = "weapons"; private const string KEY_CLOTHES = "clothes"; private const string KEY_PROJECTILES = "projectiles"; private const string KEY_MOVES = "moves"; private const string KEY_EXPLOSIONS = "explosions"; private const string KEY_ICONS = "icons"; private const string KEY_EFFECTS = "effects"; private const string KEY_MODELS = "models"; private static Dictionary<string, Dictionary<string, object>> vanilla; private static Dictionary<string, Dictionary<string, object>> modified; private static GameObject pool; public static bool DEV_MODE { get; protected set; } static Mod() { //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown DEV_MODE = true; vanilla = new Dictionary<string, Dictionary<string, object>>(); modified = new Dictionary<string, Dictionary<string, object>>(); vanilla["bases"] = new Dictionary<string, object>(); vanilla["units"] = new Dictionary<string, object>(); vanilla["factions"] = new Dictionary<string, object>(); vanilla["weapons"] = new Dictionary<string, object>(); vanilla["clothes"] = new Dictionary<string, object>(); vanilla["projectiles"] = new Dictionary<string, object>(); vanilla["moves"] = new Dictionary<string, object>(); vanilla["explosions"] = new Dictionary<string, object>(); vanilla["icons"] = new Dictionary<string, object>(); vanilla["effects"] = new Dictionary<string, object>(); vanilla["models"] = new Dictionary<string, object>(); modified["bases"] = new Dictionary<string, object>(); modified["units"] = new Dictionary<string, object>(); modified["factions"] = new Dictionary<string, object>(); modified["weapons"] = new Dictionary<string, object>(); modified["clothes"] = new Dictionary<string, object>(); modified["projectiles"] = new Dictionary<string, object>(); modified["moves"] = new Dictionary<string, object>(); modified["explosions"] = new Dictionary<string, object>(); modified["icons"] = new Dictionary<string, object>(); modified["effects"] = new Dictionary<string, object>(); modified["models"] = new Dictionary<string, object>(); GameObject val = new GameObject("Pool") { hideFlags = (HideFlags)61 }; val.transform.position = Vector3.down * -1000f; pool = val; pool.SetActive(false); } public static GameObject PoolObject(GameObject gameObject) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) gameObject.transform.parent = pool.transform; gameObject.transform.localPosition = Vector3.zero; pool.transform.SetHideFlagsChildren((HideFlags)61); return gameObject; } public static GameObject CloneAndPoolObject(GameObject obj) { GameObject val = Object.Instantiate<GameObject>(obj, pool.transform); PoolObject(val); return val; } private static M CreateObject<M>(string key, Func<string, M> query, Action<M> processClone, string name, string originalName) where M : ModdingClass<M> { M val = null; M val2 = query(originalName); if (val2 != null) { val = val2.Clone(); processClone?.Invoke(val); val.Name = name; modified[key][name] = val; } return val; } private static M GetObject<M, R>(string key, Func<string, R> query, Func<R, M> generate, string name) { M val = default(M); if (modified[key].ContainsKey(name)) { val = (M)modified[key][name]; } else if (vanilla[key].ContainsKey(name)) { val = (M)vanilla[key][name]; } else { R val2 = query(name); if (val2 != null) { val = generate(val2); vanilla[key][name] = val; } } if (val == null) { Debug.LogError((object)("[MFD] Could not find '" + name + "' in '" + key + "'.")); } return val; } public static ModUnit GetUnit(string name) { return GetObject("units", Utilities.GetUnit, (UnitBlueprint u) => new ModUnit(u), name); } public static ModUnit CreateUnit(string name, string originalName = null) { return CreateObject("units", GetUnit, delegate(ModUnit mu) { if (originalName == null) { mu.Clothes.Clear(); } }, name, (originalName == null) ? "Peasant" : originalName); } public static ModFaction GetFaction(string name) { return GetObject("factions", Utilities.GetFaction, (Faction f) => new ModFaction(f), name); } public static ModFaction CreateFaction(string name, string originalName = null) { return CreateObject("factions", GetFaction, delegate(ModFaction mf) { mf.Units.Clear(); mf.Visible = true; }, name, (originalName == null) ? "Base Faction" : originalName); } public static ModWeapon GetWeapon(string name) { return GetObject("weapons", Utilities.GetWeapon, (GameObject w) => new ModWeapon(w), name); } public static ModWeapon CreateWeapon(string name, string originalName) { return CreateObject("weapons", GetWeapon, null, name, originalName); } public static ModClothing GetClothing(string name) { return GetObject("clothes", Utilities.GetClothing, (GameObject c) => new ModClothing(c), name); } public static ModClothing CreateClothing(string name, string originalName) { return CreateObject("clothes", GetClothing, null, name, originalName); } public static ModMove GetMove(string name) { return GetObject("moves", Utilities.GetMove, (GameObject m) => new ModMove(m), name); } public static ModMove CreateMove(string name, string originalName) { return CreateObject("moves", GetMove, null, name, originalName); } public static ModProjectile GetProjectile(string name) { return GetObject("projectiles", Utilities.GetProjectile, (GameObject p) => new ModProjectile(p), name); } public static ModProjectile CreateProjectile(string name, string originalName) { return CreateObject("projectiles", GetProjectile, null, name, originalName); } public static ModExplosion GetExplosion(string name) { return GetObject("explosions", Utilities.GetExplosion, (GameObject e) => new ModExplosion(e), name); } public static ModExplosion CreateExplosion(string name, string originalName) { return CreateObject("explosions", GetExplosion, null, name, originalName); } public static ModEffect GetEffect(string name) { return GetObject("effects", Utilities.GetEffect, (UnitEffectBase e) => new ModEffect(e), name); } public static ModEffect CreateEffect(string name, string originalName) { return CreateObject("effects", GetEffect, null, name, originalName); } public static ModBase GetBase(string name) { return GetObject("bases", Utilities.GetUnitBase, (GameObject b) => new ModBase(b), name); } public static ModBase CreateBase(string name, string originalName) { return CreateObject("bases", GetBase, null, name, originalName); } public static ModModel GetModel(string name) { return GetObject("models", Utilities.GetModel, (GameObject m) => new ModModel(m), name); } public static ModModel CreateModel(string name, string originalName) { return CreateObject("models", GetModel, null, name, originalName); } public static Sprite GetIcon(string name) { return GetObject("icons", Utilities.GetIcon, (Sprite s) => s, name); } } public class ModBase : ModdingClass<ModBase> { public GameObject internalObject { get; private set; } public override string Name { get { return ((Object)internalObject.gameObject).name; } set { ((Object)internalObject.gameObject).name = value; } } public override void ColorInternal(int index, Color color, float glow = 0f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Utilities.SetObjectColor(internalObject, index, color, glow); } public ModBase(GameObject unitBase) { internalObject = unitBase; } public override ModBase Clone() { GameObject unitBase = Mod.CloneAndPoolObject(internalObject); return new ModBase(unitBase); } public override void Separate() { } } public enum ClothingType { Static, Skinned } public class ModClothing : ModdingClass<ModClothing> { private PropItem item; private SkinnedMeshRenderer renderer; private ModModel model; public GameObject internalObject { get; private set; } public ClothingType Type { get; private set; } public override string Name { get { return ((CharacterItem)item).Entity.Name; } set { ((CharacterItem)item).Entity.Name = value; } } public ModModel Model { get { return model; } set { //IL_0065: 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_00c2: Unknown result type (might be due to invalid IL or missing references) if (value != null) { Utilities.SetMeshRenderers(internalObject, enabled: false); model = value.Clone(); if (Type == ClothingType.Static) { model.internalObject.transform.parent = internalObject.transform; model.internalObject.transform.localPosition = Vector3.zero; model.internalObject.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); } else if (Type == ClothingType.Skinned) { Utilities.PlaceMeshOnBone(renderer, model.internalObject, ((CharacterItem)item).GearT); } } else { if (model != null) { Utilities.SetMeshRenderers(internalObject, enabled: true); } model = null; } } } public float Size { get { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) Vector3 localScale = internalObject.transform.localScale; return (localScale.x + localScale.y + localScale.z) / 3f; } set { //IL_0001: 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) Utilities.SetClothScale(this, Vector3.one * value); } } public Vector3 Scale { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return internalObject.transform.localScale; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Utilities.SetClothScale(this, value); } } public override void ColorInternal(int index, Color color, float glow = 0f) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (model == null) { Utilities.SetObjectColor(internalObject, index, color, glow); } else { model.Color(index, color, glow); } } public ModClothing(GameObject prop) { internalObject = Mod.CloneAndPoolObject(prop); renderer = internalObject.GetComponentInChildren<SkinnedMeshRenderer>(); Type = (((Object)(object)renderer != (Object)null) ? ClothingType.Skinned : ClothingType.Static); item = internalObject.GetComponentInChildren<PropItem>(); } public override ModClothing Clone() { ModClothing modClothing = new ModClothing(internalObject) { Model = Model }; modClothing.Separate(); return modClothing; } public override void Separate() { } } public abstract class ModdingClass<T> where T : ModdingClass<T> { public abstract string Name { get; set; } public abstract T Clone(); public abstract void Separate(); public abstract void ColorInternal(int index, Color color, float glow = 0f); public void Color(Color color, float glow = 0f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ColorInternal(0, color, glow); } public void Color(string color, float glow = 0f) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) Color(0, Utilities.HexColor(color), glow); } public void Color(int index, Color color, float glow = 0f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ColorInternal(index, color, glow); } public void Color(int index, string color, float glow = 0f) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) Color(index, Utilities.HexColor(color), glow); } public void Colors(params Color[] colors) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < colors.Length; i++) { Color(i, colors[i]); } } public void Colors(params string[] colors) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < colors.Length; i++) { Color(i, Utilities.HexColor(colors[i])); } } public void Colors(params (Color color, float glow)[] colors) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < colors.Length; i++) { Color(i, colors[i].color, colors[i].glow); } } public void Colors(params (string color, float glow)[] colors) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < colors.Length; i++) { Color(i, Utilities.HexColor(colors[i].color), colors[i].glow); } } } public class ModEffect : ModdingClass<ModEffect> { public UnitEffectBase internalObject { get; private set; } public override string Name { get { return ((Object)((Component)internalObject).gameObject).name; } set { ((Object)((Component)internalObject).gameObject).name = value; } } public override void ColorInternal(int index, Color color, float glow = 0f) { } public ModEffect(UnitEffectBase effect) { internalObject = effect; } public override ModEffect Clone() { GameObject val = Mod.CloneAndPoolObject(((Component)internalObject).gameObject); return new ModEffect(val.GetComponent<UnitEffectBase>()); } public override void Separate() { } } public class ModExplosion : ModdingClass<ModExplosion> { private Explosion explosion; private ExplosionAddEffect addEffect; private ModEffect effect; public GameObject internalObject { get; private set; } public override string Name { get { return ((Object)internalObject).name; } set { ((Object)internalObject).name = value; } } public float Damage { get { if (Object.op_Implicit((Object)(object)explosion)) { return explosion.damage; } return 0f; } set { if (Object.op_Implicit((Object)(object)explosion)) { explosion.damage = value; } } } public float Force { get { if (Object.op_Implicit((Object)(object)explosion)) { return explosion.force; } return 0f; } set { if (Object.op_Implicit((Object)(object)explosion)) { explosion.force = value; } } } public ForceDirection ForceDirection { get { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0022: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)explosion)) { return explosion.forceDirection; } return (ForceDirection)0; } set { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)explosion)) { explosion.forceDirection = value; } } } public float Radius { get { if (Object.op_Implicit((Object)(object)explosion)) { return explosion.radius; } return 0f; } set { if (Object.op_Implicit((Object)(object)explosion)) { explosion.radius = value; } } } public ModEffect Effect { get { return effect; } set { effect = value; if (!Object.op_Implicit((Object)(object)addEffect)) { addEffect = internalObject.AddComponent<ExplosionAddEffect>(); } if (value != null) { addEffect.EffectPrefab = value.internalObject; } else { addEffect.EffectPrefab = null; } } } public float Size { get { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) Vector3 localScale = internalObject.transform.localScale; return (localScale.x + localScale.y + localScale.z) / 3f; } set { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) internalObject.transform.localScale = Vector3.one * value; } } public Vector3 Scale { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return internalObject.transform.localScale; } set { //IL_000b: Unknown result type (might be due to invalid IL or missing references) internalObject.transform.localScale = value; } } public override void ColorInternal(int index, Color color, float glow = 0f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Utilities.SetObjectColor(internalObject, index, color, glow); } public ModExplosion(GameObject explosionObject) { internalObject = explosionObject; explosion = internalObject.GetComponentInChildren<Explosion>(); addEffect = internalObject.GetComponentInChildren<ExplosionAddEffect>(); } public override ModExplosion Clone() { GameObject explosionObject = Mod.CloneAndPoolObject(internalObject); ModExplosion modExplosion = new ModExplosion(explosionObject); if (Effect != null) { modExplosion.Effect = Effect; } return modExplosion; } public override void Separate() { if (Effect != null) { Effect = Effect.Clone(); } } } public class ModFaction : ModdingClass<ModFaction> { public Faction internalObject { get; private set; } public WrapperDelineation<ModUnit> Units { get; private set; } public UnitBlueprint[] Blueprints => Units.List.Select((ModUnit w) => w.internalObject).ToArray(); public override string Name { get { return internalObject.Entity.Name; } set { internalObject.Entity.Name = value; } } public bool Visible { get { return internalObject.m_displayFaction; } set { internalObject.m_displayFaction = value; } } public Sprite Icon { get { return internalObject.Entity.SpriteIcon; } set { internalObject.Entity.SetSpriteIcon(value); } } private void UpdateBlueprints(List<ModUnit> units) { internalObject.Units = (from ModUnit unit in units select unit.internalObject).ToArray(); } public ModUnit NewUnit(string name, string originalName = null) { ModUnit modUnit = Mod.CreateUnit(name, originalName); Units.Add(modUnit); return modUnit; } public override void ColorInternal(int index, Color color, float glow = 0f) { //IL_0006: 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) internalObject.m_FactionColor = color; } public ModFaction(Faction faction) { internalObject = faction; Units = new WrapperDelineation<ModUnit>(UpdateBlueprints, Mod.GetUnit) { List = (from UnitBlueprint blueprint in internalObject.Units select new ModUnit(blueprint)).ToList() }; } public override ModFaction Clone() { Faction val = Object.Instantiate<Faction>(internalObject); val.Entity.GenerateNewID(); val.Entity.Name = Utilities.IncrementName(Name); val.Units = Array.Empty<UnitBlueprint>(); val.index = Utilities.database.GetFactions().ToList().Count; Utilities.AddFactionToDatabase(val); ModFaction modFaction = new ModFaction(val); modFaction.Separate(); return modFaction; } public override void Separate() { Units.List = (from ModUnit unit in Units.List select unit.Clone()).ToList(); } } public class ModModel : ModdingClass<ModModel> { private Vector3 position; private Quaternion rotation; public GameObject internalObject { get; private set; } public override string Name { get { return ((Object)internalObject.gameObject).name; } set { ((Object)internalObject.gameObject).name = value; } } public Vector3 Position { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return position; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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) position = value; internalObject.transform.localPosition = position; } } public Quaternion Rotation { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return rotation; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) rotation = value; internalObject.transform.localRotation = Utilities.blenderToUnity * rotation; } } public override void ColorInternal(int index, Color color, float glow = 0f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Utilities.SetObjectColor(internalObject, index, color, glow); } public ModModel(GameObject model) { internalObject = model; } public override ModModel Clone() { GameObject model = Mod.CloneAndPoolObject(internalObject); return new ModModel(model); } public override void Separate() { } } public class ModMove : ModdingClass<ModMove> { private SpecialAbility specialAbility; public GameObject internalObject { get; private set; } public override string Name { get { return ((CharacterItem)specialAbility).Entity.Name; } set { ((CharacterItem)specialAbility).Entity.Name = value; } } public override void ColorInternal(int index, Color color, float glow = 0f) { } public ModMove(GameObject move) { internalObject = move; specialAbility = move.GetComponentInChildren<SpecialAbility>(); } public override ModMove Clone() { GameObject move = Mod.CloneAndPoolObject(internalObject); return new ModMove(move); } public override void Separate() { } } public enum ProjectileType { Regular, Physical, Other } public class ModProjectile : ModdingClass<ModProjectile> { private ProjectileEntity projectileEntity; private ProjectileHit rHit; private MoveTransform rMoveTransform; private ProjectileHitAddEffect rAddEffect; private CollisionWeapon pCollision; private AddForce pAddForce; private MeleeWeaponAddEffect pAddEffect; private MeleeWeaponSpawn pSpawner; private ModModel model; private ModEffect effect; private ModUnit unit; public GameObject internalObject { get; private set; } public override string Name { get { return projectileEntity.Entity.Name; } set { projectileEntity.Entity.Name = value; } } public ProjectileType Type { get; private set; } public ModModel Model { get { return model; } set { //IL_0057: 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 (value != null) { Utilities.SetMeshRenderers(internalObject, enabled: false); model = value.Clone(); model.internalObject.transform.parent = internalObject.transform; model.internalObject.transform.localPosition = Vector3.zero; model.internalObject.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); } else { if (model != null) { Utilities.SetMeshRenderers(internalObject, enabled: true); } model = null; } } } public ModEffect Effect { get { return effect; } set { effect = value; if (Type == ProjectileType.Regular) { if (!Object.op_Implicit((Object)(object)rAddEffect)) { rAddEffect = ((Component)rHit).gameObject.AddComponent<ProjectileHitAddEffect>(); } rAddEffect.EffectPrefab = value?.internalObject; } else if (Type == ProjectileType.Physical) { if (!Object.op_Implicit((Object)(object)pAddEffect)) { pAddEffect = ((Component)pCollision).gameObject.AddComponent<MeleeWeaponAddEffect>(); } pAddEffect.EffectPrefab = value?.internalObject; } } } public WrapperDelineation<ModExplosion> Explosions { get; private set; } public ModExplosion Explosion { get { ModExplosion result = null; if (Explosions.List.Count > 0) { result = Explosions.List[0]; } return result; } set { Explosions.Clear(); if (value != null) { Explosions.Add(value); } } } public ModUnit Unit { get { return unit; } set { unit = value; Explosions.Clear(); ModExplosion modExplosion = Utilities.unitSpawner.Clone(); modExplosion.internalObject.GetComponent<UnitSpawner>().unitBlueprint = unit.internalObject; Explosions.Add(modExplosion); } } public float Damage { get { if (Type == ProjectileType.Regular) { return rHit.damage; } if (Type == ProjectileType.Physical) { return pCollision.damage; } return 0f; } set { if (Type == ProjectileType.Regular) { rHit.damage = value; } else if (Type == ProjectileType.Physical) { pCollision.damage = value; } } } public float Force { get { if (Type == ProjectileType.Regular) { return rHit.force; } if (Type == ProjectileType.Physical) { return pCollision.onImpactForce; } return 0f; } set { if (Type == ProjectileType.Regular) { rHit.force = value; } else if (Type == ProjectileType.Physical) { pCollision.onImpactForce = value; } } } public float Speed { get { if (Type == ProjectileType.Regular) { return rMoveTransform.selfImpulse.z; } if (Type == ProjectileType.Physical) { return pAddForce.force.z; } return 0f; } set { if (Type == ProjectileType.Regular) { rMoveTransform.selfImpulse.z = value; } else if (Type == ProjectileType.Physical) { pAddForce.force.z = value; } } } public float Size { get { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) Vector3 localScale = internalObject.transform.localScale; return (localScale.x + localScale.y + localScale.z) / 3f; } set { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) internalObject.transform.localScale = Vector3.one * value; } } public Vector3 Scale { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return internalObject.transform.localScale; } set { //IL_000b: Unknown result type (might be due to invalid IL or missing references) internalObject.transform.localScale = value; } } public void UpdateImpact(List<ModExplosion> explosions) { if (Type == ProjectileType.Regular) { rHit.objectsToSpawn = explosions.Cast<ModExplosion>().Select((Func<ModExplosion, ObjectToSpawn>)((ModExplosion explosion) => new ObjectToSpawn { objectToSpawn = explosion.internalObject })).ToArray(); } else if (Type == ProjectileType.Physical && explosions.Count > 0) { if (Object.op_Implicit((Object)(object)pSpawner)) { pSpawner.objectToSpawn = explosions[0].internalObject; return; } pSpawner = ((Component)pCollision).gameObject.AddComponent<MeleeWeaponSpawn>(); pSpawner.objectToSpawn = explosions[0].internalObject; } } public override void ColorInternal(int index, Color color, float glow = 0f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Utilities.SetObjectColor(internalObject, index, color, glow); } public ModProjectile(GameObject projectile, bool isClone = false) { internalObject = projectile; projectileEntity = internalObject.GetComponentInChildren<ProjectileEntity>(); rHit = internalObject.GetComponentInChildren<ProjectileHit>(); rMoveTransform = internalObject.GetComponentInChildren<MoveTransform>(); rAddEffect = internalObject.GetComponentInChildren<ProjectileHitAddEffect>(); pCollision = internalObject.GetComponentInChildren<CollisionWeapon>(); pAddForce = internalObject.GetComponentInChildren<AddForce>(); pAddEffect = internalObject.GetComponentInChildren<MeleeWeaponAddEffect>(); pSpawner = internalObject.GetComponentInChildren<MeleeWeaponSpawn>(); Explosions = new WrapperDelineation<ModExplosion>(UpdateImpact, Mod.GetExplosion); if (Object.op_Implicit((Object)(object)rHit)) { Type = ProjectileType.Regular; } else if (Object.op_Implicit((Object)(object)pCollision)) { Type = ProjectileType.Physical; } else { Type = ProjectileType.Other; } if (Type == ProjectileType.Regular) { ObjectToSpawn[] objectsToSpawn = rHit.objectsToSpawn; foreach (ObjectToSpawn val in objectsToSpawn) { if (val != null) { Explosions.Add(new ModExplosion(val.objectToSpawn)); } } if (Object.op_Implicit((Object)(object)rAddEffect) && Object.op_Implicit((Object)(object)rAddEffect.EffectPrefab) && !isClone) { effect = new ModEffect(rAddEffect.EffectPrefab); } } else if (Type == ProjectileType.Physical) { if (Object.op_Implicit((Object)(object)pSpawner) && Object.op_Implicit((Object)(object)pSpawner.objectToSpawn)) { Explosions.Add(new ModExplosion(pSpawner.objectToSpawn)); } if (Object.op_Implicit((Object)(object)pAddEffect) && Object.op_Implicit((Object)(object)pAddEffect.EffectPrefab) && !isClone) { effect = new ModEffect(pAddEffect.EffectPrefab); } } } public override ModProjectile Clone() { GameObject projectile = Mod.CloneAndPoolObject(internalObject); ModProjectile modProjectile = new ModProjectile(projectile, isClone: true); modProjectile.Explosions.List = Explosions.List; modProjectile.Model = Model; ModProjectile modProjectile2 = modProjectile; string name = Utilities.IncrementName(modProjectile2.projectileEntity.Entity.Name); modProjectile2.projectileEntity.Entity.Name = name; ((Object)modProjectile2.internalObject).name = name; if (Effect != null) { modProjectile2.Effect = Effect; } modProjectile2.Separate(); return modProjectile2; } public override void Separate() { if (Effect != null) { Effect = Effect.Clone(); } Explosions.List = (from ModExplosion explosion in Explosions.List select explosion.Clone()).ToList(); } } public class ModUnit : ModdingClass<ModUnit> { public class ModVoice { public UnitBlueprint internalObject { get; private set; } public string Death { get { return internalObject.voiceBundle.DeathRef; } set { internalObject.voiceBundle.DeathRef = value; } } public string Alive { get { return internalObject.voiceBundle.VocalRef; } set { internalObject.voiceBundle.VocalRef = value; } } public float Pitch { get { return internalObject.VoicePitch; } set { internalObject.VoicePitch = value; } } public ModVoice(UnitBlueprint blueprint) { internalObject = blueprint; internalObject.voiceBundle = ScriptableObject.CreateInstance<VoiceBundle>(); } } public UnitBlueprint internalObject; private ModWeapon rightWeapon; private ModWeapon leftWeapon; private ModBase unitBase; private ModUnit rider; public WrapperDelineation<ModClothing> Clothes { get; private set; } public WrapperDelineation<ModMove> Moves { get; private set; } public ModVoice Voice { get; private set; } public override string Name { get { return internalObject.Entity.Name; } set { internalObject.Entity.Name = value; } } public Sprite Icon { get { return internalObject.Entity.SpriteIcon; } set { internalObject.Entity.SetSpriteIcon(value); } } public float Health { get { return internalObject.health; } set { internalObject.health = value; } } public float Speed { get { return internalObject.movementSpeedMuiltiplier; } set { internalObject.movementSpeedMuiltiplier = value; } } public float TurnSpeed { get { return internalObject.TurnSpeed; } set { if ((Object)(object)internalObject.turningData != (Object)null) { internalObject.turningData.TurnSpeed = value; } internalObject.turnSpeed = value; } } public float Mass { get { return internalObject.massMultiplier; } set { internalObject.massMultiplier = value; } } public float Balance { get { return internalObject.balanceMultiplier; } set { internalObject.balanceMultiplier = value; } } public float BalanceStrength { get { return internalObject.balanceForceMultiplier; } set { internalObject.balanceForceMultiplier = value; } } public float Priority { get { return internalObject.targetingPriorityMultiplier; } set { internalObject.targetingPriorityMultiplier = value; } } public float Size { get { return internalObject.sizeMultiplier; } set { internalObject.sizeMultiplier = value; } } public bool TwoHanded { get { return internalObject.holdinigWithTwoHands; } set { internalObject.holdinigWithTwoHands = value; } } public int Cost { get { return (int)internalObject.GetUnitCost(true); } set { internalObject.useCustomCost = true; internalObject.customCost = value; } } public ModWeapon RightWeapon { get { return rightWeapon; } set { if (value != null) { rightWeapon = value; internalObject.RightWeapon = rightWeapon.internalObject; } } } public ModWeapon LeftWeapon { get { return leftWeapon; } set { if (value != null) { leftWeapon = value; internalObject.LeftWeapon = leftWeapon.internalObject; } } } public ModBase Base { get { return unitBase; } set { unitBase = value; internalObject.UnitBase = unitBase.internalObject; } } public Vector2 SizeRange { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) return new Vector2(internalObject.minSizeRandom, internalObject.maxSizeRandom); } set { //IL_0007: 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) internalObject.minSizeRandom = value.x; internalObject.maxSizeRandom = value.y; } } public ModUnit Rider { get { return rider; } set { rider = value; if (rider != null) { internalObject.SetField<UnitBlueprint>("Riders", new UnitBlueprint[1] { rider.internalObject }); } else { internalObject.SetField<UnitBlueprint>("Riders", Array.Empty<UnitBlueprint>()); } } } private void UpdateClothing(List<ModClothing> list) { internalObject.m_props = (from ModClothing clothing in list select clothing.internalObject).ToArray(); } private void UpdateMoves(List<ModMove> list) { internalObject.objectsToSpawnAsChildren = (from ModMove move in list select move.internalObject).ToArray(); } public override void ColorInternal(int index, Color color, float glow = 0f) { } public ModUnit(UnitBlueprint blueprint) { internalObject = blueprint; Clothes = new WrapperDelineation<ModClothing>(UpdateClothing, Mod.GetClothing); Moves = new WrapperDelineation<ModMove>(UpdateMoves, Mod.GetMove); Voice = new ModVoice(blueprint); if (internalObject.m_props != null) { Clothes.List = (from GameObject prop in internalObject.m_props where (Object)(object)prop != (Object)null select new ModClothing(prop)).ToList(); } else { internalObject.m_props = Array.Empty<GameObject>(); } if (Object.op_Implicit((Object)(object)internalObject.RightWeapon)) { RightWeapon = new ModWeapon(internalObject.RightWeapon); } if (Object.op_Implicit((Object)(object)internalObject.LeftWeapon)) { LeftWeapon = new ModWeapon(internalObject.LeftWeapon); } } public override ModUnit Clone() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) string name = Utilities.IncrementName(Name); UnitBlueprint val = Object.Instantiate<UnitBlueprint>(internalObject); val.Entity.GUID = DatabaseID.NewID(); val.Entity.Name = name; Utilities.AddUnitToDatabase(val); ModUnit modUnit = new ModUnit(val); modUnit.Clothes.List = Clothes.List; modUnit.Moves.List = Moves.List; modUnit.Rider = Rider; modUnit.Cost = Cost; ModUnit modUnit2 = modUnit; modUnit2.Separate(); return modUnit2; } public override void Separate() { if (RightWeapon != null) { RightWeapon = RightWeapon.Clone(); } if (LeftWeapon != null) { LeftWeapon = LeftWeapon.Clone(); } Clothes.List = (from ModClothing clothing in Clothes.List select clothing.Clone()).ToList(); Moves.List = (from ModMove move in Moves.List select move.Clone()).ToList(); } } public enum WeaponType { Melee, Ranged } public class ModWeapon : ModdingClass<ModWeapon> { public class ModMelee { private readonly ModWeapon internalWeapon; public float SwingSpeed { get { return (internalWeapon.Type == WeaponType.Melee) ? internalWeapon.internalMelee.curveForce : 0f; } set { if (internalWeapon.Type == WeaponType.Melee) { internalWeapon.internalMelee.curveForce = value; } } } public Vector3 SwingDirection { get { //IL_001f: 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) return (internalWeapon.Type == WeaponType.Melee) ? internalWeapon.internalMelee.swingDirection : Vector3.zero; } set { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (internalWeapon.Type == WeaponType.Melee) { internalWeapon.internalMelee.swingDirection = value; } } } public float Impact { get { return (internalWeapon.Type == WeaponType.Melee) ? internalWeapon.mCollision.impactMultiplier : 0f; } set { if (internalWeapon.Type == WeaponType.Melee) { internalWeapon.mCollision.impactMultiplier = value; } } } public ModMelee(ModWeapon weapon) { internalWeapon = weapon; } } public class ModRanged { private readonly ModWeapon internalWeapon; public ModProjectile Projectile { get { return internalWeapon.projectile; } set { if (internalWeapon.Type == WeaponType.Ranged) { internalWeapon.projectile = value; internalWeapon.internalRanged.ObjectToSpawn = internalWeapon.projectile.