Decompiled source of WarfareRemake v1.0.0
ModernWarfare/ModernWarfare.dll
Decompiled 3 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.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Logging; using DM; using HarmonyLib; using Landfall.TABS; using Landfall.TABS.AI.Components.Modifiers; using Landfall.TABS.GameMode; using Landfall.TABS.GameState; using Landfall.TABS.UnitPlacement; using TFBGames; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace ModernWarfare; public static class Content { public static readonly Dictionary<string, GameObject> Bullets = new Dictionary<string, GameObject>(); public static readonly Dictionary<string, GameObject> Ord = new Dictionary<string, GameObject>(); public static readonly List<UnitBlueprint> US = new List<UnitBlueprint>(); public static readonly List<UnitBlueprint> RU = new List<UnitBlueprint>(); public static bool Built; public static bool UsingImportedGear; private static Color C(float r, float g, float b) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new Color(r, g, b, 1f); } public static void Build() { if (!Built) { float realtimeSinceStartup = Time.realtimeSinceStartup; Registry.Init(); AssetLib.Init(); Mats.Init(); FX.Init(); Sounds.Init(); Sounds.BuildAll(); Body.Calibrate(); if (Plugin.DevOutput) { Body.DumpDev(Plugin.DevDir); } Gear.Init(); Weapons.Init(); BuildBullets(); BuildOrdnance(); BuildInfantry(); try { British.BuildInfantry(); } catch (Exception ex) { Plugin.Log.LogError((object)("british infantry failed: " + ex)); } try { Marines.Build(); } catch (Exception ex2) { Plugin.Log.LogError((object)("marines failed: " + ex2)); } try { Vehicles.Build(); } catch (Exception ex3) { Plugin.Log.LogError((object)("vehicles failed: " + ex3)); } try { Aircraft.Build(); } catch (Exception ex4) { Plugin.Log.LogError((object)("aircraft failed: " + ex4)); } try { Vehicles.BuildNaval(); } catch (Exception ex5) { Plugin.Log.LogError((object)("naval failed: " + ex5)); } try { Fortifications.Build(); } catch (Exception ex6) { Plugin.Log.LogError((object)("fortifications failed: " + ex6)); } try { Specials.Build(); } catch (Exception ex7) { Plugin.Log.LogError((object)("specials failed: " + ex7)); } try { Police.Build(); } catch (Exception ex8) { Plugin.Log.LogError((object)("police failed: " + ex8)); } try { Uniforms.ApplyInsignia(); } catch (Exception ex9) { Plugin.Log.LogError((object)("insignia failed: " + ex9)); } try { Tracers.ApplyToShells(Ord); } catch (Exception ex10) { Plugin.Log.LogError((object)("shell tracers failed: " + ex10)); } BuildFactions(); CloneFix.RegisterAll(); Built = true; Plugin.Log.LogInfo((object)$"Modern Warfare content built in {Time.realtimeSinceStartup - realtimeSinceStartup:0.00}s: {Registry.OurUnits.Count} units, {Weapons.All.Count} weapons, {Gear.Props.Count} props"); } } private static void BuildBullets() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) Color tracer = C(1f, 0.42f, 0.22f); Color tracer2 = C(0.45f, 1f, 0.4f); Color tracer3 = C(1f, 0.85f, 0.6f); Bullets["556"] = Weapons.Bullet("556", 55f, 230f, 6f, 1500f, 3f, 8f, 0f, tracer, 0.05f, 1); Bullets["545"] = Weapons.Bullet("545", 52f, 230f, 6f, 1400f, 3f, 7f, 0f, tracer2, 0.05f, 1); Bullets["762R"] = Weapons.Bullet("762x54R", 85f, 240f, 6f, 2600f, 3.4f, 12f, 4f, tracer2, 0.07f, 2); Bullets["762N"] = Weapons.Bullet("762x51", 150f, 260f, 5f, 4000f, 3.3f, 12f, 4f, tracer, 0.06f, 2); Bullets["SVD"] = Weapons.Bullet("762x54R_sniper", 175f, 260f, 5f, 4500f, 3.6f, 13f, 5f, tracer2, 0.06f, 2); Bullets["50"] = Weapons.Bullet("50BMG", 650f, 300f, 4f, 12000f, 7.5f, 32f, 90f, tracer, 0.1f, 3); Bullets["9mm"] = Weapons.Bullet("9mm", 35f, 180f, 8f, 900f, 1f, 2f, 0f, tracer3, 0.03f, 1); Bullets["12ga"] = Weapons.Bullet("12ga", 24f, 170f, 9f, 700f, 0.8f, 1f, 0f, tracer3, 0.02f, 1); Bullets["9x39"] = Weapons.Bullet("9x39", 75f, 200f, 7f, 1600f, 3.2f, 8f, 0f, C(0.8f, 0.8f, 0.8f), 0.025f, 1); Bullets["127"] = Weapons.Bullet("127HMG", 320f, 280f, 4f, 8000f, 7f, 28f, 70f, tracer2, 0.11f, 2); Bullets["50HMG"] = Weapons.Bullet("50HMG", 320f, 280f, 4f, 8000f, 7f, 28f, 70f, tracer, 0.11f, 2); Bullets["coaxN"] = Weapons.Bullet("762coaxN", 85f, 240f, 6f, 2400f, 3.3f, 10f, 4f, tracer, 0.07f, 2); Bullets["coaxR"] = Weapons.Bullet("762coaxR", 85f, 240f, 6f, 2400f, 3.4f, 10f, 4f, tracer2, 0.07f, 2); } public static GameObject OrdPrefab(string key, MB model, Action<Ordnance> cfg) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown GameObject val = Prefabs.New("MW_O_" + key); if (model != null) { GameObject val2 = new GameObject("Model"); val2.transform.SetParent(val.transform, false); val2.AddComponent<MeshFilter>().sharedMesh = model.ToMesh("mw_o_" + key); ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = Mats.VC; } Ordnance ordnance = val.AddComponent<Ordnance>(); ordnance.kind = key; cfg?.Invoke(ordnance); Ord[key] = val; return val; } public static MB RocketModel(float len, float r, Color body, Color nose, bool fins) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) MB mB = new MB(); mB.Paint(body).Cyl(new Vector3(0f, 0f, (0f - len) * 0.5f), new Vector3(0f, 0f, len * 0.3f), r, 8); mB.Paint(nose).Cyl(new Vector3(0f, 0f, len * 0.3f), new Vector3(0f, 0f, len * 0.5f), r, r * 0.15f, 8, capA: false, capB: true); if (fins) { for (int i = 0; i < 4; i++) { mB.Paint(body).Push().Rot(0f, 0f, (float)i * 90f) .Box(new Vector3(0f, r * 1.6f, (0f - len) * 0.42f), new Vector3(r * 0.25f, r * 1.4f, len * 0.14f)) .Pop(); } } return mB; } private static void BuildOrdnance() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) OrdPrefab("PG7VL", RocketModel(0.95f, 0.05f, Pal.RuGreen, Pal.RuGreen, fins: true), delegate(Ordnance o) { o.directDamage = 400f; o.penMM = 500f; o.heat = true; o.vehicleDamage = 900f; o.blastRadius = 2.6f; o.blastDamage = 110f; o.blastForce = 9f; o.fxSize = 1.1f; o.boomSound = "ExplM"; o.gravity = 4f; o.thrust = 40f; o.motorTime = 0.6f; o.maxSpeed = 140f; o.smoke = 0.35f; o.smokeSize = 0.35f; o.life = 5f; }); OrdPrefab("Javelin", RocketModel(1.1f, 0.065f, Pal.Olive, Pal.C(7039829), fins: true), delegate(Ordnance o) { o.directDamage = 600f; o.penMM = 760f; o.heat = true; o.tandem = true; o.vehicleDamage = 1700f; o.blastRadius = 3.2f; o.blastDamage = 220f; o.blastForce = 11f; o.fxSize = 1.5f; o.boomSound = "ExplL"; o.guide = Ordnance.Guide.TopAttack; o.turnRate = 85f; o.thrust = 60f; o.motorTime = 3f; o.maxSpeed = 95f; o.topAltitude = 30f; o.ignite = 0.35f; o.igniteSound = "ATGM"; o.smoke = 0.3f; o.smokeSize = 0.45f; o.life = 14f; }); OrdPrefab("Stinger", RocketModel(1.3f, 0.04f, Pal.C(13158592), Pal.C(7172192), fins: true), delegate(Ordnance o) { o.directDamage = 700f; o.penMM = 40f; o.vehicleDamage = 900f; o.blastRadius = 3f; o.blastDamage = 260f; o.fxSize = 0.9f; o.boomSound = "ExplM"; o.guide = Ordnance.Guide.IR; o.turnRate = 160f; o.thrust = 120f; o.motorTime = 3f; o.maxSpeed = 230f; o.proximity = 3.5f; o.flareChance = 0.5f; o.smoke = 0.3f; o.smokeSize = 0.4f; o.life = 9f; }); OrdPrefab("Igla", RocketModel(1.3f, 0.04f, Pal.RuGreen, Pal.C(2764322), fins: true), delegate(Ordnance o) { o.directDamage = 700f; o.penMM = 40f; o.vehicleDamage = 900f; o.blastRadius = 3f; o.blastDamage = 260f; o.fxSize = 0.9f; o.boomSound = "ExplM"; o.guide = Ordnance.Guide.IR; o.turnRate = 150f; o.thrust = 115f; o.motorTime = 3f; o.maxSpeed = 220f; o.proximity = 3.5f; o.flareChance = 0.45f; o.smoke = 0.3f; o.smokeSize = 0.4f; o.life = 9f; }); OrdPrefab("40mm", RocketModel(0.12f, 0.025f, Pal.Olive, Pal.Brass, fins: false), delegate(Ordnance o) { o.directDamage = 90f; o.penMM = 40f; o.heat = true; o.vehicleDamage = 60f; o.blastRadius = 3.4f; o.blastDamage = 95f; o.blastForce = 8f; o.fxSize = 0.7f; o.boomSound = "ExplS"; o.gravity = 9.8f; o.life = 6f; }); } private static GameObject G(string k) { if (!Gear.Props.TryGetValue(k, out var value)) { return null; } return value; } private static bool ImportedGear() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) if (!AssetLib.Has("h_ach")) { return false; } GearType gear = (GearType)0; Gear.ImportedProp("ach", "ACH Helmet (OCP, Comtac)", gear, "head", "h_ach", Gear.HeadFit(1f)); Gear.ImportedProp("fast", "FAST Ballistic (Foliage Green, NSW)", gear, "head", "h_fast", Gear.HeadFit(1f)); Gear.ImportedProp("heavyfast", "Heavy FAST (Shark Nose Art)", gear, "head", "h_heavyfast", Gear.HeadFit(1.08f)); Gear.ImportedProp("chops", "FAST Mandible Chops (Shark Mouth)", gear, "head", "h_chops", Gear.HeadFit(1.08f)); Gear.ImportedProp("6b47", "6B47 Ratnik Helmet (ESS)", gear, "head", "h_6b47", Gear.HeadFit(1f)); Gear.ImportedProp("6b47hs", "6B47 Ratnik Helmet", gear, "head", "h_6b47hs", Gear.HeadFit(1f)); Gear.ImportedProp("gpnvg", "GPNVG-18 Quad NVG", gear, "head", "n_gpnvg", Gear.HeadFit(1f)); Gear.ImportedProp("pvs15", "AN/PVS-15 NVG", gear, "head", "n_pvs15", Gear.HeadFit(1.08f)); Gear.ImportedProp("1pn138", "1PN138 NVG", gear, "head", "n_1pn138", Gear.HeadFit(1f)); GearType gear2 = (GearType)3; GearType gear3 = (GearType)7; Gear.ImportedProp("pc_coyote", "Plate Frame (Rifleman, Coyote)", gear2, "torso", "v_plateframe", Gear.ChestFit(1f)); Gear.ImportedProp("pc_coyote_belt", "Plate Frame Belt Kit", gear3, "hip", "v_plateframe_hip", Gear.ChestFit(1f)); Gear.ImportedProp("pc_ranger", "Plate Frame (Team Leader)", gear2, "torso", "v_sof", Gear.ChestFit(1f)); Gear.ImportedProp("pc_ranger_belt", "Team Leader Belt Kit", gear3, "hip", "v_sof_hip", Gear.ChestFit(1f)); Gear.ImportedProp("iotv", "IOTV (SAW Gunner, OCP)", gear2, "torso", "v_iotv_saw", Gear.ChestFit(1.04f)); Gear.ImportedProp("6b45", "6B45 Ratnik Vest (Rifleman)", gear2, "torso", "v_6b45", Gear.ChestFit(1f)); Gear.ImportedProp("6b45mg", "6B45 Ratnik Vest (Machine Gunner)", gear2, "torso", "v_6b45mg", Gear.ChestFit(1f)); Gear.Boots("boots_us", "Combat Boots (Coyote)", Pal.C(9204824)); Gear.Boots("boots_ru", "Combat Boots (Black)", Pal.C(2763306)); return true; } private static void BuildGear() { //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_088a: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_08bb: Unknown result type (might be due to invalid IL or missing references) Material[] mats = (Material[])(object)new Material[1] { Mats.VC }; Uniforms.Region r = new Uniforms.Region(1.22f, 1.712f, 0.86f, 0.016f, 0.36f); Uniforms.Region r2 = new Uniforms.Region(0.1f, 1.31f, 0.5f, 0.011f, 0.36f); Uniforms.Region r3 = new Uniforms.Region(1.22f, 1.712f, 0.86f, 0.016f, 0.3f); Uniforms.Region r4 = new Uniforms.Region(0.1f, 1.31f, 0.5f, 0.011f, 0.3f); if ((Object)(object)Uniforms.Make("ocp_shirt", "OCP Combat Shirt", "CP_Western_torso011", Gear.MatMulticam, r) == (Object)null) { Material matMulticam = Gear.MatMulticam; int[] camoSlots = new int[1]; Gear.Uniform("ocp_shirt", "OCP Combat Shirt", "CP_Western_torso011", matMulticam, camoSlots, dropTeamColorOnCamo: true); } if ((Object)(object)Uniforms.Make("ocp_pants", "OCP Trousers", "CP_Western_pants002", Gear.MatMulticam, r2) == (Object)null) { Material matMulticam2 = Gear.MatMulticam; int[] camoSlots2 = new int[1]; Gear.Uniform("ocp_pants", "OCP Trousers", "CP_Western_pants002", matMulticam2, camoSlots2, dropTeamColorOnCamo: true); } if ((Object)(object)Uniforms.Make("emr_shirt", "EMR Ratnik Shirt", "CP_Western_torso011", Gear.MatEMR, r3) == (Object)null) { Material matEMR = Gear.MatEMR; int[] camoSlots3 = new int[1]; Gear.Uniform("emr_shirt", "EMR Ratnik Shirt", "CP_Western_torso011", matEMR, camoSlots3, dropTeamColorOnCamo: true); } if ((Object)(object)Uniforms.Make("emr_pants", "EMR Ratnik Trousers", "CP_Western_pants002", Gear.MatEMR, r4) == (Object)null) { Material matEMR2 = Gear.MatEMR; int[] camoSlots4 = new int[1]; Gear.Uniform("emr_pants", "EMR Ratnik Trousers", "CP_Western_pants002", matEMR2, camoSlots4, dropTeamColorOnCamo: true); } if (ImportedGear()) { UsingImportedGear = true; return; } Gear.Prop("ach", "ACH Helmet (OCP)", (GearType)0, "head", Gear.Helmet(new Gear.HelmetCfg { Kind = "ACH", Headset = false }), (Material[])(object)new Material[3] { Gear.MatMulticam, Mats.VC, Mats.TeamRed }, 2); Gear.Prop("fast", "FAST SF Helmet + GPNVG-18", (GearType)0, "head", Gear.Helmet(new Gear.HelmetCfg { Kind = "FAST", NVG = true, Quad = true, Headset = true }), Gear.HelmetMats("mw_fast_rg", Pal.Ranger, shark: false, 3), 2); Gear.Prop("heavyfast", "Heavy FAST Helmet (Shark Nose Art)", (GearType)0, "head", Gear.Helmet(new Gear.HelmetCfg { Kind = "HEAVYFAST", NVG = true, Quad = false, Headset = true, Shark = true }), Gear.HelmetMats("mw_fast_shark", Pal.Coyote, shark: true, 5), 2); Gear.Prop("6b47", "6B47 Ratnik Helmet (EMR)", (GearType)0, "head", Gear.Helmet(new Gear.HelmetCfg { Kind = "6B47" }), (Material[])(object)new Material[3] { Gear.MatEMR, Mats.VC, Mats.TeamRed }, 2); Gear.Prop("6b47hs", "6B47 Helmet + Headset", (GearType)0, "head", Gear.Helmet(new Gear.HelmetCfg { Kind = "6B47", Headset = true }), (Material[])(object)new Material[3] { Gear.MatEMR, Mats.VC, Mats.TeamRed }, 2); Gear.Prop("6b47olive", "6B47 Helmet (Olive) + NVG", (GearType)0, "head", Gear.Helmet(new Gear.HelmetCfg { Kind = "6B47", Headset = true, NVG = true }), Gear.HelmetMats("mw_6b47_olive", Pal.RuGreen, shark: false, 9), 2); Gear.Prop("pc_coyote", "Plate Carrier (Coyote)", (GearType)3, "torso", Gear.Vest(new Gear.VestCfg { Kind = "PC", Cloth = Pal.Coyote, Pouch = Pal.Coyote, Strap = Pal.C(6180666), Mags = 3 }), Gear.VestMats(null), 2); Gear.Prop("pc_ranger", "SF Plate Carrier (Ranger Green)", (GearType)3, "torso", Gear.Vest(new Gear.VestCfg { Kind = "PC", Cloth = Pal.Ranger, Pouch = Pal.Ranger, Strap = Pal.C(3356459), Mags = 3, Radio = true }), Gear.VestMats(null), 2); Gear.Prop("iotv", "Heavy Armour Vest (IOTV)", (GearType)3, "torso", Gear.Vest(new Gear.VestCfg { Kind = "HEAVY", Cloth = Pal.Coyote, Pouch = Pal.Coyote, Strap = Pal.C(6180666), Mags = 0, SawPouches = true, Radio = true, Textured = true }), Gear.VestMats(Gear.MatMulticam), 2); Gear.Prop("6b45", "6B45 Ratnik Vest (EMR)", (GearType)3, "torso", Gear.Vest(new Gear.VestCfg { Kind = "RATNIK", Cloth = Pal.RuGreen, Pouch = Pal.RuGreen, Strap = Pal.C(3948585), Mags = 4, AkMags = true, Textured = true }), Gear.VestMats(Gear.MatEMR), 2); Gear.Prop("6b45mg", "6B45 Vest (MG pouches)", (GearType)3, "torso", Gear.Vest(new Gear.VestCfg { Kind = "RATNIK", Cloth = Pal.RuGreen, Pouch = Pal.RuGreen, Strap = Pal.C(3948585), Mags = 0, SawPouches = true, Radio = true, Textured = true }), Gear.VestMats(Gear.MatEMR), 2); Gear.Prop("6b45olive", "6B45 Vest (Olive, Spetsnaz)", (GearType)3, "torso", Gear.Vest(new Gear.VestCfg { Kind = "PC", Cloth = Pal.RuGreen, Pouch = Pal.RuGreen, Strap = Pal.C(2895904), Mags = 4, AkMags = true, Radio = true }), Gear.VestMats(null), 2); Gear.Prop("belt_us", "Battle Belt (M17 holster)", (GearType)7, "hip", Gear.Belt(Pal.Coyote, Pal.Coyote, holster: true, Pal.Black), mats, -1); Gear.Prop("belt_ru", "Ratnik Belt (PL-15 holster)", (GearType)7, "hip", Gear.Belt(Pal.RuGreen, Pal.RuGreen, holster: true, Pal.Black), mats, -1); Gear.Prop("groin_us", "Groin Protector", (GearType)7, "hip", Gear.Groin(Pal.Coyote), mats, -1); Gear.Prop("groin_ru", "Groin Protector (Ratnik)", (GearType)7, "hip", Gear.Groin(Pal.RuGreen), mats, -1); Gear.Prop("deltoid", "Deltoid Armour", (GearType)2, "armL", Gear.Deltoid(Pal.Coyote), mats, -1); Gear.Prop("knee_us", "Knee Pads (Coyote)", (GearType)9, "shinL", Gear.KneePad(Pal.Coyote), mats, -1); Gear.Prop("knee_ru", "Knee Pads (Black)", (GearType)9, "shinL", Gear.KneePad(Pal.Black), mats, -1); Gear.Prop("boots_us", "Combat Boots (Coyote)", (GearType)9, "shinL", Gear.Boot(Pal.C(9204824), Pal.C(3025444)), mats, -1); Gear.Prop("boots_ru", "Combat Boots (Black)", (GearType)9, "shinL", Gear.Boot(Pal.C(2500134), Pal.C(1118481)), mats, -1); Gear.Prop("gloves", "Tactical Gloves", (GearType)5, "foreL", Gear.Glove(Pal.C(3815987)), mats, -1); Gear.Prop("pack_us", "Assault Pack", (GearType)3, "torso", Gear.AssaultPack(Pal.Coyote, Pal.C(6180666)), mats, -1); Gear.Prop("pack_ru", "Ratnik Pack", (GearType)3, "torso", Gear.AssaultPack(Pal.RuGreen, Pal.C(3948585)), mats, -1); Gear.Prop("balaclava", "Balaclava", (GearType)0, "head", Gear.Balaclava(Pal.C(2829606)), mats, -1); } private static GameObject Gun(GunSpec s) { return Weapons.Gun(s); } private static void BuildInfantry() { //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) BuildGear(); Dictionary<string, GameObject> bullets = Bullets; GunSpec gunSpec = new GunSpec(); gunSpec.Key = "M4A1"; gunSpec.Display = "M4A1 Carbine (ACOG)"; gunSpec.Sound = "M4A1"; gunSpec.Model = Guns.M4A1(); gunSpec.Projectile = bullets["556"]; gunSpec.Burst = 3; gunSpec.BurstDelay = 0.075f; gunSpec.Cooldown = 0.55f; gunSpec.Mag = 10; gunSpec.Reload = 2.4f; gunSpec.Spread = 1.1f; gunSpec.Range = 48f; gunSpec.ShootRecoil = 2.5f; gunSpec.TorsoRecoil = 1.5f; gunSpec.Cost = 300; GameObject weapon = Gun(gunSpec); GunSpec gunSpec2 = new GunSpec(); gunSpec2.Key = "HK416"; gunSpec2.Display = "HK416 (SOF modified)"; gunSpec2.Sound = "HK416"; gunSpec2.Model = Guns.HK416(); gunSpec2.Projectile = bullets["556"]; gunSpec2.Burst = 4; gunSpec2.BurstDelay = 0.07f; gunSpec2.Cooldown = 0.42f; gunSpec2.Mag = 8; gunSpec2.Reload = 1.9f; gunSpec2.Spread = 0.65f; gunSpec2.Range = 52f; gunSpec2.ShootRecoil = 2f; gunSpec2.TorsoRecoil = 1.2f; gunSpec2.Cost = 500; GameObject weapon2 = Gun(gunSpec2); GunSpec gunSpec3 = new GunSpec(); gunSpec3.Key = "M249"; gunSpec3.Display = "M249 SAW"; gunSpec3.Sound = "M249"; gunSpec3.Model = Guns.M249(); gunSpec3.Projectile = bullets["556"]; gunSpec3.Burst = 8; gunSpec3.BurstDelay = 0.075f; gunSpec3.Cooldown = 0.75f; gunSpec3.Mag = 25; gunSpec3.Reload = 6.5f; gunSpec3.Spread = 2.2f; gunSpec3.Range = 50f; gunSpec3.ShootRecoil = 2f; gunSpec3.TorsoRecoil = 2.5f; gunSpec3.Mass = 11f; gunSpec3.Hold = 0.7f; gunSpec3.Heavy = true; gunSpec3.Kick = 0.02f; gunSpec3.LeftHandZ = 0.27f; gunSpec3.Cost = 600; GameObject val = Gun(gunSpec3); GunSpec gunSpec4 = new GunSpec(); gunSpec4.Key = "M110"; gunSpec4.Display = "M110A1 CSASS"; gunSpec4.Sound = "M110"; gunSpec4.Model = Guns.M110(); gunSpec4.Projectile = bullets["762N"]; gunSpec4.Burst = 1; gunSpec4.Cooldown = 1.1f; gunSpec4.Mag = 20; gunSpec4.Reload = 3.2f; gunSpec4.Spread = 0.18f; gunSpec4.Range = 85f; gunSpec4.ShootRecoil = 6f; gunSpec4.TorsoRecoil = 3f; gunSpec4.Mass = 7f; gunSpec4.Cost = 500; GameObject weapon3 = Gun(gunSpec4); GunSpec gunSpec5 = new GunSpec(); gunSpec5.Key = "M107"; gunSpec5.Display = "Barrett M107 (.50 BMG)"; gunSpec5.Sound = "M107"; gunSpec5.Model = Guns.M107(); gunSpec5.Projectile = bullets["50"]; gunSpec5.Burst = 1; gunSpec5.Cooldown = 2.3f; gunSpec5.Mag = 10; gunSpec5.Reload = 4.5f; gunSpec5.Spread = 0.15f; gunSpec5.Range = 110f; gunSpec5.ShootRecoil = 16f; gunSpec5.TorsoRecoil = 9f; gunSpec5.Mass = 14f; gunSpec5.Hold = 0.8f; gunSpec5.Heavy = true; gunSpec5.Kick = 0.05f; gunSpec5.LeftHandZ = 0.33f; gunSpec5.Cost = 900; GameObject val2 = Gun(gunSpec5); GunSpec gunSpec6 = new GunSpec(); gunSpec6.Key = "AK74M"; gunSpec6.Display = "AK-74M"; gunSpec6.Sound = "AK74M"; gunSpec6.Model = Guns.AK74M(); gunSpec6.Projectile = bullets["545"]; gunSpec6.Burst = 4; gunSpec6.BurstDelay = 0.1f; gunSpec6.Cooldown = 0.62f; gunSpec6.Mag = 8; gunSpec6.Reload = 2.6f; gunSpec6.Spread = 1.4f; gunSpec6.Range = 46f; gunSpec6.ShootRecoil = 2.5f; gunSpec6.TorsoRecoil = 1.6f; gunSpec6.LeftHandZ = 0.27f; gunSpec6.Cost = 280; GameObject weapon4 = Gun(gunSpec6); GunSpec gunSpec7 = new GunSpec(); gunSpec7.Key = "AK12"; gunSpec7.Display = "AK-12 (Spetsnaz)"; gunSpec7.Sound = "AK12"; gunSpec7.Model = Guns.AK12(); gunSpec7.Projectile = bullets["545"]; gunSpec7.Burst = 3; gunSpec7.BurstDelay = 0.088f; gunSpec7.Cooldown = 0.5f; gunSpec7.Mag = 10; gunSpec7.Reload = 2.1f; gunSpec7.Spread = 0.85f; gunSpec7.Range = 50f; gunSpec7.ShootRecoil = 2.2f; gunSpec7.TorsoRecoil = 1.3f; gunSpec7.LeftHandZ = 0.29f; gunSpec7.Cost = 450; GameObject weapon5 = Gun(gunSpec7); GunSpec gunSpec8 = new GunSpec(); gunSpec8.Key = "PKM"; gunSpec8.Display = "PKM"; gunSpec8.Sound = "PKM"; gunSpec8.Model = Guns.PKM(); gunSpec8.ModelOffset = new Vector3(0f, 0f, 0.24f); gunSpec8.Projectile = bullets["762R"]; gunSpec8.Burst = 7; gunSpec8.BurstDelay = 0.092f; gunSpec8.Cooldown = 0.85f; gunSpec8.Mag = 14; gunSpec8.Reload = 7f; gunSpec8.Spread = 2.4f; gunSpec8.Range = 55f; gunSpec8.ShootRecoil = 2.5f; gunSpec8.TorsoRecoil = 3f; gunSpec8.Mass = 10f; gunSpec8.Hold = 0.75f; gunSpec8.Heavy = true; gunSpec8.LeftHandZ = 0.3f; gunSpec8.Cost = 550; GameObject val3 = Gun(gunSpec8); GunSpec gunSpec9 = new GunSpec(); gunSpec9.Key = "PKP"; gunSpec9.Display = "PKP Pecheneg"; gunSpec9.Sound = "PKP"; gunSpec9.Model = Guns.PKP(); gunSpec9.ModelOffset = new Vector3(0f, 0f, 0.17f); gunSpec9.Projectile = bullets["762R"]; gunSpec9.Burst = 9; gunSpec9.BurstDelay = 0.088f; gunSpec9.Cooldown = 0.85f; gunSpec9.Mag = 11; gunSpec9.Reload = 6.5f; gunSpec9.Spread = 1.7f; gunSpec9.Range = 60f; gunSpec9.ShootRecoil = 2.5f; gunSpec9.TorsoRecoil = 3f; gunSpec9.Mass = 12f; gunSpec9.Hold = 0.7f; gunSpec9.Heavy = true; gunSpec9.LeftHandZ = 0.34f; gunSpec9.Cost = 650; GameObject val4 = Gun(gunSpec9); GunSpec gunSpec10 = new GunSpec(); gunSpec10.Key = "SVD"; gunSpec10.Display = "SVD Dragunov"; gunSpec10.Sound = "SVD"; gunSpec10.Model = Guns.SVD(); gunSpec10.Projectile = bullets["SVD"]; gunSpec10.Burst = 1; gunSpec10.Cooldown = 1.5f; gunSpec10.Mag = 10; gunSpec10.Reload = 3f; gunSpec10.Spread = 0.25f; gunSpec10.Range = 80f; gunSpec10.ShootRecoil = 6f; gunSpec10.TorsoRecoil = 3f; gunSpec10.Mass = 7f; gunSpec10.LeftHandZ = 0.3f; gunSpec10.Cost = 450; GameObject weapon6 = Gun(gunSpec10); Bipod bipod = val.AddComponent<Bipod>(); bipod.legZ = 0.42f; bipod.legLen = 0.28f; Bipod bipod2 = val2.AddComponent<Bipod>(); bipod2.legZ = 0.62f; bipod2.legLen = 0.34f; bipod2.spreadMul = 0.5f; bipod2.recoilMul = 0.35f; Bipod bipod3 = val3.AddComponent<Bipod>(); bipod3.legZ = 0.5f; bipod3.legLen = 0.3f; Bipod bipod4 = val4.AddComponent<Bipod>(); bipod4.legZ = 0.52f; bipod4.legLen = 0.3f; GameObject grenade = Ord["40mm"]; GunSpec gunSpec11 = new GunSpec(); gunSpec11.Key = "M4M320"; gunSpec11.Display = "M4A1 + M320 Grenade Launcher"; gunSpec11.Sound = "M4A1"; gunSpec11.Model = Guns.M4M320(); gunSpec11.Projectile = bullets["556"]; gunSpec11.Burst = 3; gunSpec11.BurstDelay = 0.075f; gunSpec11.Cooldown = 0.6f; gunSpec11.Mag = 10; gunSpec11.Reload = 2.5f; gunSpec11.Spread = 1.2f; gunSpec11.Range = 48f; gunSpec11.ShootRecoil = 2.5f; gunSpec11.TorsoRecoil = 1.5f; gunSpec11.Mass = 7.5f; gunSpec11.LeftHandZ = 0.27f; gunSpec11.Cost = 450; GameObject val5 = Gun(gunSpec11); AddUnderbarrel(val5, grenade, 5.5f); GunSpec gunSpec12 = new GunSpec(); gunSpec12.Key = "AK74GP25"; gunSpec12.Display = "AK-74M + GP-25"; gunSpec12.Sound = "AK74M"; gunSpec12.Model = Guns.AK74GP25(); gunSpec12.Projectile = bullets["545"]; gunSpec12.Burst = 4; gunSpec12.BurstDelay = 0.1f; gunSpec12.Cooldown = 0.65f; gunSpec12.Mag = 8; gunSpec12.Reload = 2.6f; gunSpec12.Spread = 1.5f; gunSpec12.Range = 46f; gunSpec12.ShootRecoil = 2.5f; gunSpec12.TorsoRecoil = 1.6f; gunSpec12.Mass = 7.5f; gunSpec12.LeftHandZ = 0.25f; gunSpec12.Cost = 420; GameObject val6 = Gun(gunSpec12); AddUnderbarrel(val6, grenade, 6f); GunSpec gunSpec13 = new GunSpec(); gunSpec13.Key = "RPG7"; gunSpec13.Display = "RPG-7 (PG-7VL)"; gunSpec13.Sound = "RPGLaunch"; gunSpec13.Model = Guns.RPG7(); gunSpec13.Projectile = bullets["9mm"]; gunSpec13.Burst = 1; gunSpec13.Cooldown = 6f; gunSpec13.Mag = 1; gunSpec13.Reload = 0f; gunSpec13.Spread = 1.2f; gunSpec13.Range = 55f; gunSpec13.ShootRecoil = 8f; gunSpec13.TorsoRecoil = 4f; gunSpec13.Mass = 8f; gunSpec13.LeftHandZ = 0.18f; gunSpec13.RightHandZ = -0.02f; gunSpec13.Cost = 600; GameObject weapon7 = Weapons.LauncherWeapon(gunSpec13, new LauncherCfg { Visual = Ord["PG7VL"], Speed = 70f, Gravity = 4f, PreferVehicles = true, Sound = "RPGLaunch", Backblast = 1.2f }); GunSpec gunSpec14 = new GunSpec(); gunSpec14.Key = "Javelin"; gunSpec14.Display = "FGM-148 Javelin"; gunSpec14.Sound = "SoftLaunch"; gunSpec14.Model = Guns.Javelin(); gunSpec14.Projectile = bullets["9mm"]; gunSpec14.Burst = 1; gunSpec14.Cooldown = 9f; gunSpec14.Mag = 1; gunSpec14.Reload = 0f; gunSpec14.Spread = 0.5f; gunSpec14.Range = 120f; gunSpec14.ShootRecoil = 3f; gunSpec14.TorsoRecoil = 2f; gunSpec14.Mass = 13f; gunSpec14.Hold = 0.8f; gunSpec14.Heavy = true; gunSpec14.LeftHandZ = 0.22f; gunSpec14.RightHandZ = -0.03f; gunSpec14.FixedLeftHand = true; gunSpec14.Cost = 1000; GameObject weapon8 = Weapons.LauncherWeapon(gunSpec14, new LauncherCfg { Visual = Ord["Javelin"], Speed = 14f, Gravity = 0.5f, Guided = true, TopAttack = true, PreferVehicles = true, Sound = "SoftLaunch", Backblast = 0.35f }); GunSpec gunSpec15 = new GunSpec(); gunSpec15.Key = "Stinger"; gunSpec15.Display = "FIM-92 Stinger"; gunSpec15.Sound = "ATGM"; gunSpec15.Model = Guns.Stinger(); gunSpec15.Projectile = bullets["9mm"]; gunSpec15.Burst = 1; gunSpec15.Cooldown = 8f; gunSpec15.Mag = 1; gunSpec15.Reload = 0f; gunSpec15.Spread = 0.3f; gunSpec15.Range = 150f; gunSpec15.ShootRecoil = 3f; gunSpec15.TorsoRecoil = 2f; gunSpec15.Mass = 9f; gunSpec15.LeftHandZ = 0.2f; gunSpec15.RightHandZ = -0.05f; gunSpec15.Cost = 900; GameObject weapon9 = Weapons.LauncherWeapon(gunSpec15, new LauncherCfg { Visual = Ord["Stinger"], Speed = 45f, Gravity = 0.5f, Guided = true, AirOnly = true, Sound = "ATGM", Backblast = 0.8f }); GunSpec gunSpec16 = new GunSpec(); gunSpec16.Key = "Igla"; gunSpec16.Display = "9K38 Igla"; gunSpec16.Sound = "ATGM"; gunSpec16.Model = Guns.Igla(); gunSpec16.Projectile = bullets["9mm"]; gunSpec16.Burst = 1; gunSpec16.Cooldown = 8f; gunSpec16.Mag = 1; gunSpec16.Reload = 0f; gunSpec16.Spread = 0.3f; gunSpec16.Range = 145f; gunSpec16.ShootRecoil = 3f; gunSpec16.TorsoRecoil = 2f; gunSpec16.Mass = 9f; gunSpec16.LeftHandZ = 0.2f; gunSpec16.RightHandZ = -0.05f; gunSpec16.Cost = 850; GameObject weapon10 = Weapons.LauncherWeapon(gunSpec16, new LauncherCfg { Visual = Ord["Igla"], Speed = 45f, Gravity = 0.5f, Guided = true, AirOnly = true, Sound = "ATGM", Backblast = 0.8f }); ArmorSpec armorSpec = new ArmorSpec(); armorSpec.helmet = 1.7f; armorSpec.helmetCover = 0.75f; armorSpec.plates = 3.6f; armorSpec.plateCover = 0.62f; armorSpec.soft = 1.5f; armorSpec.blast = 0.8f; ArmorSpec armor = armorSpec; ArmorSpec armorSpec2 = new ArmorSpec(); armorSpec2.helmet = 2f; armorSpec2.helmetCover = 0.7f; armorSpec2.plates = 3.8f; armorSpec2.plateCover = 0.7f; armorSpec2.soft = 1.7f; armorSpec2.blast = 0.75f; armorSpec2.plateHP = 130f; ArmorSpec armor2 = armorSpec2; ArmorSpec armorSpec3 = new ArmorSpec(); armorSpec3.helmet = 2.8f; armorSpec3.helmetCover = 0.82f; armorSpec3.plates = 3.7f; armorSpec3.plateCover = 0.82f; armorSpec3.soft = 1.8f; armorSpec3.limbs = 1.6f; armorSpec3.blast = 0.62f; armorSpec3.plateHP = 150f; ArmorSpec armor3 = armorSpec3; ArmorSpec armorSpec4 = new ArmorSpec(); armorSpec4.helmet = 1.7f; armorSpec4.helmetCover = 0.8f; armorSpec4.plates = 3.6f; armorSpec4.plateCover = 0.62f; armorSpec4.soft = 1.5f; armorSpec4.blast = 0.8f; ArmorSpec armor4 = armorSpec4; ArmorSpec armorSpec5 = new ArmorSpec(); armorSpec5.helmet = 1.8f; armorSpec5.helmetCover = 0.82f; armorSpec5.plates = 3.7f; armorSpec5.plateCover = 0.78f; armorSpec5.soft = 1.7f; armorSpec5.limbs = 1.4f; armorSpec5.blast = 0.7f; armorSpec5.plateHP = 130f; ArmorSpec armor5 = armorSpec5; Func<string[], List<GameObject>> func = delegate(string[] keys) { List<GameObject> list = new List<GameObject>(); foreach (string k in keys) { GameObject val8 = G(k); if ((Object)(object)val8 != (Object)null) { list.Add(val8); } } return list; }; bool real = UsingImportedGear; string[] arg = (real ? new string[3] { "ocp_shirt", "ocp_pants", "boots_us" } : new string[5] { "ocp_shirt", "ocp_pants", "belt_us", "knee_us", "boots_us" }); string[] arg2 = (real ? new string[3] { "emr_shirt", "emr_pants", "boots_ru" } : new string[5] { "emr_shirt", "emr_pants", "belt_ru", "knee_ru", "boots_ru" }); Func<string[], string[], string[]> func2 = delegate(string[] a, string[] b) { List<string> list = new List<string>(a); list.AddRange(b); return list.ToArray(); }; Func<string[], string[], string[]> func3 = (string[] imported, string[] procedural) => (!real) ? procedural : imported; US.Add(Make("M4Rifleman", "M4A1 Rifleman", "US Army rifleman. M4A1 Block II with M150 ACOG, PEQ-15 and KAC grip, ESAPI plate frame, ACH with Comtacs. 3-round bursts.", weapon, func(func2(arg, func3(new string[3] { "ach", "pc_coyote", "pc_coyote_belt" }, new string[2] { "ach", "pc_coyote" }))), armor, 110f, 450, 1f, 1f, 1f, 1f)); US.Add(Make("M4Grenadier", "M320 Grenadier", "Rifleman with an M320 40mm grenade launcher under the M4A1.", val5, func(func2(arg, func3(new string[3] { "ach", "pc_coyote", "pc_coyote_belt" }, new string[3] { "ach", "pc_coyote", "pack_us" }))), armor, 110f, 650, 1f, 1f, 1f, 1f)); US.Add(Make("SpecOps", "Spec Ops Operator", "Tier-1 operator: heavily modified HK416 (EOTech 553, PEQ-15, tan AFG, SureFire brake), FAST helmet with GPNVG-18 quad NVG, Level IV+ plates.", weapon2, func(func2(arg, func3(new string[4] { "fast", "gpnvg", "pc_ranger", "pc_ranger_belt" }, new string[3] { "fast", "pc_ranger", "gloves" }))), armor2, 140f, 1300, 1.1f, 1.1f, 1.05f, 1.2f)); if (AssetLib.Has("MXC")) { GunSpec gunSpec17 = new GunSpec(); gunSpec17.Key = "MXC"; gunSpec17.Display = "MXC Carbine (Holo, IR laser)"; gunSpec17.Sound = "M4A1"; gunSpec17.Projectile = bullets["556"]; gunSpec17.Burst = 4; gunSpec17.BurstDelay = 0.068f; gunSpec17.Cooldown = 0.4f; gunSpec17.Mag = 10; gunSpec17.Reload = 1.9f; gunSpec17.Spread = 0.75f; gunSpec17.Range = 48f; gunSpec17.ShootRecoil = 1.9f; gunSpec17.TorsoRecoil = 1.1f; gunSpec17.Mass = 3.5f; gunSpec17.Cost = 450; GameObject weapon11 = Gun(gunSpec17); US.Add(Make("MXCAssaulter", "MXC Assaulter", "Close-quarters assaulter with the compact MXC carbine (holographic sight, IR laser): quick four-round bursts on the move. FAST helmet, plate carrier, light and fast.", weapon11, func(func2(arg, func3(new string[5] { "fast", "pvs15", "pc_ranger", "pc_ranger_belt", "gloves" }, new string[3] { "fast", "pc_ranger", "gloves" }))), armor2, 125f, 900, 1.12f, 1.1f, 1.05f, 1.1f)); } if (AssetLib.Has("MXCS")) { GunSpec gunSpec18 = new GunSpec(); gunSpec18.Key = "MXCS"; gunSpec18.Display = "MXC Carbine (Suppressed)"; gunSpec18.Sound = "VSS"; gunSpec18.Projectile = bullets["556"]; gunSpec18.Burst = 3; gunSpec18.BurstDelay = 0.075f; gunSpec18.Cooldown = 0.45f; gunSpec18.Mag = 10; gunSpec18.Reload = 1.9f; gunSpec18.Spread = 0.6f; gunSpec18.Range = 50f; gunSpec18.ShootRecoil = 1.6f; gunSpec18.TorsoRecoil = 0.9f; gunSpec18.Mass = 3.9f; gunSpec18.Flash = 0.15f; gunSpec18.Smoke = 0.08f; gunSpec18.Cost = 520; GameObject weapon12 = Gun(gunSpec18); US.Add(Make("MXCRecon", "MXC Recon Operator (Suppressed)", "Recon operator with a suppressed MXC: quiet, accurate three-round bursts, GPNVG-18 night vision on the FAST, Level IV+ plates.", weapon12, func(func2(arg, func3(new string[5] { "fast", "gpnvg", "pc_ranger", "pc_ranger_belt", "gloves" }, new string[3] { "fast", "pc_ranger", "gloves" }))), armor2, 135f, 1150, 1.08f, 1.08f, 1.05f, 1.15f)); } US.Add(Make("M249Gunner", "M249 SAW Gunner", "Heavy-armoured automatic rifleman: M249 PIP with M145 optic, heavy FAST with shark nose art and PVS-15, IOTV (SAW). Slow and steady.", val, func(func2(arg, func3(new string[5] { "heavyfast", "chops", "pvs15", "iotv", "pc_coyote_belt" }, new string[5] { "heavyfast", "iotv", "deltoid", "groin_us", "gloves" }))), armor3, 130f, 950, 0.78f, 0.85f, 0.9f, 1.4f, 1.6f)); US.Add(Make("Marksman", "M110 Marksman", "Designated marksman with the M110 (7.62 NATO) and Leupold Mk4.", weapon3, func(func2(arg, func3(new string[3] { "ach", "pc_coyote", "pc_coyote_belt" }, new string[2] { "ach", "pc_coyote" }))), armor, 105f, 800, 1f, 1f, 1f, 1f)); US.Add(Make("Sniper50", "M107 .50 Sniper", "Barrett M107 anti-materiel rifle. One shot, one kill - and it hurts light vehicles and helicopters.", val2, func(func2(arg, func3(new string[3] { "ach", "pc_coyote", "pc_coyote_belt" }, new string[3] { "ach", "pc_coyote", "pack_us" }))), armor, 100f, 1500, 0.95f, 0.95f, 1f, 1.2f, 1.3f)); US.Add(Make("JavelinGunner", "Javelin Gunner", "FGM-148 Javelin: fire-and-forget, top-attack tandem warhead. Hunts tanks.", weapon8, func(func2(arg, func3(new string[3] { "ach", "pc_coyote", "pc_coyote_belt" }, new string[3] { "ach", "pc_coyote", "pack_us" }))), armor, 110f, 1800, 0.92f, 0.95f, 1f, 1.2f, 1.3f)); US.Add(Make("StingerGunner", "Stinger Gunner", "FIM-92 Stinger MANPADS. Only engages aircraft and follows friendly troops.", weapon9, func(func2(arg, func3(new string[3] { "ach", "pc_coyote", "pc_coyote_belt" }, new string[3] { "ach", "pc_coyote", "pack_us" }))), armor, 105f, 1400, 1f, 1f, 1f, 1f, 1f, friendly: true)); RU.Add(Make("AKRifleman", "AK-74M Rifleman", "Motor rifleman in full Ratnik: 6B47 helmet with ESS goggles, 6B45 vest, EMR camo, AK-74M with Kobra sight.", weapon4, func(func2(arg2, new string[2] { "6b47", "6b45" })), armor4, 110f, 420, 1f, 1f, 1f, 1f)); RU.Add(Make("AKGrenadier", "GP-25 Grenadier", "AK-74M with a GP-25 under-barrel grenade launcher.", val6, func(func2(arg2, func3(new string[2] { "6b47", "6b45" }, new string[3] { "6b47", "6b45", "pack_ru" }))), armor4, 110f, 600, 1f, 1f, 1f, 1f)); RU.Add(Make("PKMGunner", "PKM Gunner", "Squad machine gunner with the PKM (7.62x54R).", val3, func(func2(arg2, new string[2] { "6b47hs", "6b45mg" })), armor4, 125f, 850, 0.85f, 0.9f, 0.95f, 1.3f, 1.4f)); RU.Add(Make("PKPGunner", "PKP Pecheneg Gunner", "PKP Pecheneg with forced-air cooled heavy barrel - sustained, accurate fire. Heavier Ratnik armour.", val4, func(func2(arg2, func3(new string[2] { "6b47hs", "6b45mg" }, new string[4] { "6b47hs", "6b45mg", "groin_ru", "gloves" }))), armor5, 130f, 1050, 0.8f, 0.88f, 0.92f, 1.4f, 1.5f)); if (AssetLib.Has("RPK")) { GunSpec gunSpec19 = new GunSpec(); gunSpec19.Key = "RPK"; gunSpec19.Display = "RPK-74M"; gunSpec19.Sound = "AK74M"; gunSpec19.Projectile = bullets["545"]; gunSpec19.Burst = 6; gunSpec19.BurstDelay = 0.095f; gunSpec19.Cooldown = 0.7f; gunSpec19.Mag = 8; gunSpec19.Reload = 3.2f; gunSpec19.Spread = 1.5f; gunSpec19.Range = 54f; gunSpec19.ShootRecoil = 2.2f; gunSpec19.TorsoRecoil = 2f; gunSpec19.Mass = 7f; gunSpec19.Hold = 0.8f; gunSpec19.LeftHandZ = 0.3f; gunSpec19.Cost = 520; GameObject val7 = Gun(gunSpec19); Bipod bipod5 = val7.AddComponent<Bipod>(); bipod5.legZ = 0.5f; bipod5.legLen = 0.28f; RU.Add(Make("RPKGunner", "RPK-74M Gunner", "Squad automatic rifleman with the RPK-74M: long-barrelled 5.45, 45-round magazines, bursts from the bipod.", val7, func(func2(arg2, new string[2] { "6b47", "6b45mg" })), armor4, 120f, 640, 0.92f, 0.95f, 0.97f, 1.2f, 1.2f)); } RU.Add(Make("SVDMarksman", "SVD Marksman", "Dragunov (SVDM) designated marksman with PSO-1M2 sight.", weapon6, func(func2(arg2, new string[2] { "6b47", "6b45" })), armor4, 105f, 750, 1f, 1f, 1f, 1f)); RU.Add(Make("RPGGunner", "RPG-7 Gunner", "RPG-7V2 with PGO-7 sight and PG-7VL HEAT rockets. Prefers armour.", weapon7, func(func2(arg2, func3(new string[2] { "6b47", "6b45" }, new string[3] { "6b47", "6b45", "pack_ru" }))), armor4, 110f, 900, 1f, 1f, 1f, 1f)); RU.Add(Make("IglaGunner", "Igla Gunner", "9K38 Igla MANPADS. Only engages aircraft and follows friendly troops.", weapon10, func(func2(arg2, func3(new string[2] { "6b47", "6b45" }, new string[3] { "6b47", "6b45", "pack_ru" }))), armor4, 105f, 1300, 1f, 1f, 1f, 1f, 1f, friendly: true)); RU.Add(Make("Spetsnaz", "Spetsnaz Operator", "Special purpose operator: AK-12 with 1P87 sight, 6B47 with Comtacs and 1PN138 NVG, Level IV+ plates.", weapon5, func(func3(new string[6] { "emr_shirt", "emr_pants", "boots_ru", "6b47hs", "1pn138", "6b45" }, new string[9] { "emr_shirt", "emr_pants", "6b47olive", "balaclava", "6b45olive", "belt_ru", "knee_ru", "boots_ru", "gloves" })), armor2, 135f, 1200, 1.08f, 1.08f, 1.05f, 1.2f)); } private static void AddUnderbarrel(GameObject gun, GameObject grenade, float cooldown) { Underbarrel underbarrel = gun.AddComponent<Underbarrel>(); underbarrel.grenade = grenade; underbarrel.cooldown = cooldown; } internal static UnitBlueprint Make(string key, string display, string desc, GameObject weapon, List<GameObject> props, ArmorSpec armor, float hp, int cost, float speed, float anim, float step, float balance, float mass = 1f, bool friendly = false) { string text = null; foreach (KeyValuePair<string, GameObject> item in Weapons.All) { if ((Object)(object)item.Value == (Object)(object)weapon) { text = item.Key; } } Sprite val = ((text != null) ? AssetLib.Icon(text) : null); if ((Object)(object)val == (Object)null && (Object)(object)weapon != (Object)null) { GunFX component = weapon.GetComponent<GunFX>(); if ((Object)(object)component != (Object)null && !string.IsNullOrEmpty(component.asset)) { val = AssetLib.Icon(component.asset); } } if ((Object)(object)val == (Object)null) { try { val = UnitIcon(key, text, props); } catch (Exception ex) { Plugin.Log.LogWarning((object)("icon " + key + ": " + ex.Message)); } } UnitSpec unitSpec = new UnitSpec(); unitSpec.Key = key; unitSpec.Display = display; unitSpec.Desc = desc; unitSpec.Right = weapon; unitSpec.Props = props; unitSpec.Armor = armor; unitSpec.Health = hp; unitSpec.Cost = cost; unitSpec.Speed = speed; unitSpec.Anim = anim; unitSpec.Step = step; unitSpec.Balance = balance; unitSpec.BalanceForce = 1f; unitSpec.Mass = mass; unitSpec.Icon = val; unitSpec.Friendly = friendly; return Units.Make(unitSpec); } public static Sprite UnitIcon(string key, string weaponKey, List<GameObject> props) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) List<SoftRender.Part> list = new List<SoftRender.Part>(); if (weaponKey != null && Weapons.Models.TryGetValue(weaponKey, out var value) && value != null) { list.Add(new SoftRender.Part { Mesh = value, Xf = Matrix4x4.TRS(new Vector3(0f, -0.15f, 0f), Quaternion.Euler(0f, -90f, 0f), Vector3.one) }); } foreach (GameObject prop in props) { if ((Object)(object)prop == (Object)null) { continue; } PropItem component = prop.GetComponent<PropItem>(); if (!((Object)(object)component == (Object)null) && (int)((CharacterItem)component).GearT == 0) { MeshFilter componentInChildren = prop.GetComponentInChildren<MeshFilter>(true); if (!((Object)(object)componentInChildren == (Object)null) && Gear.PropMB.TryGetValue(((Object)prop).name, out var value2) && value2 != null) { list.Add(new SoftRender.Part { Mesh = value2, SubColors = HelmetColors(prop), Xf = Matrix4x4.TRS(new Vector3(-0.25f, 0.2f - Body.HeadC.y * 0.55f, 0f), Quaternion.Euler(0f, -55f, 0f), Vector3.one * 0.55f) }); break; } } } if (list.Count == 0) { return null; } Texture2D t = SoftRender.Render(list, Quaternion.Euler(10f, 0f, 0f), 128, 0.05f, new Color(0.07f, 0.07f, 0.07f, 1f)); if (Plugin.DevOutput) { SoftRender.SavePng(t, Path.Combine(Plugin.DevDir, "icon_u_" + key + ".png")); } return TexGen.ToSprite(t); } private static Color[] HelmetColors(GameObject p) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) MeshRenderer componentInChildren = p.GetComponentInChildren<MeshRenderer>(true); if ((Object)(object)componentInChildren == (Object)null) { return null; } Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials; Color[] array = (Color[])(object)new Color[sharedMaterials.Length]; for (int i = 0; i < sharedMaterials.Length; i++) { if ((Object)(object)sharedMaterials[i] == (Object)null || (Object)(object)sharedMaterials[i] == (Object)(object)Mats.VC) { ref Color reference = ref array[i]; reference = new Color(0f, 0f, 0f, 0f); continue; } Texture mainTexture = sharedMaterials[i].mainTexture; Texture2D val = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null); ref Color reference2 = ref array[i]; reference2 = (((Object)(object)val != (Object)null) ? Avg(val) : sharedMaterials[i].color); } return array; } private static Color Avg(Texture2D t) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) try { Color[] pixels = t.GetPixels(0); Color val = default(Color); ((Color)(ref val))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < pixels.Length; i += 7) { val += pixels[i]; } val /= (float)Mathf.Max(1, pixels.Length / 7); val.a = 1f; return val; } catch { return Color.gray; } } private static void BuildFactions() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) Sprite icon = TexGen.ToSprite(TexGen.Emblem(128, Pal.C(3093284), Pal.C(4936243), Color.white, Pal.C(1776916))); Sprite icon2 = TexGen.ToSprite(TexGen.Emblem(128, Pal.C(9071146), Pal.C(4082222), Pal.C(12855840), Pal.C(14925928))); US.AddRange(Vehicles.US); US.AddRange(Aircraft.US); US.AddRange(Specials.US); RU.AddRange(Vehicles.RU); RU.AddRange(Aircraft.RU); RU.AddRange(Specials.RU); if ((Object)(object)Police.Blitz != (Object)null) { RU.Add(Police.Blitz); } Units.MakeFaction("US", "Modern: US Army", icon, Pal.C(5925690), 13, US); Units.MakeFaction("RU", "Modern: Russian Army", icon2, Pal.C(8010286), 14, RU); if (Police.All.Count > 0) { Sprite icon3 = TexGen.ToSprite(TexGen.Emblem(128, Pal.C(1713216), Pal.C(2898534), Pal.C(15263984), Pal.C(13150280))); Units.MakeFaction("POLICE", "Modern: Police", icon3, Pal.C(2898534), 16, Police.All); } if (British.All.Count > 0) { List<UnitBlueprint> list = new List<UnitBlueprint>(British.All); list.AddRange(Vehicles.UK); list.AddRange(Aircraft.UK); Sprite icon4 = TexGen.ToSprite(TexGen.Emblem(128, Pal.C(1976906), Pal.C(4871478), Pal.C(13111342), Pal.C(15263976))); Units.MakeFaction("UK", "Modern: British Army", icon4, Pal.C(4871478), 17, list); } if (Marines.All.Count > 0) { List<UnitBlueprint> list2 = new List<UnitBlueprint>(Marines.All); foreach (UnitBlueprint item in Marines.Support) { if ((Object)(object)item != (Object)null && !list2.Contains(item)) { list2.Add(item); } } Sprite icon5 = TexGen.ToSprite(TexGen.Emblem(128, Pal.C(9116186), Pal.C(4147756), Pal.C(13938487), Pal.C(1710618))); Units.MakeFaction("USMC", "Modern: US Marine Corps", icon5, Pal.C(4147756), 18, list2); } if (Fortifications.All.Count > 0) { Sprite icon6 = TexGen.ToSprite(TexGen.Emblem(128, Pal.C(7234128), Pal.C(4867126), Pal.C(14207392), Pal.C(2762272))); Units.MakeFaction("FORT", "Modern: Fortifications", icon6, Pal.C(7234128), 15, Fortifications.All); } } } public class Underbarrel : MonoBehaviour { public GameObject grenade; public float cooldown = 6f; public float minRange = 9f; public float maxRange = 42f; public float speed = 30f; private float next; private RangeWeapon rw; private void Awake() { CloneFix.Fix((Component)(object)this); } private void Start() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown rw = ((Component)this).GetComponent<RangeWeapon>(); if ((Object)(object)rw != (Object)null && rw.shootEvent != null) { rw.shootEvent.AddListener(new UnityAction(OnAttack)); } next = Time.time + Random.Range(1f, cooldown); } private void OnAttack() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (Time.time < next || (Object)(object)grenade == (Object)null) { return; } Unit val = Launcher.Owner((Weapon)(object)rw); if (Targets.Alive(val) && !((Object)(object)val.data.targetMainRig == (Object)null)) { Vector3 val2 = ((Component)this).transform.position + ((Component)this).transform.forward * 0.4f; Vector3 position = val.data.targetMainRig.position; float num = Vector3.Distance(val2, position); if (!(num < minRange) && !(num > maxRange)) { next = Time.time + cooldown; Vector3 velocity = Ordnance.Lob(val2, position + Random.insideUnitSphere * 1.2f, speed, 9.8f, high: false); Ordnance ordnance = Ordnance.Spawn(grenade, val2, velocity, val.Team, val); ordnance.gravity = 9.8f; Sounds.Play("GL", val2, 0.9f, Random.Range(0.95f, 1.05f)); } } } } public static class Dumper { private const BindingFlags DF = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static readonly CultureInfo IC = CultureInfo.InvariantCulture; private static Assembly gameAsm = typeof(Unit).Assembly; public static Dictionary<DatabaseID, T> Dict<T>(object owner, string field) { FieldInfo field2 = owner.GetType().GetField(field, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); return (Dictionary<DatabaseID, T>)field2.GetValue(owner); } public static void DumpAll(string path) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_0d94: Unknown result type (might be due to invalid IL or missing references) //IL_11ba: Unknown result type (might be due to invalid IL or missing references) //IL_11d3: Unknown result type (might be due to invalid IL or missing references) //IL_1025: Unknown result type (might be due to invalid IL or missing references) //IL_103f: Unknown result type (might be due to invalid IL or missing references) //IL_1075: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); ContentDatabase val = ContentDatabase.Instance(); LandfallContentDatabase landfallContentDatabase = val.LandfallContentDatabase; stringBuilder.AppendLine("##### SCENES"); for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++) { stringBuilder.AppendLine(i + ": " + SceneUtility.GetScenePathByBuildIndex(i)); } Scene activeScene = SceneManager.GetActiveScene(); stringBuilder.AppendLine("active scene: " + ((Scene)(ref activeScene)).name); stringBuilder.AppendLine("##### FACTIONS"); foreach (Faction item in val.GetFactionsOrderedByIndex()) { if (!((Object)(object)item == (Object)null)) { stringBuilder.AppendLine(string.Concat("FACTION '", item.Entity.Name, "' id=", item.Entity.GUID, " index=", item.index, " display=", item.m_displayFaction, " secret=", item.IsSecret, " cat=", item.m_FactionCatagory, " color=", item.m_FactionColor, " modID=", item.modID, " icon=", Nm((Object)(object)item.Entity.SpriteIcon), " unlock=", item.Entity.UnlockKey)); UnitBlueprint[] units = item.Units; foreach (UnitBlueprint val2 in units) { stringBuilder.AppendLine(" unit '" + (Object.op_Implicit((Object)(object)val2) ? val2.Name : "null") + "' " + (Object.op_Implicit((Object)(object)val2) ? ((object)val2.Entity.GUID/*cast due to .constrained prefix*/).ToString() : "")); } } } stringBuilder.AppendLine("default hotbar: " + string.Join(", ", (from x in val.GetDefaultHotbarFactions() where (Object)(object)x != (Object)null select x.Entity.Name).ToArray())); Dictionary<DatabaseID, GameObject> dictionary = Dict<GameObject>(landfallContentDatabase, "m_unitBases"); Dictionary<DatabaseID, GameObject> dictionary2 = Dict<GameObject>(landfallContentDatabase, "m_weapons"); Dictionary<DatabaseID, GameObject> dictionary3 = Dict<GameObject>(landfallContentDatabase, "m_combatMoves"); Dictionary<DatabaseID, GameObject> dictionary4 = Dict<GameObject>(landfallContentDatabase, "m_characterProps"); Dictionary<DatabaseID, GameObject> dictionary5 = Dict<GameObject>(landfallContentDatabase, "m_projectiles"); Dictionary<GameObject, DatabaseID> ids = new Dictionary<GameObject, DatabaseID>(); Dictionary<DatabaseID, GameObject>[] array = new Dictionary<DatabaseID, GameObject>[5] { dictionary, dictionary2, dictionary3, dictionary4, dictionary5 }; foreach (Dictionary<DatabaseID, GameObject> dictionary6 in array) { foreach (KeyValuePair<DatabaseID, GameObject> item2 in dictionary6) { if ((Object)(object)item2.Value != (Object)null && !ids.ContainsKey(item2.Value)) { ids[item2.Value] = item2.Key; } } } Func<GameObject, string> N = (GameObject g) => (!((Object)(object)g == (Object)null)) ? ("'" + ((Object)g).name + "'" + (ids.ContainsKey(g) ? ("#" + ids[g]) : "")) : "null"; stringBuilder.AppendLine("##### BLUEPRINTS"); foreach (UnitBlueprint item3 in from x in landfallContentDatabase.GetUnitBlueprints() where (Object)(object)x != (Object)null orderby x.Name select x) { try { stringBuilder.Append(string.Concat("BP '", item3.Name, "' id=", item3.Entity.GUID, " so=", ((Object)item3).name)); stringBuilder.Append(" base=" + N(item3.UnitBase) + " R=" + N(item3.RightWeapon) + " L=" + N(item3.LeftWeapon) + " twoHand=" + item3.holdinigWithTwoHands); stringBuilder.Append(" hp=" + F(item3.health) + " mass=" + F(item3.massMultiplier) + " size=" + F(item3.sizeMultiplier) + " rnd=" + F(item3.minSizeRandom) + ".." + F(item3.maxSizeRandom) + " speed=" + F(item3.movementSpeedMuiltiplier) + " anim=" + F(item3.animationMultiplier) + " step=" + F(item3.stepMultiplier) + " bal=" + F(item3.balanceMultiplier) + "/" + F(item3.balanceForceMultiplier) + " drag=" + F(item3.dragMultiplier)); stringBuilder.Append(" cost=" + item3.GetUnitCost(true) + " secret=" + item3.IsSecret + " dmgM=" + F(item3.damageMultiplier) + " atkSpdM=" + F(item3.attackSpeedMultiplier) + " rangeM=" + F(item3.rangeMultiplier) + " hpM=" + F(item3.healthMultiplier)); stringBuilder.Append(" vocal=" + Get(item3, "vocalRef") + " death=" + Get(item3, "deathRef") + " foot=" + Get(item3, "footRef") + " voice=" + Nm((Object)(object)item3.voiceBundle) + " pitch=" + F(item3.VoicePitch)); stringBuilder.Append(string.Concat(" turn=", F(item3.turnSpeed), " nav=", item3.NavmeshType, " tgt=", (item3.TargetingComponent == null) ? "null" : ((object)item3.TargetingComponent).GetType().Name, " tgtPrio=", F(item3.targetingPriorityMultiplier))); stringBuilder.Append(" moves=" + ((item3.MovementComponents == null) ? "null" : string.Join("|", item3.MovementComponents.Select((IMovementComponent m) => (m != null) ? (((object)m).GetType().Name + "{" + Fields(m, 2) + "}") : "null").ToArray()))); stringBuilder.Append(" props=[" + string.Join(", ", ((IEnumerable<GameObject>)(((object)item3.m_props) ?? ((object)new GameObject[0]))).Select((GameObject p) => N(p)).ToArray()) + "]"); stringBuilder.Append(" children=[" + string.Join(", ", ((IEnumerable<GameObject>)(((object)item3.objectsToSpawnAsChildren) ?? ((object)new GameObject[0]))).Select((GameObject p) => N(p)).ToArray()) + "]"); stringBuilder.Append(" riders=[" + string.Join(", ", ((IEnumerable<UnitBlueprint>)(((object)item3.UnitRiders) ?? ((object)new UnitBlueprint[0]))).Select((UnitBlueprint p) => (!Object.op_Implicit((Object)(object)p)) ? "null" : p.Name).ToArray()) + "] mount=" + (Object.op_Implicit((Object)(object)item3.Mount) ? item3.Mount.Name : "null")); stringBuilder.Append(" sep=" + F(item3.weaponSeparation) + " arm=" + F(item3.ArmLimitMultiplier) + " neck=" + F(item3.neckLimitMultiplier) + " fist=" + N(item3.fistRef) + " scaleW=" + item3.scaleWeapons + " noMiss=" + item3.removeCloseRangeMiss); stringBuilder.AppendLine(" atkCurve=" + Fmt(item3.attackDistanceCurve, 0) + " desc=" + Get(item3, "unitDescription")); } catch (Exception ex) { stringBuilder.AppendLine(" !! " + ex.Message); } } stringBuilder.AppendLine("##### UNIT BASES"); foreach (KeyValuePair<DatabaseID, GameObject> item4 in dictionary) { stringBuilder.AppendLine("BASE " + N(item4.Value)); if (Object.op_Implicit((Object)(object)item4.Value)) { Hier(stringBuilder, item4.Value.transform, " ", 0, 7, fields: true); } } stringBuilder.AppendLine("##### WEAPONS"); foreach (KeyValuePair<DatabaseID, GameObject> item5 in dictionary2) { stringBuilder.AppendLine("WEAPON " + N(item5.Value)); if (Object.op_Implicit((Object)(object)item5.Value)) { Hier(stringBuilder, item5.Value.transform, " ", 0, 4, fields: true); } } stringBuilder.AppendLine("##### PROJECTILES"); foreach (KeyValuePair<DatabaseID, GameObject> item6 in dictionary5) { stringBuilder.AppendLine("PROJ " + N(item6.Value)); if (Object.op_Implicit((Object)(object)item6.Value)) { Hier(stringBuilder, item6.Value.transform, " ", 0, 3, fields: true); } } stringBuilder.AppendLine("##### COMBAT MOVES"); foreach (KeyValuePair<DatabaseID, GameObject> item7 in dictionary3) { stringBuilder.AppendLine("MOVE " + N(item7.Value)); if (Object.op_Implicit((Object)(object)item7.Value)) { Hier(stringBuilder, item7.Value.transform, " ", 0, 2, fields: true); } } stringBuilder.AppendLine("##### PROPS"); foreach (KeyValuePair<DatabaseID, GameObject> item8 in dictionary4) { GameObject value = item8.Value; if (Object.op_Implicit((Object)(object)value)) { CharacterItem component = value.GetComponent<CharacterItem>(); stringBuilder.AppendLine("PROP " + N(value) + " type=" + (Object.op_Implicit((Object)(object)component) ? ((object)component).GetType().Name : "?") + " gear=" + (Object.op_Implicit((Object)(object)component) ? ((object)component.GearT).ToString() : "?") + " show=" + (Object.op_Implicit((Object)(object)component) ? component.ShowInEditor.ToString() : "?") + " name=" + (Object.op_Implicit((Object)(object)component) ? component.Entity.Name : "")); Hier(stringBuilder, value.transform, " ", 0, 2, fields: false); } } stringBuilder.AppendLine("##### SOUNDBANK"); SoundPlayer service = ServiceLocator.GetService<SoundPlayer>(); if ((Object)(object)service != (Object)null && (Object)(object)service.soundBank != (Object)null) { SoundBankCategory[] categories = service.soundBank.Categories; foreach (SoundBankCategory val3 in categories) { stringBuilder.AppendLine("CAT '" + val3.categoryName + "' mixer=" + Nm((Object)(object)val3.categoryMixerGroup) + " vol=" + F(val3.volumeMultiplier) + " pitch=" + F(val3.pitchMultiplier) + " min=" + F(val3.minDistanceMultiplier) + " max=" + F(val3.maxDistanceMultiplier)); SoundEffectInstance[] soundEffects = val3.soundEffects; foreach (SoundEffectInstance val4 in soundEffects) { int num3 = 0; string text = ""; if (val4.clipTypes != null) { SoundEffectVariations[] clipTypes = val4.clipTypes; foreach (SoundEffectVariations val5 in clipTypes) { if (val5 != null && val5.clips != null) { num3 += val5.clips.Length; if (text == "" && val5.clips.Length > 0 && Object.op_Implicit((Object)(object)val5.clips[0])) { text = ((Object)val5.clips[0]).name; } } } } stringBuilder.AppendLine(string.Concat(" '", val4.soundRef, "' clips=", num3, " first=", text, " vol=", val4.volume, " pitch=", val4.pitch, " max=", val4.maxInstances, "/", val4.maxInstanceBehaviour, " cd=", F(val4.cooldown), " blend=", F(val4.spatialBlend), " dist=", F(val4.minDistance), "..", F(val4.maxDistance), " prio=", val4.priority, " mixer=", Nm((Object)(object)val4.overrideMixerGroup))); } } } stringBuilder.AppendLine("##### MAPS"); foreach (MapAsset item9 in val.GetAllMapAssetsOrdered()) { if (Object.op_Implicit((Object)(object)item9)) { stringBuilder.AppendLine(string.Concat("MAP '", item9.Entity.Name, "' id=", item9.Entity.GUID, " type=", item9.m_MapType, " mapName=", item9.MapName, " idx=", item9.m_mapIndex, " secret=", item9.m_isSecret, " scene=", Fmt(item9.SceneReference, 0), " song=", item9.SongCategoryName)); } } stringBuilder.AppendLine("##### VOICES"); foreach (VoiceBundle allVoiceBundle in val.GetAllVoiceBundles()) { if (Object.op_Implicit((Object)(object)allVoiceBundle)) { stringBuilder.AppendLine("VOICE '" + ((Object)allVoiceBundle).name + "' " + Fields(allVoiceBundle, 1)); } } File.WriteAllText(path, stringBuilder.ToString()); Plugin.Log.LogInfo((object)("wrote dump " + path + " (" + stringBuilder.Length + " chars)")); } private static void Hier(StringBuilder sb, Transform t, string ind, int depth, int maxDepth, bool fields) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Expected O, but got Unknown //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Expected O, but got Unknown sb.Append(ind + ((Object)t).name + (((Component)t).gameObject.activeSelf ? "" : "(off)") + " lp=" + V3(t.localPosition) + " lr=" + V3(t.localEulerAngles) + " ls=" + V3(t.localScale) + " :"); Component[] components = ((Component)t).GetComponents<Component>(); Component[] array = components; foreach (Component val in array) { sb.Append(" " + (((Object)(object)val == (Object)null) ? "<missing>" : ((object)val).GetType().Name)); } sb.AppendLine(); Component[] array2 = components; foreach (Component val2 in array2) { if ((Object)(object)val2 == (Object)null) { continue; } Type type = ((object)val2).GetType(); if (val2 is MeshFilter) { Mesh sharedMesh = ((MeshFilter)val2).sharedMesh; object obj; if (!Object.op_Implicit((Object)(object)sharedMesh)) { obj = "null"; } else { object[] array3 = new object[5] { ((Object)sharedMesh).name, " v=", sharedMesh.vertexCount, " b=", null }; Bounds bounds = sharedMesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; array3[4] = ((Vector3)(ref size)).ToString("F2"); obj = string.Concat(array3); } sb.AppendLine(ind + " mesh=" + (string?)obj); } else if (val2 is SkinnedMeshRenderer) { Mesh sharedMesh2 = ((SkinnedMeshRenderer)val2).sharedMesh; sb.AppendLine(ind + " smesh=" + (Object.op_Implicit((Object)(object)sharedMesh2) ? (((Object)sharedMesh2).name + " v=" + sharedMesh2.vertexCount) : "null") + " mats=" + Mats((Renderer)val2)); } else if (val2 is Renderer) { sb.AppendLine(ind + " mats=" + Mats((Renderer)val2)); } else if (val2 is Rigidbody) { Rigidbody val3 = (Rigidbody)val2; sb.AppendLine(ind + " rb mass=" + F(val3.mass) + " drag=" + F(val3.drag) + "/" + F(val3.angularDrag) + " kin=" + val3.isKinematic + " grav=" + val3.useGravity); } else if (val2 is BoxCollider) { BoxCollider val4 = (BoxCollider)val2; sb.AppendLine(ind + " box c=" + V3(val4.center) + " s=" + V3(val4.size) + " trig=" + ((Collider)val4).isTrigger + " layer=" + LayerMask.LayerToName(((Component)t).gameObject.layer)); } else if (val2 is CapsuleCollider) { CapsuleCollider val5 = (CapsuleCollider)val2; sb.AppendLine(ind + " capsule r=" + F(val5.radius) + " h=" + F(val5.height) + " dir=" + val5.direction + " layer=" + LayerMask.LayerToName(((Component)t).gameObject.layer)); } else if (val2 is SphereCollider) { SphereCollider val6 = (SphereCollider)val2; sb.AppendLine(ind + " sphere r=" + F(val6.radius) + " layer=" + LayerMask.LayerToName(((Component)t).gameObject.layer)); } else if (fields && type.Assembly == gameAsm) { sb.AppendLine(ind + " {" + type.Name + "} " + Fields(val2, 0)); } } if (depth < maxDepth) { for (int k = 0; k < t.childCount; k++) { Hier(sb, t.GetChild(k), ind + " ", depth + 1, maxDepth, fields); } } else if (t.childCount > 0) { sb.AppendLine(ind + " ..." + t.childCount + " children"); } } private static string Mats(Renderer r) { return string.Join(",", r.sharedMaterials.Select((Material m) => (!Object.op_Implicit((Object)(object)m)) ? "null" : (((Object)m).name + "|" + (Object.op_Implicit((Object)(object)m.shader) ? ((Object)m.shader).name : "?"))).ToArray()); } public static string Fields(object o, int depth) { StringBuilder stringBuilder = new StringBuilder(); Type type = o.GetType(); while (type != null && type != typeof(MonoBehaviour) && type != typeof(Behaviour) && type != typeof(Component) && type != typeof(ScriptableObject) && type != typeof(Object) && type != typeof(object) && type != typeof(ValueType)) { FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!typeof(Delegate).IsAssignableFrom(fieldInfo.FieldType)) { object value; try { value = fieldInfo.GetValue(o); } catch { continue; } string value2; try { value2 = Fmt(value, depth + 1); } catch (Exception ex) { value2 = "!" + ex.GetType().Name; } string text = fieldInfo.Name; if (text.StartsWith("<")) { text = text.Substring(1, text.IndexOf('>') - 1); } stringBuilder.Append(text).Append('=').Append(value2) .Append(' '); } } type = type.BaseType; } return stringBuilder.ToString(); } public static string Fmt(object v, int depth) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown if (v == null) { return "null"; } if (v is Object) { Object val = (Object)v; if (!Object.op_Implicit(val)) { return "null"; } return "'" + val.name + "'"; } if (v is string) { return string.Concat("\"", v, "\""); } Type type = v.GetType(); if (type.IsPrimitive || type.IsEnum) { return Convert.ToString(v, IC); } if (v is Vector3) { return V3((Vector3)v); } if (v is Vector2 val2) { return ((Vector2)(ref val2)).ToString("F2"); } if (v is Quaternion) { Quaternion val3 = (Quaternion)v; return "q" + V3(((Quaternion)(ref val3)).eulerAngles); } if (v is Color val4) { return ((Color)(ref val4)).ToString("F2"); } if (v is LayerMask) { LayerMask val5 = (LayerMask)v; return "mask" + ((LayerMask)(ref val5)).value; } if (v is AnimationCurve) { AnimationCurve val6 = (AnimationCurve)v; return "curve[" + string.Join(" ", val6.keys.Select((Keyframe k) => F(((Keyframe)(ref k)).time) + ":" + F(((Keyframe)(ref k)).value)).ToArray()) + "]"; } if (v is UnityEventBase) { UnityEventBase val7 = (UnityEventBase)v; int persistentEventCount = val7.GetPersistentEventCount(); if (persistentEventCount == 0) { return "ev0"; } List<string> list = new List<string>(); for (int num = 0; num < persistentEventCount; num++) { list.Add(Nm(val7.GetPersistentTarget(num)) + "." + val7.GetPersistentMethodName(num)); } return "ev{" + string.Join(",", list.ToArray()) + "}"; } if (v is IList) { IList list2 = (IList)v; if (depth > 2) { return "[" + list2.Count + "]"; } List<string> list3 = new List<string>(); for (int num2 = 0; num2 < list2.Count && num2 < 10; num2++) { list3.Add(Fmt(list2[num2], depth + 1)); } return "[" + list2.Count + "]{" + string.Join(",", list3.ToArray()) + ((list2.Count > 10) ? ",..." : "") + "}"; } if (v is IDictionary) { return "dict" + ((IDictionary)v).Count; } if (depth <= 2 && type.Namespace != "System" && !type.FullName.StartsWith("System.") && !type.FullName.StartsWith("Unity.")) { return type.Name + "{" + Fields(v, depth + 1) + "}"; } return type.Name; } private static string Get(object o, string field) { Type type = o.GetType(); while (type != null) { FieldInfo field2 = type.GetField(field, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { return Fmt(field2.GetValue(o), 3); } type = type.BaseType; } return "?"; } public static string Nm(Object o) { if (!Object.op_Implicit(o)) { return "null"; } return o.name; } public static string F(float f) { return f.ToString("0.###", IC); } public static string V3(Vector3 v) { return "(" + F(v.x) + "," + F(v.y) + "," + F(v.z) + ")"; } } [BepInPlugin("com.modernwarfare.tabs", "Modern Warfare Faction", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string GUID = "com.modernwarfare.tabs"; public const string VERSION = "1.0.0"; public static ManualLogSource Log; public static string Folder; public static string DevDir; public static bool DevOutput; public static Harmony H; private void Awake() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Folder = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); DevDir = Path.Combine(Folder, "dev"); DevOutput = File.Exists(Path.Combine(Folder, "dev.flag")); if (DevOutput) { Directory.CreateDirectory(DevDir); } H = new Harmony("com.modernwarfare.tabs"); try { Registry.Patch(H); } catch (Exception ex) { Log.LogError((object)("registry patches: " + ex)); } try { ArmorSystem.Patch(H); } catch (Exception ex2) { Log.LogError((object)("armour patches: " + ex2)); } try { PlacementFix.Patch(H); } catch (Exception ex3) { Log.LogError((object)("placement patch: " + ex3)); } try { WaterPlacement.Patch(H); } catch (Exception ex4) { Log.LogError((object)("water placement patch: " + ex4)); } try { MaskEyes.Patch(H); } catch (Exception ex5) { Log.LogError((object)("mask eyes patch: " + ex5)); } try { FireDiscipline.Patch(H); } catch (Exception ex6) { Log.LogError((object)("fire discipline patch: " + ex6)); } try { HEShell.Patch(H); } catch (Exception ex7) { Log.LogError((object)("HE shell patch: " + ex7)); } GameObject val = new GameObject("ModernWarfareRunner"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<Runner>(); Log.LogInfo((object)("Modern Warfare 1.0.0 loaded from " + Folder)); } } public class Runner : MonoBehaviour { private IEnumerator Start() { while ((Object)(object)ServiceLocator.GetService<SoundPlayer>() == (Object)null) { yield return null; } yield return null; try { Content.Build(); } catch (Exception ex) { Plugin.Log.LogError((object)("Content build failed: " + ex)); } string dump = Path.Combine(Plugin.Folder, "dump.flag"); if (File.Exists(dump)) { try { Dumper.DumpAll(Path.Combine(Plugin.Folder, "dump.txt")); } catch (Exception ex2) { Plugin.Log.LogError((object)("dump failed: " + ex2)); } File.Delete(dump); yield return (object)new WaitForSeconds(0.5f); Application.Quit(); yield break; } string test = Path.Combine(Plugin.Folder, "selftest.flag"); if (File.Exists(test)) { string scenario = File.ReadAllText(test).Trim(); File.Delete(test); if (scenario.Length == 0) { scenario = "infantry"; } yield return ((MonoBehaviour)this).StartCoroutine(SelfTest.Run(scenario, (MonoBehaviour)(object)this)); } } } public static class SelfTest { public static readonly StringBuilder Report = new StringBuilder(); private static int errors; public static bool Running; public static void Log(string s) { Report.AppendLine($"[{Time.realtimeSinceStartup,6:0.0}] {s}"); Plugin.Log.LogInfo((object)("[selftest] " + s)); } public static void OnUnityLog(string condition, string stack, LogType type) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 if (Running && ((int)type == 4 || (int)type == 0)) { errors++; if (errors < 60) { Report.AppendLine(string.Concat(" !! ", type, ": ", condition, ((int)type == 4) ? ("\n " + stack.Replace("\n", "\n ")) : "")); } } } public static IEnumerator Run(string scenario, MonoBehaviour host) { Running = true; Application.logMessageReceived += new LogCallback(OnUnityLog); string dir = Path.Combine(Plugin.Folder, "selftest"); Directory.CreateDirectory(dir); string[] files = Directory.GetFiles(dir, "*.png"); foreach (string path in files) { File.Delete(path); } Log("scenario: " + scenario); float wait = 0f; while (true) { Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.StartsWith("MainMenu") || !(wait < 60f)) { break; } wait += Time.unscaledDeltaTime; yield return null; } yield return (object)new WaitForSecondsRealtime(2f); GameModeService gms = ServiceLocator.GetService<GameModeService>(); gms.SetGameMode<SandboxGameMode>(); MapAsset map = ContentDatabase.Instance().GetAllMapAssetsOrdered().FirstOrDefault((Func<MapAsset, bool>)((MapAsset m) => (Object)(object)m != (Object)null && m.Entity.Name == ((scenario == "air") ? "MAP_SIMULATION_DAY" : "MAP_SIMULATION_DAY"))); Log("loading map " + (((Object)(object)map != (Object)null) ? map.MapName : "null")); TABSSceneManager.LoadMap(map, false); wait = 0f; while (wait < 90f) { wait += Time.unscaledDeltaTime; Scene activeScene2 = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene2)).name.Contains("Simulation") && !TABSSceneManager.IsLoading) { break; } yield return null; } object[] array = new object[4] { "scene: ", null, null, null }; Scene activeScene3 = SceneManager.GetActiveScene(); array[1] = ((Scene)(ref activeScene3)).name; array[2] = " loading="; array[3] = TABSSceneManager.IsLoading; Log(string.Concat(array)); yield return (object)new WaitForSecondsRealtime(4f); GameStateManager gsm = ServiceLocator.GetService<GameStateManager>(); Log("game state: " + ((gsm != null) ? ((object)gsm.GameState).ToString() : "null")); List<Unit> spawned = new List<Unit>(); Scenario(scenario, out var red, out var blue); foreach (KeyValuePair<UnitBlueprint, Vector3> item in red) { SpawnOne(item.Key, item.Value, (Team)0, spawned); } foreach (KeyValuePair<UnitBlueprint, Vector3> item2 in blue) { SpawnOne(item2.Key, item2.Value, (Team)1, spawned); } Log("spawned " + spawned.Count + " units"); yield return (object)new WaitForSecondsRealtime(1.5f); Camera cam = Camera.main; CameraRig rig = null; if ((Object)(object)cam != (Object)null) { rig = ((Component)cam).gameObject.AddComponent<CameraRig>(); rig.Disable(); } Vector3 center = Vector3.zero; foreach (Unit item3 in spawned) { if ((Object)(object)item3 != (Object)null) { center += Targets.Pos(item3); } } if (spawned.Count > 0) { center /= (float)spawned.Count; } Log("battle centre " + ((Vector3)(ref center)).ToString("F1")); if (scenario.StartsWith("gallery")) { yield return Gallery(spawned, rig, dir); } else { if ((Object)(object)rig != (Object)null) { rig.Set(center + new Vector3(-26f, 16f, -20f), center + Vector3.up * 1.5f); } yield return (object)new WaitForSecondsRealtime(0.5f); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "00_placement.png")); yield return (object)new WaitForSecondsRealtime(0.5f); if (gsm != null) { gsm.EnterBattleState(); } Log("battle started"); float t = 0f; int shot = 1; float[] shots = new float[6] { 3f, 7f, 12f, 18f, 26f, 36f }; float duration = ((scenario == "support" || scenario == "marines") ? 150f : ((scenario == "air" || scenario == "tanks" || scenario == "helis") ? 60f : 42f)); if (scenario == "support" || scenario == "marines") { shots = new float[9] { 4f, 12f, 22f, 35f, 50f, 70f, 95f, 120f, 145f }; } if (scenario == "helis") { shots = new float[7] { 3f, 9f, 16f, 24f, 32f, 42f, 52f }; } while (t < duration) { t += Time.unscaledDeltaTime; if ((Object)(object)rig != (Object)null) { Vector3 val = Vector3.zero; int num = 0; foreach (Unit item4 in spawned) { if (Targets.Alive(item4)) { val += Targets.Pos(item4); num++; } } if (num > 0) { center = Vector3.Lerp(center, val / (float)num, Time.unscaledDeltaTime * 0.5f); } float num2 = t * 0.08f; rig.Set(center + new Vector3(Mathf.Cos(num2) * -30f, 17f, Mathf.Sin(num2) * -30f), center + Vector3.up * 2f); } if (shot - 1 < shots.Length && t > shots[shot - 1]) { ScreenCapture.CaptureScreenshot(Path.Combine(dir, $"{shot:00}_t{(int)t:00}.png")); Log($"t={t:0} alive red={spawned.Count((Unit u) => (Object)(object)u != (Object)null && (int)u.Team == 0 && Targets.Alive(u))} blue={spawned.Count((Unit u) => (Object)(object)u != (Object)null && (int)u.Team == 1 && Targets.Alive(u))} | bullets={ArmorSystem.BulletsSeen} stopped={ArmorSystem.Stopped} pen={ArmorSystem.Penetrated} cracked={ArmorSystem.PlatesCracked} | ord fired={Ordnance.Fired} hits={Ordnance.Impacts} decoys={Ordnance.Decoys} | launched={Launcher.TotalLaunched} | clonefix restored={CloneFix.Restored} missed={CloneFix.Missed}"); Log($" helis: drops={HeliFlight.Drops} crashes={HeliFlight.Crashes} | tripods set up={SetupGun.Deployed} | bipod deploys={Bipod.Deploys}"); Log($" ifv: dismounted={IFV.Dismounted} shells={IFV.Shells} | cases={Casings.Ejected} | chem clouds={ChemCloud.Clouds} sick={ChemCloud.Sickened} turned={ChemCloud.Turned} | missiles off rails={HeliFlight.MissilesHidden} | shields fitted={HeldFit.Fitted}"); Log($" a10: runs={JetStrike.Runs} bombs={JetStrike.Bombs} shot={JetStrike.Shot} chaff={JetStrike.Chaff} | heli rearms={HeliFlight.Rearms} ships={NavalShip.Built} | barracks spawned={BarracksSpawner.Spawned} | tank smoke={IFV.Smokes} | atgm lost lock={Ordnance.LostLock} | doorgun blocked={DoorGun.Blocked} | placement fix={PlacementFix.Allowed}"); Log($" squads: huddles={Tactics.Huddles} rear guards={Tactics.RearGuards} fall backs={Tactics.FallBacks} regroups={Tactics.Regroups} | arma gun sounds={Sounds.ArmaGuns} tracers={Tracers.Attached}"); Log($" navy: lhd waves={AmphibShip.Waves} boats={AmphibShip.Boats} venoms={AmphibShip.Helis} | boats beached={BoatDrive.Beached} marines landed={BoatDrive.Landed} | masks on={Marines.MasksOn} | jet rockets={JetStrike.Rockets} | water scans={Water.Scans} | boarded={IFV.Boarded} snapped={SeatPose.Snapped}"); Log($" anims: hand actions={HandAction.Actions} chem throws={ChemThrow.Throws} masks donned={MaskDon.Donned} posed aiming={SeatPose.Aiming} eyes hidden={MaskEyes.Hidden}"); Log($" zombies: risen={Zombie.Risen} bites={Zombie.Bites} eaten={Zombie.Eaten}"); Log($" discipline: held (friendly)={FireDiscipline.HeldFriendly} held (vehicle)={FireDiscipline.HeldVehicle} side steps={FireDiscipline.Steps} | guns unbugged={Tactics.GunsUnbugged} | sat in cover={Tactics.Sits} rifles resting={SeatPose.Resting} | seats lowered={MachineKit.Lowered}"); foreach (Unit item5 in spawned) { if (!((Object)(object)item5 == (Object)null) && !((Object)(object)((Component)item5).GetComponentInChildren<HeliFlight>() == (Object)null) && !((Object)(object)item5.data == (Object)null) && !((Object)(object)item5.data.mainRig == (Object)null)) { object[] array2 = new object[4] { ((Object)(object)item5.unitBlueprint != (Object)null) ? item5.unitBlueprint.Name : ((Object)item5).name, null, null, null }; Vector3 position = item5.data.mainRig.position; array2[1] = ((Vector3)(ref position)).ToString("F1"); array2[2] = item5.data.health; array2[3] = item5.data.Dead; Log(string.Format(" {0} pos={1} hp={2:0} dead={3}", array2)); } } shot++; } yield return null; } foreach (Unit item6 in spawned) { if (!((Object)(object)item6 == (Object)null)) { string text = ""; BodyArmor componentInChildren = ((Component)item6).GetComponentInChildren<BodyArmor>(); if ((Object)(object)componentInChildren != (Object)null) { text = $" armour stops={componentInChildren.stops} helmetStops={componentInChildren.helmetStops} pens={componentInChildren.pens} plateHP={componentInChildren.plateHP:0}"; } ArmoredHull componentInChildren2 = ((Component)item6).GetComponentInChildren<ArmoredHull>(); if ((Object)(object)componentInChildren2 != (Object)null) { text = text + " hull:" + ((object)componentInChildren2).ToString(); } Log($" {item6.Team} {(((Object)(object)item6.unitBlueprint != (Object)null) ? item6.unitBlueprint.Name : ((Object)item6).name)} alive={Targets.Alive(item6)} hp={(((Object)(object)item6.data != (Object)null) ? item6.data.health : (-1f)):0}/{(((Object)(object)item6.data != (Object)null) ? item6.data.maxHealth : (-1f)):0}{text}"); } } int flung = 0; Unit[] array3 = Targets.Units(); foreach (Unit val2 in array3) { if ((Object)(object)val2 == (Object)null || (Object)(object)val2.data == (Object)null || (Object)(object)val2.data.mainRig == (Object)null || Targets.IsAir(val2)) { continue; } Vector3 position2 = val2.data.mainRig.position; Vector2 val3 = new Vector2(position2.x - center.x, position2.z - center.z); if (((Vector2)(ref val3)).magnitude > 140f || position2.y > center.y + 30f || position2.y < center.y - 30f) { flung++; if (flung <= 8) { Log(" FLUNG " + (((Object)(object)val2.unitBlueprint != (Object)null) ? val2.unitBlueprint.Name : ((Object)val2).name) + " at " + ((Vector3)(ref position2)).ToString("F0")); } } } Log(" units flung off the field: " + flung); IFV[] array4 = Object.FindObjectsOfType<IFV>(); foreach (IFV iFV in array4) { Quaternion rotation = ((Component)iFV).transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; Log($" ifv {((Object)((Component)iFV).transform.root).name} pitch={Mathf.DeltaAngle(0f, eulerAngles.x):0.0} roll={Mathf.DeltaAngle(0f, eulerAngles.z):0.0}"); } } Log("errors logged: " + errors); File.WriteAllText(Path.Combine(dir, "report.txt"), Report.ToString()); Running = false; yield return (object)new WaitForSecondsRealtime(1f); Application.Quit(); } private static IEnumerator Gallery(List<Unit> sp