using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("4.5.0.0")] [assembly: AssemblyInformationalVersion("4.5.0")] [assembly: AssemblyProduct("EmpressBotPlayers")] [assembly: AssemblyTitle("EmpressBotPlayers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.PlayerBot { internal static class BotAccess { private delegate void EnemyHurtDelegate(EnemyHealth instance, int damage, Vector3 direction); private static readonly FieldInfo TruckScreenInstanceField = AccessTools.Field(typeof(TruckScreenText), "instance"); private static readonly FieldInfo TruckScreenStaticGrabColliderField = AccessTools.Field(typeof(TruckScreenText), "staticGrabCollider"); private static readonly FieldInfo PhysGrabberGrabbedPhysObjectField = AccessTools.Field(typeof(PhysGrabber), "grabbedPhysGrabObject"); private static readonly FieldInfo PhysGrabberGrabbedObjectField = AccessTools.Field(typeof(PhysGrabber), "grabbedObject"); private static readonly FieldInfo PhysGrabberGrabRangeField = AccessTools.Field(typeof(PhysGrabber), "grabRange"); private static readonly FieldInfo RoundDirectorInstanceField = AccessTools.Field(typeof(RoundDirector), "instance"); private static readonly FieldInfo RoundExtractionActiveField = AccessTools.Field(typeof(RoundDirector), "extractionPointActive"); private static readonly FieldInfo RoundExtractionCurrentField = AccessTools.Field(typeof(RoundDirector), "extractionPointCurrent"); private static readonly FieldInfo RoundAllExtractionsCompletedField = AccessTools.Field(typeof(RoundDirector), "allExtractionPointsCompleted"); private static readonly FieldInfo PlayerEnergyStartField = AccessTools.Field(typeof(PlayerController), "EnergyStart"); private static readonly FieldInfo PlayerEnergyCurrentField = AccessTools.Field(typeof(PlayerController), "EnergyCurrent"); private static readonly FieldInfo PlayerAvatarField = AccessTools.Field(typeof(PlayerController), "playerAvatarScript"); private static readonly FieldInfo PlayerSteamIdField = AccessTools.Field(typeof(PlayerAvatar), "steamID"); private static readonly FieldInfo StatsManagerInstanceField = AccessTools.Field(typeof(StatsManager), "instance"); private static readonly FieldInfo StatsManagerItemDictionaryField = AccessTools.Field(typeof(StatsManager), "itemDictionary"); private static readonly FieldInfo StatsManagerItemField = AccessTools.Field(typeof(StatsManager), "item"); private static readonly FieldInfo StatsManagerSpot1TakenField = AccessTools.Field(typeof(StatsManager), "playerInventorySpot1Taken"); private static readonly FieldInfo StatsManagerSpot2TakenField = AccessTools.Field(typeof(StatsManager), "playerInventorySpot2Taken"); private static readonly FieldInfo StatsManagerSpot3TakenField = AccessTools.Field(typeof(StatsManager), "playerInventorySpot3Taken"); private static readonly FieldInfo InventoryInstanceField = AccessTools.Field(typeof(Inventory), "instance"); private static readonly FieldInfo PunManagerInstanceField = AccessTools.Field(typeof(PunManager), "instance"); private static readonly FieldInfo PhysGrabberInstanceField = AccessTools.Field(typeof(PhysGrabber), "instance"); private static readonly FieldInfo ItemDisabledField = AccessTools.Field(typeof(Item), "disabled"); private static readonly FieldInfo ItemTypeField = AccessTools.Field(typeof(Item), "itemType"); private static readonly FieldInfo ItemNameField = AccessTools.Field(typeof(Item), "itemName"); private static readonly FieldInfo ItemPrefabField = AccessTools.Field(typeof(Item), "prefab"); private static readonly FieldInfo ItemGunMuzzleField = AccessTools.Field(typeof(ItemGun), "gunMuzzle"); private static readonly FieldInfo ItemGunBatteryField = AccessTools.Field(typeof(ItemGun), "itemBattery"); private static readonly FieldInfo ItemGunShootCooldownField = AccessTools.Field(typeof(ItemGun), "shootCooldown"); private static readonly FieldInfo ItemGunShootTimeField = AccessTools.Field(typeof(ItemGun), "shootTime"); private static readonly FieldInfo ItemGunBatteryDrainField = AccessTools.Field(typeof(ItemGun), "batteryDrain"); private static readonly FieldInfo ItemGunBatteryDrainFullBarField = AccessTools.Field(typeof(ItemGun), "batteryDrainFullBar"); private static readonly FieldInfo ItemBatteryLifeField = AccessTools.Field(typeof(ItemBattery), "batteryLife"); private static readonly FieldInfo ItemBatteryLifeIntField = AccessTools.Field(typeof(ItemBattery), "batteryLifeInt"); private static readonly FieldInfo ItemBatteryBarsField = AccessTools.Field(typeof(ItemBattery), "batteryBars"); private static readonly FieldInfo ItemAttributesInstanceNameField = AccessTools.Field(typeof(ItemAttributes), "instanceName"); private static readonly FieldInfo EnemyDirectorSpawnedField = AccessTools.Field(typeof(EnemyDirector), "enemiesSpawned"); private static readonly FieldInfo RunManagerLevelIsShopField = AccessTools.Field(typeof(RunManager), "levelIsShop"); private static readonly FieldInfo ExtractionSpotlight1Field = AccessTools.Field(typeof(ExtractionPoint), "spotlight1"); private static readonly FieldInfo EnemyParentSpawnedField = AccessTools.Field(typeof(EnemyParent), "Spawned"); private static readonly FieldInfo EnemyParentEnemyField = AccessTools.Field(typeof(EnemyParent), "Enemy"); private static readonly FieldInfo EnemyHealthField = AccessTools.Field(typeof(Enemy), "Health"); private static readonly FieldInfo EnemyHealthCurrentField = AccessTools.Field(typeof(EnemyHealth), "healthCurrent"); private static readonly FieldInfo EnemyHealthDeadField = AccessTools.Field(typeof(EnemyHealth), "dead"); private static readonly FieldInfo EnemyHealthDeadImpulseField = AccessTools.Field(typeof(EnemyHealth), "deadImpulse"); private static readonly MethodInfo InventoryGetAllSpotsMethod = AccessTools.Method(typeof(Inventory), "GetAllSpots", (Type[])null, (Type[])null); private static readonly MethodInfo InventorySpotIsOccupiedMethod = AccessTools.Method(typeof(InventorySpot), "IsOccupied", (Type[])null, (Type[])null); private static readonly MethodInfo StatsManagerSetBatteryLevelMethod = AccessTools.Method(typeof(StatsManager), "SetBatteryLevel", new Type[2] { typeof(string), typeof(int) }, (Type[])null); private static readonly MethodInfo StatsManagerDictionaryUpdateValueMethod = AccessTools.Method(typeof(StatsManager), "DictionaryUpdateValue", new Type[3] { typeof(string), typeof(string), typeof(int) }, (Type[])null); private static readonly MethodInfo PunManagerUpdateStatMethod = AccessTools.Method(typeof(PunManager), "UpdateStat", new Type[3] { typeof(string), typeof(string), typeof(int) }, (Type[])null); private static readonly MethodInfo PunManagerSetItemNameMethod = AccessTools.Method(typeof(PunManager), "SetItemName", new Type[3] { typeof(string), typeof(ItemAttributes), typeof(int) }, (Type[])null); private static readonly MethodInfo PrefabResourcePathGetter = AccessTools.PropertyGetter(typeof(PrefabRef), "ResourcePath"); private static readonly MethodInfo PrefabObjectGetter = AccessTools.PropertyGetter(typeof(PrefabRef), "Prefab"); private static readonly MethodInfo ItemEquippableRequestEquipMethod = AccessTools.Method(typeof(ItemEquippable), "RequestEquip", new Type[2] { typeof(int), typeof(int) }, (Type[])null); private static readonly MethodInfo PhysGrabberOverrideGrabMethod = AccessTools.Method(typeof(PhysGrabber), "OverrideGrab", new Type[3] { typeof(PhysGrabObject), typeof(float), typeof(bool) }, (Type[])null); private static readonly MethodInfo PhysGrabberOverrideAlwaysGrabbableMethod = AccessTools.Method(typeof(PhysGrabber), "OverrideAlwaysGrabbable", new Type[1] { typeof(float) }, (Type[])null); private static readonly MethodInfo PhysGrabberOverrideGrabDistanceMethod = AccessTools.Method(typeof(PhysGrabber), "OverrideGrabDistance", new Type[1] { typeof(float) }, (Type[])null); private static readonly MethodInfo PhysGrabberOverrideGrabReleaseMethod = AccessTools.Method(typeof(PhysGrabber), "OverrideGrabRelease", new Type[2] { typeof(int), typeof(float) }, (Type[])null); private static readonly MethodInfo ExtractionPointOnClickMethod = AccessTools.Method(typeof(ExtractionPoint), "OnClick", (Type[])null, (Type[])null); private static readonly EnemyHurtDelegate EnemyHurt = CreateEnemyHurtDelegate(); private static readonly FieldInfo ShopManagerInstanceField = AccessTools.Field(typeof(ShopManager), "instance"); private static readonly FieldInfo ShopManagerTotalCurrencyField = AccessTools.Field(typeof(ShopManager), "totalCurrency"); private static readonly FieldInfo ShopManagerTotalCostField = AccessTools.Field(typeof(ShopManager), "totalCost"); private static readonly FieldInfo ItemAttributesItemField = AccessTools.Field(typeof(ItemAttributes), "item"); private static readonly FieldInfo ItemAttributesValueField = AccessTools.Field(typeof(ItemAttributes), "value"); private static readonly MethodInfo ExtractionPointOnShopClickMethod = AccessTools.Method(typeof(ExtractionPoint), "OnShopClick", (Type[])null, (Type[])null); private static readonly MethodInfo ExtractionPointButtonPressMethod = AccessTools.Method(typeof(ExtractionPoint), "ButtonPress", (Type[])null, (Type[])null); public static TruckScreenText TruckScreen() { return GetStatic(TruckScreenInstanceField); } public static GameObject TruckScreenStaticGrabCollider(TruckScreenText screen) { return Get(TruckScreenStaticGrabColliderField, screen); } public static PhysGrabObject GrabbedPhysObject(PhysGrabber grabber) { return Get(PhysGrabberGrabbedPhysObjectField, grabber); } public static Rigidbody GrabbedRigidbody(PhysGrabber grabber) { return Get(PhysGrabberGrabbedObjectField, grabber); } public static float GrabRange(PhysGrabber grabber) { return GetFloat(PhysGrabberGrabRangeField, grabber, 4f); } public static RoundDirector RoundDirector() { return GetStatic(RoundDirectorInstanceField); } public static bool ExtractionPointActive(RoundDirector round) { return GetBool(RoundExtractionActiveField, round); } public static ExtractionPoint CurrentExtractionPoint(RoundDirector round) { return Get(RoundExtractionCurrentField, round); } public static bool AllExtractionsCompleted(RoundDirector round) { return GetBool(RoundAllExtractionsCompletedField, round); } public static float EnergyStart(PlayerController player) { return GetFloat(PlayerEnergyStartField, player, 0f); } public static float EnergyCurrent(PlayerController player) { return GetFloat(PlayerEnergyCurrentField, player, 0f); } public static PlayerAvatar PlayerAvatar(PlayerController player) { return Get(PlayerAvatarField, player); } public static string PlayerSteamId(PlayerAvatar avatar) { return GetString(PlayerSteamIdField, avatar); } public static StatsManager StatsManagerInstance() { return GetStatic(StatsManagerInstanceField); } public static Inventory InventoryInstance() { return GetStatic(InventoryInstanceField); } public static PunManager PunManagerInstance() { return GetStatic(PunManagerInstanceField); } public static Dictionary ItemDictionary(StatsManager stats) { return Get>(StatsManagerItemDictionaryField, stats); } public static Dictionary ItemInstances(StatsManager stats) { return Get>(StatsManagerItemField, stats); } public static Dictionary InventorySpotTaken(StatsManager stats, int spot) { return spot switch { 1 => Get>(StatsManagerSpot2TakenField, stats), 0 => Get>(StatsManagerSpot1TakenField, stats), _ => Get>(StatsManagerSpot3TakenField, stats), }; } public static bool ItemDisabled(Item item) { return GetBool(ItemDisabledField, item); } public static itemType ItemType(Item item) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return GetStruct(ItemTypeField, (object)item, (itemType)0); } public static string ItemDisplayName(Item item) { return GetString(ItemNameField, item); } public static PrefabRef ItemPrefab(Item item) { return Get(ItemPrefabField, item); } public static string PrefabResourcePath(PrefabRef prefab) { if (prefab == null || PrefabResourcePathGetter == null) { return string.Empty; } try { return (PrefabResourcePathGetter.Invoke(prefab, null) as string) ?? string.Empty; } catch { return string.Empty; } } public static GameObject PrefabObject(PrefabRef prefab) { if (prefab == null || PrefabObjectGetter == null) { return null; } try { object? obj = PrefabObjectGetter.Invoke(prefab, null); return (GameObject)((obj is GameObject) ? obj : null); } catch { return null; } } public static List GetAllInventorySpots(Inventory inventory) { if (!Object.op_Implicit((Object)(object)inventory) || InventoryGetAllSpotsMethod == null) { return new List(); } try { return (InventoryGetAllSpotsMethod.Invoke(inventory, null) as List) ?? new List(); } catch { return new List(); } } public static bool IsInventorySpotOccupied(InventorySpot spot) { if (!Object.op_Implicit((Object)(object)spot) || InventorySpotIsOccupiedMethod == null) { return true; } try { object obj = InventorySpotIsOccupiedMethod.Invoke(spot, null); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return true; } } public static void SetBatteryLevel(StatsManager stats, string itemName, int value) { if (!Object.op_Implicit((Object)(object)stats) || string.IsNullOrEmpty(itemName) || StatsManagerSetBatteryLevelMethod == null) { return; } try { StatsManagerSetBatteryLevelMethod.Invoke(stats, new object[2] { itemName, value }); } catch { } } public static void DictionaryUpdateValue(StatsManager stats, string dictionaryName, string key, int value) { if (!Object.op_Implicit((Object)(object)stats) || string.IsNullOrEmpty(dictionaryName) || string.IsNullOrEmpty(key) || StatsManagerDictionaryUpdateValueMethod == null) { return; } try { StatsManagerDictionaryUpdateValueMethod.Invoke(stats, new object[3] { dictionaryName, key, value }); } catch { } } public static void UpdateStat(PunManager manager, string dictionaryName, string key, int value) { if (!Object.op_Implicit((Object)(object)manager) || string.IsNullOrEmpty(dictionaryName) || string.IsNullOrEmpty(key) || PunManagerUpdateStatMethod == null) { return; } try { PunManagerUpdateStatMethod.Invoke(manager, new object[3] { dictionaryName, key, value }); } catch { } } public static void SetItemName(PunManager manager, string itemName, ItemAttributes attributes, int photonViewId) { if (!Object.op_Implicit((Object)(object)manager) || string.IsNullOrEmpty(itemName) || !Object.op_Implicit((Object)(object)attributes) || PunManagerSetItemNameMethod == null) { return; } try { PunManagerSetItemNameMethod.Invoke(manager, new object[3] { itemName, attributes, photonViewId }); } catch { } } public static void RequestEquip(ItemEquippable equippable, int spot, int requesterViewId) { if (!Object.op_Implicit((Object)(object)equippable) || ItemEquippableRequestEquipMethod == null) { return; } try { ItemEquippableRequestEquipMethod.Invoke(equippable, new object[2] { spot, requesterViewId }); } catch { } } public static void OverrideGrab(PhysGrabObject target, float grabTime) { PhysGrabber @static = GetStatic(PhysGrabberInstanceField); if (!Object.op_Implicit((Object)(object)@static) || !Object.op_Implicit((Object)(object)target) || PhysGrabberOverrideGrabMethod == null) { return; } try { PhysGrabberOverrideGrabMethod.Invoke(@static, new object[3] { target, grabTime, false }); } catch { } } public static void OverrideGrab(PhysGrabber grabber, PhysGrabObject target, float grabTime) { if (!Object.op_Implicit((Object)(object)grabber) || !Object.op_Implicit((Object)(object)target) || PhysGrabberOverrideGrabMethod == null) { return; } try { PhysGrabberOverrideGrabMethod.Invoke(grabber, new object[3] { target, grabTime, false }); } catch { } } public static void OverrideAlwaysGrabbable(PhysGrabber grabber, float time) { if (!Object.op_Implicit((Object)(object)grabber) || PhysGrabberOverrideAlwaysGrabbableMethod == null) { return; } try { PhysGrabberOverrideAlwaysGrabbableMethod.Invoke(grabber, new object[1] { time }); } catch { } } public static void OverrideGrabDistance(PhysGrabber grabber, float distance) { if (!Object.op_Implicit((Object)(object)grabber) || PhysGrabberOverrideGrabDistanceMethod == null) { return; } try { PhysGrabberOverrideGrabDistanceMethod.Invoke(grabber, new object[1] { distance }); } catch { } } public static void ReleaseGrab(PhysGrabber grabber, PhysGrabObject target, float time) { if (!Object.op_Implicit((Object)(object)grabber) || !Object.op_Implicit((Object)(object)target) || PhysGrabberOverrideGrabReleaseMethod == null) { return; } try { PhysGrabberOverrideGrabReleaseMethod.Invoke(grabber, new object[2] { PhotonViewId((Component)(object)target), time }); } catch { } } public static int PhotonViewId(Component component) { if (!Object.op_Implicit((Object)(object)component)) { return -1; } PhotonView component2 = component.GetComponent(); if (!Object.op_Implicit((Object)(object)component2)) { return -1; } return component2.ViewID; } public static Transform GunMuzzle(ItemGun gun) { return Get(ItemGunMuzzleField, gun); } public static ItemBattery GunBattery(ItemGun gun) { return Get(ItemGunBatteryField, gun); } public static void TuneBotGun(ItemGun gun) { if (Object.op_Implicit((Object)(object)gun)) { SetField(ItemGunShootCooldownField, gun, 0.08f); SetField(ItemGunShootTimeField, gun, 0.03f); SetField(ItemGunBatteryDrainField, gun, 0f); SetField(ItemGunBatteryDrainFullBarField, gun, value: false); gun.gunRandomSpread = 0f; gun.gunRange = Mathf.Max(gun.gunRange, 50f); } } public static int BatteryBars(ItemBattery battery) { return GetStruct(ItemBatteryBarsField, battery, 0); } public static void SetBattery(ItemBattery battery, float life, int lifeInt) { if (Object.op_Implicit((Object)(object)battery)) { SetField(ItemBatteryLifeField, battery, life); SetField(ItemBatteryLifeIntField, battery, lifeInt); } } public static string ItemInstanceName(ItemAttributes attributes) { return GetString(ItemAttributesInstanceNameField, attributes); } public static List EnemiesSpawned() { return Get>(EnemyDirectorSpawnedField, EnemyDirector.instance) ?? new List(); } public static bool RunLevelIsShop(RunManager runManager) { return GetBool(RunManagerLevelIsShopField, runManager); } public static bool ExtractionSpotlightEnabled(ExtractionPoint point) { Light val = Get(ExtractionSpotlight1Field, point); if (Object.op_Implicit((Object)(object)val)) { return ((Behaviour)val).enabled; } return false; } public static void ActivateExtractionPoint(ExtractionPoint point) { if (!Object.op_Implicit((Object)(object)point) || ExtractionPointOnClickMethod == null) { return; } try { ExtractionPointOnClickMethod.Invoke(point, null); } catch { } } public static void ShopCheckout(ExtractionPoint point) { if (!Object.op_Implicit((Object)(object)point) || ExtractionPointOnShopClickMethod == null) { return; } try { ExtractionPointOnShopClickMethod.Invoke(point, null); } catch { } } public static void ShopButtonPress(ExtractionPoint point) { if (!Object.op_Implicit((Object)(object)point) || ExtractionPointButtonPressMethod == null) { return; } try { ExtractionPointButtonPressMethod.Invoke(point, null); } catch { } } public static ShopManager ShopManagerInstance() { return GetStatic(ShopManagerInstanceField); } public static int ShopTotalCurrency(ShopManager shop) { return GetInt(ShopManagerTotalCurrencyField, shop, 0); } public static int ShopTotalCost(ShopManager shop) { return GetInt(ShopManagerTotalCostField, shop, 0); } public static Item ItemFromAttributes(ItemAttributes attributes) { return Get(ItemAttributesItemField, attributes); } public static int ItemAttributesValue(ItemAttributes attributes) { return GetInt(ItemAttributesValueField, attributes, 0); } public static int EnemyHealthCurrent(EnemyHealth health) { return GetInt(EnemyHealthCurrentField, health, 1); } public static bool EnemyParentSpawned(EnemyParent enemyParent) { return GetBool(EnemyParentSpawnedField, enemyParent); } public static Enemy EnemyFromParent(EnemyParent enemyParent) { return Get(EnemyParentEnemyField, enemyParent); } public static EnemyHealth EnemyHealth(Enemy enemy) { return Get(EnemyHealthField, enemy); } public static bool EnemyHealthDead(EnemyHealth health) { if (!GetBool(EnemyHealthDeadField, health) && !GetBool(EnemyHealthDeadImpulseField, health)) { return EnemyHealthCurrent(health) <= 0; } return true; } public static void HurtEnemy(EnemyHealth health, int damage, Vector3 direction) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)health == (Object)null || EnemyHurt == null) { return; } try { EnemyHurt(health, damage, direction); } catch { } } private static T GetStatic(FieldInfo field) where T : class { if (field == null) { return null; } try { return field.GetValue(null) as T; } catch { return null; } } private static T Get(FieldInfo field, object instance) where T : class { if (field == null || instance == null) { return null; } try { return field.GetValue(instance) as T; } catch { return null; } } private static bool GetBool(FieldInfo field, object instance) { if (field == null || instance == null) { return false; } try { object value = field.GetValue(instance); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } private static float GetFloat(FieldInfo field, object instance, float fallback) { if (field == null || instance == null) { return fallback; } try { return (field.GetValue(instance) is float num) ? num : fallback; } catch { return fallback; } } private static int GetInt(FieldInfo field, object instance, int fallback) { if (field == null || instance == null) { return fallback; } try { return (field.GetValue(instance) is int num) ? num : fallback; } catch { return fallback; } } private static string GetString(FieldInfo field, object instance) { if (field == null || instance == null) { return string.Empty; } try { return (field.GetValue(instance) as string) ?? string.Empty; } catch { return string.Empty; } } private static T GetStruct(FieldInfo field, object instance, T fallback) where T : struct { if (field == null || instance == null) { return fallback; } try { return (field.GetValue(instance) is T val) ? val : fallback; } catch { return fallback; } } private static void SetField(FieldInfo field, object instance, T value) { if (field == null || instance == null) { return; } try { field.SetValue(instance, value); } catch { } } private static EnemyHurtDelegate CreateEnemyHurtDelegate() { try { MethodInfo methodInfo = AccessTools.Method(typeof(EnemyHealth), "Hurt", (Type[])null, (Type[])null); return (methodInfo == null) ? null : AccessTools.MethodDelegate(methodInfo, (object)null, true); } catch { return null; } } } [HarmonyPatch(typeof(InputManager))] public static class BotInputPatches { [HarmonyPatch("GetMovementX")] [HarmonyPrefix] public static bool MoveX(ref float __result) { if (!PlayerIsBotComplete.IsActive) { return true; } __result = PlayerIsBotComplete.MoveInput.x; return false; } [HarmonyPatch("GetMovementY")] [HarmonyPrefix] public static bool MoveY(ref float __result) { if (!PlayerIsBotComplete.IsActive) { return true; } __result = PlayerIsBotComplete.MoveInput.y; return false; } [HarmonyPatch("GetMouseX")] [HarmonyPrefix] public static bool LookX(ref float __result) { if (!PlayerIsBotComplete.IsActive) { return true; } __result = PlayerIsBotComplete.LookInput.x; return false; } [HarmonyPatch("GetMouseY")] [HarmonyPrefix] public static bool LookY(ref float __result) { if (!PlayerIsBotComplete.IsActive) { return true; } __result = PlayerIsBotComplete.LookInput.y; return false; } [HarmonyPatch("KeyHold")] [HarmonyPrefix] public static bool KeyHold(InputKey key, ref bool __result) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 if (!PlayerIsBotComplete.IsActive) { return true; } if ((int)key == 1) { __result = PlayerIsBotComplete.InputJump; return false; } if ((int)key == 2) { __result = PlayerIsBotComplete.InputInteract; return false; } if ((int)key == 4) { __result = PlayerIsBotComplete.InputThrow; return false; } if ((int)key == 10) { __result = PlayerIsBotComplete.InputGrab; return false; } if ((int)key == 15) { __result = PlayerIsBotComplete.InputSprint; return false; } return true; } [HarmonyPatch("KeyDown")] [HarmonyPrefix] public static bool KeyDown(InputKey key, ref bool __result) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 if (!PlayerIsBotComplete.IsActive) { return true; } if ((int)key == 1) { __result = PlayerIsBotComplete.InputJump; return false; } if ((int)key == 2) { __result = PlayerIsBotComplete.InputInteract; return false; } if ((int)key == 4) { __result = PlayerIsBotComplete.InputThrow; return false; } if ((int)key == 10) { __result = PlayerIsBotComplete.InputGrab; return false; } if ((int)key == 15) { __result = PlayerIsBotComplete.InputSprint; return false; } return true; } } public class PlayerBotBrain : MonoBehaviour { public enum State { Initializing, Wandering, ChasingLoot, Grabbing, CarryingToTruck, GoingToTruck, StartingEngine, WaitingForActivation, Combat } private PlayerController _player; private State _currentState; private PhysGrabObject _targetLoot; private PhysGrabObject _lastTargetLoot; private ExtractionPoint _targetExtractor; private float _chaseTimer; private int _lastActivateId; private float _lastActivateTime; private float _grabAttemptTimer; private float _truckInteractTimer; private string _debugStatus = "Initializing..."; private bool _reachedTruck; private bool _returningToTruckBeforeScreenRetry; private float _retargetTimer; private float _waitingForActivationTimer; private float _deliveryNoPathTimer; private float _deliveryStillTimer; private float _deliveryRecoveryUntil; private float _deliveryRepathTimer; private float _deliveryEndpointTimer; private Vector3 _deliveryRecoveryPoint; private Vector3 _deliveryLastGoal; private Vector3 _lastDeliveryPosition; private ExtractionPoint _deliveryCommittedExtractor; private int _deliveryCommittedItemId; private float _lootRepathTimer; private Vector3 _lastLootGoal; private State _lastLoggedState; private string _lastLoggedStatus; private float _stateTraceTimer; private string _sceneKey; private Coroutine _initRoutine; private bool _levelReady; private float _offMeshTimer; private Vector3 _globalIdlePosition; private float _globalIdleTimer; private int _shopCarriedUpgradeId; private ExtractionPoint _shopCheckoutExtractor; public Transform CamTr { get; private set; } public PlayerBotNavigation Navigation { get; private set; } public PlayerBotLootScanner LootScanner { get; private set; } public PlayerBotCarryController CarryController { get; private set; } public PlayerBotExtractionController ExtractionController { get; private set; } public PlayerBotCombatController CombatController { get; private set; } public PlayerBotShopController ShopController { get; private set; } public bool IsWanderingState => _currentState == State.Wandering; private void Start() { _player = ((Component)this).GetComponent(); RefreshCameraTransform(); Navigation = new PlayerBotNavigation(this); LootScanner = new PlayerBotLootScanner(this); CarryController = new PlayerBotCarryController(this); ExtractionController = new PlayerBotExtractionController(this); CombatController = new PlayerBotCombatController(this); ShopController = new PlayerBotShopController(this); _sceneKey = ResolveLevelKey(); BeginLevelInitialization(releaseCarry: false); } private void OnDisable() { PlayerIsBotComplete.IsActive = false; if (CarryController != null && Object.op_Implicit((Object)(object)CarryController.CarriedItem)) { CarryController.ReleaseItem(immediate: true); } } private void OnGUI() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)PlayerIsBotComplete.Instance == (Object)null) && PlayerIsBotComplete.Instance.ShowOverlay.Value) { GUI.color = Color.cyan; GUI.skin.label.fontStyle = (FontStyle)1; GUI.skin.box.fontStyle = (FontStyle)1; GUI.Box(new Rect(10f, 10f, 300f, 200f), "Be A Bot"); GUI.Label(new Rect(20f, 35f, 280f, 20f), $"State: {_currentState}"); GUI.Label(new Rect(20f, 50f, 280f, 20f), "Target: " + (Object.op_Implicit((Object)(object)_targetLoot) ? ((Object)_targetLoot).name : "None")); GUI.Label(new Rect(20f, 65f, 280f, 20f), "Carrying: " + (Object.op_Implicit((Object)(object)CarryController.CarriedItem) ? ((Object)CarryController.CarriedItem).name : "None")); GUI.Label(new Rect(20f, 80f, 280f, 20f), $"Stuck: {Navigation.StuckTimer:F1}"); GUI.Label(new Rect(20f, 95f, 280f, 20f), "Status: " + _debugStatus); GUI.Label(new Rect(20f, 110f, 280f, 20f), $"Carry Time: {CarryController.CarryTimer:F1}s"); GUI.Label(new Rect(20f, 125f, 280f, 20f), $"Reached Truck: {_reachedTruck}"); Rigidbody val = (Object.op_Implicit((Object)(object)CarryController.Grabber) ? BotAccess.GrabbedRigidbody(CarryController.Grabber) : null); string text = (Object.op_Implicit((Object)(object)val) ? ((Object)val).name : "Nothing"); GUI.Label(new Rect(20f, 155f, 280f, 20f), "Hand: " + text); GUI.Label(new Rect(20f, 170f, 280f, 20f), $"Inputs Locked: {PlayerIsBotComplete.IsActive}"); GUI.skin.label.fontStyle = (FontStyle)0; GUI.skin.box.fontStyle = (FontStyle)0; } } public void SetDebugStatus(string status) { if (!(_debugStatus == status)) { _debugStatus = status; PlayerIsBotComplete.DebugLog("Status=" + status); } } private void RefreshCameraTransform() { Transform val = ResolveCameraTransform(); if (Object.op_Implicit((Object)(object)val)) { CamTr = val; } } private Transform ResolveCameraTransform() { PlayerAvatar val = null; if (Object.op_Implicit((Object)(object)_player)) { val = _player.playerAvatarScript; } if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)PlayerController.instance)) { val = PlayerController.instance.playerAvatarScript; } if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)PlayerAvatar.instance)) { val = PlayerAvatar.instance; } if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.PlayerVisionTarget) && Object.op_Implicit((Object)(object)val.PlayerVisionTarget.VisionTransform)) { return val.PlayerVisionTarget.VisionTransform; } if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.localCamera)) { return ((Component)val.localCamera).transform; } Camera val2 = ((Component)this).GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = Camera.main; } if (Object.op_Implicit((Object)(object)val2)) { return ((Component)val2).transform; } return ((Component)this).transform; } private IEnumerator InitLevelData() { _levelReady = false; PlayerIsBotComplete.IsActive = false; PlayerIsBotComplete.ClearInputs(); _debugStatus = "Waiting for LevelGen..."; while ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { yield return (object)new WaitForSeconds(1f); } _debugStatus = "Waiting for NavMesh..."; yield return (object)new WaitForSeconds(1f); bool placed = false; while (!placed) { if (Navigation.TryPlaceOnNavMesh(((Component)this).transform.position)) { placed = true; continue; } _debugStatus = "Retrying NavMesh..."; yield return (object)new WaitForSeconds(2f); } Navigation.BuildGlobalTargets(); Navigation.PickWanderDest(); _currentState = State.Wandering; _debugStatus = "Ready"; _levelReady = true; PlayerIsBotComplete.IsActive = true; _initRoutine = null; } private void BeginLevelInitialization(bool releaseCarry) { if (_initRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_initRoutine); } ResetRuntimeState(releaseCarry); _initRoutine = ((MonoBehaviour)this).StartCoroutine(InitLevelData()); } private void ResetRuntimeState(bool releaseCarry) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00f3: Unknown result type (might be due to invalid IL or missing references) _levelReady = false; PlayerIsBotComplete.IsActive = false; PlayerIsBotComplete.ClearInputs(); if (releaseCarry && CarryController != null && Object.op_Implicit((Object)(object)CarryController.CarriedItem)) { CarryController.ReleaseItem(immediate: true); } _targetLoot = null; _lastTargetLoot = null; _targetExtractor = null; _lastActivateId = 0; _lastActivateTime = 0f; _currentState = State.Initializing; _debugStatus = "Waiting for LevelGen..."; _chaseTimer = 0f; _grabAttemptTimer = 0f; _truckInteractTimer = 0f; _reachedTruck = false; _returningToTruckBeforeScreenRetry = false; _retargetTimer = 0f; _waitingForActivationTimer = 0f; _lootRepathTimer = 0f; _lastLootGoal = Vector3.zero; _stateTraceTimer = 0f; _lastLoggedStatus = null; _offMeshTimer = 0f; _globalIdlePosition = Vector3.zero; _globalIdleTimer = 0f; _shopCarriedUpgradeId = 0; _shopCheckoutExtractor = null; ResetDeliveryState(); if (Navigation != null) { Navigation.ResetRuntime(); } if (LootScanner != null) { LootScanner.Reset(); } if (ShopController != null) { ShopController.ResetForNewScene(_sceneKey); } } private string ResolveLevelKey() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; int num = (Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? ((Object)LevelGenerator.Instance).GetInstanceID() : 0); bool flag = false; bool flag2 = false; bool flag3 = false; try { flag = SemiFunc.RunIsShop(); flag2 = SemiFunc.RunIsLevel(); flag3 = SemiFunc.MenuLevel(); } catch { } return $"{name}:{num}:{flag}:{flag2}:{flag3}"; } private void Update() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (!PlayerIsBotComplete.CanRunOnThisPeer()) { PlayerIsBotComplete.IsActive = false; PlayerIsBotComplete.ClearInputs(); } else { if ((Object)(object)Navigation.Agent == (Object)null) { return; } string text = ResolveLevelKey(); if (_sceneKey != text) { _sceneKey = text; BeginLevelInitialization(releaseCarry: true); return; } RefreshCameraTransform(); if (!_levelReady) { PlayerIsBotComplete.IsActive = false; PlayerIsBotComplete.ClearInputs(); TraceState(); return; } PlayerIsBotComplete.IsActive = true; Navigation.Agent.nextPosition = ((Component)this).transform.position; if (!Navigation.Agent.isOnNavMesh) { PlayerIsBotComplete.ClearInputs(); _offMeshTimer += Time.deltaTime; if (Navigation.TryPlaceOnNavMesh(((Component)this).transform.position, 6f)) { _offMeshTimer = 0f; } else if (Navigation.TryPlaceOnNavMesh(((Component)this).transform.position, 20f)) { _offMeshTimer = 0f; } else if (_offMeshTimer > 5f) { _offMeshTimer = 0f; BeginLevelInitialization(releaseCarry: false); } return; } _offMeshTimer = 0f; LootScanner.UpdateTimers(); ExtractionController.Update(); CombatController.UpdateLoadout(); if ((Object)(object)PlayerIsBotComplete.Instance != (Object)null && PlayerIsBotComplete.Instance.CombatAssist.Value && CombatController.UpdateCombat()) { _currentState = State.Combat; } else { UpdateDecisions(); Navigation.UpdateMovement(); } UpdateAiming(); if (Object.op_Implicit((Object)(object)CarryController.CarriedItem)) { CarryController.KeepItemAttached(); } UpdateGlobalIdleWatchdog(); TraceState(); } } private void UpdateGlobalIdleWatchdog() { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (_currentState == State.WaitingForActivation || _currentState == State.Grabbing || _currentState == State.StartingEngine || _currentState == State.Combat) { _globalIdlePosition = ((Component)this).transform.position; _globalIdleTimer = 0f; return; } if (_globalIdlePosition == Vector3.zero) { _globalIdlePosition = ((Component)this).transform.position; _globalIdleTimer = 0f; return; } if (Vector3.Distance(((Component)this).transform.position.WithY(0f), _globalIdlePosition.WithY(0f)) > 0.6f) { _globalIdlePosition = ((Component)this).transform.position; _globalIdleTimer = 0f; return; } _globalIdleTimer += Time.deltaTime; if (_globalIdleTimer < 8f) { return; } PlayerIsBotComplete.DebugLog("Idle watchdog firing in state=" + _currentState); _globalIdleTimer = 0f; _globalIdlePosition = ((Component)this).transform.position; switch (_currentState) { case State.ChasingLoot: if (Object.op_Implicit((Object)(object)_targetLoot)) { LootScanner.IgnorePermanent(((Object)_targetLoot).GetInstanceID()); } _targetLoot = null; _lastTargetLoot = null; _chaseTimer = 0f; _lootRepathTimer = 0f; _lastLootGoal = Vector3.zero; _currentState = State.Wandering; Navigation.Agent.ResetPath(); Navigation.PickWanderDest(); break; case State.CarryingToTruck: if (Object.op_Implicit((Object)(object)CarryController.CarriedItem)) { LootScanner.IgnoreTemp(((Object)CarryController.CarriedItem).GetInstanceID(), 60f); CarryController.ReleaseItem(immediate: true); } ResetDeliveryState(); _currentState = State.Wandering; Navigation.Agent.ResetPath(); Navigation.PickWanderDest(); break; case State.GoingToTruck: _reachedTruck = false; _returningToTruckBeforeScreenRetry = false; _truckInteractTimer = 0f; Navigation.Agent.ResetPath(); Navigation.PickWanderDest(); _currentState = State.Wandering; break; default: Navigation.Agent.ResetPath(); Navigation.PickWanderDest(); _currentState = State.Wandering; break; } SetDebugStatus("Recovered from idle stall"); } private void UpdateDecisions() { //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_10e9: Unknown result type (might be due to invalid IL or missing references) //IL_10f4: Unknown result type (might be due to invalid IL or missing references) //IL_0c09: Unknown result type (might be due to invalid IL or missing references) //IL_0c0e: Unknown result type (might be due to invalid IL or missing references) //IL_0c10: Unknown result type (might be due to invalid IL or missing references) //IL_0c12: 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_0b2a: Unknown result type (might be due to invalid IL or missing references) //IL_0b2f: Unknown result type (might be due to invalid IL or missing references) //IL_0b37: Unknown result type (might be due to invalid IL or missing references) //IL_0b78: Unknown result type (might be due to invalid IL or missing references) //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0b87: Unknown result type (might be due to invalid IL or missing references) //IL_0b8e: Unknown result type (might be due to invalid IL or missing references) //IL_0d8d: Unknown result type (might be due to invalid IL or missing references) //IL_0d92: Unknown result type (might be due to invalid IL or missing references) //IL_0de3: Unknown result type (might be due to invalid IL or missing references) //IL_0de8: Unknown result type (might be due to invalid IL or missing references) //IL_0c59: Unknown result type (might be due to invalid IL or missing references) //IL_0c63: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_0c70: Unknown result type (might be due to invalid IL or missing references) //IL_0c6c: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_0dfb: Unknown result type (might be due to invalid IL or missing references) //IL_0e0b: Unknown result type (might be due to invalid IL or missing references) //IL_0c77: Unknown result type (might be due to invalid IL or missing references) //IL_0ee0: Unknown result type (might be due to invalid IL or missing references) //IL_0ee5: Unknown result type (might be due to invalid IL or missing references) //IL_0ee7: Unknown result type (might be due to invalid IL or missing references) //IL_0eee: Unknown result type (might be due to invalid IL or missing references) //IL_0ef4: Unknown result type (might be due to invalid IL or missing references) //IL_0efe: Unknown result type (might be due to invalid IL or missing references) //IL_0ea2: Unknown result type (might be due to invalid IL or missing references) //IL_0ea7: Unknown result type (might be due to invalid IL or missing references) //IL_0f3e: Unknown result type (might be due to invalid IL or missing references) //IL_0f44: Invalid comparison between Unknown and I4 //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Invalid comparison between Unknown and I4 //IL_0f78: Unknown result type (might be due to invalid IL or missing references) //IL_0f82: Unknown result type (might be due to invalid IL or missing references) //IL_0f84: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0fbf: Unknown result type (might be due to invalid IL or missing references) //IL_0d1a: Unknown result type (might be due to invalid IL or missing references) //IL_10c6: Unknown result type (might be due to invalid IL or missing references) //IL_10cb: Unknown result type (might be due to invalid IL or missing references) //IL_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_0a0e: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_09e0: Unknown result type (might be due to invalid IL or missing references) //IL_1033: Unknown result type (might be due to invalid IL or missing references) //IL_1035: Unknown result type (might be due to invalid IL or missing references) //IL_0a26: Unknown result type (might be due to invalid IL or missing references) //IL_0a2b: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) PlayerIsBotComplete.InputSprint = false; float num = (Object.op_Implicit((Object)(object)_player) ? BotAccess.EnergyStart(_player) : 0f); if (Object.op_Implicit((Object)(object)_player) && num > 0f && BotAccess.EnergyCurrent(_player) / num >= 0.5f && Navigation.Agent.hasPath && !Navigation.Agent.pathPending && Navigation.TryGetRemainingDistance(out var distance) && distance > 5f && Navigation.TryGetMoveDirection(out var direction) && Vector3.Angle(((Component)this).transform.forward, direction) < 20f) { PlayerIsBotComplete.InputSprint = true; } if (_currentState == State.WaitingForActivation) { _waitingForActivationTimer += Time.deltaTime; if (!Object.op_Implicit((Object)(object)_targetExtractor)) { _currentState = State.Wandering; _waitingForActivationTimer = 0f; return; } RoundDirector val = BotAccess.RoundDirector(); if (Object.op_Implicit((Object)(object)val) && BotAccess.ExtractionPointActive(val) && (Object)(object)BotAccess.CurrentExtractionPoint(val) == (Object)(object)_targetExtractor) { _currentState = State.Wandering; _targetExtractor = null; _debugStatus = "Extractor Activated! Resuming..."; _waitingForActivationTimer = 0f; Navigation.PickWanderDest(); } else if (_waitingForActivationTimer > 3f) { _debugStatus = "Activation wait complete, resuming..."; _currentState = State.Wandering; _targetExtractor = null; _waitingForActivationTimer = 0f; Navigation.PickWanderDest(); } else { Navigation.Agent.ResetPath(); } return; } if ((Object)(object)CarryController.CarriedItem != (Object)null) { _currentState = State.CarryingToTruck; _chaseTimer = 0f; CarryController.UpdateCarryTimer(); int instanceID = ((Object)CarryController.CarriedItem).GetInstanceID(); if (_deliveryCommittedItemId != instanceID) { ResetDeliveryPathState(); _deliveryCommittedExtractor = null; _deliveryCommittedItemId = instanceID; } ExtractionPoint targetEP = null; Vector3 goal; bool flag = TryResolveDeliveryTarget(out goal, out targetEP); if (!flag) { ExtractionPoint val2 = SemiFunc.ExtractionPointGetNearest(((Component)this).transform.position); if (Object.op_Implicit((Object)(object)val2)) { targetEP = val2; goal = ((Component)val2).transform.position; flag = true; } } if (_debugStatus == "Picked up item!" && !CarryController.IsDropping) { SetDebugStatus(Object.op_Implicit((Object)(object)targetEP) ? "Carrying item to extractor..." : "Carrying item to truck..."); } float num2 = Vector3.Distance(((Component)this).transform.position, goal); float num3 = (CarryController.UsingVanillaPhysGrab ? 2.75f : 3f); float num4 = (CarryController.UsingVanillaPhysGrab ? 4.5f : 5f); if (flag && num2 <= num3 && !CarryController.IsDropping) { if (Object.op_Implicit((Object)(object)targetEP) && !IsDeliveryDropAllowed(targetEP)) { SetDebugStatus("Activating extractor before delivery..."); TryActivateExtraction(targetEP); _targetExtractor = targetEP; _currentState = State.WaitingForActivation; _waitingForActivationTimer = 0f; ExtractionController.StartActivation(targetEP); Navigation.Agent.ResetPath(); return; } if (IsDeliveryDropAllowed(targetEP) || CarryController.CarryTimer > 14f) { SetDebugStatus("Dropping item into chute..."); CarryController.StartDrop(targetEP); PlayerIsBotComplete.InputInteract = false; return; } } if (flag) { UpdateDeliveryProgress(); Vector3 val3 = ((Time.time < _deliveryRecoveryUntil) ? _deliveryRecoveryPoint : goal); float distance2; bool flag2 = Navigation.TryGetRemainingDistance(out distance2); bool flag3 = Navigation.HasCompletePath() && !flag2 && _deliveryStillTimer > 1.5f; bool flag4 = !Navigation.Agent.hasPath || (!Navigation.Agent.pathPending && (int)Navigation.Agent.pathStatus > 0) || flag3; bool num5 = Navigation.Agent.pathPending && _deliveryRepathTimer > 0f; bool flag5 = Vector3.Distance(val3.WithY(0f), _deliveryLastGoal.WithY(0f)) > 1f; _deliveryRepathTimer -= Time.deltaTime; bool flag6 = num5 || (Navigation.Agent.hasPath && !flag5 && !flag4); if (!flag6 && (flag5 || flag4 || _deliveryRepathTimer <= 0f)) { if (flag3) { Navigation.Agent.ResetPath(); } flag6 = Navigation.SetDestination(val3); if (flag6) { _deliveryLastGoal = val3; _deliveryRecoveryUntil = 0f; _deliveryRepathTimer = 1.25f; } } if (!flag6) { float minRadius = (CarryController.UsingVanillaPhysGrab ? 1.2f : 2f); flag6 = Navigation.TrySetDestinationNear(goal, minRadius, 7f, out _deliveryRecoveryPoint); if (flag6) { _deliveryLastGoal = _deliveryRecoveryPoint; _deliveryRecoveryUntil = Time.time + 1f; _deliveryRepathTimer = 1.25f; SetDebugStatus("Recovering delivery path..."); } } if (!flag6) { _deliveryNoPathTimer += Time.deltaTime; if (_deliveryNoPathTimer > 1.5f && Navigation.TrySetRecoveryDestination(out _deliveryRecoveryPoint)) { _deliveryLastGoal = _deliveryRecoveryPoint; _deliveryRecoveryUntil = Time.time + 1f; _deliveryRepathTimer = 1.25f; _deliveryNoPathTimer = 0f; SetDebugStatus("Repositioning with valuable..."); } } else { _deliveryNoPathTimer = 0f; } if (_deliveryStillTimer > 5f && num2 > num4 + 1f) { bool flag7 = false; if (!flag2 && Navigation.TrySetCloserDestinationNear(goal, num2, num3, 8f, out _deliveryRecoveryPoint)) { _deliveryLastGoal = _deliveryRecoveryPoint; _deliveryRecoveryUntil = Time.time + 1f; _deliveryRepathTimer = 1.25f; flag7 = true; SetDebugStatus("Recovering delivery path..."); } else if (Navigation.SetDestination(goal)) { _deliveryLastGoal = goal; _deliveryRecoveryUntil = 0f; _deliveryRepathTimer = 1.25f; flag7 = true; SetDebugStatus("Refreshing delivery route..."); } else if (Navigation.TrySetDestinationNear(goal, num3, 7f, out _deliveryRecoveryPoint)) { _deliveryLastGoal = _deliveryRecoveryPoint; _deliveryRecoveryUntil = Time.time + 1f; _deliveryRepathTimer = 1.25f; flag7 = true; SetDebugStatus("Recovering delivery path..."); } else if (Navigation.TrySetRecoveryDestination(out _deliveryRecoveryPoint)) { _deliveryLastGoal = _deliveryRecoveryPoint; _deliveryRecoveryUntil = Time.time + 1f; _deliveryRepathTimer = 1.25f; flag7 = true; SetDebugStatus("Repositioning with valuable..."); } if (flag7) { Navigation.Agent.stoppingDistance = (CarryController.UsingVanillaPhysGrab ? 0.25f : 0.5f); } _deliveryStillTimer = 0f; } if (!CarryController.IsDropping && _deliveryStillTimer > 2f && num2 <= num4) { if (Object.op_Implicit((Object)(object)targetEP) && !IsDeliveryDropAllowed(targetEP)) { SetDebugStatus("Activating extractor from delivery endpoint..."); TryActivateExtraction(targetEP); _targetExtractor = targetEP; _currentState = State.WaitingForActivation; _waitingForActivationTimer = 0f; ExtractionController.StartActivation(targetEP); Navigation.Agent.ResetPath(); return; } if (IsDeliveryDropAllowed(targetEP) || CarryController.CarryTimer > 14f) { SetDebugStatus("Dropping item into chute..."); CarryController.StartDrop(targetEP); PlayerIsBotComplete.InputInteract = false; return; } } Navigation.Agent.stoppingDistance = (CarryController.UsingVanillaPhysGrab ? 0.25f : 0.5f); } if (flag && Navigation.HasCompletePath() && Navigation.TryGetRemainingDistance(out var distance3) && distance3 <= Navigation.Agent.stoppingDistance + 0.35f && num2 > num3 + 0.35f && !CarryController.IsDropping) { _deliveryEndpointTimer += Time.deltaTime; if (_deliveryEndpointTimer > 0.65f) { _deliveryEndpointTimer = 0f; if (Object.op_Implicit((Object)(object)targetEP) && !IsDeliveryDropAllowed(targetEP) && num2 <= 5f) { SetDebugStatus("Activating extractor from delivery endpoint..."); TryActivateExtraction(targetEP); _targetExtractor = targetEP; _currentState = State.WaitingForActivation; _waitingForActivationTimer = 0f; ExtractionController.StartActivation(targetEP); Navigation.Agent.ResetPath(); return; } if (num2 <= num4 && (IsDeliveryDropAllowed(targetEP) || CarryController.CarryTimer > 14f)) { SetDebugStatus("Dropping item into chute..."); CarryController.StartDrop(targetEP); PlayerIsBotComplete.InputInteract = false; return; } if (num2 > num4) { if (Navigation.SetDestination(goal)) { _deliveryLastGoal = goal; _deliveryRecoveryUntil = 0f; _deliveryRepathTimer = 1.25f; SetDebugStatus("Refreshing delivery route..."); } else if (Navigation.TrySetDestinationNear(goal, num3, 6f, out _deliveryRecoveryPoint)) { _deliveryLastGoal = _deliveryRecoveryPoint; _deliveryRecoveryUntil = Time.time + 1f; _deliveryRepathTimer = 1.25f; SetDebugStatus("Recovering delivery path..."); } } } } else { _deliveryEndpointTimer = 0f; } PlayerIsBotComplete.InputInteract = false; return; } ResetDeliveryState(); PlayerIsBotComplete.InputThrow = false; PlayerIsBotComplete.InputInteract = false; if (_shopCarriedUpgradeId != 0 && (Object)(object)CarryController.CarriedItem == (Object)null) { ShopController.NotifyUpgradeDelivered(); _shopCarriedUpgradeId = 0; } if (HandleShopBranch()) { return; } bool flag8 = false; RoundDirector val4 = BotAccess.RoundDirector(); if (Object.op_Implicit((Object)(object)val4) && BotAccess.AllExtractionsCompleted(val4)) { flag8 = true; } bool flag9 = false; if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom.PlayerCount <= 1) { flag9 = true; } if (flag9) { if (SemiFunc.RunIsShop()) { flag8 = true; } if (!SemiFunc.RunIsLevel()) { flag8 = true; } } if (flag8) { _currentState = State.GoingToTruck; _targetLoot = null; _chaseTimer = 0f; if (_returningToTruckBeforeScreenRetry) { Vector3 truckDestination = Navigation.GetTruckDestination(); Navigation.SetDestination(truckDestination); Navigation.Agent.stoppingDistance = 1.2f; _debugStatus = "Returning inside truck before screen retry..."; bool num6 = !Navigation.Agent.pathPending; bool flag10 = Vector3.Distance(((Component)this).transform.position.WithY(0f), truckDestination.WithY(0f)) <= 1.8f; float distance4; bool flag11 = num6 && Navigation.TryGetRemainingDistance(out distance4) && distance4 <= Navigation.Agent.stoppingDistance + 0.5f; if (flag10 || flag11) { _returningToTruckBeforeScreenRetry = false; _reachedTruck = false; _truckInteractTimer = 0f; _debugStatus = "Retrying truck screen..."; } return; } Vector3 destination = Navigation.GetTruckDestination(); Vector3 screenPosition = destination; bool flag12 = Navigation.TryGetTruckScreenDestination(out destination, out screenPosition); Navigation.SetDestination(destination); Navigation.Agent.stoppingDistance = (flag12 ? 0.65f : 1.5f); if (Vector3.Distance(((Component)this).transform.position.WithY(0f), (flag12 ? screenPosition : destination).WithY(0f)) <= (flag12 ? 3f : 3f) && !_reachedTruck) { _reachedTruck = true; _truckInteractTimer = 0f; _debugStatus = "At truck, looking for screen..."; } if (_reachedTruck && Object.op_Implicit((Object)(object)BotAccess.TruckScreen())) { _currentState = State.StartingEngine; _debugStatus = "Interacting with truck screen..."; if (_truckInteractTimer > 6f) { _reachedTruck = false; _returningToTruckBeforeScreenRetry = true; _truckInteractTimer = 0f; _currentState = State.GoingToTruck; Navigation.SetDestination(Navigation.GetTruckDestination()); Navigation.Agent.stoppingDistance = 1.2f; _debugStatus = "Truck screen missed, resetting inside truck..."; } } } else if ((Object)(object)_targetLoot != (Object)null) { if ((Object)(object)_targetLoot != (Object)(object)_lastTargetLoot) { _lastTargetLoot = _targetLoot; _chaseTimer = 0f; _lootRepathTimer = 0f; _lastLootGoal = Vector3.zero; } if (!((Component)_targetLoot).gameObject.activeInHierarchy || (Object)(object)_targetLoot.rb == (Object)null || SemiFunc.PhysGrabObjectIsGrabbed(_targetLoot)) { _targetLoot = null; _lastTargetLoot = null; _lootRepathTimer = 0f; _lastLootGoal = Vector3.zero; _currentState = State.Wandering; return; } float num7 = Vector3.Distance(((Component)this).transform.position, ((Component)_targetLoot).transform.position); if (num7 < 2.5f) { _currentState = State.Grabbing; _chaseTimer = 0f; Navigation.Agent.ResetPath(); _grabAttemptTimer += Time.deltaTime; if (_grabAttemptTimer > 3f) { LootScanner.IgnorePermanent(((Object)_targetLoot).GetInstanceID()); _targetLoot = null; _lastTargetLoot = null; _grabAttemptTimer = 0f; _lootRepathTimer = 0f; _lastLootGoal = Vector3.zero; Navigation.PickWanderDest(); } return; } _currentState = State.ChasingLoot; SetDebugStatus("Chasing loot..."); _grabAttemptTimer = 0f; Vector3 position = ((Component)_targetLoot).transform.position; bool num8 = Vector3.Distance(position.WithY(0f), _lastLootGoal.WithY(0f)) > 1f; bool flag13 = !Navigation.Agent.hasPath || (!Navigation.Agent.pathPending && (int)Navigation.Agent.pathStatus > 0); _lootRepathTimer -= Time.deltaTime; if (num8 || flag13 || _lootRepathTimer <= 0f) { if (Navigation.SetDestination(position)) { _lastLootGoal = position; _lootRepathTimer = 1f; } else { _lootRepathTimer = 0.25f; } } if (Navigation.StuckTimer > 2.4f) { bool flag14 = false; if (Navigation.TrySetCloserDestinationNear(position, num7, 1.25f, 7f, out var chosen)) { flag14 = true; SetDebugStatus("Recovering loot path..."); } else if (Navigation.TrySetAlternateDestinationNear(position, 1.75f, 7f, out chosen)) { flag14 = true; SetDebugStatus("Recovering loot path..."); } else if (Navigation.TrySetRecoveryDestination(out chosen)) { flag14 = true; SetDebugStatus("Repositioning for loot..."); } if (flag14) { _lastLootGoal = chosen; _lootRepathTimer = 0.75f; _chaseTimer = Mathf.Max(0f, _chaseTimer - 2f); Navigation.ResetStuckTimer(); } } _chaseTimer += Time.deltaTime; if (_chaseTimer > 15f) { LootScanner.IgnorePermanent(((Object)_targetLoot).GetInstanceID()); _targetLoot = null; _lastTargetLoot = null; _chaseTimer = 0f; _lootRepathTimer = 0f; _lastLootGoal = Vector3.zero; Navigation.PickWanderDest(); } } else { PhysGrabObject val5 = LootScanner.ScanForLoot(((Component)this).transform.position, Navigation.SpawnTruckPos); if ((Object)(object)val5 != (Object)null) { _targetLoot = val5; } _currentState = State.Wandering; SetDebugStatus("Wandering..."); _chaseTimer = 0f; _retargetTimer -= Time.deltaTime; bool num9 = !Navigation.Agent.pathPending; float distance5; bool flag15 = num9 && Navigation.TryGetRemainingDistance(out distance5) && distance5 <= Navigation.Agent.stoppingDistance + 1f; bool flag16 = num9 && !Navigation.Agent.hasPath; if (_retargetTimer <= 0f || flag15 || flag16) { Navigation.PickWanderDest(); _retargetTimer = Random.Range(3f, 8f); } } } private bool HandleShopBranch() { //IL_007a: 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_0086: 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_0095: 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_00b2: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if (ShopController == null || !ShopController.IsInShop) { _shopCheckoutExtractor = null; return false; } if (ShopController.ShouldCheckout) { ExtractionPoint val = _shopCheckoutExtractor; if (!Object.op_Implicit((Object)(object)val) || !((Component)val).gameObject.activeInHierarchy) { try { val = SemiFunc.ExtractionPointGetNearest(((Component)this).transform.position); } catch { val = null; } _shopCheckoutExtractor = val; } if (!Object.op_Implicit((Object)(object)val)) { return false; } Vector3 position = ((Component)val).transform.position; if (Vector3.Distance(((Component)this).transform.position.WithY(0f), position.WithY(0f)) > 3.5f) { Navigation.SetDestination(position); Navigation.Agent.stoppingDistance = 1.5f; _currentState = State.GoingToTruck; SetDebugStatus("Returning to extractor for checkout..."); return true; } Navigation.Agent.ResetPath(); _currentState = State.StartingEngine; SetDebugStatus("Pressing shop checkout..."); ShopController.TryCheckout(val); if (!ShopController.ShouldCheckout) { _shopCheckoutExtractor = null; } return true; } if (ShopController.ShouldPursueUpgrade && (Object)(object)CarryController.CarriedItem == (Object)null) { PhysGrabObject val2 = ShopController.FindAffordableUpgrade(); if (Object.op_Implicit((Object)(object)val2) && (Object)(object)_targetLoot != (Object)(object)val2) { _targetLoot = val2; _lastTargetLoot = null; _chaseTimer = 0f; _lootRepathTimer = 0f; _lastLootGoal = Vector3.zero; SetDebugStatus("Targeting shop upgrade..."); } } return false; } private bool TryResolveDeliveryTarget(out Vector3 goal, out ExtractionPoint targetEP) { //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_003b: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) goal = ((Component)this).transform.position; targetEP = null; try { RoundDirector val = BotAccess.RoundDirector(); if (Object.op_Implicit((Object)(object)val)) { if (BotAccess.AllExtractionsCompleted(val)) { _deliveryCommittedExtractor = null; goal = Navigation.GetTruckDestination(); return true; } if (IsCommittedDeliveryExtractorValid()) { targetEP = _deliveryCommittedExtractor; goal = ((Component)targetEP).transform.position; return true; } _deliveryCommittedExtractor = null; if (BotAccess.ExtractionPointActive(val) && Object.op_Implicit((Object)(object)BotAccess.CurrentExtractionPoint(val))) { targetEP = BotAccess.CurrentExtractionPoint(val); _deliveryCommittedExtractor = targetEP; goal = ((Component)targetEP).transform.position; return true; } ExtractionPoint val2 = GetFirstIdleExtraction(val); if (!Object.op_Implicit((Object)(object)val2)) { val2 = SemiFunc.ExtractionPointGetNearestNotActivated(((Component)this).transform.position); } if (Object.op_Implicit((Object)(object)val2)) { targetEP = val2; _deliveryCommittedExtractor = targetEP; goal = ((Component)val2).transform.position; return true; } } } catch { } return false; } private bool IsCommittedDeliveryExtractorValid() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)_deliveryCommittedExtractor) && ((Component)_deliveryCommittedExtractor).gameObject.activeInHierarchy) { return (int)_deliveryCommittedExtractor.currentState != 7; } return false; } private ExtractionPoint GetFirstIdleExtraction(RoundDirector round) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)round) || round.extractionPointList == null) { return null; } foreach (GameObject extractionPoint in round.extractionPointList) { if (Object.op_Implicit((Object)(object)extractionPoint)) { ExtractionPoint component = extractionPoint.GetComponent(); if (Object.op_Implicit((Object)(object)component) && (int)component.currentState == 1) { return component; } } } return null; } private static bool IsFiniteDistance(float distance) { if (!float.IsNaN(distance)) { return !float.IsInfinity(distance); } return false; } private void TraceState() { _stateTraceTimer -= Time.deltaTime; bool flag = _currentState != _lastLoggedState || _debugStatus != _lastLoggedStatus; if (flag || !(_stateTraceTimer > 0f)) { _stateTraceTimer = (flag ? 0.25f : 2f); _lastLoggedState = _currentState; _lastLoggedStatus = _debugStatus; bool flag2 = Object.op_Implicit((Object)(object)Navigation.Agent) && Navigation.Agent.hasPath; bool flag3 = Object.op_Implicit((Object)(object)Navigation.Agent) && Navigation.Agent.pathPending; float num = (Object.op_Implicit((Object)(object)Navigation.Agent) ? Navigation.RemainingDistanceForDebug() : (-1f)); string text = (Object.op_Implicit((Object)(object)_targetLoot) ? ((Object)_targetLoot).name : "None"); string text2 = (Object.op_Implicit((Object)(object)CarryController.CarriedItem) ? ((Object)CarryController.CarriedItem).name : "None"); PlayerIsBotComplete.DebugLog($"State={_currentState} Status={_debugStatus} Target={text} Carrying={text2} HasPath={flag2} Pending={flag3} Remaining={num:F1} Stuck={Navigation.StuckTimer:F1}"); } } private void UpdateDeliveryProgress() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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) if (_lastDeliveryPosition == Vector3.zero) { _lastDeliveryPosition = ((Component)this).transform.position; } if (Vector3.Distance(((Component)this).transform.position.WithY(0f), _lastDeliveryPosition.WithY(0f)) > 0.08f) { _lastDeliveryPosition = ((Component)this).transform.position; _deliveryStillTimer = 0f; return; } bool num = Navigation.HasCompletePath(); float distance; bool flag = Navigation.TryGetRemainingDistance(out distance); if (num && (!flag || distance > Navigation.Agent.stoppingDistance + 0.5f)) { _deliveryStillTimer += Time.deltaTime; } else { _deliveryStillTimer = 0f; } } private void ResetDeliveryState() { ResetDeliveryPathState(); _deliveryCommittedExtractor = null; _deliveryCommittedItemId = 0; } private void ResetDeliveryPathState() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) _deliveryNoPathTimer = 0f; _deliveryStillTimer = 0f; _deliveryRecoveryUntil = 0f; _deliveryRepathTimer = 0f; _deliveryEndpointTimer = 0f; _deliveryRecoveryPoint = Vector3.zero; _deliveryLastGoal = Vector3.zero; _lastDeliveryPosition = Vector3.zero; } private bool IsDeliveryDropAllowed(ExtractionPoint targetEP) { try { if ((Object)(object)targetEP != (Object)null && ExtractionController != null && ExtractionController.IsSettlingActivation(targetEP)) { return false; } if ((Object)(object)targetEP != (Object)null && BotAccess.ExtractionSpotlightEnabled(targetEP)) { return true; } RoundDirector val = BotAccess.RoundDirector(); if (Object.op_Implicit((Object)(object)val)) { if (BotAccess.AllExtractionsCompleted(val)) { return true; } if ((Object)(object)targetEP == (Object)null) { return false; } return BotAccess.ExtractionPointActive(val) && (Object)(object)BotAccess.CurrentExtractionPoint(val) == (Object)(object)targetEP; } } catch { } return true; } private void TryActivateExtraction(ExtractionPoint ep) { if (Object.op_Implicit((Object)(object)ep)) { int instanceID = ((Object)ep).GetInstanceID(); if (_lastActivateId != instanceID || !(Time.time - _lastActivateTime < 0.75f)) { _lastActivateId = instanceID; _lastActivateTime = Time.time; BotAccess.ActivateExtractionPoint(ep); } } } private void UpdateAiming() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_02b7: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00ea: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) PlayerIsBotComplete.LookInput = Vector2.zero; PlayerIsBotComplete.InputInteract = false; PlayerIsBotComplete.InputGrab = false; if (CombatController != null && CombatController.IsEngaged && CombatController.TryGetAimPosition(out var aimPosition)) { float num = AimAt(aimPosition); _debugStatus = $"Shooting enemy... Angle: {num:F1}°"; return; } if (_currentState == State.WaitingForActivation) { _debugStatus = "Waiting for extractor activation..."; return; } Vector3 val2; if (_currentState == State.Grabbing && (Object)(object)_targetLoot != (Object)null) { Vector3 val = ((Component)_targetLoot).transform.position; Collider component = ((Component)_targetLoot).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { Bounds bounds = component.bounds; val = ((Bounds)(ref bounds)).center; } val2 = val - CamTr.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 forward = CamTr.forward; val2 = new Vector3(forward.x, 0f, forward.z); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; val2 = new Vector3(normalized.x, 0f, normalized.z); Vector3 normalized3 = ((Vector3)(ref val2)).normalized; float num2 = Vector3.SignedAngle(normalized2, normalized3, Vector3.up); float num3 = Mathf.Asin(normalized.y) * 57.29578f - Mathf.Asin(forward.y) * 57.29578f; float x = Mathf.Clamp(num2 / 15f, -1f, 1f); float y = Mathf.Clamp(num3 / 15f, -1f, 1f); if (Mathf.Abs(num2) > 1f) { PlayerIsBotComplete.LookInput.x = x; } if (Mathf.Abs(num3) > 1f) { PlayerIsBotComplete.LookInput.y = y; } _debugStatus = $"Aiming: Y={num2:F1}° P={num3:F1}°"; if (!(Vector3.Angle(forward, normalized) < 15f) || !CarryController.CanReachTarget(_targetLoot)) { return; } if (ShopController != null && (Object)(object)ShopController.CurrentUpgradeTarget == (Object)(object)_targetLoot) { _shopCarriedUpgradeId = ((Object)_targetLoot).GetInstanceID(); _shopCheckoutExtractor = null; try { _shopCheckoutExtractor = SemiFunc.ExtractionPointGetNearest(((Component)this).transform.position); } catch { } ShopController.ClearUpgradeTarget(); } CarryController.PickUpItem(_targetLoot); _targetLoot = null; _grabAttemptTimer = 0f; return; } TruckScreenText val3 = BotAccess.TruckScreen(); if (_currentState == State.StartingEngine && Object.op_Implicit((Object)(object)val3)) { Vector3 position = ((Component)val3).transform.position; GameObject val4 = BotAccess.TruckScreenStaticGrabCollider(val3); if (Object.op_Implicit((Object)(object)val4)) { position = val4.transform.position; } val2 = position - CamTr.position; Vector3 normalized4 = ((Vector3)(ref val2)).normalized; Vector3 forward2 = CamTr.forward; val2 = new Vector3(forward2.x, 0f, forward2.z); Vector3 normalized5 = ((Vector3)(ref val2)).normalized; val2 = new Vector3(normalized4.x, 0f, normalized4.z); Vector3 normalized6 = ((Vector3)(ref val2)).normalized; float num4 = Vector3.SignedAngle(normalized5, normalized6, Vector3.up); float num5 = Mathf.Asin(normalized4.y) * 57.29578f - Mathf.Asin(forward2.y) * 57.29578f; float x2 = Mathf.Clamp(num4 / 15f, -1f, 1f); float y2 = Mathf.Clamp(num5 / 15f, -1f, 1f); if (Mathf.Abs(num4) > 1f) { PlayerIsBotComplete.LookInput.x = x2; } if (Mathf.Abs(num5) > 1f) { PlayerIsBotComplete.LookInput.y = y2; } float num6 = Vector3.Angle(forward2, normalized4); _debugStatus = $"Starting Engine... Angle: {num6:F1}°"; _truckInteractTimer += Time.deltaTime; if (num6 < 45f || _truckInteractTimer > 1f) { PlayerIsBotComplete.InputGrab = true; if (_truckInteractTimer > 2f) { _debugStatus = "Held grab, starting..."; } } } else { if (Navigation.Agent.hasPath && !Navigation.Agent.pathPending && Navigation.TryGetMoveDirection(out var direction)) { float num7 = Mathf.Clamp(Vector3.SignedAngle(((Component)this).transform.forward, direction, Vector3.up) / 45f, -1f, 1f) * 1.5f; PlayerIsBotComplete.LookInput = new Vector2(num7, 0f); } CenterCameraPitch(); } } private float AimAt(Vector3 targetPos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00f7: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPos - CamTr.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 forward = CamTr.forward; val = new Vector3(forward.x, 0f, forward.z); Vector3 normalized2 = ((Vector3)(ref val)).normalized; val = new Vector3(normalized.x, 0f, normalized.z); Vector3 normalized3 = ((Vector3)(ref val)).normalized; float num = Vector3.SignedAngle(normalized2, normalized3, Vector3.up); float num2 = Mathf.Asin(normalized.y) * 57.29578f - Mathf.Asin(forward.y) * 57.29578f; float x = Mathf.Clamp(num / 15f, -1f, 1f); float y = Mathf.Clamp(num2 / 15f, -1f, 1f); if (Mathf.Abs(num) > 1f) { PlayerIsBotComplete.LookInput.x = x; } if (Mathf.Abs(num2) > 1f) { PlayerIsBotComplete.LookInput.y = y; } return Vector3.Angle(forward, normalized); } private void CenterCameraPitch() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)CamTr)) { float num = Mathf.Asin(Mathf.Clamp(CamTr.forward.y, -1f, 1f)) * 57.29578f; if (Mathf.Abs(num) > 1f) { PlayerIsBotComplete.LookInput.y = Mathf.Clamp((0f - num) / 18f, -0.75f, 0.75f); } } } } public class PlayerBotCarryController { private PlayerBotBrain _brain; private Transform _holdPoint; private PhysGrabObject _fakeCarriedItem; private PhysGrabObject _activeGrabItem; private PhysGrabObject _pendingGrabItem; private float _pendingGrabUntil; private Rigidbody _carriedRB; private List _carriedCols = new List(); private Collider[] _myCols; public PhysGrabber Grabber { get; private set; } public PhysGrabObject CarriedItem { get { if (UseRealGrab) { PhysGrabObject val = BotAccess.GrabbedPhysObject(Grabber); if (Object.op_Implicit((Object)(object)val) && (Object)(object)val == (Object)(object)_activeGrabItem) { return val; } if (Object.op_Implicit((Object)(object)val) && (Object)(object)val == (Object)(object)_pendingGrabItem) { _activeGrabItem = val; return val; } if (Time.time < _pendingGrabUntil && Object.op_Implicit((Object)(object)_pendingGrabItem)) { return _pendingGrabItem; } if (!Object.op_Implicit((Object)(object)val) && Time.time >= _pendingGrabUntil) { _activeGrabItem = null; } return null; } return _fakeCarriedItem; } } private bool UseRealGrab { get { if ((Object)(object)Grabber != (Object)null) { return PlayerIsBotComplete.ShouldUseVanillaPhysGrab(); } return false; } } public bool UsingVanillaPhysGrab => UseRealGrab; public float CarryTimer { get; private set; } public bool IsDropping { get; private set; } public PlayerBotCarryController(PlayerBotBrain brain) { //IL_002a: 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_0070: Unknown result type (might be due to invalid IL or missing references) _brain = brain; Grabber = ((Component)brain).GetComponentInChildren(); _holdPoint = new GameObject("BotHoldPoint").transform; _holdPoint.SetParent(((Component)brain).transform, false); _holdPoint.localPosition = new Vector3(0f, 1f, 0.6f); _holdPoint.localRotation = Quaternion.identity; _myCols = ((Component)brain).GetComponentsInChildren(true); } public void UpdateCarryTimer() { CarryTimer += Time.deltaTime; } public bool CanReachTarget(PhysGrabObject target) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (UseRealGrab) { float num = Mathf.Max(2f, BotAccess.GrabRange(Grabber) + 0.5f); return Vector3.Distance(Object.op_Implicit((Object)(object)_brain.CamTr) ? _brain.CamTr.position : (((Component)_brain).transform.position + Vector3.up), ((Component)target).transform.position) <= num; } return Vector3.Distance(_holdPoint.position, ((Component)target).transform.position) < 2f; } public void PickUpItem(PhysGrabObject item) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)item) || (Object)(object)CarriedItem != (Object)null) { return; } if (UseRealGrab) { _activeGrabItem = item; _pendingGrabItem = item; _pendingGrabUntil = Time.time + 1.25f; PlayerIsBotComplete.InputGrab = true; BotAccess.OverrideAlwaysGrabbable(Grabber, 0.25f); BotAccess.OverrideGrab(Grabber, item, 0.35f); CarryTimer = 0f; _brain.ExtractionController.ResetGrace(); _brain.SetDebugStatus("Grabbing item"); return; } _fakeCarriedItem = item; _carriedRB = item.rb; try { ((Component)item).transform.SetParent((Transform)null, true); if (Object.op_Implicit((Object)(object)_carriedRB)) { _carriedRB.velocity = Vector3.zero; _carriedRB.angularVelocity = Vector3.zero; _carriedRB.isKinematic = true; } item.OverrideKnockOutOfGrabDisable(2f); } catch { } SetCarryCollisionIgnore(ignore: true); CarryTimer = 0f; _brain.ExtractionController.ResetGrace(); _brain.SetDebugStatus("Picked up item!"); } public void KeepItemAttached() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)CarriedItem)) { return; } if (UseRealGrab) { PlayerIsBotComplete.InputGrab = true; PhysGrabObject val = BotAccess.GrabbedPhysObject(Grabber); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)_activeGrabItem) && (Object)(object)val != (Object)(object)_activeGrabItem) { BotAccess.ReleaseGrab(Grabber, val, 0.15f); return; } if (Object.op_Implicit((Object)(object)_pendingGrabItem) && (!Object.op_Implicit((Object)(object)val) || (Object)(object)val != (Object)(object)_pendingGrabItem) && Time.time < _pendingGrabUntil) { BotAccess.OverrideAlwaysGrabbable(Grabber, 0.15f); BotAccess.OverrideGrab(Grabber, _pendingGrabItem, 0.2f); } BotAccess.OverrideGrabDistance(Grabber, 2f); } else { Transform transform = ((Component)_fakeCarriedItem).transform; if ((Object)(object)transform.parent != (Object)(object)_holdPoint) { transform.SetParent(_holdPoint, false); } transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; } } public void ReleaseItem(bool immediate, bool addForce = false) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)CarriedItem)) { return; } PhysGrabObject carriedItem = CarriedItem; int instanceID = ((Object)carriedItem).GetInstanceID(); _brain.LootScanner.IgnoreTemp(instanceID, 5f); if (UseRealGrab) { PlayerIsBotComplete.InputGrab = false; BotAccess.ReleaseGrab(Grabber, carriedItem, 0.2f); _activeGrabItem = null; _pendingGrabItem = null; _pendingGrabUntil = 0f; CarryTimer = 0f; _brain.ExtractionController.ResetGrace(); _brain.SetDebugStatus("Released item"); return; } try { ((Component)carriedItem).transform.SetParent((Transform)null, true); if (Object.op_Implicit((Object)(object)_carriedRB)) { _carriedRB.isKinematic = false; _carriedRB.velocity = Vector3.zero; _carriedRB.angularVelocity = Vector3.zero; } } catch { } SetCarryCollisionIgnore(ignore: false); Vector3 position = ((Component)carriedItem).transform.position + ((Component)_brain).transform.forward * 0.8f; ((Component)carriedItem).transform.position = position; if (addForce && Object.op_Implicit((Object)(object)_carriedRB)) { _carriedRB.AddForce(((Component)_brain).transform.forward * 4f, (ForceMode)1); } _fakeCarriedItem = null; _carriedRB = null; CarryTimer = 0f; _brain.ExtractionController.ResetGrace(); _brain.SetDebugStatus("Dropped item"); } public void StartDrop(ExtractionPoint activeEP) { IsDropping = true; ((MonoBehaviour)_brain).StartCoroutine(DropGently(activeEP)); } private IEnumerator DropGently(ExtractionPoint activeEP) { if (!Object.op_Implicit((Object)(object)CarriedItem)) { IsDropping = false; yield break; } if (UseRealGrab) { PhysGrabObject releasedReal = CarriedItem; float settleUntil = Time.time + 1f; while (Object.op_Implicit((Object)(object)releasedReal) && Time.time < settleUntil) { PlayerIsBotComplete.InputGrab = true; BotAccess.OverrideGrabDistance(Grabber, Object.op_Implicit((Object)(object)activeEP) ? 1f : 1.4f); yield return null; } ReleaseItem(immediate: false); if (Object.op_Implicit((Object)(object)releasedReal)) { _brain.LootScanner.IgnoreTemp(((Object)releasedReal).GetInstanceID(), 5f); } IsDropping = false; yield break; } PhysGrabObject released = _fakeCarriedItem; Transform tform = ((Component)released).transform; try { tform.SetParent((Transform)null, true); } catch { } Vector3 start = tform.position; Vector3 val; Vector3 val2; if (!Object.op_Implicit((Object)(object)activeEP)) { val = ((Component)_brain).transform.forward; } else { val2 = (((Component)activeEP).transform.position - ((Component)_brain).transform.position).WithY(0f); val = ((Vector3)(ref val2)).normalized; } Vector3 val3 = val; if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f) { val3 = ((Component)_brain).transform.forward; } Vector3 end = start + val3 * 0.6f + Vector3.down * 0.3f; float t = 0f; float dur = 0.25f; while (t < dur && Object.op_Implicit((Object)(object)_fakeCarriedItem)) { t += Time.deltaTime; float num = Mathf.Clamp01(t / dur); tform.position = Vector3.Lerp(start, end, num); tform.rotation = Quaternion.Slerp(tform.rotation, Quaternion.identity, num * 0.5f); yield return null; } try { if (Object.op_Implicit((Object)(object)_carriedRB)) { _carriedRB.isKinematic = false; _carriedRB.detectCollisions = true; if ((int)_carriedRB.collisionDetectionMode == 0) { _carriedRB.collisionDetectionMode = (CollisionDetectionMode)2; } _carriedRB.velocity = Vector3.zero; _carriedRB.angularVelocity = Vector3.zero; } } catch { } SetCarryCollisionIgnore(ignore: false); if (Object.op_Implicit((Object)(object)_brain.Navigation.Agent) && _brain.Navigation.Agent.isOnNavMesh) { Vector3 position = ((Component)_brain).transform.position; val2 = Random.insideUnitSphere.WithY(0f); NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(position + ((Vector3)(ref val2)).normalized * 1.2f, ref val4, 2f, -1)) { _brain.Navigation.SetDestination(((NavMeshHit)(ref val4)).position); } } yield return (object)new WaitForFixedUpdate(); HardReleaseAndSeparate(((Component)_brain).transform.position); int instanceID = ((Object)released).GetInstanceID(); _brain.LootScanner.IgnoreTemp(instanceID, 5f); _fakeCarriedItem = null; _carriedRB = null; CarryTimer = 0f; _brain.ExtractionController.ResetGrace(); IsDropping = false; _brain.SetDebugStatus("Item delivered!"); } private void HardReleaseAndSeparate(Vector3 awayFrom, float minSeparation = 0.9f) { //IL_0032: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_fakeCarriedItem == (Object)null) { return; } try { ((Component)_fakeCarriedItem).transform.SetParent((Transform)null, true); } catch { } Vector3 val = (((Component)_fakeCarriedItem).transform.position - awayFrom).WithY(0f); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = ((Component)_brain).transform.forward; } val = ((Vector3)(ref val)).normalized; Vector3 position = ((Component)_fakeCarriedItem).transform.position + val * minSeparation; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)_fakeCarriedItem).transform.position + Vector3.up * 0.1f, val, ref val2, minSeparation, -1, (QueryTriggerInteraction)1)) { position = ((RaycastHit)(ref val2)).point - val * 0.05f; } ((Component)_fakeCarriedItem).transform.position = position; Physics.SyncTransforms(); try { if (Object.op_Implicit((Object)(object)_carriedRB)) { _carriedRB.AddForce(val * 1.25f, (ForceMode)1); } } catch { } } private void SetCarryCollisionIgnore(bool ignore) { if ((Object)(object)_fakeCarriedItem == (Object)null) { return; } _carriedCols.Clear(); ((Component)_fakeCarriedItem).GetComponentsInChildren(true, _carriedCols); for (int i = 0; i < _myCols.Length; i++) { Collider val = _myCols[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } for (int j = 0; j < _carriedCols.Count; j++) { Collider val2 = _carriedCols[j]; if (Object.op_Implicit((Object)(object)val2)) { try { Physics.IgnoreCollision(val, val2, ignore); } catch { } } } } } } public class PlayerBotCombatController { private readonly PlayerBotBrain _brain; private Enemy _target; private ItemGun _handgun; private ItemAttributes _handgunAttributes; private PhysGrabObject _handgunGrabObject; private Transform _gunHoldPoint; private Rigidbody _handgunRigidbody; private readonly List _handgunColliders = new List(); private readonly List _enemyColliders = new List(); private readonly Dictionary _hiddenTargetCooldowns = new Dictionary(); private string _handgunInstanceName; private string _loadoutSceneKey; private float _loadoutRetryTimer; private float _scanTimer; private float _fireTimer; private float _lostSightTimer; private float _repositionTimer; private float _visibleTargetTimer; private int _visibleTargetId; private bool _aimLocked; private const float ENGAGE_RANGE = 16f; private const float HIDDEN_ENGAGE_RANGE = 8.5f; private const float RELEASE_RANGE = 20f; private const float FIRE_INTERVAL = 0.55f; private const float LOST_SIGHT_LIMIT = 3.5f; private const float VISIBLE_TARGET_LIMIT = 8f; private const float VISIBLE_TARGET_COOLDOWN = 4f; private const float HIDDEN_TARGET_COOLDOWN = 10f; public bool IsEngaged { get; private set; } public PlayerBotCombatController(PlayerBotBrain brain) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) _brain = brain; _gunHoldPoint = new GameObject("BotGunHoldPoint").transform; _gunHoldPoint.SetParent(((Component)brain).transform, false); _gunHoldPoint.localPosition = new Vector3(0.35f, 1f, 0.55f); _gunHoldPoint.localRotation = Quaternion.identity; } public void UpdateLoadout() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!CanUseLevelLoadout()) { _loadoutSceneKey = null; _handgun = null; _handgunAttributes = null; _handgunGrabObject = null; _handgunRigidbody = null; _handgunColliders.Clear(); _handgunInstanceName = null; return; } KeepHandgunCharged(); UpdateGunHold(active: false); Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (_loadoutSceneKey == name && !string.IsNullOrEmpty(_handgunInstanceName)) { return; } _loadoutRetryTimer -= Time.deltaTime; if (!(_loadoutRetryTimer > 0f)) { _loadoutRetryTimer = 2f; if (TryGiveHandgun()) { _loadoutSceneKey = name; } } } public bool UpdateCombat() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) IsEngaged = false; _aimLocked = false; if (!CanUseLevelLoadout()) { _target = null; _visibleTargetTimer = 0f; _visibleTargetId = 0; return false; } _fireTimer -= Time.deltaTime; KeepHandgunCharged(); if (!IsValidTarget(_target)) { _target = FindTarget(); } if (!IsValidTarget(_target)) { return false; } if (Object.op_Implicit((Object)(object)_brain.CarryController.CarriedItem)) { IsEngaged = true; PlayerIsBotComplete.MoveInput = Vector2.zero; PlayerIsBotComplete.InputSprint = false; PlayerIsBotComplete.InputJump = false; _brain.Navigation.Agent.ResetPath(); _brain.CarryController.ReleaseItem(immediate: false); _brain.SetDebugStatus("Dropping valuable for combat..."); return true; } if (!Object.op_Implicit((Object)(object)_handgun)) { if (_loadoutRetryTimer <= 0f) { TryGiveHandgun(); } return false; } TryHoldHandgun(); Vector3 aimPosition = GetAimPosition(_target); if (Vector3.Distance(((Component)_brain).transform.position, aimPosition) > 20f) { _target = null; _visibleTargetTimer = 0f; _visibleTargetId = 0; return false; } bool flag = HasLineOfSight(_target, aimPosition); if (!flag) { _visibleTargetTimer = 0f; _visibleTargetId = 0; _lostSightTimer += Time.deltaTime; if (_lostSightTimer > 3.5f) { SuppressHiddenTarget(_target, "lost sight timeout"); _target = null; _lostSightTimer = 0f; return false; } IsEngaged = true; PlayerIsBotComplete.InputSprint = false; PlayerIsBotComplete.InputJump = false; if (!TryRepositionForShot(aimPosition)) { SuppressHiddenTarget(_target, "no reposition path"); _target = null; _lostSightTimer = 0f; return false; } _brain.Navigation.UpdateMovement(); _brain.SetDebugStatus("Repositioning for shot..."); return true; } _lostSightTimer = 0f; _aimLocked = true; int instanceID = ((Object)_target).GetInstanceID(); if (_visibleTargetId != instanceID) { _visibleTargetId = instanceID; _visibleTargetTimer = 0f; } _visibleTargetTimer += Time.deltaTime; if (_visibleTargetTimer > 8f) { SuppressHiddenTarget(_target, "visible combat timeout", 4f); _target = null; _visibleTargetTimer = 0f; _visibleTargetId = 0; return false; } IsEngaged = true; _brain.Navigation.Agent.ResetPath(); PlayerIsBotComplete.MoveInput = Vector2.zero; PlayerIsBotComplete.InputSprint = false; PlayerIsBotComplete.InputJump = false; if (flag && _fireTimer <= 0f && IsAimedAt(aimPosition)) { FireAtTarget(_target, aimPosition); _fireTimer = 0.55f; } return true; } public bool TryGetAimPosition(out Vector3 aimPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) aimPosition = Vector3.zero; if (!IsValidTarget(_target)) { return false; } if (!_aimLocked) { return false; } aimPosition = GetAimPosition(_target); return true; } private bool CanUseLevelLoadout() { if (!PlayerIsBotComplete.CanRunOnThisPeer()) { return false; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return false; } if (SemiFunc.RunIsShop() || SemiFunc.RunIsLobbyMenu() || SemiFunc.MenuLevel()) { return false; } if (Object.op_Implicit((Object)(object)RunManager.instance) && BotAccess.RunLevelIsShop(RunManager.instance)) { return false; } return SemiFunc.RunIsLevel(); } private bool TryGiveHandgun() { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) StatsManager val = BotAccess.StatsManagerInstance(); Inventory val2 = BotAccess.InventoryInstance(); PlayerController val3 = ((Component)_brain).GetComponent(); if (!Object.op_Implicit((Object)(object)val3)) { val3 = PlayerController.instance; } if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val3)) { return false; } Item val4 = FindHandgunItem(val); PrefabRef val5 = BotAccess.ItemPrefab(val4); if (!Object.op_Implicit((Object)(object)val4) || val5 == null) { return false; } int num = FindFreeInventorySpot(val2); if (num < 0) { return false; } PlayerAvatar val6 = BotAccess.PlayerAvatar(val3); if (!Object.op_Implicit((Object)(object)val6)) { return false; } string text = BotAccess.PlayerSteamId(val6); if (string.IsNullOrEmpty(text)) { return false; } string text2 = PredictNextInstanceName(((Object)val4).name); BotAccess.SetBatteryLevel(val, text2, 100); ReserveInventorySpot(val, BotAccess.PunManagerInstance(), text, text2, num); Vector3 val7 = ((Component)_brain).transform.position + ((Component)_brain).transform.forward * 0.8f + Vector3.up * 0.8f; Vector3 val8 = ((Component)_brain).transform.forward.WithY(0f); Vector3 val9; if (!(((Vector3)(ref val8)).sqrMagnitude > 0.001f)) { val9 = Vector3.forward; } else { val8 = ((Component)_brain).transform.forward.WithY(0f); val9 = ((Vector3)(ref val8)).normalized; } Quaternion val10 = Quaternion.LookRotation(val9, Vector3.up); GameObject val11 = null; string text3 = BotAccess.PrefabResourcePath(val5); GameObject val12 = BotAccess.PrefabObject(val5); if (SemiFunc.IsMultiplayer() && !string.IsNullOrEmpty(text3)) { try { val11 = PhotonNetwork.InstantiateRoomObject(text3, val7, val10, (byte)0, (object[])null); } catch { val11 = null; } } if (!Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val12)) { val11 = Object.Instantiate(val12, val7, val10); } if (Object.op_Implicit((Object)(object)val11)) { _handgun = val11.GetComponent() ?? val11.GetComponentInChildren(true); _handgunAttributes = val11.GetComponent() ?? val11.GetComponentInChildren(true); _handgunGrabObject = val11.GetComponent() ?? val11.GetComponentInChildren(true); _handgunRigidbody = val11.GetComponent() ?? val11.GetComponentInChildren(true); _handgunColliders.Clear(); val11.GetComponentsInChildren(true, _handgunColliders); } if (!Object.op_Implicit((Object)(object)_handgun)) { return false; } _handgunInstanceName = text2; BotAccess.SetItemName(BotAccess.PunManagerInstance(), text2, _handgunAttributes, BotAccess.PhotonViewId((Component)(object)_handgunAttributes)); BotAccess.RequestEquip(val11.GetComponent() ?? val11.GetComponentInChildren(true), num, BotAccess.PhotonViewId((Component)(object)val6)); KeepHandgunCharged(); UpdateGunHold(active: false); return true; } private void ReserveInventorySpot(StatsManager stats, PunManager pun, string steamId, string instanceName, int spot) { string dictionaryName = spot switch { 1 => "playerInventorySpot2", 0 => "playerInventorySpot1", _ => "playerInventorySpot3", }; int hashCode = instanceName.GetHashCode(); BotAccess.DictionaryUpdateValue(stats, dictionaryName, steamId, hashCode); BotAccess.UpdateStat(pun, dictionaryName, steamId, hashCode); BotAccess.InventorySpotTaken(stats, spot)?.Remove(steamId); } private Item FindHandgunItem(StatsManager stats) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 Dictionary dictionary = BotAccess.ItemDictionary(stats); if (dictionary == null) { return null; } foreach (KeyValuePair item in dictionary) { Item value = item.Value; if (Object.op_Implicit((Object)(object)value) && !BotAccess.ItemDisabled(value) && (int)BotAccess.ItemType(value) == 9) { string obj = item.Key ?? string.Empty; string text = BotAccess.ItemDisplayName(value); string text2 = ((Object)value).name ?? string.Empty; if (obj.IndexOf("handgun", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("handgun", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("handgun", StringComparison.OrdinalIgnoreCase) >= 0) { return value; } } } foreach (KeyValuePair item2 in dictionary) { Item value2 = item2.Value; if (Object.op_Implicit((Object)(object)value2) && !BotAccess.ItemDisabled(value2) && (int)BotAccess.ItemType(value2) == 9) { return value2; } } return null; } private int FindFreeInventorySpot(Inventory inventory) { List allInventorySpots = BotAccess.GetAllInventorySpots(inventory); for (int i = 0; i < allInventorySpots.Count && i < 3; i++) { InventorySpot val = allInventorySpots[i]; if (Object.op_Implicit((Object)(object)val) && !BotAccess.IsInventorySpotOccupied(val)) { return i; } } return -1; } private string PredictNextInstanceName(string itemName) { int num = 1; Dictionary dictionary = BotAccess.ItemInstances(BotAccess.StatsManagerInstance()); if (dictionary == null) { return itemName + "/" + num; } foreach (string key in dictionary.Keys) { if (!string.IsNullOrEmpty(key) && key.Contains("/")) { string[] array = key.Split('/'); if (array.Length == 2 && !(array[0] != itemName) && int.TryParse(array[1], out var result) && result >= num) { num = result + 1; } } } return itemName + "/" + num; } private void KeepHandgunCharged() { StatsManager val = BotAccess.StatsManagerInstance(); if (Object.op_Implicit((Object)(object)_handgunAttributes)) { string text = BotAccess.ItemInstanceName(_handgunAttributes); if (!string.IsNullOrEmpty(text)) { _handgunInstanceName = text; } } if (!string.IsNullOrEmpty(_handgunInstanceName) && Object.op_Implicit((Object)(object)val)) { BotAccess.SetBatteryLevel(val, _handgunInstanceName, 100); } if (Object.op_Implicit((Object)(object)_handgun)) { BotAccess.TuneBotGun(_handgun); ItemBattery val2 = BotAccess.GunBattery(_handgun); if (!Object.op_Implicit((Object)(object)val2)) { val2 = ((Component)_handgun).GetComponent(); } if (Object.op_Implicit((Object)(object)val2)) { BotAccess.SetBattery(val2, 100f, BotAccess.BatteryBars(val2)); } } } private void UpdateGunHold(bool active) { //IL_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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 (!Object.op_Implicit((Object)(object)_handgun) || !Object.op_Implicit((Object)(object)_gunHoldPoint)) { return; } Transform val = (Object.op_Implicit((Object)(object)_brain.CamTr) ? _brain.CamTr : ((Component)_brain).transform); _gunHoldPoint.position = val.position + val.forward * 0.45f + val.right * 0.25f - val.up * 0.18f; _gunHoldPoint.rotation = val.rotation; if ((Object)(object)((Component)_handgun).transform.parent != (Object)(object)_gunHoldPoint) { ((Component)_handgun).transform.SetParent(_gunHoldPoint, true); } ((Component)_handgun).transform.localPosition = (Vector3)(active ? Vector3.zero : new Vector3(0f, -0.35f, -0.25f)); ((Component)_handgun).transform.localRotation = Quaternion.identity; if (Object.op_Implicit((Object)(object)_handgunRigidbody)) { if (!_handgunRigidbody.isKinematic) { _handgunRigidbody.velocity = Vector3.zero; _handgunRigidbody.angularVelocity = Vector3.zero; } _handgunRigidbody.isKinematic = true; } for (int i = 0; i < _handgunColliders.Count; i++) { Collider val2 = _handgunColliders[i]; if (Object.op_Implicit((Object)(object)val2)) { val2.enabled = active; } } } private void TakeOutHandgun() { UpdateGunHold(active: true); PhysGrabber grabber = _brain.CarryController.Grabber; PhysGrabObject val = BotAccess.GrabbedPhysObject(grabber); if (Object.op_Implicit((Object)(object)val) && (Object)(object)val == (Object)(object)_handgunGrabObject) { BotAccess.ReleaseGrab(grabber, val, 0.1f); } } private void TryHoldHandgun() { if (Object.op_Implicit((Object)(object)_handgun)) { TakeOutHandgun(); } } private Enemy FindTarget() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) _scanTimer -= Time.deltaTime; if (_scanTimer > 0f) { return null; } _scanTimer = 0.2f; if (!Object.op_Implicit((Object)(object)EnemyDirector.instance)) { return null; } Enemy val = null; Enemy val2 = null; float num = float.PositiveInfinity; float num2 = float.PositiveInfinity; List list = BotAccess.EnemiesSpawned(); for (int i = 0; i < list.Count; i++) { EnemyParent val3 = list[i]; if ((Object)(object)val3 == (Object)null || !BotAccess.EnemyParentSpawned(val3)) { continue; } Enemy val4 = BotAccess.EnemyFromParent(val3); if (!Object.op_Implicit((Object)(object)val4) || !IsValidTarget(val4) || IsHiddenTargetCoolingDown(val4)) { continue; } Vector3 aimPosition = GetAimPosition(val4); float num3 = Vector3.Distance(((Component)_brain).transform.position, aimPosition); if (num3 > 16f) { continue; } if (HasLineOfSight(val4, aimPosition)) { if (num3 < num) { val = val4; num = num3; } } else if (num3 <= 8.5f && num3 < num2) { val2 = val4; num2 = num3; } } Enemy val5 = (Object.op_Implicit((Object)(object)val) ? val : val2); if (Object.op_Implicit((Object)(object)val5)) { PlayerIsBotComplete.DebugLog("Combat target=" + ((Object)val5).name + " visible=" + ((Object)(object)val5 == (Object)(object)val)); } return val5; } private bool IsValidTarget(Enemy enemy) { if (!Object.op_Implicit((Object)(object)enemy) || !((Component)enemy).gameObject.activeInHierarchy) { return false; } EnemyHealth val = BotAccess.EnemyHealth(enemy); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)enemy.CenterTransform)) { return !BotAccess.EnemyHealthDead(val); } return false; } private Vector3 GetAimPosition(Enemy enemy) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0068: 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_008d: 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_00a3: Unknown result type (might be due to invalid IL or missing references) if (TryGetBirthdayBoyAimPosition(enemy, out var aimPosition)) { return aimPosition; } Vector3 origin = (Object.op_Implicit((Object)(object)_brain.CamTr) ? _brain.CamTr.position : ((Component)_brain).transform.position); if (TryGetHittableAimPosition(enemy, origin, out var aimPosition2)) { return aimPosition2; } if (TryGetEnemyColliderBounds(enemy, out var bounds)) { Vector3 center = ((Bounds)(ref bounds)).center; center.y = Mathf.Lerp(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y, 0.6f); return center; } if (!Object.op_Implicit((Object)(object)enemy.CenterTransform)) { return ((Component)enemy).transform.position; } return enemy.CenterTransform.position; } private bool TryGetHittableAimPosition(Enemy enemy, Vector3 origin, out Vector3 aimPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) aimPosition = Vector3.zero; if (!Object.op_Implicit((Object)(object)enemy)) { return false; } _enemyColliders.Clear(); ((Component)enemy).GetComponentsInChildren(true, _enemyColliders); int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" }); Collider val = null; float num2 = float.PositiveInfinity; Vector3 val2 = Vector3.zero; RaycastHit val8 = default(RaycastHit); for (int i = 0; i < _enemyColliders.Count; i++) { Collider val3 = _enemyColliders[i]; if (!IsUsableCollider(val3) || val3.isTrigger) { continue; } Bounds bounds = val3.bounds; Vector3 val4 = ((Bounds)(ref bounds)).size; if (((Vector3)(ref val4)).sqrMagnitude < 0.0004f) { continue; } Vector3 center = ((Bounds)(ref bounds)).center; center.y = Mathf.Lerp(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y, 0.6f); Vector3 val5 = val3.ClosestPoint(origin); Vector3 val6 = center; float num3 = Vector3.Distance(val5, center); val4 = ((Bounds)(ref bounds)).extents; if (num3 > ((Vector3)(ref val4)).magnitude * 0.5f) { val6 = Vector3.Lerp(center, val5, 0.35f); } Vector3 val7 = val6 - origin; float magnitude = ((Vector3)(ref val7)).magnitude; if (magnitude <= 0.05f) { aimPosition = val6; return true; } if (Physics.Raycast(origin, val7 / magnitude, ref val8, magnitude + 0.2f, num, (QueryTriggerInteraction)1) && ColliderBelongsToEnemy(((RaycastHit)(ref val8)).collider, enemy)) { float num4 = magnitude + Vector3.Distance(((RaycastHit)(ref val8)).point, val6) * 0.25f; if (num4 < num2) { num2 = num4; val = val3; val2 = val6; } } } if ((Object)(object)val == (Object)null) { return false; } aimPosition = val2; return true; } private static bool ColliderBelongsToEnemy(Collider col, Enemy enemy) { if (!Object.op_Implicit((Object)(object)col) || !Object.op_Implicit((Object)(object)enemy)) { return false; } if ((Object)(object)((Component)col).GetComponentInParent() == (Object)(object)enemy) { return true; } EnemyRigidbody componentInParent = ((Component)col).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { return (Object)(object)componentInParent.enemy == (Object)(object)enemy; } return false; } private bool TryGetBirthdayBoyAimPosition(Enemy enemy, out Vector3 aimPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0057: 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_0068: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) aimPosition = Vector3.zero; EnemyBirthdayBoy birthdayBoy = GetBirthdayBoy(enemy); if (!Object.op_Implicit((Object)(object)birthdayBoy)) { return false; } CapsuleCollider val = null; if (IsUsableCollider((Collider)(object)birthdayBoy.colliderSmall)) { val = birthdayBoy.colliderSmall; } else if (IsUsableCollider((Collider)(object)birthdayBoy.BBcollider)) { val = birthdayBoy.BBcollider; } if (Object.op_Implicit((Object)(object)val)) { Bounds bounds = ((Collider)val).bounds; aimPosition = ((Bounds)(ref bounds)).center; aimPosition.y = Mathf.Lerp(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y, 0.56f); return true; } if (TryGetEnemyColliderBounds(enemy, out var bounds2)) { aimPosition = ((Bounds)(ref bounds2)).center; aimPosition.y = Mathf.Lerp(((Bounds)(ref bounds2)).min.y, ((Bounds)(ref bounds2)).max.y, 0.56f); return true; } if (Object.op_Implicit((Object)(object)birthdayBoy.headPivot) && Object.op_Implicit((Object)(object)enemy.CenterTransform)) { aimPosition = Vector3.Lerp(enemy.CenterTransform.position, birthdayBoy.headPivot.position, 0.35f); return true; } return false; } private EnemyBirthdayBoy GetBirthdayBoy(Enemy enemy) { if (!Object.op_Implicit((Object)(object)enemy)) { return null; } EnemyBirthdayBoy val = ((Component)enemy).GetComponent(); if (!Object.op_Implicit((Object)(object)val)) { val = ((Component)enemy).GetComponentInChildren(true); } if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)enemy.EnemyParent)) { val = ((Component)enemy.EnemyParent).GetComponentInChildren(true); } if (!Object.op_Implicit((Object)(object)val) && ((Object)enemy).name.IndexOf("Birthday", StringComparison.OrdinalIgnoreCase) >= 0) { val = ((Component)enemy).GetComponentInParent(); } return val; } private bool TryGetEnemyColliderBounds(Enemy enemy, out Bounds bounds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); if (!Object.op_Implicit((Object)(object)enemy)) { return false; } _enemyColliders.Clear(); ((Component)enemy).GetComponentsInChildren(true, _enemyColliders); bool flag = false; for (int i = 0; i < _enemyColliders.Count; i++) { Collider val = _enemyColliders[i]; if (IsUsableCollider(val) && !val.isTrigger) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } return flag; } private static bool IsUsableCollider(Collider col) { if (Object.op_Implicit((Object)(object)col) && col.enabled) { return ((Component)col).gameObject.activeInHierarchy; } return false; } private bool HasLineOfSight(Enemy enemy, Vector3 aimPosition) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_brain.CamTr)) { return false; } return HasLineOfSightFrom(_brain.CamTr.position, enemy, aimPosition); } private bool HasLineOfSightFrom(Vector3 origin, Enemy enemy, Vector3 aimPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = aimPosition - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.1f) { return true; } int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" }); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(origin, ((Vector3)(ref val)).normalized, ref val2, magnitude, num, (QueryTriggerInteraction)1)) { return true; } if ((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent() == (Object)(object)enemy) { return true; } EnemyRigidbody componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { return (Object)(object)componentInParent.enemy == (Object)(object)enemy; } return false; } private bool TryRepositionForShot(Vector3 aimPosition) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) _repositionTimer -= Time.deltaTime; float distance; bool flag = _brain.Navigation.HasCompletePath() && _brain.Navigation.TryGetRemainingDistance(out distance) && distance > 0.75f; if (_repositionTimer > 0f && flag) { return true; } _repositionTimer = 0.65f; Vector3 val = (aimPosition - ((Component)_brain).transform.position).WithY(0f); if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = ((Component)_brain).transform.forward.WithY(0f); } if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; float[] array = new float[3] { 1.75f, 3f, 4.25f }; foreach (float num in array) { for (int j = -1; j <= 1; j += 2) { Vector3 val3 = ((Component)_brain).transform.position + normalized * (float)j * num - val * 0.65f; if (HasLineOfSightFrom(val3 + Vector3.up * 1.35f, _target, aimPosition) && _brain.Navigation.SetDestination(val3)) { return true; } } } for (int k = -1; k <= 1; k += 2) { Vector3 destination = ((Component)_brain).transform.position + normalized * (float)k * 2f - val * 1.25f; if (_brain.Navigation.SetDestination(destination)) { return true; } } _brain.Navigation.Agent.ResetPath(); return false; } private bool IsHiddenTargetCoolingDown(Enemy enemy) { int instanceID = ((Object)enemy).GetInstanceID(); if (!_hiddenTargetCooldowns.TryGetValue(instanceID, out var value)) { return false; } if (Time.time < value) { return true; } _hiddenTargetCooldowns.Remove(instanceID); return false; } private void SuppressHiddenTarget(Enemy enemy, string reason, float cooldown = 10f) { if (Object.op_Implicit((Object)(object)enemy)) { _hiddenTargetCooldowns[((Object)enemy).GetInstanceID()] = Time.time + cooldown; PlayerIsBotComplete.DebugLog("Combat suppress target=" + ((Object)enemy).name + " reason=" + reason); } } private bool IsAimedAt(Vector3 aimPosition) { //IL_0014: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!Object.op_Implicit((Object)(object)_brain.CamTr)) { return false; } Vector3 val = aimPosition - _brain.CamTr.position; Vector3 normalized = ((Vector3)(ref val)).normalized; return Vector3.Angle(_brain.CamTr.forward, normalized) <= 10f; } private void FireAtTarget(Enemy enemy, Vector3 aimPosition) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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) if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)_handgun)) { return; } Transform val = BotAccess.GunMuzzle(_handgun); if (!Object.op_Implicit((Object)(object)val)) { return; } Vector3 val2 = aimPosition; if (!TryGetHittableAimPosition(enemy, val.position, out var aimPosition2)) { if (TryGetEnemyColliderBounds(enemy, out var bounds)) { val2 = ((Bounds)(ref bounds)).center; val2.y = Mathf.Lerp(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y, 0.6f); } } else { val2 = aimPosition2; } Vector3 val3 = val2 - val.position; if (!(((Vector3)(ref val3)).sqrMagnitude < 0.001f)) { ((Vector3)(ref val3)).Normalize(); ((Component)_handgun).transform.rotation = Quaternion.FromToRotation(val.forward, val3) * ((Component)_handgun).transform.rotation; KeepHandgunCharged(); if (_handgun.Shoot()) { _brain.SetDebugStatus("Shooting enemy..."); } } } } public class PlayerBotExtractionController { private PlayerBotBrain _brain; private int _lastActivateId; private float _lastActivateTime; private float _activationTimer; public const float ActivationSettleDelay = 3f; private int _selfActivatedExtractorId; private float _selfActivatedAt; public float ActivationGraceUntil { get; private set; } public bool IsActivating { get; private set; } public PlayerBotExtractionController(PlayerBotBrain brain) { _brain = brain; } public void ResetGrace() { ActivationGraceUntil = 0f; _selfActivatedExtractorId = 0; _selfActivatedAt = 0f; } public bool IsSettlingActivation(ExtractionPoint ep) { if (!Object.op_Implicit((Object)(object)ep)) { return false; } if (_selfActivatedExtractorId != ((Object)ep).GetInstanceID()) { return false; } return Time.time - _selfActivatedAt < 3f; } public void Update() { if (IsActivating) { _activationTimer += Time.deltaTime; if (_activationTimer > 3f) { IsActivating = false; _activationTimer = 0f; } } } public bool IsDeliveryDropAllowed(ExtractionPoint targetEP) { try { RoundDirector val = BotAccess.RoundDirector(); if (Object.op_Implicit((Object)(object)val)) { if (BotAccess.AllExtractionsCompleted(val)) { return true; } if ((Object)(object)targetEP == (Object)null) { return false; } return BotAccess.ExtractionPointActive(val) && (Object)(object)BotAccess.CurrentExtractionPoint(val) == (Object)(object)targetEP; } } catch { } return true; } public void StartActivation(ExtractionPoint ep) { if (Object.op_Implicit((Object)(object)ep)) { int instanceID = ((Object)ep).GetInstanceID(); if (_lastActivateId != instanceID || !(Time.time - _lastActivateTime < 0.75f)) { _lastActivateId = instanceID; _lastActivateTime = Time.time; ActivationGraceUntil = Time.time + 2f; IsActivating = true; _activationTimer = 0f; _selfActivatedExtractorId = instanceID; _selfActivatedAt = Time.time; } } } public void CancelActivation() { IsActivating = false; _activationTimer = 0f; } } public class PlayerBotLootScanner { private PlayerBotBrain _brain; private HashSet _permanentIgnoreIds = new HashSet(); private Dictionary _tempIgnoreIds = new Dictionary(); private float _scanTimer; public PlayerBotLootScanner(PlayerBotBrain brain) { _brain = brain; } public void IgnorePermanent(int id) { _permanentIgnoreIds.Add(id); } public void IgnoreTemp(int id, float duration) { _tempIgnoreIds[id] = Time.time + duration; } public void Reset() { _permanentIgnoreIds.Clear(); _tempIgnoreIds.Clear(); _scanTimer = 0f; } public void UpdateTimers() { List list = new List(); foreach (KeyValuePair tempIgnoreId in _tempIgnoreIds) { if (Time.time > tempIgnoreId.Value) { list.Add(tempIgnoreId.Key); } } foreach (int item in list) { _tempIgnoreIds.Remove(item); } } public PhysGrabObject ScanForLoot(Vector3 scanOrigin, Vector3 defaultDropZone) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) _scanTimer -= Time.deltaTime; if (_scanTimer > 0f) { return null; } _scanTimer = 0.5f; return FindLoot(scanOrigin, defaultDropZone); } private PhysGrabObject FindLoot(Vector3 origin, Vector3 defaultDropZone) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(origin, 20f); float num = 999f; PhysGrabObject result = null; Vector3 val = defaultDropZone; RoundDirector val2 = BotAccess.RoundDirector(); ExtractionPoint val3 = (Object.op_Implicit((Object)(object)val2) ? BotAccess.CurrentExtractionPoint(val2) : null); if (Object.op_Implicit((Object)(object)val2) && BotAccess.ExtractionPointActive(val2) && Object.op_Implicit((Object)(object)val3)) { val = ((Component)val3).transform.position; } Collider[] array2 = array; for (int i = 0; i < array2.Length; i++) { ValuableObject componentInParent = ((Component)array2[i]).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)componentInParent)) { continue; } PhysGrabObject component = ((Component)componentInParent).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { continue; } int instanceID = ((Object)component).GetInstanceID(); if (!SemiFunc.PhysGrabObjectIsGrabbed(component) && !_permanentIgnoreIds.Contains(instanceID) && !_tempIgnoreIds.ContainsKey(instanceID) && !(Vector3.Distance(((Component)component).transform.position, val) < 4f)) { float num2 = Vector3.Distance(origin, ((Component)component).transform.position); if (num2 < num) { num = num2; result = component; } } } return result; } } public class PlayerBotNavigation { private PlayerBotBrain _brain; private List _globalPoints = new List(); private readonly NavMeshPath _path = new NavMeshPath(); private bool _haveGlobal; private float _stuckTimer; private Vector3 _lastPos; private float _strafeDir = 1f; private Vector3 _lastDestination; private bool _hasLastDestination; private float _blockedTimer; private float _jumpCooldown; private readonly RaycastHit[] _hitBuffer = (RaycastHit[])(object)new RaycastHit[8]; public NavMeshAgent Agent { get; private set; } public Vector3 SpawnTruckPos { get; private set; } public float StuckTimer => _stuckTimer; public PlayerBotNavigation(PlayerBotBrain brain) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown _brain = brain; Agent = ((Component)brain).gameObject.AddComponent(); Agent.updatePosition = false; Agent.updateRotation = false; Agent.updateUpAxis = false; Agent.radius = 0.5f; Agent.height = 1.8f; Agent.speed = 0f; Agent.acceleration = 9999f; Agent.autoBraking = true; } public bool TryPlaceOnNavMesh(Vector3 desired) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return TryPlaceOnNavMesh(desired, 10f); } public bool TryPlaceOnNavMesh(Vector3 desired, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(desired, ref val, radius, -1)) { return Agent.Warp(((NavMeshHit)(ref val)).position); } return false; } public void ResetRuntime() { //IL_001e: 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_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) _globalPoints.Clear(); _haveGlobal = false; SpawnTruckPos = ((Component)_brain).transform.position; _stuckTimer = 0f; _lastPos = ((Component)_brain).transform.position; _strafeDir = 1f; _lastDestination = Vector3.zero; _hasLastDestination = false; _blockedTimer = 0f; _jumpCooldown = 0f; if ((Object)(object)Agent != (Object)null && ((Behaviour)Agent).enabled && Agent.isOnNavMesh) { Agent.ResetPath(); } } public void BuildGlobalTargets() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) _globalPoints.Clear(); SpawnTruckPos = ((Component)_brain).transform.position; try { if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.LevelPathPoints != null) { foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints) { if (Object.op_Implicit((Object)(object)levelPathPoint)) { _globalPoints.Add(((Component)levelPathPoint).transform.position); if (Object.op_Implicit((Object)(object)levelPathPoint.Room) && levelPathPoint.Room.Truck) { SpawnTruckPos = ((Component)levelPathPoint).transform.position; } } } } } catch { } if (_globalPoints.Count == 0) { try { Vector3[] vertices = NavMesh.CalculateTriangulation().vertices; int num = Mathf.Max(1, vertices.Length / 64); NavMeshHit val = default(NavMeshHit); for (int i = 0; i < vertices.Length; i += num) { if (NavMesh.SamplePosition(vertices[i], ref val, 3f, -1)) { _globalPoints.Add(((NavMeshHit)(ref val)).position); } } } catch { } } _haveGlobal = _globalPoints.Count > 0; } public void PickWanderDest() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) for (int i = 0; i < 8; i++) { Vector3 destination = ((!_haveGlobal) ? (((Component)_brain).transform.position + Random.insideUnitSphere.WithY(0f) * 15f) : _globalPoints[Random.Range(0, _globalPoints.Count)]); if (SetDestination(destination)) { return; } } Agent.ResetPath(); _hasLastDestination = false; } public Vector3 GetTruckDestination() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Vector3 result = SpawnTruckPos; try { if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.LevelPathPoints != null) { foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints) { if (Object.op_Implicit((Object)(object)levelPathPoint) && Object.op_Implicit((Object)(object)levelPathPoint.Room) && levelPathPoint.Room.Truck) { result = ((Component)levelPathPoint).transform.position; break; } } } } catch { } return result; } public bool TryGetTruckScreenDestination(out Vector3 destination, out Vector3 screenPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00c5: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) destination = GetTruckDestination(); screenPosition = destination; TruckScreenText val = BotAccess.TruckScreen(); if (!Object.op_Implicit((Object)(object)val)) { return false; } GameObject val2 = BotAccess.TruckScreenStaticGrabCollider(val); Transform val3 = (Object.op_Implicit((Object)(object)val2) ? val2.transform : ((Component)val).transform); screenPosition = val3.position; Vector3 val4 = -val3.forward.WithY(0f); if (((Vector3)(ref val4)).sqrMagnitude < 0.001f) { val4 = (GetTruckDestination() - screenPosition).WithY(0f); } if (((Vector3)(ref val4)).sqrMagnitude < 0.001f) { val4 = (((Component)_brain).transform.position - screenPosition).WithY(0f); } if (((Vector3)(ref val4)).sqrMagnitude < 0.001f) { val4 = -((Component)_brain).transform.forward.WithY(0f); } ((Vector3)(ref val4)).Normalize(); Vector3 val5 = screenPosition; float num = float.PositiveInfinity; NavMeshHit val7 = default(NavMeshHit); for (int i = -3; i <= 3; i++) { float num2 = (float)i * 22.5f; Vector3 val6 = Quaternion.Euler(0f, num2, 0f) * val4; for (int j = 0; j < 5; j++) { float num3 = 1.15f + (float)j * 0.3f; if (NavMesh.SamplePosition(screenPosition.WithY(((Component)_brain).transform.position.y) + val6 * num3, ref val7, 2.5f, -1)) { float num4 = Vector3.Distance(((NavMeshHit)(ref val7)).position.WithY(0f), screenPosition.WithY(0f)); float num5 = Vector3.Distance(((NavMeshHit)(ref val7)).position, ((Component)_brain).transform.position) + Mathf.Abs(num4 - 1.6f) * 2f + Mathf.Abs(num2) * 0.02f; if (num5 < num) { num = num5; val5 = ((NavMeshHit)(ref val7)).position; } } } } if (float.IsPositiveInfinity(num)) { NavMeshHit val8 = default(NavMeshHit); if (!NavMesh.SamplePosition(screenPosition.WithY(((Component)_brain).transform.position.y) + val4 * 1.6f, ref val8, 3f, -1)) { return false; } destination = ((NavMeshHit)(ref val8)).position; return true; } destination = val5; return true; } public bool SetDestination(Vector3 target) { //IL_002a: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Agent == (Object)null || !((Behaviour)Agent).enabled || !Agent.isOnNavMesh) { return false; } NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(target, ref val, 3f, -1)) { return false; } if (!Agent.CalculatePath(((NavMeshHit)(ref val)).position, _path) || (int)_path.status != 0) { return false; } bool num = Agent.SetPath(_path); if (num) { _lastDestination = ((NavMeshHit)(ref val)).position; _hasLastDestination = true; } return num; } public bool HasCompletePath() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 if ((Object)(object)Agent != (Object)null && ((Behaviour)Agent).enabled && Agent.isOnNavMesh && Agent.hasPath && !Agent.pathPending) { return (int)Agent.pathStatus == 0; } return false; } public bool TryGetRemainingDistance(out float distance) { distance = 0f; if ((Object)(object)Agent == (Object)null || !((Behaviour)Agent).enabled || !Agent.isOnNavMesh) { return false; } distance = Agent.remainingDistance; if (IsFinite(distance)) { return true; } return TryGetCalculatedPathDistance(out distance); } public float RemainingDistanceForDebug() { if ((Object)(object)Agent == (Object)null || !((Behaviour)Agent).enabled || !Agent.isOnNavMesh) { return 0f; } float distance = Agent.remainingDistance; if (IsFinite(distance)) { return distance; } if (!TryGetCalculatedPathDistance(out distance)) { return float.PositiveInfinity; } return distance; } public bool TryGetMoveDirection(out Vector3 direction) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) direction = GetMoveDirection(); if (((Vector3)(ref direction)).sqrMagnitude < 0.001f) { return false; } ((Vector3)(ref direction)).Normalize(); return true; } public void ResetStuckTimer() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) _stuckTimer = 0f; _lastPos = ((Component)_brain).transform.position; } private bool TryGetCalculatedPathDistance(out float distance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00f6: Unknown result type (might be due to invalid IL or missing references) distance = 0f; if (!HasCompletePath()) { return false; } Vector3 v = ((Component)_brain).transform.position; Vector3[] corners = Agent.path.corners; if (corners == null || corners.Length == 0) { if (!_hasLastDestination) { return false; } distance = Vector3.Distance(v.WithY(0f), _lastDestination.WithY(0f)); return IsFinite(distance); } foreach (Vector3 val in corners) { if (IsFinite(val)) { distance += Vector3.Distance(v.WithY(0f), val.WithY(0f)); v = val; } } if (_hasLastDestination && Vector3.Distance(v.WithY(0f), _lastDestination.WithY(0f)) > 0.25f) { distance += Vector3.Distance(v.WithY(0f), _lastDestination.WithY(0f)); } return IsFinite(distance); } private static bool IsFinite(float value) { if (!float.IsNaN(value)) { return !float.IsInfinity(value); } return false; } private static bool IsFinite(Vector3 value) { //IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references) if (IsFinite(value.x) && IsFinite(value.y)) { return IsFinite(value.z); } return false; } public bool TrySetDestinationNear(Vector3 target, float minRadius, float maxRadius, out Vector3 chosen) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) chosen = target; if (SetDestination(target)) { return true; } return TrySetAlternateDestinationNear(target, minRadius, maxRadius, out chosen); } public bool TrySetAlternateDestinationNear(Vector3 target, float minRadius, float maxRadius, out Vector3 chosen) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_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_0061: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) chosen = target; int num = 5; int num2 = 12; for (int i = 0; i < num; i++) { float num3 = Mathf.Lerp(minRadius, maxRadius, (num == 1) ? 1f : ((float)i / (float)(num - 1))); for (int j = 0; j < num2; j++) { float num4 = (float)j * (360f / (float)num2); Vector3 val = Quaternion.Euler(0f, num4, 0f) * Vector3.forward * num3; Vector3 val2 = target + val; if (SetDestination(val2)) { chosen = val2; return true; } } } return false; } public bool TrySetRecoveryDestination(out Vector3 chosen) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) chosen = ((Component)_brain).transform.position; Vector3 position = ((Component)_brain).transform.position; int num = 16; NavMeshHit val = default(NavMeshHit); for (int i = 0; i < 4; i++) { float num2 = 1.5f + (float)i * 1.25f; for (int j = 0; j < num; j++) { float num3 = (float)j * (360f / (float)num); if (NavMesh.SamplePosition(position + Quaternion.Euler(0f, num3, 0f) * Vector3.forward * num2, ref val, 1.5f, -1) && !(Vector3.Distance(((NavMeshHit)(ref val)).position.WithY(0f), position.WithY(0f)) < 1f) && SetDestination(((NavMeshHit)(ref val)).position)) { chosen = ((NavMeshHit)(ref val)).position; return true; } } } return false; } public bool TrySetCloserDestinationNear(Vector3 target, float currentTargetDistance, float minRadius, float maxRadius, out Vector3 chosen) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_008b: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0141: 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_0164: Unknown result type (might be due to invalid IL or missing references) chosen = target; if ((Object)(object)Agent == (Object)null || !((Behaviour)Agent).enabled || !Agent.isOnNavMesh) { return false; } bool flag = false; float num = float.PositiveInfinity; Vector3 val = target; int num2 = 7; int num3 = 16; NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < num2; i++) { float num4 = Mathf.Lerp(minRadius, maxRadius, (num2 == 1) ? 1f : ((float)i / (float)(num2 - 1))); for (int j = 0; j < num3; j++) { float num5 = (float)j * (360f / (float)num3); if (!NavMesh.SamplePosition(target + Quaternion.Euler(0f, num5, 0f) * Vector3.forward * num4, ref val2, 2f, -1)) { continue; } float num6 = Vector3.Distance(((NavMeshHit)(ref val2)).position.WithY(0f), target.WithY(0f)); float num7 = Vector3.Distance(((NavMeshHit)(ref val2)).position.WithY(0f), ((Component)_brain).transform.position.WithY(0f)); if (!(num6 >= currentTargetDistance - 0.35f) && !(num7 < 0.8f) && Agent.CalculatePath(((NavMeshHit)(ref val2)).position, _path) && (int)_path.status == 0) { float num8 = num6 + num7 * 0.05f; if (num8 < num) { num = num8; val = ((NavMeshHit)(ref val2)).position; flag = true; } } } } if (!flag) { return false; } chosen = val; return SetDestination(val); } public void UpdateMovement() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_031c: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_0263: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) PlayerIsBotComplete.MoveInput = Vector2.zero; PlayerIsBotComplete.InputJump = false; Physics.Raycast(((Component)_brain).transform.position + Vector3.up, ((Component)_brain).transform.forward, 1.2f); bool flag = HasCompletePath(); float distance; bool flag2 = TryGetRemainingDistance(out distance); bool flag3 = _hasLastDestination && Vector3.Distance(((Component)_brain).transform.position.WithY(0f), _lastDestination.WithY(0f)) > Agent.stoppingDistance + 0.5f; bool flag4 = flag && ((flag2 && distance > 0.4f) || (!flag2 && flag3)); if (Agent.hasPath && !Agent.pathPending && (int)Agent.pathStatus != 0) { Agent.ResetPath(); _hasLastDestination = false; if (_brain.IsWanderingState) { PickWanderDest(); } return; } float num = Vector3.Distance(((Component)_brain).transform.position.WithY(0f), _lastPos.WithY(0f)); _lastPos = ((Component)_brain).transform.position; float num2 = num / Mathf.Max(Time.deltaTime, 0.0001f); _jumpCooldown -= Time.deltaTime; bool flag5 = false; if (flag4) { Vector3 moveDirection = GetMoveDirection(); if (((Vector3)(ref moveDirection)).sqrMagnitude > 0.001f) { ((Vector3)(ref moveDirection)).Normalize(); flag5 = Mathf.Abs(Vector3.SignedAngle(((Component)_brain).transform.forward, moveDirection, Vector3.up)) < 45f; } } bool flag6 = !flag && !Agent.pathPending && _hasLastDestination && flag3; if (num2 < 0.25f && (flag4 || flag6)) { _stuckTimer += Time.deltaTime; if (_stuckTimer > 0.5f && _stuckTimer <= 1.5f) { if (Time.frameCount % 20 == 0) { _strafeDir *= -1f; } PlayerIsBotComplete.MoveInput = (Vector2)(HasSafeForwardStep() ? new Vector2(_strafeDir * 0.35f, 0.75f) : Vector2.zero); } else if (_stuckTimer > 1.5f && _stuckTimer <= 2.5f) { PlayerIsBotComplete.MoveInput = (Vector2)(HasSafeForwardStep() ? new Vector2(0f, 0.65f) : Vector2.zero); } else if (_stuckTimer > 2.5f) { Agent.ResetPath(); _hasLastDestination = false; if (_brain.IsWanderingState) { PickWanderDest(); } _stuckTimer = 0f; return; } } else { _stuckTimer = 0f; } if (flag4 && _stuckTimer <= 0.5f) { Vector3 moveDirection2 = GetMoveDirection(); if (moveDirection2 != Vector3.zero) { ((Vector3)(ref moveDirection2)).Normalize(); if (!HasSafeForwardStep()) { if (_brain.IsWanderingState) { Agent.ResetPath(); _hasLastDestination = false; PickWanderDest(); } return; } float num3 = Vector3.SignedAngle(((Component)_brain).transform.forward, moveDirection2, Vector3.up); float num4 = ((Mathf.Abs(num3) < 60f) ? 1f : 0f); if (Mathf.Abs(num3) > 45f) { num4 = 0.5f; } PlayerIsBotComplete.MoveInput = new Vector2(0f, num4); } } bool num5 = flag4 && flag5 && num2 < 1.6f; bool flag7 = _stuckTimer > 1f; if (num5 || flag7) { _blockedTimer += Time.deltaTime; } else { _blockedTimer = 0f; } if (!(_blockedTimer > 0.35f) || !(_jumpCooldown <= 0f)) { return; } bool flag8 = _stuckTimer > 1.5f; if (flag8 || TryDetectJumpableObstacle()) { PlayerIsBotComplete.InputJump = true; _jumpCooldown = (flag8 ? 0.45f : 0.7f); _blockedTimer = 0f; Vector3 moveDirection3 = GetMoveDirection(); if (((Vector3)(ref moveDirection3)).sqrMagnitude > 0.001f) { ((Vector3)(ref moveDirection3)).Normalize(); float num6 = Mathf.Clamp(Vector3.SignedAngle(((Component)_brain).transform.forward, moveDirection3, Vector3.up) / 60f, -1f, 1f) * 0.4f; PlayerIsBotComplete.MoveInput = new Vector2(num6, 1f); } else { PlayerIsBotComplete.MoveInput = new Vector2(0f, 1f); } } } private bool TryDetectJumpableObstacle() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0061: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0130: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Agent == (Object)null || !Agent.isOnNavMesh) { return false; } Vector3 val = Agent.desiredVelocity.WithY(0f); if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = GetMoveDirection(); } if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = ((Component)_brain).transform.forward.WithY(0f); } if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { return false; } ((Vector3)(ref val)).Normalize(); Vector3 position = ((Component)_brain).transform.position; RaycastHit hitInfo; bool flag = SweepHit(position + Vector3.up * 0.35f, val, 1.1f, out hitInfo); RaycastHit hitInfo2; bool flag2 = SweepHit(position + Vector3.up * 0.9f, val, 1.1f, out hitInfo2); if (!flag && !flag2) { return false; } if (SweepHit(position + Vector3.up * 1.7f, val, 1.3000001f, out hitInfo2)) { return false; } float num; if (!flag) { num = position.y + 0.9f + 0.4f; } else { Bounds bounds = ((RaycastHit)(ref hitInfo)).collider.bounds; num = ((Bounds)(ref bounds)).max.y; } if (num - position.y > 1.4f) { return false; } NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(position + val * 1.6f + Vector3.up * 0.5f, ref val2, 1.5f, -1)) { Mathf.Abs(((NavMeshHit)(ref val2)).position.y - position.y); _ = 1.5f; return true; } return true; } private bool SweepHit(Vector3 origin, Vector3 direction, float distance, out RaycastHit hitInfo) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) hitInfo = default(RaycastHit); int num = ~LayerMask.GetMask(new string[3] { "Player", "Ignore Raycast", "PlayerTrigger" }); int num2 = Physics.RaycastNonAlloc(origin, direction, _hitBuffer, distance, num, (QueryTriggerInteraction)1); float num3 = float.PositiveInfinity; for (int i = 0; i < num2; i++) { RaycastHit val = _hitBuffer[i]; if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider) && !((Component)((RaycastHit)(ref val)).collider).transform.IsChildOf(((Component)_brain).transform) && ((RaycastHit)(ref val)).distance < num3) { num3 = ((RaycastHit)(ref val)).distance; hitInfo = val; } } return !float.IsPositiveInfinity(num3); } private bool HasSafeForwardStep(float distance = 0.75f) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0061: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) if ((Object)(object)Agent == (Object)null || !Agent.isOnNavMesh) { return false; } Vector3 val = Agent.desiredVelocity.WithY(0f); if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = GetMoveDirection(); } if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = ((Component)_brain).transform.forward.WithY(0f); } if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { return true; } ((Vector3)(ref val)).Normalize(); NavMeshHit val2 = default(NavMeshHit); if (!NavMesh.SamplePosition(((Component)_brain).transform.position + val * distance, ref val2, 1.5f, -1)) { return false; } if (((Component)_brain).transform.position.y - ((NavMeshHit)(ref val2)).position.y > 1.4f) { return false; } return true; } private Vector3 GetMoveDirection() { //IL_000b: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) Vector3 position = ((Component)_brain).transform.position; Vector3 result = Vector3.zero; if ((Object)(object)Agent != (Object)null && IsFinite(Agent.steeringTarget)) { result = (Agent.steeringTarget - position).WithY(0f); if (((Vector3)(ref result)).sqrMagnitude > 0.001f) { return result; } } Vector3[] array = (((Object)(object)Agent != (Object)null && Agent.hasPath) ? Agent.path.corners : null); if (array != null) { foreach (Vector3 val in array) { if (IsFinite(val)) { Vector3 result2 = (val - position).WithY(0f); if (((Vector3)(ref result2)).sqrMagnitude > 0.04f) { return result2; } } } } if (((Vector3)(ref result)).sqrMagnitude < 0.001f && _hasLastDestination) { result = (_lastDestination - position).WithY(0f); } return result; } } public class PlayerBotShopController { private readonly PlayerBotBrain _brain; private string _shopSceneKey; private bool _purchasedThisVisit; private bool _checkedOutThisVisit; private PhysGrabObject _targetUpgrade; private float _scanCooldown; private float _checkoutInteractTimer; private float _checkoutWaitUntil; public bool IsInShop { get { try { return SemiFunc.RunIsShop(); } catch { return false; } } } public bool ShouldPursueUpgrade { get { if (IsInShop) { return !_purchasedThisVisit; } return false; } } public bool ShouldCheckout { get { if (IsInShop && _purchasedThisVisit) { return !_checkedOutThisVisit; } return false; } } public PhysGrabObject CurrentUpgradeTarget => _targetUpgrade; public PlayerBotShopController(PlayerBotBrain brain) { _brain = brain; } public void ResetForNewScene(string sceneKey) { if (!(_shopSceneKey == sceneKey)) { _shopSceneKey = sceneKey; _purchasedThisVisit = false; _checkedOutThisVisit = false; _targetUpgrade = null; _scanCooldown = 0f; _checkoutInteractTimer = 0f; _checkoutWaitUntil = 0f; } } public void NotifyUpgradeDelivered() { _purchasedThisVisit = true; _targetUpgrade = null; _checkoutWaitUntil = Time.time + 1f; } public void ClearUpgradeTarget() { _targetUpgrade = null; } public PhysGrabObject FindAffordableUpgrade() { if (!ShouldPursueUpgrade) { return null; } if (Object.op_Implicit((Object)(object)_targetUpgrade) && IsValidShopTarget(_targetUpgrade)) { return _targetUpgrade; } _targetUpgrade = null; _scanCooldown -= Time.deltaTime; if (_scanCooldown > 0f) { return null; } _scanCooldown = 0.5f; ShopManager val = BotAccess.ShopManagerInstance(); if (!Object.op_Implicit((Object)(object)val)) { return null; } int num = BotAccess.ShopTotalCurrency(val); int num2 = BotAccess.ShopTotalCost(val); int num3 = num - num2; if (num3 <= 0) { return null; } ItemUpgrade[] array; try { array = Object.FindObjectsOfType(); } catch { return null; } PhysGrabObject targetUpgrade = null; int num4 = int.MaxValue; foreach (ItemUpgrade val2 in array) { if (!Object.op_Implicit((Object)(object)val2) || !val2.isPlayerUpgrade || val2.upgradeDone || !IsWantedUpgrade(((Component)val2).gameObject)) { continue; } ItemAttributes val3 = (Object.op_Implicit((Object)(object)val2.itemAttributes) ? val2.itemAttributes : ((Component)val2).GetComponent()); if (!Object.op_Implicit((Object)(object)val3)) { continue; } int num5 = BotAccess.ItemAttributesValue(val3); if (num5 > 0 && num5 <= num3) { PhysGrabObject val4 = (Object.op_Implicit((Object)(object)val2.physGrabObject) ? val2.physGrabObject : ((Component)val2).GetComponent()); if (Object.op_Implicit((Object)(object)val4) && ((Component)val4).gameObject.activeInHierarchy && !SemiFunc.PhysGrabObjectIsGrabbed(val4) && num5 < num4) { num4 = num5; targetUpgrade = val4; } } } _targetUpgrade = targetUpgrade; return _targetUpgrade; } public bool TryCheckout(ExtractionPoint shopEP) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 if (!ShouldCheckout || !Object.op_Implicit((Object)(object)shopEP)) { return false; } if (Time.time < _checkoutWaitUntil) { return false; } _checkoutInteractTimer += Time.deltaTime; BotAccess.ShopCheckout(shopEP); if ((int)shopEP.currentState != 2) { _checkedOutThisVisit = true; PlayerIsBotComplete.DebugLog("Shop checkout complete state=" + ((object)(State)(ref shopEP.currentState)).ToString()); return true; } if (_checkoutInteractTimer > 6f) { _checkedOutThisVisit = true; PlayerIsBotComplete.DebugLog("Shop checkout timeout, moving on"); return true; } return false; } private static bool IsValidShopTarget(PhysGrabObject pgo) { if (!Object.op_Implicit((Object)(object)pgo) || !((Component)pgo).gameObject.activeInHierarchy) { return false; } if (SemiFunc.PhysGrabObjectIsGrabbed(pgo)) { return false; } ItemUpgrade component = ((Component)pgo).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.isPlayerUpgrade) { return !component.upgradeDone; } return false; } private static bool IsWantedUpgrade(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return false; } if (!Object.op_Implicit((Object)(object)go.GetComponent()) && !Object.op_Implicit((Object)(object)go.GetComponent())) { return Object.op_Implicit((Object)(object)go.GetComponent()); } return true; } } [BepInPlugin("com.empress.repo.beabot", "Be A Bot", "4.5.0")] public class PlayerIsBotComplete : BaseUnityPlugin { public static PlayerIsBotComplete Instance; public static ManualLogSource Log; private Harmony _harmony; public static bool IsActive; public ConfigEntry BotEnabled; public ConfigEntry ShowOverlay; public ConfigEntry UseVanillaPhysGrab; public ConfigEntry CombatAssist; public ConfigEntry DebugLogging; public ConfigEntry ToggleShortcut; public static Vector2 MoveInput; public static Vector2 LookInput; public static bool InputJump; public static bool InputInteract; public static bool InputThrow; public static bool InputGrab; public static bool InputSprint; private void Awake() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Instance = this; Log = ((BaseUnityPlugin)this).Logger; BotEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Turns Be A Bot on or off."); ToggleShortcut = ((BaseUnityPlugin)this).Config.Bind("General", "ToggleShortcut", new KeyboardShortcut((KeyCode)289, Array.Empty()), "Keyboard shortcut that toggles Be A Bot."); ShowOverlay = ((BaseUnityPlugin)this).Config.Bind("General", "ShowOverlay", true, "Shows the small Be A Bot status overlay."); UseVanillaPhysGrab = ((BaseUnityPlugin)this).Config.Bind("Carry", "UseVanillaPhysGrab", true, "Uses the real player physgrabber instead of moving valuables directly."); CombatAssist = ((BaseUnityPlugin)this).Config.Bind("Safety", "CombatAssist", true, "Lets Be A Bot defend itself from nearby enemies."); DebugLogging = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugLogging", false, "Writes Be A Bot decision logs to BepInEx when enabled."); _harmony = new Harmony("com.empress.repo.beabot"); _harmony.PatchAll(); ((MonoBehaviour)this).StartCoroutine(WaitForPlayer()); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = ToggleShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { BotEnabled.Value = !BotEnabled.Value; if (!BotEnabled.Value) { ClearInputs(); IsActive = false; } } } public static bool CanRunOnThisPeer() { if ((Object)(object)Instance == (Object)null || !Instance.BotEnabled.Value) { return false; } if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { return true; } return false; } public static bool ShouldUseVanillaPhysGrab() { if (!((Object)(object)Instance == (Object)null)) { return Instance.UseVanillaPhysGrab.Value; } return true; } public static void DebugLog(string message) { if (!((Object)(object)Instance == (Object)null) && Instance.DebugLogging.Value && Log != null) { Log.LogInfo((object)("[Debug] " + message)); } } public static void ClearInputs() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000f: Unknown result type (might be due to invalid IL or missing references) MoveInput = Vector2.zero; LookInput = Vector2.zero; InputJump = false; InputInteract = false; InputThrow = false; InputGrab = false; InputSprint = false; } private IEnumerator WaitForPlayer() { while (true) { if ((Object)(object)PlayerController.instance != (Object)null && CanRunOnThisPeer() && (Object)(object)((Component)PlayerController.instance).gameObject.GetComponent() == (Object)null) { ((Component)PlayerController.instance).gameObject.AddComponent(); } yield return (object)new WaitForSeconds(1f); } } } public static class VectorExtensions { public static Vector3 WithY(this Vector3 v, float y) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) v.y = y; return v; } } }