using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FairAI.Component;
using FairAI.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using LethalThings;
using Unity.Netcode;
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("FairAI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FairAI")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("42deea12-f73e-4d63-81e9-5359e98c8d53")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace FairAI
{
internal class FAIR_AI : NetworkBehaviour
{
public EnemyAI targetWithRotation;
[ClientRpc]
public void SwitchedTargetedEnemyClientRpc(Turret turret, EnemyAI enemy, bool setModeToCharging = false)
{
targetWithRotation = enemy;
if (setModeToCharging)
{
Type typeFromHandle = typeof(Turret);
MethodInfo method = typeFromHandle.GetMethod("SwitchTurretMode", BindingFlags.Instance | BindingFlags.NonPublic);
method.Invoke(turret, new object[1] { 1 });
}
}
[ClientRpc]
public void RemoveTargetedEnemyClientRpc()
{
targetWithRotation = null;
}
}
[BepInPlugin("GoldenKitten.FairAI", "Fair AI", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "GoldenKitten.FairAI";
private const string modName = "Fair AI";
private const string modVersion = "1.0.0";
private Harmony harmony = new Harmony("GoldenKitten.FairAI");
public static Plugin Instance;
public static ManualLogSource logger;
public static List<EnemyType> enemies;
public static List<Item> items;
public static bool playersEnteredInside = false;
public static int wallsAndEnemyLayerMask = 524288;
public static int enemyMask = 524288;
public static int allHittablesMask;
private static float onMeshThreshold = 3f;
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
harmony = new Harmony("GoldenKitten.FairAI");
logger = Logger.CreateLogSource("GoldenKitten.FairAI");
harmony.PatchAll(typeof(Plugin));
logger.LogInfo((object)"Fair AI initiated!");
CreateHarmonyPatch(harmony, typeof(RoundManager), "Start", null, typeof(RoundManagerPatch), "PatchStart", isPrefix: false);
CreateHarmonyPatch(harmony, typeof(StartOfRound), "Start", null, typeof(StartOfRoundPatch), "PatchStart", isPrefix: false);
CreateHarmonyPatch(harmony, typeof(StartOfRound), "Update", null, typeof(StartOfRoundPatch), "PatchUpdate", isPrefix: false);
CreateHarmonyPatch(harmony, typeof(Turret), "Start", null, typeof(TurretAIPatch), "PatchStart", isPrefix: false);
CreateHarmonyPatch(harmony, typeof(Turret), "Update", null, typeof(TurretAIPatch), "PatchUpdate", isPrefix: true);
CreateHarmonyPatch(harmony, typeof(Turret), "SetTargetToPlayerBody", null, typeof(TurretAIPatch), "PatchSetTargetToPlayerBody", isPrefix: true);
CreateHarmonyPatch(harmony, typeof(Turret), "TurnTowardsTargetIfHasLOS", null, typeof(TurretAIPatch), "PatchTurnTowardsTargetIfHasLOS", isPrefix: true);
CreateHarmonyPatch(harmony, typeof(Landmine), "SpawnExplosion", new Type[4]
{
typeof(Vector3),
typeof(bool),
typeof(float),
typeof(float)
}, typeof(MineAIPatch), "PatchSpawnExplosion", isPrefix: false);
CreateHarmonyPatch(harmony, typeof(Landmine), "OnTriggerEnter", null, typeof(MineAIPatch), "PatchOnTriggerEnter", isPrefix: false);
CreateHarmonyPatch(harmony, typeof(Landmine), "OnTriggerExit", null, typeof(MineAIPatch), "PatchOnTriggerExit", isPrefix: false);
CreateHarmonyPatch(harmony, typeof(Landmine), "Detonate", null, typeof(MineAIPatch), "DetonatePatch", isPrefix: false);
if (FindType("LethalThings.RoombaAI") != null)
{
CreateHarmonyPatch(harmony, FindType("LethalThings.RoombaAI"), "Start", null, typeof(BoombaPatch), "PatchStart", isPrefix: false);
CreateHarmonyPatch(harmony, FindType("LethalThings.RoombaAI"), "DoAIInterval", null, typeof(BoombaPatch), "PatchDoAIInterval", isPrefix: false);
}
}
public static List<PlayerControllerB> GetActivePlayers()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
List<PlayerControllerB> list = new List<PlayerControllerB>();
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val in array)
{
if ((Object)val != (Object)null && !val.isPlayerDead && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled)
{
list.Add(val);
}
}
return list;
}
public static bool AllowFairness(Vector3 position)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)StartOfRound.Instance != (Object)null && Can("CheckForPlayersInside"))
{
if (IsAPlayersOutside())
{
if (!(position.y > -80f))
{
Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
if (!((Bounds)(ref bounds)).Contains(position))
{
goto IL_005c;
}
}
return true;
}
goto IL_005c;
}
return true;
IL_005c:
return playersEnteredInside;
}
public static bool IsAPlayersOutside()
{
List<PlayerControllerB> activePlayers = GetActivePlayers();
for (int i = 0; i < activePlayers.Count; i++)
{
PlayerControllerB val = activePlayers[i];
if (!val.isInsideFactory)
{
return true;
}
}
return false;
}
public static bool IsAPlayerInsideShip()
{
List<PlayerControllerB> activePlayers = GetActivePlayers();
for (int i = 0; i < activePlayers.Count; i++)
{
PlayerControllerB val = activePlayers[i];
if (val.isInHangarShipRoom)
{
return true;
}
}
return false;
}
public static bool IsAPlayerInsideDungeon()
{
List<PlayerControllerB> activePlayers = GetActivePlayers();
for (int i = 0; i < activePlayers.Count; i++)
{
PlayerControllerB val = activePlayers[i];
if (val.isInsideFactory)
{
return true;
}
}
return false;
}
public static bool CanMob(string parentIdentifier, string identifier, string mobName)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
string text = RemoveInvalidCharacters(mobName).ToUpper();
if (((BaseUnityPlugin)Instance).Config[new ConfigDefinition("Mobs", parentIdentifier)].BoxedValue.ToString().ToUpper().Equals("TRUE"))
{
foreach (ConfigDefinition key in ((BaseUnityPlugin)Instance).Config.Keys)
{
if (RemoveInvalidCharacters(key.Key.ToUpper()).Equals(RemoveInvalidCharacters(text + identifier.ToUpper())))
{
return ((BaseUnityPlugin)Instance).Config[key].BoxedValue.ToString().ToUpper().Equals("TRUE");
}
}
return false;
}
return false;
}
public static bool Can(string identifier)
{
foreach (ConfigDefinition key in ((BaseUnityPlugin)Instance).Config.Keys)
{
if (RemoveInvalidCharacters(key.Key.ToUpper()).Equals(RemoveInvalidCharacters(identifier.ToUpper())))
{
return ((BaseUnityPlugin)Instance).Config[key].BoxedValue.ToString().ToUpper().Equals("TRUE");
}
}
return false;
}
public static string RemoveWhitespaces(string source)
{
return string.Join("", source.Split((string[]?)null, StringSplitOptions.RemoveEmptyEntries));
}
public static string RemoveSpecialCharacters(string source)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (char c in source)
{
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
{
stringBuilder.Append(c);
}
}
return stringBuilder.ToString();
}
public static string RemoveInvalidCharacters(string source)
{
return RemoveWhitespaces(RemoveSpecialCharacters(source));
}
public static Type FindType(string fullName)
{
try
{
if ((from a in AppDomain.CurrentDomain.GetAssemblies()
where !a.IsDynamic
select a).SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.FullName.Equals(fullName)) != null)
{
return (from a in AppDomain.CurrentDomain.GetAssemblies()
where !a.IsDynamic
select a).SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.FullName.Equals(fullName));
}
}
catch
{
return null;
}
return null;
}
public static void CreateHarmonyPatch(Harmony harmony, Type typeToPatch, string methodToPatch, Type[] parameters, Type patchType, string patchMethod, bool isPrefix)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
if (typeToPatch == null || patchType == null)
{
logger.LogInfo((object)"Type is either incorrect or does not exist!");
return;
}
MethodInfo methodInfo = AccessTools.Method(typeToPatch, methodToPatch, parameters, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(patchType, patchMethod, (Type[])null, (Type[])null);
if (isPrefix)
{
harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
else
{
harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
}
public static bool IsAgentOnNavMesh(GameObject agentObject)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = agentObject.transform.position;
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(position, ref val, onMeshThreshold, -1) && Mathf.Approximately(position.x, ((NavMeshHit)(ref val)).position.x) && Mathf.Approximately(position.z, ((NavMeshHit)(ref val)).position.z))
{
return position.y >= ((NavMeshHit)(ref val)).position.y;
}
return false;
}
public static bool AttackTargets(Vector3 aimPoint, Vector3 forward, float range)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
return HitTargets(GetTargets(aimPoint, forward, range), forward);
}
public static List<GameObject> GetTargets(Vector3 aimPoint, Vector3 forward, float range)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
List<GameObject> list = new List<GameObject>();
Ray val = default(Ray);
((Ray)(ref val))..ctor(aimPoint, forward);
RaycastHit[] array = Physics.RaycastAll(val, range, allHittablesMask, (QueryTriggerInteraction)2);
Array.Sort(array, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance));
Vector3 val2 = aimPoint + forward * range;
IHittable val3 = default(IHittable);
EnemyAI val6 = default(EnemyAI);
for (int i = 0; i < array.Length; i++)
{
GameObject gameObject = ((Component)((RaycastHit)(ref array[i])).transform).gameObject;
if (gameObject.TryGetComponent<IHittable>(ref val3))
{
EnemyAI val4 = null;
EnemyAICollisionDetect val5 = (EnemyAICollisionDetect)(object)((val3 is EnemyAICollisionDetect) ? val3 : null);
if (val5 != null)
{
val4 = val5.mainScript;
}
if ((Object)(object)val4 != (Object)null && (val4.isEnemyDead || val4.enemyHP <= 0 || !val4.enemyType.canDie))
{
continue;
}
if (val3 is PlayerControllerB)
{
list.Add(gameObject);
}
else
{
if (!((Object)(object)val4 != (Object)null))
{
continue;
}
list.Add(gameObject);
}
val2 = ((RaycastHit)(ref array[i])).point;
break;
}
if (((Component)((RaycastHit)(ref array[i])).collider).TryGetComponent<EnemyAI>(ref val6))
{
if (val6.isEnemyDead || val6.enemyHP <= 0 || !val6.enemyType.canDie)
{
continue;
}
list.Add(((Component)val6).gameObject);
val2 = ((RaycastHit)(ref array[i])).point;
break;
}
val2 = ((RaycastHit)(ref array[i])).point;
break;
}
return list;
}
public static bool HitTargets(List<GameObject> targets, Vector3 forward)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
bool hits = false;
if (!targets.Any())
{
return hits;
}
targets.ForEach(delegate(GameObject t)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Expected O, but got Unknown
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Expected O, but got Unknown
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: 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: 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_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)t != (Object)null)
{
if ((Object)(object)t.GetComponent<PlayerControllerB>() != (Object)null)
{
PlayerControllerB component = t.GetComponent<PlayerControllerB>();
int num = 20;
hits = true;
component.DamagePlayer(num, true, true, (CauseOfDeath)7, 0, false, forward);
}
else if ((Object)(object)t.GetComponent<EnemyAICollisionDetect>() != (Object)null)
{
EnemyAICollisionDetect component2 = t.GetComponent<EnemyAICollisionDetect>();
int num2 = 1;
if (!component2.mainScript.isEnemyDead && ((NetworkBehaviour)component2.mainScript).IsOwner && CanMob("TurretDamageAllMobs", ".Turret Damage", component2.mainScript.enemyType.enemyName))
{
if (component2.mainScript is NutcrackerEnemyAI)
{
if (((EnemyAI)(NutcrackerEnemyAI)component2.mainScript).currentBehaviourStateIndex > 0)
{
component2.mainScript.HitEnemyOnLocalClient(num2, default(Vector3), (PlayerControllerB)null, false);
hits = true;
}
}
else
{
component2.mainScript.HitEnemyOnLocalClient(num2, default(Vector3), (PlayerControllerB)null, false);
hits = true;
}
}
}
else if ((Object)(object)t.GetComponent<EnemyAI>() != (Object)null)
{
EnemyAI component3 = t.GetComponent<EnemyAI>();
if (((NetworkBehaviour)component3).IsOwner)
{
int num3 = 1;
if (CanMob("TurretDamageAllMobs", ".Turret Damage", component3.enemyType.enemyName))
{
if (component3 is NutcrackerEnemyAI)
{
if (((EnemyAI)(NutcrackerEnemyAI)component3).currentBehaviourStateIndex > 0)
{
component3.HitEnemyOnLocalClient(num3, default(Vector3), (PlayerControllerB)null, false);
hits = true;
}
}
else
{
component3.HitEnemyOnLocalClient(num3, default(Vector3), (PlayerControllerB)null, false);
hits = true;
}
}
}
}
else if (t.GetComponent<IHittable>() != null)
{
IHittable component4 = t.GetComponent<IHittable>();
if (component4 is EnemyAICollisionDetect)
{
EnemyAICollisionDetect val = (EnemyAICollisionDetect)component4;
int num4 = 1;
if (((NetworkBehaviour)val.mainScript).IsOwner && CanMob("TurretDamageAllMobs", ".Turret Damage", val.mainScript.enemyType.enemyName))
{
if (val.mainScript is NutcrackerEnemyAI)
{
if (((EnemyAI)(NutcrackerEnemyAI)val.mainScript).currentBehaviourStateIndex > 0)
{
val.mainScript.HitEnemyOnLocalClient(num4, default(Vector3), (PlayerControllerB)null, false);
hits = true;
}
}
else
{
val.mainScript.HitEnemyOnLocalClient(num4, default(Vector3), (PlayerControllerB)null, false);
hits = true;
}
}
}
else if (component4 is PlayerControllerB)
{
PlayerControllerB val2 = (PlayerControllerB)component4;
int num5 = 33;
hits = true;
val2.DamagePlayer(num5, true, true, (CauseOfDeath)7, 0, false, forward);
}
else
{
component4.Hit(1, forward, (PlayerControllerB)null, true);
hits = true;
}
}
}
});
return hits;
}
}
}
namespace FairAI.Patches
{
internal class BoombaPatch
{
public static void PatchStart(ref RoombaAI __instance)
{
((Component)__instance).gameObject.AddComponent<BoombaTimer>();
}
public static void PatchDoAIInterval(ref RoombaAI __instance)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: 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)
if (!Plugin.AllowFairness(((Component)__instance).transform.position) || !Plugin.IsAgentOnNavMesh(((Component)__instance).gameObject) || (((EnemyAI)__instance).currentSearch == null && !((EnemyAI)__instance).movingTowardsTargetPlayer) || (!__instance.mineAudio.isPlaying && !__instance.mineFarAudio.isPlaying) || !((Component)__instance).GetComponent<BoombaTimer>().IsActiveBomb())
{
return;
}
Vector3 val = ((Component)__instance).transform.position + Vector3.up;
Collider[] array = Physics.OverlapSphere(val, 6f, 2621448, (QueryTriggerInteraction)2);
for (int i = 0; i < array.Length; i++)
{
float num = Vector3.Distance(val, ((Component)array[i]).transform.position);
if ((num > 4f && Physics.Linecast(val, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) || !((Object)(object)((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>() != (Object)null))
{
continue;
}
EnemyAICollisionDetect component = ((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>();
if (!((Object)(object)((Component)component.mainScript).gameObject != (Object)(object)((Component)__instance).gameObject) || !Plugin.CanMob("BoombaAllMobs", ".Boomba", component.mainScript.enemyType.enemyName))
{
continue;
}
if ((Object)(object)component != (Object)null && ((NetworkBehaviour)component.mainScript).IsOwner && !component.mainScript.isEnemyDead)
{
Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, val, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true);
if (num < 3f)
{
component.mainScript.KillEnemyOnOwnerClient(true);
}
else if (num < 6f)
{
component.mainScript.HitEnemyOnLocalClient(2, default(Vector3), (PlayerControllerB)null, false);
}
}
if (((NetworkBehaviour)__instance).IsServer)
{
((EnemyAI)__instance).KillEnemy(true);
}
else
{
((EnemyAI)__instance).KillEnemyServerRpc(true);
}
}
}
}
internal class EnemyAIPatch
{
public static void DoAIIntervalPatch(ref EnemyAI __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (!(__instance is ForestGiantAI))
{
return;
}
ForestGiantAI val = (ForestGiantAI)__instance;
if (StartOfRound.Instance.livingPlayers != 0 && !((EnemyAI)val).isEnemyDead)
{
int currentBehaviourStateIndex = ((EnemyAI)val).currentBehaviourStateIndex;
int num = currentBehaviourStateIndex;
if (num == 1)
{
val.investigating = false;
}
}
}
public static bool OnCollideWithEnemyPatch(ref EnemyAI __instance, Collider other)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
if (__instance is ForestGiantAI)
{
Type typeFromHandle = typeof(ForestGiantAI);
ForestGiantAI val = (ForestGiantAI)__instance;
FieldInfo field = typeFromHandle.GetField("inEatingPlayerAnimation", BindingFlags.Instance | BindingFlags.NonPublic);
bool flag = (bool)field.GetValue(val);
if ((Object)(object)((EnemyAI)val).inSpecialAnimationWithPlayer != (Object)null || flag || ((EnemyAI)val).stunNormalizedTimer >= 0f)
{
return false;
}
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component != (Object)null) || !((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController))
{
return false;
}
Vector3 val2 = Vector3.Normalize((val.centerPosition.position - (((Component)GameNetworkManager.Instance.localPlayerController).transform.position + Vector3.up * 1.5f)) * 1000f);
if (!Physics.Linecast(val.centerPosition.position + val2 * 1.7f, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position + Vector3.up * 1.5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && ((!StartOfRound.Instance.shipIsLeaving && StartOfRound.Instance.shipHasLanded) || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) && !((Object)(object)component.inAnimationWithEnemy != (Object)null))
{
if (component.inSpecialInteractAnimation && (Object)(object)component.currentTriggerInAnimationWith != (Object)null)
{
component.currentTriggerInAnimationWith.CancelAnimationExternally();
}
FieldInfo field2 = typeFromHandle.GetField("triggerChaseByTouchingDebounce", BindingFlags.Instance | BindingFlags.NonPublic);
bool flag2 = (bool)field2.GetValue(val);
if (((EnemyAI)val).currentBehaviourStateIndex == 0 && !flag2)
{
field2.SetValue(val, true);
MethodInfo method = typeFromHandle.GetMethod("BeginChasingNewPlayerServerRpc", BindingFlags.Instance | BindingFlags.NonPublic);
method.Invoke(__instance, new object[1] { (int)component.playerClientId });
}
else
{
val.GrabPlayerServerRpc((int)component.playerClientId);
}
}
return false;
}
return true;
}
}
internal class MineAIPatch
{
public static void PatchOnTriggerEnter(ref Landmine __instance, Collider other, ref float ___pressMineDebounceTimer)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.AllowFairness(((Component)__instance).transform.position))
{
EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead && Plugin.CanMob("ExplodeAllMobs", ".Mine", component.mainScript.enemyType.enemyName.ToUpper()))
{
___pressMineDebounceTimer = 0.5f;
__instance.PressMineServerRpc();
}
}
}
public static void PatchOnTriggerExit(ref Landmine __instance, Collider other, ref bool ___sendingExplosionRPC)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.AllowFairness(((Component)__instance).transform.position))
{
EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead && Plugin.CanMob("ExplodeAllMobs", ".Mine", component.mainScript.enemyType.enemyName.ToUpper()) && !__instance.hasExploded)
{
__instance.SetOffMineAnimation();
___sendingExplosionRPC = true;
__instance.ExplodeMineServerRpc();
}
}
}
public static void DetonatePatch(ref Landmine __instance)
{
if (!((Object)(object)__instance == (Object)null))
{
((MonoBehaviour)__instance).StartCoroutine(WaitForUpdate(1.5f, __instance));
}
}
public static IEnumerator WaitForUpdate(float waitTime, Landmine mine)
{
yield return (object)new WaitForSeconds(waitTime);
if (!((Object)(object)mine == (Object)null))
{
if ((Object)(object)((Component)mine).GetComponent<NetworkObject>() != (Object)null)
{
((Component)mine).GetComponent<NetworkObject>().Despawn(true);
}
else
{
Object.Destroy((Object)(object)((Component)mine).gameObject);
}
}
}
public static void PatchSpawnExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
Collider[] array = Physics.OverlapSphere(explosionPosition, 6f, 2621448, (QueryTriggerInteraction)2);
for (int i = 0; i < array.Length; i++)
{
float num = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
if ((num > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) || !((Object)(object)((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>() != (Object)null))
{
continue;
}
EnemyAICollisionDetect component = ((Component)array[i]).gameObject.GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component != (Object)null && ((NetworkBehaviour)component.mainScript).IsOwner && !component.mainScript.isEnemyDead)
{
if (num < killRange)
{
component.mainScript.HitEnemyOnLocalClient(component.mainScript.enemyHP, default(Vector3), (PlayerControllerB)null, false);
}
else if (num < damageRange)
{
component.mainScript.HitEnemyOnLocalClient(Mathf.RoundToInt((float)(component.mainScript.enemyHP / 2)), default(Vector3), (PlayerControllerB)null, false);
}
}
}
}
}
internal class RoundManagerPatch
{
public static void PatchStart(ref RoundManager __instance)
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Expected O, but got Unknown
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Expected O, but got Unknown
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Expected O, but got Unknown
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: Expected O, but got Unknown
Plugin.enemies = (from EnemyType e in Resources.FindObjectsOfTypeAll(typeof(EnemyType))
where (Object)(object)e != (Object)null
select e).ToList();
Plugin.items = (from Item i in Resources.FindObjectsOfTypeAll(typeof(Item))
where (Object)(object)i != (Object)null
select i).ToList();
Plugin.allHittablesMask = StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | 0x280008 | Plugin.enemyMask;
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "ExplodeAllMobs")))
{
ConfigEntry<bool> val = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "ExplodeAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Mines.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "BoombaAllMobs")))
{
ConfigEntry<bool> val2 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "BoombaAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Boombas.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretTargetAllMobs")))
{
ConfigEntry<bool> val3 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretTargetAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Targeted By Turrets.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretDamageAllMobs")))
{
ConfigEntry<bool> val4 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretDamageAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Killed By Turrets.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "CheckForPlayersInside")))
{
ConfigEntry<bool> val5 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "CheckForPlayersInside", false, "Whether to check for players inside the dungeon before anything else occurs.");
}
foreach (EnemyType enemy in Plugin.enemies)
{
string text = Plugin.RemoveInvalidCharacters(enemy.enemyName);
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Mine")))
{
ConfigEntry<bool> val6 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Mine", true, "Does it set off the landmine or not?");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Boomba")))
{
ConfigEntry<bool> val7 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Boomba", true, "Does it set off the boomba or not?");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Target")))
{
ConfigEntry<bool> val8 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Target", true, "Is it targetable by turrets?");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Damage")))
{
ConfigEntry<bool> val9 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Damage", true, "Is it damageable by turrets?");
}
}
}
}
internal class StartOfRoundPatch
{
public static void PatchStart(ref StartOfRound __instance)
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Expected O, but got Unknown
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Expected O, but got Unknown
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Expected O, but got Unknown
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: Expected O, but got Unknown
Plugin.enemies = (from EnemyType e in Resources.FindObjectsOfTypeAll(typeof(EnemyType))
where (Object)(object)e != (Object)null
select e).ToList();
Plugin.items = (from Item i in Resources.FindObjectsOfTypeAll(typeof(Item))
where (Object)(object)i != (Object)null
select i).ToList();
Plugin.allHittablesMask = StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | 0x280008 | Plugin.enemyMask;
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "ExplodeAllMobs")))
{
ConfigEntry<bool> val = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "ExplodeAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Mines.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "BoombaAllMobs")))
{
ConfigEntry<bool> val2 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "BoombaAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Set Off Boombas.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretTargetAllMobs")))
{
ConfigEntry<bool> val3 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretTargetAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Targeted By Turrets.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "TurretDamageAllMobs")))
{
ConfigEntry<bool> val4 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "TurretDamageAllMobs", true, "Leave On To Customise Mobs Below Or Turn Off To Make All Mobs Unable To Be Killed By Turrets.");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", "CheckForPlayersInside")))
{
ConfigEntry<bool> val5 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", "CheckForPlayersInside", false, "Whether to check for players inside the dungeon before anything else occurs.");
}
foreach (EnemyType enemy in Plugin.enemies)
{
string text = Plugin.RemoveInvalidCharacters(enemy.enemyName);
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Mine")))
{
ConfigEntry<bool> val6 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Mine", true, "Does it set off the landmine or not?");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Boomba")))
{
ConfigEntry<bool> val7 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Boomba", true, "Does it set off the boomba or not?");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Target")))
{
ConfigEntry<bool> val8 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Target", true, "Is it targetable by turrets?");
}
if (!((BaseUnityPlugin)Plugin.Instance).Config.ContainsKey(new ConfigDefinition("Mobs", text + ".Turret Damage")))
{
ConfigEntry<bool> val9 = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Mobs", text + ".Turret Damage", true, "Is it damageable by turrets?");
}
}
}
public static void PatchUpdate(ref StartOfRound __instance)
{
if (Plugin.Can("CheckForPlayersInside"))
{
if (__instance.shipIsLeaving)
{
Plugin.playersEnteredInside = false;
}
else
{
Plugin.playersEnteredInside = Plugin.IsAPlayerInsideDungeon();
}
}
}
}
internal class TurretAIPatch
{
public static float viewRadius = 10f;
public static float viewAngle = 90f;
public static void PatchStart(ref Turret __instance)
{
FAIR_AI component = ((Component)__instance).gameObject.GetComponent<FAIR_AI>();
if ((Object)(object)component == (Object)null)
{
component = ((Component)__instance).gameObject.AddComponent<FAIR_AI>();
}
}
public static bool PatchUpdate(ref Turret __instance)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Expected I4, but got Unknown
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Invalid comparison between Unknown and I4
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Invalid comparison between Unknown and I4
//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
//IL_05d9: Invalid comparison between Unknown and I4
//IL_078f: Unknown result type (might be due to invalid IL or missing references)
//IL_0795: Invalid comparison between Unknown and I4
//IL_09d5: Unknown result type (might be due to invalid IL or missing references)
//IL_09db: Invalid comparison between Unknown and I4
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Invalid comparison between Unknown and O
//IL_082b: Unknown result type (might be due to invalid IL or missing references)
//IL_0831: Invalid comparison between Unknown and O
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Expected O, but got Unknown
//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
//IL_08fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0908: Unknown result type (might be due to invalid IL or missing references)
//IL_090d: Unknown result type (might be due to invalid IL or missing references)
//IL_091f: Unknown result type (might be due to invalid IL or missing references)
//IL_083e: Unknown result type (might be due to invalid IL or missing references)
//IL_0848: Expected O, but got Unknown
//IL_0ddc: Unknown result type (might be due to invalid IL or missing references)
//IL_0df7: Unknown result type (might be due to invalid IL or missing references)
//IL_0e10: Unknown result type (might be due to invalid IL or missing references)
//IL_0e1c: Unknown result type (might be due to invalid IL or missing references)
//IL_0e2e: Unknown result type (might be due to invalid IL or missing references)
//IL_0946: Unknown result type (might be due to invalid IL or missing references)
//IL_0955: Unknown result type (might be due to invalid IL or missing references)
//IL_095a: Unknown result type (might be due to invalid IL or missing references)
//IL_0977: Unknown result type (might be due to invalid IL or missing references)
//IL_097c: Unknown result type (might be due to invalid IL or missing references)
//IL_098b: Unknown result type (might be due to invalid IL or missing references)
//IL_0c1f: Unknown result type (might be due to invalid IL or missing references)
//IL_0c2b: Unknown result type (might be due to invalid IL or missing references)
//IL_0c46: Unknown result type (might be due to invalid IL or missing references)
//IL_0c52: Unknown result type (might be due to invalid IL or missing references)
//IL_0c57: Unknown result type (might be due to invalid IL or missing references)
//IL_0c74: Unknown result type (might be due to invalid IL or missing references)
//IL_0ba7: Unknown result type (might be due to invalid IL or missing references)
//IL_0bad: Invalid comparison between Unknown and O
//IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
//IL_0eb1: Unknown result type (might be due to invalid IL or missing references)
//IL_0ec3: Unknown result type (might be due to invalid IL or missing references)
//IL_0e8b: Unknown result type (might be due to invalid IL or missing references)
//IL_0ca6: Unknown result type (might be due to invalid IL or missing references)
//IL_0ccc: Unknown result type (might be due to invalid IL or missing references)
//IL_0cd1: Unknown result type (might be due to invalid IL or missing references)
//IL_0cd7: Unknown result type (might be due to invalid IL or missing references)
//IL_0cdc: Unknown result type (might be due to invalid IL or missing references)
//IL_0ceb: Unknown result type (might be due to invalid IL or missing references)
//IL_0bba: Unknown result type (might be due to invalid IL or missing references)
//IL_0bc4: Expected O, but got Unknown
if (Plugin.AllowFairness(((Component)__instance).transform.position))
{
FAIR_AI component = ((Component)__instance).gameObject.GetComponent<FAIR_AI>();
Type typeFromHandle = typeof(Turret);
if (!__instance.turretActive)
{
FieldInfo field = typeFromHandle.GetField("wasTargetingPlayerLastFrame", BindingFlags.Instance | BindingFlags.NonPublic);
field.SetValue(__instance, false);
__instance.turretMode = (TurretMode)0;
__instance.targetPlayerWithRotation = null;
component.targetWithRotation = null;
return false;
}
FieldInfo field2 = typeFromHandle.GetField("wasTargetingPlayerLastFrame", BindingFlags.Instance | BindingFlags.NonPublic);
object value = field2.GetValue(__instance);
if ((Object)(object)__instance.targetPlayerWithRotation != (Object)null || (Object)(object)component.targetWithRotation != (Object)null)
{
if (!(bool)value)
{
field2.SetValue(__instance, true);
if ((int)__instance.turretMode == 0)
{
__instance.turretMode = (TurretMode)1;
}
}
MethodInfo method = typeFromHandle.GetMethod("SetTargetToPlayerBody", BindingFlags.Instance | BindingFlags.NonPublic);
method.Invoke(__instance, null);
MethodInfo method2 = typeFromHandle.GetMethod("TurnTowardsTargetIfHasLOS", BindingFlags.Instance | BindingFlags.NonPublic);
method2.Invoke(__instance, null);
}
else if ((bool)value)
{
field2.SetValue(__instance, false);
__instance.turretMode = (TurretMode)0;
}
FieldInfo field3 = typeFromHandle.GetField("turretModeLastFrame", BindingFlags.Instance | BindingFlags.NonPublic);
object value2 = field3.GetValue(__instance);
FieldInfo field4 = typeFromHandle.GetField("rotatingClockwise", BindingFlags.Instance | BindingFlags.NonPublic);
object value3 = field4.GetValue(__instance);
FieldInfo field5 = typeFromHandle.GetField("fadeBulletAudioCoroutine", BindingFlags.Instance | BindingFlags.NonPublic);
object value4 = field5.GetValue(__instance);
FieldInfo field6 = typeFromHandle.GetField("turretInterval", BindingFlags.Instance | BindingFlags.NonPublic);
object value5 = field6.GetValue(__instance);
FieldInfo field7 = typeFromHandle.GetField("rotatingSmoothly", BindingFlags.Instance | BindingFlags.NonPublic);
object value6 = field7.GetValue(__instance);
FieldInfo field8 = typeFromHandle.GetField("switchRotationTimer", BindingFlags.Instance | BindingFlags.NonPublic);
object value7 = field8.GetValue(__instance);
FieldInfo field9 = typeFromHandle.GetField("rotatingRight", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field10 = typeFromHandle.GetField("hasLineOfSight", BindingFlags.Instance | BindingFlags.NonPublic);
object value8 = field10.GetValue(__instance);
FieldInfo field11 = typeFromHandle.GetField("lostLOSTimer", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field12 = typeFromHandle.GetField("shootRay", BindingFlags.Instance | BindingFlags.NonPublic);
object value9 = field12.GetValue(__instance);
FieldInfo field13 = typeFromHandle.GetField("hit", BindingFlags.Instance | BindingFlags.NonPublic);
object value10 = field13.GetValue(__instance);
FieldInfo field14 = typeFromHandle.GetField("berserkTimer", BindingFlags.Instance | BindingFlags.NonPublic);
object value11 = field14.GetValue(__instance);
FieldInfo field15 = typeFromHandle.GetField("enteringBerserkMode", BindingFlags.Instance | BindingFlags.NonPublic);
object value12 = field15.GetValue(__instance);
TurretMode turretMode = __instance.turretMode;
TurretMode val = turretMode;
RaycastHit val4;
switch ((int)val)
{
case 0:
value2 = field3.GetValue(__instance);
if ((int)(TurretMode)value2 > 0)
{
field3.SetValue(__instance, (object)(TurretMode)0);
field4.SetValue(__instance, false);
__instance.mainAudio.Stop();
__instance.farAudio.Stop();
__instance.berserkAudio.Stop();
value4 = field5.GetValue(__instance);
if ((object)(Coroutine)value4 != null)
{
((MonoBehaviour)__instance).StopCoroutine((Coroutine)value4);
}
MethodInfo method4 = typeFromHandle.GetMethod("FadeBulletAudio", BindingFlags.Instance | BindingFlags.NonPublic);
IEnumerator enumerator = (IEnumerator)method4.Invoke(__instance, null);
field5.SetValue(__instance, ((MonoBehaviour)__instance).StartCoroutine(enumerator));
__instance.bulletParticles.Stop(true, (ParticleSystemStopBehavior)1);
__instance.rotationSpeed = 28f;
field7.SetValue(__instance, true);
__instance.turretAnimator.SetInteger("TurretMode", 0);
field6.SetValue(__instance, Random.Range(0f, 0.15f));
}
if (!((NetworkBehaviour)__instance).IsServer)
{
break;
}
if ((float)value7 >= 7f)
{
field8.SetValue(__instance, 0f);
value7 = field8.GetValue(__instance);
bool flag = !(bool)field9.GetValue(__instance);
__instance.SwitchRotationClientRpc(flag);
__instance.SwitchRotationOnInterval(flag);
}
else
{
field8.SetValue(__instance, (float)value7 + Time.deltaTime);
}
value5 = field6.GetValue(__instance);
if ((float)value5 >= 0.25f)
{
field6.SetValue(__instance, 0f);
PlayerControllerB val5 = __instance.CheckForPlayersInLineOfSight(1.35f, true);
List<EnemyAI> actualTargets = GetActualTargets(__instance, GetTargets(__instance));
if ((Object)(object)val5 != (Object)null && !val5.isPlayerDead)
{
__instance.targetPlayerWithRotation = val5;
MethodInfo method5 = typeFromHandle.GetMethod("SwitchTurretMode", BindingFlags.Instance | BindingFlags.NonPublic);
method5.Invoke(__instance, new object[1] { 1 });
__instance.SwitchTargetedPlayerClientRpc((int)val5.playerClientId, true);
}
else if (actualTargets.Any())
{
__instance.targetPlayerWithRotation = null;
component.targetWithRotation = actualTargets[0];
MethodInfo method6 = typeFromHandle.GetMethod("SwitchTurretMode", BindingFlags.Instance | BindingFlags.NonPublic);
method6.Invoke(__instance, new object[1] { 1 });
component.SwitchedTargetedEnemyClientRpc(__instance, actualTargets[0], setModeToCharging: true);
}
}
else
{
value5 = field6.GetValue(__instance);
field6.SetValue(__instance, (float)value5 + Time.deltaTime);
}
break;
case 1:
value2 = field3.GetValue(__instance);
if ((int)(TurretMode)value2 != 1)
{
field3.SetValue(__instance, (object)(TurretMode)1);
field4.SetValue(__instance, false);
__instance.mainAudio.PlayOneShot(__instance.detectPlayerSFX);
__instance.berserkAudio.Stop();
WalkieTalkie.TransmitOneShotAudio(__instance.mainAudio, __instance.detectPlayerSFX, 1f);
__instance.rotationSpeed = 95f;
field7.SetValue(__instance, false);
field11.SetValue(__instance, 0f);
__instance.turretAnimator.SetInteger("TurretMode", 1);
}
if (!((NetworkBehaviour)__instance).IsServer)
{
break;
}
value5 = field6.GetValue(__instance);
if ((float)value5 >= 1.5f)
{
field6.SetValue(__instance, 0f);
Debug.Log((object)"Charging timer is up, setting to firing mode");
if (!(bool)value8)
{
Debug.Log((object)"hasLineOfSight is false");
__instance.targetPlayerWithRotation = null;
component.targetWithRotation = null;
__instance.RemoveTargetedPlayerClientRpc();
component.RemoveTargetedEnemyClientRpc();
}
else
{
MethodInfo method7 = typeFromHandle.GetMethod("SwitchTurretMode", BindingFlags.Instance | BindingFlags.NonPublic);
method7.Invoke(__instance, new object[1] { 2 });
__instance.SetToModeClientRpc(2);
}
}
else
{
value5 = field6.GetValue(__instance);
field6.SetValue(__instance, (float)value5 + Time.deltaTime);
}
break;
case 2:
value2 = field3.GetValue(__instance);
if ((int)(TurretMode)value2 != 2)
{
field3.SetValue(__instance, (object)(TurretMode)2);
__instance.berserkAudio.Stop();
__instance.mainAudio.clip = __instance.firingSFX;
__instance.mainAudio.Play();
__instance.farAudio.clip = __instance.firingFarSFX;
__instance.farAudio.Play();
__instance.bulletParticles.Play(true);
__instance.bulletCollisionAudio.Play();
value4 = field5.GetValue(__instance);
if ((object)(Coroutine)value4 != null)
{
((MonoBehaviour)__instance).StopCoroutine((Coroutine)value4);
}
__instance.bulletCollisionAudio.volume = 1f;
field7.SetValue(__instance, false);
field11.SetValue(__instance, 0f);
__instance.turretAnimator.SetInteger("TurretMode", 2);
}
value5 = field6.GetValue(__instance);
if ((float)value5 >= 0.21f)
{
field6.SetValue(__instance, 0f);
Plugin.AttackTargets(__instance.aimPoint.position, __instance.aimPoint.forward, 30f);
field12.SetValue(__instance, (object)new Ray(__instance.aimPoint.position, __instance.aimPoint.forward));
RaycastHit val6 = default(RaycastHit);
if (Physics.Raycast((Ray)value9, ref val6, 30f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1))
{
field13.SetValue(__instance, val6);
Ray val7 = (Ray)value9;
value10 = field13.GetValue(__instance);
Transform transform2 = ((Component)__instance.bulletCollisionAudio).transform;
val4 = (RaycastHit)value10;
transform2.position = ((Ray)(ref val7)).GetPoint(((RaycastHit)(ref val4)).distance - 0.5f);
}
}
else
{
value5 = field6.GetValue(__instance);
field6.SetValue(__instance, (float)value5 + Time.deltaTime);
}
break;
case 3:
value2 = field3.GetValue(__instance);
if ((int)(TurretMode)value2 != 3)
{
field3.SetValue(__instance, (object)(TurretMode)3);
__instance.turretAnimator.SetInteger("TurretMode", 1);
field14.SetValue(__instance, 1.3f);
__instance.berserkAudio.Play();
__instance.rotationSpeed = 77f;
field15.SetValue(__instance, true);
field7.SetValue(__instance, true);
field11.SetValue(__instance, 0f);
field2.SetValue(__instance, false);
__instance.targetPlayerWithRotation = null;
component.targetWithRotation = null;
}
value12 = field15.GetValue(__instance);
if ((bool)value12)
{
value11 = field14.GetValue(__instance);
field14.SetValue(__instance, (float)value11 - Time.deltaTime);
value11 = field14.GetValue(__instance);
if ((float)value11 <= 0f)
{
field15.SetValue(__instance, false);
field4.SetValue(__instance, true);
field14.SetValue(__instance, 9f);
__instance.turretAnimator.SetInteger("TurretMode", 2);
__instance.mainAudio.clip = __instance.firingSFX;
__instance.mainAudio.Play();
__instance.farAudio.clip = __instance.firingFarSFX;
__instance.farAudio.Play();
__instance.bulletParticles.Play(true);
__instance.bulletCollisionAudio.Play();
value4 = field5.GetValue(__instance);
if ((object)(Coroutine)value4 != null)
{
((MonoBehaviour)__instance).StopCoroutine((Coroutine)value4);
}
__instance.bulletCollisionAudio.volume = 1f;
}
break;
}
value5 = field6.GetValue(__instance);
if ((float)value5 >= 0.21f)
{
field6.SetValue(__instance, 0f);
Plugin.AttackTargets(__instance.aimPoint.position, __instance.aimPoint.forward, 30f);
field12.SetValue(__instance, (object)new Ray(__instance.aimPoint.position, __instance.aimPoint.forward));
value9 = field12.GetValue(__instance);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast((Ray)value9, ref val2, 30f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1))
{
value9 = field12.GetValue(__instance);
field13.SetValue(__instance, val2);
value10 = field12.GetValue(__instance);
Transform transform = ((Component)__instance.bulletCollisionAudio).transform;
Ray val3 = (Ray)value9;
val4 = (RaycastHit)value10;
transform.position = ((Ray)(ref val3)).GetPoint(((RaycastHit)(ref val4)).distance - 0.5f);
}
}
else
{
value5 = field6.GetValue(__instance);
field6.SetValue(__instance, (float)value5 - Time.deltaTime);
}
if (((NetworkBehaviour)__instance).IsServer)
{
value11 = field14.GetValue(__instance);
field14.SetValue(__instance, (float)value11 - Time.deltaTime);
value11 = field14.GetValue(__instance);
if ((float)value11 <= 0f)
{
MethodInfo method3 = typeFromHandle.GetMethod("SwitchTurretMode", BindingFlags.Instance | BindingFlags.NonPublic);
method3.Invoke(__instance, new object[1] { 0 });
__instance.SetToModeClientRpc(0);
}
}
break;
}
value3 = field4.GetValue(__instance);
if ((bool)value3)
{
__instance.turnTowardsObjectCompass.localEulerAngles = new Vector3(-180f, __instance.turretRod.localEulerAngles.y - Time.deltaTime * 20f, 180f);
__instance.turretRod.rotation = Quaternion.RotateTowards(__instance.turretRod.rotation, __instance.turnTowardsObjectCompass.rotation, __instance.rotationSpeed * Time.deltaTime);
return false;
}
value6 = field7.GetValue(__instance);
if ((bool)value6)
{
__instance.turnTowardsObjectCompass.localEulerAngles = new Vector3(-180f, Mathf.Clamp(__instance.targetRotation, 0f - __instance.rotationRange, __instance.rotationRange), 180f);
}
__instance.turretRod.rotation = Quaternion.RotateTowards(__instance.turretRod.rotation, __instance.turnTowardsObjectCompass.rotation, __instance.rotationSpeed * Time.deltaTime);
}
return false;
}
public static bool PatchSetTargetToPlayerBody(ref Turret __instance)
{
Type typeFromHandle = typeof(Turret);
FieldInfo field = typeFromHandle.GetField("targetingDeadPlayer", BindingFlags.Instance | BindingFlags.NonPublic);
object value = field.GetValue(__instance);
if ((Object)(object)__instance.targetPlayerWithRotation != (Object)null)
{
if (__instance.targetPlayerWithRotation.isPlayerDead)
{
value = field.GetValue(__instance);
if (!(bool)value)
{
field.SetValue(__instance, true);
}
if ((Object)(object)__instance.targetPlayerWithRotation.deadBody != (Object)null)
{
__instance.targetTransform = ((Component)__instance.targetPlayerWithRotation.deadBody.bodyParts[5]).transform;
}
FAIR_AI component = ((Component)__instance).gameObject.GetComponent<FAIR_AI>();
if ((Object)(object)component.targetWithRotation != (Object)null)
{
value = field.GetValue(__instance);
if (!(bool)value)
{
field.SetValue(__instance, true);
}
value = field.GetValue(__instance);
if (!((Component)component.targetWithRotation).GetComponent<EnemyAI>().isEnemyDead)
{
field.SetValue(__instance, false);
__instance.targetTransform = ((Component)component.targetWithRotation).transform;
}
}
}
else
{
field.SetValue(__instance, false);
__instance.targetTransform = ((Component)__instance.targetPlayerWithRotation.gameplayCamera).transform;
}
}
else
{
FAIR_AI component2 = ((Component)__instance).gameObject.GetComponent<FAIR_AI>();
if ((Object)(object)component2.targetWithRotation != (Object)null)
{
value = field.GetValue(__instance);
if (!(bool)value)
{
field.SetValue(__instance, true);
}
value = field.GetValue(__instance);
if (!((Component)component2.targetWithRotation).GetComponent<EnemyAI>().isEnemyDead)
{
field.SetValue(__instance, false);
__instance.targetTransform = ((Component)component2.targetWithRotation).transform;
}
}
}
return false;
}
public static bool PatchTurnTowardsTargetIfHasLOS(ref Turret __instance)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: 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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
if (TurnTowardsTargetEnemyIfHasLOS(__instance))
{
return false;
}
bool flag = true;
Type typeFromHandle = typeof(Turret);
FieldInfo field = typeFromHandle.GetField("targetingDeadPlayer", BindingFlags.Instance | BindingFlags.NonPublic);
object value = field.GetValue(__instance);
FieldInfo field2 = typeFromHandle.GetField("hasLineOfSight", BindingFlags.Instance | BindingFlags.NonPublic);
object value2 = field.GetValue(__instance);
FieldInfo field3 = typeFromHandle.GetField("lostLOSTimer", BindingFlags.Instance | BindingFlags.NonPublic);
object value3 = field.GetValue(__instance);
if ((bool)value || Vector3.Angle(__instance.targetTransform.position - __instance.centerPoint.position, __instance.forwardFacingPos.forward) > __instance.rotationRange)
{
flag = false;
}
if (Physics.Linecast(__instance.aimPoint.position, __instance.targetTransform.position, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1))
{
flag = false;
}
if (flag)
{
field2.SetValue(__instance, true);
field3.SetValue(__instance, 0f);
__instance.tempTransform.position = __instance.targetTransform.position;
Transform tempTransform = __instance.tempTransform;
tempTransform.position -= Vector3.up * 0.15f;
__instance.turnTowardsObjectCompass.LookAt(__instance.tempTransform);
return false;
}
value2 = field2.GetValue(__instance);
if ((bool)value2)
{
field2.SetValue(__instance, false);
field3.SetValue(__instance, 0f);
}
if (!((NetworkBehaviour)__instance).IsServer)
{
return false;
}
value3 = field3.GetValue(__instance);
field3.SetValue(__instance, (float)value3 + Time.deltaTime);
value3 = field3.GetValue(__instance);
if ((float)value3 >= 2f)
{
field3.SetValue(__instance, 0f);
Debug.Log((object)"Turret: LOS timer ended on server. checking for new player target");
PlayerControllerB val = __instance.CheckForPlayersInLineOfSight(2f, false);
List<EnemyAI> actualTargets = GetActualTargets(__instance, GetTargets(__instance));
if ((Object)(object)val != (Object)null)
{
__instance.targetPlayerWithRotation = val;
__instance.SwitchTargetedPlayerClientRpc((int)val.playerClientId, false);
Debug.Log((object)"Turret: Got new player target");
}
else
{
Debug.Log((object)"Turret: No new player to target; returning to detection mode.");
__instance.targetPlayerWithRotation = null;
__instance.RemoveTargetedPlayerClientRpc();
}
}
return false;
}
public static bool TurnTowardsTargetEnemyIfHasLOS(Turret turret)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
bool flag = true;
Type typeFromHandle = typeof(Turret);
FieldInfo field = typeFromHandle.GetField("targetingDeadPlayer", BindingFlags.Instance | BindingFlags.NonPublic);
object value = field.GetValue(turret);
FieldInfo field2 = typeFromHandle.GetField("hasLineOfSight", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field3 = typeFromHandle.GetField("lostLOSTimer", BindingFlags.Instance | BindingFlags.NonPublic);
if ((bool)value || Vector3.Angle(turret.targetTransform.position - turret.centerPoint.position, turret.forwardFacingPos.forward) > turret.rotationRange)
{
flag = false;
}
if (Physics.Linecast(turret.aimPoint.position, turret.targetTransform.position, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1))
{
flag = false;
}
List<EnemyAI> actualTargets = GetActualTargets(turret, GetTargets(turret));
if (flag && actualTargets != null && actualTargets.Any())
{
field2.SetValue(turret, true);
field3.SetValue(turret, 0f);
if ((Object)(object)((Component)turret).GetComponent<FAIR_AI>() != (Object)null)
{
FAIR_AI component = ((Component)turret).GetComponent<FAIR_AI>();
if ((Object)(object)component.targetWithRotation == (Object)null)
{
component.targetWithRotation = actualTargets[0];
}
turret.tempTransform.position = ((Component)component.targetWithRotation).transform.position;
Transform tempTransform = turret.tempTransform;
tempTransform.position -= Vector3.up * 0.15f;
turret.turnTowardsObjectCompass.LookAt(turret.tempTransform);
}
return flag;
}
object value2 = field2.GetValue(turret);
if ((bool)value2)
{
field2.SetValue(turret, false);
field3.SetValue(turret, 0f);
}
if (!((NetworkBehaviour)turret).IsServer)
{
return false;
}
FAIR_AI component2 = ((Component)turret).gameObject.GetComponent<FAIR_AI>();
List<EnemyAI> actualTargets2 = GetActualTargets(turret, GetTargets(turret));
if (actualTargets2.Any())
{
component2.targetWithRotation = actualTargets2[0];
component2.SwitchedTargetedEnemyClientRpc(turret, actualTargets2[0]);
return true;
}
component2.targetWithRotation = null;
component2.RemoveTargetedEnemyClientRpc();
return false;
}
public static List<EnemyAI> GetActualTargets(Turret turret, List<EnemyAI> targets)
{
List<EnemyAI> list = new List<EnemyAI>();
if (targets != null)
{
targets.RemoveAll((EnemyAI t) => (Object)(object)t == (Object)null);
if (targets.Any())
{
foreach (EnemyAI target in targets)
{
if ((Object)(object)target != (Object)null && !target.isEnemyDead && Plugin.CanMob("TurretTargetAllMobs", ".Turret Target", target.enemyType.enemyName))
{
list.Add(target);
}
}
}
}
return list;
}
private static List<EnemyAI> GetTargets(Turret turret, float radius = 2f, bool angleRangeCheck = false)
{
List<Transform> list = FindVisibleTargets(turret);
List<EnemyAI> en = new List<EnemyAI>();
if (list.Any())
{
list.ForEach(delegate(Transform e)
{
EnemyAICollisionDetect component = ((Component)e).GetComponent<EnemyAICollisionDetect>();
EnemyAI val = ((Component)component).GetComponent<EnemyAI>();
if ((Object)(object)component != (Object)null)
{
val = component.mainScript;
}
if ((Object)(object)val != (Object)null && Plugin.CanMob("TurretTargetAllMobs", ".Turret Target", val.enemyType.enemyName))
{
en.Add(val);
}
});
}
return en;
}
public static Vector3 DirectionFromAngle(Turret turret, float angleInDegrees, bool angleIsGlobal)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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)
if (!angleIsGlobal)
{
angleInDegrees += ((Component)turret).transform.eulerAngles.y;
}
return new Vector3(Mathf.Sin(angleInDegrees * ((float)Math.PI / 180f)), 0f, Mathf.Cos(angleInDegrees * ((float)Math.PI / 180f)));
}
public static List<Transform> FindVisibleTargets(Turret turret)
{
//IL_0007: 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_003f: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0083: 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_009b: 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)
Collider[] array = Physics.OverlapSphere(turret.aimPoint.position, viewRadius, Plugin.enemyMask);
List<Transform> list = new List<Transform>();
for (int i = 0; i < array.Length; i++)
{
Transform transform = ((Component)array[i]).transform;
Vector3 val = transform.position - turret.aimPoint.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
if (!(Vector3.Angle(turret.aimPoint.forward, normalized) < viewAngle / 2f))
{
continue;
}
float num = Vector3.Distance(turret.aimPoint.position, transform.position);
if (!Physics.Raycast(turret.aimPoint.position, normalized, num, ~Plugin.enemyMask))
{
if ((Object)(object)((Component)transform).GetComponent<EnemyAICollisionDetect>() != (Object)null && Plugin.CanMob("TurretTargetAllMobs", ".Turret Target", ((Component)transform).GetComponent<EnemyAICollisionDetect>().mainScript.enemyType.enemyName))
{
list.Add(transform);
}
if ((Object)(object)((Component)transform).GetComponent<EnemyAI>() != (Object)null && Plugin.CanMob("TurretTargetAllMobs", ".Turret Target", ((Component)transform).GetComponent<EnemyAI>().enemyType.enemyName))
{
list.Add(transform);
}
}
}
return list;
}
}
}
namespace FairAI.Component
{
internal class BoombaTimer : MonoBehaviour
{
private bool isActiveBomb = false;
private void Start()
{
((MonoBehaviour)this).StartCoroutine(StartBombTimer());
Plugin.logger.LogInfo((object)"Boomba has been set active.");
}
public IEnumerator StartBombTimer()
{
SetActiveBomb(isActive: false);
yield return (object)new WaitForSeconds(3f);
SetActiveBomb(isActive: true);
}
public void SetActiveBomb(bool isActive)
{
isActiveBomb = isActive;
}
public bool IsActiveBomb()
{
return isActiveBomb;
}
}
}