using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInExPlugin; using HarmonyLib; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FrankysAircraftModifier (FrankysAircraftModifier)")] [assembly: AssemblyProduct("FrankysAircraftModifier")] [assembly: AssemblyVersion("1.0.0.0")] namespace BepInExPlugin { [BepInPlugin("FrankysAircraftModifier", "FrankysAircraftModifier", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry RegionDesc; public static ConfigEntry RegionsBoolValue; public static ConfigEntry HornetSearchValue; public static ConfigEntry SuperHornetSearchValue; public static ConfigEntry ProwlerSearchValue; public static ConfigEntry HawkeyeSearchValue; public static ConfigEntry SeahawkSearchValue; public static ConfigEntry HarrierSearchValue; public static ConfigEntry VikingSearchValue; public static ConfigEntry HornetRadarValue; public static ConfigEntry SuperHornetRadarValue; public static ConfigEntry ProwlerRadarValue; public static ConfigEntry HawkeyeRadarValue; public static ConfigEntry SeahawkRadarValue; public static ConfigEntry HarrierRadarValue; public static ConfigEntry VikingRadarValue; public static ConfigEntry HornetRepairValue; public static ConfigEntry SuperHornetRepairValue; public static ConfigEntry ProwlerRepairValue; public static ConfigEntry HawkeyeRepairValue; public static ConfigEntry OspreyRepairValue; public static ConfigEntry GreyoundRepairValue; public static ConfigEntry SeahawkRepairValue; public static ConfigEntry ChinookRepairValue; public static ConfigEntry HarrierRepairValue; public static ConfigEntry VikingRepairValue; public static ConfigEntry HornetSpeedValue; public static ConfigEntry SuperHornetSpeedValue; public static ConfigEntry ProwlerSpeedValue; public static ConfigEntry HawkeyeSpeedValue; public static ConfigEntry OspreySpeedValue; public static ConfigEntry GreyoundSpeedValue; public static ConfigEntry SeahawkSpeedValue; public static ConfigEntry ChinookSpeedValue; public static ConfigEntry HarrierSpeedValue; public static ConfigEntry VikingSpeedValue; public static ConfigEntry CrewSpeedDesc; public static ConfigEntry MaintenacneValue; public static ConfigEntry FuelValue; public static ConfigEntry WeaponsValue; public static ConfigEntry InfantryValue; public static ConfigEntry CargoValue; public static ConfigEntry SafetyValue; public static ConfigEntry SpecialForcesValue; public static ConfigEntry AccelerationValue; public static ConfigEntry TruckSpeedDesc; public static ConfigEntry TruckValue; public static ConfigEntry RearmTimeDesc; public static ConfigEntry RearmValue; public static ConfigEntry HornetRefuelValue; public static ConfigEntry SuperHornetRefuelValue; public static ConfigEntry ProwlerRefuelValue; public static ConfigEntry HawkeyeRefuelValue; public static ConfigEntry OspreyRefuelValue; public static ConfigEntry GreyoundRefuelValue; public static ConfigEntry SeahawkRefuelValue; public static ConfigEntry ChinookRefuelValue; public static ConfigEntry HarrierRefuelValue; public static ConfigEntry VikingRefuelValue; public static ConfigEntry OutgoingDesc; public static ConfigEntry OutgoingValue; public static ConfigEntry CarrierRangeDesc; public static ConfigEntry CarrierRangeValue; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("FrankysAircraftModifier"); val.PatchAll(); Debug.Log((object)"FrankysAircraftModifier loaded"); RegionDesc = ((BaseUnityPlugin)this).Config.Bind("Aircraft Regions", "Description", "This section sets whether or not VTOL aircraft (exl. Harrier) can VTOL from catapults", ""); RegionsBoolValue = ((BaseUnityPlugin)this).Config.Bind("Aircraft Regions", "VTOL at catapults", false, ""); CrewSpeedDesc = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Description", "This section changes how fast the crew moves. Acceleration NEEDS to be higher than the speed so units don't slide everywhere!", ""); MaintenacneValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Maintence Crew Speed", 1f, ""); FuelValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Fuel Crew Speed", 1f, ""); WeaponsValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Weapons Crew Speed", 1f, ""); InfantryValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Infantry Speed", 1f, ""); CargoValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Cargo Crew Speed", 1f, ""); SafetyValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Safety Crew Speed", 1f, ""); SpecialForcesValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Special Forces Speed", 1f, ""); AccelerationValue = ((BaseUnityPlugin)this).Config.Bind("Crew Speed", "Acceleration Factor", 1f, "You want this to be a higher number than your crew speed"); TruckSpeedDesc = ((BaseUnityPlugin)this).Config.Bind("Cargo Truck Speed", "Description", "This section changes how fast the cargo truck is", ""); TruckValue = ((BaseUnityPlugin)this).Config.Bind("Cargo Truck Speed", "Cargo Truck Speed", 12f, ""); RearmTimeDesc = ((BaseUnityPlugin)this).Config.Bind("Rearm Time", "Description", "This section changes how fast the crew rearm aircraft", ""); RearmValue = ((BaseUnityPlugin)this).Config.Bind("Rearm Time", "Rearm Time", 8f, ""); OutgoingDesc = ((BaseUnityPlugin)this).Config.Bind("Outgoing Missions", "Description", "This section changes how many outgoing missions you can have", ""); OutgoingValue = ((BaseUnityPlugin)this).Config.Bind("Outgoing Missions", "Outgoing Missions", 3, ""); CarrierRangeDesc = ((BaseUnityPlugin)this).Config.Bind("Carrier Radar Range", "Description", "This section changes how far the carriers radar can see", ""); CarrierRangeValue = ((BaseUnityPlugin)this).Config.Bind("Carrier Radar Range", "Carrier Radar Range", 0.25f, ""); HornetSearchValue = ((BaseUnityPlugin)this).Config.Bind("Hornet", "Search Time Multiplier", 1f, ""); HornetRadarValue = ((BaseUnityPlugin)this).Config.Bind("Hornet", "Radar Range", 0.5f, ""); HornetRepairValue = ((BaseUnityPlugin)this).Config.Bind("Hornet", "Repair Speed", 8f, ""); HornetSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Hornet", "Taxi Speed", 14f, ""); HornetRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Hornet", "Refuel Time", 8f, ""); SuperHornetSearchValue = ((BaseUnityPlugin)this).Config.Bind("Super Hornet", "Search Time Multiplier", 1.3f, ""); SuperHornetRadarValue = ((BaseUnityPlugin)this).Config.Bind("Super Hornet", "Radar Range", 0.5f, ""); SuperHornetRepairValue = ((BaseUnityPlugin)this).Config.Bind("Super Hornet", "Repair Speed", 8f, ""); SuperHornetSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Super Hornet", "Taxi Speed", 14f, ""); SuperHornetRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Super Hornet", "Refuel Time", 8f, ""); ProwlerSearchValue = ((BaseUnityPlugin)this).Config.Bind("Prowler", "Search Time Multiplier", 1.2f, ""); ProwlerRadarValue = ((BaseUnityPlugin)this).Config.Bind("Prowler", "Radar Range", 0.75f, ""); ProwlerRepairValue = ((BaseUnityPlugin)this).Config.Bind("Prowler", "Repair Speed", 8f, ""); ProwlerSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Prowler", "Taxi Speed", 14f, ""); ProwlerRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Prowler", "Refuel Time", 8f, ""); HawkeyeSearchValue = ((BaseUnityPlugin)this).Config.Bind("Hawkeye", "Search Time Multiplier", 2.2f, ""); HawkeyeRadarValue = ((BaseUnityPlugin)this).Config.Bind("Hawkeye", "Radar Range", 1f, ""); HawkeyeRepairValue = ((BaseUnityPlugin)this).Config.Bind("Hawkeye", "Repair Speed", 8f, ""); HawkeyeSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Hawkeye", "Taxi Speed", 14f, ""); HawkeyeRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Hawkeye", "Refuel Time", 8f, ""); OspreyRepairValue = ((BaseUnityPlugin)this).Config.Bind("Osprey", "Repair Speed", 8f, ""); OspreySpeedValue = ((BaseUnityPlugin)this).Config.Bind("Osprey", "Taxi Speed", 14f, ""); OspreyRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Osprey", "Refuel Time", 8f, ""); GreyoundRepairValue = ((BaseUnityPlugin)this).Config.Bind("Greyhound", "Repair Speed", 8f, ""); GreyoundSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Greyhound", "Taxi Speed", 14f, ""); GreyoundRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Greyhound", "Refuel Time", 8f, ""); SeahawkSearchValue = ((BaseUnityPlugin)this).Config.Bind("Seahawk", "Search Time Multiplier", 1f, ""); SeahawkRadarValue = ((BaseUnityPlugin)this).Config.Bind("Seahawk", "Radar Range", 0.5f, ""); SeahawkRepairValue = ((BaseUnityPlugin)this).Config.Bind("Seahawk", "Repair Speed", 8f, ""); SeahawkSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Seahawk", "Taxi Speed", 14f, ""); SeahawkRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Seahawk", "Refuel Time", 8f, ""); ChinookRepairValue = ((BaseUnityPlugin)this).Config.Bind("Chinook", "Repair Speed", 8f, ""); ChinookSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Chinook", "Taxi Speed", 14f, ""); ChinookRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Chinook", "Refuel Time", 8f, ""); HarrierSearchValue = ((BaseUnityPlugin)this).Config.Bind("Harrier", "Search Time Multiplier", 1f, ""); HarrierRadarValue = ((BaseUnityPlugin)this).Config.Bind("Harrier", "Radar Range", 0.5f, ""); HarrierRepairValue = ((BaseUnityPlugin)this).Config.Bind("Harrier", "Repair Speed", 8f, ""); HarrierSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Harrier", "Taxi Speed", 14f, ""); HarrierRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Harrier", "Refuel Time", 8f, ""); VikingSearchValue = ((BaseUnityPlugin)this).Config.Bind("Viking", "Search Time Multiplier", 1.5f, ""); VikingRadarValue = ((BaseUnityPlugin)this).Config.Bind("Viking", "Radar Range", 0.75f, ""); VikingRepairValue = ((BaseUnityPlugin)this).Config.Bind("Viking", "Repair Speed", 8f, ""); VikingSpeedValue = ((BaseUnityPlugin)this).Config.Bind("Viking", "Taxi Speed", 14f, ""); VikingRefuelValue = ((BaseUnityPlugin)this).Config.Bind("Viking", "Refuel Time", 8f, ""); } } internal static class PluginInfo { public const string PLUGIN_NAME = "FrankysAircraftModifier"; public const string PLUGIN_ID = "FrankysAircraftModifier"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace FrankysAircraftModifier { [HarmonyPatch(typeof(PathedMovementAction), "Awake")] public static class TruckSpeedOverride { private static void Prefix(PathedMovementAction __instance) { //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Invalid comparison between Unknown and I4 Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if (!((Object)(object)val == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(PathedMovementAction), "_movementSpeed"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Unit), "_unitType"); UnitType val2 = (UnitType)fieldInfo2.GetValue(val); float value = Plugin.TruckValue.Value; if ((object)fieldInfo == null) { Debug.LogError((object)"Taxi Speed field not valid yet"); } else if ((int)val2 == 12) { fieldInfo.SetValue(__instance, value); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value}"); } } } } [HarmonyPatch(typeof(MissionManager), "Awake")] public static class CarrierRangeOverride { private static void Prefix(MissionManager __instance) { FieldInfo fieldInfo = AccessTools.Field(typeof(MissionManager), "_carrierRadarDetectionRange"); float value = Plugin.CarrierRangeValue.Value; if ((object)fieldInfo == null) { Debug.LogError((object)"waitForWarmup bool not valid yet"); return; } fieldInfo.SetValue(__instance, value); Debug.Log((object)$"Carrier radar range set to {value}"); } } [HarmonyPatch(typeof(CrewMember), "Awake")] public static class CrewmemberSpeedOverride { private static void Prefix(CrewMember __instance) { //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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Invalid comparison between Unknown and I4 //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Invalid comparison between Unknown and I4 //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Invalid comparison between Unknown and I4 //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Invalid comparison between Unknown and I4 //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Invalid comparison between Unknown and I4 //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Invalid comparison between Unknown and I4 CrewMember val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if ((Object)(object)val == (Object)null) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(CrewMember), "_speedMultiplier"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(CrewMember), "_crewMemberType"); CrewMemberType val2 = (CrewMemberType)fieldInfo2.GetValue(val); FloatRange val3 = (FloatRange)fieldInfo.GetValue(__instance); NavMeshAgent component = ((Component)__instance).GetComponent(); float value = Plugin.MaintenacneValue.Value; float value2 = Plugin.FuelValue.Value; float value3 = Plugin.WeaponsValue.Value; float value4 = Plugin.InfantryValue.Value; float value5 = Plugin.CargoValue.Value; float value6 = Plugin.SafetyValue.Value; float value7 = Plugin.SpecialForcesValue.Value; float value8 = Plugin.AccelerationValue.Value; if ((object)fieldInfo == null) { Debug.LogError((object)"Crewmember Speed field not valid yet"); return; } if ((int)val2 == 1) { ((FloatRange)(ref val3)).Min = value; ((FloatRange)(ref val3)).Max = value; component.speed = value; component.acceleration = value8; Debug.Log((object)$"{((Object)val).name} speed set to {value}"); } if ((int)val2 == 2) { ((FloatRange)(ref val3)).Min = value2; ((FloatRange)(ref val3)).Max = value2; component.speed = value2; component.acceleration = value8; Debug.Log((object)$"{((Object)val).name} speed set to {value2}"); } if ((int)val2 == 3) { ((FloatRange)(ref val3)).Min = value3; ((FloatRange)(ref val3)).Max = value3; component.speed = value3; component.acceleration = value8; Debug.Log((object)$"{((Object)val).name} speed set to {value3}"); } if ((int)val2 == 4) { ((FloatRange)(ref val3)).Min = value4; ((FloatRange)(ref val3)).Max = value4; component.speed = value4; component.acceleration = value8; Debug.Log((object)$"{((Object)val).name} speed set to {value4}"); } if ((int)val2 == 5) { ((FloatRange)(ref val3)).Min = value5; ((FloatRange)(ref val3)).Max = value5; component.speed = value5; component.acceleration = value8; Debug.Log((object)$"{((Object)val).name} speed set to {value5}"); } if ((int)val2 == 6) { ((FloatRange)(ref val3)).Min = value6; ((FloatRange)(ref val3)).Max = value6; component.speed = value6; component.acceleration = value8; Debug.Log((object)$"{((Object)val).name} speed set to {value6}"); } if ((int)val2 == 7) { ((FloatRange)(ref val3)).Min = value7; ((FloatRange)(ref val3)).Max = value7; component.speed = value7; component.acceleration = value8; Debug.Log((object)$"{((Object)val).name} speed set to {value7}"); } } } [HarmonyPatch(typeof(MissionManager), "Awake")] public static class OutgoingMissionsOverride { private static void Prefix(MissionManager __instance) { FieldInfo fieldInfo = AccessTools.Field(typeof(MissionManager), "_maxOutgoingMissions"); int num = Mathf.RoundToInt((float)Plugin.OutgoingValue.Value); if ((object)fieldInfo == null) { Debug.LogError((object)"Mission Field not valid yet"); return; } fieldInfo.SetValue(__instance, num); Debug.Log((object)$"Outgoing Missions set to {num}"); } } [HarmonyPatch(typeof(Unit), "Awake")] public static class RadarRangeOverride { private static void Prefix(Unit __instance) { //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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Invalid comparison between Unknown and I4 //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Invalid comparison between Unknown and I4 //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Invalid comparison between Unknown and I4 //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Invalid comparison between Unknown and I4 //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Invalid comparison between Unknown and I4 Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if (!((Object)(object)val == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(Unit), "_radarDetectionRange"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Unit), "_unitType"); UnitType val2 = (UnitType)fieldInfo2.GetValue(val); float value = Plugin.HornetRadarValue.Value; float value2 = Plugin.SuperHornetRadarValue.Value; float value3 = Plugin.ProwlerRadarValue.Value; float value4 = Plugin.HawkeyeRadarValue.Value; float value5 = Plugin.SeahawkRadarValue.Value; float value6 = Plugin.HarrierRadarValue.Value; float value7 = Plugin.VikingRadarValue.Value; if ((int)val2 == 1) { fieldInfo.SetValue(__instance, value); Debug.Log((object)$"{((Object)val).name} radar range set to {value}"); } if ((int)val2 == 2) { fieldInfo.SetValue(__instance, value2); Debug.Log((object)$"{((Object)val).name} radar range set to {value2}"); } if ((int)val2 == 3) { fieldInfo.SetValue(__instance, value3); Debug.Log((object)$"{((Object)val).name} radar range set to {value3}"); } if ((int)val2 == 4) { fieldInfo.SetValue(__instance, value4); Debug.Log((object)$"{((Object)val).name} radar range set to {value4}"); } if ((int)val2 == 7) { fieldInfo.SetValue(__instance, value5); Debug.Log((object)$"{((Object)val).name} radar range set to {value5}"); } if ((int)val2 == 10) { fieldInfo.SetValue(__instance, value6); Debug.Log((object)$"{((Object)val).name} radar range set to {value6}"); } if ((int)val2 == 11) { fieldInfo.SetValue(__instance, value7); Debug.Log((object)$"{((Object)val).name} radar range set to {value7}"); } } } } [HarmonyPatch(typeof(MissionAction), "Awake")] public static class RearmTimeOverride { private static void Prefix(MissionAction __instance) { //IL_0098: 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_00ad: Unknown result type (might be due to invalid IL or missing references) Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if (!((Object)(object)val == (Object)null)) { HashSet hashSet = new HashSet { (MissionType)1, (MissionType)2, (MissionType)3, (MissionType)4, (MissionType)5, (MissionType)7, (MissionType)8, (MissionType)9 }; FieldInfo fieldInfo = AccessTools.Field(((object)__instance).GetType(), "_workDuration"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Unit), "_unitType"); UnitType val2 = (UnitType)fieldInfo2.GetValue(val); float value = Plugin.RearmValue.Value; if (hashSet.Contains(__instance.MissionType) && (object)fieldInfo != null) { fieldInfo.SetValue(__instance, value); Debug.Log((object)$"{((Object)val).name} Rearm Time set to {value}"); } } } } [HarmonyPatch(typeof(RepairAction), "Awake")] public static class RepairTimeOverride { private static void Prefix(RepairAction __instance) { //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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Invalid comparison between Unknown and I4 //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Invalid comparison between Unknown and I4 //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Invalid comparison between Unknown and I4 //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Invalid comparison between Unknown and I4 //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Invalid comparison between Unknown and I4 //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Invalid comparison between Unknown and I4 //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Invalid comparison between Unknown and I4 //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Invalid comparison between Unknown and I4 //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Invalid comparison between Unknown and I4 Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if ((Object)(object)val == (Object)null) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(RepairAction), "_timeToRepair"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Unit), "_unitType"); UnitType val2 = (UnitType)fieldInfo2.GetValue(val); float value = Plugin.HornetRepairValue.Value; float value2 = Plugin.SuperHornetRepairValue.Value; float value3 = Plugin.ProwlerRepairValue.Value; float value4 = Plugin.HawkeyeRepairValue.Value; float value5 = Plugin.OspreyRepairValue.Value; float value6 = Plugin.GreyoundRepairValue.Value; float value7 = Plugin.SeahawkRepairValue.Value; float value8 = Plugin.ChinookRepairValue.Value; float value9 = Plugin.HarrierRepairValue.Value; float value10 = Plugin.VikingRepairValue.Value; if ((object)fieldInfo == null) { Debug.LogError((object)"Repair field not valid yet"); return; } if ((int)val2 == 1) { fieldInfo.SetValue(__instance, value); Debug.Log((object)$"{((Object)val).name} repair time set to {value}"); } if ((int)val2 == 2) { fieldInfo.SetValue(__instance, value2); Debug.Log((object)$"{((Object)val).name} repair time set to {value2}"); } if ((int)val2 == 3) { fieldInfo.SetValue(__instance, value3); Debug.Log((object)$"{((Object)val).name} repair time set to {value3}"); } if ((int)val2 == 4) { fieldInfo.SetValue(__instance, value4); Debug.Log((object)$"{((Object)val).name} repair time set to {value4}"); } if ((int)val2 == 5) { fieldInfo.SetValue(__instance, value5); Debug.Log((object)$"{((Object)val).name} repair time set to {value5}"); } if ((int)val2 == 6) { fieldInfo.SetValue(__instance, value6); Debug.Log((object)$"{((Object)val).name} repair time set to {value6}"); } if ((int)val2 == 7) { fieldInfo.SetValue(__instance, value7); Debug.Log((object)$"{((Object)val).name} repair time set to {value7}"); } if ((int)val2 == 9) { fieldInfo.SetValue(__instance, value8); Debug.Log((object)$"{((Object)val).name} repair time set to {value8}"); } if ((int)val2 == 10) { fieldInfo.SetValue(__instance, value9); Debug.Log((object)$"{((Object)val).name} repair time set to {value9}"); } if ((int)val2 == 11) { fieldInfo.SetValue(__instance, value10); Debug.Log((object)$"{((Object)val).name} repair time set to {value10}"); } } } [HarmonyPatch(typeof(Unit), "Awake")] public static class SearchMultiplierOverride { private static void Prefix(Unit __instance) { //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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Invalid comparison between Unknown and I4 //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Invalid comparison between Unknown and I4 //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Invalid comparison between Unknown and I4 //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Invalid comparison between Unknown and I4 //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Invalid comparison between Unknown and I4 Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if (!((Object)(object)val == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(Unit), "_searchMissionTimeMultiplier"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Unit), "_unitType"); UnitType val2 = (UnitType)fieldInfo2.GetValue(val); float value = Plugin.HornetSearchValue.Value; float value2 = Plugin.SuperHornetSearchValue.Value; float value3 = Plugin.ProwlerSearchValue.Value; float value4 = Plugin.HawkeyeSearchValue.Value; float value5 = Plugin.SeahawkSearchValue.Value; float value6 = Plugin.HarrierSearchValue.Value; float value7 = Plugin.VikingSearchValue.Value; if ((int)val2 == 1) { fieldInfo.SetValue(__instance, value); Debug.Log((object)$"{((Object)val).name} radar range set to {value}"); } if ((int)val2 == 2) { fieldInfo.SetValue(__instance, value2); Debug.Log((object)$"{((Object)val).name} radar range set to {value2}"); } if ((int)val2 == 3) { fieldInfo.SetValue(__instance, value3); Debug.Log((object)$"{((Object)val).name} radar range set to {value3}"); } if ((int)val2 == 4) { fieldInfo.SetValue(__instance, value4); Debug.Log((object)$"{((Object)val).name} radar range set to {value4}"); } if ((int)val2 == 7) { fieldInfo.SetValue(__instance, value5); Debug.Log((object)$"{((Object)val).name} radar range set to {value5}"); } if ((int)val2 == 10) { fieldInfo.SetValue(__instance, value6); Debug.Log((object)$"{((Object)val).name} radar range set to {value6}"); } if ((int)val2 == 11) { fieldInfo.SetValue(__instance, value7); Debug.Log((object)$"{((Object)val).name} radar range set to {value7}"); } } } } [HarmonyPatch(typeof(PathedMovementAction), "Awake")] public static class TaxiSpeedOverride { private static void Prefix(PathedMovementAction __instance) { //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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Invalid comparison between Unknown and I4 //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Invalid comparison between Unknown and I4 //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Invalid comparison between Unknown and I4 //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Invalid comparison between Unknown and I4 //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Invalid comparison between Unknown and I4 //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Invalid comparison between Unknown and I4 //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Invalid comparison between Unknown and I4 //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Invalid comparison between Unknown and I4 //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Invalid comparison between Unknown and I4 Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if ((Object)(object)val == (Object)null) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(PathedMovementAction), "_movementSpeed"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Unit), "_unitType"); UnitType val2 = (UnitType)fieldInfo2.GetValue(val); float value = Plugin.HornetSpeedValue.Value; float value2 = Plugin.SuperHornetSpeedValue.Value; float value3 = Plugin.ProwlerSpeedValue.Value; float value4 = Plugin.HawkeyeSpeedValue.Value; float value5 = Plugin.OspreySpeedValue.Value; float value6 = Plugin.GreyoundSpeedValue.Value; float value7 = Plugin.SeahawkSpeedValue.Value; float value8 = Plugin.ChinookSpeedValue.Value; float value9 = Plugin.HarrierSpeedValue.Value; float value10 = Plugin.VikingSpeedValue.Value; if ((object)fieldInfo == null) { Debug.LogError((object)"Taxi Speed field not valid yet"); return; } if ((int)val2 == 1) { fieldInfo.SetValue(__instance, value); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value}"); } if ((int)val2 == 2) { fieldInfo.SetValue(__instance, value2); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value2}"); } if ((int)val2 == 3) { fieldInfo.SetValue(__instance, value3); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value3}"); } if ((int)val2 == 4) { fieldInfo.SetValue(__instance, value4); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value4}"); } if ((int)val2 == 5) { fieldInfo.SetValue(__instance, value5); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value5}"); } if ((int)val2 == 6) { fieldInfo.SetValue(__instance, value6); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value6}"); } if ((int)val2 == 7) { fieldInfo.SetValue(__instance, value7); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value7}"); } if ((int)val2 == 9) { fieldInfo.SetValue(__instance, value8); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value8}"); } if ((int)val2 == 10) { fieldInfo.SetValue(__instance, value9); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value9}"); } if ((int)val2 == 11) { fieldInfo.SetValue(__instance, value10); Debug.Log((object)$"{((Object)val).name} taxi speed set to {value10}"); } } } [HarmonyPatch(typeof(EntityAction), "IsRegionTypeAllowed")] public static class VTOLRegionOverride { private static bool Prefix(EntityAction __instance, RegionType regionType, ref bool __result) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if ((Object)(object)val == (Object)null) { return true; } if (((int)val.UnitType == 5 || (int)val.UnitType == 7 || (int)val.UnitType == 9) && ((int)regionType == 2 || (int)regionType == 4 || (int)regionType == 5)) { __result = true; return false; } return true; } } } namespace FrankysAircraftModifier.FrankysAircraftModifier { [HarmonyPatch(typeof(RefuelAction), "Awake")] public static class RefuelTimeOverride { private static void Prefix(RefuelAction __instance) { //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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Invalid comparison between Unknown and I4 //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Invalid comparison between Unknown and I4 //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Invalid comparison between Unknown and I4 //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Invalid comparison between Unknown and I4 //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Invalid comparison between Unknown and I4 //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Invalid comparison between Unknown and I4 //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Invalid comparison between Unknown and I4 //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Invalid comparison between Unknown and I4 //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Invalid comparison between Unknown and I4 Unit val = ((Component)__instance).GetComponent() ?? ((Component)__instance).GetComponentInParent(); if ((Object)(object)val == (Object)null) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(RefuelAction), "_timeToRefuel"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Unit), "_unitType"); UnitType val2 = (UnitType)fieldInfo2.GetValue(val); float value = Plugin.HornetRefuelValue.Value; float value2 = Plugin.SuperHornetRefuelValue.Value; float value3 = Plugin.ProwlerRefuelValue.Value; float value4 = Plugin.HawkeyeRefuelValue.Value; float value5 = Plugin.OspreyRefuelValue.Value; float value6 = Plugin.GreyoundRefuelValue.Value; float value7 = Plugin.SeahawkRefuelValue.Value; float value8 = Plugin.ChinookRefuelValue.Value; float value9 = Plugin.HarrierRefuelValue.Value; float value10 = Plugin.VikingRefuelValue.Value; if ((object)fieldInfo == null) { Debug.LogError((object)"Refuel field not valid yet"); return; } if ((int)val2 == 1) { fieldInfo.SetValue(__instance, value); Debug.Log((object)$"{((Object)val).name} refuel time set to {value}"); } if ((int)val2 == 2) { fieldInfo.SetValue(__instance, value2); Debug.Log((object)$"{((Object)val).name} refuel time set to {value2}"); } if ((int)val2 == 3) { fieldInfo.SetValue(__instance, value3); Debug.Log((object)$"{((Object)val).name} refuel time set to {value3}"); } if ((int)val2 == 4) { fieldInfo.SetValue(__instance, value4); Debug.Log((object)$"{((Object)val).name} refuel time set to {value4}"); } if ((int)val2 == 5) { fieldInfo.SetValue(__instance, value5); Debug.Log((object)$"{((Object)val).name} refuel time set to {value5}"); } if ((int)val2 == 6) { fieldInfo.SetValue(__instance, value6); Debug.Log((object)$"{((Object)val).name} refuel time set to {value6}"); } if ((int)val2 == 7) { fieldInfo.SetValue(__instance, value7); Debug.Log((object)$"{((Object)val).name} refuel time set to {value7}"); } if ((int)val2 == 9) { fieldInfo.SetValue(__instance, value8); Debug.Log((object)$"{((Object)val).name} refuel time set to {value8}"); } if ((int)val2 == 10) { fieldInfo.SetValue(__instance, value9); Debug.Log((object)$"{((Object)val).name} refuel time set to {value9}"); } if ((int)val2 == 11) { fieldInfo.SetValue(__instance, value10); Debug.Log((object)$"{((Object)val).name} refuel time set to {value10}"); } } } }