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<string> RegionDesc;
public static ConfigEntry<bool> RegionsBoolValue;
public static ConfigEntry<float> HornetSearchValue;
public static ConfigEntry<float> SuperHornetSearchValue;
public static ConfigEntry<float> ProwlerSearchValue;
public static ConfigEntry<float> HawkeyeSearchValue;
public static ConfigEntry<float> SeahawkSearchValue;
public static ConfigEntry<float> HarrierSearchValue;
public static ConfigEntry<float> VikingSearchValue;
public static ConfigEntry<float> HornetRadarValue;
public static ConfigEntry<float> SuperHornetRadarValue;
public static ConfigEntry<float> ProwlerRadarValue;
public static ConfigEntry<float> HawkeyeRadarValue;
public static ConfigEntry<float> SeahawkRadarValue;
public static ConfigEntry<float> HarrierRadarValue;
public static ConfigEntry<float> VikingRadarValue;
public static ConfigEntry<float> HornetRepairValue;
public static ConfigEntry<float> SuperHornetRepairValue;
public static ConfigEntry<float> ProwlerRepairValue;
public static ConfigEntry<float> HawkeyeRepairValue;
public static ConfigEntry<float> OspreyRepairValue;
public static ConfigEntry<float> GreyoundRepairValue;
public static ConfigEntry<float> SeahawkRepairValue;
public static ConfigEntry<float> ChinookRepairValue;
public static ConfigEntry<float> HarrierRepairValue;
public static ConfigEntry<float> VikingRepairValue;
public static ConfigEntry<float> HornetSpeedValue;
public static ConfigEntry<float> SuperHornetSpeedValue;
public static ConfigEntry<float> ProwlerSpeedValue;
public static ConfigEntry<float> HawkeyeSpeedValue;
public static ConfigEntry<float> OspreySpeedValue;
public static ConfigEntry<float> GreyoundSpeedValue;
public static ConfigEntry<float> SeahawkSpeedValue;
public static ConfigEntry<float> ChinookSpeedValue;
public static ConfigEntry<float> HarrierSpeedValue;
public static ConfigEntry<float> VikingSpeedValue;
public static ConfigEntry<string> CrewSpeedDesc;
public static ConfigEntry<float> MaintenacneValue;
public static ConfigEntry<float> FuelValue;
public static ConfigEntry<float> WeaponsValue;
public static ConfigEntry<float> InfantryValue;
public static ConfigEntry<float> CargoValue;
public static ConfigEntry<float> SafetyValue;
public static ConfigEntry<float> SpecialForcesValue;
public static ConfigEntry<float> AccelerationValue;
public static ConfigEntry<string> TruckSpeedDesc;
public static ConfigEntry<float> TruckValue;
public static ConfigEntry<string> RearmTimeDesc;
public static ConfigEntry<float> RearmValue;
public static ConfigEntry<float> HornetRefuelValue;
public static ConfigEntry<float> SuperHornetRefuelValue;
public static ConfigEntry<float> ProwlerRefuelValue;
public static ConfigEntry<float> HawkeyeRefuelValue;
public static ConfigEntry<float> OspreyRefuelValue;
public static ConfigEntry<float> GreyoundRefuelValue;
public static ConfigEntry<float> SeahawkRefuelValue;
public static ConfigEntry<float> ChinookRefuelValue;
public static ConfigEntry<float> HarrierRefuelValue;
public static ConfigEntry<float> VikingRefuelValue;
public static ConfigEntry<string> OutgoingDesc;
public static ConfigEntry<int> OutgoingValue;
public static ConfigEntry<string> CarrierRangeDesc;
public static ConfigEntry<float> 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<string>("Aircraft Regions", "Description", "This section sets whether or not VTOL aircraft (exl. Harrier) can VTOL from catapults", "");
RegionsBoolValue = ((BaseUnityPlugin)this).Config.Bind<bool>("Aircraft Regions", "VTOL at catapults", false, "");
CrewSpeedDesc = ((BaseUnityPlugin)this).Config.Bind<string>("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<float>("Crew Speed", "Maintence Crew Speed", 1f, "");
FuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Crew Speed", "Fuel Crew Speed", 1f, "");
WeaponsValue = ((BaseUnityPlugin)this).Config.Bind<float>("Crew Speed", "Weapons Crew Speed", 1f, "");
InfantryValue = ((BaseUnityPlugin)this).Config.Bind<float>("Crew Speed", "Infantry Speed", 1f, "");
CargoValue = ((BaseUnityPlugin)this).Config.Bind<float>("Crew Speed", "Cargo Crew Speed", 1f, "");
SafetyValue = ((BaseUnityPlugin)this).Config.Bind<float>("Crew Speed", "Safety Crew Speed", 1f, "");
SpecialForcesValue = ((BaseUnityPlugin)this).Config.Bind<float>("Crew Speed", "Special Forces Speed", 1f, "");
AccelerationValue = ((BaseUnityPlugin)this).Config.Bind<float>("Crew Speed", "Acceleration Factor", 1f, "You want this to be a higher number than your crew speed");
TruckSpeedDesc = ((BaseUnityPlugin)this).Config.Bind<string>("Cargo Truck Speed", "Description", "This section changes how fast the cargo truck is", "");
TruckValue = ((BaseUnityPlugin)this).Config.Bind<float>("Cargo Truck Speed", "Cargo Truck Speed", 12f, "");
RearmTimeDesc = ((BaseUnityPlugin)this).Config.Bind<string>("Rearm Time", "Description", "This section changes how fast the crew rearm aircraft", "");
RearmValue = ((BaseUnityPlugin)this).Config.Bind<float>("Rearm Time", "Rearm Time", 8f, "");
OutgoingDesc = ((BaseUnityPlugin)this).Config.Bind<string>("Outgoing Missions", "Description", "This section changes how many outgoing missions you can have", "");
OutgoingValue = ((BaseUnityPlugin)this).Config.Bind<int>("Outgoing Missions", "Outgoing Missions", 3, "");
CarrierRangeDesc = ((BaseUnityPlugin)this).Config.Bind<string>("Carrier Radar Range", "Description", "This section changes how far the carriers radar can see", "");
CarrierRangeValue = ((BaseUnityPlugin)this).Config.Bind<float>("Carrier Radar Range", "Carrier Radar Range", 0.25f, "");
HornetSearchValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hornet", "Search Time Multiplier", 1f, "");
HornetRadarValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hornet", "Radar Range", 0.5f, "");
HornetRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hornet", "Repair Speed", 8f, "");
HornetSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hornet", "Taxi Speed", 14f, "");
HornetRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hornet", "Refuel Time", 8f, "");
SuperHornetSearchValue = ((BaseUnityPlugin)this).Config.Bind<float>("Super Hornet", "Search Time Multiplier", 1.3f, "");
SuperHornetRadarValue = ((BaseUnityPlugin)this).Config.Bind<float>("Super Hornet", "Radar Range", 0.5f, "");
SuperHornetRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Super Hornet", "Repair Speed", 8f, "");
SuperHornetSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Super Hornet", "Taxi Speed", 14f, "");
SuperHornetRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Super Hornet", "Refuel Time", 8f, "");
ProwlerSearchValue = ((BaseUnityPlugin)this).Config.Bind<float>("Prowler", "Search Time Multiplier", 1.2f, "");
ProwlerRadarValue = ((BaseUnityPlugin)this).Config.Bind<float>("Prowler", "Radar Range", 0.75f, "");
ProwlerRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Prowler", "Repair Speed", 8f, "");
ProwlerSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Prowler", "Taxi Speed", 14f, "");
ProwlerRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Prowler", "Refuel Time", 8f, "");
HawkeyeSearchValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hawkeye", "Search Time Multiplier", 2.2f, "");
HawkeyeRadarValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hawkeye", "Radar Range", 1f, "");
HawkeyeRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hawkeye", "Repair Speed", 8f, "");
HawkeyeSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hawkeye", "Taxi Speed", 14f, "");
HawkeyeRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Hawkeye", "Refuel Time", 8f, "");
OspreyRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Osprey", "Repair Speed", 8f, "");
OspreySpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Osprey", "Taxi Speed", 14f, "");
OspreyRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Osprey", "Refuel Time", 8f, "");
GreyoundRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Greyhound", "Repair Speed", 8f, "");
GreyoundSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Greyhound", "Taxi Speed", 14f, "");
GreyoundRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Greyhound", "Refuel Time", 8f, "");
SeahawkSearchValue = ((BaseUnityPlugin)this).Config.Bind<float>("Seahawk", "Search Time Multiplier", 1f, "");
SeahawkRadarValue = ((BaseUnityPlugin)this).Config.Bind<float>("Seahawk", "Radar Range", 0.5f, "");
SeahawkRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Seahawk", "Repair Speed", 8f, "");
SeahawkSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Seahawk", "Taxi Speed", 14f, "");
SeahawkRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Seahawk", "Refuel Time", 8f, "");
ChinookRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Chinook", "Repair Speed", 8f, "");
ChinookSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Chinook", "Taxi Speed", 14f, "");
ChinookRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Chinook", "Refuel Time", 8f, "");
HarrierSearchValue = ((BaseUnityPlugin)this).Config.Bind<float>("Harrier", "Search Time Multiplier", 1f, "");
HarrierRadarValue = ((BaseUnityPlugin)this).Config.Bind<float>("Harrier", "Radar Range", 0.5f, "");
HarrierRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Harrier", "Repair Speed", 8f, "");
HarrierSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Harrier", "Taxi Speed", 14f, "");
HarrierRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("Harrier", "Refuel Time", 8f, "");
VikingSearchValue = ((BaseUnityPlugin)this).Config.Bind<float>("Viking", "Search Time Multiplier", 1.5f, "");
VikingRadarValue = ((BaseUnityPlugin)this).Config.Bind<float>("Viking", "Radar Range", 0.75f, "");
VikingRepairValue = ((BaseUnityPlugin)this).Config.Bind<float>("Viking", "Repair Speed", 8f, "");
VikingSpeedValue = ((BaseUnityPlugin)this).Config.Bind<float>("Viking", "Taxi Speed", 14f, "");
VikingRefuelValue = ((BaseUnityPlugin)this).Config.Bind<float>("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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
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<CrewMember>() ?? ((Component)__instance).GetComponentInParent<CrewMember>();
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<NavMeshAgent>();
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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
if (!((Object)(object)val == (Object)null))
{
HashSet<MissionType> hashSet = new HashSet<MissionType>
{
(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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
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<Unit>() ?? ((Component)__instance).GetComponentInParent<Unit>();
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}");
}
}
}
}