using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using AIGraph; using AK; using Agents; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Hook; using BepInEx.Unity.IL2CPP.Utils; using BepInEx.Unity.IL2CPP.Utils.Collections; using BetterBots.Components; using BetterBots.Managers; using BotControl; using BotControl.CustomActions; using BotControl.CustomActions.CustomActions; using BotControl.CustomActions.Patches; using BotControl.Menus; using BotControl.Networking; using BotControl.Patches; using BotControl.SmartSelect; using BotControl.SmartSelect.PressActions; using BotControl.SmartSelect.PressActions.DoubleTapActions; using BotControl.SmartSelect.PressTypes; using CellMenu; using ChainedPuzzles; using CollisionRundown.Features.HUDs; using CullingSystem; using Enemies; using ExteriorRendering; using FluffyUnderware.DevTools.Extensions; using GTFO.API; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly; using Il2CppInterop.Runtime.Runtime.VersionSpecific.Class; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using LevelGeneration; using Localization; using Microsoft.CodeAnalysis; using Player; using PrioritySet; using SNetwork; using SlideDrum; using SlideDrum.sInputSystem; using SlideMenu; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("BotControl")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+gitd5013ac-dirty-dev.d5013acaeca679836731ad818ee8d06830e6585a")] [assembly: AssemblyProduct("BotControl")] [assembly: AssemblyTitle("BotControl")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal delegate void <>f__AnonymousDelegate0(T1 arg1, T2 arg2 = default(T2), T3 arg3 = default(T3)); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate1(T1 arg = default(T1)); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate2(T1 arg1, T2 arg2, T3 arg3 = 0.1f); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate3(T1 arg = true); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate4(T1 arg1, T2 arg2, T3 arg3 = false); [CompilerGenerated] internal delegate TResult <>f__AnonymousDelegate5(T1 arg1, T2 arg2 = 0uL); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate6(T1 arg1, T2 arg2 = false, T3 arg3 = default(T3)); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate7(T1 arg1, T2 arg2, T3 arg3 = default(T3), T4 arg4 = default(T4)); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate8(T1 arg1, T2 arg2, T3 arg3 = 10); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate9(T1 arg1 = default(T1), T2 arg2 = default(T2), T3 arg3 = 0uL, T4 arg4 = default(T4)); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate10(T1 arg1, T2 arg2, T3 arg3 = ""); [CompilerGenerated] internal delegate void <>f__AnonymousDelegate11(T1 arg1, T2 arg2 = default(T2)); namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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; } } } public static class CustomActionRegistry { private static readonly (Type ActionType, Func CreateDescriptor)[] Actions; static CustomActionRegistry() { Actions = (from t in typeof(CustomActionBase).Assembly.GetTypes() where t.IsClass && !t.IsAbstract && typeof(CustomActionBase).IsAssignableFrom(t) select (Action: t, Descriptor: t.GetNestedType("Descriptor", BindingFlags.Public | BindingFlags.NonPublic)) into pair where pair.Descriptor != null && typeof(CustomActionBase.Descriptor).IsAssignableFrom(pair.Descriptor) && !pair.Descriptor.IsAbstract select (Action: pair.Action, CreateDescriptorFactory(pair.Descriptor))).ToArray(); } private static Func CreateDescriptorFactory(Type descriptorType) { ConstructorInfo? constructor = descriptorType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(PlayerAIBot) }, null); if (constructor == null) { throw new InvalidOperationException("No (PlayerAIBot) constructor on " + descriptorType.FullName); } ParameterExpression parameterExpression = Expression.Parameter(typeof(PlayerAIBot), "bot"); return Expression.Lambda>(Expression.New(constructor, parameterExpression), new ParameterExpression[1] { parameterExpression }).Compile(); } public static void RegisterIl2CppTypes() { ClassInjector.RegisterTypeInIl2Cpp(typeof(CustomActionBase)); ClassInjector.RegisterTypeInIl2Cpp(typeof(CustomActionBase.Descriptor)); (Type, Func)[] actions = Actions; for (int i = 0; i < actions.Length; i++) { Type item = actions[i].Item1; ClassInjector.RegisterTypeInIl2Cpp(item); ClassInjector.RegisterTypeInIl2Cpp(item.GetNestedType("Descriptor", BindingFlags.Public | BindingFlags.NonPublic)); } } public static void Setup(PlayerAIBot bot) { if ((Object)(object)bot == (Object)null) { throw new ArgumentNullException("bot"); } dataStore orCreateData = zActions.GetOrCreateData(bot); (Type, Func)[] actions = Actions; for (int i = 0; i < actions.Length; i++) { CustomActionBase.Descriptor descriptor = actions[i].Item2(bot); if ((Object)(object)((Descriptor)descriptor).Bot == (Object)null) { ((Descriptor)descriptor).Bot = bot; } CustomActionBase customActionBase = (CustomActionBase)(object)((Descriptor)descriptor).CreateAction(); orCreateData.customActionDescriptors.Add(descriptor, (int?)null, (ConflictResolution?)null, (DuplicateValuePolicy?)null, (PlacementIndexBias?)null); orCreateData.customActionBases.Add(customActionBase, (int?)null, (ConflictResolution?)null, (DuplicateValuePolicy?)null, (PlacementIndexBias?)null); } } } [HarmonyPatch] public static class UnlockActionPatch { private static float s_hackSuccessChance = 0.25f; private static int s_hackMaxNrFaults = 3; private const uint LockMelterBackpackItemId = 116u; private const uint HackingToolBackpackItemId = 53u; private static bool useNewMethod = true; [HarmonyPatch(typeof(PlayerBotActionUnlock), "ChooseMethod")] [HarmonyPrefix] public static bool PreChooseMethod(PlayerBotActionUnlock __instance, ref bool __result) { if (!useNewMethod) { return true; } __result = ChooseMethod(__instance); return false; } private static EventDelegateFunc CreateEventDelegate(PlayerBotActionUnlock action) { return DelegateSupport.ConvertDelegate((Delegate)new Action(action.OnMethodActionEvent)); } private static bool ChooseMethod(PlayerBotActionUnlock action) { //IL_0001: 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_0029: Expected I4, but got Unknown //IL_0072: 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_0044: Unknown result type (might be due to invalid IL or missing references) if ((int)action.m_method != 0) { return CommitChosenMethod(action); } if (action.m_desc == null) { throw new NullReferenceException(); } int num = (int)action.m_desc.Method; if (UsesFlagResolution(num)) { if (TryResolveFlagMethod(action, num, out var resolved)) { action.m_method = resolved; if (!TryAssignMethodDescriptor(action, resolved)) { return false; } return CommitChosenMethod(action); } action.m_method = (MethodEnum)0; return false; } action.m_method = (MethodEnum)num; if (num == 0) { MarkDescriptorFailed(action); return false; } if (!TryAssignMethodDescriptor(action, action.m_method)) { return false; } return CommitChosenMethod(action); } private static bool CommitChosenMethod(PlayerBotActionUnlock action) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (action.m_desc == null) { throw new NullReferenceException(); } action.m_desc.UsedMethod = action.m_method; return true; } private static void MarkDescriptorFailed(PlayerBotActionUnlock action) { if (action.m_desc == null) { throw new NullReferenceException(); } ((Descriptor)action.m_desc).SetCompletionStatus((StatusType)4); } private static bool UsesFlagResolution(int descriptorMethod) { if (descriptorMethod == 7) { return true; } return (descriptorMethod & (descriptorMethod - 1)) != 0; } private static bool TryResolveFlagMethod(PlayerBotActionUnlock action, int methodFlags, out MethodEnum resolved) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Invalid comparison between Unknown and I4 //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_0117: 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_011e: Invalid comparison between Unknown and I4 resolved = (MethodEnum)0; action.m_method = (MethodEnum)methodFlags; LG_WeakLock val = action.m_desc.Lock; PlayerAIBot bot = ((PlayerBotActionBase)action).m_bot; if ((Object)(object)bot == (Object)null) { throw new NullReferenceException(); } if (!bot.WantsCrouch() && (methodFlags & 1) != 0) { if (bot.Backpack == null) { throw new NullReferenceException(); } BackpackItem val2 = default(BackpackItem); if (bot.Backpack.TryGetBackpackItem((InventorySlot)10, ref val2)) { if ((Object)(object)val == (Object)null) { throw new NullReferenceException(); } if ((int)val.Status == 0) { resolved = (MethodEnum)1; return true; } } } if ((methodFlags & 2) != 0) { if (bot.Backpack == null) { throw new NullReferenceException(); } BackpackItem val3 = default(BackpackItem); if (bot.Backpack.TryGetBackpackItem((InventorySlot)11, ref val3)) { if (val3 == null) { throw new NullReferenceException(); } if (val3.ItemID == 53) { if ((Object)(object)val == (Object)null) { throw new NullReferenceException(); } if ((int)val.Status == 1) { resolved = (MethodEnum)2; return true; } } } } if ((methodFlags & 4) != 0) { if (bot.Backpack == null) { throw new NullReferenceException(); } BackpackItem val4 = default(BackpackItem); if (bot.Backpack.TryGetBackpackItem((InventorySlot)5, ref val4)) { if (val4 == null) { throw new NullReferenceException(); } if (val4.ItemID == 116) { if ((Object)(object)val == (Object)null) { throw new NullReferenceException(); } eWeakLockStatus status = val.Status; if ((int)status == 0 || (int)status == 1) { resolved = (MethodEnum)4; return true; } } } } return false; } private static bool TryAssignMethodDescriptor(PlayerBotActionUnlock action, MethodEnum method) { //IL_0000: 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_0018: Expected I4, but got Unknown switch (method - 1) { case 0: { if (!TryCreateMeleeDescriptor(action, out var descriptor)) { return false; } action.m_chosenMethod = descriptor; return true; } case 1: action.m_chosenMethod = (Descriptor)(object)CreateHackDescriptor(action); return true; case 3: action.m_chosenMethod = (Descriptor)(object)CreateMeltDescriptor(action); return true; default: MarkDescriptorFailed(action); return false; } } private static bool TryCreateMeleeDescriptor(PlayerBotActionUnlock action, out Descriptor descriptor) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown descriptor = null; if (((PlayerBotActionBase)action).m_backpack == null) { throw new NullReferenceException(); } BackpackItem val = default(BackpackItem); if (!((PlayerBotActionBase)action).m_backpack.TryGetBackpackItem((InventorySlot)10, ref val)) { return false; } if (val == null) { throw new NullReferenceException(); } MeleeWeaponThirdPerson weapon = ((Il2CppObjectBase)val.Instance).TryCast(); Descriptor val2 = new Descriptor(((PlayerBotActionBase)action).m_bot); ((Descriptor)val2).ParentActionBase = (PlayerBotActionBase)(object)action; ((Descriptor)val2).Prio = ((Descriptor)action.m_desc).Prio; ((Descriptor)val2).EventDelegate = CreateEventDelegate(action); val2.Haste = 0.75f; val2.Force = 1f; val2.Strike = true; val2.Loop = true; val2.Travel = true; if (action.m_desc == null) { throw new NullReferenceException(); } LG_WeakLock obj = action.m_desc.Lock; if ((Object)(object)obj == (Object)null) { throw new NullReferenceException(); } LG_WeakLockDamage componentInChildren = ((Component)obj).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { throw new NullReferenceException(); } val2.TargetGameObject = ((Component)componentInChildren).gameObject; val2.Weapon = weapon; descriptor = (Descriptor)(object)val2; return true; } private static Descriptor CreateHackDescriptor(PlayerBotActionUnlock action) { //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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0065: Expected O, but got Unknown Descriptor val = new Descriptor(((PlayerBotActionBase)action).m_bot) { ParentActionBase = (PlayerBotActionBase)(object)action, Prio = ((Descriptor)action.m_desc).Prio, EventDelegate = CreateEventDelegate(action) }; if (action.m_desc == null) { throw new NullReferenceException(); } val.Lock = action.m_desc.Lock; val.MaxNrFaults = s_hackMaxNrFaults; val.SuccessChance = s_hackSuccessChance; return val; } private static Descriptor CreateMeltDescriptor(PlayerBotActionUnlock action) { //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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown Descriptor val = new Descriptor(((PlayerBotActionBase)action).m_bot) { ParentActionBase = (PlayerBotActionBase)(object)action, Prio = ((Descriptor)action.m_desc).Prio, EventDelegate = CreateEventDelegate(action) }; if (action.m_desc == null) { throw new NullReferenceException(); } val.Lock = action.m_desc.Lock; return val; } } [Flags] public enum CornerTag { None = 0, Top = 1, MiddleY = 2, Bottom = 4, Left = 8, MiddleX = 0x10, Right = 0x20, Front = 0x40, MiddleZ = 0x80, Back = 0x100, Center = 0x92, All = 0x1FF } public struct BoundingPoint { public Vector3 Position; public CornerTag Tags; public BoundingPoint(Vector3 pos, CornerTag tags) { //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) Position = pos; Tags = tags; } public bool Has(CornerTag tag) { return (Tags & tag) != 0; } public override string ToString() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) return $"{Tags}: {Position}"; } } public class BoundingBox { [Flags] public enum BoundingSource { None = 0, MeshFilters = 1, Renderers = 2, Colliders = 4, All = 7 } private readonly GameObject _go; private readonly List _points = new List(); private List _debugMarkers = new List(); public IEnumerable Points => _points; public Vector3 Center { get; private set; } public Vector3 Size { get; private set; } public IEnumerable Front => GetCorners(CornerTag.Front); public IEnumerable Back => GetCorners(CornerTag.Back); public IEnumerable Top => GetCorners(CornerTag.Top); public IEnumerable Bottom => GetCorners(CornerTag.Bottom); public IEnumerable Left => GetCorners(CornerTag.Left); public IEnumerable Right => GetCorners(CornerTag.Right); public BoundingBox(GameObject go, BoundingSource sources = BoundingSource.All) { _go = go; Refresh(sources); } public void Refresh(BoundingSource sources = BoundingSource.All) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_00be: 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) //IL_00d3: 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_0187: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: 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_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: 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_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_034e: 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_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: 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_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: 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_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = _go.transform.rotation; _go.transform.rotation = Quaternion.identity; Transform parent = _go.transform.parent; _go.transform.parent = null; _points.Clear(); Transform transform = _go.transform; List list = new List(); if (sources.HasFlag(BoundingSource.MeshFilters)) { foreach (MeshFilter componentsInChild in _go.GetComponentsInChildren()) { if (!((Object)(object)componentsInChild.mesh == (Object)null)) { Bounds bounds = componentsInChild.mesh.bounds; ((Bounds)(ref bounds)).center = transform.InverseTransformPoint(((Component)componentsInChild).transform.TransformPoint(((Bounds)(ref bounds)).center)); list.Add(bounds); } } } if (sources.HasFlag(BoundingSource.Renderers)) { foreach (Renderer componentsInChild2 in _go.GetComponentsInChildren()) { Bounds bounds2 = componentsInChild2.bounds; ((Bounds)(ref bounds2)).center = transform.InverseTransformPoint(((Bounds)(ref bounds2)).center); list.Add(bounds2); } } if (sources.HasFlag(BoundingSource.Colliders)) { foreach (Collider componentsInChild3 in _go.GetComponentsInChildren()) { Bounds bounds3 = componentsInChild3.bounds; ((Bounds)(ref bounds3)).center = transform.InverseTransformPoint(((Bounds)(ref bounds3)).center); list.Add(bounds3); } } if (list.Count == 0) { Vector3 pos = (Center = transform.position); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { CornerTag cornerTag = CornerTag.None; cornerTag = (CornerTag)((int)cornerTag | (i switch { 1 => 16, 0 => 8, _ => 32, })); cornerTag = (CornerTag)((int)cornerTag | (j switch { 1 => 2, 0 => 4, _ => 1, })); cornerTag = (CornerTag)((int)cornerTag | (k switch { 1 => 128, 0 => 256, _ => 64, })); _points.Add(new BoundingPoint(pos, cornerTag)); } } } _go.transform.rotation = rotation; return; } Bounds val = list[0]; foreach (Bounds item in list.Skip(1)) { Bounds current2 = item; ((Bounds)(ref val)).Encapsulate(((Bounds)(ref current2)).min); ((Bounds)(ref val)).Encapsulate(((Bounds)(ref current2)).max); } Size = ((Bounds)(ref val)).size; Center = transform.TransformPoint(((Bounds)(ref val)).center); Vector3 center = ((Bounds)(ref val)).center; Vector3 extents = ((Bounds)(ref val)).extents; float[] array = new float[3] { 0f - extents.x, 0f, extents.x }; float[] array2 = new float[3] { 0f - extents.y, 0f, extents.y }; float[] array3 = new float[3] { 0f - extents.z, 0f, extents.z }; for (int l = 0; l < 3; l++) { for (int m = 0; m < 3; m++) { for (int n = 0; n < 3; n++) { Vector3 val2 = center + new Vector3(array[l], array2[m], array3[n]); Vector3 pos2 = transform.TransformPoint(val2); CornerTag cornerTag2 = CornerTag.None; cornerTag2 = (CornerTag)((int)cornerTag2 | (l switch { 1 => 16, 0 => 8, _ => 32, })); cornerTag2 = (CornerTag)((int)cornerTag2 | (m switch { 1 => 2, 0 => 4, _ => 1, })); cornerTag2 = (CornerTag)((int)cornerTag2 | (n switch { 1 => 128, 0 => 256, _ => 64, })); _points.Add(new BoundingPoint(pos2, cornerTag2)); } } } _go.transform.rotation = rotation; _go.transform.parent = parent; for (int num = 0; num < _points.Count; num++) { Vector3 val3 = _points[num].Position - transform.position; Vector3 pos3 = rotation * val3 + transform.position; _points[num] = new BoundingPoint(pos3, _points[num].Tags); } Vector3 val4 = Vector3.zero; foreach (BoundingPoint point in _points) { val4 += point.Position; } Center = val4 / (float)_points.Count; } public bool IsInside(Vector3 worldPoint) { //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_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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: 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_0084: 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_0092: 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_00a0: 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_00ae: 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_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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) BoundingPoint[] array = _points.Where((BoundingPoint p) => !p.Has(CornerTag.MiddleX) && !p.Has(CornerTag.MiddleY) && !p.Has(CornerTag.MiddleZ)).ToArray(); if (array.Length == 0) { return false; } Vector3 val = array[0].Position; Vector3 val2 = array[0].Position; for (int num = 1; num < array.Length; num++) { val = Vector3.Min(val, array[num].Position); val2 = Vector3.Max(val2, array[num].Position); } if (worldPoint.x >= val.x && worldPoint.x <= val2.x && worldPoint.y >= val.y && worldPoint.y <= val2.y) { if (worldPoint.z >= val.z) { return worldPoint.z <= val2.z; } return false; } return false; } public IEnumerable GetCorners(CornerTag include = CornerTag.All, CornerTag exclude = CornerTag.None) { foreach (BoundingPoint point in _points) { if (point.Has(include) && (exclude == CornerTag.None || !point.Has(exclude))) { yield return point.Position; } } } public IEnumerable CornersOnly() { foreach (BoundingPoint point in _points) { if (!point.Has(CornerTag.MiddleX) && !point.Has(CornerTag.MiddleY) && !point.Has(CornerTag.MiddleZ)) { yield return point.Position; } } } public void ToggleDebug() { if (_debugMarkers.Count == 0) { ShowDebug(); } else { ClearDebug(); } } public void ShowDebug(Transform parent = null, float size = 0.2f) { //IL_001e: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0082: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0139: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) ClearDebug(); foreach (Vector3 corner in GetCorners()) { GameObject val = new GameObject("BB_DebugPoint"); if ((Object)(object)parent != (Object)null) { val.transform.parent = parent; } val.transform.position = corner; TextMesh obj = val.AddComponent(); obj.text = "-"; obj.characterSize = size; obj.anchor = (TextAnchor)4; obj.alignment = (TextAlignment)1; obj.color = Color.red; zDebug.DrawLine(corner, Center, Color.white, 0.01f).transform.SetParent(val.transform, true); _debugMarkers.Add(val); } BoundingPoint? boundingPoint = _points.FirstOrDefault((BoundingPoint p) => p.Has(CornerTag.Top) && p.Has(CornerTag.MiddleX) && p.Has(CornerTag.MiddleZ)); if (boundingPoint.HasValue) { GameObject val2 = new GameObject("BB_DebugLabel"); if ((Object)(object)parent != (Object)null) { val2.transform.parent = parent; } val2.transform.position = boundingPoint.Value.Position + Vector3.up * 0.1f; val2.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f); _debugMarkers.Add(val2); } } public void ClearDebug() { foreach (GameObject debugMarker in _debugMarkers) { if ((Object)(object)debugMarker != (Object)null) { Object.Destroy((Object)(object)debugMarker); } } _debugMarkers.Clear(); } } namespace CollisionRundown.Features.HUDs { internal static class InGameTitle { public static PUI_InteractionPrompt Prompt; private static readonly Regex s_StripRichTextRegex = new Regex("\\<.+?\\>"); private static int s_SmallTitleLength; private static int s_TitleLength; public static void DisplayDefault() { ((TMP_Text)Prompt.m_headerText).maxVisibleCharacters = 0; ((RectTransformComp)Prompt).SetVisible(true); CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoDefaultDisplay()), (Action)null); } public static void SetTitle(string smallTitle, string title) { string text = s_StripRichTextRegex.Replace(smallTitle, ""); SetLength(titleLength: s_StripRichTextRegex.Replace(title, "").Length, smallTitleLength: text.Length); SetText(smallTitle + "\n" + title); } public static void SetLength(int smallTitleLength, int titleLength) { s_SmallTitleLength = smallTitleLength; s_TitleLength = titleLength; } private static IEnumerator DoDefaultDisplay() { ((TMP_Text)Prompt.m_headerText).alpha = 1f; ((TMP_Text)Prompt.m_headerText).maxVisibleCharacters = 0; Prompt.PlayIntro(); CM_PageBase.PostSound(EVENTS.HUD_SCAN_COMPLETE_INDICATION, "Display IGT"); yield return (object)new WaitForSeconds(0.33f); int visibleCount = 0; while (visibleCount <= s_SmallTitleLength) { visibleCount++; ((TMP_Text)Prompt.m_headerText).maxVisibleCharacters = visibleCount; CM_PageBase.PostSound(EVENTS.HUD_EXIT_SCAN_INFO_TEXT_DISAPPEAR, "Type IGT"); yield return (object)new WaitForSeconds(0.065f); } yield return (object)new WaitForSeconds(1f); while (visibleCount <= s_TitleLength + s_SmallTitleLength + 1) { visibleCount++; ((TMP_Text)Prompt.m_headerText).maxVisibleCharacters = visibleCount; CM_PageBase.PostSound(EVENTS.HUD_EXIT_SCAN_INFO_TEXT_DISAPPEAR, "Type IGT"); yield return (object)new WaitForSeconds(0.065f); } yield return (object)new WaitForSeconds(6.5f); CM_PageBase.PostSound(EVENTS.HUD_EXIT_SCAN_INFO_TEXT_APPEAR, "Hide IGT"); Prompt.PlayIntro(); yield return (object)new WaitForSeconds(0.33f); ((RectTransformComp)Prompt).SetVisible(false); } private static void SetText(string rawText) { ((TMP_Text)Prompt.m_headerText).SetText(rawText, true); } } [HarmonyPatch(typeof(InteractionGuiLayer), "Setup")] internal static class Patch_InteractionLayer_Setup { private static void Postfix(InteractionGuiLayer __instance) { //IL_0011: 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_0076: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) PUI_InteractionPrompt obj = ((Il2CppObjectBase)((GuiLayer)__instance).AddRectComp("Gui/Player/PUI_InteractionPrompt_CellUI", (GuiAnchor)3, new Vector2(0f, 258f), (Transform)null)).Cast(); ((Graphic)obj.m_headerText).color = Color.white; ((TMP_Text)obj.m_headerText).fontSize = 24.5f; ((TMP_Text)obj.m_headerText).fontSizeMin = 24.5f; ((TMP_Text)obj.m_headerText).fontSizeMax = 24.5f; ((TMP_Text)obj.m_headerText).rectTransform.sizeDelta = new Vector2(120f, -10f); obj.m_whiteBox.transform.localPosition = new Vector3(0f, -22.8f, 0f); obj.m_whiteBox.transform.localScale = new Vector3(1f, 1.35f, 1f); obj.m_whiteBoxWide.transform.localPosition = new Vector3(0f, -22.8f, 0f); obj.m_whiteBoxWide.transform.localScale = new Vector3(1f, 1.5f, 1f); obj.SetTimerFill(0f); ((RectTransformComp)obj).SetVisible(false); InGameTitle.Prompt = obj; InGameTitle.SetTitle("Small debug title here", "Beeeeg debug title here"); } } } namespace SlideMenu { public class FlexibleMethodDefinition { public Delegate method; public object[] args; public FlexibleMethodDefinition(Delegate method) { this.method = method; args = Array.Empty(); } public FlexibleMethodDefinition(Delegate method, object[] args) { this.method = method; this.args = args; } public static implicit operator FlexibleMethodDefinition(Delegate d) { return new FlexibleMethodDefinition(d); } public object? Invoke() { return Invoke(args); } public object? Invoke(params object[] suppliedArgs) { if ((object)method == null) { throw new InvalidOperationException("No method assigned to FlexibleMethodDefinition."); } object[] array = ((suppliedArgs != null && suppliedArgs.Length != 0) ? suppliedArgs : args); try { return method.DynamicInvoke(array); } catch (TargetParameterCountException innerException) { throw new InvalidOperationException($"Parameter count mismatch. Expected {method.Method.GetParameters().Length}, got {((array != null) ? array.Length : 0)}.", innerException); } catch (Exception inner) { throw new TargetInvocationException("Error invoking method '" + method.Method.Name + "'.", inner); } } } public class FlexibleEvent { private readonly OrderedSet listeners = new OrderedSet(); public FlexibleEvent Listen(Action method) { if (method == null) { return this; } listeners.Add(method); return this; } public FlexibleEvent Listen(FlexibleMethodDefinition method) { return Listen(method.method, method.args, method); } public FlexibleEvent Listen(Delegate method, object[] args, FlexibleMethodDefinition? fMethod = null) { if ((object)method == null) { return this; } ParameterInfo[] parameters = method.Method.GetParameters(); object[] finalArgs = new object[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { if (i < args.Length && args[i] != new object()) { finalArgs[i] = args[i]; continue; } if (parameters[i].IsOptional) { finalArgs[i] = parameters[i].DefaultValue; continue; } throw new ArgumentException("Missing required argument '" + parameters[i].Name + "'"); } listeners.Add(Wrapper); return this; void Wrapper() { method.DynamicInvoke(finalArgs); if (fMethod?.args != null) { for (int j = 0; j < finalArgs.Length && j < fMethod.args.Length; j++) { fMethod.args[j] = finalArgs[j]; } } } } public void Unlisten(Action method) { listeners.Remove(method); } public void Unlisten(FlexibleMethodDefinition method) { listeners.Remove((Action)method.method); } public void ClearListeners() { listeners.Clear(); } public void Invoke() { foreach (Action listener in listeners) { listener(); } } } public class sMenu { public class sMenuNode { private class SelectionColorHandler { private sMenuNode node; private bool selected; private bool pressed; private static Color selectedOffset = new Color(0.1f, 0.1f, 0.1f); private static Color pressedOffset = new Color(0.3f, 0.2f, 0.5f); public SelectionColorHandler(sMenuNode Node) { node = Node; } internal void onClosed() { selected = false; pressed = false; UpdateOffset(); } internal void onSelected() { selected = true; UpdateOffset(); } internal void OnDeselected() { selected = false; UpdateOffset(); } internal void OnPressed() { pressed = true; UpdateOffset(); } internal void OnUnpressed() { pressed = false; UpdateOffset(); } private void UpdateOffset() { //IL_0015: 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_0033: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) node.ColorOffset = new Color(0f, 0f, 0f); if (selected) { sMenuNode sMenuNode = node; sMenuNode.ColorOffset += selectedOffset; } if (pressed) { sMenuNode sMenuNode2 = node; sMenuNode2.ColorOffset += pressedOffset; } } } private string _title = ""; private string _subtitle = ""; private string _description = ""; private string _text = ""; private string _prefix = ""; private string _suffix = ""; public bool selected; public bool pressed; public bool held; public int frameFirstPressedAt = Time.frameCount; public float timeFirstPressedAt = Time.time; public int frameLastPressedAt = Time.frameCount; public float timeLastPressedAt = Time.time; public float lastTapTime = Time.time; public sMenu parrentMenu; private Dictionary _eventMap; public TextPart fullTextPart; public TextPart titlePart; public TextPart subtitlePart; public TextPart descriptionPart; public GameObject gameObject; private GameObject TextPartGameObject; private RectTransform rect; internal GameObject backgroundObject; internal RawImage backgroundImage; private SelectionColorHandler selectionColorHandler; private bool hasHoverText; private Color _color; private Color _colorOffset; private float holdThreshold = 0.2f; private float doubleTapThreshold = 0.3f; public string title { get { return _title.Trim(); } set { _title = value; UpdateTitle(); } } public string subtitle { get { return _subtitle.Trim(); } set { _subtitle = value; UpdateSubtitle(); } } public string description { get { return _description.Trim(); } set { _description = value; UpdateDescription(); } } public string text { get { return _text.Trim(); } set { _text = value; UpdateText(); } } public string prefix { get { return _prefix.Trim(); } set { _prefix = value; UpdateText(); } } public string suffix { get { return _suffix.Trim(); } set { _suffix = value; UpdateText(); } } public string fullText { get { return string.Join(" ", prefix, text, suffix).Trim(); } [Obsolete("\nDon't assign to fullText. Use vars \"prefix\", \"text\" and \"suffix\" instead.\nYou probably want var \"text\".", true)] set { } } public bool closeOnPress { get; private set; } private Dictionary eventMap { get { if (_eventMap == null) { _eventMap = new Dictionary(); sMenuManager.nodeEvent[] values = Enum.GetValues(); foreach (sMenuManager.nodeEvent key in values) { _eventMap[key] = new FlexibleEvent(); } } return _eventMap; } } public Color color { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _color; } set { //IL_0001: 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_0008: 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_0017: Unknown result type (might be due to invalid IL or missing references) Color val = _color; _color = value; if (val != value) { SetColor(_color); } } } public Color ColorOffset { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _colorOffset; } set { //IL_0001: 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_0008: 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_0017: Unknown result type (might be due to invalid IL or missing references) Color colorOffset = _colorOffset; _colorOffset = value; if (colorOffset != value) { SetColor(_color); } } } public sMenuNode(string arg_Name, sMenu arg_parrentMenu, FlexibleMethodDefinition arg_Callback) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0139: 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_0198: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: 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_0344: Unknown result type (might be due to invalid IL or missing references) gameObject = new GameObject("sMenuNode " + arg_Name); gameObject.transform.SetParent(((Component)arg_parrentMenu.getCanvas()).transform, false); backgroundObject = new GameObject("Background"); TextPartGameObject = new GameObject("TextParts"); TextPartGameObject.transform.SetParent(gameObject.transform, false); backgroundObject.transform.SetParent(gameObject.transform, false); backgroundObject.transform.localPosition = new Vector3(0f, 0f, 30f); backgroundImage = backgroundObject.AddComponent(); backgroundImage.texture = (Texture)(object)sMenuManager.DefaultBackgroundImage; rect = gameObject.AddComponent(); RectTransform obj = rect; RectTransform obj2 = rect; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); obj2.anchorMax = val; obj.anchorMin = val; rect.anchoredPosition = Vector2.zero; ((Transform)rect).localScale = Vector3.one; parrentMenu = arg_parrentMenu; if (arg_Callback != null) { eventMap[sMenuManager.nodeEvent.OnUnpressedSelected].Listen(arg_Callback); } color = parrentMenu.getTextColor(); VerticalLayoutGroup obj3 = TextPartGameObject.AddComponent(); ((LayoutGroup)obj3).childAlignment = (TextAnchor)4; ((HorizontalOrVerticalLayoutGroup)obj3).spacing = 2f; ((HorizontalOrVerticalLayoutGroup)obj3).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandHeight = false; ContentSizeFitter obj4 = TextPartGameObject.AddComponent(); obj4.verticalFit = (FitMode)2; obj4.horizontalFit = (FitMode)2; ((Object)(titlePart = new TextPart(TextPartGameObject, title ?? "", new Color(0.2f, 0.2f, 0.2f, 1f), TextPart.TextPartType.Title).SetScale(0.75f, 0.75f)).gameObject).name = "Title"; ((Object)(fullTextPart = new TextPart(TextPartGameObject, text ?? "", parrentMenu.textColor, TextPart.TextPartType.Main)).gameObject).name = "Text"; ((Object)(subtitlePart = new TextPart(TextPartGameObject, title ?? "", new Color(0.1f, 0.1f, 0.1f, 1f), TextPart.TextPartType.Subtitle).SetScale(0.75f, 0.75f)).gameObject).name = "Subtitle"; ((Object)(descriptionPart = new TextPart(TextPartGameObject, description, parrentMenu.textColor, TextPart.TextPartType.Description)).gameObject).name = "Description"; text = arg_Name; selectionColorHandler = new SelectionColorHandler(this); AddListener(sMenuManager.nodeEvent.OnSelected, selectionColorHandler.onSelected); AddListener(sMenuManager.nodeEvent.OnDeselected, selectionColorHandler.OnDeselected); AddListener(sMenuManager.nodeEvent.OnPressed, selectionColorHandler.OnPressed); AddListener(sMenuManager.nodeEvent.OnUnpressed, selectionColorHandler.OnUnpressed); parrentMenu.AddListener(sMenuManager.menuEvent.OnClosed, selectionColorHandler.onClosed); } public sMenuNode Update() { if (selected) { eventMap[sMenuManager.nodeEvent.WhileSelected].Invoke(); parrentMenu.selectedNode = this; } else { eventMap[sMenuManager.nodeEvent.WhileDeselected].Invoke(); } if (!pressed) { eventMap[sMenuManager.nodeEvent.WhileUnpressed].Invoke(); } return this; } public Vector3 GetRelativePosition() { //IL_0006: 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_0025: 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_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_0056: 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_0066: 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_006c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Scale(new Vector3(rect.anchoredPosition.x, rect.anchoredPosition.y, 0f), ((Component)parrentMenu.getCanvas()).transform.localScale); Vector3 val2 = parrentMenu.gameObject.transform.TransformPoint(val); return ((Component)sMenuManager.mainCamera).transform.position - val2; } public sMenuNode SetPosition(float x, float y) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SetPosition(new Vector2(x, y)); return this; } public sMenuNode SetPosition(Vector2 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) rect.anchoredPosition = pos; return this; } public sMenuNode SetSize(float scale) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return this.SetSize(new Vector3(scale, scale, scale)); } public sMenuNode SetSize(float x, float y) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) this.SetSize(new Vector2(x, y)); return this; } public sMenuNode SetSize(Vector2 scale) { //IL_0001: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) this.SetSize(new Vector3(scale.x, scale.y, ((Transform)rect).localScale.z)); return this; } public sMenuNode SetSize(float x, float y, float z) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) this.SetSize(new Vector3(x, y, z)); return this; } public sMenuNode SetSize(Vector3 scale) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Transform)rect).localScale = scale; return this; } public sMenuNode SetCloseMenuOnPress(bool close) { closeOnPress = close; return this; } public sMenuNode FaceCamera() { //IL_000b: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = Quaternion.LookRotation(gameObject.transform.position - ((Component)sMenuManager.mainCamera).transform.position); setRotation(rotation); return this; } public sMenuNode setRotation(Quaternion rot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) gameObject.transform.rotation = rot; return this; } public sMenuNode Select() { if (selected) { return this; } selected = true; SetSize(sMenuManager.selectedNodeSizeMultiplier); eventMap[sMenuManager.nodeEvent.OnSelected].Invoke(); parrentMenu.OnSelected.Invoke(); return this; } public sMenuNode Deselect() { if (!selected) { return this; } selected = false; SetSize(1f); eventMap[sMenuManager.nodeEvent.OnDeselected].Invoke(); parrentMenu.OnDeselected.Invoke(); return this; } public sMenuNode Pressing() { frameLastPressedAt = Time.frameCount; timeLastPressedAt = Time.time; eventMap[sMenuManager.nodeEvent.WhilePressed].Invoke(); if (Time.time - timeFirstPressedAt > holdThreshold) { if (held) { if (selected) { eventMap[sMenuManager.nodeEvent.WhileHeldSelected].Invoke(); } else { eventMap[sMenuManager.nodeEvent.WhileHeld].Invoke(); } } else { held = true; if (selected) { eventMap[sMenuManager.nodeEvent.OnHeldImmediateSelected].Invoke(); } eventMap[sMenuManager.nodeEvent.OnHeldImmediate].Invoke(); } } return this; } public sMenuNode Press() { frameFirstPressedAt = Time.frameCount; timeFirstPressedAt = Time.time; pressed = true; eventMap[sMenuManager.nodeEvent.OnPressed].Invoke(); if (closeOnPress) { sMenuManager.CloseAllMenus(); return this; } return this; } public sMenuNode Unpress() { if (pressed) { eventMap[sMenuManager.nodeEvent.OnUnpressed].Invoke(); if (held) { eventMap[sMenuManager.nodeEvent.OnHeld].Invoke(); } if (selected) { eventMap[sMenuManager.nodeEvent.OnUnpressedSelected].Invoke(); } if (held && selected) { eventMap[sMenuManager.nodeEvent.OnHeldSelected].Invoke(); } if (Time.time - timeFirstPressedAt < holdThreshold) { eventMap[sMenuManager.nodeEvent.OnTapped].Invoke(); if (Time.time - lastTapTime <= doubleTapThreshold) { eventMap[sMenuManager.nodeEvent.OnDoubleTapped].Invoke(); } else { zUpdater.InvokeStatic(new FlexibleMethodDefinition(new Action(InvokeTappedExclusive)), doubleTapThreshold - Time.deltaTime / 2f); } lastTapTime = Time.time; } } held = false; pressed = false; return this; } private void InvokeTappedExclusive() { if (Time.time - lastTapTime >= doubleTapThreshold - Time.deltaTime && !pressed) { eventMap[sMenuManager.nodeEvent.OnTappedExclusive].Invoke(); } } public sMenuNode AddListener(sMenuManager.nodeEvent arg_event, Action arg_method) { return AddListener(arg_event, (FlexibleMethodDefinition)arg_method); } public sMenuNode AddListener(sMenuManager.nodeEvent arg_event, Delegate method, params object[] args) { FlexibleMethodDefinition arg_method = new FlexibleMethodDefinition(method, args); return AddListener(arg_event, arg_method); } public sMenuNode AddListener(sMenuManager.nodeEvent arg_event, FlexibleMethodDefinition arg_method) { if (eventMap.TryGetValue(arg_event, out var value)) { value.Listen(arg_method); } return this; } public sMenuNode RemoveListener(sMenuManager.nodeEvent arg_event, Action arg_method) { if (eventMap.TryGetValue(arg_event, out var value)) { value.Unlisten(arg_method); } return this; } public sMenuNode RemoveListener(sMenuManager.nodeEvent arg_event) { if (eventMap.TryGetValue(arg_event, out var value)) { value.ClearListeners(); } return this; } public sMenuNode RemoveListener(sMenuManager.nodeEvent arg_event, FlexibleMethodDefinition arg_method) { if (eventMap.TryGetValue(arg_event, out var value)) { value.Unlisten(arg_method); } return this; } public sMenuNode ClearListeners(sMenuManager.nodeEvent arg_event) { if (eventMap.TryGetValue(arg_event, out var value)) { value.ClearListeners(); } return this; } public sMenuNode SetTitle(string arg_Title) { title = arg_Title ?? string.Empty; return this; } public sMenuNode SetSubtitle(string arg_Subtitle) { subtitle = arg_Subtitle ?? string.Empty; return this; } public sMenuNode SetDescription(string arg_Description) { description = arg_Description ?? string.Empty; return this; } public sMenuNode SetText(string arg_Text) { text = arg_Text ?? string.Empty; return this; } public sMenuNode SetPrefix(string arg_Prefix) { prefix = arg_Prefix ?? string.Empty; return this; } public sMenuNode SetSuffix(string arg_Suffix) { suffix = arg_Suffix ?? string.Empty; return this; } public sMenuNode SetColor(Color arg_Color) { //IL_0001: 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_001f: 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_0040: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) color = arg_Color; foreach (TextPart textPart in GetTextParts()) { Color val = arg_Color; val.r += ColorOffset.r; val.g += ColorOffset.g; val.b += ColorOffset.b; val.a = arg_Color.a; textPart.SetColor(val); } return this; } public sMenuNode AddHoverText(sMenuPannel.Side side, string[] textList) { foreach (string text in textList) { AddHoverText(side, text); } return this; } public sMenuNode AddHoverText(sMenuPannel.Side side, string text) { sMenuPannel pannel = parrentMenu.AddPannel(side); string key = ((Object)gameObject).GetInstanceID().ToString(); pannel.addLine(text, key); pannel.SetLineVisible(visible: false, text, key); if (!hasHoverText) { AddListener(sMenuManager.nodeEvent.OnSelected, delegate { pannel.SetKeyVisible(visible: true, key); }); AddListener(sMenuManager.nodeEvent.OnDeselected, delegate { pannel.SetKeyVisible(visible: false, key); }); hasHoverText = true; } return this; } public List GetTextParts(TextPart.TextPartType types = TextPart.TextPartType.All) { return (from f in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where f.FieldType == typeof(TextPart) select f.GetValue(this) as TextPart into tp where tp != null && (types & tp.type) != 0 select tp).ToList(); } private void UpdateTitle() { if (titlePart != null) { titlePart.SetText(title); } } private void UpdateSubtitle() { if (subtitlePart != null) { subtitlePart.SetText(subtitle); } } private void UpdateDescription() { if (descriptionPart != null) { descriptionPart.SetText(description); } } private void UpdateText() { if (fullTextPart != null) { fullTextPart.SetText(fullText); } } } public class sMenuPannel { public enum Side { left, right, top, bottom } public Side side; public sMenu parrentMenu; public GameObject gameObject; public RectTransform rect; public Color color; public Dictionary> lines = new Dictionary>(); public sMenuPannel(Side side, sMenu parrentMenu) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_006d: 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_00ad: 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) this.side = side; gameObject = new GameObject($"zMenuPannel {side}"); gameObject.transform.SetParent(((Component)parrentMenu.getCanvas()).transform, false); this.parrentMenu = parrentMenu; color = parrentMenu.getTextColor(); rect = gameObject.GetComponent(); if ((Object)(object)rect == (Object)null) { rect = gameObject.AddComponent(); } ((Transform)rect).localScale = Vector3.one; rect.sizeDelta = new Vector2(300f, 0f); VerticalLayoutGroup obj = gameObject.AddComponent(); ((LayoutGroup)obj).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj).spacing = 2f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = side == Side.top || side == Side.bottom; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ContentSizeFitter obj2 = gameObject.AddComponent(); obj2.verticalFit = (FitMode)2; obj2.horizontalFit = (FitMode)2; UpdatePosition(); } public sMenuPannel UpdatePosition(float margin = 0f) { //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) //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_00ac: 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_00e0: 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_005e: 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_0114: 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_0148: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) Rect nodeBounds = parrentMenu.GetNodeBounds(); Vector2 zero = Vector2.zero; switch (side) { case Side.right: rect.anchorMax = new Vector2(0f, 0.5f); rect.anchorMin = new Vector2(0f, 0.5f); rect.pivot = new Vector2(0f, 0.5f); ((Vector2)(ref zero))..ctor(((Rect)(ref nodeBounds)).xMax + margin, 0f); break; case Side.left: rect.anchorMax = new Vector2(1f, 0.5f); rect.anchorMin = new Vector2(1f, 0.5f); rect.pivot = new Vector2(1f, 0.5f); ((Vector2)(ref zero))..ctor(((Rect)(ref nodeBounds)).xMin - margin, 0f); break; case Side.top: rect.anchorMax = new Vector2(0.5f, 0f); rect.anchorMin = new Vector2(0.5f, 0f); rect.pivot = new Vector2(0.5f, 0f); ((Vector2)(ref zero))..ctor(0f, ((Rect)(ref nodeBounds)).yMax + margin); break; case Side.bottom: rect.anchorMax = new Vector2(0.5f, 1f); rect.anchorMin = new Vector2(0.5f, 1f); rect.pivot = new Vector2(0.5f, 1f); ((Vector2)(ref zero))..ctor(0f, ((Rect)(ref nodeBounds)).yMin - margin); break; } gameObject.transform.localPosition = Vector2.op_Implicit(zero); FaceCamera(); return this; } public TextPart addLine(string lineText, string key = "Default") { //IL_000d: Unknown result type (might be due to invalid IL or missing references) TextPart textPart = new TextPart(gameObject, lineText, parrentMenu.textColor, TextPart.TextPartType.Pannel); textPart.gameObject.transform.SetParent(gameObject.transform, false); if (!lines.ContainsKey(key)) { lines[key] = new List(); } lines[key].Add(textPart); return textPart; } public sMenuPannel FaceCamera() { //IL_000b: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = Quaternion.LookRotation(gameObject.transform.position - ((Component)sMenuManager.mainCamera).transform.position); setRotation(rotation); return this; } public sMenuPannel setRotation(Quaternion rot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) gameObject.transform.rotation = rot; return this; } public TextPart GetLine(string lineText, string key) { TextPart result = null; foreach (TextPart item in lines[key]) { if (item.text.Contains(lineText)) { result = item; break; } } return result; } public sMenuPannel SetLineVisible(bool visible, string line, string key = "") { TextPart textPart = null; if (key == "") { foreach (string key2 in lines.Keys) { textPart = GetLine(line, key2); if (textPart != null) { break; } } } else if (lines.ContainsKey(key)) { textPart = GetLine(line, key); } textPart.gameObject.SetActive(visible); return this; } public sMenuPannel SetKeyVisible(bool visible, string key) { if (!lines.ContainsKey(key)) { return this; } foreach (TextPart item in lines[key]) { item.gameObject.SetActive(visible); } return this; } public bool IsLineVisible(string line, string key = "") { TextPart line2 = GetLine(line, key); if (line2 != null) { return line2.gameObject.activeInHierarchy; } return false; } public bool IsKeyVisible(string key) { if (!lines.ContainsKey(key)) { return false; } int num = 0; foreach (TextPart item in lines[key]) { num = ((!item.gameObject.activeInHierarchy) ? (num - 1) : (num + 1)); } return num > 0; } public sMenuPannel ToggleLineVisiblity(string line, string key = "") { if (!lines.ContainsKey(key)) { return this; } bool flag = IsLineVisible(line, key); SetLineVisible(!flag, line, key); return this; } public sMenuPannel ToggleKeyVisiblity(string key) { if (!lines.ContainsKey(key)) { return this; } bool flag = IsKeyVisible(key); SetKeyVisible(!flag, key); return this; } } public class TextPart { [Flags] public enum TextPartType { none = 0, Main = 1, Title = 2, Subtitle = 4, Description = 8, Pannel = 0x10, Default = 0x20, All = 0x3F } public TextPartType type; private string _text; private Color _textColor; private Color _colorOffset; private TextMeshPro textMesh; public string text { get { return _text; } set { _text = value; ((TMP_Text)textMesh).text = value; } } public Color textColor { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _textColor; } set { //IL_0001: 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_0008: 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_0017: Unknown result type (might be due to invalid IL or missing references) Color val = _textColor; _textColor = value; if (val != value) { I_SetColor(_textColor); } } } public Color ColorOffset { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _colorOffset; } set { //IL_0001: 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_0008: 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_0017: Unknown result type (might be due to invalid IL or missing references) Color colorOffset = _colorOffset; _colorOffset = value; if (colorOffset != value) { I_SetColor(_textColor); } } } public GameObject gameObject { get; private set; } public RectTransform rect { get; private set; } public TextPart(GameObject parent, string arg_Text, Color color, TextPartType type) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0024: 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_004e: 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_00d4: 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_013b: Unknown result type (might be due to invalid IL or missing references) this.type = type; gameObject = new GameObject(); gameObject.transform.position = Vector3.zero; gameObject.transform.rotation = Quaternion.identity; gameObject.transform.localScale = Vector3.one; gameObject.layer = 0; gameObject.tag = "Untagged"; gameObject.SetActive(true); gameObject.transform.SetParent(parent.transform, false); ((Object)gameObject).name = "TextPart " + arg_Text; rect = gameObject.AddComponent(); rect.anchoredPosition = Vector2.zero; ((Transform)rect).localScale = Vector3.one; rect.sizeDelta = new Vector2(300f, 0f); textMesh = gameObject.AddComponent(); ((TMP_Text)textMesh).enableAutoSizing = false; ((TMP_Text)textMesh).fontSize = sMenuManager.defaultFontSize; ((TMP_Text)textMesh).alignment = (TextAlignmentOptions)514; ((Graphic)textMesh).color = color; text = arg_Text; ContentSizeFitter obj = gameObject.AddComponent(); obj.verticalFit = (FitMode)2; obj.horizontalFit = (FitMode)2; } public TextPart SetText(string newText) { text = newText; return this; } public TextPart SetPosition(Vector2 pos) { //IL_0001: 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) SetPosition(pos.x, pos.y); return this; } public TextPart SetPosition(float x, float y) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) rect.anchoredPosition = new Vector2(x, y); return this; } public TextPart SetScale(float scale) { SetScale(scale, scale, 1f); return this; } public TextPart SetScale(Vector2 scale) { //IL_0001: 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) SetScale(scale.x, scale.y, 1f); return this; } public TextPart SetScale(Vector3 scale) { //IL_0001: 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_000d: Unknown result type (might be due to invalid IL or missing references) SetScale(scale.x, scale.y, scale.z); return this; } public TextPart SetScale(float x, float y) { SetScale(x, y, 1f); return this; } public TextPart SetScale(float x, float y, float z) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ((Transform)rect).localScale = new Vector3(x, y, z); return this; } private TextPart I_SetColor(Color color) { //IL_0007: 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_0012: Unknown result type (might be due to invalid IL or missing references) ((Graphic)textMesh).color = textColor + ColorOffset; return this; } public TextPart SetColor(Color color) { //IL_0001: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) textColor = color; ((Graphic)textMesh).color = textColor + ColorOffset; return this; } public Color GetColor() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return textColor; } } private string name; private sMenu _parrentMenu; internal int frameOpenedAt = Time.frameCount; internal float timeOpenedAt = Time.time; public GameObject gameObject; private Canvas canvas; public Vector3 RelativePosition = Vector3.zero; private Dictionary eventMap; public Dictionary> catagories = new Dictionary>(); private int catagoryIndex; private FlexibleEvent OnOpened = new FlexibleEvent(); private FlexibleEvent WhileOpened = new FlexibleEvent(); private FlexibleEvent OnClosed = new FlexibleEvent(); private FlexibleEvent WhileClosed = new FlexibleEvent(); private FlexibleEvent OnSelected = new FlexibleEvent(); private FlexibleEvent WhileSelected = new FlexibleEvent(); private FlexibleEvent OnDeselected = new FlexibleEvent(); private FlexibleEvent WhileDeselected = new FlexibleEvent(); private FlexibleEvent OnCatagoryChanged = new FlexibleEvent(); private int pannelPositionWorkaround; private Vector3 canvasScale = new Vector3(0.003f, 0.003f, 0.003f); public float radius; public float rotationalOffset; private Color textColor = sMenuManager.defaultColor; private sMenuNode selectedNode; private RectTransform rect; private Dictionary pannels = new Dictionary(); public IEnumerable allNodes { get { if (centerNode == null) { return nodes; } return new sMenuNode[1] { centerNode }.Concat(nodes.Where((sMenuNode n) => n != centerNode)); } } public OrderedSet nodes { get; private set; } = new OrderedSet(); public OrderedSet disabledNodes { get; private set; } = new OrderedSet(); public sMenuNode centerNode { get; private set; } public sMenu parrentMenu { get { return _parrentMenu; } private set { _parrentMenu = value; if (value != null) { centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); centerNode.AddListener(sMenuManager.nodeEvent.OnUnpressedSelected, _parrentMenu.Open); } } } public List currentCatagory => catagories[currentCatagoryName]; public string currentCatagoryName => catagories.Keys.ToArray().ElementAt(catagoryIndex); public sMenu(string arg_Name, sMenu arg_ParrentMenu = null) { //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_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_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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown eventMap = new Dictionary { { sMenuManager.menuEvent.OnOpened, OnOpened }, { sMenuManager.menuEvent.WhileOpened, WhileOpened }, { sMenuManager.menuEvent.OnClosed, OnClosed }, { sMenuManager.menuEvent.WhileClosed, WhileClosed }, { sMenuManager.menuEvent.OnSelected, OnSelected }, { sMenuManager.menuEvent.WhileSelected, WhileSelected }, { sMenuManager.menuEvent.OnDeselected, OnDeselected }, { sMenuManager.menuEvent.WhileDeselected, WhileDeselected }, { sMenuManager.menuEvent.OnCatagoryChanged, OnCatagoryChanged } }; radius = sMenuManager.defaultRadius; name = arg_Name; gameObject = new GameObject("sMenu " + name); gameObject.transform.SetParent(sMenuManager.menuParrent.transform); setupCanvas(); centerNode = new sMenuNode(arg_Callback: (arg_ParrentMenu == null) ? new FlexibleMethodDefinition(new Func(Close)) : new FlexibleMethodDefinition(new Action(arg_ParrentMenu.Open)), arg_Name: name, arg_parrentMenu: this).SetTitle((arg_ParrentMenu != null) ? arg_ParrentMenu.name : "Close"); parrentMenu = arg_ParrentMenu; Close(); } internal void UpdateCatagoryByScroll() { if (catagories.Count() == 0) { return; } float axis = Input.GetAxis("Mouse ScrollWheel"); int num = (int)Mathf.Sign(axis); if (axis != 0f) { catagoryIndex += num; if (catagoryIndex >= catagories.Count()) { catagoryIndex = 0; } if (catagoryIndex < 0) { catagoryIndex = catagories.Count() - 1; } SetCatagory(catagories.Keys.ElementAt(catagoryIndex)); } } public void UpdateCatagoryNodes() { if (catagoryIndex >= catagories.Count()) { return; } string text = catagories.Keys.ElementAt(catagoryIndex); centerNode.SetSubtitle("[ " + text + " ]"); if (text.ToLower() == "all") { foreach (sMenuNode node in nodes) { EnableNode(node); } return; } foreach (sMenuNode node2 in nodes) { if (catagories[text].Contains(node2)) { EnableNode(node2); } else { DisableNode(node2); } } } public void SetCatagory(string catagory) { if (!catagories.ContainsKey(catagory)) { return; } centerNode.SetSubtitle("[ " + catagory + " ]"); if (catagory.ToLower() == "all") { foreach (sMenuNode node in nodes) { EnableNode(node); } return; } foreach (sMenuNode node2 in nodes) { if (catagories[catagory].Contains(node2)) { EnableNode(node2); } else { DisableNode(node2); } } catagoryIndex = catagories.Keys.ToList().IndexOf(catagory); UpdatePannelPositions(); OnCatagoryChanged.Invoke(); } public void AddCatagory(string catagory) { if (!catagories.ContainsKey(catagory)) { catagories[catagory] = new List(); } } public void AddNodeToCatagory(string catagory, sMenuNode node) { if (node != null) { if (!catagories.ContainsKey(catagory)) { AddCatagory(catagory); } catagories[catagory].Add(node); } } public void AddNodeToCatagory(string catagory, string nodeName) { sMenuNode node = GetNode(nodeName); if (node != null) { AddNodeToCatagory(catagory, node); } } public void UpdatePosition() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_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_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)sMenuManager.mainCamera).transform.position - RelativePosition; setPosition(position); } public void Update() { if (gameObject.activeInHierarchy) { WhileOpened.Invoke(); } else { WhileClosed.Invoke(); } selectedNode = null; foreach (sMenuNode item in allNodes.Where((sMenuNode n) => n.gameObject.activeInHierarchy).ToList()) { item.Update(); } if (selectedNode != null) { WhileSelected.Invoke(); } else { WhileDeselected.Invoke(); } if (pannelPositionWorkaround < 2) { _UpdatePannelPositions(); } } public void Lateupdate() { UpdatePosition(); FaceCamera(); } public void PreRender() { UpdatePosition(); FaceCamera(); } public sMenu Close() { setVisiblity(visible: false); if (sMenuManager.currentMenu == this) { sMenuManager.currentMenu = null; } OnClosed.Invoke(); return this; } public void Open() { //IL_0056: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) timeOpenedAt = Time.time; frameOpenedAt = Time.frameCount; if (parrentMenu == null) { if (RelativePosition == Vector3.zero) { MoveInfrontOfCamera(); } } else { sMenuNode node = parrentMenu.GetNode(name); SetRelativePosition(((Component)sMenuManager.mainCamera).transform.position - node.gameObject.transform.position); } FaceCamera(); setVisiblity(visible: true); ArrangeNodes(); sMenuManager.previousMenu = sMenuManager.currentMenu; sMenuManager.currentMenu = this; if (sMenuManager.previousMenu != null && sMenuManager.previousMenu != this) { sMenuManager.previousMenu.Close(); } OnOpened.Invoke(); } public sMenuPannel AddPannel(sMenuPannel.Side side, string initialText = "") { if (pannels.ContainsKey(side)) { if (initialText != "") { pannels[side].addLine(initialText); } return pannels[side]; } sMenuPannel sMenuPannel = new sMenuPannel(side, this); if (initialText != "") { sMenuPannel.addLine(initialText); } pannels[side] = sMenuPannel; return sMenuPannel; } public sMenu SetRelativePosition(float x, float y, float z) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return SetRelativePosition(new Vector3(x, y, z)); } public sMenu SetRelativePosition(Vector3 relativePosition) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) RelativePosition = relativePosition; return setPosition(((Component)sMenuManager.mainCamera).transform.position - RelativePosition); } public sMenu ResetRelativePosition(bool setPos = true) { //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_0026: 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_0031: Unknown result type (might be due to invalid IL or missing references) RelativePosition = Vector3.zero; if (setPos && (Object)(object)sMenuManager.mainCamera != (Object)null) { return setPosition(((Component)sMenuManager.mainCamera).transform.position - RelativePosition); } return this; } private void AddDebugVisuals() { //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_003f: 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_0069: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e6: 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_0101: 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) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)canvas == (Object)null) { Debug.LogWarning(Object.op_Implicit("zMenu: Tried to add debug visuals, but canvas is null!")); return; } GameObject val = new GameObject("DebugBackground"); val.transform.SetParent(((Component)canvas).transform, false); ((Graphic)val.AddComponent()).color = new Color(0.5f, 0.5f, 0.5f, 0.5f); RectTransform component = val.GetComponent(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; GameObject val2 = new GameObject("DebugText"); val2.transform.SetParent(((Component)canvas).transform, false); TextMeshPro obj = val2.AddComponent(); ((TMP_Text)obj).text = "Hello from " + name; ((TMP_Text)obj).fontSize = 24f; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((Graphic)obj).color = Color.white; RectTransform component2 = ((Component)obj).GetComponent(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; } private void setupCanvas() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_007a: 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_00aa: 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_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) //IL_00e8: 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) if (!Object.op_Implicit((Object)(object)canvas)) { GameObject val = new GameObject("Canvas"); val.transform.SetParent(gameObject.transform, false); canvas = val.AddComponent(); canvas.renderMode = (RenderMode)2; canvas.worldCamera = Camera.main; val.AddComponent().dynamicPixelsPerUnit = 10f; rect = val.GetComponent(); ((Transform)rect).localPosition = Vector3.zero; ((Transform)rect).localScale = canvasScale; gameObject.transform.position = ((Component)sMenuManager.mainCamera).transform.position + ((Component)sMenuManager.mainCamera).transform.forward * 1f; gameObject.transform.rotation = Quaternion.LookRotation(gameObject.transform.position - ((Component)sMenuManager.mainCamera).transform.position); } } internal void Setsize(float scale) { //IL_0007: 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) ((Transform)rect).localScale = canvasScale * scale; } public sMenu ArrangeNodes() { List list = nodes.Where((sMenuNode n) => n.gameObject.activeInHierarchy).ToList(); float num = 0f; if (rotationalOffset == 0f && list.Count() == 4) { num = 45f; } if (rotationalOffset == 0f && list.Count() == 2) { num = 90f; } float num2 = (rotationalOffset + num) * ((float)Math.PI / 180f); int count = list.Count; if (count != 0) { for (int num3 = 0; num3 < count; num3++) { float num4 = (float)Math.PI * 2f / (float)count * (float)num3 - (float)Math.PI / 2f + num2; float x = radius * Mathf.Cos(num4); float y = (0f - radius) * Mathf.Sin(num4); list[num3].SetPosition(x, y); } } UpdatePannelPositions(); return this; } public sMenu UpdatePannelPositions() { pannelPositionWorkaround = 0; return _UpdatePannelPositions(); } private sMenu _UpdatePannelPositions() { pannelPositionWorkaround++; foreach (sMenuPannel value in pannels.Values) { value.UpdatePosition(); } return this; } public sMenu MoveInfrontOfCamera() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)sMenuManager.mainCamera).transform.position + ((Component)sMenuManager.mainCamera).transform.forward * 1f; return SetRelativePosition(((Component)sMenuManager.mainCamera).transform.position - val); } public sMenu FaceCamera(bool menuOnly = false) { //IL_000b: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = Quaternion.LookRotation(gameObject.transform.position - ((Component)sMenuManager.mainCamera).transform.position); setRotation(rotation); if (!menuOnly) { foreach (sMenuNode allNode in allNodes) { allNode.FaceCamera(); } } return this; } public sMenu setPosition(float x, float y, float z) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return setPosition(new Vector3(x, y, z)); } public sMenu setPosition(Vector3 pos) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) gameObject.transform.position = pos; return this; } public sMenu setLocalPosition(float x, float y, float z) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return setLocalPosition(new Vector3(x, y, z)); } public sMenu setLocalPosition(Vector3 pos) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) gameObject.transform.localPosition = pos; return this; } public sMenu setRotation(Quaternion rot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) gameObject.transform.rotation = rot; return this; } public sMenu AddListener(sMenuManager.menuEvent arg_event, Action arg_method) { return AddListener(arg_event, (FlexibleMethodDefinition)arg_method); } public sMenu AddListener(sMenuManager.menuEvent arg_event, Delegate method, params object[] args) { FlexibleMethodDefinition arg_method = new FlexibleMethodDefinition(method, args); return AddListener(arg_event, arg_method); } public sMenu AddListener(sMenuManager.menuEvent arg_event, FlexibleMethodDefinition arg_method) { if (eventMap.TryGetValue(arg_event, out var value)) { value.Listen(arg_method); } return this; } public sMenu RemoveListener(sMenuManager.menuEvent arg_event, Action arg_method) { if (eventMap.TryGetValue(arg_event, out var value)) { value.Unlisten(arg_method); } return this; } public sMenu RemoveListener(sMenuManager.menuEvent arg_event) { if (eventMap.TryGetValue(arg_event, out var value)) { value.ClearListeners(); } return this; } public sMenu RemoveListener(sMenuManager.menuEvent arg_event, FlexibleMethodDefinition arg_method) { if (eventMap.TryGetValue(arg_event, out var value)) { value.Unlisten(arg_method); } return this; } public sMenu ClearListeners(sMenuManager.menuEvent arg_event) { if (eventMap.TryGetValue(arg_event, out var value)) { value.ClearListeners(); } return this; } public void DisableNode(sMenuNode node) { if (!disabledNodes.Contains(node)) { disabledNodes.Add(node); node.gameObject.SetActive(false); ArrangeNodes(); } } public void DisableNode(sMenu menu) { sMenuNode sMenuNode = nodes.FirstOrDefault((sMenuNode n) => n.text == menu.centerNode.text); if (sMenuNode != null) { DisableNode(sMenuNode); } } public void DisableNode(string nodeText) { sMenuNode sMenuNode = nodes.FirstOrDefault((sMenuNode n) => n.text == nodeText); if (sMenuNode != null) { DisableNode(sMenuNode); } } public void EnableNode(sMenuNode node) { if (disabledNodes.Contains(node)) { disabledNodes.Remove(node); node.gameObject.SetActive(true); ArrangeNodes(); } } public void EnableNode(string nodeText) { sMenuNode sMenuNode = disabledNodes.FirstOrDefault((sMenuNode n) => n.text == nodeText); if (sMenuNode != null) { EnableNode(sMenuNode); } } public void EnableNode(sMenu menu) { sMenuNode sMenuNode = disabledNodes.FirstOrDefault((sMenuNode n) => n.text == menu.centerNode.text); if (sMenuNode != null) { EnableNode(sMenuNode); } } public sMenuNode AddNode(sMenu menu) { FlexibleMethodDefinition callback = new FlexibleMethodDefinition(new Action(menu.Open)); menu.parrentMenu = this; return AddNode(menu.name, callback); } public sMenuNode AddNode(string arg_Name) { Action arg_callback = null; return AddNode(arg_Name, arg_callback); } public sMenuNode AddNode(string arg_Name, Delegate method, params object[] args) { FlexibleMethodDefinition callback = new FlexibleMethodDefinition(method, args); return AddNode(arg_Name, callback); } public sMenuNode AddNode(string arg_Name, Action arg_callback) { FlexibleMethodDefinition callback = new FlexibleMethodDefinition(arg_callback); return AddNode(arg_Name, callback); } public sMenuNode AddNode(string arg_Name, FlexibleMethodDefinition callback) { sMenuNode sMenuNode = new sMenuNode(arg_Name, this, callback); RegisterNode(sMenuNode); ArrangeNodes(); return sMenuNode; } public sMenuNode GetNode() { return parrentMenu.GetNode(this); } public sMenuNode GetNode(sMenu menu) { if (menu.parrentMenu != this) { return null; } return GetNode(menu.centerNode.text); } public sMenuNode GetNode(string nodeName) { foreach (sMenuNode allNode in allNodes) { if (allNode.text == nodeName) { return allNode; } } return null; } public sMenu RegisterNode(sMenuNode node) { nodes.Add(node); return this; } public sMenu setVisiblity(bool visible) { gameObject.SetActive(visible); return this; } public Color getTextColor() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return textColor; } public Canvas getCanvas() { return canvas; } public void setNodeSize(float size) { foreach (sMenuNode node in nodes) { node.SetSize(size); } } public Rect GetNodeBounds() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_00e3: 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_0103: 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_01fd: 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_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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_019c: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; float num2 = float.MaxValue; float num3 = float.MinValue; float num4 = float.MinValue; foreach (sMenuNode allNode in allNodes) { Transform transform = allNode.gameObject.transform; Vector3 localScale = transform.localScale; transform.localScale = Vector3.one * sMenuManager.selectedNodeSizeMultiplier; foreach (RectTransform componentsInChild in allNode.gameObject.GetComponentsInChildren()) { Rect val = componentsInChild.rect; Vector3[] array = (Vector3[])(object)new Vector3[4] { new Vector3(((Rect)(ref val)).xMin, ((Rect)(ref val)).yMin, 0f), new Vector3(((Rect)(ref val)).xMax, ((Rect)(ref val)).yMin, 0f), new Vector3(((Rect)(ref val)).xMax, ((Rect)(ref val)).yMax, 0f), new Vector3(((Rect)(ref val)).xMin, ((Rect)(ref val)).yMax, 0f) }; for (int i = 0; i < 4; i++) { Vector3 val2 = ((Transform)componentsInChild).TransformPoint(array[i]); Vector3 val3 = gameObject.transform.InverseTransformPoint(val2); val3.x /= ((Component)canvas).transform.localScale.x; val3.y /= ((Component)canvas).transform.localScale.y; val3.z /= ((Component)canvas).transform.localScale.z; num = Mathf.Min(num, val3.x); num3 = Mathf.Max(num3, val3.x); num2 = Mathf.Min(num2, val3.y); num4 = Mathf.Max(num4, val3.y); } } transform.localScale = localScale; } return Rect.MinMaxRect(num, num2, num3, num4); } } public static class sMenuManager { public enum nodeEvent { OnPressed, WhilePressed, OnUnpressed, WhileUnpressed, OnSelected, WhileSelected, OnDeselected, WhileDeselected, OnDoubleTapped, OnTapped, OnHeld, WhileHeld, OnHeldImmediate, OnUnpressedSelected, OnHeldSelected, WhileHeldSelected, OnHeldImmediateSelected, OnTappedExclusive } public enum menuEvent { OnOpened, WhileOpened, OnClosed, WhileClosed, OnSelected, WhileSelected, OnDeselected, WhileDeselected, OnCatagoryChanged } public static GameObject menuParrent; private static bool playerInControll = false; private static Texture2D _defaultBackgroundImage; public static KeyCode keybinding = (KeyCode)120; private static sMenu.sMenuNode selectedNode; public static Camera mainCamera; public static string defaultColorHex = ColorUtility.ToHtmlStringRGB(defaultColor); public static string defaultEnabledColorHex = ColorUtility.ToHtmlStringRGB(defaultEnabledColor); public static string defaultDisabledColorHex = ColorUtility.ToHtmlStringRGB(defaultDisabledColor); internal static bool pressable; internal static sMenu.sMenuNode pressedNode; internal static float selectedNodeSizeMultiplier = 1.5f; internal static float menuSizeScaler = 1f; private static float angleTollerance = 45f; private static float nodeAngleTollerance = 10f; internal static float pannelBuffer = 1f; private static bool menuWasOpenOnLastFrame = false; public static HashSet menus { get; private set; } = new HashSet(); public static Texture2D DefaultBackgroundImage { get { if ((Object)(object)_defaultBackgroundImage == (Object)null) { _defaultBackgroundImage = CreateBackgroundImage(); } return _defaultBackgroundImage; } set { _defaultBackgroundImage = value; } } public static sMenu mainMenu { get; private set; } public static sMenu currentMenu { get; internal set; } public static sMenu previousMenu { get; internal set; } public static Color defaultColor { get; private set; } = new Color(0.2f, 0.2f, 0.2f, 1f); public static Color defaultEnabledColor { get; private set; } = new Color(0.2f, 0.2f, 0.2f, 1f); public static Color defaultDisabledColor { get; private set; } = new Color(0.25f, 0f, 0f); public static float defaultFontSize { get; private set; } = 100f; public static float defaultRadius { get; private set; } = 100f; private static bool menuOpen => currentMenu != null; public static sMenu createMenu(string name, sMenu parrentMenu = null, bool autoAddNode = true) { sMenu sMenu2 = new sMenu(name, parrentMenu); if (parrentMenu == null) { sMenu2.centerNode.ClearListeners(nodeEvent.OnUnpressedSelected); sMenu2.centerNode.AddListener(nodeEvent.OnUnpressedSelected, CloseAllMenus); } else if (autoAddNode) { parrentMenu.AddNode(sMenu2); } sMenu2.centerNode.AddListener(nodeEvent.WhileSelected, sMenu2.UpdateCatagoryByScroll); registerMenu(sMenu2); return sMenu2; } public static sMenu registerMenu(sMenu menu) { menus.Add(menu); return menu; } public static void ClearMenus() { menus.Clear(); } public static void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0076: 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) playerInControll = (int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12 || (int)FocusStateManager.CurrentState == 6; if (!playerInControll) { return; } if ((Object)(object)mainCamera == (Object)null) { zMenus.CreateMenus(); } if (menuOpen) { menuWasOpenOnLastFrame = true; currentMenu.Update(); } else { if (menuWasOpenOnLastFrame && (int)FocusStateManager.CurrentState == 6) { FocusStateManager.ChangeState(FocusStateManager.PreviousState, false); } menuWasOpenOnLastFrame = false; } if (Input.GetKey(keybinding)) { if (pressable) { if (!menuOpen) { FocusStateManager.ChangeState((eFocusState)6, false); mainMenu.Open(); } else if (selectedNode != null) { pressedNode = selectedNode; pressedNode.Press(); } } else if (pressedNode != null) { pressedNode.Pressing(); } pressable = false; } else { pressable = true; if (pressedNode != null) { pressedNode.Unpress(); } pressedNode = null; } } public static void CloseAllMenus() { pressedNode = null; foreach (sMenu menu in menus) { menu.ResetRelativePosition(); menu.Close(); } } public static void LateUpdate() { if (playerInControll && menuOpen) { currentMenu.Lateupdate(); } } public static void PreRender() { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) if (!playerInControll || !menuOpen) { return; } currentMenu.PreRender(); Dictionary dictionary = new Dictionary(currentMenu.nodes.Count + 1); foreach (sMenu.sMenuNode item in currentMenu.allNodes.Where((sMenu.sMenuNode n) => n.gameObject.activeInHierarchy).ToList()) { dictionary[item.gameObject] = item; } List candidates = dictionary.Keys.ToList(); GameObject closestObjectInLookDirection = GetClosestObjectInLookDirection(((Component)mainCamera).transform, candidates, nodeAngleTollerance * menuSizeScaler); selectedNode = null; if ((Object)(object)closestObjectInLookDirection != (Object)null) { dictionary.TryGetValue(closestObjectInLookDirection, out selectedNode); } foreach (sMenu.sMenuNode value in dictionary.Values) { if (value == selectedNode && !value.selected) { value.Select(); } if (value != selectedNode && value.selected) { value.Deselect(); } } if ((Object)(object)closestObjectInLookDirection == (Object)null) { Vector3 val = currentMenu.gameObject.transform.position - ((Component)mainCamera).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (Vector3.Angle(((Component)mainCamera).transform.forward, normalized) > angleTollerance * menuSizeScaler) { CloseAllMenus(); } else if ((Object)(object)GetClosestObjectInLookDirection(((Component)mainCamera).transform, candidates, nodeAngleTollerance * menuSizeScaler * 2f) == (Object)null) { CloseAllMenus(); } } } public static void SetupCamera() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown mainCamera = Camera.main; ((Component)mainCamera).gameObject.AddComponent().onPreRender.Listen(PreRender); menuParrent = new GameObject("menus"); mainMenu = new sMenu("Main"); mainMenu.centerNode.AddListener(nodeEvent.OnUnpressedSelected, CloseAllMenus); registerMenu(mainMenu); } public static void ClearAllMenus() { CloseAllMenus(); menus.Clear(); mainCamera = null; Object.Destroy((Object)(object)menuParrent); SetupCamera(); } public static sMenu GetMenu(string menuName) { foreach (sMenu menu in menus) { if (menu.centerNode.text.Contains(menuName)) { return menu; } } return null; } public static void SetMenusScale(float scale) { foreach (sMenu menu in menus) { menu.Setsize(scale); } } public static GameObject GetClosestObjectInLookDirection(Transform baseTransform, List candidates, float maxAngle = 180f, Vector3? candidateOffset = null, Vector3? baseOffset = null) { //IL_0017: 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_0039: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00e5: 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_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_0102: 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_010b: 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_0112: 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) candidateOffset = (Vector3)(((??)candidateOffset) ?? Vector3.zero); baseOffset = (Vector3)(((??)baseOffset) ?? Vector3.zero); if ((Object)(object)baseTransform == (Object)null || candidates == null || candidates.Count == 0) { return null; } Vector3 val = baseTransform.position; Vector3? val2 = baseOffset; Vector3 value = (val2.HasValue ? new Vector3?(val + val2.GetValueOrDefault()) : ((Vector3?)null)).Value; Vector3 forward = baseTransform.forward; GameObject val3 = null; float num = maxAngle; foreach (GameObject candidate in candidates) { if (!((Object)(object)candidate == (Object)null)) { val = candidate.transform.position; val2 = candidateOffset; val = (val2.HasValue ? new Vector3?(val + val2.GetValueOrDefault()) : ((Vector3?)null)).Value - value; Vector3 normalized = ((Vector3)(ref val)).normalized; float num2 = Vector3.Angle(forward, normalized); if (num2 < num) { num = num2; val3 = candidate; } } } if ((Object)(object)val3 != (Object)null && num <= maxAngle) { return val3; } return null; } private static Texture2D CreateBackgroundImage(int size = 512, Color? color = null) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_000b: 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_0137: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_010a: 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) if (!color.HasValue) { color = Color.black; } float num = 0.9f; float num2 = 0f; new Color(color.Value.r, color.Value.g, color.Value.b, 0.75f); Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[size * size]; float num3 = (float)size / 2f; float num4 = 5f; float num5 = num3 - num4; float num6 = num5 * num5; Color val2 = default(Color); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num7 = (float)j - num3 + 0.5f; float num8 = (float)i - num3 + 0.5f; float num9 = num7 * num7 + num8 * num8; if (num9 <= num6) { float num10 = Mathf.Sqrt(num9); float num11 = Mathf.Lerp(num, num2, num10 / num5); ((Color)(ref val2))..ctor(color.Value.r, color.Value.g, color.Value.b, num11); array[i * size + j] = Color32.op_Implicit(val2); } else { array[i * size + j] = Color32.op_Implicit(new Color(0f, 0f, 0f, 0f)); } } } val.SetPixels32(Il2CppStructArray.op_Implicit(array)); val.Apply(); return val; } } public static class sMenus { public static void CreateMenus() { sMenuManager.createMenu("TestMenu 1", sMenuManager.mainMenu).AddPannel(sMenu.sMenuPannel.Side.left, "Test1"); sMenuManager.createMenu("TestMenu 2", sMenuManager.mainMenu); sMenuManager.createMenu("TestMenu 3", sMenuManager.mainMenu).GetNode().AddHoverText(sMenu.sMenuPannel.Side.right, "This is test"); } } public class slideMenuUpdater : MonoBehaviour { public static FlexibleEvent onUpdate = new FlexibleEvent(); public static FlexibleEvent onLateUpdate = new FlexibleEvent(); public static slideMenuUpdater Instance; public FlexibleEvent onPreRender = new FlexibleEvent(); private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)this); } else { Instance = this; } } private void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { OnPreRender(); } public static void CreateInstance() { if ((Object)(object)Instance == (Object)null) { Camera main = Camera.main; if ((Object)(object)main == (Object)null) { Debug.LogError(Object.op_Implicit("No main camera found for slideMenuUpdater!")); } else { Instance = ((Component)main).gameObject.AddComponent(); } } } private void Update() { sMenuManager.Update(); onUpdate?.Invoke(); } private void LateUpdate() { sMenuManager.LateUpdate(); onLateUpdate?.Invoke(); } public static void InvokeStatic(FlexibleMethodDefinition method, float time) { if ((Object)(object)Instance == (Object)null) { CreateInstance(); } MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)Instance, Instance.InvokeDelayed(method, time)); } private IEnumerator InvokeDelayed(FlexibleMethodDefinition method, float time) { yield return (object)new WaitForSeconds(time); method.method.DynamicInvoke(method.args); } private void OnPreRender() { sMenuManager.PreRender(); onPreRender?.Invoke(); } } } namespace SlideDrum { public class OrderedSet : IEnumerable, IEnumerable { private readonly List _list = new List(); private readonly Dictionary _dict = new Dictionary(); public int Count => _list.Count; public T this[int index] => _list[index]; public bool Add(T item, bool first = false) { if (_dict.ContainsKey(item)) { return false; } if (first) { _list.Insert(0, item); for (int i = 0; i < _list.Count; i++) { _dict[_list[i]] = i; } } else { _list.Add(item); _dict[item] = _list.Count - 1; } return true; } public bool Remove(T item) { if (!_dict.TryGetValue(item, out var value)) { return false; } _dict.Remove(item); _list.RemoveAt(value); for (int i = value; i < _list.Count; i++) { _dict[_list[i]] = i; } return true; } public void Clear() { _list.Clear(); _dict.Clear(); } public bool Enqueue(T item) { return Add(item); } public bool Insert(T newItem, T currentItem, bool before) { if (!_dict.TryGetValue(currentItem, out var value)) { throw new ArgumentException("currentItem is not present in the set.", "currentItem"); } if (_dict.ContainsKey(newItem)) { return false; } int num = (before ? value : (value + 1)); _list.Insert(num, newItem); for (int i = num; i < _list.Count; i++) { _dict[_list[i]] = i; } return true; } public T Dequeue() { if (_list.Count == 0) { throw new InvalidOperationException("The OrderedSet is empty."); } T val = _list[0]; Remove(val); return val; } public T Peek() { if (_list.Count == 0) { throw new InvalidOperationException("The OrderedSet is empty."); } return _list[0]; } public bool Contains(T item) { return _dict.ContainsKey(item); } public IEnumerator GetEnumerator() { return _list.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _list.GetEnumerator(); } public List ToList() { return new List(_list); } } public interface IOverrideTree { uint treeID { get; } string identifier { get; } bool IsDefaultValue(string key); bool IHasDefault(string key); bool IMatchingDefaultValue(string key); bool IHasKey(string key); bool IHasValue(string key); bool IHasParrent(string key); object? IGetValue(string key); object? IValueAt(string key); object? IGetDefaultValue(string key); bool AllDefault(IEnumerable keys); } public class OverrideTree : IOverrideTree { public class FallbackLink { public Node Target { get; } public int? MaxDepth { get; } public FallbackLink(Node target, int? maxDepth = null) { Target = target ?? throw new ArgumentNullException("target"); MaxDepth = maxDepth; } } public class Node { public FlexibleEvent onChanged = new FlexibleEvent(); public FlexibleEvent onThisNodeChanged = new FlexibleEvent(); public uint nodeID { get; private set; } public string nodeIdentity { get; private set; } public T? Value { get; set; } private bool hasDefaultValue { get; } private T? _DefaultValue { get; } public T? DefaultValue { get { if (hasDefaultValue) { return _DefaultValue; } if (Parent != null) { return Parent.DefaultValue; } return default(T); } } public T? InitalValue { get; } public Func? Condition { get; } public bool IsRoot => Parent == null; public Node? Parent { get; private set; } public OverrideTree Tree { get; internal set; } public List Children { get; } = new List(); public List Fallbacks { get; } = new List(); internal Node(string key, Node parent = null, T? value = default(T?), Func? condition = null, T? defaultValue = default(T?), bool hasDefaultValue = false) { if (defaultValue != null) { hasDefaultValue = true; } nodeIdentity = key; Value = value; Condition = condition; Parent = parent; InitalValue = value; _DefaultValue = defaultValue; nodeID = OverrideTree.HashString(GetNodeTreeString()); this.hasDefaultValue = hasDefaultValue; } public T? GetValue() { T result = ValueAt(); foreach (Node child in Children) { if (child.Condition == null || child.Condition()) { T value = child.GetValue(); if (value != null) { result = value; } } } return result; } public void AddFallback(Node target, int? maxDepth = null) { if (target == null) { throw new ArgumentNullException("target"); } Fallbacks.Add(new FallbackLink(target, maxDepth)); } public bool RemoveFallback(Node target, int? maxDepth = null, bool matchMaxDepth = false) { if (target == null) { throw new ArgumentNullException("target"); } for (int i = 0; i < Fallbacks.Count; i++) { FallbackLink fallbackLink = Fallbacks[i]; if (fallbackLink.Target == target && (!matchMaxDepth || fallbackLink.MaxDepth == maxDepth)) { Fallbacks.RemoveAt(i); return true; } } return false; } public T? ValueAt() { if (Value != null) { return Value; } foreach (FallbackLink fallback in Fallbacks) { T val = ResolveFallbackValue(fallback, new HashSet()); if (val != null) { return val; } } if (Parent == null) { throw new InvalidOperationException("Root node has null value."); } return Parent.ValueAt(); } private T? ResolveFallbackValue(FallbackLink link, HashSet visited) { return ResolveFallbackNode(link.Target, link.MaxDepth, visited); } private T? ResolveFallbackNode(Node node, int? maxDepth, HashSet visited) { if (node == null) { return default(T); } if (!visited.Add(node)) { return default(T); } if (node.Value != null) { return node.Value; } if (maxDepth == 0) { return default(T); } int? budget = (maxDepth.HasValue ? new int?(maxDepth.Value - 1) : ((int?)null)); foreach (FallbackLink fallback in node.Fallbacks) { int? maxDepth2 = CombineMaxDepth(budget, fallback.MaxDepth); T val = ResolveFallbackNode(fallback.Target, maxDepth2, visited); if (val != null) { return val; } } return default(T); } private static int? CombineMaxDepth(int? budget, int? linkMaxDepth) { if (!budget.HasValue) { return linkMaxDepth; } if (!linkMaxDepth.HasValue) { return budget; } return Math.Min(budget.Value, linkMaxDepth.Value); } public void SetValue(T? newValue) { HashSet hashSet = OnChanged(); Value = newValue; onThisNodeChanged.Invoke(); foreach (FlexibleEvent item in hashSet) { item.Invoke(); } } private HashSet OnChanged(bool fromParrent = false, HashSet callList = null) { if (callList == null) { callList = new HashSet(); } if (Value != null && fromParrent) { return callList; } callList.Add(onChanged); foreach (Node child in Children) { child.OnChanged(fromParrent: true, callList); } return callList; } public bool HasValue() { return Value != null; } public bool HasParrent() { return Parent != null; } public bool HasDefault() { return hasDefaultValue; } public bool MatchingDefaultValue() { if (!HasValue()) { return true; } if (hasDefaultValue && DefaultValue != null) { return EqualityComparer.Default.Equals(DefaultValue, Value); } if (Parent == null) { return IsDefaultValue(); } return EqualityComparer.Default.Equals(Parent.ValueAt(), Value); } public bool IsDefaultValue() { if (!HasValue()) { return true; } return EqualityComparer.Default.Equals(DefaultValue, Value); } internal string GetNodeTreeString() { if (Parent == null) { return nodeIdentity; } return Parent.GetNodeTreeString() + "/" + nodeIdentity; } } internal static Dictionary> Trees = new Dictionary>(); private uint treeID; private string identifier = "DefaultIdent"; public Type type; public Dictionary nodesByID { get; private set; } = new Dictionary(); public Dictionary nodes { get; private set; } = new Dictionary(StringComparer.Ordinal); public Node rootNode { get; private set; } string IOverrideTree.identifier => identifier; uint IOverrideTree.treeID => treeID; public static uint HashString(string str) { uint num = 2166136261u; for (int i = 0; i < str.Length; i++) { num ^= str[i]; num *= 16777619; } return num; } public static void ResetTrees() { Trees.Clear(); } public OverrideTree(T rootValue, string identifier, string rootKey = "Default", FlexibleMethodDefinition OnChanged = null) { this.identifier = identifier; treeID = HashString(identifier); Trees[treeID] = this; if (rootValue == null) { throw new ArgumentNullException("rootValue", "Initial value can not be null"); } rootNode = new Node(rootKey, null, rootValue, null, rootValue); nodes[rootKey] = rootNode; nodesByID[0u] = rootNode; if (OnChanged != null) { rootNode.onChanged.Listen(OnChanged); } type = typeof(T); } public static OverrideTree GetTreeFromID(uint ID) { return Trees[ID]; } public Node GetNodeFromIdent(string ident) { if (!nodes.ContainsKey(ident)) { throw new KeyNotFoundException("ident"); } return nodes[ident]; } public Node GetNodeFromId(uint id) { return nodesByID[id]; } public Node AddNode(string key, T? value, string? parent = null, Func? condition = null, FlexibleMethodDefinition onChanged = null, T? defaultValue = default(T?), bool hasDefaultValue = false) { if (defaultValue != null) { hasDefaultValue = true; } Node parent2 = null; if (parent != null) { if (!nodes.ContainsKey(parent)) { throw new KeyNotFoundException("Could not find parrent named " + parent + " when adding node " + key); } parent2 = nodes[parent]; } return AddNode(key, value, parent2, condition, onChanged, defaultValue, hasDefaultValue); } public Node AddNode(string key, T? value, Node? parent = null, Func? condition = null, FlexibleMethodDefinition onChanged = null, T? defaultValue = default(T?), bool hasDefaultValue = false) { if (defaultValue != null) { hasDefaultValue = true; } if (nodes.ContainsKey(key)) { if (parent == null) { throw new InvalidOperationException("Key '" + key + "' already in use."); } throw new InvalidOperationException($"Key '{key}' already in use. Consider combineing with the parrent key for '{parent.nodeIdentity}/{key}'"); } if (parent == null) { parent = rootNode; } if (!nodes.Values.Contains(parent)) { throw new InvalidOperationException("Parent '" + parent.nodeIdentity + "' not found."); } Node node = new Node(key, parent, value, condition, defaultValue, hasDefaultValue); parent.Children.Add(node); nodes[key] = node; nodesByID[node.nodeID] = node; node.Tree = this; if (onChanged != null) { node.onChanged.Listen(onChanged); } return node; } public OverrideTree AddFallback(string key, string targetKey, int? maxDepth = null) { AddFallback(NodeAt(key), GetNodeFromIdent(targetKey), maxDepth); return this; } public Node AddFallback(Node node, Node target, int? maxDepth = null) { node.AddFallback(target, maxDepth); return node; } public bool RemoveFallback(string key, string targetKey, int? maxDepth = null, bool matchMaxDepth = false) { return RemoveFallback(NodeAt(key), GetNodeFromIdent(targetKey), maxDepth, matchMaxDepth); } public bool RemoveFallback(Node node, Node target, int? maxDepth = null, bool matchMaxDepth = false) { return node.RemoveFallback(target, maxDepth, matchMaxDepth); } public T? SetValue(uint nodeID, T? value, ulong netSender = 0uL) { if (!nodesByID.ContainsKey(nodeID)) { Debug.Log(Object.op_Implicit($"Tried to set unknown nodeID '{nodeID}' in '{treeID} ({identifier}) to '{value}' via netSender {netSender} ")); return default(T); } Node node = nodesByID[nodeID]; Debug.Log(Object.op_Implicit($"Setting value of node by ID '{nodeID}' ({node.GetNodeTreeString()}) in tree {treeID} ({identifier}) to '{value}' (netSender: {netSender})")); return SetValue(nodesByID[nodeID].nodeIdentity, value, netSender); } public T? ResetToDefault(string key, ulong netSender = 0uL) { if (!nodes.ContainsKey(key)) { Debug.Log(Object.op_Implicit($"Tried to reset unknown key '{key}' in '{treeID} ({identifier}) to default via netSender {netSender} ")); return default(T); } Node node = nodes[key]; return SetValue(key, node.DefaultValue, netSender); } public T? SetValue(string key, T? value, ulong netSender = 0uL) { T val; if (!nodes.ContainsKey(key)) { Debug.Log(Object.op_Implicit($"Tried to set unknown key '{key}' in '{treeID} ({identifier}) to '{value}' via netSender {netSender} ")); val = default(T); return val; } Node node = nodes[key]; Debug.Log(Object.op_Implicit($"Setting value of node by key '{node.GetNodeTreeString()}' ({node.nodeID}) in tree {treeID} ({identifier}) to '{value}' (netSender: {netSender})")); node.SetValue(value); if (netSender == 0L) { object obj; switch (Type.GetTypeCode(Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T))) { case TypeCode.Boolean: { pStructs.pBoolOverideTreeInfo pBoolOverideTreeInfo = new pStructs.pBoolOverideTreeInfo { treeID = treeID, keyId = node.nodeID }; if (value == null) { pBoolOverideTreeInfo.value = false; pBoolOverideTreeInfo.isNull = true; } else { if (!(value is bool)) { throw new InvalidCastException($"Expected bool value for key '{key}', but got {value.GetType().Name}."); } object obj4 = value; bool value4 = (bool)((obj4 is bool) ? obj4 : null); pBoolOverideTreeInfo.value = value4; pBoolOverideTreeInfo.isNull = false; } NetworkAPI.InvokeEvent("SetBoolOverideTree", pBoolOverideTreeInfo, (SNet_ChannelType)2); break; } case TypeCode.Int32: { pStructs.pIntOverideTreeInfo pIntOverideTreeInfo = new pStructs.pIntOverideTreeInfo { treeID = treeID, keyId = node.nodeID }; if (value == null) { pIntOverideTreeInfo.value = 0; pIntOverideTreeInfo.isNull = true; } else { if (!(value is int)) { throw new InvalidCastException($"Expected int value for key '{key}', but got {value.GetType().Name}."); } object obj2 = value; int value2 = (int)((obj2 is int) ? obj2 : null); pIntOverideTreeInfo.value = value2; pIntOverideTreeInfo.isNull = false; } NetworkAPI.InvokeEvent("SetIntOverideTree", pIntOverideTreeInfo, (SNet_ChannelType)2); break; } case TypeCode.Single: { pStructs.pFloatOverideTreeInfo pFloatOverideTreeInfo = new pStructs.pFloatOverideTreeInfo { treeID = treeID, keyId = node.nodeID }; if (value == null) { pFloatOverideTreeInfo.value = 0f; pFloatOverideTreeInfo.isNull = true; } else { if (!(value is float)) { throw new InvalidCastException($"Expected float value for key '{key}', but got {value.GetType().Name}."); } object obj3 = value; float value3 = (float)((obj3 is float) ? obj3 : null); pFloatOverideTreeInfo.value = value3; pFloatOverideTreeInfo.isNull = false; } NetworkAPI.InvokeEvent("SetFloatOverideTree", pFloatOverideTreeInfo, (SNet_ChannelType)2); break; } default: { ref T reference = ref value; val = default(T); if (val == null) { val = reference; reference = ref val; if (val == null) { obj = null; goto IL_0492; } } obj = reference.GetType().Name; goto IL_0492; } IL_0492: if (obj == null) { obj = "null"; } Debug.Log(Object.op_Implicit("set unusual type (" + (string?)obj + ") in override tree.")); break; } } return ValueAt(key); } public T? GetValue() { return rootNode.GetValue(); } public T? GetValue(string key = null) { if (key == null) { return rootNode.GetValue(); } return NodeAt(key).GetValue(); } public T? ValueAt(string key, bool shouldthrow = true) { return NodeAt(key, shouldthrow).ValueAt(); } public bool HasParrent(string key) { return NodeAt(key).HasParrent(); } public bool HasParrentAndValue(string key) { if (HasParrent(key)) { return HasValue(key); } return false; } public bool HasKey(string key) { return nodes.ContainsKey(key); } public bool HasValue(string key) { if (HasKey(key)) { return GetNodeFromIdent(key).HasValue(); } return false; } public bool MatchingDefaultValue(string key) { return NodeAt(key).MatchingDefaultValue(); } public bool IsDefaultValue(string key) { return NodeAt(key).IsDefaultValue(); } public bool HasDefault(string key) { return NodeAt(key).HasDefault(); } private Node NodeAt(string key, bool shouldThrow = true) { if (!nodes.ContainsKey(key)) { if (shouldThrow) { throw new KeyNotFoundException("key"); } return null; } return nodes[key]; } public bool AllDefault(IEnumerable keys) { foreach (string key in keys) { if (!IsDefaultValue(key)) { return false; } } return true; } public T GetDefaultValue(string key) { return NodeAt(key).DefaultValue; } public object IGetDefaultValue(string key) { return GetDefaultValue(key); } public object IValueAt(string key) { return ValueAt(key); } public object IGetValue(string key) { return GetValue(key); } public bool IHasValue(string key) { return HasValue(key); } public bool IHasKey(string key) { return HasKey(key); } public bool IMatchingDefaultValue(string key) { return MatchingDefaultValue(key); } public bool IHasParrent(string key) { return HasParrent(key); } public bool IHasDefault(string key) { return HasDefault(key); } } } namespace SlideDrum.sInputSystem { public struct sInputEvent { public float Time; public bool Pressed; public KeyCode Key; public sInputEvent(KeyCode Key, float Time, bool Pressed) { //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) this.Key = Key; this.Time = Time; this.Pressed = Pressed; } public override string ToString() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) string value = (Pressed ? "Pressed" : "Unpressed"); return $"{Key} {value} at {Time}"; } } public static class sInputSystem { private static Dictionary WasKeyHeldOnThePreviousFrame = new Dictionary(); private static int LenthOfSequenceDefinitionsWhenKeyCodesWasLastUpdates = 0; private static HashSet _KeyCodes; private static List SequenceDefinitions = new List(); private static HashSet KeyCodes { get { if (_KeyCodes == null || LenthOfSequenceDefinitionsWhenKeyCodesWasLastUpdates != SequenceDefinitions.Count) { if (_KeyCodes == null) { _KeyCodes = new HashSet(); } else { _KeyCodes.Clear(); } foreach (sSequenceDefinition sequenceDefinition in SequenceDefinitions) { _KeyCodes.UnionWith(sequenceDefinition.KeyCodes); } LenthOfSequenceDefinitionsWhenKeyCodesWasLastUpdates = SequenceDefinitions.Count; } return _KeyCodes; } } public static void AddListener(sSequenceDefinition newSequenceDefinition, FlexibleMethodDefinition callback = null, KeyCode? Key = null) { //IL_0016: 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: Expected O, but got Unknown if (callback != null) { newSequenceDefinition.Callback = callback; } if (Key.HasValue) { newSequenceDefinition.SetKeyCode(Key.Value); } SequenceDefinitions.Add(newSequenceDefinition); if (newSequenceDefinition.Callback == null) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(78, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Created a keypress sequence listener with no callback! \""); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(newSequenceDefinition); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\" Nothing will happen!"); } log.LogWarning(val); } } public static void Update() { //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_001b: 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_0051: 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_0062: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; foreach (KeyCode keyCode in KeyCodes) { bool key = Input.GetKey(keyCode); bool value; bool flag = !WasKeyHeldOnThePreviousFrame.TryGetValue(keyCode, out value); bool num = key && (!value || flag); bool flag2 = !key && (value || flag); if (num) { sTimeline.Add(new sInputEvent(keyCode, time, Pressed: true)); } if (flag2) { sTimeline.Add(new sInputEvent(keyCode, time, Pressed: false)); } WasKeyHeldOnThePreviousFrame[keyCode] = key; } EvaluateDefinitions(sTimeline.KeyPressRefrences); } private static void EvaluateDefinitions(List Refrences) { for (int i = 0; i < SequenceDefinitions.Count; i++) { sSequenceDefinition sSequenceDefinition2 = SequenceDefinitions[i]; if (sSequenceDefinition2.Matches(Refrences)) { sSequenceDefinition2.Callback.Invoke(); } } } } public static class sInputSystemDefaults { public const float TapThreshold = 0.25f; public static sKeyPressDefinition Press => new sKeyPressDefinition(null, Pressed: true, null, "Press"); public static sKeyPressDefinition ShortPress => new sKeyPressDefinition(null, Pressed: true, null, "ShortPress", 0.25f); public static sKeyPressDefinition LongPress => new sKeyPressDefinition(null, Pressed: true, null, "LongPress", float.MaxValue, 0.25f); public static sKeyPressDefinition Unpressed => new sKeyPressDefinition(null, Pressed: false, null, "Unpressed"); public static sKeyPressDefinition LongUnpressed => new sKeyPressDefinition(null, Pressed: false, null, "LongUnpressed", float.MaxValue, 0.25f); public static sKeyPressDefinition VeryLongUnpressed => new sKeyPressDefinition(null, Pressed: false, null, "VeryLongUnpressed", float.MaxValue, 1f); public static sKeyPressDefinition ShortUnpressed => new sKeyPressDefinition(null, Pressed: false, null, "ShortUnpressed", 0.25f); public static sSequenceDefinition OnTapped => new sSequenceDefinition(new sKeyPressDefinition[2] { ShortPress, Unpressed }, null, Strict: false, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnTapped"); public static sSequenceDefinition OnTappedExclusive => new sSequenceDefinition(new sKeyPressDefinition[2] { LongUnpressed, ShortPress }, null, Strict: true, RisingEdgeOnly: true, 0.25f, ExclusiveSelf: true, "OnTappedExclusive"); public static sSequenceDefinition OnHold => new sSequenceDefinition(new sKeyPressDefinition[2] { LongPress, Unpressed }, null, Strict: false, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnHold"); public static sSequenceDefinition OnHoldImmediate => new sSequenceDefinition(new sKeyPressDefinition[1] { LongPress }, null, Strict: false, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnHoldImmediate"); public static sSequenceDefinition OnHoldImmediateExclusive => new sSequenceDefinition(new sKeyPressDefinition[2] { LongUnpressed, LongPress }, null, Strict: true, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnHoldImmediateExclusive"); public static sSequenceDefinition OnDoubleTappedExclusive => new sSequenceDefinition(new sKeyPressDefinition[4] { LongUnpressed, ShortPress, ShortUnpressed, ShortPress }, null, Strict: true, RisingEdgeOnly: true, 0.25f, ExclusiveSelf: true, "OnDoubleTapped"); public static sSequenceDefinition OnTapAndHold => new sSequenceDefinition(new sKeyPressDefinition[3] { ShortPress, LongPress, Unpressed }, null, Strict: false, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnTapAndHold"); public static sSequenceDefinition OnTapAndHoldExclusive => new sSequenceDefinition(new sKeyPressDefinition[4] { LongUnpressed, ShortPress, LongPress, Unpressed }, null, Strict: false, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnTapAndHoldExclusive"); public static sSequenceDefinition OnTapAndHoldImmediateExclusive => new sSequenceDefinition(new sKeyPressDefinition[3] { LongUnpressed, ShortPress, LongPress }, null, Strict: false, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnTapAndHoldImmediateExclusive"); public static sSequenceDefinition WhileHeld => new sSequenceDefinition(new sKeyPressDefinition[1] { LongPress }, null, Strict: false, RisingEdgeOnly: false, 0f, ExclusiveSelf: true, "WhileHeld"); public static sSequenceDefinition OnTrippleTap => new sSequenceDefinition(new sKeyPressDefinition[3] { ShortPress, ShortPress, ShortPress }, null, Strict: false, RisingEdgeOnly: true, 0f, ExclusiveSelf: true, "OnTrippleTap"); } public class sKeyPressAnchor { public enum Anchorpoint { Start, Inside, End } public readonly sKeyPressDefinition PressDefinition; public readonly Anchorpoint OtherPoint; public readonly Anchorpoint ThisPoint; public readonly float WindowStart; public readonly float WindowEnd; public sKeyPressAnchor(sKeyPressDefinition PressDefinition, Anchorpoint ThisPoint, Anchorpoint OtherPoint, float WindowStart, float WindowEnd) { this.PressDefinition = PressDefinition; this.OtherPoint = OtherPoint; this.ThisPoint = ThisPoint; this.WindowStart = WindowStart; this.WindowEnd = WindowEnd; } public sKeyPressAnchor(sKeyPressAnchor Other) { PressDefinition = Other.PressDefinition; OtherPoint = Other.OtherPoint; ThisPoint = Other.ThisPoint; WindowStart = Other.WindowStart; WindowEnd = Other.WindowEnd; } internal bool Matches(sKeyPressRefrence timelineEvent) { if (!PressDefinition.AnyMatches) { return false; } foreach (sKeyPressRefrence matchCandidate in PressDefinition.MatchCandidates) { if (CandidateMataches(timelineEvent, matchCandidate)) { return true; } } return false; } internal bool CandidateMataches(sKeyPressRefrence PressA, sKeyPressRefrence PressB) { float num = 0f; float num2 = 0f; float num3 = 0f; float num4 = 0f; switch (ThisPoint) { case Anchorpoint.Start: num3 = PressA.Start; num4 = PressA.Start; break; case Anchorpoint.End: num3 = PressA.End; num4 = PressA.End; break; case Anchorpoint.Inside: num3 = PressA.Start; num4 = PressA.End; break; } switch (OtherPoint) { case Anchorpoint.Start: num = PressB.Start + WindowStart; num2 = PressB.Start + WindowEnd; break; case Anchorpoint.End: num = PressB.End + WindowStart; num2 = PressB.End + WindowEnd; break; case Anchorpoint.Inside: num = PressB.Start + WindowStart; num2 = PressB.End + WindowEnd; break; } if (num4 >= num && num3 <= num2) { return true; } return false; } } public class sKeyPressDefinition { public KeyCode? Key; public readonly bool Pressed = true; public readonly string? Identifier; public readonly float MaxDuration = float.MaxValue; public readonly float MinDuration; public readonly bool Strict; public readonly bool Breaking; public HashSet MatchCandidates = new HashSet(); public List Anchors { get; private set; } = new List(); public bool HasAnchors => Anchors.Count > 0; public bool AnyMatches => MatchCandidates.Count > 0; public sKeyPressDefinition(KeyCode? Key, bool Pressed, List? Anchors = null, string? Identifier = null, float MaxDuration = float.MaxValue, float MinDuration = 0f, bool Strict = false, bool Breaking = false) { this.Key = Key; this.Pressed = Pressed; this.Identifier = Identifier; this.MaxDuration = MaxDuration; this.MinDuration = MinDuration; this.Strict = Strict; this.Breaking = Breaking; this.Anchors = Anchors ?? new List(); } public sKeyPressDefinition AddAnchor(sKeyPressAnchor Anchor) { Anchors.Add(Anchor); return this; } public sKeyPressDefinition AddAnchor(sKeyPressDefinition Anchor) { return AddAnchor(new sKeyPressAnchor(Anchor, sKeyPressAnchor.Anchorpoint.Start, sKeyPressAnchor.Anchorpoint.End, 0f, 0.25f)); } public sKeyPressDefinition ResetMatchCandidates() { MatchCandidates.Clear(); return this; } public bool CheckMatch(sKeyPressRefrence timelineEvent, out bool Matched) { //IL_0083: 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) Matched = false; if (HasAnchors) { bool flag = false; foreach (sKeyPressAnchor anchor in Anchors) { if (anchor.PressDefinition.AnyMatches) { flag = true; break; } } if (!flag) { return false; } } if (MaxDuration < timelineEvent.Durration) { return false; } if (MinDuration > timelineEvent.Durration) { return false; } if (timelineEvent.Pressed != Pressed) { return false; } if ((KeyCode?)timelineEvent.Key != Key) { if (Strict) { return true; } return false; } bool flag2 = !HasAnchors; if (!flag2) { foreach (sKeyPressAnchor anchor2 in Anchors) { if (anchor2.Matches(timelineEvent)) { flag2 = true; } } } if (flag2) { Matched = MatchCandidates.Add(timelineEvent); } if (flag2) { return Breaking; } return false; } public override string ToString() { //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) if (Identifier != null) { return Identifier; } string value = (Pressed ? "P" : "U"); return $"[{((object)Key.Value/*cast due to .constrained prefix*/).ToString()}:{value}]:[{MinDuration},{MaxDuration}]:[{Strict},{Breaking}]"; } } public struct sKeyPressRefrence { public readonly KeyCode Key; public bool Pressed; public float Start; private float? _End; public float End { get { if (!_End.HasValue) { return Time.time; } return _End.Value; } set { _End = value; } } public bool Completed => _End.HasValue; public float Durration => End - Start; public sKeyPressRefrence(KeyCode Key, bool Pressed, float Start, float? End = null) { //IL_000d: 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) _End = null; this.Key = Key; this.Start = Start; _End = End; this.Pressed = Pressed; } public sKeyPressRefrence(sInputEvent Start, sInputEvent End) { //IL_0014: 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_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) Pressed = false; _End = null; if (Start.Key != End.Key) { throw new ArgumentException("Start and end events must have the same key."); } if (Start.Pressed == End.Pressed) { throw new ArgumentException("Start and end events must have different pressed states."); } Key = Start.Key; this.Start = Start.Time; this.End = End.Time; Pressed = Start.Pressed; } public sKeyPressRefrence(sInputEvent Start, float EndTime) { //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) Pressed = false; _End = null; Key = Start.Key; this.Start = Start.Time; End = EndTime; Pressed = Start.Pressed; } public bool ContainsEvent(sInputEvent evnt) { //IL_0001: 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) if (evnt.Key != Key) { return false; } if (evnt.Time == Start) { return evnt.Pressed == Pressed; } if (evnt.Time == End) { return evnt.Pressed != Pressed; } return false; } public override string ToString() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) string value = (Pressed ? "Pressed" : "Unpressed"); return $"{Key} {value} for {Durration} at {Start}"; } } public class sSequenceDefinition { public readonly sKeyPressDefinition[] Presses; public FlexibleMethodDefinition Callback; public readonly bool Strict; public readonly bool RisingEdgeOnly; public readonly float ExclusivityWindow; public readonly bool ExclusiveSelf = true; public readonly HashSet ExclusiveOther = new HashSet(); public readonly HashSet ExclusiveSelfExcept = new HashSet(); private bool PreviouslyMatched; private bool Matched; private bool _AllMatched; private string? Identifier; private HashSet _BreakList; private HashSet _KeyCodes; public Dictionary SolvedSolution { get; private set; } public HashSet BreakList { get { //IL_003a: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (_BreakList == null) { _BreakList = new HashSet(ExclusiveOther); _BreakList.UnionWith(KeyCodes); foreach (KeyCode item in ExclusiveSelfExcept) { _BreakList.Remove(item); } } return _BreakList; } } private float? MatchStartTimestamp => SolvedSolution?[Presses[0]].Start; private float? MatchEndTimestamp => SolvedSolution?[Presses[Presses.Length - 1]].End; public HashSet KeyCodes { get { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (_KeyCodes == null) { _KeyCodes = new HashSet(); sKeyPressDefinition[] presses = Presses; foreach (sKeyPressDefinition sKeyPressDefinition2 in presses) { if (sKeyPressDefinition2.Key.HasValue) { _KeyCodes.Add(sKeyPressDefinition2.Key.Value); } } } return _KeyCodes; } } public sSequenceDefinition(sKeyPressDefinition[] Presses, FlexibleMethodDefinition Callback, bool Strict = false, bool RisingEdgeOnly = true, float ExclusivityWindow = 0f, bool ExclusiveSelf = true, string Identifier = null, HashSet ExclusiveOther = null, HashSet ExclusiveSelfExcept = null, bool autoAnchor = true) { this.Presses = Presses; this.Callback = Callback; this.Strict = Strict; this.RisingEdgeOnly = RisingEdgeOnly; this.ExclusivityWindow = ExclusivityWindow; this.ExclusiveSelf = ExclusiveSelf; this.Identifier = Identifier; this.ExclusiveOther = ExclusiveOther ?? new HashSet(); this.ExclusiveSelfExcept = ExclusiveSelfExcept ?? new HashSet(); if (autoAnchor) { AutoAnchor(); } } private void ResetPressMatches() { sKeyPressDefinition[] presses = Presses; for (int i = 0; i < presses.Length; i++) { presses[i].ResetMatchCandidates(); } } private bool CheckSequenceComplete(int Index = 0, Dictionary Solution = null) { if (Solution == null) { Solution = new Dictionary(); } if (Index >= Presses.Length) { SolvedSolution = Solution; return true; } sKeyPressDefinition sKeyPressDefinition2 = Presses[Index]; foreach (sKeyPressRefrence matchCandidate in sKeyPressDefinition2.MatchCandidates) { if (!Solution.Values.Contains(matchCandidate) && CandidateFits(sKeyPressDefinition2, matchCandidate, Solution)) { Solution.Add(sKeyPressDefinition2, matchCandidate); if (CheckSequenceComplete(Index + 1, Solution)) { return true; } Solution.Remove(sKeyPressDefinition2); } } return false; } public bool MatchedAll(bool recheck = true) { if (recheck) { _AllMatched = CheckSequenceComplete(); } return _AllMatched; } private bool CandidateFits(sKeyPressDefinition press, sKeyPressRefrence candidate, Dictionary solution) { foreach (sKeyPressAnchor anchor in press.Anchors) { if (solution.TryGetValue(anchor.PressDefinition, out var value) && !anchor.CandidateMataches(candidate, value)) { return false; } } return true; } private bool ContainsInputEvent(sInputEvent Evnt) { foreach (sKeyPressRefrence value in SolvedSolution.Values) { if (value.ContainsEvent(Evnt)) { return true; } } return false; } public bool Matches(List Refrences) { //IL_013d: Unknown result type (might be due to invalid IL or missing references) ResetPressMatches(); int num = 0; int num2 = 0; do { num = num2; for (int i = 0; i < Refrences.Count; i++) { sKeyPressRefrence timelineEvent = Refrences[i]; for (int num3 = Presses.Length - 1; num3 >= 0; num3--) { if (Presses[num3].CheckMatch(timelineEvent, out var Matched)) { return MatchedTail(Matched: false); } if (Matched) { num2++; if (MatchedAll()) { break; } } } if (MatchedAll()) { break; } } } while (!MatchedAll() && num < num2); if (MatchedAll()) { if (MatchEndTimestamp + ExclusivityWindow > Time.time) { return MatchedTail(Matched: false); } for (int j = 0; j < sTimeline.Sequence.Count; j++) { sInputEvent evnt = sTimeline.Sequence[j]; if (evnt.Time < (Strict ? MatchStartTimestamp : MatchEndTimestamp)) { break; } if (!ContainsInputEvent(evnt) && BreakList.Contains(evnt.Key)) { return MatchedTail(Matched: false); } } if (RisingEdgeOnly) { if (!PreviouslyMatched) { return MatchedTail(Matched: true); } PreviouslyMatched = this.Matched; this.Matched = true; return false; } return MatchedTail(Matched: true); } return MatchedTail(Matched: false); } private bool MatchedTail(bool Matched) { PreviouslyMatched = Matched; this.Matched = Matched; return Matched; } public void SetKeyCode(KeyCode Key) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) sKeyPressDefinition[] presses = Presses; for (int i = 0; i < presses.Length; i++) { presses[i].Key = Key; } } public void AutoAnchor() { if (Presses.Length > 1) { for (int i = 1; i < Presses.Length; i++) { Presses[i].AddAnchor(Presses[i - 1]); } } } public override string ToString() { if (Identifier != "") { return Identifier; } string text = ""; sKeyPressDefinition[] presses = Presses; foreach (sKeyPressDefinition value in presses) { text += $"-{value}"; } return text; } } public static class sTimeline { private const int buffersize = 16; public static sRollingBuffer Sequence { get; private set; } = new sRollingBuffer(16); public static List KeyPressRefrences { get { //IL_001e: 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_004f: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); List list = new List(); for (int i = 0; i < Sequence.Count; i++) { sInputEvent sInputEvent2 = Sequence[i]; if (dictionary.TryGetValue(sInputEvent2.Key, out var value)) { if (value.Pressed == sInputEvent2.Pressed) { throw new ArgumentException("Two presses or two unpresses in a row should never happen!"); } sKeyPressRefrence item = new sKeyPressRefrence(sInputEvent2, value); list.Add(item); dictionary[sInputEvent2.Key] = sInputEvent2; } else { sKeyPressRefrence item2 = new sKeyPressRefrence(sInputEvent2, Time.time); list.Add(item2); dictionary[sInputEvent2.Key] = sInputEvent2; } } return list; } } public static void Add(sInputEvent Evnt) { Sequence.Add(Evnt); } } public class sRollingBuffer { private readonly T[] buffer; private int index; private int count; public int Count => count; public int Capacity => buffer.Length; public bool full => count == Capacity; public T this[int i] => Get(i); public sRollingBuffer(int capacity) { buffer = new T[capacity]; } public void Add(T item) { buffer[index] = item; index = (index + 1) % buffer.Length; if (count < buffer.Length) { count++; } } public T Get(int index) { if (index >= count || index < 0) { return default(T); } int num = (this.index - 1 - index + buffer.Length) % buffer.Length; return buffer[num]; } public T Oldest() { if (count == 0) { return default(T); } int num = index % buffer.Length - 1; return buffer[num]; } public T Newest() { if (count == 0) { return default(T); } return buffer[0]; } } } namespace ZombieTweak2 { public static class Il2CppInteropVersionHelper { public static string GetIl2CppInteropVersion() { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "Il2CppInterop.Common"); if (assembly == null) { return "Il2CppInterop not loaded"; } string text = assembly.GetName().Version?.ToString() ?? "Unknown"; AssemblyInformationalVersionAttribute customAttribute = assembly.GetCustomAttribute(); if (customAttribute != null) { text = customAttribute.InformationalVersion; } if (text.Contains('+')) { text = text.Split('+')[0]; } return text; } } [HarmonyPatch] public static class il2cppInteropPatches { [HarmonyPatch(typeof(ClassInjector), "GetIl2CppTypeFullName")] [HarmonyPrefix] public unsafe static bool GetIl2CppTypeFullNamePatch(Il2CppTypeStruct* typePointer, ref string __result) { INativeClassStruct obj = UnityVersionHandler.Wrap((Il2CppClass*)(void*)IL2CPP.il2cpp_class_from_type((IntPtr)typePointer)); INativeAssemblyStruct val = UnityVersionHandler.Wrap(UnityVersionHandler.Wrap(obj.Image).Assembly); StringBuilder stringBuilder = new StringBuilder(); Stack stack = new Stack(); INativeClassStruct val2 = obj; INativeClassStruct val3 = obj; do { stack.Push(Marshal.PtrToStringUTF8(val2.Name) ?? ""); val3 = val2; } while ((val2 = UnityVersionHandler.Wrap(val2.DeclaringType)) != null); string text = ((val3.Namespace != IntPtr.Zero) ? (Marshal.PtrToStringUTF8(val3.Namespace) ?? "") : ""); stringBuilder.Append(text); if (text.Length > 0) { stringBuilder.Append('.'); } stringBuilder.Append(string.Join("+", stack)); string text2 = Marshal.PtrToStringUTF8(val.Name.Name); if (text2 != "mscorlib") { stringBuilder.Append(", "); stringBuilder.Append(text2); } __result = stringBuilder.ToString(); return false; } } } namespace BotControl { [HarmonyPatch] public static class BBCompat { private static Dictionary botRecorders = new Dictionary(); public static void OnInit() { MethodInfo methodInfo = AccessTools.Method(typeof(RootPlayerBotAction), "UpdateActionCollectItem", (Type[])null, (Type[])null); ZiMain.m_Harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)1, "com.east.bb"); } public static void SetBotsOpenContainersToFalse() { ConfigurationPluginManager.BetterBotsOpenContainers = false; } public static BotRecorder GetBotRecorder(PlayerAIBot bot) { return GetBotRecorder(bot.Agent); } public static BotRecorder GetBotRecorder(PlayerAgent agent) { return GetBotRecorder(agent.PlayerSlotIndex); } public static BotRecorder GetBotRecorder(int index) { PlayerAgent val = default(PlayerAgent); if (!PlayerManager.TryGetPlayerAgent(ref index, ref val)) { throw new InvalidOperationException($"Could not find bot at index {index}"); } if (!botRecorders.ContainsKey(index) || (Object)(object)botRecorders[index] == (Object)null) { botRecorders[index] = ((Component)val).gameObject.GetComponent(); } return botRecorders[index]; } [MethodImpl(MethodImplOptions.NoInlining)] public static bool CheckDanger(PlayerAgent agent) { BotRecorder botRecorder = GetBotRecorder(agent); if ((Object)(object)botRecorder != (Object)null) { return botRecorder.IsInDangerousSituation(); } return false; } [MethodImpl(MethodImplOptions.NoInlining)] internal static bool CheckReviveAllowed(PlayerAgent m_agent) { BotRecorder botRecorder = GetBotRecorder(m_agent); if ((Object)(object)botRecorder != (Object)null) { return !botRecorder.Brain.ReviveRestricted; } return true; } } [HarmonyPatch] public static class BBPatches { [HarmonyPatch(typeof(PlayerBotManagerExtended), "IsBotCurrentlyBusyWithAction")] [HarmonyPostfix] public static void PostIsBotCurrentlyBusyWithAction(PlayerAIBot bot, ref bool __result) { if (__result) { return; } _ = bot.Agent.CharacterID; foreach (KeyValuePair> manualAction in zActions.manualActions) { foreach (ManualAction item in manualAction.Value) { if (((Il2CppObjectBase)item.Bot).Pointer == ((Il2CppObjectBase)bot).Pointer) { __result = true; return; } } } } } public static class zActionSub { public static List> onAdded = new List>(); public static List> onRemoved = new List>(); public static Dictionary> botActionMap = new Dictionary>(); public static Dictionary actionCallbacks = new Dictionary(); public static void Update() { List botList = ZiMain.GetBotList(); Il2CppActionComparer comparer = new Il2CppActionComparer(); foreach (PlayerAIBot item in botList) { List value = new List(); botActionMap.TryGetValue(((Object)item).GetInstanceID(), out value); if (value == null) { value = new List(); } List list = new List(); Enumerator enumerator2 = item.Actions.GetEnumerator(); while (enumerator2.MoveNext()) { PlayerBotActionBase current2 = enumerator2.Current; list.Add(current2); } List list2 = list.Except(value, comparer).ToList(); List list3 = value.Except(list, comparer).ToList(); foreach (PlayerBotActionBase item2 in list2) { onAdd(item, item2); } foreach (PlayerBotActionBase item3 in list3) { onRemove(item, item3); } botActionMap[((Object)item).GetInstanceID()] = list; } } public static void addOnAdded(Action action) { onAdded.Add(action); } public static void addOnRemoved(Action action) { onRemoved.Add(action); } public static void onAdd(PlayerAIBot bot, PlayerBotActionBase botAction) { foreach (Action item in onAdded) { item(bot, botAction); } } public static void onRemove(PlayerAIBot bot, PlayerBotActionBase botAction) { foreach (Action item in onRemoved) { item(bot, botAction); } } public static void addOnTerminated(Descriptor descriptor, FlexibleMethodDefinition method) { object[] array = new object[method.args.Length + 1]; method.args.CopyTo(array, 0); array[method.args.Length] = descriptor; method.args = array; if (actionCallbacks.ContainsKey(((Il2CppObjectBase)descriptor).Pointer)) { actionCallbacks[((Il2CppObjectBase)descriptor).Pointer].Listen(method); return; } actionCallbacks[((Il2CppObjectBase)descriptor).Pointer] = new FlexibleEvent(); actionCallbacks[((Il2CppObjectBase)descriptor).Pointer].Listen(method); } } public class Il2CppActionComparer : IEqualityComparer { public bool Equals(PlayerBotActionBase x, PlayerBotActionBase y) { if (x == null || y == null) { return x == y; } return ((Il2CppObjectBase)x).Pointer == ((Il2CppObjectBase)y).Pointer; } public int GetHashCode(PlayerBotActionBase obj) { if (obj == null) { return 0; } return ((Il2CppObjectBase)obj).Pointer.GetHashCode(); } } public static class zBotActions { public static float defaultPrio = 14f; public static void StartAction(ManualAction manualAction) { if (!zActions.manualActions.ContainsKey(manualAction.Commander.CharacterID)) { zActions.manualActions[manualAction.Commander.CharacterID] = new List(); } zActions.manualActions[manualAction.Commander.CharacterID].Add(manualAction); if (SNet.IsMaster) { manualAction.Bot.StartAction(manualAction.ActionDescriptor); } } public static void StartAction(PlayerAIBot aiBot, Descriptor Desc, PlayerAgent Commander, uint ID) { StartAction(new ManualAction(Desc, Commander, aiBot, ID)); } public static Descriptor TryGetDescriptor(PlayerAIBot Bot) where Type : Descriptor { if ((Object)(object)Bot == (Object)null) { return null; } Enumerator enumerator = Bot.Actions.GetEnumerator(); while (enumerator.MoveNext()) { Descriptor descBase = enumerator.Current.DescBase; if (descBase != null && zHelpers.IsOfType(((Object)descBase).GetIl2CppType()) && !descBase.IsTerminated()) { return descBase; } } return null; } public static void SetLeader(PlayerAgent Follower, PlayerAgent Leader, PlayerAgent Commander = null, ulong netsender = 0uL) { //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_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_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) if (!Follower.Owner.IsBot) { return; } PlayerAIBot component = ((Component)Follower).GetComponent(); if (!SNet.IsMaster) { if (netsender != 0L) { component.Agent.NavMarker.UpdateExtraInfo(); return; } NetworkAPI.InvokeEvent("RequestToSetLeader", new pStructs.pLeaderInfo { leader = pStructs.Get_pStructFromRefrence(Leader), follower = pStructs.Get_pStructFromRefrence(Follower), Commander = pStructs.Get_pStructFromRefrence(Commander) }, (SNet_ChannelType)2); } else { component.SyncValues.Leader = Leader; component.Agent.NavMarker.UpdateExtraInfo(); } } public static void SendbotToMoveToLocation(PlayerAIBot aiBot, Vector3 TargetLocation, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_006e: 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_0080: 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_0087: 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_0096: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)aiBot == (Object)null) { return; } if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } Descriptor desc = new Descriptor(aiBot) { Prio = defaultPrio, Haste = 1f, DestinationType = (DestinationEnum)0, DestinationPos = TargetLocation, Persistent = false, Bulletproof = (BulletproofEnum)0 }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToMoveToLocation", new pStructs.pLocationInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), position = zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos, BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_IWILLDOIT, "I will do it.", 2f); SetLeader(aiBot.Agent, aiBot.Agent, zStaticRefrences.LocalPlayer, 0uL); aiBot.Agent.NavMarker.UpdateExtraInfo(); } } public static void SendBotToPickUpMine(PlayerAIBot aiBot, MineDeployerInstance Mine, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //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_009e: 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 (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } Descriptor desc = new Descriptor(aiBot) { Prio = defaultPrio, TargetItem = (ItemEquippable)(object)Mine }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { pStructs.pPickupMineInfo pPickupMineInfo = new pStructs.pPickupMineInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent) }; ushort? obj; if (Mine == null) { obj = null; } else { IReplicator replicator = Mine.Replicator; obj = ((replicator != null) ? new ushort?(replicator.Key) : ((ushort?)null)); } ushort? num = obj; pPickupMineInfo.MineReplicatorKey = num.GetValueOrDefault(); pPickupMineInfo.ID = actionID; NetworkAPI.InvokeEvent("RequestToPickupMine", pPickupMineInfo, (SNet_ChannelType)2); } } else if (!((Object)(object)((Mine != null) ? ((Item)Mine).Owner : null) != (Object)null) || ((Item)Mine).Owner.Owner.IsBot) { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToPickUpSentry(PlayerAIBot aiBot, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } Descriptor desc = new Descriptor(aiBot) { Prio = defaultPrio }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToPickupSentry", new pStructs.pPickupSentryInfo { playerAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), commander = pStructs.Get_pStructFromRefrence(Commander), ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToPlaceSentry(PlayerAIBot aiBot, Pose sentryPose, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_0064: 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_006c: Expected O, but got Unknown //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_009e: 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_00aa: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } Descriptor desc = new Descriptor(aiBot) { Prio = defaultPrio, InstallationPose = sentryPose }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToPlaceSentry", new pStructs.pPlaceToolInfo { playerAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), commander = pStructs.Get_pStructFromRefrence(Commander), Pose = sentryPose, ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToPlaceMine(PlayerAIBot aiBot, Pose minePose, InventorySlot slot, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_0064: 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_006b: 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_007e: Expected O, but got Unknown //IL_00a4: 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_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_00bd: 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_00c5: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } Descriptor desc = new Descriptor(aiBot) { Prio = defaultPrio, InstallationPose = minePose, BackpackItem = zHelpers.GetAgentBackpackItem(aiBot.Agent, slot) }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToPlaceMine", new pStructs.pPlaceMineInfo { Agent = pStructs.Get_pStructFromRefrence(aiBot.Agent), Commander = pStructs.Get_pStructFromRefrence(Commander), pose = minePose, slot = slot, ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToUseCfoamGun(PlayerAIBot aiBot, Vector3 targetPosition, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_0064: 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_0077: 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_008a: Expected O, but got Unknown //IL_00af: 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_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_00c8: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToUseCfoamGun{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } Descriptor desc = new Descriptor(aiBot) { Prio = 15f, TargetType = (TargetTypeEnum)1, TargetObject = ((Component)Commander).transform, TargetPosition = targetPosition, Haste = 1f }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToUseCfoamGun", new pStructs.pUseCfoamInfo { Agent = pStructs.Get_pStructFromRefrence(aiBot.Agent), Commander = pStructs.Get_pStructFromRefrence(Commander), position = targetPosition, ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToPickupItem(PlayerAIBot aiBot, ItemInLevel item, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //IL_006c: 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_00bd: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00f7: 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_0108: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_014f: 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_015c: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToPickupItem{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } float prio = defaultPrio; float s_collectItemStandDistance = RootPlayerBotAction.s_collectItemStandDistance; LG_ResourceContainer_Storage componentInParent = ((Component)item).GetComponentInParent(); _ = ((Component)item).transform.position; Vector3 standoffPosition; if ((Object)(object)componentInParent != (Object)null) { zHelpers.SnapPositionToNav(((Component)componentInParent).transform.position - ((Component)componentInParent).transform.up * s_collectItemStandDistance, out standoffPosition); } else { zHelpers.TryGetStandoffPosition(((Component)aiBot).transform.position, ((Component)item).transform.position, 1f, out standoffPosition); } float haste = 1f; Descriptor desc = new Descriptor(aiBot) { TargetItem = (Item)(object)item, TargetContainer = item.container, TargetPosition = standoffPosition, Prio = prio, Haste = haste }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { pStructs.pPickupItemInfo pPickupItemInfo = default(pStructs.pPickupItemInfo); ((pReplicator)(ref pPickupItemInfo.item.replicatorRef)).SetID(((Component)item).GetComponent().m_stateReplicator.Replicator); pPickupItemInfo.playerAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent); pPickupItemInfo.commander = pStructs.Get_pStructFromRefrence(Commander); pPickupItemInfo.ID = actionID; NetworkAPI.InvokeEvent("RequestToPickupItem", pPickupItemInfo, (SNet_ChannelType)2); } return; } CarryItemPickup_Core component = ((Component)item).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { SendBotToCarryItem(aiBot, component, Commander, netsender); return; } ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Commander.PlayerName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is sending "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(aiBot.Agent.PlayerName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to pick up "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Item)item).PublicName); } log.LogInfo(val); ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do.", 2f); zChatHandler.sendChatMessage("Picking up " + ((Item)item).PublicName, PressActionManager.GetAction("Pickup Item").FriendlyIdentifier + IPressAction.chatPermSuffix, aiBot.Agent, Commander); } public static void SendBotToReviveAgent(PlayerAIBot Reviver, PlayerAgent Downed, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //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_009e: 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_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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToReviveAgent{Commander.PlayerName}{Reviver.Agent.PlayerName}{Time.time}"); } Descriptor desc = new Descriptor(Reviver) { Client = Downed, Prio = 15f }; StartAction(Reviver, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToReviveAgent", new pStructs.pReviveAgentInfo { Revier = pStructs.Get_pStructFromRefrence(Reviver.Agent), Downed = pStructs.Get_pStructFromRefrence(Downed), commander = pStructs.Get_pStructFromRefrence(Commander), ID = actionID }, (SNet_ChannelType)2); } } else { zChatHandler.sendChatMessage("Reving " + Downed.PlayerName, PressActionManager.GetAction("Revive Agent").FriendlyIdentifier + IPressAction.chatPermSuffix, Reviver.Agent, Commander); ZiMain.BotBarkBack(Reviver.Agent.CharacterID, EVENTS.PLAY_CL_IWILLDOIT, "I will do it."); } } public static void SendBotToCarryItem(PlayerAIBot aiBot, CarryItemPickup_Core item, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //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_00c1: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } float prio = 11f; Descriptor desc = new Descriptor(aiBot) { TargetItem = item, Prio = prio }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { pStructs.pPickupItemInfo pPickupItemInfo = default(pStructs.pPickupItemInfo); ((pReplicator)(ref pPickupItemInfo.item.replicatorRef)).SetID(((Component)item).GetComponent().m_stateReplicator.Replicator); pPickupItemInfo.playerAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent); pPickupItemInfo.commander = pStructs.Get_pStructFromRefrence(Commander); pPickupItemInfo.ID = actionID; NetworkAPI.InvokeEvent("RequestToPickupItem", pPickupItemInfo, (SNet_ChannelType)2); } return; } ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Commander.PlayerName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is sending "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(aiBot.Agent.PlayerName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to carry "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Item)item)._PublicName_k__BackingField); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" with the new method"); } log.LogInfo(val); zChatHandler.sendChatMessage("Carrying " + ((Item)item)._PublicName_k__BackingField, PressActionManager.GetAction("Pickup Item").FriendlyIdentifier + IPressAction.chatPermSuffix, aiBot.Agent, Commander); ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } public static void SendBotToShareResourcePack(PlayerAIBot aiBot, PlayerAgent receiver, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0102: 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_010e: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_014b: 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_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_0165: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } float prio = defaultPrio; float haste = 1f; BackpackItem backpackItem = null; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(59, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(aiBot.Agent.PlayerName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" was told by "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Commander != null) ? Commander.PlayerName : null) ?? "someone"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" with netid "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(netsender); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to try to share resource pack to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(receiver.PlayerName); } log.LogInfo(val); if (!zHelpers.TryGetAgentBackpackItem(aiBot.Agent, (InventorySlot)4, out backpackItem)) { return; } ItemEquippable val2 = ((Il2CppObjectBase)backpackItem.Instance).Cast(); Descriptor desc = new Descriptor(aiBot) { Receiver = receiver, Item = val2, Prio = prio, Haste = haste }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToShareResourcePack", new pStructs.pShareResourceInfo { sender = pStructs.Get_pStructFromRefrence(aiBot.Agent), receiver = pStructs.Get_pStructFromRefrence(receiver), commander = pStructs.Get_pStructFromRefrence(Commander), ID = actionID }, (SNet_ChannelType)2); } } else { aiBot.Inventory.DoEquipItem(val2); float ammoInPack = aiBot.Backpack.AmmoStorage.GetAmmoInPack((AmmoType)3); zChatHandler.sendChatMessage($"Sharing my {((Item)val2).PublicName} ({ammoInPack}%) with {receiver.PlayerName}.", PressActionManager.GetAction("Share Resource").FriendlyIdentifier + IPressAction.chatPermSuffix, aiBot.Agent, Commander); ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } [Obsolete] public static void SendBotToClearCurrentRoom(PlayerAIBot aiBot = null, PlayerAgent commander = null, ulong netsender = 0uL, Descriptor arg_descriptor = null) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002c: 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_014f: 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_0159: 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_00b0: 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) if (arg_descriptor != null && (int)arg_descriptor.Status != 3) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unsucsefull last kill "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(arg_descriptor.Status); } log.LogInfo(val); return; } if ((Object)(object)commander == (Object)null) { commander = PlayerManager.GetLocalPlayerAgent(); } List enemiesInNode = ((Agent)commander).CourseNode.m_enemiesInNode; Vector3 val3; if ((Object)(object)aiBot == (Object)null) { PlayerAgent val2 = null; float num = float.MaxValue; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (current.Owner.IsBot) { val3 = ((Component)commander).gameObject.transform.position - ((Component)current).gameObject.transform.position; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val2 = current; } } } if ((Object)(object)val2 == (Object)null) { return; } aiBot = ((Component)val2).gameObject.GetComponent(); } if (enemiesInNode.Count <= 0) { zChatHandler.sendChatMessage("I have killed all enemies in the room", "Clear RoomTalkInChatNotifyActionSuccess", ((Component)aiBot).gameObject.GetComponent(), commander); return; } float num2 = float.MaxValue; Enumerator enumerator2 = enemiesInNode.GetEnumerator(); while (enumerator2.MoveNext()) { EnemyAgent current2 = enumerator2.Current; val3 = ((Component)aiBot).gameObject.transform.position - ((Component)current2).gameObject.transform.position; float sqrMagnitude2 = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude2 < num2) { num2 = sqrMagnitude2; } } new FlexibleMethodDefinition(new <>f__AnonymousDelegate9(SendBotToClearCurrentRoom), new object[3] { aiBot, commander, netsender }); } public static bool SendBotToThrowItem(PlayerAgent Commander, PlayerAgent botAgent, Vector3 MovePosition, Vector3 TargetPosition, ulong netSender = 0uL, uint actionID = 0u) { //IL_0092: 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_00a2: 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_00b4: 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_00c7: 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_00e0: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0102: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_011c: 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_0124: Unknown result type (might be due to invalid IL or missing references) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{botAgent.PlayerName}{Time.time}"); } PlayerAIBot component = ((Component)botAgent).GetComponent(); zHelpers.TryGetAgentBackpackItem(component.Agent, (InventorySlot)5, out BackpackItem backpackItem); if (backpackItem == null) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(42, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Wanted to throw an item but found nothing."); } log.LogWarning(val); return false; } Descriptor desc = new Descriptor(component) { Prio = defaultPrio, Haste = 0.8f, TargetPosition = TargetPosition, TargetObject = ((Component)Commander).transform, TargetType = (TargetTypeEnum)1, Item = ((Il2CppObjectBase)backpackItem.Instance).Cast(), MovementAllowed = true }; StartAction(component, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netSender != 0L) { return false; } NetworkAPI.InvokeEvent("RequestToThrowItem", new pStructs.pThrowDataInfo { Agent = pStructs.Get_pStructFromRefrence(botAgent), Commander = pStructs.Get_pStructFromRefrence(Commander), TargetPosition = TargetPosition, MovePosition = MovePosition, ID = actionID }, (SNet_ChannelType)2); return false; } ZiMain.BotBarkBack(botAgent.CharacterID, EVENTS.PLAY_CL_IWILLDOIT, "I will do it."); return false; } internal static void SendbotToBreakLock(PlayerAIBot aiBot, LG_WeakLock Lock, MethodEnum method, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //IL_0087: 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_00a5: 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_00ac: 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_00be: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00df: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_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_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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToMoveToLocation{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } _ = defaultPrio; iLG_WeakLockHolder holder = Lock.m_holder; LG_DoorButton val = ((Il2CppObjectBase)holder).TryCast(); LG_WeakResourceContainer val2 = ((Il2CppObjectBase)holder).TryCast(); GameObject gameObject; TargetTypeEnum targetType; if ((Object)(object)val != (Object)null) { gameObject = ((Component)((Il2CppObjectBase)val.m_door).TryCast()).gameObject; targetType = (TargetTypeEnum)0; } else { if (!((Object)(object)val2 != (Object)null)) { return; } gameObject = ((Component)val2).gameObject; targetType = (TargetTypeEnum)1; } Descriptor desc = new Descriptor(aiBot) { TargetType = targetType, TargetGO = gameObject, Prio = 13f, TargetPosition = gameObject.transform.position, Method = method, Lock = Lock }; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender != 0L) { return; } pStructs.pBreakLockInfo pBreakLockInfo = default(pStructs.pBreakLockInfo); SNet_StateReplicator val3 = ((Il2CppObjectBase)Lock.GetStateReplicator()).TryCast>(); pBreakLockInfo.Lock = val3.GetProviderSyncStruct(); pBreakLockInfo.Commander = pStructs.Get_pStructFromRefrence(Commander); pBreakLockInfo.BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent); pBreakLockInfo.ID = actionID; pBreakLockInfo.Method = method; NetworkAPI.InvokeEvent("RequestToBreakLock", pBreakLockInfo, (SNet_ChannelType)2); } ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_IMONMYWAY, "On my way."); } internal static void CancelBotAction(uint actionID, ulong netsender = 0uL) { if (!SNet.IsMaster) { if (netsender == 0L) { pStructs.pActionTerminatedInfo pActionTerminatedInfo = new pStructs.pActionTerminatedInfo { ID = actionID }; NetworkAPI.InvokeEvent("RequestActionCancel", pActionTerminatedInfo, (SNet_ChannelType)2); } return; } bool flag = false; foreach (int key in zActions.manualActions.Keys) { foreach (ManualAction item in zActions.manualActions[key]) { if (actionID == item.ID) { item.Bot.StopAction(item.ActionDescriptor); flag = true; break; } } if (flag) { break; } } } public static void SendBotToAttackSleeper(PlayerAIBot aiBot, EnemyAgent Enemy, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToAttackSleeper{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } CustomBotActionManualAttack.Descriptor obj = new CustomBotActionManualAttack.Descriptor(aiBot) { TargetAgent = Enemy, Haste = 0.5f }; ((Descriptor)obj).Prio = defaultPrio; CustomBotActionManualAttack.Descriptor desc = obj; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToAttackSleeper", new pStructs.pAttackEnemyInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), Enemy = pStructs.Get_pStructFromRefrence(Enemy), ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToDropHere(PlayerAIBot aiBot, Vector3 DropPosition, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToDropHere{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } CustomBotActionDropHere.Descriptor obj = new CustomBotActionDropHere.Descriptor(aiBot) { DropPosition = zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos, Haste = 1f }; ((Descriptor)obj).Prio = defaultPrio; CustomBotActionDropHere.Descriptor desc = obj; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToDropHere", new pStructs.pLocationInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), position = DropPosition, ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToInsertCell(PlayerAIBot aiBot, LG_PowerGenerator_Core Generator, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0136: Unknown result type (might be due to invalid IL or missing references) object obj; if (Generator == null) { obj = null; } else { iCarryItemInteractionTarget powerCellInteraction = Generator.m_powerCellInteraction; if (powerCellInteraction == null) { obj = null; } else { LG_GenericCarryItemInteractionTarget obj2 = ((Il2CppObjectBase)powerCellInteraction).Cast(); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } } GameObject val = (GameObject)obj; if ((Object)(object)val == (Object)null || !val.activeInHierarchy) { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_ICANTDOTHAT, "I can't do that."); } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } if (actionID == 0) { actionID = zHelpers.HashString($"RequestToInsertCell{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } CustomBotActionInsertPowerCell.Descriptor obj3 = new CustomBotActionInsertPowerCell.Descriptor(aiBot) { TargetGenerator = Generator, Haste = 1f }; ((Descriptor)obj3).Prio = defaultPrio; CustomBotActionInsertPowerCell.Descriptor desc = obj3; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster && netsender == 0L) { NetworkAPI.InvokeEvent("RequestToInsertCell", new pStructs.pLocationInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), position = ((Component)Generator).transform.position, ID = actionID }, (SNet_ChannelType)2); } } public static void SendBotToOpenContainer(PlayerAIBot aiBot, LG_WeakResourceContainer Container, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_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_00bb: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToOpenContainer{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } CustomBotActionOpenContainer.Descriptor obj = new CustomBotActionOpenContainer.Descriptor(aiBot) { TargetContainer = Container, Haste = 1f }; ((Descriptor)obj).Prio = defaultPrio; CustomBotActionOpenContainer.Descriptor desc = obj; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToOpenContainer", new pStructs.pLocationInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), position = ((Component)Container).transform.position, ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_OPENING, "Opening."); } } public static void SendBotToRefillSentry(PlayerAIBot aiBot, SentryGunInstance Sentry, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //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_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_00bb: 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) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToRefillSentry{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } CustomBotActionRefillSentry.Descriptor obj = new CustomBotActionRefillSentry.Descriptor(aiBot) { TargetSentry = Sentry, Haste = 1f }; ((Descriptor)obj).Prio = defaultPrio; CustomBotActionRefillSentry.Descriptor desc = obj; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToRefillSentry", new pStructs.pLocationInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), position = ((Component)Sentry).transform.position, ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } public static void SendBotToInteractDoor(PlayerAIBot aiBot, LG_WeakDoor Door, Vector3 TargetPosition, MethodEnum method, PlayerAgent Commander = null, ulong netsender = 0uL, uint actionID = 0u) { //IL_0062: 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_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_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_00d3: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (actionID == 0) { actionID = zHelpers.HashString($"RequestToInteractDoor{Commander.PlayerName}{aiBot.Agent.PlayerName}{Time.time}"); } CustomBotActionInteractDoor.Descriptor obj = new CustomBotActionInteractDoor.Descriptor(aiBot) { TargetDoor = Door, method = method, TargetPosition = TargetPosition }; ((Descriptor)obj).Prio = defaultPrio; CustomBotActionInteractDoor.Descriptor desc = obj; StartAction(aiBot, (Descriptor)(object)desc, Commander, actionID); if (!SNet.IsMaster) { if (netsender == 0L) { NetworkAPI.InvokeEvent("RequestToInteractDoor", new pStructs.pDoorInteractInfo { Commander = pStructs.Get_pStructFromRefrence(Commander), BotAgent = pStructs.Get_pStructFromRefrence(aiBot.Agent), DoorPosition = ((Component)Door).transform.position, TargetPosition = TargetPosition, Method = method, ID = actionID }, (SNet_ChannelType)2); } } else { ZiMain.BotBarkBack(aiBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do."); } } } public struct ChatMessage { public int? SpeakerID; public int? ReceiverID; public string Message; public float localtimestamp; private uint _Hash; public uint Hash { get { if (_Hash == 0) { _Hash = zHelpers.HashString(Message + SpeakerID + ReceiverID + localtimestamp); } return _Hash; } } public ChatMessage(string Message, int? SpeakerID, int? ReceiverID) { _Hash = 0u; localtimestamp = Time.time; this.Message = Message; this.SpeakerID = SpeakerID; this.ReceiverID = ReceiverID; } } internal static class zChatHandler { private static ChatMessage previousMessage; public static void sendChatMessage(string message, string PermissionString, PlayerAgent sender = null, PlayerAgent receiver = null) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown if (!zSlideComputer.ActionPermissions.ValueAt("TalkInChat").Value) { return; } if (zSlideComputer.ActionPermissions.HasKey(PermissionString)) { if (zSlideComputer.ActionPermissions.ValueAt(PermissionString, shouldthrow: false).Value) { ChatMessage chatMessage = new ChatMessage { Message = message, SpeakerID = ((sender != null) ? new int?(sender.CharacterID) : ((int?)null)), ReceiverID = ((receiver != null) ? new int?(receiver.CharacterID) : ((int?)null)) }; bool num = chatMessage.Hash == previousMessage.Hash; previousMessage = chatMessage; if (!num) { PlayerChatManager.WantToSentTextMessage(((Object)(object)sender != (Object)null) ? sender : PlayerManager.GetLocalPlayerAgent(), message, receiver); } } } else { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("PermissionString not found "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(PermissionString); } log.LogWarning(val); PlayerChatManager.WantToSentTextMessage(((Object)(object)sender != (Object)null) ? sender : PlayerManager.GetLocalPlayerAgent(), message, receiver); } } } public static class zDebug { private static GameObject debugSphere; public static Agent nofindagent; private static bool checkVis = false; public static int playerIndex = 1; public static PlayerAgent agent = null; public static GameObject head = null; private static GameObject visObserver; private static GameObject visTarget; private static Dictionary boxes = new Dictionary(); internal static void ShowDebugSphere(Vector3 position, float radius) { //IL_010e: 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_012a: 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_0058: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)debugSphere == (Object)null) { debugSphere = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)debugSphere).name = "LookDirectionDebugSphere"; Object.Destroy((Object)(object)debugSphere.GetComponent()); Renderer component = debugSphere.GetComponent(); component.material = new Material(Shader.Find("Standard")); component.material.color = new Color(0f, 1f, 0f, 0.3f); component.material.SetFloat("_Mode", 3f); component.material.SetInt("_SrcBlend", 5); component.material.SetInt("_DstBlend", 10); component.material.SetInt("_ZWrite", 0); component.material.DisableKeyword("_ALPHATEST_ON"); component.material.EnableKeyword("_ALPHABLEND_ON"); component.material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); component.material.renderQueue = 3000; } debugSphere.transform.position = position; debugSphere.transform.localScale = Vector3.one * (radius * 2f); } private static void printallbotactionpriorities() { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); bool flag = default(bool); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (!current.Owner.IsBot) { continue; } PlayerAIBot component = ((Component)current).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { continue; } ZiMain.log.LogInfo((object)current.PlayerName); RootPlayerBotAction val = ((Il2CppObjectBase)component.Actions[0]).Cast(); if (val == null) { continue; } Type type = ((object)val).GetType(); while (type != null && type != typeof(object)) { FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!typeof(Descriptor).IsAssignableFrom(fieldInfo.FieldType)) { continue; } object? value = fieldInfo.GetValue(val); Descriptor val2 = (Descriptor)((value is Descriptor) ? value : null); if (val2 != null) { ManualLogSource log = ZiMain.log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(6, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("\t - "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(fieldInfo.Name); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.Prio); } log.LogInfo(val3); } } PropertyInfo[] properties = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (!typeof(Descriptor).IsAssignableFrom(propertyInfo.PropertyType)) { continue; } try { object? value2 = propertyInfo.GetValue(val, null); Descriptor val4 = (Descriptor)((value2 is Descriptor) ? value2 : null); if (val4 != null) { ManualLogSource log2 = ZiMain.log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(6, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("\t - "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(propertyInfo.Name); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val4.Prio); } log2.LogInfo(val3); } } catch { } } type = type.BaseType; } } } private static void printAllNames() { HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); HashSet hashSet3 = new HashSet(); HashSet hashSet4 = new HashSet(); HashSet hashSet5 = new HashSet(); foreach (Item item in ((IEnumerable)Object.FindObjectsOfType()).ToList()) { hashSet4.Add(((item != null) ? item.PublicName : null) ?? ""); object obj; if (item == null) { obj = null; } else { ItemDataBlock itemDataBlock = item.ItemDataBlock; obj = ((itemDataBlock != null) ? itemDataBlock.publicName : null); } if (obj == null) { obj = ""; } hashSet5.Add((string)obj); hashSet.Add(((item != null) ? item.ArchetypeName : null) ?? ""); object obj2; if (item == null) { obj2 = null; } else { ItemDataBlock itemDataBlock2 = item.ItemDataBlock; obj2 = ((itemDataBlock2 != null) ? itemDataBlock2.terminalItemShortName : null); } if (obj2 == null) { obj2 = ""; } hashSet2.Add((string)obj2); object obj3; if (item == null) { obj3 = null; } else { ItemDataBlock itemDataBlock3 = item.ItemDataBlock; obj3 = ((itemDataBlock3 != null) ? itemDataBlock3.terminalItemLongName : null); } LocalizedText val = (LocalizedText)obj3; hashSet3.Add((val != null) ? LocalizedText.op_Implicit(val) : ""); } ZiMain.log.LogInfo((object)"PublicNames:"); ZiMain.log.LogInfo((object)string.Join("\n", hashSet4)); ZiMain.log.LogInfo((object)"DataBlockPublicNames:"); ZiMain.log.LogInfo((object)string.Join("\n", hashSet5)); ZiMain.log.LogInfo((object)"ArchetypeNames:"); ZiMain.log.LogInfo((object)string.Join("\n", hashSet)); ZiMain.log.LogInfo((object)"terminalItemShortNames:"); ZiMain.log.LogInfo((object)string.Join("\n", hashSet2)); ZiMain.log.LogInfo((object)"terminalItemLongNames:"); ZiMain.log.LogInfo((object)string.Join("\n", hashSet3)); } private static void printAllInventoryItems() { //IL_000f: 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_0037: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown Il2CppReferenceArray> itemDataPerInventorySlot = ItemSpawnManager.m_itemDataPerInventorySlot; bool flag = default(bool); for (int i = 0; i < ((Il2CppArrayBase>)(object)itemDataPerInventorySlot).Count; i++) { string text = ((object)(InventorySlot)(byte)i/*cast due to .constrained prefix*/).ToString(); Il2CppReferenceArray val = ((Il2CppArrayBase>)(object)itemDataPerInventorySlot)[i]; ManualLogSource log = ZiMain.log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(4, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Il2CppArrayBase)(object)val).Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("):"); } log.LogInfo(val2); foreach (ItemDataBlock item in (Il2CppArrayBase)(object)val) { ManualLogSource log2 = ZiMain.log; val2 = new BepInExInfoLogInterpolatedStringHandler(6, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\t - ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(GameDataBlockBase.s_blockIDByName[((GameDataBlockBase)(object)item).name]); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(item.publicName); } log2.LogInfo(val2); } } } private static void printWhatBotsCanPickUp() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown Enumerator enumerator = RootPlayerBotAction.s_itemBasePrios.GetEnumerator(); bool flag = default(bool); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; uint key = current.Key; float value = current.Value; string name = ((GameDataBlockBase)(object)GameDataBlockBase.s_blockByID[key]).name; ManualLogSource log = ZiMain.log; BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(1, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(":"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(value); } log.LogMessage(val); } } private static string printNameFromID(uint id) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (GameDataBlockBase.s_blockByID.ContainsKey(id)) { string text = ((GameDataBlockBase)(object)GameDataBlockBase.s_blockByID[id]).name + " - " + GameDataBlockBase.s_blockByID[id].publicName; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(2, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(id); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); } log.LogInfo(val); return text; } return ""; } private static ItemDataBlock getDatablockFromId(uint id) { if (GameDataBlockBase.s_blockByID.ContainsKey(id)) { return GameDataBlockBase.s_blockByID[id]; } return null; } private static void TestReciveSetGenericAction(string actionKey, int playerID, bool allowed) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown pStructs.pGenericPermission pGenericPermission = new pStructs.pGenericPermission { playerID = playerID, allowed = allowed }; int num = zSlideComputer.PermissionDefinitions.KeyToId(actionKey); if (num == -1) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(65, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unknown actionKey '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(actionKey); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' when setting action perms for id:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(playerID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", allowed:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(allowed); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogWarning(val); } else { pGenericPermission.actionID = num; NetworkAPI.InvokeEvent("SetActionPermission", pGenericPermission, (SNet_ChannelType)2); } } private static bool OriginalUpdateActionShareResoursePack(RootPlayerBotAction __instance, ref Descriptor bestAction) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (!((Descriptor)__instance.m_shareResourceAction).IsTerminated()) { return false; } ((Descriptor)__instance.m_shareResourceAction).Prio = RootPlayerBotAction.m_prioSettings.ShareResource; if (!RootPlayerBotAction.CompareActionPrios((Descriptor)(object)__instance.m_shareResourceAction, bestAction)) { return false; } if (((PlayerBotActionBase)__instance).m_bot.IsActionForbidden((Descriptor)(object)__instance.m_shareResourceAction)) { return false; } PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(((PlayerBotActionBase)__instance).m_agent.Owner); BackpackItem val = default(BackpackItem); if (!backpack.TryGetBackpackItem((InventorySlot)4, ref val)) { return false; } PlayerAmmoStorage ammoStorage = backpack.AmmoStorage; float num = ammoStorage.ResourcePackAmmo.CostOfBullet / ammoStorage.ResourcePackAmmo.AmmoMaxCap; PlayerAgent val2 = null; float num2 = 0f; for (int i = 0; i < PlayerManager.PlayerAgentsInLevel.Count; i++) { PlayerAgent val3 = PlayerManager.PlayerAgentsInLevel[i]; if ((Object)(object)val3 == (Object)null || !((Agent)val3).Alive) { continue; } if ((Object)(object)val3 != (Object)(object)((PlayerBotActionBase)__instance).m_agent) { float prio = ((Descriptor)__instance.m_shareResourceAction).Prio; Vector3 position = ((Agent)val3).Position; if (((PlayerBotActionBase)__instance).m_bot.ApplyRestrictionsToRootPosition(ref position, ref prio)) { continue; } } PlayerAmmoStorage ammoStorage2 = PlayerBackpackManager.GetBackpack(val3.Owner).AmmoStorage; float num3 = 0f; if (__instance.m_gearAvailability.Has((GearFlags)1024)) { num = AgentModifierManager.ApplyModifier((Agent)(object)((PlayerBotActionBase)__instance).m_agent, (AgentModifier)3, num); if (((Dam_SyncedDamageBase)val3.Damage).GetHealthRel() + num < 0.98f) { num3 = 0.98f - ((Dam_SyncedDamageBase)val3.Damage).GetHealthRel(); } } else if (__instance.m_gearAvailability.Has((GearFlags)2048)) { num = AgentModifierManager.ApplyModifier((Agent)(object)((PlayerBotActionBase)__instance).m_agent, (AgentModifier)108, num); if (ammoStorage2.StandardAmmo.RelInPack + num < 0.98f && ammoStorage2.SpecialAmmo.RelInPack + num < 0.98f) { num3 = 0.98f - (ammoStorage2.StandardAmmo.RelInPack + ammoStorage2.SpecialAmmo.RelInPack) / 2f; } } else if (__instance.m_gearAvailability.Has((GearFlags)8192)) { if (val3.Damage.Infection * 0.98f > num) { num3 = val3.Damage.Infection * 0.98f; } } else if (__instance.m_gearAvailability.Has((GearFlags)4096)) { num = AgentModifierManager.ApplyModifier((Agent)(object)((PlayerBotActionBase)__instance).m_agent, (AgentModifier)108, num); if (val3.NeedToolAmmo() && ammoStorage2.ClassAmmo.RelInPack + num < 0.98f) { num3 = 0.98f - ammoStorage2.ClassAmmo.RelInPack; } } if (num3 > 0f) { num3 = Mathf.Clamp01(num3 / 0.98f); if (!val3.Owner.IsBot) { num3 = Mathf.Lerp(num3, 1f, 0.5f); } if (num3 > num2) { val2 = val3; num2 = num3; } } } if ((Object)(object)val2 != (Object)null) { __instance.m_shareResourceAction.Item = ((Il2CppObjectBase)val.Instance).Cast(); __instance.m_shareResourceAction.Receiver = val2; __instance.m_shareResourceAction.Haste = 0.8f; bestAction = (Descriptor)(object)__instance.m_shareResourceAction; } return false; } private static void TestReciveRequestToPickupItemNetwork(ulong sender, PlayerAgent bot, ItemInLevel item) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_002e: Unknown result type (might be due to invalid IL or missing references) zNetworking.ReciveRequestToPickupItem(sender, new pStructs.pPickupItemInfo { item = pStructs.Get_pStructFromRefrence((Item)(object)item), playerAgent = pStructs.Get_pStructFromRefrence(bot), commander = pStructs.Get_pStructFromRefrence(PlayerManager.GetLocalPlayerAgent()) }); } private static void TestReciveRequestToShareResourcePackNetwork(ulong netSender, PlayerAgent sender, PlayerAgent receiver) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_002e: Unknown result type (might be due to invalid IL or missing references) zNetworking.ReciveRequestToShareResource(netSender, new pStructs.pShareResourceInfo { sender = pStructs.Get_pStructFromRefrence(sender), receiver = pStructs.Get_pStructFromRefrence(receiver), commander = pStructs.Get_pStructFromRefrence(PlayerManager.GetLocalPlayerAgent()) }); } private static void TestReciveRequestSendBotToKillEnemyNetwork(ulong netSender, PlayerAgent aiBot, EnemyAgent enemy) { } internal static void setCheckVizTarget() { _ = PlayerManager.PlayerAgentsInLevel.Count; visObserver = ((Component)PlayerManager.PlayerAgentsInLevel[playerIndex].GetHeadCamTransform().parent).gameObject; Transform transform = sMenuManager.mainMenu.gameObject.transform; visTarget = zSearch.FindBestAlignedComponenet(transform, zSearch.FindAllInView(transform, 10000f, 3f).Cast().ToHashSet()).gameObject; } internal static void debugCheckViz() { if ((Object)(object)visObserver == (Object)null || (Object)(object)visTarget == (Object)null) { setCheckVizTarget(); } if (!((Object)(object)visObserver == (Object)null) && !((Object)(object)visTarget == (Object)null)) { zVisibilityManager.CheckObjectVisiblity(visTarget, visObserver); } } internal static void toggleVisCheck() { setVisCheck(!checkVis); } internal static void setVisCheck(bool set) { checkVis = set; } internal static void MarkUnexploredArea(PlayerAgent playerAgent = null) { //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_001b: 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) //IL_001e: 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_002b: 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) if ((Object)(object)playerAgent == (Object)null) { playerAgent = PlayerManager.GetLocalPlayerAgent(); } Vector3 unexploredLocation = VisitSearchNode.getUnexploredLocation(((Agent)playerAgent).Position); if (!(unexploredLocation == ((Agent)playerAgent).Position) && !(unexploredLocation == Vector3.zero)) { CreatePing(unexploredLocation); } } internal static void CreatePing(Vector3 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) GuiManager.AttemptSetPlayerPingStatus(PlayerManager.GetLocalPlayerAgent(), true, pos, (eNavMarkerStyle)1); } internal static void debugUpdate() { if (checkVis) { debugCheckViz(); } } internal static void SendClosestBotToExplore() { //IL_0040: 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) PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); PlayerAIBot val = null; PlayerAgent sender = null; float num = float.MaxValue; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (current.Owner.IsBot && ((Agent)current).Alive) { float num2 = Vector3.Distance(((Agent)current).Position, ((Agent)localPlayerAgent).Position); if (num2 < num) { num = num2; sender = current; val = ((Component)current).gameObject.GetComponent(); } } } if (!((Object)(object)val == (Object)null)) { zChatHandler.sendChatMessage("Okay here I go exploring!", "Explore" + IPressAction.chatPermSuffix, sender, localPlayerAgent); SendBotToExplore(val); } } internal static VisitNode GetNodeImLookingAT(Transform lookTransform) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lookTransform == (Object)null) { return null; } RaycastHit val = default(RaycastHit); if (!Physics.Raycast(lookTransform.position, lookTransform.forward, ref val, 100f)) { return null; } HashSet nearByNodes = zVisitedManager.GetNearByNodes(((RaycastHit)(ref val)).point, zVisitedManager.NodeVisitDistance); if (nearByNodes.Count == 0) { return null; } List candidates = nearByNodes.Select((VisitNode n) => (GameObject)(((object)n.DebugObject) ?? ((object)new GameObject()))).ToList(); GameObject closestObj = zFindableManager.ResolveObjectInLookDirection(lookTransform, candidates); VisitNode visitNode = nearByNodes.FirstOrDefault((VisitNode n) => (Object)(object)n.DebugObject == (Object)(object)closestObj); if (visitNode != null) { CreatePing(visitNode.position); } return visitNode; } [Obsolete] internal static void SendBotToExplore(PlayerAIBot bot, Descriptor desc = null) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0026: 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_002c: 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_0038: 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_003f: 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_0051: 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_0063: 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_0076: Expected O, but got Unknown if (desc == null || (int)((Descriptor)desc).Status == 3) { VisitNode unexploredLocation = zVisitedManager.GetUnexploredLocation(((Agent)bot.Agent).Position); if (unexploredLocation != null) { Vector3 position = unexploredLocation.position; CreatePing(position); Descriptor val = new Descriptor(bot) { DestinationPos = position, Haste = 0.5f, WalkPosture = (PostureEnum)0, Radius = 0.1f, DestinationType = (DestinationEnum)0, Persistent = false, Prio = 15f }; bot.StartAction((Descriptor)(object)val); FlexibleMethodDefinition method = new FlexibleMethodDefinition(new <>f__AnonymousDelegate11(SendBotToExplore), new object[1] { bot }); zActionSub.addOnTerminated((Descriptor)(object)val, method); } } } internal static void debugCorners() { //IL_0006: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) List types = new List { ((Object)new LG_WeakResourceContainer()).GetIl2CppType(), ((Object)new EnemyAgent()).GetIl2CppType(), ((Object)new ColliderMaterial()).GetIl2CppType(), ((Object)new PlayerAgent()).GetIl2CppType() }; Transform transform = sMenuManager.mainMenu.gameObject.transform; GameObject val = zFindableManager.ResolveObjectInLookDirection(transform, zFindableManager.GetGameObjectsWithLookDirection(transform, types)); if ((Object)(object)val == (Object)null) { ZiMain.log.LogWarning((object)"Could not find target for corners"); return; } if (boxes.ContainsKey(val)) { boxes[val].ToggleDebug(); return; } BoundingBox boundingBox = new BoundingBox(val); boundingBox.ShowDebug(); boxes[val] = boundingBox; } internal static void ToggleNodes() { zVisitedManager.SetDebug(!zVisitedManager.debugCube); } internal static void ToggleConnections() { bool? lines = !zVisitedManager.debugLines; zVisitedManager.SetDebug(null, null, lines); } internal static void ToggleNodeInfo() { bool? text = !zVisitedManager.debugText; zVisitedManager.SetDebug(null, text); } internal static GameObject DrawLine(Vector3 start, Vector3 end, Color color, float width, float time = 1f) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0034: 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_004a: 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_0058: Expected O, but got Unknown GameObject val = new GameObject("VisibilityLine"); LineRenderer obj = val.AddComponent(); obj.startWidth = width; obj.endWidth = width; ((Renderer)obj).material = new Material(Shader.Find("Unlit/Color")); obj.startColor = color; obj.endColor = color; obj.positionCount = 2; obj.SetPosition(0, start); obj.SetPosition(1, end); return val; } } public static class zFindableManager { public class PingTargetTransform { public Transform transform; public PlayerPingTarget ping; } public static HashSet CheckedNodes = new HashSet(); public static float foundDistance = 30f; private static PlayerAgent localPlayer = null; public static int MapCellSise = 5; public static List AllFindableObjects = new List(); public static List AllFoundFindables = new List(); public static List AllUnfoundFindables = new List(); public static Dictionary> findbleObjectMap = new Dictionary>(); public static Dictionary> courseNodeFindableObjectCache = new Dictionary>(); private static List pingTransforms = new List(); public static int AgentSearchIndex = 0; public static float searchTiming = 0.5f; public static float lastSearched = 0f; public static Dictionary lastCheckedPosition = new Dictionary(); public static float staticRange = 5f; public static float staticRangeTimeout = 5f; public static float visiblityThreshold = 0.2f; public static float verticalOffset = 2f; public static OrderedSet<(FindableObject, PlayerAgent)> findsQueue = new OrderedSet<(FindableObject, PlayerAgent)>(); public static int vizChecksPerFrame = 10; [Obsolete] public static GameObject ResolveObjectInLookDirection(Transform baseTransform, List candidates, float maxAngle = 180f, Vector3? candidateOffset = null, Vector3? baseOffset = null) { //IL_0017: 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_0039: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00e5: 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_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_0102: 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_010b: 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_0112: 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) candidateOffset = (Vector3)(((??)candidateOffset) ?? Vector3.zero); baseOffset = (Vector3)(((??)baseOffset) ?? Vector3.zero); if ((Object)(object)baseTransform == (Object)null || candidates == null || candidates.Count == 0) { return null; } Vector3 val = baseTransform.position; Vector3? val2 = baseOffset; Vector3 value = (val2.HasValue ? new Vector3?(val + val2.GetValueOrDefault()) : ((Vector3?)null)).Value; Vector3 forward = baseTransform.forward; GameObject val3 = null; float num = maxAngle; foreach (GameObject candidate in candidates) { if (!((Object)(object)candidate == (Object)null)) { val = candidate.transform.position; val2 = candidateOffset; val = (val2.HasValue ? new Vector3?(val + val2.GetValueOrDefault()) : ((Vector3?)null)).Value - value; Vector3 normalized = ((Vector3)(ref val)).normalized; float num2 = Vector3.Angle(forward, normalized); if (num2 < num) { num = num2; val3 = candidate; } } } if ((Object)(object)val3 != (Object)null && num <= maxAngle) { return val3; } return null; } [Obsolete] public static List GetObjectsWithComponentsInRadius(Vector3 position, float searchRadius, List types) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Collider[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(position, searchRadius)); foreach (Collider val in array) { foreach (Type type in types) { Component componentInParent = ((Component)val).GetComponentInParent(type); if ((Object)(object)componentInParent != (Object)null) { list.Add(componentInParent.gameObject); } } } return list; } [Obsolete] public static List GetComponentsInRadius(Vector3 position, float searchRadius) where T : Component { //IL_0006: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Collider[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(position, searchRadius)); for (int i = 0; i < array.Length; i++) { T componentInParent = ((Component)array[i]).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { list.Add(componentInParent); } } return list; } [Obsolete] public static List GetObjectsWithComponentInRadius(Vector3 position, float searchRadius) where T : Component { //IL_0006: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Collider[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(position, searchRadius)); for (int i = 0; i < array.Length; i++) { T componentInParent = ((Component)array[i]).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { list.Add(((Component)componentInParent).gameObject); } } return list; } [Obsolete] public static List GetGameObjectsWithLookDirection(Transform source, List types, float searchRadius = 3f, float rayDistance = 10000f) { //IL_0001: 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_001d: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(source.position, source.forward), ref val, rayDistance)) { return GetObjectsWithComponentsInRadius(((RaycastHit)(ref val)).point, searchRadius, types); } return new List(); } [Obsolete] public static List GetGameObjectsWithLookDirection(Transform source, float searchRadius = 3f, float rayDistance = 10000f) where T : Component { //IL_0001: 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_001d: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(source.position, source.forward), ref val, rayDistance)) { return GetObjectsWithComponentInRadius(((RaycastHit)(ref val)).point, searchRadius); } return new List(); } public static void Update() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 if ((Object)(object)localPlayer == (Object)null) { localPlayer = PlayerManager.GetLocalPlayerAgent(); } if ((Object)(object)localPlayer == (Object)null || (Object)(object)localPlayer.Owner == (Object)null) { return; } if ((int)localPlayer.Owner.refSessionMode != 8) { if (findbleObjectMap.Count > 0) { findbleObjectMap.Clear(); courseNodeFindableObjectCache.Clear(); } } else { if ((int)FocusStateManager.CurrentState != 4 && (int)FocusStateManager.CurrentState != 12 && (int)FocusStateManager.CurrentState != 6) { return; } if (Time.time - lastSearched > searchTiming) { PlayerAgent agent = PlayerManager.PlayerAgentsInLevel[AgentSearchIndex]; UpdateFindables(agent); UpdatefindsQue(agent); AgentSearchIndex++; lastSearched = Time.time; if (AgentSearchIndex >= PlayerManager.PlayerAgentsInLevel.Count) { AgentSearchIndex = 0; } } FindsQueu(); CleanFindableObjectMaps(); } } private static void CleanFindableObjectMaps() { //IL_014e: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) List list = new List(); HashSet hashSet = new HashSet(); foreach (KeyValuePair> item in findbleObjectMap) { List value = item.Value; List list2 = new List(); foreach (FindableObject item2 in value) { if ((Object)(object)item2?.gameObject == (Object)null || !item2.gameObject.activeInHierarchy) { list2.Add(item2); } } foreach (FindableObject item3 in list2) { value.Remove(item3); if (item3?.courseNode != null && courseNodeFindableObjectCache.TryGetValue(item3.courseNode.Name, out var value2)) { value2.Remove(item3); if (value2.Count == 0) { hashSet.Add(item3.courseNode); } } } if (value.Count == 0) { list.Add(item.Key); } } foreach (Vector2 item4 in list) { findbleObjectMap.Remove(item4); } foreach (AIG_CourseNode item5 in hashSet) { courseNodeFindableObjectCache.Remove(item5.Name); } } public static void ProcessPingTargetsIntoFindableObjectMap(PlayerPingTarget[] allpingTargets) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected I4, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Invalid comparison between Unknown and I4 //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Invalid comparison between Unknown and I4 //IL_031e: 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) if (allpingTargets == null || allpingTargets.Count() == 0) { return; } pingTransforms = new List(); foreach (PlayerPingTarget val in allpingTargets) { Transform parent = ((Component)val).transform; Type type = null; eNavMarkerStyle pingTargetStyle = val.PingTargetStyle; switch ((int)pingTargetStyle) { case 3: case 4: case 6: case 8: case 9: case 10: case 11: case 16: case 17: case 18: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: type = typeof(LG_GenericTerminalItem); break; case 5: case 19: type = typeof(LG_PickupItem_Sync); break; } if (!(type != null)) { continue; } Transform val2 = parent; while ((Object)(object)((Component)parent).GetComponent(Il2CppType.From(type)) == (Object)null) { if ((Object)(object)parent.parent == (Object)null) { parent = val2; break; } parent = parent.parent; } if (!pingTransforms.Any((Transform t) => ((Object)t).GetInstanceID() == ((Object)parent).GetInstanceID())) { pingTransforms.Add(parent); } } Vector2Int val3 = default(Vector2Int); foreach (Transform pingObject in pingTransforms) { BoundingBox boundingBox = new BoundingBox(((Component)pingObject).gameObject, BoundingBox.BoundingSource.Renderers); ((Vector2Int)(ref val3))..ctor(Mathf.FloorToInt(boundingBox.Center.x / (float)MapCellSise), Mathf.FloorToInt(boundingBox.Center.z / (float)MapCellSise)); if (!findbleObjectMap.TryGetValue(Vector2Int.op_Implicit(val3), out var _)) { findbleObjectMap[Vector2Int.op_Implicit(val3)] = new List(); } if (findbleObjectMap[Vector2Int.op_Implicit(val3)].Any((FindableObject findable) => (Object)(object)findable.gameObject != (Object)null && ((Object)findable.gameObject).GetInstanceID() == ((Object)((Component)pingObject).gameObject).GetInstanceID())) { continue; } FindableObject findableObject = new FindableObject { gameObject = ((Component)pingObject).gameObject, type = typeof(PlayerPingTarget), pingSyle = ((Component)pingObject).GetComponentInChildren().PingTargetStyle, found = false, box = boundingBox }; MapFindable(findableObject); if ((int)findableObject.pingSyle != 10 && (int)findableObject.pingSyle != 11) { continue; } LG_ResourceContainer_Storage component = findableObject.gameObject.GetComponent(); if (!((Object)(object)component != (Object)null)) { continue; } foreach (ItemInLevel item in GetItemsFromLocker(component)) { PlayerPingTarget componentInChildren = ((Component)item).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { BoundingBox box = new BoundingBox(((Component)componentInChildren).gameObject, BoundingBox.BoundingSource.Renderers); MapFindable(new FindableObject { gameObject = ((Component)item).gameObject, type = typeof(PlayerPingTarget), pingSyle = componentInChildren.PingTargetStyle, found = false, box = box }); } } } } public static void MapFindable(FindableObject findable) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0056: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown Vector2Int val = default(Vector2Int); ((Vector2Int)(ref val))..ctor(Mathf.FloorToInt(findable.box.Center.x / (float)MapCellSise), Mathf.FloorToInt(findable.box.Center.z / (float)MapCellSise)); if (!findbleObjectMap.ContainsKey(Vector2Int.op_Implicit(val))) { findbleObjectMap[Vector2Int.op_Implicit(val)] = new List(); } findbleObjectMap[Vector2Int.op_Implicit(val)].Add(findable); AllFindableObjects.Add(findable); AllUnfoundFindables.Add(findable); if (findable.courseNode == null) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Findable "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)findable.gameObject).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" has no coursenode!"); } log.LogWarning(val2); } else { if (!courseNodeFindableObjectCache.ContainsKey(findable.courseNode.Name)) { courseNodeFindableObjectCache[findable.courseNode.Name] = new List(); } courseNodeFindableObjectCache[findable.courseNode.Name].Add(findable); } } public static void ProcessEnemiesIntoFindableObjectMap(EnemyAgent[] enemyAgents) { //IL_0039: 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_0070: 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_009b: 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_0085: 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_00e2: Unknown result type (might be due to invalid IL or missing references) if (enemyAgents == null || enemyAgents.Count() == 0) { return; } Vector2Int val = default(Vector2Int); foreach (EnemyAgent enemyAgent in enemyAgents) { BoundingBox boundingBox = new BoundingBox(((Component)enemyAgent).gameObject, BoundingBox.BoundingSource.Renderers); ((Vector2Int)(ref val))..ctor(Mathf.FloorToInt(boundingBox.Center.x / (float)MapCellSise), Mathf.FloorToInt(boundingBox.Center.z / (float)MapCellSise)); if (!findbleObjectMap.TryGetValue(Vector2Int.op_Implicit(val), out var _)) { findbleObjectMap[Vector2Int.op_Implicit(val)] = new List(); } if (!findbleObjectMap[Vector2Int.op_Implicit(val)].Any((FindableObject findable) => (Object)(object)findable.gameObject != (Object)null && ((Object)findable.gameObject).GetInstanceID() == ((Object)((Component)enemyAgent).gameObject).GetInstanceID())) { MapFindable(new FindableObject { gameObject = ((Component)enemyAgent).gameObject, type = typeof(EnemyAgent), pingSyle = (eNavMarkerStyle)2, found = false, box = boundingBox }); } } } public static List GetItemsFromLocker(LG_ResourceContainer_Storage storage) { List list = new List(); Enumerator enumerator = storage.PickupInteractions.GetEnumerator(); while (enumerator.MoveNext()) { Transform val = ((Component)enumerator.Current).gameObject.transform; int num = 0; ItemInLevel val2 = null; while ((Object)(object)val != (Object)null && num < 7) { val2 = ((Component)val).GetComponent(); if ((Object)(object)val2 != (Object)null) { break; } val = val.parent; num++; } if (!((Object)(object)val2 == (Object)null)) { list.Add(val2); } } return list; } public static void UpdateFindables(PlayerAgent agent) { //IL_005a: 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_007f: 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) if (!lastCheckedPosition.ContainsKey(((Object)((Component)agent).gameObject).GetInstanceID()) || !(Vector3.Distance(lastCheckedPosition[((Object)((Component)agent).gameObject).GetInstanceID()], ((Component)agent).transform.position) < staticRange)) { lastCheckedPosition[((Object)((Component)agent).gameObject).GetInstanceID()] = ((Component)agent).transform.position; ProcessPingTargetsIntoFindableObjectMap(zSearch.FindAllNearby(((Agent)agent).EyePosition, foundDistance).ToArray()); ProcessEnemiesIntoFindableObjectMap(zSearch.FindAllNearby(((Agent)agent).EyePosition, foundDistance).ToArray()); } } public static void FindsQueu() { //IL_00a4: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown int num = 0; bool flag = default(bool); while (findsQueue.Count > 0) { (FindableObject, PlayerAgent) tuple = findsQueue.Dequeue(); PlayerAgent item = tuple.Item2; FindableObject item2 = tuple.Item1; GameObject gameObject = item2.gameObject; if (item2 == null || (Object)(object)gameObject == (Object)null || !gameObject.activeInHierarchy || item2.found) { continue; } if (!item2.lastCheckedVis.TryGetValue(item.Owner.PlayerSlotIndex(), out var value)) { value = 0f; } if (Time.time - value < searchTiming) { continue; } item2.lastCheckedVis[item.Owner.PlayerSlotIndex()] = Time.time; zVisibilityManager.visSettings visSettings = new zVisibilityManager.visSettings(); visSettings.observerOffest = Vector3.up * verticalOffset; visSettings.visMethod = zVisibilityManager.visMethods.VeryBasic; visSettings.maxDistance = foundDistance; zVisibilityManager.visSettings settings = visSettings; if (zVisibilityManager.CheckObjectVisiblity(gameObject, ((Component)item).gameObject, settings) > visiblityThreshold) { item2.SetFound(); GuiManager.AttemptSetPlayerPingStatus(item, true, item2.box.Center, item2.pingSyle); ManualLogSource log = ZiMain.log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found object "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item2.type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("! "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)gameObject).name); } log.LogInfo(val); ItemInLevel component = item2.gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { PickupMenuClass.Encounter(((Item)component).ItemDataBlock.publicName); } } num++; if (num >= vizChecksPerFrame) { break; } } } public static void UpdatefindsQue(PlayerAgent agent) { //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) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)agent).transform.position; int num = Mathf.FloorToInt(position.x / (float)MapCellSise); int num2 = Mathf.FloorToInt(position.z / (float)MapCellSise); int num3 = Mathf.CeilToInt(foundDistance / (float)MapCellSise); Vector2 key = default(Vector2); for (int i = -num3; i <= num3; i++) { for (int j = -num3; j <= num3; j++) { ((Vector2)(ref key))..ctor((float)(num + i), (float)(num2 + j)); if (!findbleObjectMap.TryGetValue(key, out var value)) { continue; } foreach (FindableObject item in value) { if (!item.found) { findsQueue.Enqueue((item, agent)); } } } } } } public class FindableObject { public GameObject gameObject; private BoundingBox _box; private AIG_CourseNode _courseNode; private Vector2 _Cell; public Type type; private bool hasDim; private eDimensionIndex _dimension; public eNavMarkerStyle pingSyle; public bool found; public Dictionary lastCheckedVis = new Dictionary(); public BoundingBox box { get { if (_box != null) { return _box; } return _box = new BoundingBox(gameObject, BoundingBox.BoundingSource.Renderers); } set { _box = value; } } public AIG_CourseNode courseNode { get { //IL_0010: 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) if (_courseNode != null) { return _courseNode; } AIG_CourseNode.TryGetCourseNode(dimension, box.Center, 1f, ref _courseNode); if (_courseNode == null) { return null; } if (!zFindableManager.courseNodeFindableObjectCache.ContainsKey(_courseNode.Name)) { zFindableManager.courseNodeFindableObjectCache[_courseNode.Name] = new List(); } if (!zFindableManager.courseNodeFindableObjectCache[_courseNode.Name].Contains(this)) { zFindableManager.courseNodeFindableObjectCache[_courseNode.Name].Add(this); } return _courseNode; } set { _courseNode = value; } } public Vector2 Cell { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) _ = _Cell; return _Cell; } } public eDimensionIndex dimension { get { //IL_001b: 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_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_0031: 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) if (hasDim) { return _dimension; } return _dimension = Dimension.GetDimensionFromPos(gameObject.transform.position).DimensionIndex; } set { //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) _dimension = value; hasDim = true; } } public void SetFound() { found = true; zFindableManager.AllUnfoundFindables.Remove(this); zFindableManager.AllFoundFindables.Add(this); } public static Vector2 CellFromPosition(Vector3 worldPos) { //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_0026: Unknown result type (might be due to invalid IL or missing references) return new Vector2((float)Mathf.FloorToInt(worldPos.x / (float)zFindableManager.MapCellSise), (float)Mathf.FloorToInt(worldPos.z / (float)zFindableManager.MapCellSise)); } public override string ToString() { return ((object)Unsafe.As(ref pingSyle)/*cast due to .constrained prefix*/).ToString(); } } public class VisitSearchNode { public static float VisitNodeDistance = 2f; private static float FuzzyVisitNodeDistance = VisitNodeDistance * 1.4f; public static HashSet AllNodes = new HashSet(); public static Dictionary> nodeGrid = new Dictionary>(); public static HashSet debugCubes = new HashSet(); public Vector3 UnexploredLocation = Vector3.zero; public GameObject debugCube; public HashSet SampleDebugCubes = new HashSet(); public Vector3 position; public bool explored; public int propigated; public HashSet conntectedNodes = new HashSet(); public NavMeshHit hit; private Vector2Int cell; public static int propigationAmmount = 30; public static int areaMask = 1; public static Vector3 getUnexploredLocation(Vector3 position) { //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_000a: Unknown result type (might be due to invalid IL or missing references) return GetNearestNode(position)?.getUnexploredLocation() ?? position; } public Vector3 getUnexploredLocation() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) HashSet visited = new HashSet(); return getUnexploredLocation(ref visited); } public Vector3 getUnexploredLocation(ref HashSet visited) { //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_0013: 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_00ee: 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_00c1: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (UnexploredLocation != Vector3.zero) { return UnexploredLocation; } if (visited == null) { visited = new HashSet(); } visited.Add(this); if (visited.Count > 100) { ZiMain.log.LogWarning((object)"Everything nearby has been explored"); return Vector3.zero; } List list = new List(conntectedNodes); for (int num = list.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); VisitSearchNode value = list[num]; list[num] = list[index]; list[index] = value; } foreach (VisitSearchNode item in list) { if (!visited.Contains(item) && item != this) { Vector3 unexploredLocation = item.getUnexploredLocation(ref visited); if (unexploredLocation != Vector3.zero) { return unexploredLocation; } } } return Vector3.zero; } public static void Update() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_003c: 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_0053: Unknown result type (might be due to invalid IL or missing references) Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if ((Object)(object)current == (Object)null || (int)current.Owner.refSessionMode != 8) { continue; } _ = current.CharacterID; if (GetNearByNodes(((Agent)current).Position, VisitNodeDistance).Count == 0) { new VisitSearchNode(((Agent)current).Position, propigationAmmount); } foreach (VisitSearchNode nearByNode in GetNearByNodes(((Agent)current).Position, VisitNodeDistance * 10f)) { if (!nearByNode.explored) { nearByNode.explored = true; nearByNode.propigate(propigationAmmount); nearByNode.UpdateDebugCube(explore: false); } } } } public static HashSet GetNearByNodes(Vector3 position, float searchRadius = -1f) { //IL_0008: 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_0083: 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) HashSet hashSet = new HashSet(); Vector2Int val = default(Vector2Int); ((Vector2Int)(ref val))..ctor(Mathf.FloorToInt(position.x / VisitNodeDistance), Mathf.FloorToInt(position.z / VisitNodeDistance)); if (searchRadius <= 0f) { searchRadius = FuzzyVisitNodeDistance; } int num = Mathf.CeilToInt(searchRadius / VisitNodeDistance); if (num < 1) { num = 1; } HashSet hashSet2 = new HashSet(); Vector2Int key = default(Vector2Int); for (int i = -num; i <= num; i++) { for (int j = -num; j <= num; j++) { ((Vector2Int)(ref key))..ctor(((Vector2Int)(ref val)).x + i, ((Vector2Int)(ref val)).y + j); if (nodeGrid.TryGetValue(key, out var value) && value != null) { hashSet2.UnionWith(value); } } } foreach (VisitSearchNode item in hashSet2) { if (item != null && Vector3.Distance(item.position, position) <= searchRadius) { hashSet.Add(item); } } return hashSet; } public HashSet GetNearByNodes() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetNearByNodes(position); } public static VisitSearchNode GetNearestNode(Vector3 position) { //IL_0000: 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_002c: Unknown result type (might be due to invalid IL or missing references) HashSet nearByNodes = GetNearByNodes(position); VisitSearchNode result = null; float num = float.MaxValue; foreach (VisitSearchNode item in nearByNodes) { if (item != null) { float num2 = Vector3.Distance(item.position, position); if (num2 < num) { num = num2; result = item; } } } return result; } public VisitSearchNode(Vector3 Position, int proigate = 0) { //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_0033: 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_0048: 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_0096: 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_00b0: 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_0102: Unknown result type (might be due to invalid IL or missing references) hit = default(NavMeshHit); NavMesh.SamplePosition(Position, ref hit, 3f, -1); position = Position; AllNodes.Add(this); cell = new Vector2Int(Mathf.FloorToInt(position.x / VisitNodeDistance), Mathf.FloorToInt(position.z / VisitNodeDistance)); if (!nodeGrid.TryGetValue(cell, out var value)) { value = new HashSet(); nodeGrid[cell] = value; } value.Add(this); HashSet nearByNodes = GetNearByNodes(position, FuzzyVisitNodeDistance * 2f); nearByNodes.Remove(this); foreach (VisitSearchNode item in nearByNodes) { item.UpdateDebugCube(); if (item != null && CanNavigateBetween(item.position, position)) { conntectedNodes.Add(item); item.conntectedNodes.Add(this); } } CheckSamplesNearby(proigate); propigated = Math.Max(proigate, propigated); addDebugCube(); } public static bool CanNavigateBetween(Vector3 start, Vector3 end) { //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) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0030: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 NavMeshHit val = default(NavMeshHit); NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(start, ref val, 1f, areaMask) && NavMesh.SamplePosition(end, ref val2, 1f, areaMask)) { NavMeshPath val3 = new NavMeshPath(); if (NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val2)).position, areaMask, val3)) { return (int)val3.status == 0; } return false; } return false; } public void UpdateDebugCube(bool explore = true) { //IL_0050: 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) if ((Object)(object)debugCube == (Object)null) { return; } Renderer component = debugCube.GetComponent(); if ((Object)(object)component == (Object)null) { return; } if (explore) { CheckSamplesNearby(); } if (explored) { component.material.color = Color.green; } else { component.material.color = Color.red; } Transform val = debugCube.transform.Find("PropigatedText"); if ((Object)(object)val != (Object)null) { TextMesh component2 = ((Component)val).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.text = propigated.ToString(); } else { ZiMain.log.LogWarning((object)"UpdateDebugCube: TextMesh component not found on PropigatedText."); } } else { ZiMain.log.LogWarning((object)"UpdateDebugCube: PropigatedText not found."); } } public void addDebugCube() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_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_0089: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); Object.Destroy((Object)(object)val.GetComponent()); val.transform.localScale = Vector3.one * 0.1f; val.transform.position = position + Vector3.up * 1f; Renderer component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.material.color = Color.green; } debugCubes.Add(val); debugCube = val; GameObject val2 = new GameObject("PropigatedText"); val2.transform.SetParent(debugCube.transform); val2.transform.localPosition = Vector3.up * 0.25f; TextMesh obj = val2.AddComponent(); obj.characterSize = 0.1f; obj.anchor = (TextAnchor)7; obj.alignment = (TextAlignment)1; obj.color = new Color(0.2f, 0.2f, 0.2f); obj.text = propigated.ToString(); UpdateDebugCube(); } public void addSampleDebugCube(Vector3 pos, HashSet nearbyNodes, Color color) { //IL_0028: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00b9: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c0: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_011a: 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_0137: 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_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) GameObject cube = GameObject.CreatePrimitive((PrimitiveType)3); Object.Destroy((Object)(object)cube.GetComponent()); cube.transform.localScale = Vector3.one * 0.05f; Vector3 startWorld = pos + Vector3.up * 0.5f; cube.transform.position = startWorld; Renderer component = cube.GetComponent(); if ((Object)(object)component != (Object)null) { component.material.color = color; } Vector3 endWorld = (((Object)(object)debugCube != (Object)null) ? debugCube.transform.position : (position + Vector3.up * 1f)); CreateLine(startWorld, endWorld, Color.white); Color baseColor = default(Color); ((Color)(ref baseColor))..ctor(0.6f, 0.3f, 0.1f); foreach (VisitSearchNode nearbyNode in nearbyNodes) { if (nearbyNode != null) { Vector3 endWorld2 = (((Object)(object)nearbyNode.debugCube != (Object)null) ? nearbyNode.debugCube.transform.position : (nearbyNode.position + Vector3.up * 1f)); CreateLine(startWorld, endWorld2, baseColor); } } SampleDebugCubes.Add(cube); void CreateLine(Vector3 val2, Vector3 val3, Color val5) { //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_0036: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_006f: 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_007e: 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) GameObject val = new GameObject("DebugLine"); val.transform.SetParent(cube.transform, true); LineRenderer obj = val.AddComponent(); obj.useWorldSpace = true; obj.positionCount = 2; obj.SetPosition(0, val2); obj.SetPosition(1, val3); obj.startWidth = 0.01f; obj.endWidth = 0.01f; ((Renderer)obj).material = new Material(Shader.Find("Sprites/Default")); Color val4 = val5; val4.a = 0.2f; obj.startColor = val4; obj.endColor = val4; obj.numCapVertices = 2; } } public void propigate(int depth, HashSet visited = null) { if (depth <= 0) { return; } if (visited == null) { visited = new HashSet(); } if (visited.Contains(this)) { return; } visited.Add(this); propigated = Math.Max(depth, propigated); UpdateDebugCube(); CheckSamplesNearby(depth - 1); foreach (VisitSearchNode nearByNode in GetNearByNodes()) { nearByNode.propigate(depth - 1, visited); } } public bool CheckSamplesNearby(int propigate = 0) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0156: 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_00b3: 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_00d4: 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_00fa: 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_0104: 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_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_0111: 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_0119: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject sampleDebugCube in SampleDebugCubes) { Object.Destroy((Object)(object)sampleDebugCube); } int num = 8; float visitNodeDistance = VisitNodeDistance; int num2 = Random.Range(0, num); UnexploredLocation = Vector3.zero; NavMeshHit val = default(NavMeshHit); for (int i = 0; i < num; i++) { float num3 = (float)((i + num2) % num) * (float)Math.PI * 2f / (float)num; if (!NavMesh.SamplePosition(position + new Vector3(Mathf.Cos(num3), 0f, Mathf.Sin(num3)) * visitNodeDistance, ref val, 3f, -1)) { continue; } Vector3 result = default(Vector3); if (!AdjustPositionUp(((NavMeshHit)(ref val)).position, out result)) { continue; } Vector3 result2 = default(Vector3); if (!AdjustPositionUp(position, out result2)) { continue; } HashSet nearByNodes = GetNearByNodes(result, VisitNodeDistance); Vector3.Distance(result, result2); Vector3 val2 = result2 - result; _ = ((Vector3)(ref val2)).normalized; if (CanNavigateBetween(result, result2)) { UnexploredLocation = result; if (nearByNodes.Count == 0 && propigate > 0) { new VisitSearchNode(result, propigate - 1); } } } return UnexploredLocation != Vector3.zero; static bool AdjustPositionUp(Vector3 pos, out Vector3 reference, float maxLift = 1.5f, float step = 0.05f) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00a7: 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_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_00c4: 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_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_00da: 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_00e4: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0074: 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_0054: 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_011f: Unknown result type (might be due to invalid IL or missing references) PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); object obj; if (localPlayerAgent == null) { obj = null; } else { PlayerCharacterController playerCharacterController = localPlayerAgent.PlayerCharacterController; obj = ((playerCharacterController != null) ? playerCharacterController.m_characterController : null); } CharacterController val3 = (CharacterController)obj; if ((Object)(object)val3 == (Object)null) { ZiMain.log.LogWarning((object)"AdjustPositionUp: PlayerCharacterController not found, falling back to sphere check."); for (float num4 = 0f; num4 <= maxLift; num4 += step) { if (!Physics.CheckSphere(pos, 0.1f)) { reference = pos; return true; } pos.y += step; } reference = pos; return false; } float radius = val3.radius; float height = val3.height; Vector3 center = val3.center; CharacterController playerCollider = val3; for (float num5 = 0f; num5 <= maxLift; num5 += step) { Vector3 val4 = pos + center - Vector3.up * (height / 2f - radius); Vector3 val5 = pos + center + Vector3.up * (height / 2f - radius); if (!Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapCapsule(val4, val5, radius, -1, (QueryTriggerInteraction)1)).Any((Collider c) => (Object)(object)c != (Object)(object)playerCollider)) { reference = pos; return true; } pos.y += step; } reference = pos; return false; } } } public class ComponentFinder : MonoBehaviour { public IEnumerator FindAllWithComponentSlow(Action> onComplete, int itemsPerFrame = 100) where T : Component { List results = new List(); List list = new List(); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); if (((Scene)(ref sceneAt)).isLoaded) { ((Scene)(ref sceneAt)).GetRootGameObjects(list.ToIl2CppList()); } } int processed = 0; T val = default(T); foreach (GameObject item in list) { foreach (Transform componentsInChild in item.GetComponentsInChildren(true)) { if (((Component)componentsInChild).TryGetComponent(ref val)) { results.Add(((Component)componentsInChild).gameObject); } processed++; if (processed % itemsPerFrame == 0) { yield return null; } } } onComplete?.Invoke(results); } } public static class ListConverter { public static List ToIl2CppList(this IEnumerable source) { List val = new List(); foreach (T item in source) { val.Add(item); } return val; } } public static class zHelpers { private static readonly NavMeshPath s_path = new NavMeshPath(); private static readonly Vector3[] s_corners = (Vector3[])(object)new Vector3[20]; private static int s_cornerCount; public static bool TryGetStandoffPosition(Vector3 start, Vector3 end, float standoffDistance, out Vector3 standoffPosition, int areaMask = -1) { //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_0008: 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_0065: 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) standoffPosition = end; if (!NavMesh.CalculatePath(start, end, areaMask, s_path)) { return false; } if ((int)s_path.status != 0) { return false; } s_cornerCount = s_path.GetCornersNonAlloc(Il2CppStructArray.op_Implicit(s_corners)); if (s_cornerCount == 0) { return false; } float num = GetPathLength(s_cornerCount) - standoffDistance; if (num <= 0f) { standoffPosition = s_corners[0]; return true; } GetPointOnPath(s_path, num, out standoffPosition); return true; } public static void GetPointOnPath(NavMeshPath path, float maxDistance, out Vector3 point) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_0052: 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_0076: 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_0067: 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_0060: 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) s_cornerCount = path.GetCornersNonAlloc(Il2CppStructArray.op_Implicit(s_corners)); if (s_cornerCount < 2) { point = s_corners[0]; return; } float num = 0f; Vector3 val = s_corners[0]; for (int i = 1; i < s_cornerCount; i++) { Vector3 val2 = s_corners[i]; num += Vector3.Distance(val, val2); if (maxDistance < num) { point = val2; return; } val = val2; } point = val; } private static float GetPathLength(int cornerCount) { //IL_0013: 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) float num = 0f; for (int i = 1; i < cornerCount; i++) { num += Vector3.Distance(s_corners[i - 1], s_corners[i]); } return num; } public static float Round(float value, int decimalPlaces) { float num = Mathf.Pow(10f, (float)decimalPlaces); return Mathf.Round(value * num) / num; } public static uint HashString(string str) { uint num = 2166136261u; for (int i = 0; i < str.Length; i++) { num ^= str[i]; num *= 16777619; } return num; } public static bool SnapPositionToNav(Vector3 originalPosition, out Vector3 resultPosition, float maxdistance = 1.5f, int areamask = -1) { //IL_0000: 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) //IL_001d: 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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(originalPosition, ref val, maxdistance, areamask)) { resultPosition = ((NavMeshHit)(ref val)).position; return true; } resultPosition = originalPosition; return false; } public static bool IsObstructed(Vector3 from, GameObject target, GameObject excludedObject, int layerMask = -1) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return IsObstructed(from, target, layerMask, (IEnumerable?)(object)new GameObject[1] { excludedObject }); } public static bool IsObstructed(Vector3 from, GameObject target, int layerMask = -1, IEnumerable? excludedObjects = null) { //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_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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_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) if ((Object)(object)target == (Object)null) { return true; } Vector3 val = target.transform.position - from; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.0001f) { return false; } val /= magnitude; RaycastHit[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.RaycastAll(from, val, magnitude, layerMask)); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; Transform transform = ((RaycastHit)(ref val2)).transform; if ((Object)(object)transform == (Object)(object)target.transform || transform.IsChildOf(target.transform)) { continue; } if (excludedObjects != null) { bool flag = false; foreach (GameObject excludedObject in excludedObjects) { if (!((Object)(object)excludedObject == (Object)null) && ((Object)(object)transform == (Object)(object)excludedObject.transform || transform.IsChildOf(excludedObject.transform))) { flag = true; break; } } if (flag) { continue; } } return true; } return false; } public static bool IsOfType(Il2CppObjectBase instance) { if (instance == null) { return false; } IntPtr intPtr = IL2CPP.il2cpp_object_get_class(instance.Pointer); IntPtr nativeClassPtr = Il2CppClassPointerStore.NativeClassPtr; if (!(intPtr == nativeClassPtr)) { return IL2CPP.il2cpp_class_is_assignable_from(nativeClassPtr, intPtr); } return true; } public static bool IsOfType(Type type) { Type val = Il2CppType.Of(); if (type != (Type)null) { if (!(type == val)) { return type.IsSubclassOf(val); } return true; } return false; } public static uint GetAgentBackpackItemId(PlayerAgent agent, InventorySlot slot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BackpackItem agentBackpackItem = GetAgentBackpackItem(agent, slot); if (agentBackpackItem == null) { return 0u; } return agentBackpackItem.ItemID; } public static bool TryGetAgentBackpackItem(PlayerAgent agent, InventorySlot slot, out BackpackItem backpackItem) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (PlayerBackpackManager.GetBackpack(agent.Owner).TryGetBackpackItem(slot, ref backpackItem)) { return true; } return false; } public static BackpackItem GetAgentBackpackItem(PlayerAgent agent, InventorySlot slot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) BackpackItem result = default(BackpackItem); if (PlayerBackpackManager.GetBackpack(agent.Owner).TryGetBackpackItem(slot, ref result)) { return result; } return null; } public static bool PositionIsValidForAgent(PlayerAgent Agent, ref Vector3 Position) { //IL_0001: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(Position, ref val, 1f, -1)) { return false; } Position = ((NavMeshHit)(ref val)).position; NavMeshPath val2 = new NavMeshPath(); if (!NavMesh.CalculatePath(((Agent)Agent).GoodPosition, Position, 17, val2)) { return false; } if ((int)val2.status != 0) { return false; } return true; } public static bool CanBotReach(PlayerAIBot bot, Vector3 location, float maxDistance = 6f) { //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_0019: Expected O, but got Unknown //IL_001f: 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_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_0048: Invalid comparison between Unknown and I4 //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_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_0078: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(location, ref val, 3f, 17)) { return false; } NavMeshPath val2 = new NavMeshPath(); if (!NavMesh.CalculatePath(((Agent)bot.Agent).GoodPosition, ((NavMeshHit)(ref val)).position, 17, val2)) { return false; } if ((int)val2.status == 0) { return true; } if ((int)val2.status == 2) { return false; } return Vector3.Distance(((Il2CppArrayBase)(object)val2.corners)[((Il2CppArrayBase)(object)val2.corners).Length - 1] + Vector3.up * 1.5f, location) < maxDistance; } } public class ComponentInstanceIdComparer : IEqualityComparer { public bool Equals(Component x, Component y) { if (x == y) { return true; } if ((Object)(object)x == (Object)null || (Object)(object)y == (Object)null) { return false; } return ((Object)x).GetInstanceID() == ((Object)y).GetInstanceID(); } public int GetHashCode(Component obj) { if (obj == null) { return 0; } return ((Object)obj).GetInstanceID(); } } public class Il2CppTypePtrComparer : IEqualityComparer { public bool Equals(Type x, Type y) { if (x == (Type)null || y == (Type)null) { return false; } return ((Il2CppObjectBase)x).Pointer == ((Il2CppObjectBase)y).Pointer; } public int GetHashCode(Type obj) { return ((Il2CppObjectBase)obj).Pointer.GetHashCode(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.SlideDrum.Slides-Bot-Control", "Slides Bot Control", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ZiMain : BasePlugin { public const string version = "1.2.0"; public static ManualLogSource log; internal static bool newRootBotPlayerAction = true; public static Dictionary BotTable = new Dictionary(); public static PlayerChatManager _chatManager; public static PUI_CommunicationMenu _menu; public static bool rootmenusetup = false; public static Random rng = new Random(); private static bool? _HasBetterBots; public static int approachWakeChance = 5; public static int wakeChancePerSecond = 20; internal const bool debugMode = true; internal const bool customActions = false; internal static bool VoiceMenu = false; internal static bool extraActionMenus = false; private static List _botList; private static int LastPlayerCount = 0; public static Harmony m_Harmony; public static bool HasBetterBots { get { if (!_HasBetterBots.HasValue) { _HasBetterBots = ((BaseChainloader)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("com.east.bb"); } return _HasBetterBots.Value; } } public override void Load() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown m_Harmony = new Harmony("BotControl"); m_Harmony.PatchAll(); ClassInjector.RegisterTypeInIl2Cpp(); ClassInjector.RegisterTypeInIl2Cpp(); CustomActionRegistry.RegisterIl2CppTypes(); NetworkAPI.RegisterEvent("RequestToPickupItem", (Action)zNetworking.ReciveRequestToPickupItem); NetworkAPI.RegisterEvent("RequestToBreakLock", (Action)zNetworking.ReciveRequestToBreakLock); NetworkAPI.RegisterEvent("RequestToMoveToLocation", (Action)zNetworking.ReciveRequestToMoveToLocation); NetworkAPI.RegisterEvent("RequestToDropHere", (Action)zNetworking.ReciveRequestToDropHere); NetworkAPI.RegisterEvent("RequestToInsertCell", (Action)zNetworking.ReciveRequestToInsertCell); NetworkAPI.RegisterEvent("RequestToOpenContainer", (Action)zNetworking.ReciveRequestToOpenContainer); NetworkAPI.RegisterEvent("RequestToRefillSentry", (Action)zNetworking.ReciveRequestToRefillSentry); NetworkAPI.RegisterEvent("RequestToInteractDoor", (Action)zNetworking.ReciveRequestToInteractDoor); NetworkAPI.RegisterEvent("RequestToPickupMine", (Action)zNetworking.ReciveRequestToPickupMine); NetworkAPI.RegisterEvent("RequestToReviveAgent", (Action)zNetworking.ReciveRequestToReviveAgent); NetworkAPI.RegisterEvent("RequestToPickupSentry", (Action)zNetworking.ReciveRequestToPickupSentry); NetworkAPI.RegisterEvent("RequestToPlaceSentry", (Action)zNetworking.ReciveRequestToPlaceSentry); NetworkAPI.RegisterEvent("RequestToUseCfoamGun", (Action)zNetworking.ReciveRequestToUseCfoam); NetworkAPI.RegisterEvent("RequestToPlaceMine", (Action)zNetworking.ReciveRequestToPlaceMine); NetworkAPI.RegisterEvent("RequestToShareResourcePack", (Action)zNetworking.ReciveRequestToShareResource); NetworkAPI.RegisterEvent("RequestToAttackSleeper", (Action)zNetworking.ReciveRequestToKillSleeper); NetworkAPI.RegisterEvent("RequestToThrowItem", (Action)zNetworking.ReciveRequestToThrowItem); NetworkAPI.RegisterEvent("SetBoolOverideTree", (Action)zNetworking.ReciveSetBoolOverideTree); NetworkAPI.RegisterEvent("SetIntOverideTree", (Action)zNetworking.ReciveSetIntOverideTree); NetworkAPI.RegisterEvent("SetFloatOverideTree", (Action)zNetworking.ReciveSetFloatOverideTree); NetworkAPI.RegisterEvent("RequestToSetLeader", (Action)zNetworking.ReciveRequestToSetLeader); NetworkAPI.RegisterEvent("NotifyActionTerminated", (Action)zNetworking.ReciveActionTerminated); NetworkAPI.RegisterEvent("RequestActionCancel", (Action)zNetworking.ReciveRequestActionCancel); log = ((BasePlugin)this).Log; zActionSub.addOnRemoved(onActionTerminated); zActionSub.addOnAdded(onActionAdded); UseBioscanEvaluatePatches.ApplyNativePatch(); EventAPI.OnManagersSetup += delegate { zUpdater.CreateInstance(); zUpdater.onUpdate.Listen(sMenuManager.Update); zUpdater.onUpdate.Listen(zActionSub.Update); zUpdater.onUpdate.Listen(zSmartSelect.Update); zUpdater.onLateUpdate.Listen(sMenuManager.LateUpdate); OnLateLoad(); }; LG_Factory.OnFactoryBuildDone += Action.op_Implicit((Action)zSlideComputer.Init); } public static void OnLateLoad() { if (HasBetterBots) { BBCompat.OnInit(); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { } private void onActionAdded(PlayerAIBot bot, PlayerBotActionBase action) { } public static void onActionTerminated(PlayerAIBot bot, PlayerBotActionBase action) { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Expected O, but got Unknown //IL_0d00: Unknown result type (might be due to invalid IL or missing references) //IL_0d06: Invalid comparison between Unknown and I4 //IL_0c85: Unknown result type (might be due to invalid IL or missing references) //IL_0c8b: Invalid comparison between Unknown and I4 //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Invalid comparison between Unknown and I4 //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Expected O, but got Unknown //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Invalid comparison between Unknown and I4 //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Invalid comparison between Unknown and I4 //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_07c6: 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_0476: Invalid comparison between Unknown and I4 //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Invalid comparison between Unknown and I4 //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Invalid comparison between Unknown and I4 //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Invalid comparison between Unknown and I4 //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Invalid comparison between Unknown and I4 //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Invalid comparison between Unknown and I4 //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Expected O, but got Unknown //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_084e: Invalid comparison between Unknown and I4 //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Invalid comparison between Unknown and I4 //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_09a2: Invalid comparison between Unknown and I4 //IL_0a46: Unknown result type (might be due to invalid IL or missing references) //IL_0a4c: Invalid comparison between Unknown and I4 //IL_0af0: Unknown result type (might be due to invalid IL or missing references) //IL_0af6: Invalid comparison between Unknown and I4 //IL_0c10: Unknown result type (might be due to invalid IL or missing references) string name = ((MemberInfo)((Object)action).GetIl2CppType()).Name; bool flag = Object.op_Implicit((Object)(object)zActions.isManualAction(action.DescBase)); if (flag) { bool flag2 = false; foreach (int key in zActions.manualActions.Keys) { foreach (ManualAction item in zActions.manualActions[key]) { if (((Il2CppObjectBase)item.ActionDescriptor).Pointer == ((Il2CppObjectBase)action.DescBase).Pointer) { zActions.manualActions[key].Remove(item); pStructs.pActionTerminatedInfo pActionTerminatedInfo = new pStructs.pActionTerminatedInfo { ID = item.ID, status = action.DescBase.Status }; NetworkAPI.InvokeEvent("NotifyActionTerminated", pActionTerminatedInfo, (SNet_ChannelType)2); flag2 = true; break; } } if (flag2) { break; } } } bool flag3 = default(bool); switch (name) { case "PlayerBotActionCarryExpeditionItem": { Descriptor val3 = ((Il2CppObjectBase)action.DescBase).Cast(); ManualLogSource obj13 = log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(54, 4, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(bot.Agent.PlayerName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" completed collect "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Item)val3.TargetItem)._PublicName_k__BackingField); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" task with status: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(action.DescBase.Status); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" access layers "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Descriptor)val3).m_accessLayers); } obj13.LogInfo(val2); zChatHandler.sendChatMessage("I put down the " + ((Item)val3.TargetItem)._PublicName_k__BackingField + ".", PressActionManager.GetAction("Drop Now").FriendlyIdentifier + ChatSettingsMenu.SuccessString, bot.Agent); break; } case "PlayerBotActionCollectItem": { string friendlyIdentifier4 = PressActionManager.GetAction("Pickup Item").FriendlyIdentifier; Descriptor val4 = ((Il2CppObjectBase)action.DescBase).Cast(); CarryItemPickup_Core component = ((Component)val4.TargetItem).gameObject.GetComponent(); string text2 = val4.TargetItem.PublicName; string value2 = "collected"; if ((Object)(object)component != (Object)null) { text2 = val4.TargetItem._PublicName_k__BackingField; value2 = "picked up"; } ManualLogSource obj14 = log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(54, 4, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(bot.Agent.PlayerName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" completed collect "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(text2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" task with status: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(action.DescBase.Status); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" access layers "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Descriptor)val4).m_accessLayers); } obj14.LogInfo(val2); string value3 = (flag ? "the" : "a"); if ((int)action.DescBase.Status == 3) { InventorySlot inventorySlot = val4.TargetItem.ItemDataBlock.inventorySlot; AmmoType val5 = (AmmoType)(((int)inventorySlot == 5) ? 5 : (((int)inventorySlot == 4) ? 3 : 4)); float ammoInPack2 = bot.Backpack.AmmoStorage.GetAmmoInPack(val5); string text3 = (((int)inventorySlot == 4) ? "%" : ""); string value4 = ""; if (ammoInPack2 > 0f) { value4 = " (" + ammoInPack2 + text3 + ")"; } zChatHandler.sendChatMessage($"I {value2} {value3} {text2}{value4}.", friendlyIdentifier4 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.SuccessString, bot.Agent); } else if ((int)action.DescBase.Status == 4) { zChatHandler.sendChatMessage($"I couldn't get {value3} {text2}.", friendlyIdentifier4 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else if ((int)action.DescBase.Status == 5) { zChatHandler.sendChatMessage($"I can't get {value3} {text2} right now.", friendlyIdentifier4 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else if ((int)action.DescBase.Status == 6) { zChatHandler.sendChatMessage($"I can't get {value3} {text2} right now.", friendlyIdentifier4 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else if ((int)action.DescBase.Status == 7) { zChatHandler.sendChatMessage($"I can't get {value3} {text2} right now.", friendlyIdentifier4 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else if ((int)action.DescBase.Status != 2) { zChatHandler.sendChatMessage($"I can't get {value3} {text2} status {action.DescBase.Status}.", friendlyIdentifier4 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } break; } case "PlayerBotActionShareResourcePack": { string friendlyIdentifier2 = PressActionManager.GetAction("Share Resource").FriendlyIdentifier; log.LogInfo((object)"PlayerBotActionShareResourcePack removed"); Descriptor val = ((Il2CppObjectBase)action.DescBase).Cast(); log.LogInfo((object)"descriptor cast"); float ammoInPack = bot.Backpack.AmmoStorage.GetAmmoInPack((AmmoType)3); ManualLogSource obj7 = log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Got ammo left "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ammoInPack); } obj7.LogInfo(val2); ManualLogSource obj8 = log; val2 = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(bot.Agent.PlayerName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" completed share"); } obj8.LogInfo(val2); ManualLogSource obj9 = log; val2 = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Item)val.Item).PublicName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" task with status: "); } obj9.LogInfo(val2); ManualLogSource obj10 = log; val2 = new BepInExInfoLogInterpolatedStringHandler(2, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(action.DescBase.Status); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" "); } obj10.LogInfo(val2); ManualLogSource obj11 = log; val2 = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("access layers "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Descriptor)val).m_accessLayers); } obj11.LogInfo(val2); string value = (flag ? "the" : "a"); string text = (((Object)(object)val.Receiver == (Object)(object)bot.Agent) ? "myself" : val.Receiver.PlayerName); ManualLogSource obj12 = log; val2 = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Got receiver or myself "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(text); } obj12.LogInfo(val2); if ((int)action.DescBase.Status == 3) { zChatHandler.sendChatMessage($"I gave {text} {value} {((Item)val.Item).PublicName} ({ammoInPack}%).", friendlyIdentifier2 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.SuccessString, bot.Agent); } else if ((int)action.DescBase.Status == 4) { zChatHandler.sendChatMessage($"I coul't give {text} {value} {((Item)val.Item).PublicName} ({ammoInPack}%).", friendlyIdentifier2 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else if ((int)action.DescBase.Status == 5) { zChatHandler.sendChatMessage($"I can't give {text} {value} {((Item)val.Item).PublicName} ({ammoInPack}%) right now.", friendlyIdentifier2 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else if ((int)action.DescBase.Status == 6) { zChatHandler.sendChatMessage($"I can't give {text} {value} {((Item)val.Item).PublicName} ({ammoInPack}%) right now.", friendlyIdentifier2 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else if ((int)action.DescBase.Status == 7) { zChatHandler.sendChatMessage($"I can't give {text} {value} {((Item)val.Item).PublicName} ({ammoInPack}%) right now.", friendlyIdentifier2 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } else { zChatHandler.sendChatMessage($"I can't give {text} {value} {((Item)val.Item).PublicName} ({ammoInPack}%) status {action.DescBase.Status}.", friendlyIdentifier2 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } break; } case "PlayerBotActionTravel": if (flag && action.DescBase.ParentActionBase == null) { string friendlyIdentifier3 = PressActionManager.GetAction("Move To").FriendlyIdentifier; if ((int)action.DescBase.Status == 3) { zChatHandler.sendChatMessage("I arrived at the location.", friendlyIdentifier3 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.SuccessString, bot.Agent); } else { zChatHandler.sendChatMessage("I could't make it to the location.", friendlyIdentifier3 + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); } } break; case "PlayerBotActionAttack": { if (!flag) { break; } string friendlyIdentifier = PressActionManager.GetAction("Attack Enemy").FriendlyIdentifier; if ((int)action.DescBase.Status == 3) { object obj; if (action == null) { obj = null; } else { PlayerBotActionAttack obj2 = ((Il2CppObjectBase)action).Cast(); if (obj2 == null) { obj = null; } else { Descriptor desc = obj2.m_desc; if (desc == null) { obj = null; } else { Agent targetAgent = desc.TargetAgent; if (targetAgent == null) { obj = null; } else { EnemyAgent obj3 = ((Il2CppObjectBase)targetAgent).Cast(); obj = ((obj3 == null) ? null : ((GameDataBlockBase)(object)obj3.EnemyData)?.name); } } } } if (obj == null) { obj = "enemy"; } zChatHandler.sendChatMessage("I killed the " + (string?)obj + ".", friendlyIdentifier + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.SuccessString, bot.Agent); break; } object obj4; if (action == null) { obj4 = null; } else { PlayerBotActionAttack obj5 = ((Il2CppObjectBase)action).Cast(); if (obj5 == null) { obj4 = null; } else { Descriptor desc2 = obj5.m_desc; if (desc2 == null) { obj4 = null; } else { Agent targetAgent2 = desc2.TargetAgent; if (targetAgent2 == null) { obj4 = null; } else { EnemyAgent obj6 = ((Il2CppObjectBase)targetAgent2).Cast(); obj4 = ((obj6 == null) ? null : ((GameDataBlockBase)(object)obj6.EnemyData)?.name); } } } } if (obj4 == null) { obj4 = "enemy"; } zChatHandler.sendChatMessage("I could't kill the " + (string?)obj4 + ".", friendlyIdentifier + ChatSettingsMenu.chatPermsString + ChatSettingsMenu.FailString, bot.Agent); break; } } } public static void BotBarkBack(int botId, uint voiceID, string subtitle, float delay = 1f) { zUpdater.InvokeStatic(new FlexibleMethodDefinition(new <>f__AnonymousDelegate10(BotBark), new object[3] { botId, voiceID, subtitle }), delay); } internal static void BotBark(int botId, uint voiceID, string subtitle = "") { PlayerVoiceManager.WantToSay(botId, voiceID); if (subtitle != "") { zStaticRefrences.Subtitles.ShowSingleLineSubtitle(subtitle, 1f); } } public static void CheckForWakeChance(PlayerAIBot aiBot, GameObject enemyGo, Descriptor descriptor) { } public static void wakeUpRoom(PlayerAIBot aiBot, GameObject enemyGo) { } public static void slowUpdate() { } public static List GetBotList() { if (LastPlayerCount != PlayerManager.PlayerAgentsInLevel.Count) { UpdateBotList(); } else if (_botList == null) { UpdateBotList(); } else if (_botList.Any((PlayerAIBot x) => (Object)(object)x == (Object)null)) { UpdateBotList(); } return _botList; } private static void UpdateBotList() { if (_botList == null) { _botList = new List(); } else { _botList.Clear(); } LastPlayerCount = PlayerManager.PlayerAgentsInLevel.Count; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (current.Owner.IsBot) { _botList.Add(((Component)current).gameObject.GetComponent()); } } } public static void PlayUiSound(uint e) { CM_PageBase.PostSound(e, "PlayUiSound"); } } public class zSearch { public static GameObject FindBestAligned(Transform Look, HashSet Candidates, float MaxAngle = 180f) { return zSearch.FindBestAligned(Look, Candidates, (Func)((GameObject x) => x.transform), MaxAngle); } public static Component FindBestAlignedComponenet(Transform Look, HashSet Candidates, float MaxAngle = 180f) { return zSearch.FindBestAligned(Look, Candidates, (Func)((Component x) => x.transform), MaxAngle); } public static T FindBestAligned(Transform Look, HashSet Candidates, Func GetTransform, float MaxAngle = 180f) where T : Object { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //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_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_0046: 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) Vector3 forward = Look.forward; T result = default(T); float num = MaxAngle; foreach (T Candidate in Candidates) { Vector3 val = GetTransform(Candidate).position - Look.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num2 = Vector3.Angle(forward, normalized); if (num2 < num) { num = num2; result = Candidate; } } return result; } public static Component FindBestInView(Transform Look, Type Type, float MaxDistance = 10000f, float radius = 3f, float MaxAngle = 180f) { Type Type2; return FindBestInView(Look, new HashSet { Type }, out Type2, MaxDistance, radius, MaxAngle); } public static Component FindBestInView(Transform Look, HashSet Types, float MaxDistance = 10000f, float Radius = 3f, float MaxAngle = 180f) { Type Type; return FindBestInView(Look, Types, out Type, MaxDistance, Radius, MaxAngle); } public static Component FindBestInView(Transform Look, HashSet types, out Type Type, float MaxDistance = 10000f, float radius = 3f, float MaxAngle = 180f) { Dictionary> dictionary = new Dictionary>(); HashSet hashSet = new HashSet(new ComponentInstanceIdComparer()); foreach (Type type in types) { HashSet other = (dictionary[type] = FindAllInView(Look, type, MaxDistance, radius)); hashSet.UnionWith(other); } Component val = FindBestAlignedComponenet(Look, hashSet, MaxAngle); Type = null; foreach (KeyValuePair> item in dictionary) { if (item.Value.Contains(val)) { Type = item.Key; break; } } return val; } public static HashSet FindAllInView(Transform Look, float MaxDistance = 10000f, float radius = 3f) where T : Component { HashSet hashSet = FindAllInView(Look, Il2CppType.Of(), MaxDistance, radius); HashSet hashSet2 = new HashSet(); foreach (Component item in hashSet) { T val = ((Il2CppObjectBase)item).TryCast(); if ((Object)(object)val != (Object)null) { hashSet2.Add(val); } } return hashSet2; } public static HashSet FindAllInView(Transform Look, Type Type, float MaxDistance = 10000f, float radius = 3f) { return FindAllInView(Look, new HashSet { Type }, MaxDistance, radius); } public static HashSet FindAllInView(Transform Look, HashSet types, float MaxDistance = 10000f, float radius = 3f) { //IL_0001: 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_0028: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(new Ray(Look.position, Look.forward), ref val, MaxDistance)) { return new HashSet(new ComponentInstanceIdComparer()); } return FindAllNearby(((RaycastHit)(ref val)).point, types, radius); } public static Component FindNearest(Vector3 Position, Type Type, float Radius = 3f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return FindNearest(Position, new HashSet { Type }, Radius); } public static Component FindNearest(Vector3 Position, HashSet Types, float Radius = 3f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Type Type; return FindNearest(Position, out Type, Types, Radius); } public static Component FindNearest(Vector3 Position, out Type Type, HashSet Types, float Radius = 3f) { //IL_0000: 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_002a: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = FindAllNearby(Position, Types, Radius); float num = float.MaxValue; Component result = null; Type = null; foreach (Component item in hashSet) { float num2 = Vector3.Distance(Position, item.transform.position); if (!(num2 < num)) { continue; } num = num2; result = item; foreach (Type Type2 in Types) { if (Type2.IsAssignableFrom(((Object)item).GetIl2CppType())) { Type = Type2; break; } } } return result; } public static HashSet FindAllNearby(Vector3 Position, float Radius = 3f) where T : Component { //IL_0000: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = FindAllNearby(Position, Il2CppType.Of(), Radius); HashSet hashSet2 = new HashSet(); foreach (Component item in hashSet) { T val = ((Il2CppObjectBase)item).TryCast(); if ((Object)(object)val != (Object)null) { hashSet2.Add(val); } } return hashSet2; } public static HashSet FindAllNearby(Vector3 Position, Type Type, float Radius = 3f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return FindAllNearby(Position, new HashSet { Type }, Radius); } public static HashSet FindAllNearby(Vector3 Position, HashSet Types, float Radius = 3f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(new ComponentInstanceIdComparer()); Collider[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(Position, Radius)); foreach (Collider val in array) { foreach (Type Type in Types) { if (!(Type == (Type)null)) { Component componentInParent = ((Component)val).GetComponentInParent(Type); if ((Object)(object)componentInParent != (Object)null) { hashSet.Add(componentInParent); } } } } return hashSet; } public static PrioritySet FindAllInViewSorted(Transform Look, HashSet types, float MaxDistance = 10000f, float radius = 3f, float MaxAngle = 180f) { //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_0079: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0095: 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_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(new ComponentInstanceIdComparer()); foreach (Type type in types) { HashSet other = FindAllInView(Look, type, MaxDistance, radius); hashSet.UnionWith(other); } Vector3 forward = Look.forward; PrioritySet val = new PrioritySet((IEqualityComparer)new ComponentInstanceIdComparer()); foreach (Component item in hashSet) { Vector3 val2 = item.transform.position - Look.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Angle(forward, normalized); if (num >= MaxAngle) { continue; } bool flag = false; for (int i = 0; i < val.Count; i++) { val2 = val[i].transform.position - Look.position; Vector3 normalized2 = ((Vector3)(ref val2)).normalized; float num2 = Vector3.Angle(forward, normalized2); if (num < num2) { val.InsertRelative(item, val[i], false, (int?)null, (ConflictResolution?)null, (DuplicateValuePolicy?)null); flag = true; break; } } if (!flag) { val.Add(item, (int?)null, (ConflictResolution?)null, (DuplicateValuePolicy?)null, (PlacementIndexBias?)null); } } return val; } } public static class zSlideComputer { public static class PermissionDefinitions { private class PermissionDefinition { public sMenu.sMenuNode node; public List actionTypesToCull; public string key; internal PermissionDefinition(string key, sMenu.sMenuNode node = null, List ActionTypesToCull = null) { this.key = key; this.node = node; actionTypesToCull = ActionTypesToCull; if (actionTypesToCull == null) { actionTypesToCull = new List(); } } } private static Dictionary permissionDeffinitions = new Dictionary(); private static List _actionKeysCache = new List(); private static List ActionKeys { get { if (_actionKeysCache.Count != permissionDeffinitions.Count || _actionKeysCache.Except(permissionDeffinitions.Keys).Any() || permissionDeffinitions.Keys.Except(_actionKeysCache).Any()) { _actionKeysCache = permissionDeffinitions.Keys.OrderBy((string k) => k, StringComparer.Ordinal).ToList(); } return _actionKeysCache; } } public static void ClearPermissionDefinitions() { permissionDeffinitions.Clear(); } public static void CreatePermissionDeffinition(string key, bool? defaultPerm = true, sMenu.sMenuNode node = null, sMenu menu = null, Type ActionTypeToCull = null, float? defaultPriority = null, string parrentKey = null, bool hasDefaultValue = false) { List list = new List(); if (ActionTypeToCull != null) { list.Add(ActionTypeToCull); } CreatePermissionDeffinition(key, defaultPerm, node, menu, list, defaultPriority, parrentKey, hasDefaultValue); } public static void CreatePermissionDeffinition(string key, bool? defaultPerm = true, sMenu.sMenuNode node = null, sMenu menu = null, List ActionTypesToCull = null, float? defaultPriority = null, string parrentKey = null, bool hasDefaultValue = false) { if (defaultPriority.HasValue) { ActionPriorities.AddNode("Default" + key, defaultPriority, (string?)null, (Func?)null, (FlexibleMethodDefinition)null, defaultPriority, hasDefaultValue: false); ActionPriorities.AddNode(key, defaultPriority, "Default" + key, null, null, defaultPriority).onChanged.Listen(new <>f__AnonymousDelegate11(AutomaticActionMenuClass.GenericUpdateNodePrioDisplay), new object[1] { node }); } OverrideTree.Node node2 = ActionPermissions.AddNode(key, defaultPerm, parrentKey, null, null, defaultPerm, hasDefaultValue); node2.onChanged.Listen(new Action>(RemoveActionsOfType), new object[1] { ActionTypesToCull }); if (node != null) { node2.onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { key, node }); } if (menu != null) { node2.onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { key, menu.centerNode }); } } public static bool KeyExists(string key) { return ActionKeys.Contains(key); } public static int KeyToId(string key) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (!KeyExists(key)) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unknown actionKey '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(key); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' when converting to id."); } log.LogWarning(val); return -1; } return ActionKeys.IndexOf(key); } public static string IdToKey(int id) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (id < 0 || id >= ActionKeys.Count) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unknown actionId '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(id); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' when converting to key."); } log.LogWarning(val); return null; } return ActionKeys[id]; } } public static OverrideTree ActionPriorities; public static OverrideTree ActionPermissions; public static void Init() { if (ZiMain.HasBetterBots) { BBCompat.SetBotsOpenContainersToFalse(); } zSmartSelectHud.Setup(); } public static void FirstTimeSetup() { } public static void Update() { } public static Dictionary GetBotItems() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown Dictionary dictionary = new Dictionary(); Enumerator enumerator = RootPlayerBotAction.s_itemBasePrios.GetEnumerator(); bool flag = default(bool); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; uint key = current.Key; float value = current.Value; string publicName = GameDataBlockBase.s_blockByID[key].publicName; dictionary[publicName] = value; ManualLogSource log = ZiMain.log; BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(1, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(publicName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(":"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(value); } log.LogMessage(val); } return dictionary; } internal static void GenericToggleAllowed(string actionKey, sMenu.sMenuNode node, bool allowDissabled = false) { if (allowDissabled || node.gameObject.activeInHierarchy) { bool value = !ActionPermissions.ValueAt(actionKey).Value; ActionPermissions.SetValue(actionKey, value, 0uL); } } public static void RemoveActionsOfType(List actionTypes) { foreach (Type actionType in actionTypes) { RemoveActionsOfType(actionType); } } public static void RemoveActionsOfType(Type actionType) { foreach (PlayerAIBot bot in ZiMain.GetBotList()) { RemoveActionsOfType(bot.Agent, actionType); } } public static void RemoveActionsOfType(PlayerAgent agent, Type actionType) { if (!typeof(PlayerBotActionBase).IsAssignableFrom(actionType) || !agent.Owner.IsBot) { return; } List list = new List(); PlayerAIBot component = ((Component)agent).gameObject.GetComponent(); Enumerator enumerator = component.Actions.GetEnumerator(); while (enumerator.MoveNext()) { PlayerBotActionBase current = enumerator.Current; if (((MemberInfo)((Object)current).GetIl2CppType()).Name == actionType.Name) { list.Add(current); } } foreach (PlayerBotActionBase item in list) { component.StopAction(item.DescBase); } } } public static class zStaticRefrences { public static PUI_CommunicationMenu _CommsMenu; public static PUI_Subtitles _Subtitles; private static PlayerAgent _LocalPlayer; public static Transform _CameraTransform; private static HashSet _AllBotAgents; private static HashSet _AllBotObjects; public static Transform[] _SentryRaycastCorners; public static PUI_CommunicationMenu CommsMenu { get { if ((Object)(object)_CommsMenu == (Object)null) { _CommsMenu = GameObject.Find("GUI/CellUI_Camera(Clone)/PlayerLayer/MovementRoot/PUI_CommunicationMenu(Clone)").GetComponent(); } return _CommsMenu; } } public static PUI_Subtitles Subtitles { get { if ((Object)(object)_Subtitles == (Object)null) { _Subtitles = GameObject.Find("GUI/CellUI_Camera(Clone)/PlayerLayer/MovementRoot/PUI_Subtitles_CellUI(Clone)").GetComponent(); } return _Subtitles; } } public static PlayerAgent LocalPlayer { get { if ((Object)(object)_LocalPlayer == (Object)null) { _LocalPlayer = PlayerManager.GetLocalPlayerAgent(); } return _LocalPlayer; } } public static Transform CameraTransform { get { if ((Object)(object)_CameraTransform == (Object)null) { _CameraTransform = ((Component)LocalPlayer.FPSCamera).transform; } return _CameraTransform; } } public static HashSet AllPlayerAgentsInLevel => ((IEnumerable)PlayerManager.PlayerAgentsInLevel.ToArray()).ToHashSet(); public static HashSet AllPlayerAgentObjectsInLevel => ((IEnumerable)PlayerManager.PlayerAgentsInLevel.ToArray()).Select((PlayerAgent agent) => ((Component)agent).gameObject).ToHashSet(); public static HashSet AllBotAgents { get { if (_AllBotAgents == null || _AllBotAgents.Any((PlayerAgent obj) => (Object)(object)obj == (Object)null)) { _AllBotAgents = ((IEnumerable)PlayerManager.PlayerAgentsInLevel.ToArray()).Where((PlayerAgent agent) => agent.Owner.IsBot).ToHashSet(); } return _AllBotAgents; } } public static HashSet AllBotObjects { get { if (_AllBotObjects == null || _AllBotObjects.Any((GameObject obj) => (Object)(object)obj == (Object)null)) { _AllBotObjects = (from agent in (IEnumerable)PlayerManager.PlayerAgentsInLevel.ToArray() where agent.Owner.IsBot select ((Component)agent).gameObject).ToHashSet(); } return _AllBotObjects; } } public static Transform[] SentryRaycastCorners { get { if (_SentryRaycastCorners == null) { _SentryRaycastCorners = LoadSentryCorners(); } return _SentryRaycastCorners; } } private static Transform[] LoadSentryCorners() { Il2CppReferenceArray obj = Resources.FindObjectsOfTypeAll(Il2CppType.Of()); object obj2; if (obj == null) { obj2 = null; } else { Object? obj3 = ((IEnumerable)obj).FirstOrDefault((Func)((Object x) => x.name == "SentryGunFirstPerson")); if (obj3 == null) { obj2 = null; } else { SentryGunFirstPerson obj4 = ((Il2CppObjectBase)obj3).TryCast(); if (obj4 == null) { obj2 = null; } else { GameObject placementIndicatorPrefab = obj4.m_placementIndicatorPrefab; if (placementIndicatorPrefab == null) { obj2 = null; } else { SentryGunPlacementIndicator component = placementIndicatorPrefab.GetComponent(); obj2 = ((component != null) ? component.m_raycastCorners : null); } } } } return Il2CppArrayBase.op_Implicit((Il2CppArrayBase)obj2); } } public class zUpdater : MonoBehaviour { public static FlexibleEvent onUpdate = new FlexibleEvent(); public static FlexibleEvent onLateUpdate = new FlexibleEvent(); public static zUpdater Instance = new zUpdater(); private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)this); ZiMain.log.LogWarning((object)"Multiple updater instances created"); } else { Instance = this; } } public static void CreateInstance() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = new GameObject("zUpdater").AddComponent(); } } private void Update() { onUpdate?.Invoke(); } private void LateUpdate() { onLateUpdate?.Invoke(); } public static void InvokeStatic(FlexibleMethodDefinition method, float time) { if ((Object)(object)Instance == (Object)null) { CreateInstance(); } MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)Instance, Instance.InvokeDelayed(method, time)); } private IEnumerator InvokeDelayed(FlexibleMethodDefinition method, float time) { yield return (object)new WaitForSeconds(time); method.method.DynamicInvoke(method.args); } } public class zCameraEvents : MonoBehaviour { public FlexibleEvent onPreRender = new FlexibleEvent(); private void OnPreRender() { onPreRender?.Invoke(); } } public static class zVisibilityManager { public enum visMethods { VeryFancy, Fancy, Basic, VeryBasic } public struct visSettings { public float maxDistance; public visMethods visMethod; public bool resetCullingCam; public Vector3 observerOffest; public Vector3 targetOffset; public float FOV; public visSettings() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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) maxDistance = 30f; visMethod = visMethods.VeryBasic; resetCullingCam = true; observerOffest = Vector3.zero; targetOffset = Vector3.zero; FOV = 90f; } } private static class Setup { public static void SetUpObservationCamera() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) _observationCamera = observercamGobject.GetComponent(); if ((Object)(object)_observationCamera == (Object)null) { _observationCamera = observercamGobject.AddComponent(); } ((Behaviour)observationCamera).enabled = false; observationCamera.allowMSAA = false; observationCamera.useOcclusionCulling = false; observationCamera.farClipPlane = 150f; observationCamera.targetTexture = renderTexture; observationCamera.clearFlags = (CameraClearFlags)2; observationCamera.backgroundColor = Color.black; observationCamera.cullingMask = (1 << LayerMask.NameToLayer("Default")) | (1 << LayerMask.NameToLayer("Enemy")) | (1 << LayerMask.NameToLayer("Dynamic")); } public static void SetUpMaterals() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) unlitMat = new Material(Shader.Find("Unlit/Color")); unlitMat.color = Color.white; } } public static class Settings { public static Vector2Int resolution; static Settings() { //IL_0004: 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) resolution = new Vector2Int(16, 16); } } public static class HelperMethods { public struct CameraSettings { public float fieldOfView; public float nearClipPlane; public float farClipPlane; public bool allowMSAA; public bool useOcclusionCulling; public CameraClearFlags clearFlags; public Color backgroundColor; public LayerMask cullingMask; public Vector3 agentPosition; public Quaternion agentRotation; public Vector3 camPosition; public Quaternion camRotation; public RenderTexture targetTexture; } public static float InverseLerp(float min, float max, float value) { return (value - min) / (max - min); } public static void QuaternionToYawPitch(Quaternion q, out float yaw, out float pitch) { //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_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) //IL_000d: 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_0026: Unknown result type (might be due to invalid IL or missing references) Vector3 val = q * Vector3.forward; yaw = Mathf.Atan2(val.x, val.z) * 57.29578f; pitch = (0f - Mathf.Asin(Mathf.Clamp(val.y, -1f, 1f))) * 57.29578f; } public static CameraSettings SaveSettings() { //IL_0059: 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_0066: 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_0078: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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) Camera main = Camera.main; FPSCamera component = ((Component)main).GetComponent(); return new CameraSettings { fieldOfView = main.fieldOfView, nearClipPlane = main.nearClipPlane, farClipPlane = main.farClipPlane, allowMSAA = main.allowMSAA, useOcclusionCulling = main.useOcclusionCulling, clearFlags = main.clearFlags, backgroundColor = main.backgroundColor, cullingMask = LayerMask.op_Implicit(main.cullingMask), camPosition = ((Component)main).transform.position, camRotation = ((Component)main).transform.rotation, targetTexture = main.targetTexture, agentPosition = component.Position, agentRotation = component.Rotation }; } public static void SetSettings(Camera source) { //IL_004f: 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_007d: 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_00af: 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_00d6: 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_010f: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; FPSCamera component = ((Component)main).gameObject.GetComponent(); main.fieldOfView = source.fieldOfView; main.nearClipPlane = source.nearClipPlane; main.farClipPlane = source.farClipPlane; main.allowMSAA = source.allowMSAA; main.useOcclusionCulling = source.useOcclusionCulling; main.clearFlags = source.clearFlags; main.backgroundColor = source.backgroundColor; main.cullingMask = source.cullingMask; ((Component)main).transform.position = ((Component)source).transform.position; ((Component)main).transform.rotation = ((Component)source).transform.rotation; main.targetTexture = source.targetTexture; component.Position = ((Component)source).transform.position; component.Rotation = ((Component)source).transform.rotation; ((Agent)component.m_owner).Position = ((Component)source).transform.position; ((Component)component.m_owner).transform.rotation = ((Component)source).transform.rotation; float yaw = ((LookCameraController)component).m_yaw; float pitch = ((LookCameraController)component).m_pitch; QuaternionToYawPitch(((Component)source).transform.rotation, out yaw, out pitch); ((LookCameraController)component).m_yaw = yaw; ((LookCameraController)component).m_pitch = pitch; } public static void SetSettings(CameraSettings settings) { //IL_004a: 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_0062: 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_0089: 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_00ac: 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_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) Camera main = Camera.main; FPSCamera component = ((Component)main).GetComponent(); main.fieldOfView = settings.fieldOfView; main.nearClipPlane = settings.nearClipPlane; main.farClipPlane = settings.farClipPlane; main.allowMSAA = settings.allowMSAA; main.useOcclusionCulling = settings.useOcclusionCulling; main.clearFlags = settings.clearFlags; main.backgroundColor = settings.backgroundColor; main.cullingMask = LayerMask.op_Implicit(settings.cullingMask); ((Component)main).transform.position = settings.camPosition; ((Component)main).transform.rotation = settings.camRotation; main.targetTexture = settings.targetTexture; component.Position = settings.agentPosition; component.Rotation = settings.agentRotation; ((Agent)component.m_owner).Position = settings.agentPosition; ((Component)component.m_owner).transform.rotation = settings.agentRotation; float yaw = ((LookCameraController)component).m_yaw; float pitch = ((LookCameraController)component).m_pitch; QuaternionToYawPitch(settings.agentRotation, out yaw, out pitch); ((LookCameraController)component).m_yaw = yaw; ((LookCameraController)component).m_pitch = pitch; } public static void CopyTextureAtlasToCpu() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) RenderTexture active = RenderTexture.active; RenderTexture.active = renderTextureAtlas; textureAtlas.ReadPixels(new Rect(0f, 0f, (float)((Texture)renderTextureAtlas).width, (float)((Texture)renderTextureAtlas).height), 0, 0, false); textureAtlas.Apply(false, false); RenderTexture.active = active; } public static bool IsClose(Color32 c, Color target, float tol) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) float num = (float)(int)c.r / 255f; float num2 = (float)(int)c.g / 255f; float num3 = (float)(int)c.b / 255f; if (Mathf.Abs(num - target.r) <= tol && Mathf.Abs(num2 - target.g) <= tol) { return Mathf.Abs(num3 - target.b) <= tol; } return false; } public static Color GetAverageColor(RenderTexture renderTexture, Color ignoreColor, float tolerance = 0.01f) { //IL_0037: 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_0078: 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_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_008a: 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_00dc: 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_00b1: 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_0093: 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) if ((Object)(object)renderTexture == (Object)null) { return Color.clear; } RenderTexture active = RenderTexture.active; RenderTexture.active = renderTexture; scratchBoard.ReadPixels(new Rect(0f, 0f, (float)((Texture)renderTexture).width, (float)((Texture)renderTexture).height), 0, 0); scratchBoard.Apply(); RenderTexture.active = active; Color32[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)scratchBoard.GetPixels32()); long num = 0L; long num2 = 0L; long num3 = 0L; long num4 = 0L; Color32[] array2 = array; foreach (Color32 val in array2) { if (!IsClose(val, ignoreColor, tolerance) && (val.r != 0 || val.g != 0 || val.b != 0)) { num += val.r; num2 += val.g; num3 += val.b; num4++; } } if (num4 == 0L) { return Color.clear; } return new Color((float)num / ((float)num4 * 255f), (float)num2 / ((float)num4 * 255f), (float)num3 / ((float)num4 * 255f), 1f); } public static void StoreMaterals(GameObject target) { originalMats.Clear(); zVisibilityManager.rendererCache = Il2CppArrayBase.op_Implicit(target.GetComponentsInChildren()); Renderer[] rendererCache = zVisibilityManager.rendererCache; foreach (Renderer val in rendererCache) { originalMats.Add(((IEnumerable)val.sharedMaterials).ToArray()); } } public static void RestoreMaterals() { for (int i = 0; i < rendererCache.Length; i++) { rendererCache[i].sharedMaterials = Il2CppReferenceArray.op_Implicit(originalMats[i]); } originalMats.Clear(); } public static void SetMateral(Material materal) { Renderer[] rendererCache = zVisibilityManager.rendererCache; foreach (Renderer val in rendererCache) { Material[] array = (Material[])(object)new Material[((Il2CppArrayBase)(object)val.sharedMaterials).Length]; for (int j = 0; j < array.Length; j++) { array[j] = materal; } val.sharedMaterials = Il2CppReferenceArray.op_Implicit(array); } } public static void CopyToAtlas(int index) { if ((Object)(object)renderTexture == (Object)null || (Object)(object)renderTextureAtlas == (Object)null) { throw new ArgumentNullException("RenderTexture or atlas is null."); } if (index < 0 || index >= ((Texture)renderTextureAtlas).height / ((Texture)renderTexture).height) { throw new ArgumentOutOfRangeException("index", "Index out of bounds for atlas bands."); } int height = ((Texture)renderTexture).height; int num = index * height; Graphics.CopyTexture((Texture)(object)renderTexture, 0, 0, 0, 0, ((Texture)renderTexture).width, height, (Texture)(object)renderTextureAtlas, 0, 0, 0, num); } public static float CalculateVerticalFov(Vector3 observerPos, BoundingBox targetBounds) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) float y = targetBounds.Size.y; float num = Vector3.Distance(observerPos, targetBounds.Center); if (num < 0.0001f || y <= 0f) { return 1f; } return Mathf.Clamp(2f * Mathf.Atan(y / (2f * num)) * 57.29578f + VisDebug.fovOffset, 0.0001f, 179f); } public static Vector3[] GetCorners(Bounds bounds) { //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_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) //IL_0018: 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_001f: 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_002b: 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_003c: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: 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_0094: 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_00a5: 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_00ad: 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_00ba: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_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_0106: 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) //IL_0111: 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_011d: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_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_013d: Unknown result type (might be due to invalid IL or missing references) Vector3 center = ((Bounds)(ref bounds)).center; Vector3 extents = ((Bounds)(ref bounds)).extents; return (Vector3[])(object)new Vector3[8] { center + new Vector3(extents.x, extents.y, extents.z), center + new Vector3(extents.x, extents.y, 0f - extents.z), center + new Vector3(extents.x, 0f - extents.y, extents.z), center + new Vector3(extents.x, 0f - extents.y, 0f - extents.z), center + new Vector3(0f - extents.x, extents.y, extents.z), center + new Vector3(0f - extents.x, extents.y, 0f - extents.z), center + new Vector3(0f - extents.x, 0f - extents.y, extents.z), center + new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z) }; } public static Bounds GetMaxBounds(GameObject go) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Bounds rendererMaxBounds = GetRendererMaxBounds(go); ((Bounds)(ref rendererMaxBounds)).Encapsulate(GetColliderMaxBounds(go)); return rendererMaxBounds; } public static Bounds GetRendererMaxBounds(GameObject go) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_001f: 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_0063: Unknown result type (might be due to invalid IL or missing references) Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(); if (componentsInChildren.Length == 0) { return new Bounds(go.transform.position, Vector3.zero); } Bounds bounds = componentsInChildren[0].bounds; foreach (Renderer item in componentsInChildren) { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } return bounds; } public static Bounds GetColliderMaxBounds(GameObject go) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_001f: 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_0063: Unknown result type (might be due to invalid IL or missing references) Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(); if (componentsInChildren.Length == 0) { return new Bounds(go.transform.position, Vector3.zero); } Bounds bounds = componentsInChildren[0].bounds; foreach (Collider item in componentsInChildren) { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } return bounds; } public static Color HueShift(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) float num3 = default(float); float num = default(float); float num2 = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); num = (num + 0.5f) % 1f; num2 = ((num2 > 0.001f) ? num2 : 0f); return Color.HSVToRGB(num, num2, num3, true); } public static Dictionary BackupLayers(GameObject root) { Dictionary dictionary = new Dictionary(); foreach (Transform componentsInChild in root.GetComponentsInChildren(true)) { dictionary[((Object)((Component)componentsInChild).gameObject).GetInstanceID()] = ((Component)componentsInChild).gameObject.layer; } return dictionary; } public static void RestoreLayers(GameObject root, Dictionary backup) { foreach (Transform componentsInChild in root.GetComponentsInChildren(true)) { int instanceID = ((Object)((Component)componentsInChild).gameObject).GetInstanceID(); if (backup.TryGetValue(instanceID, out var value)) { ((Component)componentsInChild).gameObject.layer = value; } } } public static void SetLayer(GameObject root, int layer) { root.layer = layer; foreach (Transform componentsInChild in root.GetComponentsInChildren(true)) { ((Component)componentsInChild).gameObject.layer = layer; } } public static int CountWhitePixels(RenderTexture renderTexture) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0039: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) RenderTexture active = RenderTexture.active; RenderTexture.active = renderTexture; Texture2D val = new Texture2D(((Texture)renderTexture).width, ((Texture)renderTexture).height, (TextureFormat)3, false); val.ReadPixels(new Rect(0f, 0f, (float)((Texture)renderTexture).width, (float)((Texture)renderTexture).height), 0, 0); val.Apply(); int num = 0; Color32[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)val.GetPixels32()); foreach (Color32 val2 in array) { if (val2.r == byte.MaxValue && val2.g == byte.MaxValue && val2.b == byte.MaxValue) { num++; } } RenderTexture.active = active; Object.Destroy((Object)(object)val); return num; } } private static class VisDebug { public static bool debugMode; public static GameObject debugParrent; public static bool applyMask; public static float maxVisibilityforMaxScore; public static float minVisiblityForMinScore; public static float emmisivenessOn; public static float emmisivenessOff; public static bool alwaysEmit; public static Color AverageColor; public static Color invertedColor; internal static float fovOffset; public static readonly Dictionary debugQuads; static VisDebug() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown debugMode = true; applyMask = true; maxVisibilityforMaxScore = 0.3f; minVisiblityForMinScore = 0.1f; emmisivenessOn = 0.75f; emmisivenessOff = 0.1f; alwaysEmit = false; AverageColor = Color.black; invertedColor = Color.white; fovOffset = 5f; debugParrent = new GameObject("zVisDebug"); debugQuads = new Dictionary(); } internal static void CreateDebugHud(int index) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_009f: 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_00bc: Expected O, but got Unknown //IL_00e9: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: 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_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: 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_0479: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)debugParrent == (Object)null) { debugParrent = new GameObject("zVisDebug"); } string text = $"DebugHudTexture_{index}"; if (!debugQuads.TryGetValue(index, out var value)) { value = new GameObject(text); value.transform.SetParent(debugParrent.transform, false); Canvas obj = value.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 9999; CanvasScaler obj2 = value.AddComponent(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); value.AddComponent(); GameObject val = new GameObject("AtlasImage"); val.transform.SetParent(value.transform, false); RectTransform component = ((Component)val.AddComponent()).GetComponent(); component.anchorMin = new Vector2(1f, 0f); component.anchorMax = new Vector2(1f, 0f); component.pivot = new Vector2(1f, 0f); float num = -70f - (float)index * ((float)(((Texture)textureAtlas).width * 4) + 60f); component.anchoredPosition = new Vector2(num, 10f); component.sizeDelta = new Vector2((float)(((Texture)textureAtlas).width * 4), (float)(((Texture)textureAtlas).height * 4)); debugQuads[index] = value; int num2 = ((Vector2Int)(ref Settings.resolution)).y * 4; int num3 = ((Texture)textureAtlas).height / ((Vector2Int)(ref Settings.resolution)).y; for (int i = 0; i < num3; i++) { GameObject val2 = new GameObject($"Label_{i}"); val2.transform.SetParent(val.transform, false); Text obj3 = val2.AddComponent(); obj3.text = i.ToString(); obj3.font = Resources.GetBuiltinResource("Arial.ttf"); obj3.fontSize = 20; ((Graphic)obj3).color = Color.white; obj3.alignment = (TextAnchor)3; RectTransform component2 = ((Component)obj3).GetComponent(); component2.anchorMin = new Vector2(1f, 0f); component2.anchorMax = new Vector2(1f, 0f); component2.pivot = new Vector2(0f, 0.5f); component2.anchoredPosition = new Vector2(5f, (float)(i * num2) + (float)num2 / 2f); component2.sizeDelta = new Vector2(40f, 30f); } float num4 = component.sizeDelta.x / 2f; float num5 = 30f; GameObject val3 = new GameObject("AverageColorSwatch"); val3.transform.SetParent(val.transform, false); Image obj4 = val3.AddComponent(); ((Graphic)obj4).color = AverageColor; RectTransform component3 = ((Component)obj4).GetComponent(); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(0f, 1f); component3.pivot = new Vector2(0f, 0f); component3.anchoredPosition = new Vector2(0f, 10f); component3.sizeDelta = new Vector2(num4, num5); GameObject val4 = new GameObject("HueShiftColorSwatch"); val4.transform.SetParent(val.transform, false); Image obj5 = val4.AddComponent(); ((Graphic)obj5).color = invertedColor; RectTransform component4 = ((Component)obj5).GetComponent(); component4.anchorMin = new Vector2(0f, 1f); component4.anchorMax = new Vector2(0f, 1f); component4.pivot = new Vector2(0f, 0f); component4.anchoredPosition = new Vector2(num4, 10f); component4.sizeDelta = new Vector2(num4, num5); } RawImage componentInChildren = value.GetComponentInChildren(); Texture2D val5 = new Texture2D(((Texture)textureAtlas).width, ((Texture)textureAtlas).height, (TextureFormat)4, false); val5.SetPixels(textureAtlas.GetPixels()); val5.Apply(); componentInChildren.texture = (Texture)(object)val5; foreach (Image componentsInChild in value.GetComponentsInChildren()) { if (((Object)componentsInChild).name == "AverageColorSwatch") { ((Graphic)componentsInChild).color = AverageColor; } if (((Object)componentsInChild).name == "HueShiftColorSwatch") { ((Graphic)componentsInChild).color = invertedColor; } } } } private class Vector3Comparer : IEqualityComparer { private const float tolerance = 0.0001f; public bool Equals(Vector3 a, Vector3 b) { //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) Vector3 val = a - b; return ((Vector3)(ref val)).sqrMagnitude < 9.999999E-09f; } public int GetHashCode(Vector3 v) { //IL_0000: 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_0023: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.RoundToInt(v.x / 0.0001f); int num2 = Mathf.RoundToInt(v.y / 0.0001f); int num3 = Mathf.RoundToInt(v.z / 0.0001f); return (num * 73856093) ^ (num2 * 19349663) ^ (num3 * 83492791); } } private static Camera _observationCamera; private static GameObject observercamGobject; private static ExteriorCamera observerExteriroCamera; private static FPSCamera fpsCamera; private static PreLitVolume PreLitVolume; private static RenderTexture renderTextureAtlas; private static RenderTexture renderTexture; private static Texture2D textureAtlas; private static Texture2D scratchBoard; private static Material unlitMat; private static Material litMat; private static List originalMats; private static Renderer[] rendererCache; private static Dictionary boundingBoxCache; private static Camera real_C_Cam_cam; private static C_MovingCuller real_C_Cam_agent; private static Camera r_camera; private static Transform r_transform; public static Camera observationCamera { get { if ((Object)(object)_observationCamera == (Object)null) { Setup.SetUpObservationCamera(); } return _observationCamera; } } private static bool cullingCamInOriginalState { get { if ((Object)(object)real_C_Cam_cam == (Object)(object)C_Camera.Current.m_camera) { return (Object)(object)real_C_Cam_agent == (Object)(object)C_Camera.Current.m_cullAgent; } return false; } } static zVisibilityManager() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown originalMats = new List(); real_C_Cam_cam = C_Camera.Current.m_camera; real_C_Cam_agent = C_Camera.Current.m_cullAgent; r_camera = new Camera(); r_transform = new Transform(); observercamGobject = new GameObject("ObserverCam"); renderTexture = new RenderTexture(((Vector2Int)(ref Settings.resolution)).x, ((Vector2Int)(ref Settings.resolution)).y, 1, (RenderTextureFormat)0); Setup.SetUpObservationCamera(); Setup.SetUpMaterals(); scratchBoard = new Texture2D(((Vector2Int)(ref Settings.resolution)).x, ((Vector2Int)(ref Settings.resolution)).y, (TextureFormat)3, false); } public static float CheckObjectVisiblity(GameObject target, GameObject observer) { visSettings settings = new visSettings(); return CheckObjectVisiblity(target, observer, settings); } public static float CheckObjectVisiblity(GameObject target, GameObject observer, visMethods vismethod) { visSettings settings = new visSettings(); settings.visMethod = vismethod; return CheckObjectVisiblity(target, observer, settings); } public static float CheckObjectVisiblity(GameObject target, GameObject observer, float maxDistance) { visSettings settings = new visSettings(); settings.maxDistance = maxDistance; return CheckObjectVisiblity(target, observer, settings); } public static float CheckObjectVisiblity(GameObject target, GameObject observer, visSettings settings) { float result = 0f; switch (settings.visMethod) { case visMethods.VeryFancy: result = VeryFancyObjectVisilityCheck(target, observer, settings); break; case visMethods.Fancy: result = FancyObjectVisibilityChec(target, observer, settings); break; case visMethods.Basic: result = BasicObjectVisibilityChec(target, observer, settings); break; case visMethods.VeryBasic: result = VeryBasicObjectVisibilityCheck(target, observer, settings); break; } return result; } private static float VeryFancyObjectVisilityCheck(GameObject target, GameObject observer, visSettings settings) { //IL_001e: 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_002e: 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_0037: 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_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_0080: 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_00b8: 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_014c: 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_0180: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)observer == (Object)null) { return 0f; } Vector3 val = target.transform.position - observer.transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (Vector3.Angle(observer.transform.forward, normalized) > settings.FOV / 2f) { return 0f; } float maxDistance = settings.maxDistance; PreLitVolume prelitVolume = ((Component)Camera.main).GetComponent().PrelitVolume; float value = prelitVolume.GetFogDensity(target.transform.position) + prelitVolume.GetFogDensity(observer.transform.position); value = HelperMethods.InverseLerp(3f, 0f, value); maxDistance *= value; if (Vector3.Distance(target.transform.position, observer.transform.position) > maxDistance) { return 0f; } Camera camera = C_Camera.Current.m_camera; C_MovingCuller cullAgent = C_Camera.Current.m_cullAgent; C_Camera.Current.m_camera = observationCamera; C_Camera current = C_Camera.Current; object obj; if (observer == null) { obj = null; } else { GameObject gameObject = observer.gameObject; obj = ((gameObject != null) ? gameObject.GetComponent() : null); } if (obj == null) { obj = C_Camera.Current.m_cullAgent; } current.m_cullAgent = (C_MovingCuller)obj; C_Camera.Current.RunVisibility(); observercamGobject.gameObject.transform.position = observer.transform.position; BoundingBox boundingBox = new BoundingBox(target, BoundingBox.BoundingSource.Renderers); observercamGobject.transform.LookAt(boundingBox.Center); observationCamera.fieldOfView = HelperMethods.CalculateVerticalFov(observer.transform.position, boundingBox); observationCamera.farClipPlane = settings.maxDistance; HelperMethods.StoreMaterals(target); HelperMethods.SetMateral(unlitMat); observationCamera.Render(); HelperMethods.RestoreMaterals(); C_Camera.Current.m_camera = camera; C_Camera.Current.m_cullAgent = cullAgent; C_Camera.Current.RunVisibility(); return HelperMethods.CountWhitePixels(renderTexture); } private static float FancyObjectVisibilityChec(GameObject target, GameObject observer, visSettings settings) { return 0f; } private static float BasicObjectVisibilityChec(GameObject target, GameObject observer, visSettings settings) { //IL_003c: 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_0074: 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_00bb: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00ff: 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_011a: 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_0126: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)observer == (Object)null) { return 0f; } float num = 0f; float maxDistance = settings.maxDistance; PreLitVolume prelitVolume = ((Component)Camera.main).GetComponent().PrelitVolume; float value = prelitVolume.GetFogDensity(target.transform.position) + prelitVolume.GetFogDensity(observer.transform.position); value = HelperMethods.InverseLerp(3f, 0f, value); maxDistance *= value; if (Vector3.Distance(target.transform.position, observer.transform.position) > maxDistance) { return 0f; } BoundingBox boundingBox = new BoundingBox(observer); BoundingBox boundingBox2 = new BoundingBox(target); RaycastHit val2 = default(RaycastHit); foreach (Vector3 corner in boundingBox.GetCorners()) { foreach (Vector3 corner2 in boundingBox2.GetCorners()) { Vector3 val = corner2 + settings.targetOffset - (corner + settings.observerOffest); float num2 = ((Vector3)(ref val)).magnitude * 2f; int num3 = 1017857; if (Physics.Raycast(corner + settings.observerOffest, ((Vector3)(ref val)).normalized, ref val2, num2, num3)) { if ((Object)(object)((Component)((RaycastHit)(ref val2)).collider).gameObject == (Object)(object)target || ((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(target.transform)) { num += 1f; } } else { num += 1f; } } } return num / 729f * value; } private static float VeryBasicObjectVisibilityCheck(GameObject target, GameObject observer, visSettings settings) { //IL_009e: 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_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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_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_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_00fa: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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) //IL_0111: 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_0136: 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_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)observer == (Object)null) { return 0f; } float num = settings.maxDistance; float num2 = 1f; if ((Object)(object)Camera.main != (Object)null) { FPSCamera component = ((Component)Camera.main).GetComponent(); if ((Object)(object)((component != null) ? component.PrelitVolume : null) != (Object)null) { PreLitVolume prelitVolume = component.PrelitVolume; num2 = prelitVolume.GetFogDensity(target.transform.position) + prelitVolume.GetFogDensity(observer.transform.position); num2 = HelperMethods.InverseLerp(3f, 0f, num2); num *= num2; } } if (Vector3.Distance(target.transform.position, observer.transform.position) > num) { return 0f; } Bounds rendererMaxBounds = HelperMethods.GetRendererMaxBounds(observer); ((Bounds)(ref rendererMaxBounds)).Encapsulate(HelperMethods.GetColliderMaxBounds(observer)); Bounds rendererMaxBounds2 = HelperMethods.GetRendererMaxBounds(target); ((Bounds)(ref rendererMaxBounds2)).Encapsulate(HelperMethods.GetColliderMaxBounds(target)); Vector3 val = ((Bounds)(ref rendererMaxBounds)).center + settings.observerOffest; Vector3 val2 = ((Bounds)(ref rendererMaxBounds2)).center + settings.targetOffset - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude <= Mathf.Epsilon) { return 1f; } int num3 = 1017857; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val3, magnitude, num3)) { if ((Object)(object)((Component)((RaycastHit)(ref val3)).collider).gameObject == (Object)(object)target || ((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(target.transform)) { return num2; } return 0f; } return num2; } } internal class zVisiblityManagerMessy { private static Camera _observerCam; private static RenderTexture _renderTexture; private static Texture2D _tex; private static Material _solidWhite; private static List colorsToCheck; private static Renderer[] targetRenderers; private static Texture2D visiblityTexture; private static GameObject _fullQuad; private static Material _quadMat; private static readonly Dictionary _quads; private static bool applyMask; private static float toleranceFloor; private static float toleranceCeling; public static float emmisivenessOn; public static float emmisivenessOff; public static bool alwaysEmit; public static Color AverageColor; public static Color invertedColor; static zVisiblityManagerMessy() { //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_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_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_006e: 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_00f0: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0132: 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_0150: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) colorsToCheck = new List(); _quads = new Dictionary(); applyMask = true; toleranceFloor = 0.1f; toleranceCeling = 0.3f; emmisivenessOn = 0.75f; emmisivenessOff = 0.1f; alwaysEmit = false; AverageColor = Color.black; invertedColor = Color.white; GameObject val = new GameObject("ObserverCam") { hideFlags = (HideFlags)61 }; _observerCam = val.AddComponent(); ((Behaviour)_observerCam).enabled = false; _observerCam.allowMSAA = false; _observerCam.cullingMask = (1 << LayerMask.NameToLayer("Default")) | (1 << LayerMask.NameToLayer("Enemy")); _observerCam.useOcclusionCulling = false; _observerCam.farClipPlane = 20f; val.AddComponent(); _renderTexture = new RenderTexture(128, 128, 1, (RenderTextureFormat)0) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1, autoGenerateMips = false, antiAliasing = 1 }; _observerCam.targetTexture = _renderTexture; _solidWhite = new Material(Shader.Find("Unlit/Color")); _solidWhite.color = Color.white; colorsToCheck.Add(Color.red); colorsToCheck.Add(Color.green); colorsToCheck.Add(Color.blue); _quadMat = new Material(Shader.Find("Unlit/Texture")); _quadMat.mainTexture = (Texture)(object)_renderTexture; _quadMat.mainTexture.filterMode = (FilterMode)0; _fullQuad = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_fullQuad).name = "FullSilhouetteQuad"; _fullQuad.transform.localScale = Vector3.one * 0.5f; ((Renderer)_fullQuad.GetComponent()).material = _quadMat; Object.DontDestroyOnLoad((Object)(object)_fullQuad); } private static void CreateQuad(Transform position, Texture2D texture) { //IL_0001: 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) //IL_0035: 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_0068: 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) _ = position.forward * 0.5f; _fullQuad = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_fullQuad).name = "textureQuad"; _fullQuad.transform.localScale = Vector3.one * 0.5f; ((Renderer)_fullQuad.GetComponent()).material = _quadMat; _fullQuad.transform.position = position.position; _fullQuad.transform.rotation = position.rotation; ((Renderer)_fullQuad.GetComponent()).material.mainTexture = (Texture)(object)texture; } public static float CalculateVerticalFov(Vector3 observerPos, Bounds targetBounds) { //IL_0002: 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_0010: Unknown result type (might be due to invalid IL or missing references) float y = ((Bounds)(ref targetBounds)).size.y; float num = Vector3.Distance(observerPos, ((Bounds)(ref targetBounds)).center); if (num < 0.0001f || y <= 0f) { return 1f; } return Mathf.Clamp(2f * Mathf.Atan(y / (2f * num)) * 57.29578f, 0.0001f, 179f); } public static Bounds GetMaxBounds(GameObject go) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Bounds rendererMaxBounds = GetRendererMaxBounds(go); ((Bounds)(ref rendererMaxBounds)).Encapsulate(GetColliderMaxBounds(go)); return rendererMaxBounds; } public static Bounds GetRendererMaxBounds(GameObject go) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_001f: 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_0063: Unknown result type (might be due to invalid IL or missing references) Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(); if (componentsInChildren.Length == 0) { return new Bounds(go.transform.position, Vector3.zero); } Bounds bounds = componentsInChildren[0].bounds; foreach (Renderer item in componentsInChildren) { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } return bounds; } public static Bounds GetColliderMaxBounds(GameObject go) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_001f: 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_0063: Unknown result type (might be due to invalid IL or missing references) Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(); if (componentsInChildren.Length == 0) { return new Bounds(go.transform.position, Vector3.zero); } Bounds bounds = componentsInChildren[0].bounds; foreach (Collider item in componentsInChildren) { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } return bounds; } public static float CheckForObject(GameObject observer, GameObject target, PlayerAgent agent = null, GameObject debug = null) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_011b: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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) if ((Object)(object)target == (Object)null) { return 0f; } targetRenderers = Il2CppArrayBase.op_Implicit(target.GetComponentsInChildren()); if (targetRenderers.Length == 0) { return 0f; } List list = new List(); Renderer[] array = targetRenderers; foreach (Renderer val in array) { list.Add(((IEnumerable)val.sharedMaterials).ToArray()); } array = targetRenderers; foreach (Renderer val2 in array) { Material[] array2 = (Material[])(object)new Material[((Il2CppArrayBase)(object)val2.sharedMaterials).Length]; for (int j = 0; j < array2.Length; j++) { array2[j] = _solidWhite; } val2.sharedMaterials = Il2CppReferenceArray.op_Implicit(array2); } _fullQuad.gameObject.SetActive(false); ((Component)_observerCam).transform.position = observer.transform.position; Bounds maxBounds = GetMaxBounds(target); ((Component)_observerCam).transform.LookAt(((Bounds)(ref maxBounds)).center); _observerCam.fieldOfView = CalculateVerticalFov(((Component)_observerCam).transform.position, maxBounds); Camera camera = C_Camera.Current.m_camera; C_MovingCuller cullAgent = C_Camera.Current.m_cullAgent; C_Camera.Current.m_camera = _observerCam; C_Camera current = C_Camera.Current; object obj; if (agent == null) { obj = null; } else { GameObject gameObject = ((Component)agent).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent() : null); } if (obj == null) { obj = C_Camera.Current.m_cullAgent; } current.m_cullAgent = (C_MovingCuller)obj; C_Camera.Current.RunVisibility(); _observerCam.Render(); visiblityTexture = new Texture2D(((Texture)_renderTexture).width, ((Texture)_renderTexture).height, (TextureFormat)3, false); ((Texture)visiblityTexture).filterMode = (FilterMode)0; ((Texture)visiblityTexture).wrapMode = (TextureWrapMode)1; RenderTexture.active = _renderTexture; visiblityTexture.ReadPixels(new Rect(0f, 0f, (float)((Texture)_renderTexture).width, (float)((Texture)_renderTexture).height), 0, 0); visiblityTexture.Apply(); AverageColor = GetAverageColor(visiblityTexture, Color.white); invertedColor = InvertColor(AverageColor); GetOrCreateQuad(-1, debug ?? observer, visiblityTexture, -1); FilterTexture(visiblityTexture, Color.white); float val3 = CountColorPixels(visiblityTexture, Color.white, 0.4f, 0.6f); Texture2D colorVisibleTexture; float num = RunVisibilityPass(observer, target, invertedColor, out colorVisibleTexture) / Math.Max(float.Epsilon, val3); C_Camera.Current.m_cullAgent = cullAgent; C_Camera.Current.m_camera = camera; GetOrCreateQuad(1, debug ?? observer, colorVisibleTexture, 1); for (int k = 0; k < targetRenderers.Length; k++) { targetRenderers[k].sharedMaterials = Il2CppReferenceArray.op_Implicit(list[k]); } ShowVisibilityNumber(num, invertedColor); return num; } private static float RunVisibilityPass(GameObject observer, GameObject target, Color color, out Texture2D colorVisibleTexture) { //IL_0000: 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_0084: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) Material val = CreatelitMaterial(color, target.GetComponent()); Renderer[] array = targetRenderers; foreach (Renderer val2 in array) { Material[] array2 = (Material[])(object)new Material[((Il2CppArrayBase)(object)val2.sharedMaterials).Length]; for (int j = 0; j < array2.Length; j++) { array2[j] = val; } val2.sharedMaterials = Il2CppReferenceArray.op_Implicit(array2); } _observerCam.Render(); colorVisibleTexture = new Texture2D(((Texture)_renderTexture).width, ((Texture)_renderTexture).height, (TextureFormat)3, false); RenderTexture.active = _renderTexture; colorVisibleTexture.ReadPixels(new Rect(0f, 0f, (float)((Texture)_renderTexture).width, (float)((Texture)_renderTexture).height), 0, 0); colorVisibleTexture.Apply(); if (applyMask) { ApplyMask(colorVisibleTexture, visiblityTexture); } return CountColorPixels(colorVisibleTexture, color, toleranceFloor, toleranceCeling); } private static void FilterTexture(Texture2D tex, Color color, int tolerance = 0) { //IL_000c: 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_0028: 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_0087: 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) Color32[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)tex.GetPixels32()); byte b = (byte)(color.r * 255f); byte b2 = (byte)(color.g * 255f); byte b3 = (byte)(color.b * 255f); for (int i = 0; i < array.Length; i++) { int num = array[i].r - b; int num2 = array[i].g - b2; int num3 = array[i].b - b3; if (num * num + num2 * num2 + num3 * num3 > tolerance * tolerance) { array[i] = Color32.op_Implicit(Color.black); } } tex.SetPixels32(Il2CppStructArray.op_Implicit(array)); tex.Apply(); } private static Color NormalizeColor(Color c) { //IL_0008: 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_001a: 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_002f: 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_003f: 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_004d: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(new float[3] { c.r, c.g, c.b }); if (num > 0f) { return new Color(c.r / num, c.g / num, c.b / num, c.a); } return c; } public static Color GetAverageColor(Texture2D tex, Color? ignoreColor = null, float tolerance = 0.01f) { //IL_0028: 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_00ac: 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_00c2: 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_003a: 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_0046: 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_0062: 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_0080: 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_0128: 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) Color32[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)tex.GetPixels32()); long num = 0L; long num2 = 0L; long num3 = 0L; long num4 = 0L; int num5 = 0; Color32[] array2 = array; foreach (Color32 val in array2) { if (ignoreColor.HasValue) { Color32 val2 = Color32.op_Implicit(ignoreColor.Value); float num6 = Mathf.Abs((float)(int)val.r / 255f - (float)(int)val2.r); float num7 = Mathf.Abs((float)(int)val.g / 255f - (float)(int)val2.g); float num8 = Mathf.Abs((float)(int)val.b / 255f - (float)(int)val2.b); if (num6 <= tolerance && num7 <= tolerance && num8 <= tolerance) { continue; } } num += val.r; num2 += val.g; num3 += val.b; num4 += val.a; num5++; } if (num5 == 0) { return Color.clear; } return new Color((float)num / (float)(num5 * 255), (float)num2 / (float)(num5 * 255), (float)num3 / (float)(num5 * 255), (float)num4 / (float)(num5 * 255)); } private static Color InvertColor(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0030: Unknown result type (might be due to invalid IL or missing references) float num2 = default(float); float num3 = default(float); float num = default(float); Color.RGBToHSV(c, ref num, ref num2, ref num3); num = (num + 0.5f) % 1f; Color result = Color.HSVToRGB(num, num2, num3); result.a = c.a; return result; } public static void SetLayerRecursively(GameObject obj, int layer) { Recurse(obj); void Recurse(GameObject go) { if (!((Object)(object)go == (Object)null)) { go.layer = layer; Transform transform = go.transform; for (int i = 0; i < transform.childCount; i++) { Recurse(((Component)transform.GetChild(i)).gameObject); } } } } public static Dictionary SaveOriginalLayers(GameObject obj) { Dictionary layers = new Dictionary(); Recurse(obj); return layers; void Recurse(GameObject go) { if (!((Object)(object)go == (Object)null)) { layers[go] = go.layer; Transform transform = go.transform; for (int i = 0; i < transform.childCount; i++) { Recurse(((Component)transform.GetChild(i)).gameObject); } } } } private static Material CreatelitMaterial(Color color, EnemyAgent agent = null) { //IL_000a: 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_0016: 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_0026: 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_0038: 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_0049: 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_00b3: Expected O, but got Unknown Material val = new Material(Shader.Find("Standard")); float num = 1f; val.color = new Color(color.r * num, color.g * num, color.b * num); val.EnableKeyword("_EMISSION"); bool? obj; if (agent == null) { obj = null; } else { EnemyAI aI = agent.AI; if (aI == null) { obj = null; } else { EnemyDetection detection = aI.m_detection; obj = ((detection != null) ? new bool?(detection.m_noiseDetectionOn) : ((bool?)null)); } } bool? flag = obj; val.SetColor("_EmissionColor", color * ((flag == true || alwaysEmit) ? emmisivenessOn : emmisivenessOff)); return val; } private static void ApplyMask(Texture2D targetTex, Texture2D maskTex, int tolerance = 5) { //IL_001e: 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_0024: 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_0058: 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_0033: 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) Color32[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)targetTex.GetPixels32()); Color32[] array2 = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)maskTex.GetPixels32()); for (int i = 0; i < array.Length; i++) { Color32 val = array2[i]; if (val.r < 255 - tolerance || val.g < 255 - tolerance || val.b < 255 - tolerance) { array[i] = Color32.op_Implicit(Color.black); } } targetTex.SetPixels32(Il2CppStructArray.op_Implicit(array)); targetTex.Apply(); } private static void ShowVisibilityNumber(float visPercent, Color color, int stackIndex = 0) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_007e: 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_00bf: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00df: 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_00e7: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_011d: 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) color.r *= 0.2f; color.g *= 0.2f; color.b *= 0.2f; if (!_quads.TryGetValue(999, out var value) || (Object)(object)value == (Object)null) { value = new GameObject("VisibilityText"); TextMesh obj = value.AddComponent(); obj.fontSize = 48; obj.characterSize = 0.02f; obj.anchor = (TextAnchor)4; obj.alignment = (TextAlignment)1; obj.color = color; _quads[999] = value; Object.DontDestroyOnLoad((Object)(object)value); } Transform transform = ((Component)PlayerManager.GetLocalPlayerAgent()).transform; float num = 1f; float num2 = -0.6f; float num3 = 0.6f; Vector3 val = transform.position + transform.forward * num + transform.up * 1f; Vector3 val2 = transform.right * (0f - num2); Vector3 val3 = -transform.up * ((float)stackIndex * num3); value.transform.position = val + val2 + val3; value.transform.rotation = transform.rotation; value.GetComponent().text = (visPercent * 100f).ToString("F1") + "%"; } private static float CountColorPixels(Texture2D tex, Color color, float minTolerance = 0.1f, float maxTolerance = 0.3f) { //IL_0022: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0058: 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_0093: 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) Color32[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)tex.GetPixels32()); float num = 0f; float num2 = 2f; minTolerance *= num2; maxTolerance *= num2; Vector3 val = new Vector3(color.r, color.g, color.b); Vector3 normalized = ((Vector3)(ref val)).normalized; for (int i = 0; i < array.Length; i++) { if (!(Color32.op_Implicit(array[i]) == Color.black)) { val = new Vector3((float)(int)array[i].r, (float)(int)array[i].g, (float)(int)array[i].b); float num3 = Vector3.Distance(((Vector3)(ref val)).normalized, normalized); float num4 = ((num3 < minTolerance) ? 1f : ((!(num3 > maxTolerance)) ? (1f - (num3 - minTolerance) / (maxTolerance - minTolerance)) : 0f)); num += num4; } } return num; } private static GameObject GetOrCreateQuad(int key, GameObject observer, Texture2D texture, int stackIndex) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0090: 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_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_00a9: 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_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_00c1: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (!_quads.TryGetValue(key, out var value) || (Object)(object)value == (Object)null) { value = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)value).name = $"Quad_{key}"; ((Renderer)value.GetComponent()).material = new Material(_quadMat); Object.DontDestroyOnLoad((Object)(object)value); _quads[key] = value; } float num = 1f; float num2 = 0.6f; float num3 = 0.6f; Transform transform = ((Component)PlayerManager.GetLocalPlayerAgent()).transform; Vector3 val = transform.position + transform.forward * num + transform.up * 1f; Vector3 val2 = transform.right * num2; Vector3 val3 = -transform.up * ((float)stackIndex * num3); value.transform.position = val + val2 + val3; value.transform.rotation = transform.rotation; value.transform.localScale = Vector3.one * 0.5f; CustomExtensions.ChangeLayerRecursive(value, LayerMask.NameToLayer("Ignore Raycast"), (Il2CppStructArray)null); ((Renderer)value.GetComponent()).material.mainTexture = (Texture)(object)texture; Object.Destroy((Object)(object)value.GetComponent()); return value; } private static void RestoreOriginalLayers(Dictionary layers) { foreach (KeyValuePair layer in layers) { layer.Key.layer = layer.Value; } } } public static class zVisitedManager { public class nodeToCreate { public Vector3 position; public bool garenteedNoNodesNearby; public int depth; public HashSet CheckedNodes; public override bool Equals(object obj) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (obj is nodeToCreate nodeToCreate) { float num = NodeGridSize / 2f; return Vector3.Distance(position, nodeToCreate.position) <= num; } return false; } public override int GetHashCode() { float num = NodeGridSize / 2f; int num2 = Mathf.RoundToInt(position.x / num); int num3 = Mathf.RoundToInt(position.y / num); int num4 = Mathf.RoundToInt(position.z / num); return (num2 * 73856093) ^ (num3 * 19349663) ^ (num4 * 83492791); } public static bool operator ==(nodeToCreate left, nodeToCreate right) { if ((object)left == right) { return true; } if ((object)left == null || (object)right == null) { return false; } return left.Equals(right); } public static bool operator !=(nodeToCreate left, nodeToCreate right) { return !(left == right); } } public static int NodeMapGridSize = 10; public static float NodeGridSize = 2.5f; public static float NodeVisitDistance = 10f; public static Dictionary> NodeMap = new Dictionary>(); private static bool setup = false; private static List agents = new List(); private static List botAgents = new List(); private const int areaMask = 1; internal static OrderedSet nodesThatNeedConnectionChecks = new OrderedSet(); internal static OrderedSet nodesToCreate = new OrderedSet(); private static int conectionCheckIndex = 0; internal static int connectionChecksPerFrame = 2; internal static int nodesCreatedPerFrame = 5; public static int propigationAmmount = 3; public static int propigationSampleCount = 32; internal static bool debugCube = false; internal static bool debugText = false; internal static bool debugLines = false; internal static int unexploredMaxDepth = 100; private static PlayerAgent localPlayer; public static Vector3[] CapsuleCorners; public static HashSet allnodes = new HashSet(); public static Dictionary> VisitNodeCourseNodeCache = new Dictionary>(); public static VisitNode GetUnexploredLocation(Vector3 position, int depth = 0, int maxDepth = 0, OrderedSet searched = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (maxDepth == 0) { maxDepth = unexploredMaxDepth; } if (searched == null) { searched = new OrderedSet(); } return GetNearestNode(position)?.FindUnexplored(depth, maxDepth, searched); } public static bool HasCourseNodeBeenFullyExplored(AIG_CourseNode courseNode) { if (!VisitNodeCourseNodeCache.ContainsKey(courseNode)) { return false; } return VisitNodeCourseNodeCache[courseNode].All((VisitNode v) => v.discovered); } public static List GetFoundEnemiesInCourseNode(AIG_CourseNode courseNode) { _ = courseNode.m_enemiesInNode; return null; } public static List GetVisitNodesInCourseNode(AIG_CourseNode courseNode) { VisitNodeCourseNodeCache.TryGetValue(courseNode, out var value); return value; } public static void SetNodeMapGridSize(int size) { if (size < 1) { size = 1; } NodeMapGridSize = size; setup = false; Setup(instantNodePropigation: true); } public static void SetNodeGridSize(float size) { if (size < 0.1f) { size = 0.1f; } NodeGridSize = (float)Math.Round(size, 1); setup = false; Setup(instantNodePropigation: true); } public static void SetNodeVisitDistance(float size) { if (size < 0.1f) { size = 0.1f; } NodeVisitDistance = (float)Math.Round(size, 1); setup = false; Setup(instantNodePropigation: true); } public static void SetPropigationAmmount(int distance) { if (distance < 0) { distance = 0; } propigationAmmount = distance; setup = false; Setup(instantNodePropigation: true); } public static void SetPropigationSampleCount(int count) { if (count < 4) { count = 4; } propigationSampleCount = count; setup = false; Setup(instantNodePropigation: true); } public static void Setup(bool instantNodePropigation = false) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0141: Unknown result type (might be due to invalid IL or missing references) if (setup) { return; } if ((int)localPlayer.Owner.refSessionMode != 8) { setup = false; return; } CapsuleCorners = GetCapsuleCorners(); NodeMap.Clear(); bool flag = debugCube; bool flag2 = debugText; bool flag3 = debugLines; debugCube = false; debugText = false; debugLines = false; foreach (VisitNode allnode in allnodes) { allnode.UpdateDebugVisuals(); } allnodes.Clear(); debugCube = flag; debugText = flag2; debugLines = flag3; nodesThatNeedConnectionChecks.Clear(); nodesToCreate.Clear(); agents = ((IEnumerable)PlayerManager.PlayerAgentsInLevel.ToArray()).ToList(); botAgents.Clear(); foreach (PlayerAgent agent in agents) { if (agent.Owner.IsBot) { botAgents.Add(agent); } } setup = true; if (!instantNodePropigation) { return; } foreach (PlayerAgent agent2 in agents) { VisitNode visitNode = CreateNodeOnNavMesh(((Agent)agent2).Position); if (visitNode != null) { visitNode.Propigate(propigationAmmount); visitNode.UpdateDebugVisuals(); } } } public static void SetDebug(bool? debug = null, bool? text = null, bool? lines = null) { if (debug.HasValue) { debugCube = debug.Value; } if (text.HasValue) { debugText = text.Value; } if (lines.HasValue) { debugLines = lines.Value; } foreach (VisitNode allnode in allnodes) { allnode.UpdateDebugVisuals(); } } public static void MapNode(VisitNode node) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) allnodes.Add(node); if (node.courseNode != null) { if (!VisitNodeCourseNodeCache.ContainsKey(node.courseNode)) { VisitNodeCourseNodeCache[node.courseNode] = new List(); } if (!VisitNodeCourseNodeCache[node.courseNode].Contains(node)) { VisitNodeCourseNodeCache[node.courseNode].Add(node); } } Vector3Int gridPosition = node.GetGridPosition(); if (!NodeMap.ContainsKey(gridPosition)) { NodeMap[gridPosition] = new HashSet(); } NodeMap[gridPosition].Add(node); } public static void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_00b0: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_02a1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)localPlayer == (Object)null) { localPlayer = PlayerManager.GetLocalPlayerAgent(); } if ((Object)(object)localPlayer == (Object)null) { return; } if ((int)localPlayer.Owner.refSessionMode != 8) { setup = false; return; } if (!setup) { Setup(); } if (!setup) { return; } if (agents.Any((PlayerAgent x) => (Object)(object)x == (Object)null)) { agents = ((IEnumerable)PlayerManager.PlayerAgentsInLevel.ToArray()).ToList(); } foreach (PlayerAgent agent in agents) { HashSet nearByNodes = GetNearByNodes(((Component)agent).transform.position, NodeVisitDistance); if (!HasNodesnearby(((Agent)agent).Position, NodeGridSize)) { VisitNode visitNode = CreateNodeOnNavMesh(((Agent)agent).Position); if (visitNode != null) { nearByNodes.Add(visitNode); } } foreach (VisitNode item in nearByNodes) { item.Discover(); item.Propigate(propigationAmmount); item.UpdateDebugVisuals(); } } for (int num = 0; num < nodesCreatedPerFrame && num < nodesToCreate.Count; num++) { nodeToCreate nodeToCreate = nodesToCreate.FirstOrDefault(); nodesToCreate.Remove(nodeToCreate); CreateNodeOnNavMesh(nodeToCreate.position)?.Propigate(nodeToCreate.depth, nodeToCreate.CheckedNodes); } for (int num2 = 0; num2 < connectionChecksPerFrame; num2++) { if (nodesThatNeedConnectionChecks.Count <= 0) { break; } if (conectionCheckIndex >= nodesThatNeedConnectionChecks.Count) { conectionCheckIndex = 0; } VisitNode visitNode2 = nodesThatNeedConnectionChecks[conectionCheckIndex]; VisitNode visitNode3 = visitNode2.nearbyNodesToCheckIfConnected.FirstOrDefault(); if (visitNode3 != null) { visitNode2.nearbyNodesToCheckIfConnected.Remove(visitNode3); visitNode3.nearbyNodesToCheckIfConnected.Remove(visitNode2); if (visitNode2.nearbyNodesToCheckIfConnected.Count == 0) { nodesThatNeedConnectionChecks.Remove(visitNode2); } if (visitNode3.nearbyNodesToCheckIfConnected.Count == 0) { nodesThatNeedConnectionChecks.Remove(visitNode3); } bool flag = false; if (visitNode2.connectedNodes.Contains(visitNode3) ^ visitNode3.connectedNodes.Contains(visitNode2)) { flag = true; } else if (!visitNode2.connectedNodes.Contains(visitNode3) && !visitNode3.connectedNodes.Contains(visitNode2) && CanNavigateBetween(visitNode2.position, visitNode3.position)) { flag = true; } if (flag && CanNodeSeeEachOther(visitNode2, visitNode3)) { visitNode2.ConnectNode(visitNode3); } } conectionCheckIndex++; } } public static bool CanNodeSeeEachOther(VisitNode node1, VisitNode node2) { //IL_0001: 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_001f: 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_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_003c: 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_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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007d: 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_0084: Unknown result type (might be due to invalid IL or missing references) Vector3 val = node2.position - node1.position; Quaternion rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized); Vector3[] worldColliderCorners = GetWorldColliderCorners(node1.position, rotation); Vector3[] worldColliderCorners2 = GetWorldColliderCorners(node2.position, rotation); int num = -1; QueryTriggerInteraction val2 = (QueryTriggerInteraction)1; Vector3[] array = worldColliderCorners; foreach (Vector3 val3 in array) { Vector3[] array2 = worldColliderCorners2; for (int j = 0; j < array2.Length; j++) { Vector3 val4 = array2[j] - val3; float magnitude = ((Vector3)(ref val4)).magnitude; val4 /= magnitude; if (!Physics.Raycast(val3, val4, magnitude, num, val2)) { return true; } } } return false; } public static Vector3[] GetWorldColliderCorners(Vector3 position, Quaternion rotation) { //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_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_002a: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[CapsuleCorners.Length]; for (int i = 0; i < CapsuleCorners.Length; i++) { array[i] = position + rotation * CapsuleCorners[i]; } return array; } public static Vector3[] GetCapsuleCorners() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_009f: 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_00a8: 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_00bb: 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_00d1: 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_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_00ec: 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_00f8: 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_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_0114: 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_0122: 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_012e: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_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) PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); object obj; if (localPlayerAgent == null) { obj = null; } else { PlayerCharacterController playerCharacterController = localPlayerAgent.PlayerCharacterController; obj = ((playerCharacterController != null) ? playerCharacterController.m_characterController : null); } CharacterController val = (CharacterController)obj; if ((Object)(object)val == (Object)null) { ZiMain.log.LogWarning((object)"GetCapsuleCorners: PlayerCharacterController not found, falling back to center point."); return (Vector3[])(object)new Vector3[1] { Vector3.zero }; } float radius = val.radius; float height = val.height; float num = (height / 2f - radius) * 0.9f; float num2 = (height / 2f - radius) * 0.9f; Vector3 zero = Vector3.zero; Vector3 val2 = Vector3.up * num; Vector3 val3 = Vector3.down * num2; return (Vector3[])(object)new Vector3[9] { zero, val2 + new Vector3(radius, 0f, radius), val2 + new Vector3(0f - radius, 0f, radius), val2 + new Vector3(radius, 0f, 0f - radius), val2 + new Vector3(0f - radius, 0f, 0f - radius), val3 + new Vector3(radius, 0f, radius), val3 + new Vector3(0f - radius, 0f, radius), val3 + new Vector3(radius, 0f, 0f - radius), val3 + new Vector3(0f - radius, 0f, 0f - radius) }; } public static VisitNode CreateNodeOnNavMesh(Vector3 pos) { //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) //IL_0024: 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_00a1: 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_006f: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(pos, ref val, 3f, -1)) { return null; } if (!IsPositionFree(((NavMeshHit)(ref val)).position)) { return null; } bool num = HasNodesnearby(((NavMeshHit)(ref val)).position, NodeGridSize); HashSet nearByNodes = GetNearByNodes(((NavMeshHit)(ref val)).position, NodeVisitDistance); if (num) { return null; } if (nearByNodes.Count > 0) { bool flag = false; foreach (VisitNode item in nearByNodes) { if (CanNavigateBetween(((NavMeshHit)(ref val)).position, item.position)) { flag = true; break; } } } VisitNode visitNode = new VisitNode(((NavMeshHit)(ref val)).position, garenteedNoNodesNearby: true); visitNode.UpdateDebugVisuals(); return visitNode; } public static Vector3Int GetGridPosition(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) return new Vector3Int(Mathf.FloorToInt(pos.x / (float)NodeMapGridSize), Mathf.FloorToInt(pos.y / (float)NodeMapGridSize), Mathf.FloorToInt(pos.z / (float)NodeMapGridSize)); } public static bool HasNodesnearby(Vector3 position, float searchRadius = 0f) { //IL_0006: 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_0068: 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) new HashSet(); Vector3Int gridPosition = GetGridPosition(position); if (searchRadius <= 0f) { searchRadius = NodeVisitDistance; } int num = Mathf.CeilToInt(searchRadius / (float)NodeMapGridSize); Vector3Int key = default(Vector3Int); for (int i = -num; i <= num; i++) { for (int j = -num; j <= num; j++) { for (int k = -num; k <= num; k++) { ((Vector3Int)(ref key))..ctor(((Vector3Int)(ref gridPosition)).x + i, ((Vector3Int)(ref gridPosition)).y + j, ((Vector3Int)(ref gridPosition)).z + k); if (!NodeMap.TryGetValue(key, out var value)) { continue; } foreach (VisitNode item in value) { if (Vector3.Distance(item.position, position) <= searchRadius) { return true; } } } } } return false; } public static VisitNode GetNearestNode(Vector3 position, float searchRadius = 0f) { //IL_0000: 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_0033: Unknown result type (might be due to invalid IL or missing references) HashSet nearByNodes = GetNearByNodes(position, searchRadius); if (nearByNodes.Count == 0) { return null; } float num = float.MaxValue; VisitNode result = null; foreach (VisitNode item in nearByNodes) { float num2 = Vector3.Distance(item.position, position); if (num2 < num) { num = num2; result = item; } if (num2 < NodeGridSize) { break; } } return result; } public static HashSet GetNearByNodes(Vector3 position, float searchRadius = 0f) { //IL_0006: 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_006d: 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_0093: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); Vector3Int gridPosition = GetGridPosition(position); if (searchRadius <= 0f) { searchRadius = NodeVisitDistance; } int num = Mathf.CeilToInt(searchRadius / (float)NodeMapGridSize); Vector3Int key = default(Vector3Int); for (int i = -num; i <= num; i++) { for (int j = -num; j <= num; j++) { for (int k = -num; k <= num; k++) { ((Vector3Int)(ref key))..ctor(((Vector3Int)(ref gridPosition)).x + i, ((Vector3Int)(ref gridPosition)).y + j, ((Vector3Int)(ref gridPosition)).z + k); if (!NodeMap.TryGetValue(key, out var value)) { continue; } foreach (VisitNode item in value) { if (Vector3.Distance(item.position, position) <= searchRadius) { hashSet.Add(item); } } } } } return hashSet; } public static bool CanNavigateBetween(Vector3 start, Vector3 end, float distanceMult = 2f) { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002e: 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_0044: 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_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_009a: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(start, ref val, 1f, 1) && NavMesh.SamplePosition(end, ref val2, 1f, 1)) { NavMeshPath val3 = new NavMeshPath(); if (!NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val2)).position, 1, val3) || (int)val3.status != 0) { return false; } float num = 0f; for (int i = 1; i < ((Il2CppArrayBase)(object)val3.corners).Length; i++) { num += Vector3.Distance(((Il2CppArrayBase)(object)val3.corners)[i - 1], ((Il2CppArrayBase)(object)val3.corners)[i]); } float num2 = Vector3.Distance(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val2)).position); return num <= distanceMult * num2; } return false; } public static bool IsPositionFree(Vector3 pos) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_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_00af: 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_00bb: 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) PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); object obj; if (localPlayerAgent == null) { obj = null; } else { PlayerCharacterController playerCharacterController = localPlayerAgent.PlayerCharacterController; obj = ((playerCharacterController != null) ? playerCharacterController.m_characterController : null); } CharacterController controller = (CharacterController)obj; if ((Object)(object)controller == (Object)null) { ZiMain.log.LogWarning((object)"AdjustPositionUp: PlayerCharacterController not found, falling back to sphere check."); return !Physics.CheckSphere(pos, 0.1f, -1, (QueryTriggerInteraction)1); } float radius = controller.radius; float height = controller.height; Vector3 center = controller.center; Vector3 val = pos + center - Vector3.up * (height / 2f - radius); Vector3 val2 = pos + center + Vector3.up * (height / 2f - radius); return !Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapCapsule(val, val2, radius, 1, (QueryTriggerInteraction)1)).Any((Collider c) => (Object)(object)c != (Object)(object)controller); } } public class VisitNode { public GameObject DebugObject; public Vector3 position; public bool discovered; public int propigated; public HashSet nearbyNodes = new HashSet(); public OrderedSet connectedNodes = new OrderedSet(); public HashSet nearbyNodesToCheckIfConnected = new HashSet(); private Dictionary connectionLines = new Dictionary(); private AIG_CourseNode _courseNode; private eDimensionIndex _dimension; private bool hasDim; public AIG_CourseNode courseNode { get { //IL_0010: 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) if (_courseNode != null) { return _courseNode; } AIG_CourseNode.TryGetCourseNode(dimension, position, 1f, ref _courseNode); return _courseNode; } set { _courseNode = value; } } public eDimensionIndex dimension { get { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0028: 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_002e: 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) if (hasDim) { return _dimension; } hasDim = true; return _dimension = Dimension.GetDimensionFromPos(position).DimensionIndex; } } public VisitNode(Vector3 pos, bool garenteedNoNodesNearby) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) position = pos; if (courseNode == null) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not find course node for visit node at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(pos); } log.LogWarning(val); } zVisitedManager.MapNode(this); nearbyNodes = GetNearByNodes(zVisitedManager.NodeGridSize * 1.75f); foreach (VisitNode nearbyNode in nearbyNodes) { nearbyNode.ConnectNearbyNode(this); } if (nearbyNodes.Count > 0) { nearbyNodesToCheckIfConnected = new HashSet(nearbyNodes); zVisitedManager.nodesThatNeedConnectionChecks.Add(this); } } public OrderedSet getUnexploredNodes() { OrderedSet orderedSet = new OrderedSet(); foreach (VisitNode connectedNode in connectedNodes) { if (!connectedNode.discovered) { orderedSet.Add(connectedNode); } } return orderedSet; } public Vector3Int GetGridPosition() { //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) return zVisitedManager.GetGridPosition(position); } public void ConnectNearbyNode(VisitNode node) { if (node != this) { if (!nearbyNodes.Contains(node)) { nearbyNodes.Add(node); } if (!node.nearbyNodes.Contains(this)) { node.nearbyNodes.Add(this); } } } public void ConnectNode(VisitNode node) { if (node != this) { if (!connectedNodes.Contains(node)) { connectedNodes.Add(node); } if (!node.connectedNodes.Contains(this)) { node.connectedNodes.Add(this); } } } public HashSet GetNearByNodes(float searchRadius = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) HashSet nearByNodes = zVisitedManager.GetNearByNodes(position, searchRadius); nearByNodes.Remove(this); return nearByNodes; } public void Discover() { if (!discovered) { discovered = true; } } public void Propigate(int depth, HashSet CheckedNodes = null) { //IL_005c: 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_007d: 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_00a6: 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_00c3: 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_011f: Unknown result type (might be due to invalid IL or missing references) if (depth <= 0 || depth <= propigated) { return; } propigated = depth; UpdateDebugVisuals(); if (CheckedNodes == null) { CheckedNodes = new HashSet(); } if (CheckedNodes.Contains(this)) { return; } CheckedNodes.Add(this); float nodeGridSize = zVisitedManager.NodeGridSize; NavMeshHit val = default(NavMeshHit); for (int i = 0; i < zVisitedManager.propigationSampleCount; i++) { float num = (float)i * (float)Math.PI * 2f / (float)zVisitedManager.propigationSampleCount; if (!NavMesh.SamplePosition(position + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * nodeGridSize, ref val, 3f, -1) || !zVisitedManager.IsPositionFree(((NavMeshHit)(ref val)).position) || !zVisitedManager.CanNavigateBetween(position, ((NavMeshHit)(ref val)).position)) { continue; } HashSet nearByNodes = zVisitedManager.GetNearByNodes(((NavMeshHit)(ref val)).position, zVisitedManager.NodeGridSize); if (nearByNodes.Count > 0) { foreach (VisitNode item2 in nearByNodes) { item2.Propigate(depth - 1, CheckedNodes); } continue; } zVisitedManager.nodeToCreate item = new zVisitedManager.nodeToCreate { position = ((NavMeshHit)(ref val)).position, garenteedNoNodesNearby = true, depth = depth - 1, CheckedNodes = CheckedNodes }; if (!zVisitedManager.nodesToCreate.Contains(item)) { zVisitedManager.nodesToCreate.Add(item); } } } public void UpdateDebugVisuals() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //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_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_0107: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_032f: 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_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Expected O, but got Unknown //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) if (!zVisitedManager.debugCube && !zVisitedManager.debugText && !zVisitedManager.debugLines) { if ((Object)(object)DebugObject != (Object)null) { Object.Destroy((Object)(object)DebugObject); DebugObject = null; } return; } if ((Object)(object)DebugObject == (Object)null) { DebugObject = new GameObject($"VisitNode_Debug_{GetHashCode()}"); DebugObject.transform.position = position + Vector3.up * 0.25f; } Transform obj = DebugObject.transform.Find("Cube"); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if (zVisitedManager.debugCube) { if ((Object)(object)val == (Object)null) { val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "Cube"; val.transform.SetParent(DebugObject.transform, false); val.transform.localPosition = Vector3.zero; val.transform.localScale = Vector3.one * 0.1f; Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } MeshRenderer component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { if ((Object)(object)((Renderer)component2).material == (Object)null) { ((Renderer)component2).material = new Material(Shader.Find("Standard")); } ((Renderer)component2).material.color = (discovered ? Color.green : Color.red); } } else if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } Transform obj2 = DebugObject.transform.Find("PropigatedText"); GameObject val2 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if (zVisitedManager.debugText) { TextMesh val3; if ((Object)(object)val2 == (Object)null) { val2 = new GameObject("PropigatedText"); val2.transform.SetParent(DebugObject.transform, false); val2.transform.localPosition = Vector3.up * 0.15f; val3 = val2.AddComponent(); val3.fontSize = 32; val3.characterSize = 0.05f; val3.anchor = (TextAnchor)4; val3.alignment = (TextAlignment)1; val3.color = Color.white; } else { val3 = val2.GetComponent(); } if ((Object)(object)val3 != (Object)null) { val3.text = propigated.ToString(); } } else if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } if (zVisitedManager.debugLines) { foreach (VisitNode connectedNode in connectedNodes) { if (connectedNode != null && (connectedNode.connectionLines == null || !connectedNode.connectionLines.ContainsKey(this))) { if (!connectionLines.TryGetValue(connectedNode, out var value) || (Object)(object)value == (Object)null) { GameObject val4 = new GameObject($"Line_{GetHashCode()}_{connectedNode.GetHashCode()}"); val4.transform.SetParent(DebugObject.transform, false); value = val4.AddComponent(); value.positionCount = 2; value.startWidth = 0.05f; value.endWidth = 0.05f; ((Renderer)value).material = new Material(Shader.Find("Unlit/Color")); ((Renderer)value).material.color = new Color(0.1f, 0.1f, 0f, 0.2f); value.useWorldSpace = true; connectionLines[connectedNode] = value; } value.SetPosition(0, position + Vector3.up * 0.25f); value.SetPosition(1, connectedNode.position + Vector3.up * 0.25f); } } { foreach (VisitNode item in connectionLines.Keys.Where((VisitNode n) => !connectedNodes.Contains(n)).ToList()) { if ((Object)(object)connectionLines[item] != (Object)null) { Object.Destroy((Object)(object)((Component)connectionLines[item]).gameObject); } connectionLines.Remove(item); } return; } } foreach (LineRenderer value2 in connectionLines.Values) { if ((Object)(object)value2 != (Object)null) { Object.Destroy((Object)(object)((Component)value2).gameObject); } } connectionLines.Clear(); } internal VisitNode FindUnexplored(int depth = 0, int maxDepth = 0, OrderedSet searched = null) { if (maxDepth == 0) { maxDepth = zVisitedManager.unexploredMaxDepth; } if (searched == null) { searched = new OrderedSet(); } OrderedSet unexploredNodes = getUnexploredNodes(); if (unexploredNodes.Count > 0) { return unexploredNodes[Random.Range(0, unexploredNodes.Count)]; } if (depth < maxDepth) { List list = connectedNodes.Except(searched).ToList(); if (list.Count() == 0) { return null; } List list2 = new List(list); for (int num = list2.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); VisitNode value = list2[num]; list2[num] = list2[index]; list2[index] = value; } foreach (VisitNode item in list2) { searched.Add(item); VisitNode visitNode = item.FindUnexplored(depth + 1, maxDepth, searched); if (visitNode != null) { return visitNode; } } } return null; } } [GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")] [CompilerGenerated] internal static class VersionInfo { public const string RootNamespace = "BotControl"; public const string Version = "1.0.0"; public const string VersionPrerelease = null; public const string VersionMetadata = "gitd5013ac-dirty-dev"; public const string SemVer = "1.0.0+gitd5013ac-dirty-dev"; public const string GitRevShort = "d5013ac-dirty"; public const string GitRevLong = "d5013acaeca679836731ad818ee8d06830e6585a-dirty"; public const string GitBranch = "dev"; public const string GitTag = "V1.1.0"; public const int GitCommitsSinceTag = 51; public const bool GitIsDirty = true; } } namespace BotControl.SmartSelect { public class Selection { private HashSet SelectedObjects = new HashSet(); public void Select(Component component, bool oneBot = true) { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); if (oneBot && component is PlayerAIBot) { this.Deselect(); } SelectedObjects.Add(component); } public bool Deselect() where T : Component { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); return SelectedObjects.RemoveWhere((Component obj) => obj is T) > 0; } public bool Deselect(Component component) { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); return SelectedObjects.Remove(component); } public bool Selected(T candidate) where T : Component { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); foreach (Component selectedObject in SelectedObjects) { if ((Object)(object)selectedObject == (Object)(object)candidate) { return true; } } return false; } public bool Selected() where T : Component { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); foreach (Component selectedObject in SelectedObjects) { if (selectedObject is T) { return true; } } return false; } public HashSet GetSelected() where T : Component { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); HashSet hashSet = new HashSet(); foreach (Component selectedObject in SelectedObjects) { T val = (T)(object)((selectedObject is T) ? selectedObject : null); if (val != null) { hashSet.Add(val); } } return hashSet; } public PlayerAIBot GetBestBot() { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); return this.GetSelected().FirstOrDefault(); } public bool AnyBotsSelected() { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); return this.Selected(); } public bool AnySelectedBotsAlive() { SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); if (!AnyBotsSelected()) { return false; } foreach (PlayerAIBot item in this.GetSelected()) { if ((Object)(object)((item != null) ? item.Agent : null) != (Object)null && ((Agent)item.Agent).Alive) { return true; } } return false; } public bool AnySelectedBotCanReach(Vector3 location) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) SelectedObjects.RemoveWhere((Component x) => (Object)(object)x == (Object)null); if (!AnyBotsSelected()) { return false; } foreach (PlayerAIBot item in this.GetSelected()) { if (((Agent)item.Agent).Alive && zHelpers.CanBotReach(item, location)) { return true; } } return false; } } public static class zSmartSelect { public enum PressTypes { Tap, Hold, DoubleTap, TapAndHold } public enum ActionTypes { Agent, Item, Sentry, Container, Nothing, Door, Enemy, Generator } public static Selection MainSelection = new Selection(); private static bool IsSetUp = false; public static uint InvalidSound = EVENTS.MENU_HOST_EXPEDITION_BUTTON_RELEASE; public static uint CorrectSound = EVENTS.MENU_HOST_EXPEDITION_BUTTON_FULL; private static float lastSlowUpdateTime = 0f; private static float SelectionAngle = 30f; public static bool FallbackToClosest = true; private const float slowupdateinterval = 0.33f; private static float now => Time.time; private static float roundedTime => now - now % 0.33f; public static void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 if ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12) { if (!IsSetUp) { SetUp(); } sInputSystem.Update(); if (roundedTime > lastSlowUpdateTime) { SlowUpdate(); } } } public static void SlowUpdate() { PressTypeManager.Update(); zSmartSelectHud.Update(); lastSlowUpdateTime = roundedTime; } private static void SetUp() { PressActionManager.Initialize(); foreach (IPressType value in PressTypeManager.TypeMap.Values) { sInputSystem.AddListener(value.PressSequence, new FlexibleMethodDefinition(new Func(value.Invoke)), (KeyCode)118); } IsSetUp = true; } public static uint GetVoiceId(PlayerAgent Agent) { string playerName = Agent.PlayerName; _ = Agent.CharacterID; uint result = 0u; if (playerName.ToUpper().Contains("BISHOP")) { result = EVENTS.PLAY_ADDRESSBISHOPIRRITATED01; } if (playerName.ToUpper().Contains("DAUDA")) { result = EVENTS.PLAY_ADDRESSDAUDAIRRITATED01; } if (playerName.ToUpper().Contains("HACKET")) { result = EVENTS.PLAY_ADDRESSHACKETTIRRITATED01; } if (playerName.ToUpper().Contains("WOODS")) { result = EVENTS.PLAY_ADDRESSWOODSIRRITATED01; } return result; } public static PlayerAIBot GetBotLookingAt() { GameObject obj = zSearch.FindBestAligned(zStaticRefrences.CameraTransform, zStaticRefrences.AllBotObjects, SelectionAngle); if (obj == null) { return null; } return obj.GetComponent(); } public static PlayerAgent GetPlayerAgentLookingAt() { GameObject obj = zSearch.FindBestAligned(zStaticRefrences.CameraTransform, zStaticRefrences.AllPlayerAgentObjectsInLevel, SelectionAngle); if (obj == null) { return null; } return obj.GetComponent(); } } internal static class zSmartSelectHud { public static GameObject TopTextGobject = null; public static TextMeshPro TopText = null; public static GameObject BottomTextGobject = null; public static TextMeshPro BottomText = null; public static int staticSize = 10; public static int lowerStaticSize = 16; public static float lowerFontSize = 10f; public static float upperStaticSize = 15f; public static Color defaultColor = new Color(1f, 1f, 1f, 0.25f); private static IPressType Tap; private static IPressType Hold; private static IPressType DoubleTap; private static IPressType TapAndHold; private static bool isSetup => (Object)(object)TopTextGobject != (Object)null; public static void Setup() { //IL_00ca: 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_00fe: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) if (!isSetup) { float num = 2160f / (float)Screen.height; GameObject val = GameObject.Find("GUI/CellUI_Camera(Clone)/PlayerLayer/MovementRoot/PUI_LocalPlayerStatus_CellUI(Clone)/ShieldBar/"); GameObject obj = Object.Instantiate(val, val.transform.parent); ObjectExt.Destroy((Object)(object)obj.transform.Find("ShieldFill Right")); ObjectExt.Destroy((Object)(object)obj.transform.Find("ShieldFill Left")); TopTextGobject = ((Component)obj.transform.Find("ShieldText")).gameObject; ((Object)TopTextGobject).name = "SmartSelectText"; Transform parent = TopTextGobject.transform.parent; TopTextGobject.transform.parent = val.transform.parent; ObjectExt.Destroy((Object)(object)parent); TopTextGobject.transform.position = new Vector3(0f, -1040f, 1870f); RectTransform component = TopTextGobject.GetComponent(); component.anchorMin = new Vector2(-1f, 0.5f); component.anchorMax = new Vector2(2f, 0.5f); component.sizeDelta = Vector2.zero; TopText = TopTextGobject.GetComponent(); ((Graphic)TopText).color = defaultColor; BottomTextGobject = Object.Instantiate(TopTextGobject, TopText.transform.parent); BottomTextGobject.transform.position = new Vector3(-27f, -1068f, 1870f); BottomText = BottomTextGobject.GetComponent(); ((TMP_Text)BottomText).fontSize = lowerFontSize * num; ((TMP_Text)TopText).fontSize = upperStaticSize * num; Tap = PressTypeManager.GetPressType("Tap"); Hold = PressTypeManager.GetPressType("Hold"); DoubleTap = PressTypeManager.GetPressType("Double Tap"); TapAndHold = PressTypeManager.GetPressType("Tap and Hold"); Canvas.ForceUpdateCanvases(); LayoutRebuilder.ForceRebuildLayoutImmediate(TopTextGobject.GetComponent()); } } public static void Update() { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) if (isSetup) { PlayerAIBot? obj = zSmartSelect.MainSelection.GetSelected().FirstOrDefault(); string inputString = ((obj != null) ? obj.Agent.PlayerName : null) ?? "None"; Pad(ref inputString, ' '); string inputString2 = Tap.CurrentAction?.FriendlyNameShort ?? ""; ConvertToStaticSize(ref inputString2, staticSize, '-'); Pad(ref inputString2, ' '); string inputString3 = Hold.CurrentAction?.FriendlyNameShort ?? ""; ConvertToStaticSize(ref inputString3, staticSize, '-'); Pad(ref inputString3, ' '); string inputString4 = DoubleTap.CurrentAction?.FriendlyNameShort ?? ""; ConvertToStaticSize(ref inputString4, staticSize, '-'); Pad(ref inputString4, ' '); string inputString5 = TapAndHold.CurrentAction?.FriendlyNameShort ?? ""; ConvertToStaticSize(ref inputString5, staticSize, '-'); Pad(ref inputString5, ' '); string inputString6 = "Tap"; ConvertToStaticSize(ref inputString6, lowerStaticSize, ' '); string inputString7 = "Hold"; ConvertToStaticSize(ref inputString7, lowerStaticSize, ' '); string inputString8 = "D-Tap"; ConvertToStaticSize(ref inputString8, lowerStaticSize, ' '); string inputString9 = "T-Hold"; ConvertToStaticSize(ref inputString9, lowerStaticSize, ' '); PlayerAIBot? obj2 = zSmartSelect.MainSelection.GetSelected().FirstOrDefault(); PlayerAgent val = ((obj2 != null) ? obj2.Agent : null); if ((Object)(object)val != (Object)null) { ((Graphic)TopText).color = val.Owner.PlayerColor; } else { ((Graphic)TopText).color = defaultColor; } ((TMP_Text)TopText).SetText($"[{inputString2}|{inputString3}|{inputString4}|{inputString5}]", true); ((TMP_Text)BottomText).SetText($"{inputString6} {inputString7} {inputString8} {inputString9}", true); } } public static void ConvertToStaticSize(ref string inputString, int size, char fillerChar, bool formattedPadding = true) { if (inputString == null) { inputString = string.Empty; } int visibleLength = GetVisibleLength(inputString); if (visibleLength >= size) { return; } int num = size - visibleLength; int num2 = num / 2; int count = num - num2; string text = new string(fillerChar, num2); string text2 = new string(fillerChar, count); if (!formattedPadding) { inputString = text + inputString + text2; return; } int num3 = 0; while (num3 < inputString.Length && inputString[num3] == '<') { int num4 = inputString.IndexOf('>', num3); if (num4 == -1) { break; } num3 = num4 + 1; } int num5 = inputString.Length; while (num5 > num3) { int num6 = num5 - 1; if (inputString[num6] != '>') { break; } int num7 = inputString.LastIndexOf('<', num6); if (num7 == -1 || num7 < num3 || num7 + 1 >= inputString.Length || inputString[num7 + 1] != '/') { break; } num5 = num7; } inputString = inputString.Substring(0, num3) + text + inputString.Substring(num3, num5 - num3) + text2 + inputString.Substring(num5); } private static int GetVisibleLength(string input) { int num = 0; int num2 = 0; while (num2 < input.Length) { if (input[num2] == '<') { int num3 = input.IndexOf('>', num2); if (num3 != -1) { num2 = num3 + 1; continue; } } num++; num2++; } return num; } public static void Pad(ref string inputString, char PadChar) { inputString = $"{PadChar}{inputString}{PadChar}"; } } } namespace BotControl.SmartSelect.PressTypes { public interface IPressType { public enum fallbackType { Default, PlayerAgent, PlayerAiBot } Component CurrentComponent { get; set; } IPressAction CurrentAction { get; set; } PrioritySet NullTypeActions { get; set; } Dictionary> TypeActionMap { get; set; } string FriendlyName { get; } string FriendlyNameShort => FriendlyName; float SelectionAngle => 30f; fallbackType FallbackType => fallbackType.Default; sSequenceDefinition PressSequence { get; } HashSet SelectableTypes { get; } PrioritySet GetAllActions() { if (TypeActionMap.Count == 0) { PressActionManager.Initialize(); } PrioritySet val = new PrioritySet(); foreach (PrioritySet value in TypeActionMap.Values) { val.UnionWith((IEnumerable)value); } val.UnionWith((IEnumerable)NullTypeActions); return val; } void RegisterAction(IPressAction action, int? priority = null) { RegisterAction(action, action.Type, priority); } void RegisterAction(IPressAction action, Type Type, int? priority = null) { PrioritySet value = new PrioritySet(); if (Type == (Type)null) { if (NullTypeActions == null) { NullTypeActions = new PrioritySet(); } value = NullTypeActions; } else { if (TypeActionMap == null) { TypeActionMap = new Dictionary>(new Il2CppTypePtrComparer()); } if (!TypeActionMap.TryGetValue(Type, out value) || value == null) { value = new PrioritySet(); TypeActionMap[Type] = value; } } if (action.Type != (Type)null) { SelectableTypes.Add(action.Type); } value.Add(action, priority, (ConflictResolution?)null, (DuplicateValuePolicy?)null, (PlacementIndexBias?)null); } bool Invoke() { bool flag = false; if (CurrentAction != null && CurrentAction.IsActionValid(CurrentComponent)) { flag = CurrentAction.Invoke(CurrentComponent); } if (flag) { ZiMain.PlayUiSound(zSmartSelect.CorrectSound); } else { ZiMain.PlayUiSound(zSmartSelect.InvalidSound); } return flag; } bool Update() { CurrentAction = null; CurrentComponent = null; PrioritySet val = zSearch.FindAllInViewSorted(zStaticRefrences.CameraTransform, SelectableTypes, 10000f, 3f, SelectionAngle); Component val2 = null; for (int i = 0; i < val.Count; i++) { val2 = val[i]; Type val3 = ((Object)val2).GetIl2CppType(); Type val4 = val3; while (val4 != (Type)null) { foreach (Type selectableType in SelectableTypes) { if (((Il2CppObjectBase)selectableType).Pointer == ((Il2CppObjectBase)val4).Pointer) { val3 = val4; break; } } val4 = val4.BaseType; } if (!TypeActionMap.TryGetValue(val3, out var value) || value == null) { continue; } foreach (IPressAction item in value) { if (item.IsActionValid(val2)) { CurrentAction = item; CurrentComponent = val2; return true; } } } foreach (IPressAction nullTypeAction in NullTypeActions) { if (nullTypeAction.IsActionValid(null)) { CurrentAction = nullTypeAction; CurrentComponent = null; return true; } } PrioritySet value2 = new PrioritySet(); switch (FallbackType) { case fallbackType.Default: return false; case fallbackType.PlayerAgent: { if (!TypeActionMap.TryGetValue(Il2CppType.Of(), out value2) || value2 == null || value2.Count == 0) { return false; } PlayerAgent playerAgentLookingAt = zSmartSelect.GetPlayerAgentLookingAt(); if ((Object)(object)playerAgentLookingAt == (Object)null) { return false; } val2 = (Component)(object)((Component)playerAgentLookingAt).GetComponent(); if ((Object)(object)val2 == (Object)null) { return false; } break; } case fallbackType.PlayerAiBot: { if (!TypeActionMap.TryGetValue(Il2CppType.Of(), out value2) || value2 == null || value2.Count == 0) { return false; } PlayerAIBot botLookingAt = zSmartSelect.GetBotLookingAt(); if ((Object)(object)botLookingAt == (Object)null) { return false; } val2 = (Component)(object)((Component)botLookingAt).GetComponent(); if ((Object)(object)val2 == (Object)null) { return false; } break; } } foreach (IPressAction item2 in value2) { if (item2.IsActionValid(val2)) { CurrentAction = item2; CurrentComponent = val2; return true; } } return false; } void OnRegister() { } } internal abstract class PressTypeExample : IPressType { private Component _CurrentComponent; private IPressAction _CurrentAction; private sSequenceDefinition _PressSequences; private PrioritySet _NullTypeActions = new PrioritySet(); private Dictionary> _TypeActionMap = new Dictionary>(new Il2CppTypePtrComparer()); private HashSet _SelectableTypes; public Component CurrentComponent { get { return _CurrentComponent; } set { _CurrentComponent = value; } } public IPressAction CurrentAction { get { return _CurrentAction; } set { _CurrentAction = value; } } public PrioritySet NullTypeActions { get { return _NullTypeActions; } set { _NullTypeActions = value; } } public Dictionary> TypeActionMap { get { return _TypeActionMap; } set { _TypeActionMap = value; } } public string FriendlyName => "EXAMPLE PRESS"; public IPressType.fallbackType FallbackType => IPressType.fallbackType.Default; public sSequenceDefinition PressSequence { get { if (_PressSequences == null) { _PressSequences = null; } return _PressSequences; } } public HashSet SelectableTypes { get { if (_SelectableTypes == null) { _SelectableTypes = new HashSet(new Il2CppTypePtrComparer()); } return _SelectableTypes; } } } public static class PressTypeManager { private static Dictionary _TypeMap; public static Dictionary TypeMap { get { if (_TypeMap == null) { Initalize(); } return _TypeMap; } } public static bool initalized => _TypeMap != null; public static IPressType GetPressType(string FriendlyName) { if (TypeMap == null) { Initalize(); } if (TypeMap.TryGetValue(FriendlyName, out var value)) { return value; } return null; } public static HashSet GetAllPressTypes() { return TypeMap.Values.ToHashSet(); } private static void Initalize() { if (initalized) { return; } _TypeMap = new Dictionary(); Type baseType = typeof(IPressType); foreach (Type item in from t in Assembly.GetExecutingAssembly().GetTypes() where !t.IsAbstract && baseType.IsAssignableFrom(t) select t) { IPressType pressType = (IPressType)Activator.CreateInstance(item, nonPublic: true); string friendlyName = pressType.FriendlyName; if (_TypeMap.ContainsKey(friendlyName)) { throw new Exception("Duplicate PressAction key: " + friendlyName); } _TypeMap[friendlyName] = pressType; pressType.OnRegister(); } } public static void Update() { if (!initalized) { Initalize(); } foreach (IPressType value in TypeMap.Values) { value.Update(); } } } public class pTypeDoublePress : IPressType { private Component _CurrentComponent; private IPressAction _CurrentAction; private sSequenceDefinition _PressSequences; private PrioritySet _NullTypeActions = new PrioritySet(); private Dictionary> _TypeActionMap = new Dictionary>(new Il2CppTypePtrComparer()); private HashSet _SelectableTypes; public Component CurrentComponent { get { return _CurrentComponent; } set { _CurrentComponent = value; } } public IPressAction CurrentAction { get { return _CurrentAction; } set { _CurrentAction = value; } } public PrioritySet NullTypeActions { get { return _NullTypeActions; } set { _NullTypeActions = value; } } public Dictionary> TypeActionMap { get { return _TypeActionMap; } set { _TypeActionMap = value; } } public string FriendlyName => "Double Tap"; public string FriendlyNameShort => "D-Tap"; public sSequenceDefinition PressSequence { get { if (_PressSequences == null) { _PressSequences = sInputSystemDefaults.OnDoubleTappedExclusive; } return _PressSequences; } } public HashSet SelectableTypes { get { if (_SelectableTypes == null) { _SelectableTypes = new HashSet(new Il2CppTypePtrComparer()); } return _SelectableTypes; } } } public class pTypeHoldPress : IPressType { private Component _CurrentComponent; private IPressAction _CurrentAction; private sSequenceDefinition _PressSequences; private PrioritySet _NullTypeActions = new PrioritySet(); private Dictionary> _TypeActionMap = new Dictionary>(new Il2CppTypePtrComparer()); private HashSet _SelectableTypes; public string FriendlyName => "Hold"; public sSequenceDefinition PressSequence { get { if (_PressSequences == null) { _PressSequences = sInputSystemDefaults.OnHoldImmediateExclusive; } return _PressSequences; } } public HashSet SelectableTypes { get { if (_SelectableTypes == null) { _SelectableTypes = new HashSet(new Il2CppTypePtrComparer()); } return _SelectableTypes; } } public Component CurrentComponent { get { return _CurrentComponent; } set { _CurrentComponent = value; } } public IPressAction CurrentAction { get { return _CurrentAction; } set { _CurrentAction = value; } } public PrioritySet NullTypeActions { get { return _NullTypeActions; } set { _NullTypeActions = value; } } public Dictionary> TypeActionMap { get { return _TypeActionMap; } set { _TypeActionMap = value; } } } public class pTypeTapAndHoldPress : IPressType { private Component _CurrentComponent; private IPressAction _CurrentAction; private sSequenceDefinition _PressSequences; private PrioritySet _NullTypeActions = new PrioritySet(); private Dictionary> _TypeActionMap = new Dictionary>(new Il2CppTypePtrComparer()); private HashSet _SelectableTypes; public string FriendlyName => "Tap and Hold"; public string FriendlyNameShort => "T-Hold"; public sSequenceDefinition PressSequence { get { if (_PressSequences == null) { _PressSequences = sInputSystemDefaults.OnTapAndHoldImmediateExclusive; } return _PressSequences; } } public HashSet SelectableTypes { get { if (_SelectableTypes == null) { _SelectableTypes = new HashSet(new Il2CppTypePtrComparer()); } return _SelectableTypes; } } public Component CurrentComponent { get { return _CurrentComponent; } set { _CurrentComponent = value; } } public IPressAction CurrentAction { get { return _CurrentAction; } set { _CurrentAction = value; } } public PrioritySet NullTypeActions { get { return _NullTypeActions; } set { _NullTypeActions = value; } } public Dictionary> TypeActionMap { get { return _TypeActionMap; } set { _TypeActionMap = value; } } } public class pTypeTapPress : IPressType { private Component _CurrentComponent; private IPressAction _CurrentAction; private sSequenceDefinition _PressSequences = sInputSystemDefaults.OnTappedExclusive; private PrioritySet _NullTypeActions = new PrioritySet(); private Dictionary> _TypeActionMap = new Dictionary>(new Il2CppTypePtrComparer()); private HashSet _SelectableTypes; public string FriendlyName => "Tap"; public IPressType.fallbackType FallbackType => IPressType.fallbackType.PlayerAiBot; public sSequenceDefinition PressSequence => _PressSequences; public HashSet SelectableTypes { get { if (_SelectableTypes == null) { _SelectableTypes = new HashSet(new Il2CppTypePtrComparer()); } return _SelectableTypes; } } public Component CurrentComponent { get { return _CurrentComponent; } set { _CurrentComponent = value; } } public IPressAction CurrentAction { get { return _CurrentAction; } set { _CurrentAction = value; } } public PrioritySet NullTypeActions { get { return _NullTypeActions; } set { _NullTypeActions = value; } } public Dictionary> TypeActionMap { get { return _TypeActionMap; } set { _TypeActionMap = value; } } [Obsolete("This method is no longer used. The logic has been made generic and moved to the action types themselves with IPressType.Update() and IPressAction.IsActionValid()")] public bool SetCurrentAction() { //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) Component currentComponent = CurrentComponent; Type val = ((currentComponent != null) ? ((Object)currentComponent).GetIl2CppType() : null); if (val == (Type)null) { if (Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.up) < 15f && zSmartSelect.MainSelection.Selected()) { _CurrentAction = PressActionManager.GetAction("Deselect All Bots"); return true; } } else { if (zHelpers.IsOfType(val)) { _CurrentAction = PressActionManager.GetAction("Select Bot"); return true; } if (zHelpers.IsOfType(val)) { SentryGunInstance obj = ((Il2CppObjectBase)CurrentComponent).Cast(); object obj2; if (obj == null) { obj2 = null; } else { PlayerAgent owner = ((Item)obj).Owner; obj2 = ((owner != null) ? ((Component)owner).GetComponent() : null); } if ((Object)obj2 != (Object)null) { _CurrentAction = PressActionManager.GetAction("Pickup Sentry"); return true; } } else if (zHelpers.IsOfType(val)) { LG_WeakDoor val2 = ((Il2CppObjectBase)CurrentComponent).Cast(); if (!Object.op_Implicit((Object)(object)zSmartSelect.MainSelection.GetSelected().FirstOrDefault())) { if (!val2.InteractionAllowed) { _CurrentAction = null; return false; } if (val2.Gate.IsTraversable) { _CurrentAction = PressActionManager.GetAction("Close Door"); } _CurrentAction = PressActionManager.GetAction("Open Door"); return true; } } } if ((Object)(object)zSmartSelect.GetBotLookingAt() != (Object)null) { _CurrentAction = PressActionManager.GetAction("Select Bot"); return true; } _CurrentAction = null; return false; } } } namespace BotControl.SmartSelect.PressActions { internal class pActionDropNow : IPressAction { public string FriendlyName => "Drop Now"; public string FriendlyNameShort => "Drop"; public string FriendlyIdentifier => "Drop Objective"; public Type Type => null; public string pressTypeIdentifier => "Double Tap"; public int? Priority => 10; public bool Invoke(Component BestComponent) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (zHelpers.GetAgentBackpackItem(bestBot.Agent, (InventorySlot)8) == null) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CANCELTHAT); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Cancel that.", 1f); zStaticRefrences.CommsMenu.OnButtonPressedDrop((PUI_CommunicationButton)null, bestBot.Agent); zChatHandler.sendChatMessage("Dropping item.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (zHelpers.GetAgentBackpackItem(bestBot.Agent, (InventorySlot)8) == null) { return false; } return true; } } internal class pActionDropHere : IPressAction { public string FriendlyName => "Drop Here"; public string FriendlyNameShort => "Drop-H"; public Type Type => null; public string pressTypeIdentifier => "Hold"; public string FriendlyIdentifier => "Drop Objective"; public int? Priority => 10; public bool Invoke(Component BestComponent) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (zHelpers.GetAgentBackpackItem(bestBot.Agent, (InventorySlot)8) == null) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CANCELTHAT); zBotActions.SendBotToDropHere(bestBot, zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Dropping item there.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (zHelpers.GetAgentBackpackItem(bestBot.Agent, (InventorySlot)8) == null) { return false; } return true; } } public class pActionPickupItem : IPressAction { public string FriendlyName => "Pickup Item"; public string FriendlyNameShort => "Pickup"; public string FriendlyIdentifier => "Pickup Item"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { ItemInLevel val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot val2 = zSmartSelect.MainSelection.GetSelected().FirstOrDefault(); if ((Object)(object)val2 == (Object)null) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_GRABTHEITEM); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Grab the item.", 1f); zBotActions.SendBotToPickupItem(val2, val, zStaticRefrences.LocalPlayer, 0uL); return true; } public bool IsActionValid(Component candidate) { //IL_0037: 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_0056: 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_00b5: Unknown result type (might be due to invalid IL or missing references) ItemInLevel val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } ePickupItemStatus? obj; if (val == null) { obj = null; } else { iPickupItemSync syncComponent = val.GetSyncComponent(); obj = ((syncComponent != null) ? new ePickupItemStatus?(syncComponent.GetCurrentState().status) : ((ePickupItemStatus?)null)); } ePickupItemStatus? val2 = obj; if (!val2.HasValue) { return false; } if (val2 != (ePickupItemStatus?)0) { return false; } CarryItemPickup_Core val3 = ((Il2CppObjectBase)val).TryCast(); if ((Object)(object)val3 != (Object)null && !val3.IsInteractable) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!zHelpers.CanBotReach(bestBot, ((Component)val).transform.position)) { return false; } return true; } } public class pActionRevive : IPressAction { public string FriendlyName => "Revive Agent"; public string FriendlyNameShort => "Revive"; public string FriendlyIdentifier => "Revive"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public int? Priority => 100; public bool Invoke(Component BestComponent) { PlayerAgent val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } zBotActions.SendBotToReviveAgent(bestBot, val, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_INEEDHELP); zChatHandler.sendChatMessage("Reving " + val.PlayerName + ".", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) PlayerAgent val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } if (((Agent)val).Alive) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!zHelpers.CanBotReach(bestBot, ((Agent)val).Position)) { return false; } return true; } } internal class pActionReviveSelf : IPressAction { private List Types = new List { null, Il2CppType.Of() }; private List PressTypeIdentifiers = new List { "Hold", "Double Tap" }; public string FriendlyName => "Revive Self"; public string FriendlyNameShort => "Revive"; public string FriendlyIdentifier => "Revive"; public int? Priority => 100; public Type Type => null; public void Register() { foreach (string pressTypeIdentifier in PressTypeIdentifiers) { IPressType pressType = PressTypeManager.GetPressType(pressTypeIdentifier); if (pressType == null) { throw new Exception("PressAction " + FriendlyName + " tried to register to non existant press type " + pressTypeIdentifier); } foreach (Type type in Types) { pressType.RegisterAction(this, type, 100); } } } public bool Invoke(Component BestComponent) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot val = null; if ((Object)(object)BestComponent != (Object)null) { PlayerAIBot val2 = ((Il2CppObjectBase)BestComponent).TryCast(); if (((Agent)val2.Agent).Alive) { return false; } if (!zHelpers.CanBotReach(val2, ((Agent)zStaticRefrences.LocalPlayer).Position)) { val = val2; } } else { val = zSmartSelect.MainSelection.GetSelected().FirstOrDefault(); } if ((Object)(object)val == (Object)null) { return false; } zBotActions.SendBotToReviveAgent(val, zStaticRefrences.LocalPlayer, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_DOWNEDNEEDINGHELP01); zChatHandler.sendChatMessage("Reviving " + zStaticRefrences.LocalPlayer.PlayerName + ".", FriendlyIdentifier + IPressAction.chatPermSuffix, val.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //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_00b8: 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) if (((Agent)zStaticRefrences.LocalPlayer).Alive) { return false; } if ((Object)(object)candidate == (Object)null) { if (!(Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.down) < 80f)) { return false; } foreach (PlayerAIBot item in zSmartSelect.MainSelection.GetSelected()) { if (((Agent)item.Agent).Alive && zHelpers.CanBotReach(item, ((Agent)zStaticRefrences.LocalPlayer).Position)) { return true; } } } else { PlayerAIBot val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } if (!((Agent)val.Agent).Alive) { return false; } if (zHelpers.CanBotReach(val, ((Agent)zStaticRefrences.LocalPlayer).Position)) { return true; } } return false; } } internal class pActionThrowConsumable : IPressAction { private static List ThrowableArchatipes = new List { "Glow Stick", "C-Foam Grenade", "Fog Repeller" }; public string FriendlyName => "Throw Consumable"; public string FriendlyIdentifier => "Throw Consumable"; public string FriendlyNameShort => "Throw"; public Type Type => null; public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { //IL_0112: 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) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } PlayerAgent localPlayer = zStaticRefrences.LocalPlayer; if (PlayerBackpackManager.GetBackpack(bestBot.Agent.Owner).AmmoStorage.ConsumableAmmo.BulletsInPack <= 0) { return false; } string archetypeName = zHelpers.GetAgentBackpackItem(bestBot.Agent, (InventorySlot)5).Instance.ArchetypeName; if (!ThrowableArchatipes.Contains(archetypeName)) { return false; } if (archetypeName == "Glow Stick") { PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_THROWSOMEGLOWSTICKSHERE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Throw a glowstick here.", 1f); } if (archetypeName == "C-Foam Grenade") { PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CFOAMHERE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Throw C-Foam here.", 1f); } if (archetypeName == "Fog Repeller") { PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PUTAFOGREPELLERHERE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Put a fog reppeler here.", 1f); } zBotActions.SendBotToThrowItem(localPlayer, bestBot.Agent, ((Component)localPlayer).transform.position, localPlayer.FPSCamera.CameraRayPos, 0uL); zChatHandler.sendChatMessage("Throwing my " + archetypeName + ".", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (zStaticRefrences.LocalPlayer.FPSCamera.CameraRayDist > 30f) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (PlayerBackpackManager.GetBackpack(bestBot.Agent.Owner).AmmoStorage.ConsumableAmmo.BulletsInPack <= 0) { return false; } BackpackItem agentBackpackItem = zHelpers.GetAgentBackpackItem(bestBot.Agent, (InventorySlot)5); if (!ThrowableArchatipes.Contains(agentBackpackItem.Instance.ArchetypeName)) { return false; } if (!zHelpers.CanBotReach(bestBot, zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos)) { return false; } return true; } } public interface IPressAction { static string chatPermSuffix = ChatSettingsMenu.chatPermsString + ChatSettingsMenu.AcknowlageString; string FriendlyIdentifier { get; } string FriendlyName { get; } string FriendlyNameShort => FriendlyName; Type Type { get; } string? pressTypeIdentifier => null; int? Priority => null; bool Enabled => true; void Register() { if (!pressTypeIdentifier.ToLower().Contains("example")) { if (pressTypeIdentifier == null) { throw new Exception("PressAction " + FriendlyName + " does not specify a press type. It must handle it's own registration."); } if (Type != (Type)null && !zHelpers.IsOfType(Type)) { throw new Exception("PressAction " + FriendlyName + " has a type that is not a Component."); } (PressTypeManager.GetPressType(pressTypeIdentifier) ?? throw new Exception("PressAction " + FriendlyName + " tried to register to non existant press type " + pressTypeIdentifier)).RegisterAction(this, Priority); } } bool Invoke(Component BestComponenet); bool IsActionValid(Component candidate); } internal class pActionExample : IPressAction { public string FriendlyName => "EXAMPLE ACTION"; public string FriendlyNameShort => "Exmpl"; public Type Type => null; public string pressTypeIdentifier => "EXAMPLE PRESS"; public string FriendlyIdentifier => "EXAMPLE"; public bool Enabled => false; public bool Invoke(Component BestComponent) { return false; } public bool IsActionValid(Component candidate) { return false; } } public static class PressActionManager { private static Dictionary ActionMap; public static void Initialize() { if (ActionMap != null) { return; } ActionMap = new Dictionary(); Type baseType = typeof(IPressAction); foreach (Type item in from t in Assembly.GetExecutingAssembly().GetTypes() where !t.IsAbstract && baseType.IsAssignableFrom(t) select t) { IPressAction pressAction = (IPressAction)Activator.CreateInstance(item, nonPublic: true); string friendlyName = pressAction.FriendlyName; if (ActionMap.ContainsKey(friendlyName)) { throw new Exception("Duplicate PressAction key: " + friendlyName); } ActionMap[friendlyName] = pressAction; pressAction.Register(); } } public static IPressAction GetAction(string name) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (ActionMap == null) { Initialize(); } if (!ActionMap.TryGetValue(name, out var value)) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not find action "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" in Press Action Map."); } log.LogError(val); } return value; } public static HashSet GetAllActions() { return ActionMap.Values.ToHashSet(); } } } namespace BotControl.SmartSelect.PressActions.TapAndHoldActions { public class pActionFollowOtherDirect : IPressAction { private string _FriendlyNameShort = "Send"; private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Follow Other Direct"; public string FriendlyIdentifier => "Follow"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public int? Priority => 15; public string pressTypeIdentifier => "Tap and Hold"; public bool Invoke(Component BestComponent) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PlayerAgent val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } if ((Object)(object)val == (Object)(object)bestBot.Agent) { return false; } pActionFollowDirect.StaticCallAgentToFollow(bestBot.Agent, val); return true; } public bool IsActionValid(Component candidate) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PlayerAgent val = ((Il2CppObjectBase)candidate).Cast(); if ((Object)(object)val == (Object)null) { return false; } if ((Object)(object)val == (Object)(object)zStaticRefrences.LocalPlayer) { return false; } SyncTable syncValues = bestBot.SyncValues; PlayerAgent val2 = ((syncValues != null) ? syncValues.Leader : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2 == (Object)(object)val) { return false; } if ((Object)(object)bestBot.Agent == (Object)(object)val) { return false; } Color = val.Owner.PlayerColor; return true; } } public class pActionFollowOtherIndirect : IPressAction { private string _FriendlyNameShort = "Send"; private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Follow Other Indirect"; public string FriendlyIdentifier => "Follow"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => null; public int? Priority => 5; public string pressTypeIdentifier => "Tap and Hold"; public bool Invoke(Component BestComponent) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PlayerAgent val = ((!((Object)(object)BestComponent != (Object)null)) ? zSmartSelect.GetPlayerAgentLookingAt() : ((Il2CppObjectBase)BestComponent).TryCast()); if ((Object)(object)val == (Object)null) { return false; } if ((Object)(object)val == (Object)(object)bestBot.Agent) { return false; } pActionFollowDirect.StaticCallAgentToFollow(bestBot.Agent, val); return true; } public bool IsActionValid(Component candidate) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PlayerAgent playerAgentLookingAt = zSmartSelect.GetPlayerAgentLookingAt(); if ((Object)(object)playerAgentLookingAt == (Object)null) { return false; } if ((Object)(object)playerAgentLookingAt == (Object)(object)zStaticRefrences.LocalPlayer) { return false; } if (!zHelpers.IsObstructed(zStaticRefrences.CameraTransform.position, ((Component)playerAgentLookingAt).gameObject, ((Component)zStaticRefrences.LocalPlayer).gameObject)) { return false; } SyncTable syncValues = bestBot.SyncValues; PlayerAgent val = ((syncValues != null) ? syncValues.Leader : null); if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)playerAgentLookingAt) { return false; } if ((Object)(object)bestBot.Agent == (Object)(object)playerAgentLookingAt) { return false; } Color = playerAgentLookingAt.Owner.PlayerColor; return true; } } public class pActionMove : IPressAction { public static int collisionLayer = LayerManager.MASK_ENEMY_PROJECTILE_COLLIDERS; public string FriendlyName => "Move To"; public string FriendlyNameShort => "Move"; public string FriendlyIdentifier => "Move"; public Type Type => null; public int? Priority => 10; public string pressTypeIdentifier => "Tap and Hold"; public bool Invoke(Component BestComponent) { //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_0027: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } Vector3 cameraRayPos = zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos; zBotActions.SendbotToMoveToLocation(bestBot, cameraRayPos, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_HURRY); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Hurry.", 1f); zChatHandler.sendChatMessage("On the way.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } Vector3 Position = zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos; if (!zHelpers.PositionIsValidForAgent(bestBot.Agent, ref Position)) { return false; } if (!zHelpers.CanBotReach(bestBot, Position)) { return false; } return true; } } } namespace BotControl.SmartSelect.PressActions.HoldActions { public class pActionAttackEnemy : IPressAction { public string FriendlyName => "Attack Enemy"; public string FriendlyNameShort => "Attack"; public string FriendlyIdentifier => "Attack"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { EnemyAgent val = ((Il2CppObjectBase)BestComponent).TryCast(); PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)val == (Object)null || (Object)(object)bestBot == (Object)null) { return false; } if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } zBotActions.SendBotToAttackSleeper(bestBot, val, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Attacking sleeper.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_0068: Unknown result type (might be due to invalid IL or missing references) if ((int)DramaManager.CurrentStateEnum != 2 && (int)DramaManager.CurrentStateEnum != 4) { return false; } EnemyAgent val = ((Il2CppObjectBase)candidate).TryCast(); PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)val == (Object)null || (Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!((Agent)val).Alive) { return false; } if ((int)val.EnemyData.EnemyType != 1) { return false; } if (!zHelpers.CanBotReach(bestBot, ((Component)val).transform.position)) { return false; } return true; } } public class pActionDeselect : IPressAction { public string FriendlyName => "Deselect All Bots"; public string FriendlyNameShort => "Deselect"; public string FriendlyIdentifier => "Select"; public Type Type => null; public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { if (!zSmartSelect.MainSelection.Selected()) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CANCELTHAT); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Cancel that.", 1f); foreach (PlayerAIBot item in zSmartSelect.MainSelection.GetSelected()) { zChatHandler.sendChatMessage("Nevermind.", FriendlyIdentifier + IPressAction.chatPermSuffix, item.Agent, zStaticRefrences.LocalPlayer); } zSmartSelect.MainSelection.Deselect(); return true; } public bool IsActionValid(Component candidate) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!zSmartSelect.MainSelection.Selected()) { return false; } if (Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.up) < 15f) { return true; } return false; } } public class pActionInsertCell : IPressAction { public string FriendlyName => "Insert Cell"; public string FriendlyNameShort => "Insert"; public string FriendlyIdentifier => "Insert"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public int? Priority => 15; public bool Invoke(Component BestComponent) { LG_PowerGenerator_Core generator = ((Il2CppObjectBase)BestComponent).TryCast(); PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } zBotActions.SendBotToInsertCell(bestBot, generator, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Inserting cell.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } LG_PowerGenerator_Core val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } if (!((Component)((Il2CppObjectBase)val.m_powerCellInteraction).Cast()).gameObject.activeInHierarchy) { return false; } if (!zHelpers.TryGetAgentBackpackItem(bestBot.Agent, (InventorySlot)8, out BackpackItem backpackItem)) { return false; } if (backpackItem.ItemID != 131) { return false; } Vector3? targetPosition = GetTargetPosition(val); if (!targetPosition.HasValue) { return false; } if (!zHelpers.CanBotReach(bestBot, targetPosition.Value)) { return false; } return true; } private Vector3? GetTargetPosition(LG_PowerGenerator_Core TargetGenerator) { //IL_0022: 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_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_0055: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)TargetGenerator).gameObject; if ((Object)(object)gameObject == (Object)null) { return null; } Transform transform = gameObject.transform; if (!zHelpers.SnapPositionToNav(transform.position + transform.forward * 1.5f, out var resultPosition)) { return null; } return resultPosition; } } public class pActionOpenContainer : IPressAction { public string FriendlyName => "Open Container"; public string FriendlyNameShort => "Open"; public string FriendlyIdentifier => "Open"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { LG_WeakResourceContainer container = ((Il2CppObjectBase)BestComponent).TryCast(); PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); zBotActions.SendBotToOpenContainer(bestBot, container, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PLEASE); zChatHandler.sendChatMessage("Opening container.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) LG_WeakResourceContainer val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } if (val.ISOpen) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!zHelpers.CanBotReach(bestBot, ((Component)val).transform.position)) { return false; } return true; } } public class pActionRefillSentry : IPressAction { public string FriendlyName => "Refill Sentry"; public string FriendlyNameShort => "Refill"; public string FriendlyIdentifier => "Share Resources"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { SentryGunInstance val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } zBotActions.SendBotToRefillSentry(bestBot, val, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Refilling sentry.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) SentryGunInstance val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } if (!val.NeedToolAmmo()) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(bestBot.Agent.Owner); if (!zHelpers.TryGetAgentBackpackItem(bestBot.Agent, (InventorySlot)4, out BackpackItem backpackItem)) { return false; } if (backpackItem == null || backpackItem.ItemID != 127) { return false; } if (backpack.AmmoStorage.ResourcePackAmmo.BulletsInPack <= 0) { return false; } if (!zHelpers.CanBotReach(bestBot, ((Component)val).transform.position)) { return false; } return true; } } public class pActionSecureDoor : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Secure Door"; public string _FriendlyNameShort => "Secure"; public string FriendlyIdentifier => "Throw Consumable"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_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_0066: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008f: 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_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_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_00f3: 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) LG_WeakDoor val = ((Il2CppObjectBase)BestComponent).TryCast(); PlayerAIBot bestBot = GetBestBot(val); if ((Object)(object)val == (Object)null || (Object)(object)bestBot == (Object)null) { return false; } if (val.Gate.IsTraversable) { return false; } Vector3 position = ((Agent)bestBot.Agent).Position; LG_Gate gate = val.Gate; Vector3 val2 = ((Component)gate).transform.position - ((Agent)bestBot.Agent).Position; Vector3 val3 = ((Component)gate).transform.forward; if (Vector3.Dot(val3, val2) > 0f) { val3 = -val3; } Vector3 val4 = ((Component)gate).transform.position + val3 * 1f; NavMeshHit val5 = default(NavMeshHit); position = ((!NavMesh.SamplePosition(val4, ref val5, 1.5f, -1)) ? val4 : ((NavMeshHit)(ref val5)).position); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CFOAMHERE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Throw C-Foam here.", 1f); zBotActions.SendBotToThrowItem(zStaticRefrences.LocalPlayer, bestBot.Agent, position, ((Component)val).transform.position, 0uL); zChatHandler.sendChatMessage("Securing door.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return false; } public bool Evaluate(PlayerAgent agent, uint itemID) { BackpackItem val = ((Il2CppArrayBase)(object)PlayerBackpackManager.GetBackpack(agent.Owner).Slots)[5]; if (val != null) { return val.ItemID == itemID; } return false; } public bool IsActionValid(Component candidate) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //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) LG_WeakDoor val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot bestBot = GetBestBot(val); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!Evaluate(bestBot.Agent, 115u)) { return false; } if (PlayerBackpackManager.GetBackpack(bestBot.Agent.Owner).AmmoStorage.ConsumableAmmo.BulletsInPack <= 0) { return false; } if ((int)val.LastStatus == 11) { return false; } if ((int)val.LastStatus == 12) { return false; } if ((int)val.LastStatus == 13) { return false; } if (val.Gate.IsTraversable && !val.InteractionAllowed) { return false; } Color = bestBot.Agent.Owner.PlayerColor; return true; } private PlayerAIBot GetBestBot(LG_WeakDoor Door) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) List botList = ZiMain.GetBotList(); List list = new List(); PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); foreach (PlayerAIBot item in botList) { if (((Agent)item.Agent).Alive && Evaluate(item.Agent, 115u) && PlayerBackpackManager.GetBackpack(item.Agent.Owner).AmmoStorage.ConsumableAmmo.BulletsInPack > 0 && zHelpers.CanBotReach(item, ((Component)Door).transform.position)) { if (((Il2CppObjectBase)item.Agent).Pointer == ((Il2CppObjectBase)bestBot.Agent).Pointer) { return bestBot; } list.Add(item); } } return list.FirstOrDefault(); } } public class pActionShareResource : IPressAction { private string _FriendlyNameShort = "Share"; private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Share Resource"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public string FriendlyIdentifier => "Share Resources"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public bool Invoke(Component BestComponent) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) bool result = false; PlayerAgent val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } float num = 0f; foreach (PlayerAIBot item in zSmartSelect.MainSelection.GetSelected()) { uint itemID = zHelpers.GetAgentBackpackItem(item.Agent, (InventorySlot)4).ItemID; bool flag = false; switch (itemID) { case 102u: flag = val.NeedHealth(); break; case 101u: flag = val.NeedWeaponAmmo(); break; case 127u: flag = val.NeedToolAmmo(); break; case 132u: flag = val.NeedDisinfection(); break; } if (flag && zHelpers.CanBotReach(item, ((Agent)val).Position)) { result = true; zBotActions.SendBotToShareResourcePack(item, val, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PLEASE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Please", 1f); ZiMain.BotBarkBack(item.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do.", 1f + num); num += 0.25f; } } return result; } public bool IsActionValid(Component candidate) { //IL_008b: 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_00a8: Unknown result type (might be due to invalid IL or missing references) PlayerAgent val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } foreach (PlayerAIBot item in zSmartSelect.MainSelection.GetSelected()) { uint agentBackpackItemId = zHelpers.GetAgentBackpackItemId(item.Agent, (InventorySlot)4); bool flag = false; switch (agentBackpackItemId) { case 102u: flag = val.NeedHealth(); break; case 101u: flag = val.NeedWeaponAmmo(); break; case 127u: flag = val.NeedToolAmmo(); break; case 132u: flag = val.NeedDisinfection(); break; } if (flag && zHelpers.CanBotReach(item, ((Agent)val).Position)) { Color = val.Owner.PlayerColor; return true; } } return false; } } internal class pActionShareSelf : IPressAction { public string FriendlyName => "Share Self"; public string FriendlyNameShort => "Share"; public Type Type => null; public string pressTypeIdentifier => "Hold"; public string FriendlyIdentifier => "Share Resources"; public bool Invoke(Component BestComponent) { PressActionManager.GetAction("Share Resource").Invoke((Component)(object)zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!zSmartSelect.MainSelection.AnySelectedBotsAlive()) { return false; } if (!(Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.down) < 15f)) { return false; } PlayerAgent localPlayer = zStaticRefrences.LocalPlayer; if (!((Agent)localPlayer).Alive) { return false; } foreach (PlayerAIBot item in zSmartSelect.MainSelection.GetSelected()) { uint agentBackpackItemId = zHelpers.GetAgentBackpackItemId(item.Agent, (InventorySlot)4); bool flag = false; switch (agentBackpackItemId) { case 102u: flag = localPlayer.NeedHealth(); break; case 101u: flag = localPlayer.NeedWeaponAmmo(); break; case 127u: flag = localPlayer.NeedToolAmmo(); break; case 132u: flag = localPlayer.NeedDisinfection(); break; } if (flag) { return true; } } return false; } } } namespace BotControl.SmartSelect.PressActions.TapActions { public class pActionCancelAll : IPressAction { public string FriendlyName => "Cancel All"; public string FriendlyNameShort => "Cancel-A"; public string FriendlyIdentifier => "Cancel Action"; public Type Type => null; public bool Enabled => true; public int? Priority => 20; public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CANCELTHAT); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Cancel that.", 1f); HashSet hashSet = new HashSet(); foreach (ManualAction item in zActions.manualActions[zStaticRefrences.LocalPlayer.CharacterID]) { zBotActions.CancelBotAction(item.ID, 0uL); hashSet.Add(item.Bot); } foreach (PlayerAIBot item2 in hashSet) { zChatHandler.sendChatMessage("Nevermind.", FriendlyIdentifier + IPressAction.chatPermSuffix, item2.Agent, zStaticRefrences.LocalPlayer); } return true; } public bool IsActionValid(Component candidate) { //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) if (!(Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.up) < 15f)) { return false; } if (!zActions.manualActions.ContainsKey(zStaticRefrences.LocalPlayer.CharacterID)) { return false; } if (zActions.manualActions[zStaticRefrences.LocalPlayer.CharacterID].Count <= 1) { return false; } return true; } } public class pActionPickupAllMines : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public int cycleOffset; public string FriendlyName => "Pickup All Mines"; public string _FriendlyNameShort => "A-Pickup-A"; public string FriendlyIdentifier => "Pickup Equipmenet"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { List botsWithDeployedMines = GetBotsWithDeployedMines(); if (botsWithDeployedMines.Count == 0) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PICKUPYOURDEPLOYABLES); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Pick up your deployables.", 1f); MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)zUpdater.Instance, BotsPickupMines(botsWithDeployedMines)); return true; } public static IEnumerator BotsPickupMines(List Bots) { foreach (PlayerAIBot Bot in Bots) { zChatHandler.sendChatMessage("Picking up mines.", "Pickup Equipmenet" + IPressAction.chatPermSuffix, Bot.Agent, zStaticRefrences.LocalPlayer); zBotActions.SendBotToPickUpMine(Bot, null, zStaticRefrences.LocalPlayer, 0uL); yield return (object)new WaitForSeconds(0.25f); } } public bool IsActionValid(Component candidate) { //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) List botsWithDeployedMines = GetBotsWithDeployedMines(); if (botsWithDeployedMines.Count <= 1) { return false; } cycleOffset++; int num = (cycleOffset - 1) / 1; botsWithDeployedMines.Sort((PlayerAIBot a, PlayerAIBot b) => ((Object)a).GetInstanceID().CompareTo(((Object)b).GetInstanceID())); int index = num % botsWithDeployedMines.Count; Color = botsWithDeployedMines[index].Agent.Owner.PlayerColor; return true; } public List GetBotsWithDeployedMines() { List list = new List(); foreach (PlayerAIBot bot in ZiMain.GetBotList()) { if (((Agent)bot.Agent).Alive && bot.GetDeployedItems().Count > 0 && zHelpers.TryGetAgentBackpackItem(bot.Agent, (InventorySlot)3, out BackpackItem backpackItem) && backpackItem != null && !(backpackItem.Instance.ArchetypeName != "Mine deployer")) { list.Add(bot); } } return list; } } public class pActionPickupMines : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Pickup All Agent Mines"; public string _FriendlyNameShort => "Pickup-A"; public string FriendlyIdentifier => "Pickup Equipmenet"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { MineDeployerInstance obj = ((Il2CppObjectBase)BestComponent).TryCast(); object obj2; if (obj == null) { obj2 = null; } else { PlayerAgent owner = ((Item)obj).Owner; obj2 = ((owner != null) ? ((Component)owner).GetComponent() : null); } PlayerAIBot val = (PlayerAIBot)obj2; if ((Object)(object)val == (Object)null) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PICKUPYOURDEPLOYABLES); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Pick up your deployables.", 1f); zBotActions.SendBotToPickUpMine(val, null, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Picking up all of my mines.", FriendlyIdentifier + IPressAction.chatPermSuffix, val.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //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) MineDeployerInstance val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } object obj; if (val == null) { obj = null; } else { PlayerAgent owner = ((Item)val).Owner; obj = ((owner != null) ? ((Component)owner).GetComponent() : null); } PlayerAIBot val2 = (PlayerAIBot)obj; if ((Object)(object)val2 == (Object)null) { return false; } if (!((Agent)val2.Agent).Alive) { return false; } if (val2.GetDeployedItems().Count <= 1) { return false; } Color = val2.Agent.Owner.PlayerColor; return true; } } public class pActionUseLockMelter : IPressAction { public static bool strike = false; public static bool travel = true; public string FriendlyName => "Lock Melter"; public string FriendlyNameShort => "Melt"; public string FriendlyIdentifier => "Interact"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Hold"; public bool Invoke(Component BestComponent) { LG_WeakLock val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PLEASE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Please.", 1f); zBotActions.SendbotToBreakLock(bestBot, val, (MethodEnum)4, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Using my lock melter.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) LG_WeakLock val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if ((Object)(object)val == (Object)null) { return false; } if (!zHelpers.TryGetAgentBackpackItem(bestBot.Agent, (InventorySlot)5, out BackpackItem backpackItem)) { return false; } if (backpackItem.ItemID != 116) { return false; } iLG_WeakLockHolder holder = val.m_holder; LG_DoorButton val2 = ((Il2CppObjectBase)holder).TryCast(); ((Il2CppObjectBase)holder).TryCast(); if ((Object)(object)val2 != (Object)null) { LG_WeakDoor val3 = ((Il2CppObjectBase)val2.m_door).TryCast(); if ((Object)(object)val3 != (Object)null && !val3.Gate.IsTraversable && Vector3.Dot(((Component)val).transform.forward, zStaticRefrences.CameraTransform.position - ((Component)val).transform.position) <= 0f) { return false; } } if (!zHelpers.CanBotReach(bestBot, ((Component)val).transform.position)) { return false; } return true; } } public class pActionCancelLast : IPressAction { public string FriendlyName => "Cancel Last"; public string FriendlyNameShort => "Cancel"; public string FriendlyIdentifier => "Cancel Action"; public Type Type => null; public bool Enabled => true; public string pressTypeIdentifier => "Tap"; public bool Invoke(Component BestComponent) { PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CANCELTHAT); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Cancel that.", 1f); if (zActions.manualActions.Count == 0) { return false; } ManualAction manualAction = zActions.manualActions[zStaticRefrences.LocalPlayer.CharacterID].Last(); zBotActions.CancelBotAction(manualAction.ID, 0uL); zChatHandler.sendChatMessage("Nevermind.", FriendlyIdentifier + IPressAction.chatPermSuffix, manualAction.Bot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //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) if (!(Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.up) < 15f)) { return false; } if (zActions.manualActions[zStaticRefrences.LocalPlayer.CharacterID].Count == 0) { return false; } return true; } } public class pActionDoorInteract : IPressAction { private string _FriendlyNameShort = "Open"; public string FriendlyName => "Open Door"; public string FriendlyNameShort => _FriendlyNameShort; public string FriendlyIdentifier => "Interact"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Tap"; public bool Invoke(Component BestComponent) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) LG_WeakDoor val = ((Il2CppObjectBase)BestComponent).TryCast(); PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_THISDOOR); zBotActions.SendBotToInteractDoor(bestBot, val, ((Component)zStaticRefrences.LocalPlayer).transform.position, (MethodEnum)7, zStaticRefrences.LocalPlayer, 0uL); if (val.Gate.IsTraversable) { zChatHandler.sendChatMessage("Closing the door.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); } else { zChatHandler.sendChatMessage("Opening the door.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); } return true; } public bool IsActionValid(Component candidate) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 if (!zSmartSelect.MainSelection.AnySelectedBotsAlive()) { return false; } LG_WeakDoor val = ((Il2CppObjectBase)candidate).TryCast(); if (!val.InteractionAllowed) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if (!((Agent)bestBot.Agent).Alive) { return false; } if (!zHelpers.CanBotReach(bestBot, ((Component)val).transform.position)) { return false; } if (val.Gate.IsTraversable) { _FriendlyNameShort = "Close"; } else { LG_DoorButton button = GetButton(val); if ((Object)(object)button == (Object)null) { return false; } LG_WeakLock val2 = GetLock(button); if ((Object)(object)val2 == (Object)null || (int)val2.Status == 3) { _FriendlyNameShort = "Open"; } else { _FriendlyNameShort = "Unlock-O"; } } return true; } private LG_DoorButton GetButton(LG_WeakDoor TargetDoor) { //IL_002e: 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_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) LG_DoorButton result = null; if ((Object)(object)TargetDoor == (Object)null) { return null; } float num = float.MinValue; foreach (LG_DoorButton item in (Il2CppArrayBase)(object)TargetDoor.m_buttons) { float num2 = Vector3.Dot(((Component)item).transform.forward, ((Component)zStaticRefrences.LocalPlayer).transform.position - ((Component)item).transform.position); if (num2 > num) { num = num2; result = item; } } return result; } public LG_WeakLock GetLock(LG_DoorButton TargetButton) { LG_WeakDoor val = ((Il2CppObjectBase)TargetButton.m_door).Cast(); if (val.WeakLocks == null) { return null; } if (((Il2CppArrayBase)(object)val.WeakLocks).Count == 0) { return null; } foreach (LG_WeakLock item in (Il2CppArrayBase)(object)val.WeakLocks) { if (((Il2CppObjectBase)item.m_holder).Pointer == ((Il2CppObjectBase)TargetButton).Pointer) { return item; } } return null; } } public class pActionFollowSelf : IPressAction { private string _FriendlyNameShort = "Follow"; private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Follow Self"; public string FriendlyIdentifier => "Follow"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => null; public string pressTypeIdentifier => "Tap"; public bool Invoke(Component BestComponent) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PressActionManager.GetAction("Follow me").Invoke((Component)(object)bestBot.Agent); return true; } public bool IsActionValid(Component candidate) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!zSmartSelect.MainSelection.AnySelectedBotsAlive()) { return false; } if (!(Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.down) < 15f)) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } SyncTable syncValues = bestBot.SyncValues; PlayerAgent val = ((syncValues != null) ? syncValues.Leader : null); if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)zStaticRefrences.LocalPlayer) { return false; } Color = bestBot.Agent.Owner.PlayerColor; return true; } } public class pActionPickupMine : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Pickup Mine"; public string _FriendlyNameShort => "Pickup"; public string FriendlyIdentifier => "Pickup Equipment"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Tap"; public bool Invoke(Component BestComponent) { MineDeployerInstance val = ((Il2CppObjectBase)BestComponent).TryCast(); object obj; if (val == null) { obj = null; } else { PlayerAgent owner = ((Item)val).Owner; obj = ((owner != null) ? ((Component)owner).GetComponent() : null); } PlayerAIBot val2 = (PlayerAIBot)obj; if ((Object)(object)val2 == (Object)null) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PICKUPYOURDEPLOYABLES); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Pick up your deployables.", 1f); zBotActions.SendBotToPickUpMine(val2, val, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Picking up mine.", FriendlyIdentifier + IPressAction.chatPermSuffix, val2.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_004c: 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) MineDeployerInstance val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } object obj; if (val == null) { obj = null; } else { PlayerAgent owner = ((Item)val).Owner; obj = ((owner != null) ? ((Component)owner).GetComponent() : null); } PlayerAIBot val2 = (PlayerAIBot)obj; if ((Object)(object)val2 == (Object)null) { return false; } if (!((Agent)val2.Agent).Alive) { return false; } if (!zHelpers.CanBotReach(val2, ((Component)val).transform.position)) { return false; } Color = val2.Agent.Owner.PlayerColor; return true; } } public class pActionPickupSentry : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Pickup Sentry"; public string _FriendlyNameShort => "Pickup"; public string FriendlyIdentifier => "Pickup Equipment"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Tap"; public bool Invoke(Component BestComponent) { SentryGunInstance obj = ((Il2CppObjectBase)BestComponent).TryCast(); object obj2; if (obj == null) { obj2 = null; } else { PlayerAgent owner = ((Item)obj).Owner; obj2 = ((owner != null) ? ((Component)owner).GetComponent() : null); } PlayerAIBot val = (PlayerAIBot)obj2; if ((Object)(object)val == (Object)null) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PICKUPYOURDEPLOYABLES); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Pick up your deployables.", 1f); zBotActions.SendBotToPickUpSentry(val, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Picking up my sentry.", FriendlyIdentifier + IPressAction.chatPermSuffix, val.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_004c: 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) SentryGunInstance val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } object obj; if (val == null) { obj = null; } else { PlayerAgent owner = ((Item)val).Owner; obj = ((owner != null) ? ((Component)owner).GetComponent() : null); } PlayerAIBot val2 = (PlayerAIBot)obj; if ((Object)(object)val2 == (Object)null) { return false; } if (!((Agent)val2.Agent).Alive) { return false; } if (!zHelpers.CanBotReach(val2, ((Component)val).transform.position)) { return false; } Color = val2.Agent.Owner.PlayerColor; return true; } } public class pActionSelect : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Select Bot"; public string _FriendlyNameShort => "Select"; public string FriendlyIdentifier => "Select"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Tap"; public bool Invoke(Component BestComponent) { PlayerAIBot val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } zSmartSelect.MainSelection.Select((Component)(object)val); PlayerAgent agent = val.Agent; string playerName = agent.PlayerName; int characterID = agent.CharacterID; uint voiceId = zSmartSelect.GetVoiceId(agent); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, voiceId); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Hey " + playerName + "!", 1f); ZiMain.BotBarkBack(characterID, EVENTS.PLAY_CL_YES, "Yes?"); zChatHandler.sendChatMessage("I'm ready.", FriendlyIdentifier + IPressAction.chatPermSuffix, agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //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) PlayerAIBot val = ((Il2CppObjectBase)candidate).Cast(); if ((Object)(object)val == (Object)null) { return false; } if (zSmartSelect.MainSelection.Selected(val)) { return false; } Color = val.Agent.Owner.PlayerColor; return true; } } public class pActionUnlock : IPressAction { public static bool strike = false; public static bool travel = true; public string FriendlyName => "Break Lock"; public string FriendlyNameShort => "Unlock"; public string FriendlyIdentifier => "Interact"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Tap"; public bool Invoke(Component BestComponent) { LG_WeakLock val = ((Il2CppObjectBase)BestComponent).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PLEASE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Please.", 1f); zBotActions.SendbotToBreakLock(bestBot, val, (MethodEnum)3, zStaticRefrences.LocalPlayer, 0uL); zChatHandler.sendChatMessage("Unlocking.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { //IL_00ba: 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_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) LG_WeakLock val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if ((Object)(object)val == (Object)null) { return false; } iLG_WeakLockHolder holder = val.m_holder; LG_DoorButton val2 = ((Il2CppObjectBase)holder).TryCast(); ((Il2CppObjectBase)holder).TryCast(); if ((Object)(object)val2 != (Object)null) { LG_WeakDoor val3 = ((Il2CppObjectBase)val2.m_door).TryCast(); if ((Object)(object)val3 != (Object)null && !val3.Gate.IsTraversable && Vector3.Dot(((Component)val).transform.forward, zStaticRefrences.CameraTransform.position - ((Component)val).transform.position) <= 0f) { return false; } } if (!zHelpers.CanBotReach(bestBot, ((Component)val).transform.position)) { return false; } return true; } } public class pActionSelectAll : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Select All"; public string _FriendlyNameShort => "Select-A"; public string FriendlyIdentifier => "Select"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => null; public string pressTypeIdentifier => "Tap and Hold"; public bool Invoke(Component BestComponent) { return true; } public bool IsActionValid(Component candidate) { return false; } } } namespace BotControl.SmartSelect.PressActions.DoubleTapActions { public class pActionAttackCountdown : IPressAction { public string FriendlyName => "Attack Countdown"; public string FriendlyNameShort => "Countdown"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Double Tap"; public string FriendlyIdentifier => "Attack"; public bool Enabled => false; public bool Invoke(Component BestComponent) { ((Il2CppObjectBase)BestComponent).TryCast(); return false; } public bool IsActionValid(Component candidate) { return false; } } public class pActionDeployMine : IPressAction { public string FriendlyName => "Deploy Mine"; public string FriendlyNameShort => "Mine"; public string FriendlyIdentifier => "Deploy Equipmenet"; public Type Type => null; public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //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_0046: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } Pose minePose = default(Pose); ((Pose)(ref minePose))..ctor(zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos, Quaternion.LookRotation(-zStaticRefrences.LocalPlayer.FPSCamera.CameraRayNormal)); zBotActions.SendBotToPlaceMine(bestBot, minePose, (InventorySlot)3, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PUTATRIPMINEHERE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Put a mine here.", 1f); ZiMain.BotBarkBack(bestBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do.", 2f); zChatHandler.sendChatMessage("Deploying trip mine.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool IsActionValid(Component candidate) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!Evaluate(bestBot)) { return false; } if (!IsMineValid(bestBot)) { return false; } return true; } private bool Evaluate(PlayerAIBot bot) { PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(bot.Agent.Owner); if (backpack == null) { return false; } if (backpack.AmmoStorage.ConsumableAmmo.BulletsInPack > 0) { BackpackItem val = ((Il2CppArrayBase)(object)backpack.Slots)[5]; if (val != null && (Object)(object)val.Instance != (Object)null && val.ItemID == 139 && (Object)/*isinst with value type is only supported in some contexts*/ != (Object)null) { return true; } } if (backpack.AmmoStorage.ClassAmmo.BulletsInPack > 0) { BackpackItem val2 = ((Il2CppArrayBase)(object)backpack.Slots)[3]; if (val2 != null && (Object)(object)val2.Instance != (Object)null && val2.ItemID == 37 && zHelpers.IsOfType((Il2CppObjectBase)(object)val2.Instance)) { return true; } } return false; } private bool IsMineValid(PlayerAIBot BestBot) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007d: 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_0080: 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_0096: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00cf: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 //IL_0109: 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_011a: Unknown result type (might be due to invalid IL or missing references) PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(BestBot.Agent.Owner); if (backpack == null) { return false; } if (backpack.AmmoStorage.ClassAmmo.BulletsInPack <= 0) { return false; } BackpackItem agentBackpackItem = zHelpers.GetAgentBackpackItem(BestBot.Agent, (InventorySlot)3); if (agentBackpackItem == null) { return false; } if (agentBackpackItem.Instance.ArchetypeName != "Mine deployer") { return false; } Transform cameraTransform = zStaticRefrences.CameraTransform; if ((Object)(object)BestBot == (Object)null || (Object)(object)cameraTransform == (Object)null) { return false; } Vector3 position = cameraTransform.position; Vector3 forward = cameraTransform.forward; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(position, forward, ref val, (float)LayerManager.MASK_TRIPMINE_CAMERARAY)) { return false; } if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, LayerManager.MASK_TRIPMINE_PLACEMENT_BLOCKERS)) { return false; } NavMeshHit val2 = default(NavMeshHit); if (!NavMesh.SamplePosition(((RaycastHit)(ref val)).point, ref val2, 3f, 17)) { return false; } NavMeshPath val3 = new NavMeshPath(); if (!NavMesh.CalculatePath(((Agent)BestBot.Agent).GoodPosition, ((NavMeshHit)(ref val2)).position, 17, val3)) { return false; } if ((int)val3.status == 2) { return false; } Vector3 val4 = ((Il2CppArrayBase)(object)val3.corners)[((Il2CppArrayBase)(object)val3.corners).Length - 1] - ((NavMeshHit)(ref val2)).position; if (!(((Vector3)(ref val4)).sqrMagnitude < PlayerBotActionDeployTripMine.s_ApproachRadius * PlayerBotActionDeployTripMine.s_ApproachRadius * PlayerBotActionDeployTripMine.s_VerifyRadiusMul * PlayerBotActionDeployTripMine.s_VerifyRadiusMul)) { return false; } return true; } } public class pActionDeploySentry : IPressAction { public string FriendlyName => "Deploy Sentry"; public string FriendlyNameShort => "Sentry"; public string FriendlyIdentifier => "Deploy Equipmenet"; public Type Type => null; public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_004a: 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_005a: 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_0077: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if (!zHelpers.TryGetAgentBackpackItem(bestBot.Agent, (InventorySlot)3, out BackpackItem backpackItem)) { return false; } bool num = backpackItem.Instance.ArchetypeName == "Sentry Gun"; bool flag = (int)backpackItem.Status == 1; if (!num || flag) { return false; } Vector3 position = zStaticRefrences.CameraTransform.position; Vector3 forward = zStaticRefrences.CameraTransform.forward; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(position, forward, ref val, 100f, LayerManager.MASK_SENTRYGUN_CAMERARAY_MOVERHELPER)) { return false; } Vector3 point = ((RaycastHit)(ref val)).point; Quaternion val2 = Quaternion.LookRotation(FlatForward(zStaticRefrences.CameraTransform)); Pose pose = default(Pose); ((Pose)(ref pose))..ctor(point, val2); if (!CanPlaceTurret(ref pose)) { return false; } zBotActions.SendBotToPlaceSentry(bestBot, pose, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PUTASENTRYGUNHERE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Put a sentry here.", 1f); ZiMain.BotBarkBack(bestBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do.", 2f); zChatHandler.sendChatMessage("Placing sentry.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool CanPlaceTurret(ref Pose pose) { //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_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_001b: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b3: 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_00bc: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_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) //IL_010e: 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_0075: 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) pose.position += Vector3.up * 0.3f; RaycastHit val = default(RaycastHit); if (Physics.Raycast(pose.position, Vector3.down, ref val, 3f, LayerManager.MASK_SENTRYGUN_CAMERARAY_MOVERHELPER)) { float num = Vector3.Dot(((RaycastHit)(ref val)).normal, Vector3.up); if (num > 0.9f) { pose.position = ((RaycastHit)(ref val)).point; } else { RaycastHit val2 = default(RaycastHit); if (!(num > 0.7f) || !Physics.Raycast(pose.position, Vector3.down, ref val2, 3f, LayerManager.MASK_SENTRYGUN_CAMERARAY)) { return false; } pose.position = ((RaycastHit)(ref val2)).point; } } Bounds val3 = default(Bounds); for (int i = 0; i < zStaticRefrences.SentryRaycastCorners.Length; i++) { Vector3 localPosition = zStaticRefrences.SentryRaycastCorners[i].localPosition; ((Bounds)(ref val3)).Encapsulate(localPosition); } Vector3 val4 = ((Bounds)(ref val3)).size * 0.5f; pose.position += Vector3.up * 0.1f; return Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapBox(pose.position, val4, pose.rotation, LayerManager.MASK_SENTRYGUN_CAMERARAY_MOVERHELPER)).Length == 0; } public Vector3 FlatForward(Transform transform) { //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_0021: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { return Vector3.forward; } return ((Vector3)(ref forward)).normalized; } public bool IsActionValid(Component candidate) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!Evaluate(bestBot.Agent)) { return false; } if (!IsSentryValid(bestBot)) { return false; } return true; } public bool Evaluate(PlayerAgent ownerAgent) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(ownerAgent.Owner); if (backpack != null) { BackpackItem val = ((Il2CppArrayBase)(object)backpack.Slots)[3]; if (val != null && (Object)(object)val.Instance != (Object)null && val.ItemID == 97) { _ = val.Status; _ = 1; return true; } } return false; } private bool IsSentryValid(PlayerAIBot BestBot) { //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_0055: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0097: 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) if (Il2CppArrayBase.op_Implicit(BestBot.GetDeployedItems().ToArray()).Length != 0) { return false; } if (!zHelpers.TryGetAgentBackpackItem(BestBot.Agent, (InventorySlot)3, out BackpackItem backpackItem)) { return false; } if (backpackItem.Instance.ArchetypeName != "Sentry Gun") { return false; } Vector3 position = zStaticRefrences.CameraTransform.position; Vector3 forward = zStaticRefrences.CameraTransform.forward; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(position, forward, ref val, 100f, LayerManager.MASK_SENTRYGUN_CAMERARAY_MOVERHELPER)) { return false; } Vector3 point = ((RaycastHit)(ref val)).point; if (!zHelpers.CanBotReach(BestBot, point)) { return false; } Quaternion val2 = Quaternion.LookRotation(FlatForward(zStaticRefrences.CameraTransform)); Pose pose = default(Pose); ((Pose)(ref pose))..ctor(point, val2); if (!CanPlaceTurret(ref pose)) { return false; } return true; } } public class pActionDestroyDoor : IPressAction { public string FriendlyName => "Destroy Door"; public string FriendlyIdentifier => "Destroy Door"; public string FriendlyNameShort => "Destroy"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Double Tap"; public bool Enabled => false; public bool Invoke(Component BestComponent) { ((Il2CppObjectBase)BestComponent).TryCast(); return false; } public bool IsActionValid(Component candidate) { return false; } } public class pActionFollowDirect : IPressAction { private string _FriendlyNameShort = "Follow"; private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Follow me"; public string FriendlyIdentifier => "Follow"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { PlayerAgent val = ((!((Object)(object)BestComponent != (Object)null)) ? zSmartSelect.GetPlayerAgentLookingAt() : ((Il2CppObjectBase)BestComponent).TryCast()); if ((Object)(object)val == (Object)null) { return false; } MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)zUpdater.Instance, CallAgentToFollow(val)); return true; } public static void StaticCallAgentToFollow(PlayerAgent Follower, PlayerAgent Followee = null, bool voicelines = true) { MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)zUpdater.Instance, CallAgentToFollow(Follower, Followee, voicelines)); } public static IEnumerator CallAgentToFollow(PlayerAgent Follower, PlayerAgent Leader = null, bool voicelines = true) { if ((Object)(object)Leader == (Object)null) { Leader = zStaticRefrences.LocalPlayer; } uint voiceId = zSmartSelect.GetVoiceId(Follower); if (Follower.Owner.IsBot) { PlayerAIBot Bot = ((Follower != null) ? ((Component)Follower).GetComponent() : null); string playerName = Bot.Agent.PlayerName; string value = Leader.PlayerName; if ((Object)(object)Leader == (Object)(object)zStaticRefrences.LocalPlayer) { value = "me"; } if (voicelines) { zStaticRefrences.Subtitles.ShowSingleLineSubtitle($"Hey {playerName}, Follow {value}!", 2f); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, voiceId); yield return (object)new WaitForSeconds(1f); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_FOLLOWME); } zBotActions.SetLeader(Follower, Leader, zStaticRefrences.LocalPlayer, 0uL); ZiMain.BotBarkBack(Bot.Agent.CharacterID, EVENTS.PLAY_CL_ILLFOLLOWYOURLEAD, "I will follow your lead.", 2f); zChatHandler.sendChatMessage("On the way to " + Leader.PlayerName + ".", "Follow" + IPressAction.chatPermSuffix, Bot.Agent, zStaticRefrences.LocalPlayer); } else { PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, voiceId); yield return (object)new WaitForSeconds(1f); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_FOLLOWME); } yield return (object)new WaitForSeconds(1f); Follower.NavMarker.UpdateExtraInfo(); } public bool IsActionValid(Component candidate) { //IL_006f: 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) PlayerAgent val = ((Il2CppObjectBase)candidate).TryCast(); if ((Object)(object)val == (Object)null) { return false; } if (!((Agent)val).Alive) { return false; } if ((Object)(object)val == (Object)(object)zStaticRefrences.LocalPlayer) { return false; } object obj; if (val == null) { obj = null; } else { PlayerAIBot component = ((Component)val).GetComponent(); if (component == null) { obj = null; } else { SyncTable syncValues = component.SyncValues; obj = ((syncValues != null) ? syncValues.Leader : null); } } PlayerAgent val2 = (PlayerAgent)obj; if ((Object)(object)val2 != (Object)null && (Object)(object)val2 == (Object)(object)zStaticRefrences.LocalPlayer) { return false; } Color = val.Owner.PlayerColor; return true; } } public class pActionFollowIndirect : IPressAction { private string _FriendlyNameShort = "Follow"; private Color Color = new Color(1f, 1f, 1f, 0.25f); public string FriendlyName => "Follow me through walls"; public string FriendlyIdentifier => "Follow"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => null; public int? Priority => -15; public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { PlayerAgent val = ((!((Object)(object)BestComponent != (Object)null)) ? zSmartSelect.GetPlayerAgentLookingAt() : ((Il2CppObjectBase)BestComponent).TryCast()); if ((Object)(object)val == (Object)null) { return false; } PressActionManager.GetAction("Follow me").Invoke((Component)(object)val); return true; } public bool IsActionValid(Component candidate) { //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) PlayerAgent playerAgentLookingAt = zSmartSelect.GetPlayerAgentLookingAt(); if ((Object)(object)playerAgentLookingAt == (Object)null) { return false; } if (!((Agent)playerAgentLookingAt).Alive) { return false; } if ((Object)(object)playerAgentLookingAt == (Object)(object)zStaticRefrences.LocalPlayer) { return false; } object obj; if (playerAgentLookingAt == null) { obj = null; } else { PlayerAIBot component = ((Component)playerAgentLookingAt).GetComponent(); if (component == null) { obj = null; } else { SyncTable syncValues = component.SyncValues; obj = ((syncValues != null) ? syncValues.Leader : null); } } PlayerAgent val = (PlayerAgent)obj; if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)zStaticRefrences.LocalPlayer) { return false; } Color = playerAgentLookingAt.Owner.PlayerColor; return true; } } public class pActionPickupAllSentries : IPressAction { private Color Color = new Color(1f, 1f, 1f, 0.25f); public int cycleOffset; public string FriendlyName => "Pickup all Sentries"; public string _FriendlyNameShort => "Pickup-A"; public string FriendlyIdentifier => "Pickup Equipmenet"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { ZiMain.GetBotList(); List botsWithTurretsOut = GetBotsWithTurretsOut(); if (botsWithTurretsOut.Count == 0) { return false; } PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_PICKUPYOURDEPLOYABLES); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Pick up your deployables.", 1f); MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)zUpdater.Instance, BotsPickupTurrets(botsWithTurretsOut)); return true; } public static IEnumerator BotsPickupTurrets(List Bots) { foreach (PlayerAIBot Bot in Bots) { zChatHandler.sendChatMessage("Picking up my sentry.", "Pickup Equipmenet" + IPressAction.chatPermSuffix, Bot.Agent, zStaticRefrences.LocalPlayer); zBotActions.SendBotToPickUpSentry(Bot, zStaticRefrences.LocalPlayer, 0uL); yield return (object)new WaitForSeconds(0.25f); } } public bool IsActionValid(Component candidate) { //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) List botsWithTurretsOut = GetBotsWithTurretsOut(); if (botsWithTurretsOut.Count <= 1) { return false; } cycleOffset++; int num = (cycleOffset - 1) / 1; botsWithTurretsOut.Sort((PlayerAIBot a, PlayerAIBot b) => ((Object)a).GetInstanceID().CompareTo(((Object)b).GetInstanceID())); int index = num % botsWithTurretsOut.Count; Color = botsWithTurretsOut[index].Agent.Owner.PlayerColor; return true; } public List GetBotsWithTurretsOut() { List list = new List(); List botList = ZiMain.GetBotList(); List list2 = new List(); foreach (PlayerAIBot item in botList) { if (Il2CppArrayBase.op_Implicit(item.GetDeployedItems().ToArray()).Length != 0 && zHelpers.TryGetAgentBackpackItem(item.Agent, (InventorySlot)3, out BackpackItem backpackItem) && backpackItem.Instance.ArchetypeName == "Sentry Gun") { list2.Add(item); } } if (list2.Count == 0) { return list; } foreach (PlayerAIBot item2 in list2) { if (((Agent)item2.Agent).Alive) { list.Add(item2); } } return list; } } public class pActionPlaceItem : IPressAction { public string FriendlyName => "Place Item"; public string FriendlyNameShort => "Place"; public string FriendlyIdentifier => "Place Item"; public Type Type => Il2CppType.Of(); public string pressTypeIdentifier => "Double Tap"; public bool Enabled => false; public bool Invoke(Component BestComponent) { ((Il2CppObjectBase)BestComponent).TryCast(); return false; } public bool IsActionValid(Component candidate) { return false; } } public class pActionShootCFoam : IPressAction { public string FriendlyName => "Shoot Cfoam"; public string FriendlyNameShort => "cFoam"; public string FriendlyIdentifier => "Deploy Equipmenet"; public Type Type => null; public string pressTypeIdentifier => "Double Tap"; public bool Invoke(Component BestComponent) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!Evaluate(bestBot.Agent)) { return false; } zBotActions.SendBotToUseCfoamGun(bestBot, zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos, zStaticRefrences.LocalPlayer, 0uL); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_CFOAMHERE); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Put foam here.", 1f); ZiMain.BotBarkBack(bestBot.Agent.CharacterID, EVENTS.PLAY_CL_WILLDO, "Will Do.", 2f); zChatHandler.sendChatMessage("Shooting c-foam.", FriendlyIdentifier + IPressAction.chatPermSuffix, bestBot.Agent, zStaticRefrences.LocalPlayer); return true; } public bool Evaluate(PlayerAgent ownerAgent) { PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(ownerAgent.Owner); if (backpack == null) { return false; } if (backpack.AmmoStorage.ClassAmmo.BulletsInPack > 0) { BackpackItem val = ((Il2CppArrayBase)(object)backpack.Slots)[3]; if (val != null && (Object)(object)val.Instance != (Object)null && val.ItemID == 73) { return true; } } return false; } public bool IsActionValid(Component candidate) { PlayerAIBot bestBot = zSmartSelect.MainSelection.GetBestBot(); if ((Object)(object)bestBot == (Object)null) { return false; } if (!((Agent)bestBot.Agent).Alive) { return false; } if (!Evaluate(bestBot.Agent)) { return false; } return true; } } public class pActionAllFollow : IPressAction { private string _FriendlyNameShort = "A-Follow"; private Color Color = new Color(1f, 1f, 1f, 0.25f); private static List NonFollowingBots = new List(); private int cycleOffset; public string FriendlyName => "All Folow"; public string FriendlyIdentifier => "Follow"; public string FriendlyNameShort => $"{_FriendlyNameShort}"; private string ColorHex => ColorUtility.ToHtmlStringRGB(Color); public Type Type => null; public int? Priority => 20; public string pressTypeIdentifier => "Tap and Hold"; public bool Invoke(Component BestComponent) { List botList = ZiMain.GetBotList(); NonFollowingBots.Clear(); foreach (PlayerAIBot item in botList) { if ((Object)(object)item.SyncValues.Leader != (Object)(object)zStaticRefrences.LocalPlayer) { NonFollowingBots.Add(item); } } if (NonFollowingBots.Count == 0) { return false; } MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)zUpdater.Instance, AllBotsFollow()); PlayerVoiceManager.WantToSay(zStaticRefrences.LocalPlayer.CharacterID, EVENTS.PLAY_CL_FOLLOWME); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Follow me!", 1f); return true; } public static IEnumerator AllBotsFollow() { List list = new List(NonFollowingBots); foreach (PlayerAIBot item in list) { pActionFollowDirect.StaticCallAgentToFollow(item.Agent, zStaticRefrences.LocalPlayer, voicelines: false); yield return (object)new WaitForSeconds(1f); } } public bool IsActionValid(Component candidate) { //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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (!(Vector3.Angle(zStaticRefrences.CameraTransform.forward, Vector3.down) < 15f)) { return false; } List botList = ZiMain.GetBotList(); NonFollowingBots.Clear(); foreach (PlayerAIBot item in botList) { if ((Object)(object)item.SyncValues.Leader != (Object)(object)zStaticRefrences.LocalPlayer) { NonFollowingBots.Add(item); } } if (NonFollowingBots.Count == 0) { return false; } cycleOffset++; int num = (cycleOffset - 1) / 1; NonFollowingBots.Sort((PlayerAIBot a, PlayerAIBot b) => ((Object)a).GetInstanceID().CompareTo(((Object)b).GetInstanceID())); int index = num % NonFollowingBots.Count; Color = NonFollowingBots[index].Agent.Owner.PlayerColor; return true; } } } namespace BotControl.Patches { [HarmonyPatch] public class AttackActionPatch { private static Descriptor originalBestAction; public static List meansList = (from x in Enum.GetValues() where (int)x != 0 && (x & (x - 1)) == 0 select x).ToList(); [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionAttack")] [HarmonyPrefix] [HarmonyPriority(0)] public static void PreUpdateActionAttack(RootPlayerBotAction __instance, ref Descriptor bestAction) { originalBestAction = bestAction; } [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionAttack")] [HarmonyPostfix] [HarmonyPriority(0)] public unsafe static void PostUpdateActionAttack(RootPlayerBotAction __instance, ref Descriptor bestAction) { //IL_004e: 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_0095: 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) //IL_0099: 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_00ba: 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 (bestAction == null || ((Il2CppObjectBase)bestAction).TryCast() == null) { return; } bool value = zSlideComputer.ActionPermissions.ValueAt("attackMeansMelee").Value; bool value2 = zSlideComputer.ActionPermissions.ValueAt("attackMeansBullet").Value; if (!value && !value2) { bestAction = originalBestAction; return; } AttackMeansEnum val = (AttackMeansEnum)0; foreach (AttackMeansEnum means in meansList) { string key = "attackMeans" + ((object)(*(AttackMeansEnum*)(&means))/*cast due to .constrained prefix*/).ToString(); if (zSlideComputer.ActionPermissions.ValueAt(key).Value) { val |= means; } } if (val != __instance.m_attackAction.Means) { __instance.m_attackAction.Means = val; zSlideComputer.RemoveActionsOfType(((PlayerBotActionBase)__instance).m_agent, typeof(PlayerBotActionAttack)); } } } [HarmonyPatch] internal class CarryExpeditionItemPatch { [HarmonyPatch(typeof(PlayerBotActionCarryExpeditionItem), "GetHoldActionPrio")] [HarmonyPostfix] private static void PostGetHoldActionPrio(PlayerBotActionCarryExpeditionItem __instance, ref float __result, ref bool isHighPrio) { PlayerAgent leader = ((PlayerBotActionBase)__instance).m_bot.SyncValues.Leader; PlayerAgent agent = ((PlayerBotActionBase)__instance).m_bot.Agent; if (!(((Dam_SyncedDamageBase)agent.Damage).Health <= 0f) && (Object)(object)leader == (Object)(object)agent && __result <= 0f) { __result = 0.1f; isHighPrio = true; } } } [HarmonyPatch] internal class CollectItemPatch { [HarmonyPatch(typeof(PlayerBotActionCollectItem), "MoveOut")] [HarmonyPostfix] public static void PostMoveOut(PlayerBotActionCollectItem __instance) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Descriptor travelAction = __instance.m_travelAction; if (travelAction != null) { Vector3 destinationPos = travelAction.DestinationPos; ((PlayerBotActionBase)__instance).SnapPositionToNav(travelAction.DestinationPos, ref destinationPos); travelAction.DestinationPos = destinationPos; travelAction.Radius = 1.5f; } } } [HarmonyPatch] public class FollowActionPatch { public static void Setup() { } [HarmonyPatch(typeof(RootPlayerBotAction), "Update")] [HarmonyPrefix] public static bool PreUpdate(RootPlayerBotAction __instance, ref bool __result) { //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) ((Descriptor)__instance.m_followLeaderAction).Prio = zSlideComputer.ActionPriorities.ValueAt(((object)DramaManager.CurrentStateEnum/*cast due to .constrained prefix*/).ToString()).Value; RootPlayerBotAction.m_prioSettings.FollowLeaderRadius = FollowMenuClass.followRadius.GetValue().Value; RootPlayerBotAction.s_followLeaderRadius = FollowMenuClass.followRadius.GetValue().Value; RootPlayerBotAction.s_followLeaderMaxDistance = FollowMenuClass.maxDistance.GetValue().Value; return true; } [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionFollowPlayer")] [HarmonyPrefix] [HarmonyPriority(0)] public unsafe static bool UpdateActionFollowPlayerPrePatch(RootPlayerBotAction __instance, ref Descriptor bestAction) { //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) DRAMA_State currentStateEnum = DramaManager.CurrentStateEnum; if (zSlideComputer.ActionPermissions.ValueAt(((object)(*(DRAMA_State*)(¤tStateEnum))/*cast due to .constrained prefix*/).ToString()).Value) { return true; } zSlideComputer.RemoveActionsOfType(typeof(PlayerBotActionFollow)); return false; } } [HarmonyPatch] public class HighlightActionPatch { private static Descriptor originalBestAction; [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionHighlight")] [HarmonyPrefix] public static void PreUpdateActionHighlight(RootPlayerBotAction __instance, ref Descriptor bestAction) { originalBestAction = bestAction; } [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionHighlight")] [HarmonyPostfix] public static void PostUpdateActionHighlight(RootPlayerBotAction __instance, ref Descriptor bestAction) { //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) if (bestAction != null && ((Il2CppObjectBase)bestAction).TryCast() != null) { string key = ((object)__instance.m_highlightAction.TargetType/*cast due to .constrained prefix*/).ToString(); if (!zSlideComputer.ActionPermissions.ValueAt(key).Value) { bestAction = originalBestAction; } } } } [HarmonyPatch] internal class PickupActionPatch { private static Il2CppReferenceArray _rawConsumableItems; private static Il2CppReferenceArray _consumableItems; private static List _consumableItemPublicNames; private static List _consumableItemNames; private static List _fullItemList; private static Il2CppReferenceArray _lastConsumables; private static Il2CppReferenceArray _lastResourcePacks; private static List _fullItemNameList; private static List _fullItemPublicNameList; public static bool useGetItemPrio = true; public static bool useUpdateActionCollectItem = true; private static bool hasSetup = false; public static List fullGlowStickNames = new List { "CONSUMABLE_GlowStick", "CONSUMABLE_GlowStick_Christmas", "CONSUMABLE_GlowStick_Halloween", "CONSUMABLE_GlowStick_Yellow" }; public static List shortGlowStickNames = new List { "Glow Stick", "Red Glow Stick", "Glow Stick Orange", "Glow Stick Yellow" }; public static List unusedItems = new List { "CONSUMABLE_Flare", "CONSUMABLE_Grenade", "CONSUMABLE_Portable_Barrier", "CONSUMABLE_ShapedMine_Explosive" }; public static Il2CppReferenceArray rawConsumableItems => ((Il2CppArrayBase>)(object)ItemSpawnManager.m_itemDataPerInventorySlot)?[5]; public static Il2CppReferenceArray consumableItems { get { Il2CppReferenceArray val = rawConsumableItems; if (val == _rawConsumableItems) { return _consumableItems; } _rawConsumableItems = val; _consumableItems = new Il2CppReferenceArray(((IEnumerable)val).Where((ItemDataBlock item) => item != null && !unusedItems.Contains(((GameDataBlockBase)(object)item).name)).ToArray()); return _consumableItems; } } public static List consumableItemPublicNames { get { Il2CppReferenceArray val = consumableItems; if (val == _consumableItems && _consumableItemPublicNames != null) { return _consumableItemPublicNames; } _consumableItemPublicNames = ((IEnumerable)val).Select((ItemDataBlock item) => item.publicName).ToList(); return _consumableItemPublicNames; } } public static List consumableItemNames { get { Il2CppReferenceArray val = consumableItems; if (val == _consumableItems && _consumableItemNames != null) { return _consumableItemNames; } _consumableItemNames = ((IEnumerable)val).Select((ItemDataBlock item) => ((GameDataBlockBase)(object)item).name).ToList(); return _consumableItemNames; } } public static List fullItemList { get { Il2CppReferenceArray val = consumableItems; Il2CppReferenceArray resourcePackItems = ShareActionPatch.resourcePackItems; if (val == _lastConsumables && resourcePackItems == _lastResourcePacks && _fullItemList != null) { return _fullItemList; } _lastConsumables = val; _lastResourcePacks = resourcePackItems; _fullItemList = ((IEnumerable)val).Concat((IEnumerable)resourcePackItems).ToList(); return _fullItemList; } } public static List fullItemNameList { get { List source = fullItemList; if (_fullItemNameList != null) { return _fullItemNameList; } _fullItemNameList = source.Select((ItemDataBlock x) => ((GameDataBlockBase)(object)x).name).ToList(); return _fullItemNameList; } } public static List fullItemPublicNameList { get { List source = fullItemList; if (_fullItemPublicNameList != null) { return _fullItemPublicNameList; } _fullItemPublicNameList = source.Select((ItemDataBlock x) => x.publicName).ToList(); return _fullItemPublicNameList; } } internal static void SetUp() { } [HarmonyPatch(typeof(RootPlayerBotAction), "GetItemPrio")] [HarmonyPrefix] public static bool GetItemPrio(RootPlayerBotAction __instance, InventorySlot itemSlot, uint itemID, ref float __result) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_014e: 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_0176: Invalid comparison between Unknown and I4 //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Invalid comparison between Unknown and I4 if (!useGetItemPrio) { return true; } __result = 0f; string blockName = GameDataBlockBase.GetBlockName(itemID); string key = "Pickup" + blockName; if (zSlideComputer.ActionPermissions.HasKey(key) && !zSlideComputer.ActionPermissions.ValueAt(key).Value) { return false; } if (zSlideComputer.ActionPriorities.HasKey(key) && (int)zSlideComputer.ActionPriorities.ValueAt(key).Value == 0) { return false; } bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val3; if (GameDataBlockBase.s_blockByID.ContainsKey(itemID)) { _ = GameDataBlockBase.s_blockByID[itemID]; __result = 0f; float num = zSlideComputer.ActionPriorities.ValueAt(key).Value; List playerAgentsInLevel = PlayerManager.PlayerAgentsInLevel; float num2 = 0f; float num3 = 0f; float num4 = 0.15f; int num5 = 0; int num6 = 0; Enumerator enumerator = playerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (current.CharacterID == ((PlayerBotActionBase)__instance).m_agent.CharacterID) { num5++; continue; } num6++; PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(current.Owner); BackpackItem val = null; if ((backpack != null && !backpack.TryGetBackpackItem(itemSlot, itemID, ref val)) || val == null) { continue; } float num7 = 1f; float num8 = 0f; InventorySlotAmmo val2 = null; if ((int)itemSlot != 4) { if ((int)itemSlot == 5) { object obj; if (backpack == null) { obj = null; } else { PlayerAmmoStorage ammoStorage = backpack.AmmoStorage; obj = ((ammoStorage != null) ? ammoStorage.ConsumableAmmo : null); } val2 = (InventorySlotAmmo)obj; num4 = 0.25f; } } else { object obj2; if (backpack == null) { obj2 = null; } else { PlayerAmmoStorage ammoStorage2 = backpack.AmmoStorage; obj2 = ((ammoStorage2 != null) ? ammoStorage2.ResourcePackAmmo : null); } val2 = (InventorySlotAmmo)obj2; num4 = 0.5f; } if (val2 != null) { num7 = val2.AmmoMaxCap; num8 = val2.AmmoInPack; } else { num7 = 1f; num8 = 1f; } num2 = Math.Max(num7, num2); num3 += num8; } if (num5 == 0) { Object agent = (Object)(object)((PlayerBotActionBase)__instance).m_agent; bool flag = agent != null && Object.op_Implicit(agent); ManualLogSource log = ZiMain.log; val3 = new BepInExErrorLogInterpolatedStringHandler(60, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Could not find this agent! This will probably cause issues. "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(flag); } log.LogError(val3); } float num9 = -1f; float num10 = -1f; float num11 = -1f; if (num2 > 0f && num6 > 0) { num9 = (float)playerAgentsInLevel.Count * num2; num10 = num3 / num9; num11 = num * num4; __result = Mathf.Lerp(num, num11, num10); } else { __result = num; } return false; } ManualLogSource log2 = ZiMain.log; val3 = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Tried to get priority for unknow id: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(itemID); } log2.LogError(val3); return false; } [HarmonyPatch(typeof(PlayerBotActionCollectItem), "OnTravelActionEvent")] [HarmonyPrefix] public static bool OnTravelActionEventPatch(PlayerBotActionCollectItem __instance, Descriptor descBase) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 if (((Il2CppObjectBase)descBase).Pointer != ((Il2CppObjectBase)__instance.m_travelAction).Pointer) { ((PlayerBotActionBase)__instance).PrintError("Rogue action."); } if (descBase.IsTerminated()) { __instance.m_travelAction = null; if ((int)descBase.Status == 3) { __instance.StartTransfer(); return false; } if (__instance.VerifyCurrentPosition()) { ZiMain.log.LogWarning((object)"VerifyCurrentPosition - travel event failed, but within range anyway!"); __instance.StartTransfer(); return false; } ZiMain.log.LogWarning((object)"VerifyCurrentPosition - travel event failed"); ((Descriptor)__instance.m_desc).SetCompletionStatus((StatusType)4); } return false; } [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionCollectItem")] [HarmonyPrefix] [HarmonyPriority(0)] public static bool UpdateActionCollectItemReCreation(RootPlayerBotAction __instance, ref Descriptor bestAction) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_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_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0364: 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_037d: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) if (!useUpdateActionCollectItem) { return true; } Descriptor collectItemAction = __instance.m_collectItemAction; Item val = null; float num = 0f; AIG_CourseNode val2 = null; Vector3 zero = Vector3.zero; if (collectItemAction != null) { if (!((Descriptor)collectItemAction).IsTerminated()) { return false; } ((Descriptor)collectItemAction).Prio = zSlideComputer.ActionPriorities.ValueAt("Pickup").Value; } if (bestAction != null) { if (collectItemAction == null) { return false; } if (((Descriptor)collectItemAction).Prio <= bestAction.Prio) { return false; } } PlayerBackpack backpack = ((PlayerBotActionBase)__instance).m_backpack; if (backpack != null && backpack.HasBackpackItem((InventorySlot)8)) { return false; } if ((Object)(object)((PlayerBotActionBase)__instance).m_bot != (Object)null && ((PlayerBotActionBase)__instance).m_bot.IsActionForbidden((Descriptor)(object)collectItemAction)) { return false; } if (!__instance.GetActivityEpicenter(ref val2, ref zero)) { return false; } zero = ((Component)((PlayerBotActionBase)__instance).m_bot).transform.position; val2 = ((Agent)((PlayerBotActionBase)__instance).m_bot.Agent).CourseNode; if ((Object)(object)((PlayerBotActionBase)__instance).m_agent != (Object)null && RootPlayerBotAction.s_tempObjReservation != null) { ((AIReservation)RootPlayerBotAction.s_tempObjReservation).CharacterID = ((PlayerBotActionBase)__instance).m_agent.CharacterID; } if (collectItemAction != null && RootPlayerBotAction.s_tempObjReservation != null) { ((AIReservation)RootPlayerBotAction.s_tempObjReservation).Prio = ((Descriptor)collectItemAction).Prio; } if ((Object)(object)((PlayerBotActionBase)__instance).m_agent != (Object)null && RootPlayerBotAction.s_tempPosReservation != null) { ((AIReservation)RootPlayerBotAction.s_tempPosReservation).CharacterID = ((PlayerBotActionBase)__instance).m_agent.CharacterID; } if (collectItemAction != null && RootPlayerBotAction.s_tempPosReservation != null) { ((AIReservation)RootPlayerBotAction.s_tempPosReservation).Prio = ((Descriptor)collectItemAction).Prio; } LG_ResourceContainer_Storage targetContainer = null; Vector3 targetPosition = Vector3.zero; float num2 = PickupMenuClass.pickupDistance.ValueAt("Pickup").Value; float s_collectItemStandDistance = RootPlayerBotAction.s_collectItemStandDistance; float num3 = num2 * num2; if (val2 != null) { MetaDataBlock metaData = val2.MetaData; if (((metaData != null) ? metaData.StorageContainers : null) != null) { Enumerator enumerator = val2.MetaData.StorageContainers.GetEnumerator(); Vector3 testPosition = default(Vector3); Vector3 val7 = default(Vector3); SeverityEnum val8 = default(SeverityEnum); BackpackItem val9 = default(BackpackItem); while (enumerator.MoveNext()) { LG_ResourceContainer_Storage current = enumerator.Current; if ((Object)(object)current == (Object)null) { continue; } GameObject gameObject = ((Component)current).gameObject; if ((Object)(object)gameObject == (Object)null) { continue; } LG_WeakResourceContainer val3 = ((Il2CppObjectBase)current.m_core).Cast(); if ((Object)(object)val3 == (Object)null || !val3.ISOpen || RootPlayerBotAction.s_tempObjReservation == null) { continue; } RootPlayerBotAction.s_tempObjReservation.Object = gameObject; if ((Object)(object)PlayerManager.Current == (Object)null || PlayerManager.Current.IsObjectReserved(RootPlayerBotAction.s_tempObjReservation) || collectItemAction == null) { continue; } collectItemAction.TargetContainer = current; if ((Object)(object)((PlayerBotActionBase)__instance).m_bot == (Object)null || !((PlayerBotActionBase)__instance).m_bot.TestFailureRetry((Descriptor)(object)collectItemAction)) { continue; } Transform transform = gameObject.transform; if ((Object)(object)transform == (Object)null) { continue; } Vector3 position = transform.position; Vector3 val4 = position - zero; if (((Vector3)(ref val4)).sqrMagnitude >= num3 || ((PlayerBotActionBase)__instance).IsAnyHumanPlayerNear(position, 4f)) { continue; } Vector3 position2 = transform.position; Vector3 val5 = transform.up * s_collectItemStandDistance; Vector3 val6 = position2 - val5; if (!((PlayerBotActionBase)__instance).SnapPositionToNav(val6, ref testPosition) || RootPlayerBotAction.s_tempPosReservation == null) { continue; } RootPlayerBotAction.s_tempPosReservation.Position = testPosition; if ((Object)(object)PlayerManager.Current == (Object)null || PlayerManager.Current.IsPositionReserved(RootPlayerBotAction.s_tempPosReservation) || (Object)(object)((PlayerBotActionBase)__instance).m_bot == (Object)null) { continue; } float restrictionPrio = ((Descriptor)collectItemAction).Prio; if (PreApplyRestrictionsToRootPosition(((PlayerBotActionBase)__instance).m_bot, ref testPosition, ref restrictionPrio)) { continue; } ((Vector3)(ref val7))..ctor(testPosition.x, testPosition.y, testPosition.z); if (!((PlayerBotActionBase)__instance).m_bot.TestDangerZones(val7, (SeverityEnum)3, ref val8) || current.PickupInteractions.Count == 0) { continue; } Enumerator enumerator2 = current.PickupInteractions.GetEnumerator(); while (enumerator2.MoveNext()) { Interact_Base current2 = enumerator2.Current; if ((Object)(object)current2 == (Object)null || !current2.IsActive) { continue; } Item componentInParent = ((Component)current2).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || componentInParent.ItemDataBlock == null) { continue; } uint itemID_gearCRC = componentInParent.pItemData.itemID_gearCRC; if (!PlayerAIBot.KnowsHowToUseItem(itemID_gearCRC)) { continue; } ItemDataBlock itemDataBlock = componentInParent.ItemDataBlock; if (itemDataBlock == null) { continue; } float itemPrio = __instance.GetItemPrio(itemDataBlock.inventorySlot, itemID_gearCRC); if (itemPrio <= num) { continue; } if (((PlayerBotActionBase)__instance).m_backpack != null && ((PlayerBotActionBase)__instance).m_backpack.TryGetBackpackItem(itemDataBlock.inventorySlot, ref val9)) { string name = ((GameDataBlockBase)(object)GameDataBlockBase.GetBlock(val9.ItemID)).name; string key = "Drop" + name; if (!zSlideComputer.ActionPermissions.ValueAt(key).Value) { continue; } float itemPrio2 = __instance.GetItemPrio(itemDataBlock.inventorySlot, val9.ItemID); if (itemPrio <= itemPrio2) { continue; } } val = componentInParent; num = itemPrio; targetContainer = current; targetPosition = testPosition; } if ((Object)(object)val != (Object)null) { collectItemAction.TargetItem = val; collectItemAction.TargetContainer = targetContainer; collectItemAction.TargetPosition = targetPosition; collectItemAction.Haste = 0.5f; bestAction = (Descriptor)(object)collectItemAction; return false; } } } } return false; } public static bool PreApplyRestrictionsToRootPosition(PlayerAIBot __instance, ref Vector3 testPosition, ref float restrictionPrio) { //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_0027: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) float resultPrio = restrictionPrio; Vector3 resultPos = testPosition; Vector3 tmpPos; for (int i = 0; i < __instance.m_queuedActions.Count; i++) { func(__instance.m_queuedActions[i], testPosition); } for (int j = 0; j < __instance.m_actions.Count; j++) { func(__instance.m_actions[j].DescBase, testPosition); } if (resultPrio > restrictionPrio) { restrictionPrio = resultPrio; testPosition = resultPos; return true; } return false; void func(Descriptor desc, Vector3 prevPos) { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) tmpPos = prevPos; if (desc.Prio > resultPrio && PreApplyPositionRestriction(desc, ref tmpPos)) { resultPrio = desc.Prio; resultPos = tmpPos; } } } public static bool PreApplyPositionRestriction(Descriptor __instance, ref Vector3 testPosition) { //IL_0022: 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_0037: 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_005f: 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_006b: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_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_009a: 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_009d: Unknown result type (might be due to invalid IL or missing references) if (__instance.PosRestriction != null && (Object)(object)__instance.PosRestriction.Center != (Object)null) { Vector3 val = testPosition - __instance.PosRestriction.Center.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > __instance.PosRestriction.Radius * __instance.PosRestriction.Radius) { val /= Mathf.Sqrt(sqrMagnitude); val *= __instance.PosRestriction.Radius * 0.85f; val = (testPosition = val + __instance.PosRestriction.Center.position); return true; } } return false; } } [HarmonyPatch] internal class PlayerAiBotPatch { [HarmonyPatch(typeof(PlayerAIBot), "StopAction")] [HarmonyPrefix] public static bool PreStopAction(PlayerAIBot __instance, Descriptor desc) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 if (desc == PlayerAIBot.s_updatingAction) { Debug.LogError(Object.op_Implicit("Action was removed during its update: " + (object)desc)); } if ((int)desc.Status == 1) { desc.OnAborted(); for (int i = 0; i < __instance.m_queuedActions.Count; i++) { if (__instance.m_queuedActions[i] == desc) { __instance.m_queuedActions.RemoveAt(i); return false; } } return false; } if ((int)desc.Status == 2) { if (desc.ActionBase == null) { Debug.LogError(Object.op_Implicit("Active descriptor is missing action: " + (object)desc)); } __instance.m_actions.Remove(desc.ActionBase); desc.ActionBase.Stop(); desc.OnStopped(); } return false; } } [HarmonyPatch] internal class CustomDescBase { private readonly Descriptor __instance; public CustomDescBase(Descriptor instance) { __instance = instance; } public void OnQueued() { OnQueuedBase(__instance); } public bool CheckCollision(Descriptor desc) { return CheckCollisionBase(__instance, desc); } public bool IsActionAllowed(Descriptor desc) { return IsActionAllowedBase(__instance, desc); } public AccessLayers GetAccessLayersRuntime() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return GetAccessLayersRuntimeBase(__instance); } public void InternalOnTerminated() { InternalOnTerminatedBase(__instance); } [HarmonyPatch(typeof(Descriptor), "OnQueued")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void OnQueuedBase(Descriptor __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "CheckCollision")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool CheckCollisionBase(Descriptor __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "IsActionAllowed")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool IsActionAllowedBase(Descriptor __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "GetAccessLayersRuntime")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static AccessLayers GetAccessLayersRuntimeBase(Descriptor __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "InternalOnTerminated")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void InternalOnTerminatedBase(Descriptor __instance) { throw new NotImplementedException(); } } [HarmonyPatch] internal class CustomBase { private readonly PlayerBotActionBase __instance; public CustomBase(PlayerBotActionBase instance) { __instance = instance; } public void Stop() { StopBase(__instance); } public bool Update() { return UpdateBase(__instance); } public void OnWarped(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) OnWarpedBase(__instance, position); } public bool IsActionAllowed(Descriptor desc) { return IsActionAllowedBase(__instance, desc); } public bool CheckCollision(Descriptor desc) { return CheckCollisionBase(__instance, desc); } public AccessLayers GetAccessLayersRuntime() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return GetAccessLayersRuntimeBase(__instance); } [HarmonyPatch(typeof(PlayerBotActionBase), "Stop")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void StopBase(PlayerBotActionBase __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "Update")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool UpdateBase(PlayerBotActionBase __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "OnWarped")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void OnWarpedBase(PlayerBotActionBase __instance, Vector3 position) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "IsActionAllowed")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool IsActionAllowedBase(PlayerBotActionBase __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "CheckCollision")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool CheckCollisionBase(PlayerBotActionBase __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "GetAccessLayersRuntime")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static AccessLayers GetAccessLayersRuntimeBase(PlayerBotActionBase __instance) { throw new NotImplementedException(); } } [HarmonyPatch] internal static class ReviveActionPatch { public static bool allowedToReviveBots = true; public static Dictionary allowedToReviveOverrides; [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionReviveTeammate")] [HarmonyPrefix] [HarmonyPriority(0)] public static bool UpdateActionReviveTeammatePrePatch(RootPlayerBotAction __instance, ref Descriptor bestAction) { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0138: 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_0142: Unknown result type (might be due to invalid IL or missing references) if (!((Descriptor)__instance.m_reviveAction).IsTerminated()) { return false; } ((Descriptor)__instance.m_reviveAction).Prio = RootPlayerBotAction.m_prioSettings.Revive; if (!RootPlayerBotAction.CompareActionPrios((Descriptor)(object)__instance.m_reviveAction, bestAction)) { return false; } if (IsActionForbiddenDebug(((PlayerBotActionBase)__instance).m_bot, (Descriptor)(object)__instance.m_reviveAction)) { return false; } if (!zSlideComputer.ActionPermissions.ValueAt("Revive").Value) { return false; } if (ZiMain.HasBetterBots && !BBCompat.CheckReviveAllowed(((PlayerBotActionBase)__instance).m_agent)) { return false; } ((AIReservation)RootPlayerBotAction.s_tempObjReservation).CharacterID = ((PlayerBotActionBase)__instance).m_agent.CharacterID; for (int i = 0; i < PlayerManager.PlayerAgentsInLevel.Count; i++) { PlayerAgent val = PlayerManager.PlayerAgentsInLevel[i]; if (!((Object)(object)val != (Object)null) || !((Object)(object)val != (Object)(object)((PlayerBotActionBase)__instance).m_agent) || ((Agent)val).Alive || !((Interact_Base)val.ReviveInteraction).IsActive || ((Interact_Base)val.ReviveInteraction).IsBlocked) { continue; } RootPlayerBotAction.s_tempObjReservation.Object = ((Component)val).gameObject; if (!PlayerManager.Current.IsObjectUnReserved(RootPlayerBotAction.s_tempObjReservation)) { continue; } float prio = ((Descriptor)__instance.m_reviveAction).Prio; Vector3 position = ((Agent)val).Position; if (((PlayerBotActionBase)__instance).m_bot.ApplyRestrictionsToRootPosition(ref position, ref prio)) { Vector3 val2 = position - ((Agent)val).Position; if (!(((Vector3)(ref val2)).sqrMagnitude <= 1f)) { continue; } } bool flag = true; if (!zSlideComputer.ActionPermissions.ValueAt("ReviveBots").Value && val.Owner.IsBot) { flag = false; } else if (!zSlideComputer.ActionPermissions.ValueAt("RevivePlayers").Value && !val.Owner.IsBot) { flag = false; } if (flag) { __instance.m_reviveAction.Client = val; bestAction = (Descriptor)(object)__instance.m_reviveAction; return false; } } return false; } public static bool IsActionForbiddenDebug(PlayerAIBot bot, Descriptor desc) { for (int i = 0; i < bot.m_queuedActions.Count; i++) { if (!IsActionAllowedDebug(bot.m_queuedActions[i], desc)) { return true; } } for (int j = 0; j < bot.m_actions.Count; j++) { if (!IsActionAllowedDebug(bot.m_actions[j].m_descBase, desc)) { return true; } } return false; } public static bool IsActionAllowedDebug(Descriptor thisBase, Descriptor desc) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (thisBase.IsMyChild(desc)) { return true; } if ((thisBase.GetAccessLayersRuntime() & desc.RequiredLayers) != 0) { float num = ((thisBase.ActionBase != null) ? Descriptor.s_minAbortPrioDiff : 0f); if (desc.Prio - thisBase.Prio < num) { return false; } } return true; } } [HarmonyPatch] public static class RootPlayerBotActionPatch { [HarmonyPatch(typeof(RootPlayerBotAction), "Update")] [HarmonyPrefix] public static bool PreUpdate(RootPlayerBotAction __instance, ref bool __result) { zActions.GetOrCreateData((PlayerBotActionBase)(object)__instance).bestAction = null; return true; } [HarmonyPatch(typeof(RootPlayerBotAction), "StartAction")] [HarmonyPrefix] public static bool StartActionPatch(RootPlayerBotAction __instance, Descriptor actionDesc) { zActions.GetOrCreateData((PlayerBotActionBase)(object)__instance).bestAction = actionDesc; return false; } [HarmonyPatch(typeof(RootPlayerBotAction), "Update")] [HarmonyPostfix] public static void PostUpdate(RootPlayerBotAction __instance, ref bool __result) { } } [HarmonyPatch] internal class ShareActionPatch { internal enum ResourceIDs : uint { MediPack = 102u, ToolPack = 127u, AmmoPack = 101u, DisinfectPack = 132u, None = 0u } private static Il2CppReferenceArray _rawResourcePackItems; private static Il2CppReferenceArray _resourcePackItems; private static List _resourcePackItemPublicNames; private static List _resourcePackItemNames; public static Il2CppReferenceArray rawResourcePackItems => ((Il2CppArrayBase>)(object)ItemSpawnManager.m_itemDataPerInventorySlot)?[4]; public static Il2CppReferenceArray resourcePackItems { get { Il2CppReferenceArray val = rawResourcePackItems; if (val == _rawResourcePackItems) { return _resourcePackItems; } _rawResourcePackItems = val; _resourcePackItems = new Il2CppReferenceArray(((IEnumerable)val).Where((ItemDataBlock item) => item != null).ToArray()); return _resourcePackItems; } } public static List resourcePackItemPublicNames { get { Il2CppReferenceArray val = resourcePackItems; if (val == _resourcePackItems && _resourcePackItemPublicNames != null) { return _resourcePackItemPublicNames; } _resourcePackItemPublicNames = ((IEnumerable)val).Select((ItemDataBlock item) => item.publicName).ToList(); return _resourcePackItemPublicNames; } } public static List resourcePackItemNames { get { Il2CppReferenceArray val = resourcePackItems; if (val == _resourcePackItems && _resourcePackItemNames != null) { return _resourcePackItemNames; } _resourcePackItemNames = ((IEnumerable)val).Select((ItemDataBlock item) => ((GameDataBlockBase)(object)item).name).ToList(); return _resourcePackItemNames; } } [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionShareResoursePack")] [HarmonyPrefix] public static bool UpdateActionShareResoursePack(RootPlayerBotAction __instance, ref Descriptor bestAction) { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) if (!((Descriptor)__instance.m_shareResourceAction).IsTerminated()) { return false; } ((Descriptor)__instance.m_shareResourceAction).Prio = RootPlayerBotAction.m_prioSettings.ShareResource; if (!RootPlayerBotAction.CompareActionPrios((Descriptor)(object)__instance.m_shareResourceAction, bestAction)) { return false; } if (((PlayerBotActionBase)__instance).m_bot.IsActionForbidden((Descriptor)(object)__instance.m_shareResourceAction)) { return false; } PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(((PlayerBotActionBase)__instance).m_agent.Owner); BackpackItem val = default(BackpackItem); if (!backpack.TryGetBackpackItem((InventorySlot)4, ref val)) { return false; } uint itemID = val.ItemID; string name = ((GameDataBlockBase)(object)GameDataBlockBase.GetBlock(itemID)).name; string key = "Share" + name; if (!zSlideComputer.ActionPermissions.ValueAt(key).Value) { return false; } if (ZiMain.HasBetterBots && BBCompat.CheckDanger(((PlayerBotActionBase)__instance).m_agent)) { return false; } PlayerAmmoStorage ammoStorage = backpack.AmmoStorage; float num = ammoStorage.ResourcePackAmmo.CostOfBullet / ammoStorage.ResourcePackAmmo.AmmoMaxCap; switch (itemID) { case 102u: num = AgentModifierManager.ApplyModifier((Agent)(object)((PlayerBotActionBase)__instance).m_agent, (AgentModifier)3, num); break; case 101u: case 127u: num = AgentModifierManager.ApplyModifier((Agent)(object)((PlayerBotActionBase)__instance).m_agent, (AgentModifier)108, num); break; } PlayerAgent val2 = null; float num2 = 0f; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); bool flag = default(bool); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if ((Object)(object)current == (Object)null || !((Agent)current).Alive) { continue; } if ((Object)(object)current != (Object)(object)((PlayerBotActionBase)__instance).m_agent) { float prio = ((Descriptor)__instance.m_shareResourceAction).Prio; Vector3 position = ((Agent)current).Position; if (((PlayerBotActionBase)__instance).m_bot.ApplyRestrictionsToRootPosition(ref position, ref prio)) { continue; } } if (!zSlideComputer.ActionPriorities.HasKey(key)) { ManualLogSource log = ZiMain.log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Tried share unknown resoruce pack ID "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(itemID); } log.LogWarning(val3); return false; } int num3 = (int)zSlideComputer.ActionPriorities.ValueAt(key).Value; Enumerator enumerator2 = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator2.MoveNext()) { PlayerAgent current2 = enumerator2.Current; if (!current2.Owner.IsBot) { continue; } PlayerAIBot component = ((Component)current2).gameObject.GetComponent(); object obj; if (component == null) { obj = null; } else { Descriptor rootAction = component.m_rootAction; if (rootAction == null) { obj = null; } else { PlayerBotActionBase actionBase = rootAction.ActionBase; if (actionBase == null) { obj = null; } else { RootPlayerBotAction obj2 = ((Il2CppObjectBase)actionBase).Cast(); obj = ((obj2 != null) ? obj2.m_shareResourceAction : null); } } } Descriptor val4 = (Descriptor)obj; if (val4 != null && !((Object)(object)val4.Item == (Object)null) && ((GameDataBlockBase)(object)((Item)val4.Item).ItemDataBlock).persistentID == itemID && val4.Receiver.CharacterID == current.CharacterID) { num3 -= (int)ammoStorage.ResourcePackAmmo.CostOfBullet; } } float num4 = Mathf.Clamp01((float)num3 / 100f); float num5 = Mathf.Lerp(0f, 0.98f, num4); float num6 = Math.Min(num5 + num, 0.98f); PlayerAmmoStorage ammoStorage2 = PlayerBackpackManager.GetBackpack(current.Owner).AmmoStorage; float num7 = 0f; switch (itemID) { case 102u: if (((Dam_SyncedDamageBase)current.Damage).GetHealthRel() + num < num6) { num7 = num6 - ((Dam_SyncedDamageBase)current.Damage).GetHealthRel(); } break; case 101u: if (ammoStorage2.StandardAmmo.RelInPack + num < num6 && ammoStorage2.SpecialAmmo.RelInPack + num < num6) { num7 = num6 - (ammoStorage2.StandardAmmo.RelInPack + ammoStorage2.SpecialAmmo.RelInPack) / 2f; } break; case 132u: if (!(((PlayerBotActionBase)__instance).m_bot.IsPositionInfected(((Agent)current).Position) > 0.001f) && current.Damage.Infection > num5) { num7 = current.Damage.Infection - num5; } break; case 127u: if (current.NeedToolAmmo() && ammoStorage2.ClassAmmo.RelInPack + num < num6) { num7 = num6 - ammoStorage2.ClassAmmo.RelInPack; } break; } if (num7 > 0f) { num7 = Mathf.Clamp01(num7 / num6); if (!current.Owner.IsBot) { num7 = Mathf.Lerp(num7, 1f, 0.5f); } if (num7 > num2) { val2 = current; num2 = num7; } } } if ((Object)(object)val2 != (Object)null) { __instance.m_shareResourceAction.Item = ((Il2CppObjectBase)val.Instance).Cast(); __instance.m_shareResourceAction.Receiver = val2; __instance.m_shareResourceAction.Haste = 0.8f; bestAction = (Descriptor)(object)__instance.m_shareResourceAction; } return false; } } public static class UseBioscanEvaluatePatches { private unsafe delegate bool d_Evaluate(IntPtr bioscan, IntPtr bot, float* standRadius, int* nrOthers, Il2CppMethodInfo* methodInfo); private static INativeDetour? EvaluateDetour; internal unsafe static void ApplyNativePatch() { if (EvaluateDetour == null) { d_Evaluate d_Evaluate = default(d_Evaluate); EvaluateDetour = INativeDetour.CreateAndApply((IntPtr)(nint)Il2CppAPI.GetIl2CppMethod("Evaluate", typeof(bool).Name, true, new string[4] { typeof(CP_Bioscan_Core).Name, typeof(PlayerAIBot).Name, typeof(float).MakeByRefType().Name, typeof(int).MakeByRefType().Name }), (d_Evaluate)EvaluatePatch, ref d_Evaluate); } } private unsafe static bool EvaluatePatch(IntPtr bioscan, IntPtr bot, float* standRadius, int* nrOthers, Il2CppMethodInfo* methodInfo) { //IL_0001: 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_000d: Expected O, but got Unknown //IL_0017: Expected O, but got Unknown CP_Bioscan_Core val = new CP_Bioscan_Core(bioscan); PlayerAIBot bot2 = new PlayerAIBot(bot); float standRadius2; int nrOthers2; bool result = EvaluateManaged(val, bot2, out standRadius2, out nrOthers2); if (standRadius != null) { *standRadius = standRadius2; } if (nrOthers != null) { *nrOthers = nrOthers2; } return result; } internal static bool EvaluateManaged(CP_Bioscan_Core bioscan, PlayerAIBot bot, out float standRadius, out int nrOthers) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001a: 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_0021: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected I4, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Expected O, but got Unknown //IL_0062: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Expected O, but got Unknown standRadius = 0f; nrOthers = 0; pBioscanState state = bioscan.State; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val; if ((int)state.status != 2 && (int)state.status != 3) { if ((int)state.status != 4) { ManualLogSource log = ZiMain.log; val = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("bioscan "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)bioscan).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" not ready "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(state.status); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } return false; } CP_PlayerScanner val2 = ((Il2CppObjectBase)bioscan.PlayerScanner).Cast(); if ((Object)(object)val2 == (Object)null) { ManualLogSource log2 = ZiMain.log; val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("bioscan "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)bioscan).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cp_PlayerScanner is null."); } log2.LogInfo(val); return false; } standRadius = val2.Radius; PlayerRequirement scanPlayersRequired = val2.ScanPlayersRequired; switch ((int)scanPlayersRequired) { case 0: { if (val2.LastPlayerCount != 0) { int num = 0; for (int i = 0; i < bioscan.PlayersOnScan.Count; i++) { if ((Object)(object)bioscan.PlayersOnScan[i] != (Object)null && !bioscan.PlayersOnScan[i].Owner.IsBot) { num++; } } nrOthers = num; } nrOthers += PlayerManager.Current.CountObjectReservations(bot.Agent.CharacterID, ((Component)bioscan).gameObject); if (!val2.CanGoFaster(nrOthers)) { ManualLogSource log4 = ZiMain.log; val = new BepInExInfoLogInterpolatedStringHandler(55, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("bioscan "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)bioscan).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cp_PlayerScanner can't go faster with "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(nrOthers); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" others."); } log4.LogInfo(val); return false; } if (bioscan.HasAlarm) { return true; } int num2 = bioscan.Owner.NRofPuzzles(); for (int j = 0; j < num2; j++) { CP_Bioscan_Core val3 = ((Il2CppObjectBase)bioscan.Owner.GetPuzzle(j)).Cast(); if (!((Object)(object)val3 != (Object)null) || !((Object)(object)val3 != (Object)(object)bioscan)) { continue; } CP_Bioscan_Core val4 = val3; if (!((Object)(object)val4 != (Object)null)) { continue; } CP_PlayerScanner val5 = ((Il2CppObjectBase)val4.PlayerScanner).Cast(); if (!((Object)(object)val5 != (Object)null) || val5.LastPlayerCount == 0) { continue; } for (int k = 0; k < val4.PlayersOnScan.Count; k++) { if ((Object)(object)val4.PlayersOnScan[k] != (Object)null && !val4.PlayersOnScan[k].Owner.IsBot) { return true; } } } break; } case 1: { if (bioscan.HasAlarm) { return true; } for (int l = 0; l < bioscan.PlayersOnScan.Count; l++) { if ((Object)(object)bioscan.PlayersOnScan[l] != (Object)null && !bioscan.PlayersOnScan[l].Owner.IsBot) { return true; } } ManualLogSource log5 = ZiMain.log; val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("bioscan "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)bioscan).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cp_PlayerScanner all."); } log5.LogInfo(val); return false; } case 2: { ManualLogSource log3 = ZiMain.log; val = new BepInExInfoLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("bioscan "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)bioscan).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cp_PlayerScanner ScanPlayersRequired solo."); } log3.LogInfo(val); return false; } } ManualLogSource log6 = ZiMain.log; val = new BepInExInfoLogInterpolatedStringHandler(83, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("bioscan "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)bioscan).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cp_PlayerScanner ScanPlayersRequired unknown value (this should't happen)."); } log6.LogInfo(val); return false; } } [HarmonyPatch] public static class ThrowItemPatch { public static Dictionary throwDescriptions = new Dictionary(); public static Vector3 GetMovePosition(PlayerBotActionThrowItem __instance) { //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_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) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Vector3 result = ((Component)((PlayerBotActionBase)__instance).m_bot).transform.position; TargetTypeEnum targetType = __instance.m_desc.TargetType; if ((int)targetType != 1) { if ((int)targetType == 2) { result = __instance.m_desc.TargetPosition; } } else { result = __instance.m_desc.TargetObject.position; } return result; } [HarmonyPatch(typeof(PlayerBotActionThrowItem), "VerifyCurrentPosition")] [HarmonyPrefix] public static bool PreVerifyCurrentPosition(PlayerBotActionThrowItem __instance, ref bool __result) { //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_0007: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Vector3 movePosition = GetMovePosition(__instance); if (movePosition != ((Component)((PlayerBotActionBase)__instance).m_bot).transform.position && __instance.CheckPositionHasView(movePosition, __instance.GetTargetPosition(), 0.9f)) { __result = false; return false; } return true; } [HarmonyPatch(typeof(PlayerBotActionThrowItem), "FindPositionWithView")] [HarmonyPrefix] public static bool PreFindPositionWithView(PlayerBotActionThrowItem __instance, Vector3 currentPosition, Vector3 targetPosition, ref Vector3 resultPosition, ref bool __result) { //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_0014: 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_0022: 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_0031: 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) resultPosition = currentPosition; __instance.m_state = (State)1; _ = __instance.m_desc.TargetType; Vector3 movePosition = GetMovePosition(__instance); if (__instance.CheckPositionHasView(movePosition, targetPosition, 0.7225f)) { resultPosition = movePosition; __result = true; return false; } return true; } [HarmonyPatch(typeof(PlayerAIBot), "StartAction")] [HarmonyPrefix] public static bool PreStartAction(PlayerAIBot __instance, Descriptor desc) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) int characterID = __instance.Agent.CharacterID; string fullName = Il2CppType.Of().FullName; string fullName2 = Il2CppType.Of().FullName; if (((Object)desc).GetIl2CppType().FullName == fullName) { Descriptor value = ((Il2CppObjectBase)desc).Cast(); throwDescriptions[characterID] = value; } else if (((Object)desc).GetIl2CppType().FullName == fullName2) { Descriptor val = ((Il2CppObjectBase)desc).Cast(); object obj; if (val == null) { obj = null; } else { PlayerBotActionBase parentActionBase = ((Descriptor)val).ParentActionBase; if (parentActionBase == null) { obj = null; } else { Type il2CppType = ((Object)parentActionBase).GetIl2CppType(); obj = ((il2CppType != null) ? il2CppType.FullName : null); } } string text = (string)obj; if (text != null && text == "Player.PlayerBotActionThrowItem") { val.DestinationPos = GetMovePosition(((Il2CppObjectBase)((Descriptor)val).ParentActionBase).Cast()); } else if (throwDescriptions.ContainsKey(characterID) && throwDescriptions[characterID] != null && !((Descriptor)throwDescriptions[characterID]).IsTerminated()) { ((Descriptor)val).ParentActionBase.SafeStopAction((Descriptor)(object)val); } } return true; } private static void OnButtonThrowItem(PlayerAgent targetAgent) { //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) //IL_0045: 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_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_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) Vector3 cameraRayPos = zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos; if (SNet.IsMaster) { zBotActions.SendBotToThrowItem(zStaticRefrences.LocalPlayer, targetAgent, ((Component)zStaticRefrences.LocalPlayer).transform.position, cameraRayPos, 0uL); } pStructs.pThrowDataInfo pThrowDataInfo = new pStructs.pThrowDataInfo { Commander = pStructs.Get_pStructFromRefrence(zStaticRefrences.LocalPlayer), Agent = pStructs.Get_pStructFromRefrence(targetAgent), MovePosition = ((Component)zStaticRefrences.LocalPlayer).transform.position, TargetPosition = cameraRayPos }; NetworkAPI.InvokeEvent("RequestToThrowItem", pThrowDataInfo, (SNet_ChannelType)2); } [HarmonyPatch(typeof(PUI_CommunicationMenu), "OnButtonPressedUseFogRepeller")] [HarmonyPrefix] public static bool PreOnButtonPressedUseFogRepeller(PUI_CommunicationMenu __instance, PUI_CommunicationButton button, PlayerAgent targetAgent, ref bool __result) { OnButtonThrowItem(targetAgent); return false; } [HarmonyPatch(typeof(PUI_CommunicationMenu), "OnButtonPressedUseGlue")] [HarmonyPrefix] public static bool PreOnButtonPressedUseGlue(PUI_CommunicationMenu __instance, PUI_CommunicationButton button, PlayerAgent targetAgent, ref bool __result) { OnButtonThrowItem(targetAgent); return false; } [HarmonyPatch(typeof(PUI_CommunicationMenu), "OnButtonPressedThrowGlowStick")] [HarmonyPrefix] public static bool PreOnButtonPressedThrowGlowStick(PUI_CommunicationMenu __instance, PUI_CommunicationButton button, PlayerAgent targetAgent, ref bool __result) { OnButtonThrowItem(targetAgent); return false; } private static void DebugSimulateNetworkThrow() { //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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_009f: 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) List botList = ZiMain.GetBotList(); PlayerAgent val = null; foreach (PlayerAIBot item in botList) { _ = item.Backpack; zHelpers.TryGetAgentBackpackItem(item.Agent, (InventorySlot)5, out BackpackItem _); } if (!((Object)(object)val == (Object)null)) { Vector3 cameraRayPos = zStaticRefrences.LocalPlayer.FPSCamera.CameraRayPos; pStructs.pThrowDataInfo info = new pStructs.pThrowDataInfo { Commander = pStructs.Get_pStructFromRefrence(zStaticRefrences.LocalPlayer), Agent = pStructs.Get_pStructFromRefrence(val), MovePosition = ((Component)zStaticRefrences.LocalPlayer).transform.position, TargetPosition = cameraRayPos }; zNetworking.ReciveRequestToThrowItem(0uL, info); } } public static Vector3 _GetAimDirection(PlayerBotActionThrowItem __instance, Vector3 fromPos, ref float forceRel, bool straightShot, out float range) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0081: 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_008f: 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_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_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_00fc: 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_0105: 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_005e: 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_00e6: 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_0080: 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_0156: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_01ae: 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) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_desc == null) { throw new NullReferenceException(); } TargetTypeEnum targetType = __instance.m_desc.TargetType; Vector3 val; if ((int)targetType != 1) { if ((int)targetType == 2) { if ((Object)(object)__instance.m_desc.TargetObject == (Object)null) { throw new NullReferenceException(); } val = __instance.m_desc.TargetObject.position; } else { if ((Object)(object)((PlayerBotActionBase)__instance).m_agent == (Object)null) { throw new NullReferenceException(); } val = ((Agent)((PlayerBotActionBase)__instance).m_agent).Position; } } else { val = __instance.m_desc.TargetPosition; } float num = val.x - fromPos.x; float num2 = val.z - fromPos.z; float num3 = val.y - fromPos.y; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(num, num2); float magnitude = ((Vector2)(ref val2)).magnitude; Vector3 val3 = Physics.gravity; float magnitude2 = ((Vector3)(ref val3)).magnitude; if (magnitude == 0f) { range = 0f; if (!(num3 <= 0f)) { return Vector3.up; } return Vector3.down; } float num4 = forceRel * PlayerBotActionThrowItem.s_throwVelocity; Vector2 val4 = val2 / magnitude; float num5 = (0f - magnitude2) * 0.5f * magnitude * magnitude / (num4 * num4); float num6 = magnitude * magnitude - (num5 - num3) * num5 * 4f; if (num6 < 0f) { range = 1f; float num7; if (num3 <= 0f) { num7 = 1f; } else { val3 = val - fromPos; num7 = Mathf.Tan((((Vector3)(ref val3)).normalized.y + 1f) * ((float)Math.PI / 4f)); } float num8 = 1f / Mathf.Sqrt(num7 * num7 + 1f); return new Vector3(val4.x * num8, num7 * num8, val4.y * num8); } float num9 = Mathf.Sqrt(num6); float num10 = num5 + num5; float num11 = (0f - magnitude - num9) / num10; float num12 = (0f - magnitude + num9) / num10; float num13 = (straightShot ? Mathf.Min(num12, num11) : Mathf.Max(num12, num11)); range = 1f / Mathf.Max(num12, num11); if (num13 > 2f && !straightShot) { float forceRel2 = forceRel * 0.75f; float range2; Vector3 result = _GetAimDirection(__instance, fromPos, ref forceRel2, straightShot: false, out range2); if (range2 < 1f) { forceRel = forceRel2; return result; } } float num14 = 1f / Mathf.Sqrt(num13 * num13 + 1f); return new Vector3(val4.x * num14, num13 * num14, val4.y * num14); } } [HarmonyPatch] public class ZombifiedPatches { public static Dictionary lastTimeCheckedForWakeUp = new Dictionary(); [HarmonyPatch(typeof(Descriptor), "InternalOnTerminated")] [HarmonyPostfix] public static void InternalOnTerminated(Descriptor __instance) { if (zActionSub.actionCallbacks.ContainsKey(((Il2CppObjectBase)__instance).Pointer)) { zActionSub.actionCallbacks[((Il2CppObjectBase)__instance).Pointer].Invoke(); } } [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionUnlock")] [HarmonyPrefix] [HarmonyPriority(0)] public static bool UpdateActionUnlock(RootPlayerBotAction __instance, ref Descriptor bestAction) { if (!zSlideComputer.ActionPermissions.ValueAt("Unlock").Value) { return false; } return true; } [HarmonyPatch(typeof(RootPlayerBotAction), "UpdateActionTagEnemies")] [HarmonyPrefix] [HarmonyPriority(0)] public static bool UpdateActionTagEnemies(RootPlayerBotAction __instance, ref Descriptor bestAction) { if (!zSlideComputer.ActionPermissions.ValueAt("Use BioTracker").Value) { return false; } return true; } [HarmonyPatch(typeof(PlayerBotActionBase), "CheckCollision")] [HarmonyPostfix] public static void CheckCollisionPatch(PlayerBotActionBase __instance, Descriptor desc, bool __result) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown if (!__result) { return; } string text = ((desc == null) ? "desc is NULL" : (((Object)(object)desc.Bot == (Object)null) ? "desc.Bot is NULL" : (((Object)(object)desc.Bot.Agent == (Object)null) ? "desc.Bot.Agent is NULL" : ((desc.Bot.Agent.PlayerName != null) ? desc.Bot.Agent.PlayerName : "desc.Bot.Agent.PlayerName is NULL")))); string text2 = ((__instance != null) ? ((MemberInfo)((Object)__instance).GetIl2CppType()).Name : "INSTANCE IS NULL"); string text3 = ((desc != null && desc.ActionBase != null) ? ((MemberInfo)((Object)desc.ActionBase).GetIl2CppType()).Name : "desc.ActionBase is NULL"); if (text2 == "INSTANCE IS NULL" || text2 == "PlayerBotActionCollectItem") { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(54, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Action collision! botName="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", instanceType="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", actionType="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text3); } log.LogWarning(val); } } [HarmonyPatch(typeof(PlayerBotActionMelee), "UpdateTravelAction")] [HarmonyPrefix] public static bool UpdateTravelAction(PlayerBotActionMelee __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 //IL_0172: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_desc == null) { return false; } if (!__instance.m_desc.Travel) { if (__instance.m_travelAction != null && (int)((Descriptor)__instance.m_travelAction).Status == 2) { PlayerAIBot bot = ((PlayerBotActionBase)__instance).m_bot; if (bot != null) { bot.StopAction((Descriptor)(object)__instance.m_travelAction); } } return false; } GameObject val = null; if ((Object)(object)__instance.m_desc.TargetAgent != (Object)null) { val = ((Component)__instance.m_desc.TargetAgent).gameObject; } else if ((Object)(object)__instance.m_desc.TargetGameObject != (Object)null) { val = __instance.m_desc.TargetGameObject; } if (__instance.m_travelAction != null) { if ((int)((Descriptor)__instance.m_travelAction).Status == 2 && (Object)(object)__instance.m_travelAction.DestinationObject == (Object)(object)val) { return false; } if ((int)((Descriptor)__instance.m_travelAction).Status == 2) { PlayerAIBot bot2 = ((PlayerBotActionBase)__instance).m_bot; if (bot2 != null) { bot2.StopAction((Descriptor)(object)__instance.m_travelAction); } } } if ((Object)(object)((PlayerBotActionBase)__instance).m_bot != (Object)null && ((PlayerBotActionBase)__instance).m_bot.RequestAction((Descriptor)(object)__instance.m_travelAction) && __instance.m_travelAction != null) { __instance.m_travelAction.DestinationObject = val; __instance.m_travelAction.Haste = __instance.m_desc.Haste; Descriptor attackAction = ((Il2CppObjectBase)((PlayerBotActionBase)__instance).m_bot.Actions[0]).Cast().m_attackAction; Descriptor val2 = ((attackAction != null) ? ((Il2CppObjectBase)attackAction).Cast() : null); if (attackAction != null && !((Descriptor)attackAction).IsTerminated()) { __instance.m_travelAction.WalkPosture = val2.Posture; } if ((Object)(object)val != (Object)null && (Object)(object)val.transform != (Object)null) { Vector3 position = val.transform.position; __instance.m_lastTravelToPosition = position; } } return false; } [HarmonyPatch(typeof(PlayerBotActionAttack), "UpdateMeleeAttack")] [HarmonyPrefix] private static void UpdateMeleeAttack(PlayerBotActionAttack __instance, bool push) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Invalid comparison between Unknown and I4 ((PlayerBotActionBase)__instance).SafeStopAction((Descriptor)(object)__instance.m_fireAction); ((PlayerBotActionBase)__instance).SafeStopAction((Descriptor)(object)__instance.m_useNanoswarmAction); Transform val = null; float num = 0f; bool flag = false; GameObject val2 = null; if (__instance.m_meleeAction != null && (Object)(object)__instance.m_meleeAction.TargetGameObject != (Object)null && Time.time - __instance.m_targetSelectedTime < PlayerBotActionAttack.s_targetReselectionDelay) { val2 = __instance.m_meleeAction.TargetGameObject; } if (push) { if (__instance.m_currentAttackOption == null || (Object)(object)__instance.m_currentAttackOption.TargetAgent == (Object)null) { return; } val = __instance.m_currentAttackOption.TargetAgent.EasyAimTarget; flag = true; } else { if (__instance.m_currentAttackOption == null) { return; } val = ((PlayerBotActionBase)__instance).FindVulnerableTarget(__instance.m_currentAttackOption.TargetAgent, val2, ref num); flag = 0.2f < num; } if (__instance.m_currentAttackOption == null) { return; } StanceEnum stance = __instance.m_currentAttackOption.Stance; if (__instance.m_meleeAction == null) { Descriptor val3 = new Descriptor(((PlayerBotActionBase)__instance).m_bot); ((Descriptor)val3).ParentActionBase = (PlayerBotActionBase)(object)__instance; ((Descriptor)val3).Prio = ((Descriptor)__instance.m_desc).Prio; val3.Push = push; val3.Loop = !push; val3.Travel = (int)stance == 2; val3.Haste = __instance.m_desc.Haste; val3.Force = 0.75f; val3.Strike = flag; val3.TargetAgent = __instance.m_currentAttackOption.TargetAgent; if ((Object)(object)val != (Object)null) { val3.TargetGameObject = ((Component)val).gameObject; } ItemEquippable itemToUse = __instance.m_currentAttackOption.ItemToUse; MeleeWeaponThirdPerson weapon = (MeleeWeaponThirdPerson)(object)((itemToUse is MeleeWeaponThirdPerson) ? itemToUse : null); val3.Weapon = weapon; if ((Object)(object)((PlayerBotActionBase)__instance).m_bot != (Object)null && ((PlayerBotActionBase)__instance).m_bot.RequestAction((Descriptor)(object)val3)) { __instance.m_meleeAction = val3; Object.op_Implicit((Object)(object)zActions.isManualAction((Descriptor)(object)val3)); } } else { if (__instance.m_desc != null) { ((Descriptor)__instance.m_meleeAction).Prio = ((Descriptor)__instance.m_desc).Prio; } __instance.m_meleeAction.TargetAgent = __instance.m_currentAttackOption.TargetAgent; if ((Object)(object)val != (Object)null) { __instance.m_meleeAction.TargetGameObject = ((Component)val).gameObject; } ItemEquippable itemToUse2 = __instance.m_currentAttackOption.ItemToUse; MeleeWeaponThirdPerson weapon2 = (MeleeWeaponThirdPerson)(object)((itemToUse2 is MeleeWeaponThirdPerson) ? itemToUse2 : null); __instance.m_meleeAction.Weapon = weapon2; __instance.m_meleeAction.Strike = flag; } } } } namespace BotControl.Networking { public class pStructs { public struct pGenericPermission { public int playerID; public int actionID; public bool allowed; } public struct pPickupMineInfo { public ushort MineReplicatorKey; public pPlayerAgent BotAgent; public pPlayerAgent Commander; internal uint ID; } public struct pActionTerminatedInfo { public StatusType status; public uint ID; } public struct pAttackEnemyInfo { public pEnemyAgent Enemy; public pPlayerAgent BotAgent; public pPlayerAgent Commander; internal uint ID; } public struct pLeaderInfo { public pPlayerAgent leader; public pPlayerAgent follower; public pPlayerAgent Commander; } public struct pBreakLockInfo { public pStateReplicatorProvider Lock; public pPlayerAgent BotAgent; public pPlayerAgent Commander; public MethodEnum Method; internal uint ID; } internal struct pPlaceToolInfo { public pPlayerAgent playerAgent; public pPlayerAgent commander; public Pose Pose; internal uint ID; } internal struct pPickupSentryInfo { public pPlayerAgent playerAgent; public pPlayerAgent commander; internal uint ID; } internal struct pPickupItemInfo { public pItemData item; public pPlayerAgent playerAgent; public pPlayerAgent commander; internal uint ID; } internal struct pShareResourceInfo { public pPlayerAgent sender; public pPlayerAgent receiver; public pPlayerAgent commander; internal uint ID; } internal struct pReviveAgentInfo { public pPlayerAgent Revier; public pPlayerAgent Downed; public pPlayerAgent commander; internal uint ID; } internal struct pUseCfoamInfo { public pPlayerAgent Agent; public pPlayerAgent Commander; public Vector3 position; internal uint ID; } internal struct pPlaceMineInfo { public pPlayerAgent Agent; public pPlayerAgent Commander; public Pose pose; public InventorySlot slot; internal uint ID; } internal struct pLocationInfo { public Vector3 position; public pPlayerAgent BotAgent; public pPlayerAgent Commander; public uint ID; } internal struct pDoorInteractInfo { public Vector3 DoorPosition; public Vector3 TargetPosition; public MethodEnum Method; public pPlayerAgent BotAgent; public pPlayerAgent Commander; public uint ID; } internal struct pBoolOverideTreeInfo { public uint treeID; public uint keyId; public bool value; public bool isNull; } internal struct pIntOverideTreeInfo { public uint treeID; public uint keyId; public int value; public bool isNull; } internal struct pFloatOverideTreeInfo { public uint treeID; public uint keyId; public float value; public bool isNull; } public struct pThrowDataInfo { public pPlayerAgent Commander; public pPlayerAgent Agent; public Vector3 MovePosition; public Vector3 TargetPosition; internal uint ID; } public static PlayerAgent Get_RefFrom_pStruct(pPlayerAgent pStruct) { PlayerAgent result = default(PlayerAgent); if (!((pPlayerAgent)(ref pStruct)).TryGet(ref result)) { return null; } return result; } public static Agent Get_RefFrom_pStruct(pAgent pStruct) { Agent result = default(Agent); if (!((pAgent)(ref pStruct)).TryGet(ref result)) { return null; } return result; } public static EnemyAgent Get_RefFrom_pStruct(pEnemyAgent pStruct) { EnemyAgent result = default(EnemyAgent); if (!((pEnemyAgent)(ref pStruct)).TryGet(ref result)) { return null; } return result; } public static PlayerAgent Get_RefFrom_pStruct(pPlayer pStruct) { SNet_Player val = default(SNet_Player); if (!((pPlayer)(ref pStruct)).TryGetPlayer(ref val)) { return null; } return ((Il2CppObjectBase)val.PlayerAgent).TryCast(); } public static GameObject Get_RefFrom_pStruct(pItemData pStruct) { GameObject result = null; IReplicator val = default(IReplicator); if (((pReplicator)(ref pStruct.replicatorRef)).TryGetID(ref val)) { result = val.ReplicatorSupplier.gameObject; } return result; } public static pPlayer Get_pPlayerFromRefrence(PlayerAgent refrence) { //IL_0002: 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) pPlayer result = default(pPlayer); ((pPlayer)(ref result)).SetPlayer(refrence.Owner); return result; } public static pStateReplicatorProvider Get_pStructFromRef(iSNet_StateReplicatorProvider original) where S : struct where I : struct { //IL_001a: 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_0017: Unknown result type (might be due to invalid IL or missing references) return (pStateReplicatorProvider)(((??)((Il2CppObjectBase)original.GetStateReplicator()).TryCast>()?.GetProviderSyncStruct()) ?? default(pStateReplicatorProvider)); } public static pStateReplicatorProvider Get_pStructFromRef(iSNet_StateReplicatorProvider original) where S : struct { //IL_001a: 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_0017: Unknown result type (might be due to invalid IL or missing references) return (pStateReplicatorProvider)(((??)((Il2CppObjectBase)original.GetStateReplicator()).TryCast>()?.GetProviderSyncStruct()) ?? default(pStateReplicatorProvider)); } public static pAgent Get_pStructFromRefrence(Agent refrence) { //IL_0002: 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) pAgent result = default(pAgent); ((pAgent)(ref result)).Set(refrence); return result; } public static pPlayerAgent Get_pStructFromRefrence(PlayerAgent refrence) { //IL_0002: 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) pPlayerAgent result = default(pPlayerAgent); ((pPlayerAgent)(ref result)).Set(refrence); return result; } public static pEnemyAgent Get_pStructFromRefrence(EnemyAgent refrence) { //IL_0002: 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) pEnemyAgent result = default(pEnemyAgent); ((pEnemyAgent)(ref result)).Set(refrence); return result; } public static pItemData Get_pStructFromRefrence(Item refrence) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return refrence.Get_pItemData(); } } public class zNetworking { internal static void ReciveSetBoolOverideTree(ulong netSender, pStructs.pBoolOverideTreeInfo info) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown ZiMain.log.LogDebug((object)"Recived request to update bool override tree!"); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(32, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("treeID:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.treeID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", keyId:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.keyId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", isNull:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.isNull); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", value:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.value); } log.LogDebug(val); uint keyId = info.keyId; bool? value = ((!info.isNull) ? new bool?(info.value) : ((bool?)null)); OverrideTree.GetTreeFromID(info.treeID).SetValue(keyId, value, netSender); } internal static void ReciveSetIntOverideTree(ulong netSender, pStructs.pIntOverideTreeInfo info) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown ZiMain.log.LogDebug((object)"Recived request to update int override tree!"); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(32, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("treeID:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.treeID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", keyId:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.keyId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", isNull:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.isNull); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", value:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.value); } log.LogDebug(val); uint keyId = info.keyId; int? value = ((!info.isNull) ? new int?(info.value) : ((int?)null)); OverrideTree.GetTreeFromID(info.treeID).SetValue(keyId, value, netSender); } internal static void ReciveSetFloatOverideTree(ulong netSender, pStructs.pFloatOverideTreeInfo info) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown ZiMain.log.LogDebug((object)"Recived request to update float override tree!"); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(32, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("treeID:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.treeID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", keyId:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.keyId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", isNull:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.isNull); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", value:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.value); } log.LogDebug(val); uint keyId = info.keyId; float? value = ((!info.isNull) ? new float?(info.value) : ((float?)null)); OverrideTree.GetTreeFromID(info.treeID).SetValue(keyId, value, netSender); } internal static void ReciveRequestToMoveToLocation(ulong netsender, pStructs.pLocationInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00b1: 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) ZiMain.log.LogInfo((object)"Recived request to move!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.BotAgent); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.Commander); Vector3 position = info.position; if ((Object)(object)val == (Object)null) { ZiMain.log.LogError((object)"Invalid request to move: bot agent is null."); return; } if ((Object)(object)val2 == (Object)null) { ZiMain.log.LogError((object)"Invalid request to move: Commander is null."); return; } ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(27, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to move to "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(position); } log.LogInfo(val3); if (!val.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to move, You can't tell a player what to do."); return; } PlayerAIBot component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { zBotActions.SendbotToMoveToLocation(component, position, val2, netsender, info.ID); } } internal static void ReciveRequestToPickupMine(ulong sender, pStructs.pPickupMineInfo info) { //IL_0018: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to pickup mine!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); MineDeployerInstance val2 = null; PlayerAgent val4; if (info.MineReplicatorKey != 0) { IReplicator val3 = default(IReplicator); SNet_Replication.TryGetReplicator(info.MineReplicatorKey, ref val3); val2 = val3.ReplicatorSupplier.gameObject.GetComponent(); val4 = ((Item)val2).Owner; } else { val4 = pStructs.Get_RefFrom_pStruct(info.BotAgent); } if ((Object)(object)val4 == (Object)null || (Object)(object)val == (Object)null) { ZiMain.log.LogError((object)"Invalid request to pickup mine: agent, item or commander is null."); return; } bool flag = default(bool); if ((Object)(object)val2 != (Object)null) { ManualLogSource log = ZiMain.log; BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(40, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val4.PlayerName); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" to pickup their mine at "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(((Component)val2).transform.position); } log.LogInfo(val5); } else { ManualLogSource log2 = ZiMain.log; BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(41, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(val4.PlayerName); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" to pickup all their mines"); } log2.LogInfo(val5); } if (!val4.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to pickup mine, You can't tell a player what to do."); } else { zBotActions.SendBotToPickUpMine(((Component)val4).GetComponent(), val2, val, sender, info.ID); } } internal static void ReciveRequestToPickupItem(ulong sender, pStructs.pPickupItemInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0055: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown ZiMain.log.LogInfo((object)"Recived request to pickup item!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.playerAgent); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.commander); GameObject val3 = pStructs.Get_RefFrom_pStruct(info.item); bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4; if ((Object)(object)val3 != (Object)null) { ManualLogSource log = ZiMain.log; val4 = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Gobject name: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(((Object)val3).name); } log.LogInfo(val4); } ItemInLevel component = val3.GetComponent(); if ((Object)(object)component == (Object)null) { ManualLogSource log2 = ZiMain.log; val4 = new BepInExInfoLogInterpolatedStringHandler(21, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Item in level is null"); } log2.LogInfo(val4); } if ((Object)(object)component == (Object)null || (Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { ZiMain.log.LogError((object)"Invalid request to pickup item: agent, item or commander is null."); return; } ManualLogSource log3 = ZiMain.log; val4 = new BepInExInfoLogInterpolatedStringHandler(28, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to pickup a "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(((Item)component).PublicName); } log3.LogInfo(val4); if (!val.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to pickup item, You can't tell a player what to do."); } else { zBotActions.SendBotToPickupItem(((Component)val).gameObject.GetComponent(), component, val2, sender, info.ID); } } internal static void ReciveRequestToReviveAgent(ulong sender, pStructs.pReviveAgentInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0077: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown ZiMain.log.LogInfo((object)"Recived request to revive agent!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Revier); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.Downed); PlayerAgent val3 = pStructs.Get_RefFrom_pStruct(info.commander); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { ZiMain.log.LogError((object)"Invalid request to revive agent: Reviver, Downed or Commander is null."); return; } ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(26, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val3.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to revive "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); } log.LogInfo(val4); if (!val.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to revive agent. You can't tell a player what to do."); return; } PlayerAIBot component = ((Component)val).GetComponent(); if ((Object)(object)component == (Object)null) { ManualLogSource log2 = ZiMain.log; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(92, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Invalid Request to revive agent. PlayerAiBot not found on revier. This should never happen!"); } log2.LogError(val5); } else { zBotActions.SendBotToReviveAgent(component, val2, val3, sender, info.ID); } } internal static void ReciveRequestToShareResource(ulong netSender, pStructs.pShareResourceInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0076: Expected O, but got Unknown ZiMain.log.LogInfo((object)"Recived request to share resoruce!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.sender); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.receiver); PlayerAgent val3 = pStructs.Get_RefFrom_pStruct(info.commander); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { ZiMain.log.LogError((object)"Invalid request to share resource: sender, reciver or commander is null."); return; } ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(40, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val3.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to share resoruces with "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); } log.LogInfo(val4); if (!val.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to share resource, You can't tell a player what to do."); } else { zBotActions.SendBotToShareResourcePack(((Component)val).gameObject.GetComponent(), val2, val3, netSender, info.ID); } } [Obsolete] internal static void ReciveRequestToKillEnemy(ulong netSender, pStructs.pAttackEnemyInfo info) { } internal static void ReciveRequestToPickupSentry(ulong netSender, pStructs.pPickupSentryInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown ZiMain.log.LogInfo((object)"Recived request to pick up sentry!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.playerAgent); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.commander); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { ZiMain.log.LogError((object)"Invalid request to pick up sentry: agent or commander is null."); return; } ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(40, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to pick up their turret!"); } log.LogInfo(val3); if (!val.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to pickup sentry, You can't tell a player what to do."); return; } PlayerAIBot component = ((Component)val).gameObject.GetComponent(); PlayerVoiceManager.WantToSay(val2.CharacterID, EVENTS.PLAY_CL_PICKUPYOURDEPLOYABLES); zStaticRefrences.Subtitles.ShowSingleLineSubtitle("Pick up your deployables.", 1f); zBotActions.SendBotToPickUpSentry(component, val2, netSender, info.ID); } internal static void ReciveRequestToPlaceSentry(ulong netSender, pStructs.pPlaceToolInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to place a sentry!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.playerAgent); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.commander); Pose pose = info.Pose; if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { ZiMain.log.LogError((object)"Invalid request to place turret: agent, commander or pose is null."); return; } ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(38, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to place their turret!"); } log.LogInfo(val3); if (!val.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to place turret, You can't tell a player what to do."); } else { zBotActions.SendBotToPlaceSentry(((Component)val).gameObject.GetComponent(), pose, val2, netSender, info.ID); } } internal static void ReciveRequestToThrowItem(ulong netSender, pStructs.pThrowDataInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0037: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0086: 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_00c6: 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) ZiMain.log.LogInfo((object)"Recived request to throw item!"); if (SNet.IsMaster) { PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.Agent); Vector3 movePosition = info.MovePosition; Vector3 targetPosition = info.TargetPosition; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(51, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to throw their consumable from "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(movePosition); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(targetPosition); } log.LogInfo(val3); if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to throw item, You can't tell a player what to do."); } else { zBotActions.SendBotToThrowItem(val, val2, movePosition, targetPosition, netSender, info.ID); } } } internal static void ReciveRequestToUseCfoam(ulong netSender, pStructs.pUseCfoamInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_008b: 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_00cf: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to use cfoam launcher!"); if (SNet.IsMaster) { PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.Agent); Vector3 position = ((Component)val).transform.position; Vector3 position2 = info.position; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(48, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to use their cfoam gun from "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(position); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(position2); } log.LogInfo(val3); if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to use cfoam launcher, You can't tell a player what to do."); } else { zBotActions.SendBotToUseCfoamGun(((Component)val2).GetComponent(), position2, val, netSender, info.ID); } } } internal static void ReciveRequestToPlaceMine(ulong netSender, pStructs.pPlaceMineInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0037: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0086: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to place mine!"); if (SNet.IsMaster) { PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.Agent); Pose pose = info.pose; InventorySlot slot = info.slot; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(49, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to use place their mine from "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(slot); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(info.pose); } log.LogInfo(val3); if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to place mines, You can't tell a player what to do."); } else { zBotActions.SendBotToPlaceMine(((Component)val2).GetComponent(), pose, slot, val, netSender, info.ID); } } } internal static void ReciveRequestToBreakLock(ulong netSender, pStructs.pBreakLockInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_00ae: 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) ZiMain.log.LogInfo((object)"Recived request to break lock!"); if (SNet.IsMaster) { PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.BotAgent); IReplicator val3 = default(IReplicator); ((pReplicator)(ref info.Lock.pRep)).TryGetID(ref val3); GameObject gameObject = val3.ReplicatorSupplier.gameObject; LG_WeakLock component = gameObject.GetComponent(); MethodEnum method = info.Method; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(41, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to use break the lock at "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(gameObject.transform.position); } log.LogInfo(val4); if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to break lock, You can't tell a player what to do."); } else { zBotActions.SendbotToBreakLock(((Component)val2).GetComponent(), component, method, val, netSender, info.ID); } } } internal static void ReciveRequestToSetLeader(ulong netSender, pStructs.pLeaderInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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: Expected O, but got Unknown ZiMain.log.LogInfo((object)"Recived request to set leader!"); if (SNet.IsMaster) { PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.follower); PlayerAgent val3 = pStructs.Get_RefFrom_pStruct(info.leader); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(26, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to follow "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val3.PlayerName); } log.LogInfo(val4); zBotActions.SetLeader(val2, val3, val, netSender); } } internal static void ReciveActionTerminated(ulong netsender, pStructs.pActionTerminatedInfo info) { if (SNet.IsMaster) { return; } foreach (ManualAction item in zActions.manualActions[zStaticRefrences.LocalPlayer.CharacterID]) { if (item.ID == info.ID) { zActions.manualActions[zStaticRefrences.LocalPlayer.CharacterID].Remove(item); break; } } } internal static void ReciveRequestActionCancel(ulong netsender, pStructs.pActionTerminatedInfo info) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Recived request to cancel action "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(info.ID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!"); } log.LogInfo(val); if (!SNet.IsMaster) { return; } foreach (int key in zActions.manualActions.Keys) { foreach (ManualAction item in zActions.manualActions[key]) { if (item.ID == info.ID) { zBotActions.CancelBotAction(info.ID, netsender); ManualLogSource log2 = ZiMain.log; val = new BepInExInfoLogInterpolatedStringHandler(36, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Remotely canceld "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item.Commander.PlayerName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'s command for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item.Bot.Agent.PlayerName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)item.ActionDescriptor).GetIl2CppType().FullName); } log2.LogInfo(val); return; } } } ManualLogSource log3 = ZiMain.log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(22, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Could not find action "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(info.ID); } log3.LogWarning(val2); } internal static void ReciveRequestToKillSleeper(ulong netSender, pStructs.pAttackEnemyInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to kill sleeper!"); if (SNet.IsMaster) { PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.BotAgent); EnemyAgent val3 = pStructs.Get_RefFrom_pStruct(info.Enemy); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(32, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to kill the "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(((GameDataBlockBase)(object)val3.EnemyData).name); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" at "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(((Component)val3).transform.position); } log.LogInfo(val4); if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to attack sleeper, You can't tell a player what to do."); } else { zBotActions.SendBotToAttackSleeper(((Component)val2).GetComponent(), val3, val, netSender, info.ID); } } } internal static void ReciveRequestToDropHere(ulong netSender, pStructs.pLocationInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0079: 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) ZiMain.log.LogInfo((object)"Recived request to drop here!"); if (SNet.IsMaster) { PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.BotAgent); Vector3 position = info.position; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(38, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to drop their item at "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(position); } log.LogInfo(val3); if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to drop here, You can't tell a player what to do."); } else { zBotActions.SendBotToDropHere(((Component)val2).GetComponent(), position, val, netSender, info.ID); } } } internal static void ReciveRequestToInsertCell(ulong netSender, pStructs.pLocationInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0036: 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_0064: Expected O, but got Unknown //IL_009c: 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_00c3: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to insert cell!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.BotAgent); Vector3 position = info.position; Component obj = zSearch.FindNearest(position, Il2CppType.Of(), 0.5f); LG_PowerGenerator_Core val3 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(34, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to insert cell at "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(position); } log.LogInfo(val4); if ((Object)(object)val3 == (Object)null) { ManualLogSource log2 = ZiMain.log; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Failed to find generator at "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(position); } log2.LogError(val5); } else if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to insert cell, You can't tell a player what to do."); } else { zBotActions.SendBotToInsertCell(((Component)val2).GetComponent(), val3, val, netSender, info.ID); } } internal static void ReciveRequestToOpenContainer(ulong netSender, pStructs.pLocationInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0036: 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_0064: Expected O, but got Unknown //IL_009c: 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_00c3: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to open container!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.BotAgent); Vector3 position = info.position; Component obj = zSearch.FindNearest(position, Il2CppType.Of(), 0.5f); LG_WeakResourceContainer val3 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(41, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to open the container at "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(position); } log.LogInfo(val4); if ((Object)(object)val3 == (Object)null) { ManualLogSource log2 = ZiMain.log; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Failed to find container at "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(position); } log2.LogError(val5); } else if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to open container, You can't tell a player what to do."); } else { zBotActions.SendBotToOpenContainer(((Component)val2).GetComponent(), val3, val, netSender, info.ID); } } internal static void ReciveRequestToRefillSentry(ulong netSender, pStructs.pLocationInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0036: 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_0064: Expected O, but got Unknown //IL_009c: 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_00c3: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to refill sentry!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.BotAgent); Vector3 position = info.position; Component obj = zSearch.FindNearest(position, Il2CppType.Of(), 0.5f); SentryGunInstance val3 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(40, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to refill the sentry at "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(position); } log.LogInfo(val4); if ((Object)(object)val3 == (Object)null) { ManualLogSource log2 = ZiMain.log; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Failed to find sentry at "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(position); } log2.LogError(val5); } else if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to refill sentry, You can't tell a player what to do."); } else { zBotActions.SendBotToRefillSentry(((Component)val2).GetComponent(), val3, val, netSender, info.ID); } } internal static void ReciveRequestToInteractDoor(ulong netSender, pStructs.pDoorInteractInfo info) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0037: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0074: Expected O, but got Unknown //IL_00ac: 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_00d4: Expected O, but got Unknown //IL_0119: 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_00e6: Unknown result type (might be due to invalid IL or missing references) ZiMain.log.LogInfo((object)"Recived request to interact with door!"); if (!SNet.IsMaster) { return; } PlayerAgent val = pStructs.Get_RefFrom_pStruct(info.Commander); PlayerAgent val2 = pStructs.Get_RefFrom_pStruct(info.BotAgent); Vector3 doorPosition = info.DoorPosition; Vector3 targetPosition = info.TargetPosition; MethodEnum method = info.Method; Component obj = zSearch.FindNearest(doorPosition, Il2CppType.Of(), 0.5f); LG_WeakDoor val3 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null); ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(40, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" wants to tell "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val2.PlayerName); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to refill the sentry at "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(doorPosition); } log.LogInfo(val4); if ((Object)(object)val3 == (Object)null) { ManualLogSource log2 = ZiMain.log; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Failed to find door at "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(doorPosition); } log2.LogError(val5); } else if (!val2.Owner.IsBot) { ZiMain.log.LogWarning((object)"Invalid request to interact with door, You can't tell a player what to do."); } else { zBotActions.SendBotToInteractDoor(((Component)val2).GetComponent(), val3, targetPosition, method, val, netSender, info.ID); } } } } namespace BotControl.Menus { public static class AttackMenuClass { public static sMenu attackMenu; public static sMenu.sMenuNode attackNode; public static sMenu.sMenuNode meleeNode; public static sMenu.sMenuNode bulletNode; public static sMenu.sMenuNode secondaryNode; public static List meansBlackList = new List { (AttackMeansEnum)8, (AttackMeansEnum)2, (AttackMeansEnum)16 }; public unsafe static void Setup(sMenu menu) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) attackMenu = menu; attackNode = menu.GetNode(); attackMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); attackMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, attackMenu.parrentMenu.Open); foreach (AttackMeansEnum means in AttackActionPatch.meansList) { string text = "attackMeans" + ((object)(*(AttackMeansEnum*)(&means))/*cast due to .constrained prefix*/).ToString(); OverrideTree.Node node = zSlideComputer.ActionPermissions.AddNode(text, null, "Attack", null, null, null, hasDefaultValue: true); if (!meansBlackList.Contains(means)) { sMenu.sMenuNode sMenuNode = attackMenu.AddNode(((object)(*(AttackMeansEnum*)(&means))/*cast due to .constrained prefix*/).ToString()); node.onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { text, sMenuNode }); sMenuNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text, sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text); attackMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text); } } attackMenu.AddPannel(sMenu.sMenuPannel.Side.top, "This controls if the bots are allowed to atack"); attackMenu.AddPannel(sMenu.sMenuPannel.Side.top, "And what they are allowed to attack with"); attackMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "These settings are a bit janky atm."); attackMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Especially when changed in the middle of combat."); attackMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "I'm pretty sure that's not the fault of the mod."); attackMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "I'd like to see if I can improve it anyway."); } } public static class BioTrackerMenuClass { public static sMenu bioTrackerMenu; public static sMenu.sMenuNode bioTrackerNode; public static void Setup(sMenu menu) { bioTrackerMenu = menu; bioTrackerNode = menu.GetNode(); bioTrackerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); bioTrackerNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, bioTrackerMenu.Open); bioTrackerMenu.AddPannel(sMenu.sMenuPannel.Side.top, "This controls if bots will ping active enemies with a bio tracker."); bioTrackerMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Also controls their voicelines for nearby enemies."); bioTrackerMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Does nothing if no bots have a biotracker equiped."); bioTrackerMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "This menu has no settings (yet?)"); bioTrackerMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Not even sure what kind of settings you'd want?"); } } public static class ChatSettingsMenu { public static sMenu SettingsMenu; public static Color onColor = new Color(0f, 0.2f, 0f); public static sMenu Menu; public static List<(sMenu.sMenuNode Node, string ActionKey)> subNodes = new List<(sMenu.sMenuNode, string)>(); public static string chatPermsString = "TalkInChat"; public static string AcknowlageString = "NotifyActionAcknowlage"; public static string SuccessString = "NotifyActionSuccess"; public static string FailString = "NotifyActionFail"; public static void Setup(sMenu _Menu) { sMenu.sMenuNode sMenuNode = _Menu.AddNode("Fail"); sMenu.sMenuNode sMenuNode2 = _Menu.AddNode("Success"); sMenu.sMenuNode sMenuNode3 = _Menu.AddNode("Acknowlage"); _Menu.AddCatagory("States"); _Menu.AddCatagory("Actions"); _Menu.AddNodeToCatagory("States", "Fail"); _Menu.AddNodeToCatagory("States", "Success"); _Menu.AddNodeToCatagory("States", "Acknowlage"); sMenuNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), FailString, sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), FailString); _Menu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetToDefault), sMenuNode, FailString); sMenuNode2.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), SuccessString, sMenuNode2); sMenuNode2.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), SuccessString); _Menu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetToDefault), sMenuNode2, SuccessString); sMenuNode3.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), AcknowlageString, sMenuNode3); sMenuNode3.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), AcknowlageString); _Menu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetToDefault), sMenuNode3, AcknowlageString); zSlideComputer.ActionPermissions.AddNode(FailString, null, chatPermsString, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { FailString, sMenuNode }); zSlideComputer.ActionPermissions.GetNodeFromIdent(FailString).onChanged.Listen(UpdateAllSubnodes); zSlideComputer.ActionPermissions.GetNodeFromIdent(FailString).onChanged.Listen(new <>f__AnonymousDelegate0>(AutomaticActionMenuClass.ApplyTextEffectsToNode), new object[2] { sMenuNode, FailString }); zSlideComputer.ActionPermissions.AddNode(SuccessString, null, chatPermsString, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { SuccessString, sMenuNode2 }); zSlideComputer.ActionPermissions.GetNodeFromIdent(SuccessString).onChanged.Listen(UpdateAllSubnodes); zSlideComputer.ActionPermissions.GetNodeFromIdent(SuccessString).onChanged.Listen(new <>f__AnonymousDelegate0>(AutomaticActionMenuClass.ApplyTextEffectsToNode), new object[2] { sMenuNode2, SuccessString }); zSlideComputer.ActionPermissions.AddNode(AcknowlageString, null, chatPermsString, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { AcknowlageString, sMenuNode3 }); zSlideComputer.ActionPermissions.GetNodeFromIdent(AcknowlageString).onChanged.Listen(UpdateAllSubnodes); zSlideComputer.ActionPermissions.GetNodeFromIdent(AcknowlageString).onChanged.Listen(new <>f__AnonymousDelegate0>(AutomaticActionMenuClass.ApplyTextEffectsToNode), new object[2] { sMenuNode3, AcknowlageString }); Menu = _Menu; HashSet allPressTypes = PressTypeManager.GetAllPressTypes(); PrioritySet val = new PrioritySet(); foreach (IPressType item in allPressTypes) { PrioritySet allActions = item.GetAllActions(); val.UnionWith((IEnumerable)allActions); } foreach (string item2 in (from x in (IEnumerable)val where x.Enabled select x.FriendlyIdentifier).ToHashSet()) { SetupNode(_Menu, item2); } _Menu.radius = 130f; _Menu.setNodeSize(0.75f); _Menu.SetCatagory("States"); } public static void ResetToDefault(sMenu.sMenuNode Node, string ActonKey) { if (Node.gameObject.activeInHierarchy) { zSlideComputer.ActionPermissions.ResetToDefault(ActonKey, 0uL); } } public static string StripRichText(string text) { return Regex.Replace(text, "<.*?>", string.Empty); } public static void UpdateAllSubnodes() { foreach (var subNode in subNodes) { AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay(subNode.ActionKey, subNode.Node); } } private static void SetupNode(sMenu parentMenu, string nodeName) { string text = nodeName + chatPermsString; sMenu.sMenuNode sMenuNode = parentMenu.AddNode(nodeName); zSlideComputer.ActionPermissions.AddNode(text, null, chatPermsString, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { text, sMenuNode }); sMenu sMenu = sMenuManager.createMenu(nodeName, parentMenu, autoAddNode: false); sMenuNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, sMenu.Open); sMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); sMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, sMenu.parrentMenu.Open); sMenu.sMenuNode sMenuNode2 = sMenu.AddNode("Fail"); sMenuNode2.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text + FailString, sMenuNode2); sMenuNode2.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text + FailString); sMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetToDefault), sMenuNode2, text + FailString); zSlideComputer.ActionPermissions.AddNode(text + FailString, null, text, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { text + FailString, sMenuNode2 }); subNodes.Add((sMenuNode2, text + FailString)); sMenu.sMenuNode sMenuNode3 = sMenu.AddNode("Success"); sMenuNode3.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text + SuccessString, sMenuNode3); sMenuNode3.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text + SuccessString); sMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetToDefault), sMenuNode3, text + SuccessString); zSlideComputer.ActionPermissions.AddNode(text + SuccessString, null, text, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { text + SuccessString, sMenuNode3 }); subNodes.Add((sMenuNode3, text + SuccessString)); sMenu.sMenuNode sMenuNode4 = sMenu.AddNode("Acknowlage"); sMenuNode4.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text + AcknowlageString, sMenuNode4); sMenuNode4.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text + AcknowlageString); sMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetToDefault), sMenuNode4, text + AcknowlageString); zSlideComputer.ActionPermissions.AddNode(text + AcknowlageString, null, text, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[2] { text + AcknowlageString, sMenuNode4 }); subNodes.Add((sMenuNode4, text + AcknowlageString)); zSlideComputer.ActionPermissions.AddFallback(text + FailString, FailString); zSlideComputer.ActionPermissions.AddFallback(text + SuccessString, SuccessString); zSlideComputer.ActionPermissions.AddFallback(text + AcknowlageString, AcknowlageString); sMenuNode.AddListener(sMenuManager.nodeEvent.OnTappedExclusive, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text, sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text); parentMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetToDefault), sMenuNode, text); parentMenu.AddNodeToCatagory("Actions", nodeName); } } public static class DebugMenuClass { public enum DebugValueToChange { NodeGridSize, NodeMapSize, NodeVisitDistance, PropigationAmmount, PropigationSampleCount, NodesCreatedPerFrame, connectionChecksPerFrame } public static class CullingMenuClass { public static void setupCullingMenu(sMenu menu) { for (int i = 0; i < 32; i++) { string text = LayerMask.LayerToName(i); if (!string.IsNullOrEmpty(text)) { Camera main = Camera.main; sMenu.sMenuNode sMenuNode = menu.AddNode(text); sMenuNode.AddListener(sMenuManager.nodeEvent.OnUnpressedSelected, new Action(ToggleLayer), main, i, sMenuNode); } } } public static void ToggleLayer(Camera camera, int layer, sMenu.sMenuNode node) { //IL_0083: 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) if ((Object)(object)camera == (Object)null) { Debug.LogWarning(Object.op_Implicit("Camera is null!")); return; } if (layer < 0 || layer > 31) { Debug.LogWarning(Object.op_Implicit("Layer index out of range (0-31)!")); return; } camera.cullingMask ^= 1 << layer; if ((camera.cullingMask & (1 << layer)) != 0) { node.SetColor(new Color(0f, 0.2f, 0f)); } else { node.SetColor(new Color(0.2f, 0f, 0f)); } } } public static sMenu debugMenu; public static sMenu debugNodeMenu; public static sMenu debugNodeSettingsMenu; public static sMenu debugCameraCullingMenu; public static sMenu debugHooksEnabled; public static void Setup(sMenu menu) { debugMenu = menu; debugNodeMenu = sMenuManager.createMenu("Nodes", debugMenu); debugNodeSettingsMenu = sMenuManager.createMenu("Settings", debugNodeMenu); debugCameraCullingMenu = sMenuManager.createMenu("Camera culling", debugMenu); debugHooksEnabled = sMenuManager.createMenu("UseHooks", debugMenu); debugMenu.AddNode("Show title prompt", InGameTitle.DisplayDefault).AddListener(sMenuManager.nodeEvent.OnUnpressedSelected, new Func(debugMenu.Close)); debugMenu.AddNode("ChecVis").AddListener(sMenuManager.nodeEvent.OnUnpressedSelected, zDebug.setCheckVizTarget).AddListener(sMenuManager.nodeEvent.OnUnpressedSelected, zDebug.debugCheckViz) .AddListener(sMenuManager.nodeEvent.OnHeldImmediate, zDebug.toggleVisCheck) .AddListener(sMenuManager.nodeEvent.OnHeldImmediate, sMenuManager.CloseAllMenus) .AddListener(sMenuManager.nodeEvent.OnTappedExclusive, sMenuManager.CloseAllMenus) .AddListener(sMenuManager.nodeEvent.OnDoubleTapped, new Action(zDebug.setVisCheck), false) .AddListener(sMenuManager.nodeEvent.OnDoubleTapped, sMenuManager.CloseAllMenus); debugMenu.AddNode("Find unexplored", new <>f__AnonymousDelegate1(zDebug.MarkUnexploredArea)); debugMenu.AddNode("SendBotToExplore", zDebug.SendClosestBotToExplore); debugMenu.AddNode("Show corners", zDebug.debugCorners); debugNodeMenu.AddNode("Node I'm looking at", new Func(zDebug.GetNodeImLookingAT), sMenuManager.mainMenu.gameObject.transform); debugNodeMenu.AddNode("Toggle Nodes", zDebug.ToggleNodes); debugNodeMenu.AddNode("Toggle Connections", zDebug.ToggleConnections); debugNodeMenu.AddNode("Toggle Node Info", zDebug.ToggleNodeInfo); debugNodeSettingsMenu.radius = 130f; debugHooksEnabled.AddNode("Use get item priority", toggleUseItemPrio); debugHooksEnabled.AddNode("Use updatePickupAction", toggleUsePickupAction); sMenu.sMenuNode sMenuNode = debugNodeSettingsMenu.AddNode("Grid Size"); sMenuNode.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate2(ChangeValueBasedOnMouseWheel), DebugValueToChange.NodeGridSize, sMenuNode, 0.1f); sMenuNode.SetSubtitle($"{zVisitedManager.NodeGridSize}"); sMenu.sMenuNode sMenuNode2 = debugNodeSettingsMenu.AddNode("Map Grid Size"); sMenuNode2.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate2(ChangeValueBasedOnMouseWheel), DebugValueToChange.NodeMapSize, sMenuNode2, 1f); sMenuNode2.SetSubtitle($"{zVisitedManager.NodeMapGridSize}"); sMenu.sMenuNode sMenuNode3 = debugNodeSettingsMenu.AddNode("Visit distnace"); sMenuNode3.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate2(ChangeValueBasedOnMouseWheel), DebugValueToChange.NodeVisitDistance, sMenuNode3, 0.5f); sMenuNode3.SetSubtitle($"{zVisitedManager.NodeVisitDistance}"); sMenu.sMenuNode sMenuNode4 = debugNodeSettingsMenu.AddNode("Propigation ammount"); sMenuNode4.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate2(ChangeValueBasedOnMouseWheel), DebugValueToChange.PropigationAmmount, sMenuNode4, 1f); sMenuNode4.SetSubtitle($"{zVisitedManager.propigationAmmount}"); sMenu.sMenuNode sMenuNode5 = debugNodeSettingsMenu.AddNode("Propigation sample count"); sMenuNode5.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate2(ChangeValueBasedOnMouseWheel), DebugValueToChange.PropigationSampleCount, sMenuNode5, 1f); sMenuNode5.SetSubtitle($"{zVisitedManager.propigationSampleCount}"); sMenu.sMenuNode sMenuNode6 = debugNodeSettingsMenu.AddNode("Nodes per frame"); sMenuNode6.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate2(ChangeValueBasedOnMouseWheel), DebugValueToChange.NodesCreatedPerFrame, sMenuNode6, 1f); sMenuNode6.SetSubtitle($"{zVisitedManager.nodesCreatedPerFrame}"); sMenu.sMenuNode sMenuNode7 = debugNodeSettingsMenu.AddNode("Connections per frame"); sMenuNode7.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate2(ChangeValueBasedOnMouseWheel), DebugValueToChange.connectionChecksPerFrame, sMenuNode7, 1f); sMenuNode7.SetSubtitle($"{zVisitedManager.connectionChecksPerFrame}"); CullingMenuClass.setupCullingMenu(debugCameraCullingMenu); debugCameraCullingMenu.radius = 140f; debugCameraCullingMenu.setNodeSize(0.5f); } private static void toggleUsePickupAction() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown PickupActionPatch.useUpdateActionCollectItem = !PickupActionPatch.useUpdateActionCollectItem; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Toggled pickup action hook: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(PickupActionPatch.useUpdateActionCollectItem); } log.LogInfo(val); } private static void toggleUseItemPrio() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown PickupActionPatch.useGetItemPrio = !PickupActionPatch.useGetItemPrio; ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Toggled item prio hook: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(PickupActionPatch.useGetItemPrio); } log.LogInfo(val); } public static void ChangeValueBasedOnMouseWheel(DebugValueToChange valueToChange, sMenu.sMenuNode node, float increment = 0.1f) { if (node == null || !node.gameObject.activeInHierarchy) { return; } float axis = Input.GetAxis("Mouse ScrollWheel"); int num = (int)Mathf.Sign(axis); if (axis != 0f) { float num2 = (float)num * increment; float value = 0f; switch (valueToChange) { case DebugValueToChange.NodeMapSize: zVisitedManager.SetNodeMapGridSize((int)num2 + zVisitedManager.NodeMapGridSize); value = zVisitedManager.NodeMapGridSize; break; case DebugValueToChange.NodeGridSize: zVisitedManager.SetNodeGridSize(num2 + zVisitedManager.NodeGridSize); value = zVisitedManager.NodeGridSize; break; case DebugValueToChange.NodeVisitDistance: zVisitedManager.SetNodeVisitDistance(num2 + zVisitedManager.NodeVisitDistance); value = zVisitedManager.NodeVisitDistance; break; case DebugValueToChange.PropigationAmmount: zVisitedManager.SetPropigationAmmount((int)num2 + zVisitedManager.propigationAmmount); value = zVisitedManager.propigationAmmount; break; case DebugValueToChange.PropigationSampleCount: zVisitedManager.SetPropigationSampleCount((int)num2 + zVisitedManager.propigationSampleCount); value = zVisitedManager.propigationSampleCount; break; case DebugValueToChange.NodesCreatedPerFrame: zVisitedManager.nodesCreatedPerFrame = Math.Max((int)num2 + zVisitedManager.nodesCreatedPerFrame, 1); value = zVisitedManager.nodesCreatedPerFrame; break; case DebugValueToChange.connectionChecksPerFrame: zVisitedManager.connectionChecksPerFrame = Math.Max((int)num2 + zVisitedManager.connectionChecksPerFrame, 1); value = zVisitedManager.connectionChecksPerFrame; break; default: Debug.LogWarning(Object.op_Implicit("Unknown DebugValueToChange: " + valueToChange)); break; } node.SetSubtitle($"{value}"); } } } public static class ExploreMenuClass { private static sMenu exploreMenu; private static sMenu.sMenuNode exploreNode; internal static void Setup(sMenu menu) { exploreMenu = menu; exploreNode = exploreMenu.parrentMenu.GetNode(exploreMenu.centerNode.text); exploreNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); exploreNode.AddListener(sMenuManager.nodeEvent.OnTapped, ToggleExplorePerms); exploreNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, exploreMenu.Open); } private static void ToggleExplorePerms() { } } public static class FollowMenuClass { private static sMenu followMenu; private static sMenu.sMenuNode followMenuNode; private static Dictionary stateNodes; private static Dictionary catagoryNodes; public static DRAMA_State previousState; public static Color currentStateColor; public static Color defaultColor; public static OverrideTree followRadius; public static OverrideTree maxDistance; private static List fightingStates; private static List ignoredStates; internal static void Setup(sMenu menu) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Invalid comparison between Unknown and I4 //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Invalid comparison between Unknown and I4 //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) defaultColor = menu.getTextColor(); currentStateColor = new Color(0f, 0.2f, 0f); followMenu = menu; followMenuNode = followMenu.GetNode(); previousState = DramaManager.CurrentStateEnum; FollowActionPatch.Setup(); fightingStates = new List(); ignoredStates = new List(); stateNodes = new Dictionary(); catagoryNodes = new Dictionary(); followRadius = new OverrideTree(7, "followRadius"); maxDistance = new OverrideTree(10, "maxDistance"); fightingStates.Add((DRAMA_State)6); fightingStates.Add((DRAMA_State)5); fightingStates.Add((DRAMA_State)8); fightingStates.Add((DRAMA_State)7); fightingStates.Add((DRAMA_State)3); ignoredStates.Add((DRAMA_State)1); ignoredStates.Add((DRAMA_State)0); zSlideComputer.ActionPriorities.AddNode("Fighting", null, "Follow", () => fightingStates.Contains(DramaManager.CurrentStateEnum), null, null, hasDefaultValue: true); zSlideComputer.ActionPriorities.AddNode("Stealth", null, "Follow", () => (int)DramaManager.CurrentStateEnum == 4, null, null, hasDefaultValue: true); zSlideComputer.ActionPriorities.AddNode("Explore", null, "Follow", () => (int)DramaManager.CurrentStateEnum == 2, null, null, hasDefaultValue: true); followRadius.AddNode("Follow", (int?)null, (string?)null, (Func?)null, (FlexibleMethodDefinition)null, (int?)null, hasDefaultValue: false); followRadius.AddNode("Fighting", null, "Follow", () => fightingStates.Contains(DramaManager.CurrentStateEnum), null, null, hasDefaultValue: true); followRadius.AddNode("Stealth", null, "Follow", () => (int)DramaManager.CurrentStateEnum == 4, null, null, hasDefaultValue: true); followRadius.AddNode("Explore", null, "Follow", () => (int)DramaManager.CurrentStateEnum == 2, null, null, hasDefaultValue: true); maxDistance.AddNode("Follow", (int?)null, (string?)null, (Func?)null, (FlexibleMethodDefinition)null, (int?)null, hasDefaultValue: false); maxDistance.AddNode("Fighting", null, "Follow", () => fightingStates.Contains(DramaManager.CurrentStateEnum), null, null, hasDefaultValue: true); maxDistance.AddNode("Stealth", null, "Follow", () => (int)DramaManager.CurrentStateEnum == 4, null, null, hasDefaultValue: true); maxDistance.AddNode("Explore", null, "Follow", () => (int)DramaManager.CurrentStateEnum == 2, null, null, hasDefaultValue: true); followRadius.nodes["Follow"].onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { followMenuNode }); maxDistance.nodes["Follow"].onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { followMenuNode }); catagoryNodes["Fighting"] = AddCatagoryNode("Fighting"); catagoryNodes["Stealth"] = AddCatagoryNode("Stealth"); catagoryNodes["Explore"] = AddCatagoryNode("Explore"); followMenu.AddCatagory("Basic"); followMenu.AddNodeToCatagory("Basic", "Fighting"); followMenu.AddNodeToCatagory("Basic", "Stealth"); followMenu.AddNodeToCatagory("Basic", "Explore"); followMenu.AddCatagory("Advanced"); followMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Controlls when and how closely the bots follow their leader."); followMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Top: Priority, how important is staying in range?"); followMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Bottom left: Range, how close should the bots be?"); followMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Bottom right: Max distance, When should bots sprint?"); followMenu.AddPannel(sMenu.sMenuPannel.Side.right, "Scroll => change setting"); followMenu.AddPannel(sMenu.sMenuPannel.Side.right, "Hold => reset"); foreach (DRAMA_State state in Enum.GetValues(typeof(DRAMA_State))) { if (ignoredStates.Contains(state)) { continue; } string parent = "Follow"; DRAMA_State val = state; if ((int)val != 2) { if ((int)val == 4) { parent = "Stealth"; } else if (fightingStates.Contains(val)) { parent = "Fighting"; } } else { parent = "Explore"; } sMenu.sMenuNode sMenuNode = followMenu.AddNode(((object)state/*cast due to .constrained prefix*/).ToString()); followRadius.AddNode(((object)state/*cast due to .constrained prefix*/).ToString(), null, parent, () => DramaManager.CurrentStateEnum == state); maxDistance.AddNode(((object)state/*cast due to .constrained prefix*/).ToString(), null, parent, () => DramaManager.CurrentStateEnum == state); followRadius.nodes[((object)state/*cast due to .constrained prefix*/).ToString()].onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { sMenuNode }); maxDistance.nodes[((object)state/*cast due to .constrained prefix*/).ToString()].onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { sMenuNode }); zSlideComputer.ActionPriorities.AddNode(((object)state/*cast due to .constrained prefix*/).ToString(), null, parent, () => DramaManager.CurrentStateEnum == state, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { sMenuNode }); zSlideComputer.ActionPermissions.AddNode(((object)state/*cast due to .constrained prefix*/).ToString(), null, parent, null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[2] { sMenuNode, ((object)state/*cast due to .constrained prefix*/).ToString() }); stateNodes[state] = sMenuNode; UpdateNodeSettingsDisplay(sMenuNode); sMenuNode.titlePart.SetScale(0.5f); sMenuNode.subtitlePart.SetScale(0.5f); sMenuNode.AddListener(sMenuManager.nodeEvent.WhileSelected, new Action(UpdateNodeBasedOnScroll), sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetSettings), sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), sMenuNode.text, sMenuNode); followMenu.AddNodeToCatagory("Advanced", sMenuNode); } followMenu.AddListener(sMenuManager.menuEvent.WhileOpened, new <>f__AnonymousDelegate3(UpdateHighlightedState)); followMenu.AddListener(sMenuManager.menuEvent.OnOpened, UpdateAllNodes); followMenu.AddListener(sMenuManager.menuEvent.OnCatagoryChanged, UpdateAllNodes); followMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); followMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, ResetAllLocalSettings); followMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, followMenu.parrentMenu.Open); followMenuNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); followMenuNode.ClearListeners(sMenuManager.nodeEvent.WhileSelected); followMenuNode.AddListener(sMenuManager.nodeEvent.WhileSelected, new Action(UpdateNodeBasedOnScroll), followMenuNode); followMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new Action(ResetSettings), followMenuNode); followMenuNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, followMenu.Open); followMenu.radius = 130f; AutomaticActionMenuClass.AutoActionMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new Action(ResetSettings), followMenuNode); UpdateNodeSettingsDisplay(followMenuNode); followMenu.SetCatagory("Basic"); } private static sMenu.sMenuNode AddCatagoryNode(string catagory) { sMenu.sMenuNode sMenuNode = followMenu.AddNode(catagory); zSlideComputer.ActionPriorities.nodes[catagory].onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { sMenuNode }); followRadius.nodes[catagory].onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { sMenuNode }); maxDistance.nodes[catagory].onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[1] { sMenuNode }); sMenuNode.titlePart.SetScale(0.5f); sMenuNode.subtitlePart.SetScale(0.5f); sMenuNode.AddListener(sMenuManager.nodeEvent.WhileSelected, new Action(UpdateNodeBasedOnScroll), sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetSettings), sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), catagory, sMenuNode); zSlideComputer.ActionPermissions.AddNode(catagory, null, "Follow", null, null, null, hasDefaultValue: true).onChanged.Listen(new <>f__AnonymousDelegate11(UpdateNodeSettingsDisplay), new object[2] { sMenuNode, catagory }); return sMenuNode; } internal static void ResetSettings(sMenu.sMenuNode node) { string text = node.text; zSlideComputer.ActionPermissions.SetValue(text, null, 0uL); zSlideComputer.ActionPriorities.SetValue(text, null, 0uL); followRadius.SetValue(text, null, 0uL); maxDistance.SetValue(text, null, 0uL); UpdateNodeSettingsDisplay(node); } private static void ResetAllLocalSettings() { foreach (sMenu.sMenuNode item in followMenu.currentCatagory) { ResetSettings(item); } } private static void UpdateHighlightedState(bool breakOnSameState = true) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_00ca: 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_00cd: Invalid comparison between Unknown and I4 //IL_0086: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_00d1: Invalid comparison between Unknown and I4 //IL_0097: 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_006a: 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_0050: 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_017e: 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_00ff: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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) if (breakOnSameState && previousState == DramaManager.CurrentStateEnum) { return; } if (followMenu.currentCatagoryName == "Advanced") { if (stateNodes.ContainsKey(DramaManager.CurrentStateEnum)) { if (stateNodes.ContainsKey(previousState)) { stateNodes[previousState].SetColor(defaultColor); } stateNodes[DramaManager.CurrentStateEnum].SetColor(currentStateColor); } else if (stateNodes.ContainsKey(previousState)) { stateNodes[previousState].SetColor(defaultColor); } } if (followMenu.currentCatagoryName == "Advanced") { DRAMA_State currentStateEnum = DramaManager.CurrentStateEnum; if ((int)currentStateEnum != 2) { if ((int)currentStateEnum == 4) { catagoryNodes["Stealth"].SetColor(currentStateColor); catagoryNodes["Fighting"].SetColor(defaultColor); catagoryNodes["Explore"].SetColor(defaultColor); } else if (fightingStates.Contains(currentStateEnum)) { catagoryNodes["Stealth"].SetColor(defaultColor); catagoryNodes["Fighting"].SetColor(currentStateColor); catagoryNodes["Explore"].SetColor(defaultColor); } } else { catagoryNodes["Stealth"].SetColor(defaultColor); catagoryNodes["Fighting"].SetColor(defaultColor); catagoryNodes["Explore"].SetColor(currentStateColor); } } previousState = DramaManager.CurrentStateEnum; } private static void UpdateNodeBasedOnScroll(sMenu.sMenuNode node) { //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_003c: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_00d0: Unknown result type (might be due to invalid IL or missing references) float axis = Input.GetAxis("Mouse ScrollWheel"); float num = (int)Mathf.Sign(axis); if (axis != 0f) { string text = node.text; Vector3 val = Camera.main.WorldToViewportPoint(node.gameObject.transform.position); val = Vector2.op_Implicit(new Vector2(val.x - 0.5f, val.y - 0.5f) * -1f); if (val.y > Math.Abs(val.x)) { num *= 0.1f; float num2 = zSlideComputer.ActionPriorities.ValueAt(text).Value + num; num2 = (float)Math.Round(num2, 1); zSlideComputer.ActionPriorities.SetValue(text, Math.Clamp(num2, 1f, 15f), 0uL); } else if (val.x > 0f) { int value = Math.Clamp(maxDistance.ValueAt(text).Value + (int)num, followRadius.ValueAt(text).Value, 60); maxDistance.SetValue(text, value, 0uL); } else { followRadius.SetValue(text, Math.Clamp(followRadius.ValueAt(text).Value + (int)num, 1, maxDistance.ValueAt(text).Value), 0uL); } UpdateNodeSettingsDisplay(node); } } private static void UpdateAllNodes() { foreach (sMenu.sMenuNode node in followMenu.nodes) { UpdateNodeSettingsDisplay(node); } } private static void UpdateNodeSettingsDisplay(sMenu.sMenuNode node, string actionKey = null) { int? num = maxDistance.ValueAt("Follow"); if (num < PickupMenuClass.pickupDistance.ValueAt("Pickup")) { PickupMenuClass.pickupDistance.SetValue("Pickup", num, 0uL); } if (actionKey == null) { actionKey = node.text; } List extraTrees = new List { followRadius, maxDistance }; AutomaticActionMenuClass.GenericUpdateNodePrioDisplay(node); AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay(actionKey, node); AutomaticActionMenuClass.ApplyTextEffectsToNode(node, actionKey, extraTrees); node.SetSubtitle($"Range [{followRadius.ValueAt(actionKey)}/{maxDistance.ValueAt(actionKey)}]"); } } public static class PickupMenuClass { public static sMenu pickupMenu; public static sMenu.sMenuNode pickupNode; public static OverrideTree pickupDistance; public static Color dropEnabledColor = new Color(0f, 0.2f, 0f, 1f); public static string glowstickNameToUse = PickupActionPatch.shortGlowStickNames.FirstOrDefault(); public static void Setup(sMenu menu) { //IL_045f: Unknown result type (might be due to invalid IL or missing references) pickupDistance = new OverrideTree(10, "pickupDistance"); pickupMenu = menu; pickupMenu.radius = 125f; pickupNode = pickupMenu.GetNode(); pickupDistance.AddNode("Pickup", null, "Default").onChanged.Listen(SetSearchDistance).Listen(new Action(UpdateNodeSettingsDisplay), new object[1] { pickupNode }); sMenu.sMenuNode sMenuNode = null; string text = "Pickup" + glowstickNameToUse; foreach (string fullItemName in PickupActionPatch.fullItemNameList) { ItemDataBlock block = GameDataBlockBase.GetBlock(fullItemName); string publicName = block.publicName; string text2 = "Pickup" + fullItemName; sMenu.sMenuNode sMenuNode2 = null; uint persistentID = ((GameDataBlockBase)(object)block).persistentID; bool flag = PickupActionPatch.fullGlowStickNames.Contains(fullItemName); if (flag) { bool flag2 = sMenuNode != null; if (!flag2) { sMenuNode = pickupMenu.AddNode(glowstickNameToUse); zSlideComputer.ActionPriorities.AddNode(text, 10f, "Pickup", null, null, 10f).onChanged.Listen(new Action(updateNodeDisplay), new object[2] { glowstickNameToUse, sMenuNode }); zSlideComputer.ActionPermissions.AddNode(text, null, "Pickup", null, null, null, hasDefaultValue: true).onChanged.Listen(new Action(updateNodeDisplay), new object[2] { glowstickNameToUse, sMenuNode }); zSlideComputer.ActionPermissions.AddNode("Drop" + glowstickNameToUse, true, "Drop", null, null, true, hasDefaultValue: true).onChanged.Listen(new Action(updateNodeDisplay), new object[2] { glowstickNameToUse, sMenuNode }); } zSlideComputer.ActionPermissions.AddNode(text2, null, text, null, null, null, hasDefaultValue: true); zSlideComputer.ActionPriorities.AddNode(text2, null, text, null, null, null, hasDefaultValue: true); zSlideComputer.ActionPermissions.AddNode("Drop" + fullItemName, true, "Drop" + glowstickNameToUse, null, null, true, hasDefaultValue: true); sMenuNode2 = sMenuNode; if (flag2) { continue; } } else { float value = 0f; if (RootPlayerBotAction.s_itemBasePrios.ContainsKey(persistentID)) { value = RootPlayerBotAction.s_itemBasePrios[persistentID]; } sMenuNode2 = pickupMenu.AddNode(publicName); zSlideComputer.ActionPriorities.AddNode(text2, value, "Pickup", null, null, value).onChanged.Listen(new Action(updateNodeDisplay), new object[2] { fullItemName, sMenuNode2 }); zSlideComputer.ActionPermissions.AddNode(text2, null, "Pickup", null, null, null, hasDefaultValue: true).onChanged.Listen(new Action(updateNodeDisplay), new object[2] { fullItemName, sMenuNode2 }); zSlideComputer.ActionPermissions.AddNode("Drop" + fullItemName, true, "Drop", null, null, true, hasDefaultValue: true).onChanged.Listen(new Action(updateNodeDisplay), new object[2] { fullItemName, sMenuNode2 }); if (!PlayerAIBot.s_recognisedItemTypes.Contains(persistentID)) { PlayerAIBot.s_recognisedItemTypes.Add(persistentID); } } string text3 = AutomaticActionMenuClass.ApplyTextEffect("Drop", AutomaticActionMenuClass.textEffect.Color, enabled: true, dropEnabledColor); if (flag) { text2 = text; } sMenuNode2.SetTitle("[ " + text3 + " ]"); sMenuNode2.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate8(UpdateAdvancedNodeBasedOnScroll), fullItemName, sMenuNode2); sMenuNode2.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text2, sMenuNode2); sMenuNode2.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetNodeSettings), fullItemName, sMenuNode2); pickupMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); pickupMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, pickupMenu.parrentMenu.Open); pickupMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetNodeSettings), fullItemName, sMenuNode2); sMenuNode2.fullTextPart.SetScale(1f, 1f); sMenuNode2.subtitlePart.SetScale(0.75f, 0.75f); sMenuNode2.titlePart.SetScale(0.5f, 0.5f); sMenuNode2.SetSize(0.75f); } pickupMenu.AddCatagory("All"); pickupMenu.AddNodeToCatagory("Default", "Ammo Pack"); pickupMenu.AddNodeToCatagory("Default", "MediPack"); pickupMenu.AddNodeToCatagory("Default", "Tool Refill Pack"); pickupMenu.AddNodeToCatagory("Default", "Disinfection Pack"); pickupMenu.AddNodeToCatagory("Default", "C-Foam Grenade"); pickupMenu.AddNodeToCatagory("Default", "Lock Melter"); pickupMenu.AddNodeToCatagory("Default", "C-Foam Tripmine"); pickupMenu.AddNodeToCatagory("Default", "Explosive Trip Mine"); pickupMenu.AddNodeToCatagory("Default", "Glow Stick"); pickupMenu.AddNodeToCatagory("Default", "Fog Repeller"); pickupMenu.AddNodeToCatagory("Default", "C-Foam Grenade"); pickupMenu.AddNodeToCatagory("Favorites", "Ammo Pack"); pickupMenu.AddNodeToCatagory("Favorites", "MediPack"); pickupMenu.AddNodeToCatagory("Favorites", "Tool Refill Pack"); pickupMenu.AddNodeToCatagory("Favorites", "Disinfection Pack"); pickupMenu.AddNodeToCatagory("Favorites", "C-Foam Grenade"); pickupMenu.AddNodeToCatagory("Resources", "MediPack"); pickupMenu.AddNodeToCatagory("Resources", "Ammo Pack"); pickupMenu.AddNodeToCatagory("Resources", "Tool Refill Pack"); pickupMenu.AddNodeToCatagory("Resources", "Disinfection Pack"); pickupMenu.AddNodeToCatagory("Placeables", "Lock Melter"); pickupMenu.AddNodeToCatagory("Placeables", "C-Foam Tripmine"); pickupMenu.AddNodeToCatagory("Placeables", "Explosive Trip Mine"); pickupMenu.AddNodeToCatagory("Throwables", "Glow Stick"); pickupMenu.AddNodeToCatagory("Throwables", "Fog Repeller"); pickupMenu.AddNodeToCatagory("Throwables", "C-Foam Grenade"); pickupMenu.AddCatagory("Encountered"); pickupMenu.SetCatagory("Default"); pickupMenu.AddListener(sMenuManager.menuEvent.OnOpened, pickupMenu.UpdateCatagoryNodes); pickupNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); pickupNode.ClearListeners(sMenuManager.nodeEvent.WhileSelected); pickupNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, pickupMenu.Open); pickupNode.AddListener(sMenuManager.nodeEvent.WhileSelected, new Action(UpdateNodeBasedOnScroll), pickupNode); pickupNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new Action(ResetSettings), pickupNode); pickupMenu.parrentMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new Action(ResetSettings), pickupNode); pickupMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Controls what bots will pickup."); pickupMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Scroll to change the priority of different items."); UpdateNodeSettingsDisplay(pickupNode); } private static void UpdateAdvancedNodeBasedOnScroll(string itemName, sMenu.sMenuNode node, int increment = 10) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (PickupActionPatch.fullGlowStickNames.Contains(itemName)) { itemName = glowstickNameToUse; } if (node == null || !node.gameObject.activeInHierarchy) { return; } float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { int num = (int)Mathf.Sign(axis); Vector3 val = Camera.main.WorldToViewportPoint(node.gameObject.transform.position); val = Vector2.op_Implicit(new Vector2(val.x - 0.5f, val.y - 0.5f) * -1f); if (val.y > Math.Abs(val.x)) { string key = "Drop" + itemName; bool value = !zSlideComputer.ActionPermissions.ValueAt(key).Value; zSlideComputer.ActionPermissions.SetValue(key, value, 0uL); } else { float num2 = zSlideComputer.ActionPriorities.ValueAt("Pickup" + itemName).Value; zSlideComputer.ActionPriorities.SetValue("Pickup" + itemName, Mathf.Clamp(num2 + (float)(num * increment), 0f, 100f), 0uL); } } } private static void UpdateNodeBasedOnScroll(sMenu.sMenuNode node) { //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_003c: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) float axis = Input.GetAxis("Mouse ScrollWheel"); float num = (int)Mathf.Sign(axis); if (axis != 0f) { string text = node.text; Vector3 val = Camera.main.WorldToViewportPoint(node.gameObject.transform.position); val = Vector2.op_Implicit(new Vector2(val.x - 0.5f, val.y - 0.5f) * -1f); if (val.y > Math.Abs(val.x)) { num *= 0.1f; float num2 = zSlideComputer.ActionPriorities.ValueAt(text).Value + num; num2 = (float)Math.Round(num2, 1); zSlideComputer.ActionPriorities.SetValue(text, Math.Clamp(num2, 1f, 15f), 0uL); } else { int value = Math.Clamp(pickupDistance.ValueAt(text).Value + (int)num, 1, 60); pickupDistance.SetValue(text, value, 0uL); } } } private static void UpdateNodeSettingsDisplay(sMenu.sMenuNode node) { string text = node.text; List extraTrees = new List { pickupDistance }; AutomaticActionMenuClass.GenericUpdateNodePrioDisplay(node); AutomaticActionMenuClass.ApplyTextEffectsToNode(node, text, extraTrees); node.SetSubtitle($"Range [{pickupDistance.ValueAt(text)}]"); } private static void SetSearchDistance() { int value = pickupDistance.ValueAt("Pickup").Value; if (value > FollowMenuClass.maxDistance.ValueAt("Follow")) { FollowMenuClass.maxDistance.SetValue("Follow", value, 0uL); } RootPlayerBotAction.s_collectItemSearchDistance = value; } internal static void Encounter(string friendlyName) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown sMenu.sMenuNode node = pickupMenu.GetNode(friendlyName); if (node == null) { return; } if (!Enumerable.Contains(pickupMenu.catagories.Keys, "Encountered")) { ManualLogSource log = ZiMain.log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(74, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unable to encouter "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(friendlyName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" because Encountered catagory not found in pickup menu."); } log.LogWarning(val); } else if (!pickupMenu.catagories["Encountered"].Contains(node)) { pickupMenu.AddNodeToCatagory("Encountered", node); pickupMenu.UpdateCatagoryNodes(); } } private static void ResetSettings(sMenu.sMenuNode node) { pickupDistance.ResetToDefault("Pickup", 0uL); zSlideComputer.ActionPermissions.ResetToDefault("Pickup", 0uL); zSlideComputer.ActionPriorities.ResetToDefault("Pickup", 0uL); } private static void ResetNodeSettings(string itemName, sMenu.sMenuNode node) { if (node.gameObject.activeInHierarchy) { if (PickupActionPatch.fullGlowStickNames.Contains(itemName)) { itemName = glowstickNameToUse; } zSlideComputer.ActionPermissions.ResetToDefault("Pickup" + itemName, 0uL); zSlideComputer.ActionPermissions.ResetToDefault("Drop" + itemName, 0uL); zSlideComputer.ActionPriorities.ResetToDefault("Pickup" + itemName, 0uL); } } public static void updateNodeDisplay(string itemName, sMenu.sMenuNode node) { //IL_00b5: 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_013e: 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_0147: Unknown result type (might be due to invalid IL or missing references) string text = "Pickup" + itemName; string key = "Drop" + itemName; AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay(text, node); List trees = new List { zSlideComputer.ActionPermissions, zSlideComputer.ActionPriorities }; List trees2 = new List { zSlideComputer.ActionPermissions }; bool enabled = AutomaticActionMenuClass.AnyTreeOverridesNullDefault(trees, text) || AutomaticActionMenuClass.AnyTreeOverridesNullDefault(trees2, key); bool enabled2 = !AutomaticActionMenuClass.AllMatchingDefaultValue(trees, text) || !AutomaticActionMenuClass.AllMatchingDefaultValue(trees2, key); AutomaticActionMenuClass.ApplyTextEffectToNode(node, AutomaticActionMenuClass.textEffect.Star, enabled); AutomaticActionMenuClass.ApplyTextEffectToNode(node, AutomaticActionMenuClass.textEffect.Italic, enabled2); float value = zSlideComputer.ActionPriorities.ValueAt(text).Value; string value2 = ColorUtility.ToHtmlStringRGB(GetPriorityColor(value)); node.SetSubtitle($"[ {value} ]"); Color value3 = ((!zSlideComputer.ActionPermissions.ValueAt("Drop" + itemName).Value) ? sMenuManager.defaultDisabledColor : dropEnabledColor); string text2 = AutomaticActionMenuClass.ApplyTextEffect("Drop", AutomaticActionMenuClass.textEffect.Color, enabled: true, value3); node.SetTitle("[ " + text2 + " ]"); } public static Color GetPriorityColor(float value) { //IL_0052: 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_005b: 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_007f: 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_0069: 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_0078: Unknown result type (might be due to invalid IL or missing references) float num = 0.25f; Color val = default(Color); ((Color)(ref val))..ctor(num, 0f, 0f); Color val2 = default(Color); ((Color)(ref val2))..ctor(num, num, 0f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, num, 0f); Color val4 = default(Color); ((Color)(ref val4))..ctor(0f, 0f, num); if (value <= 25f) { return Color.Lerp(val, val2, value / 25f); } if (value <= 50f) { return Color.Lerp(val2, val3, (value - 25f) / 25f); } return Color.Lerp(val3, val4, (value - 50f) / 50f); } } public static class PingMenuClass { public static sMenu pingMenu; public static sMenu.sMenuNode pingNode; public static void Setup(sMenu menu) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) pingMenu = menu; pingNode = menu.GetNode(); pingNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); pingNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, pingMenu.Open); TargetTypeEnum[] values = Enum.GetValues(); for (int i = 0; i < values.Length; i++) { string text = ((object)values[i]/*cast due to .constrained prefix*/).ToString(); sMenu.sMenuNode sMenuNode = pingMenu.AddNode(text + "s"); sMenuNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text, sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text); zSlideComputer.ActionPermissions.AddNode(text, null, "Ping", null, null, null, hasDefaultValue: true).onChanged.Listen(new Action(UpdateNodeDisplay), new object[2] { text, sMenuNode }); pingMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), text); } pingMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); pingMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, pingMenu.parrentMenu.Open); pingMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Controls what bots will point out and mark."); pingMenu.AddPannel(sMenu.sMenuPannel.Side.top, "I'd like to add the option for them to ping new things, like resource bags, or even scouts?"); } public static void UpdateNodeDisplay(string actionKey, sMenu.sMenuNode node) { AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay(actionKey, node); } } public static class ReviveMenuClass { public static sMenu reviveMenu; public static sMenu.sMenuNode reviveNode; public static sMenu overidesMenu; public static sMenu.sMenuNode playersNode; public static sMenu.sMenuNode botsNode; public static void Setup(sMenu menu) { reviveMenu = menu; reviveNode = menu.GetNode(); reviveNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); reviveNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, reviveMenu.Open); playersNode = reviveMenu.AddNode("Players"); playersNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), "RevivePlayers", playersNode); botsNode = reviveMenu.AddNode("Bots"); botsNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), "ReviveBots", botsNode); zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("RevivePlayers", null, playersNode, null, typeof(PlayerBotActionRevive), null, "Revive", hasDefaultValue: true); zSlideComputer.ActionPermissions.GetNodeFromIdent("RevivePlayers").onChanged.Listen(new Action(UpdateNodeDisplay), new object[2] { "RevivePlayers", playersNode }); zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("ReviveBots", null, botsNode, null, typeof(PlayerBotActionRevive), null, "Revive", hasDefaultValue: true); zSlideComputer.ActionPermissions.GetNodeFromIdent("ReviveBots").onChanged.Listen(new Action(UpdateNodeDisplay), new object[2] { "ReviveBots", botsNode }); menu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); menu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, menu.parrentMenu.Open); menu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate6(AutomaticActionMenuClass.GenericResetSettings), botsNode, false, "ReviveBots"); menu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate6(AutomaticActionMenuClass.GenericResetSettings), playersNode, false, "RevivePlayers"); menu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate6(AutomaticActionMenuClass.GenericResetSettings), reviveNode, false, "Revive"); botsNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate6(AutomaticActionMenuClass.GenericResetSettings), botsNode, false, "ReviveBots"); playersNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate6(AutomaticActionMenuClass.GenericResetSettings), playersNode, false, "RevivePlayers"); reviveMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Controls who the bots are allowed to revive"); reviveMenu.AddPannel(sMenu.sMenuPannel.Side.top, "I plan to add a way to control revives of spesific plaers"); reviveMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Maybe an option to only revive their leader?"); } public static void UpdateNodeDisplay(string actionKey, sMenu.sMenuNode node) { AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay(actionKey, node); } } public static class SettingsMenuClass { public static float menuSizeStep = 0.1f; public static sMenu SettingsMenu; public static sMenu ChatPermsMenu; public static sMenu.sMenuNode scaleNode; public static sMenu.sMenuNode ChatNode; public static Color onColor = new Color(0f, 0.2f, 0f); public static void Setup(sMenu menu) { //IL_00be: 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_02a1: Unknown result type (might be due to invalid IL or missing references) SettingsMenu = menu; scaleNode = SettingsMenu.AddNode("Scale"); ChatPermsMenu = sMenuManager.createMenu("Bots talk in chat", SettingsMenu); ChatNode = ChatPermsMenu.GetNode(); ChatNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); ChatNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, ChatPermsMenu.Open); zSlideComputer.ActionPermissions.AddNode("TalkInChat", (bool?)true, (string?)null, (Func?)null, (FlexibleMethodDefinition)null, (bool?)true, hasDefaultValue: false).onChanged.Listen(new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), new object[3] { "TalkInChat", ChatNode, onColor }); ChatNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), "TalkInChat", ChatNode); ChatNode.SetColor(onColor); scaleNode.AddListener(sMenuManager.nodeEvent.WhileSelected, UpdateScaleByScroll); ChatNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate5(zSlideComputer.ActionPermissions.ResetToDefault), "TalkInChat"); SettingsMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); SettingsMenu.centerNode.AddListener(sMenuManager.nodeEvent.WhileSelected, UpdateScaleByScroll); SettingsMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, SettingsMenu.parrentMenu.Open); SettingsMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, ResetAllSettings); scaleNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, ResetScale); ChatPermsMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); ChatPermsMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, ChatPermsMenu.parrentMenu.Open); ChatPermsMenu.AddListener(sMenuManager.menuEvent.OnOpened, new <>f__AnonymousDelegate7(AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay), "TalkInChat", ChatPermsMenu.centerNode, onColor); ChatSettingsMenu.Setup(ChatPermsMenu); UpdateScaleNodeSubtitle(); SettingsMenu.AddPannel(sMenu.sMenuPannel.Side.top, "More settings coming 'soon'!"); } private static void toggleTalk() { bool value = !zSlideComputer.ActionPermissions.ValueAt("TalkInChat").Value; zSlideComputer.ActionPermissions.SetValue("TalkInChat", value, 0uL); } private static void ResetAllSettings() { zSlideComputer.ActionPermissions.ResetToDefault("TalkInChat", 0uL); ResetScale(); } private static void ResetTalkInChat() { zSlideComputer.ActionPermissions.ResetToDefault("TalkInChat", 0uL); } private static void ResetScale() { sMenuManager.menuSizeScaler = 1f; UpdateScaleNodeSubtitle(); sMenuManager.SetMenusScale(sMenuManager.menuSizeScaler); } private static void UpdateScaleByScroll() { float axis = Input.GetAxis("Mouse ScrollWheel"); int num = (int)Mathf.Sign(axis); if (axis != 0f) { UpdateScaleNodeSubtitle(); sMenuManager.menuSizeScaler += (float)num * menuSizeStep; sMenuManager.menuSizeScaler = zHelpers.Round(sMenuManager.menuSizeScaler, 1); sMenuManager.menuSizeScaler = Math.Clamp(sMenuManager.menuSizeScaler, 0.3f, 5f); sMenuManager.SetMenusScale(sMenuManager.menuSizeScaler); } } private static void UpdateScaleNodeSubtitle() { scaleNode.SetSubtitle($"[ {sMenuManager.menuSizeScaler} ]"); } } public static class ShareMenuClass { public static sMenu shareMenu; public static sMenu.sMenuNode shareNode; public static void Setup(sMenu menu) { shareMenu = menu; shareNode = shareMenu.GetNode(); foreach (string resourcePackItemName in ShareActionPatch.resourcePackItemNames) { sMenu.sMenuNode sMenuNode = shareMenu.AddNode(resourcePackItemName); zSlideComputer.ActionPermissions.AddNode("Share" + resourcePackItemName, null, "Share", null, null, null, hasDefaultValue: true).onChanged.Listen(new Action(updateNodeThresholdDisplay), new object[2] { sMenuNode, resourcePackItemName }); if (resourcePackItemName == "DisinfectionPack") { zSlideComputer.ActionPriorities.AddNode("Share" + resourcePackItemName, 20f, "Share", null, null, 20f).onChanged.Listen(new Action(updateNodeThresholdDisplay), new object[2] { sMenuNode, resourcePackItemName }); } else { zSlideComputer.ActionPriorities.AddNode("Share" + resourcePackItemName, 80f, "Share", null, null, 80f).onChanged.Listen(new Action(updateNodeThresholdDisplay), new object[2] { sMenuNode, resourcePackItemName }); } sMenuNode.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), "Share" + resourcePackItemName, sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.OnTapped, new Action(updateNodeThresholdDisplay), sMenuNode, resourcePackItemName); sMenuNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetSettings), resourcePackItemName, sMenuNode); sMenuNode.AddListener(sMenuManager.nodeEvent.WhileSelected, new <>f__AnonymousDelegate8(ChangeThresholdBasedOnMouseWheel), resourcePackItemName, sMenuNode, 5); shareMenu.AddListener(sMenuManager.menuEvent.OnOpened, new Action(updateNodeThresholdDisplay), sMenuNode, resourcePackItemName); shareMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); shareMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediate, new Action(ResetSettings), resourcePackItemName, sMenuNode); sMenuNode.fullTextPart.SetScale(1f, 1f); sMenuNode.subtitlePart.SetScale(0.75f, 0.75f); sMenuNode.titlePart.SetScale(0.5f, 0.5f); } shareMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, shareMenu.parrentMenu.Open); shareNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); shareNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, shareMenu.Open); shareMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Controls what resources bots will automatically share"); shareMenu.AddPannel(sMenu.sMenuPannel.Side.top, "You can also change the threshold you must be below for them to share."); shareMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Scroll to change threshold."); } public static void ResetSettings(string itemName, sMenu.sMenuNode node) { zSlideComputer.ActionPermissions.ResetToDefault("Share" + itemName, 0uL); zSlideComputer.ActionPriorities.ResetToDefault("Share" + itemName, 0uL); updateNodeThresholdDisplay(node, itemName); } public static void updateNodeThresholdDisplay(sMenu.sMenuNode node, string itemName) { //IL_0023: 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) string text = "Share" + itemName; float num = zSlideComputer.ActionPriorities.ValueAt(text).Value; string value = ColorUtility.ToHtmlStringRGB(GetThresholdColor(num)); if (itemName == "DisinfectionPack") { value = ColorUtility.ToHtmlStringRGB(GetThresholdColor(100f - num)); } node.SetSubtitle($"[ {num} ]"); AutomaticActionMenuClass.GenericUpdateNodeAllowedDisplay(text, node); } public static Color GetThresholdColor(float value) { //IL_004f: 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_005e: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) float num = 0.25f; Color val = default(Color); ((Color)(ref val))..ctor(num, 0f, 0f); Color val2 = default(Color); ((Color)(ref val2))..ctor(num, num, 0f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, num, 0f); if (value <= 40f) { return Color.Lerp(val, val2, value / 40f); } return Color.Lerp(val2, val3, (value - 40f) / 60f); } public static void ChangeThresholdBasedOnMouseWheel(string itemName, sMenu.sMenuNode node, int increment = 10) { if (node == null || !node.gameObject.activeInHierarchy) { return; } float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { int num = (int)Mathf.Sign(axis); if (num != 0) { int num2 = (int)zSlideComputer.ActionPriorities.ValueAt("Share" + itemName).Value; int num3 = num * increment; int value = num2 + num3; value = Math.Clamp(value, 0, 100); zSlideComputer.ActionPriorities.SetValue("Share" + itemName, value, 0uL); updateNodeThresholdDisplay(node, itemName); } } } } public static class UnlockMenuClass { public static sMenu unlockMenu; public static sMenu.sMenuNode unlockNode; public static void Setup(sMenu menu) { unlockMenu = menu; unlockNode = unlockMenu.GetNode(); unlockNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); unlockNode.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, unlockMenu.Open); unlockMenu.AddPannel(sMenu.sMenuPannel.Side.top, "This controls if the bots are allowed to smash locks on doors/containers"); unlockMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "TODO: Control if bots can use lock melters automatically."); unlockMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "TODO: Control if bots will auto unlock containers or doors or both"); } } public static class zMenus { public static List botMenus; public static void CreateMenus() { sMenuManager.ClearAllMenus(); OverrideTree.ResetTrees(); OverrideTree.ResetTrees(); OverrideTree.ResetTrees(); AutomaticActionMenuClass.Setup(sMenuManager.createMenu("Automatic Actions", sMenuManager.mainMenu)); sMenuManager.mainMenu.AddPannel(sMenu.sMenuPannel.Side.top, "Slide's Bot Control"); sMenuManager.mainMenu.AddPannel(sMenu.sMenuPannel.Side.top, "[ V1.2.0 ]"); sMenuManager.mainMenu.radius = 100f; if (ZiMain.extraActionMenus) { ManualActionMenuClass.Setup(sMenuManager.createMenu("Manual Actions", sMenuManager.mainMenu)); sMenuManager.createMenu("Contextual Actions", sMenuManager.mainMenu); } SettingsMenuClass.Setup(sMenuManager.createMenu("Settings", sMenuManager.mainMenu)); if (ZiMain.VoiceMenu) { sMenuManager.createMenu("Voice menu", sMenuManager.mainMenu); } DebugMenuClass.Setup(sMenuManager.createMenu("Debug", sMenuManager.mainMenu)); } } public static class ManualActionMenuClass { public static sMenu manualActionMenu; public static sMenu.sMenuNode manuActionNode; public static void Setup(sMenu menu) { manualActionMenu = menu; manuActionNode = manualActionMenu.GetNode(); manualActionMenu.AddNode("Clear Room", StartClearRoomAction); } public static void StartClearRoomAction() { } } public static class AutomaticActionMenuClass { public enum textEffect { Star, Bold, Italic, Underline, Color } public static List autoActionMenus; public static sMenu AutoActionMenu; public static Dictionary textEffectDict = new Dictionary { { textEffect.Star, ("*", "*") }, { textEffect.Bold, ("", "") }, { textEffect.Italic, ("", "") }, { textEffect.Underline, ("", "") }, { textEffect.Color, ("", "") } }; internal static void Setup(sMenu _menu) { zSlideComputer.ActionPriorities = new OverrideTree(-1f, "ActionPriorities"); zSlideComputer.ActionPermissions = new OverrideTree(true, "ActionPerms"); autoActionMenus = new List(); AutoActionMenu = _menu; AutoActionMenu.radius = 130f; autoActionMenus.Clear(); sMenu sMenu = sMenuManager.createMenu("Use BioTracker", AutoActionMenu); autoActionMenus.Add(sMenu); sMenu sMenu2 = sMenuManager.createMenu("Attack", AutoActionMenu); autoActionMenus.Add(sMenu2); sMenu sMenu3 = sMenuManager.createMenu("Revive", AutoActionMenu); autoActionMenus.Add(sMenu3); sMenu sMenu4 = sMenuManager.createMenu("Share", AutoActionMenu); autoActionMenus.Add(sMenu4); sMenu sMenu5 = sMenuManager.createMenu("Ping", AutoActionMenu); autoActionMenus.Add(sMenu5); sMenu sMenu6 = sMenuManager.createMenu("Pickup", AutoActionMenu); autoActionMenus.Add(sMenu6); sMenu sMenu7 = sMenuManager.createMenu("Follow", AutoActionMenu); autoActionMenus.Add(sMenu7); sMenu sMenu8 = sMenuManager.createMenu("Unlock", AutoActionMenu); autoActionMenus.Add(sMenu8); zSlideComputer.PermissionDefinitions.ClearPermissionDefinitions(); bool? defaultPerm = true; sMenu menu = sMenu3; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Revive", defaultPerm, sMenu3.GetNode(), menu, typeof(PlayerBotActionRevive), 12f); bool? defaultPerm2 = true; menu = sMenu; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Use BioTracker", defaultPerm2, sMenu.GetNode(), menu, typeof(PlayerBotActionUseEnemyScanner)); bool? defaultPerm3 = true; menu = sMenu2; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Attack", defaultPerm3, sMenu2.GetNode(), menu, typeof(PlayerBotActionAttack)); bool? defaultPerm4 = true; menu = sMenu4; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Share", defaultPerm4, sMenu4.GetNode(), menu, typeof(PlayerBotActionShareResourcePack), 10f); bool? defaultPerm5 = true; menu = sMenu5; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Ping", defaultPerm5, sMenu5.GetNode(), menu, typeof(PlayerBotActionHighlight), 4.3f); bool? defaultPerm6 = true; menu = sMenu7; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Follow", defaultPerm6, sMenu7.GetNode(), menu, typeof(PlayerBotActionFollow), 14f); bool? defaultPerm7 = true; menu = sMenu6; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Pickup", defaultPerm7, sMenu6.GetNode(), menu, typeof(PlayerBotActionCollectItem), 4.2f); zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Drop", true, null, null, typeof(PlayerBotActionCollectItem)); bool? defaultPerm8 = true; menu = sMenu8; zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Unlock", defaultPerm8, sMenu8.GetNode(), menu, typeof(PlayerBotActionUnlock), 4.1f); zSlideComputer.PermissionDefinitions.CreatePermissionDeffinition("Move", true, null, null, typeof(PlayerBotActionWalk)); foreach (sMenu autoActionMenu in autoActionMenus) { sMenu.sMenuNode node = autoActionMenu.GetNode(); string text = node.text; if (Enumerable.Contains(zSlideComputer.ActionPriorities.nodes.Keys, text)) { _ = zSlideComputer.ActionPriorities.GetNodeFromIdent(text).DefaultValue.Value; node.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate6(GenericResetSettings), node); node.AddListener(sMenuManager.nodeEvent.WhileSelected, new Action(GenericUpdatePriorityBasedOnScroll), node); GenericUpdateNodePrioDisplay(node); } node.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); node.AddListener(sMenuManager.nodeEvent.OnTapped, new <>f__AnonymousDelegate4(zSlideComputer.GenericToggleAllowed), text, node); node.AddListener(sMenuManager.nodeEvent.OnDoubleTapped, autoActionMenu.Open); AutoActionMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnHeldImmediateSelected, new <>f__AnonymousDelegate6(GenericResetSettings), node); } AutoActionMenu.centerNode.ClearListeners(sMenuManager.nodeEvent.OnUnpressedSelected); AutoActionMenu.centerNode.AddListener(sMenuManager.nodeEvent.OnTapped, AutoActionMenu.parrentMenu.Open); AutoActionMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Scroll in center => change catagory"); AutoActionMenu.AddPannel(sMenu.sMenuPannel.Side.bottom, "Scroll on node => change priority"); AutoActionMenu.AddPannel(sMenu.sMenuPannel.Side.right, "Tap => toggle"); AutoActionMenu.AddPannel(sMenu.sMenuPannel.Side.right, "Double tap => submenu"); AutoActionMenu.AddPannel(sMenu.sMenuPannel.Side.right, "Hold => reset"); PickupMenuClass.Setup(sMenu6); ShareMenuClass.Setup(sMenu4); FollowMenuClass.Setup(sMenu7); UnlockMenuClass.Setup(sMenu8); PingMenuClass.Setup(sMenu5); BioTrackerMenuClass.Setup(sMenu); AttackMenuClass.Setup(sMenu2); ReviveMenuClass.Setup(sMenu3); AutoActionMenu.AddCatagory("All"); AutoActionMenu.AddCatagory("Favorites"); AutoActionMenu.AddNodeToCatagory("Favorites", "Pickup"); AutoActionMenu.AddNodeToCatagory("Favorites", "Share"); AutoActionMenu.AddNodeToCatagory("Favorites", "Explore"); AutoActionMenu.AddNodeToCatagory("Favorites", "Attack"); AutoActionMenu.AddCatagory("Resources"); AutoActionMenu.AddNodeToCatagory("Resources", "Pickup"); AutoActionMenu.AddNodeToCatagory("Resources", "Share"); AutoActionMenu.AddCatagory("Behavior"); AutoActionMenu.AddNodeToCatagory("Behavior", "Unlock"); AutoActionMenu.AddNodeToCatagory("Behavior", "Ping"); AutoActionMenu.AddNodeToCatagory("Behavior", "Follow"); AutoActionMenu.AddCatagory("Combat"); AutoActionMenu.AddNodeToCatagory("Combat", "Attack"); AutoActionMenu.AddNodeToCatagory("Combat", "Revive"); AutoActionMenu.AddNodeToCatagory("Behavior", "Use BioTracker"); AutoActionMenu.SetCatagory("Favorites"); } internal static void GenericUpdateNodeAllowedDisplay(string actionKey, sMenu.sMenuNode node, Color? onColor = null, Color? offColor = null) { //IL_000b: 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_0053: 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 (!onColor.HasValue) { onColor = sMenuManager.defaultEnabledColor; } if (!offColor.HasValue) { offColor = sMenuManager.defaultDisabledColor; } if (zSlideComputer.ActionPermissions.ValueAt(actionKey).Value) { node.SetColor(onColor.Value); } else { node.SetColor(offColor.Value); } ApplyTextEffectsToNode(node, actionKey); } public static void ApplyTextEffectsToNode(sMenu.sMenuNode node, string actionKey = null, List extraTrees = null) { if (actionKey == null) { actionKey = node.text; } List list = new List(); if (zSlideComputer.ActionPermissions.HasKey(actionKey)) { list.Add(zSlideComputer.ActionPermissions); } if (zSlideComputer.ActionPriorities.HasKey(actionKey)) { list.Add(zSlideComputer.ActionPriorities); } if (extraTrees != null) { foreach (IOverrideTree extraTree in extraTrees) { list.Add(extraTree); } } bool enabled = AnyTreeOverridesNullDefault(list, actionKey); bool enabled2 = !AllMatchingDefaultValue(list, actionKey); ApplyTextEffectToNode(node, textEffect.Star, enabled); ApplyTextEffectToNode(node, textEffect.Italic, enabled2); } internal static void GenericUpdatePriorityBasedOnScroll(sMenu.sMenuNode node) { float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { float num = (float)(int)Mathf.Sign(axis) * 0.1f; string text = node.text; zSlideComputer.ActionPriorities.SetValue(text, Math.Clamp(Mathf.Round((zSlideComputer.ActionPriorities.ValueAt(text).Value + num) * 10f) / 10f, 1f, 15f), 0uL); ApplyTextEffectsToNode(node); } } public static bool AnyTreeOverridesNullDefault(List trees, string key) { foreach (IOverrideTree tree in trees) { tree.IHasDefault(key); bool flag = tree.IGetDefaultValue(key) == null; bool flag2 = tree.IHasValue(key); tree.IHasParrent(key); if (flag2 && flag) { return true; } } return false; } public static bool AnyHasValue(List trees, string key) { foreach (IOverrideTree tree in trees) { if (tree.IHasValue(key)) { return true; } } return false; } public static bool AllMatchingDefaultValue(List trees, string key) { foreach (IOverrideTree tree in trees) { if (!tree.IMatchingDefaultValue(key)) { return false; } } return true; } public static bool AllDefaultValue(List trees, string key) { foreach (IOverrideTree tree in trees) { if (!tree.IsDefaultValue(key)) { return false; } } return true; } public static string ApplyTextEffect(string text, textEffect effect, bool enabled = true, Color? color = null) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) string text2 = text; string text3 = textEffectDict[effect].prefix; string item = textEffectDict[effect].suffix; if (effect == textEffect.Color) { string arg = ColorUtility.ToHtmlStringRGB((Color)(((??)color) ?? Color.white)); text3 = string.Format(text3, arg); } if (enabled) { if (!text2.Contains(text3)) { text2 = text3 + text2; } if (!text2.Contains(item)) { text2 += item; } } else { text2 = text2.Replace(text3, ""); text2 = text2.Replace(item, ""); } return text2; } public static void ApplyTextEffectToNode(sMenu.sMenuNode node, textEffect effect, bool enabled = true) { if (enabled) { if (!node.prefix.Contains(textEffectDict[effect].prefix)) { node.SetPrefix(textEffectDict[effect].prefix + node.prefix); } if (!node.suffix.Contains(textEffectDict[effect].suffix)) { node.SetSuffix(node.suffix + textEffectDict[effect].suffix); } } else { node.SetPrefix(node.prefix.Replace(textEffectDict[effect].prefix, "")); node.SetSuffix(node.suffix.Replace(textEffectDict[effect].suffix, "")); } } public static void GenericUpdateNodePrioDisplay(sMenu.sMenuNode node, string key = null) { if (key == null) { key = node.text; } node.SetTitle($"Prio [{zSlideComputer.ActionPriorities.ValueAt(key)}]"); ApplyTextEffectsToNode(node, key); } public static void GenericResetSettings(sMenu.sMenuNode node, bool allowDissabled = false, string? actionKey = null) { if (node.gameObject.activeInHierarchy || allowDissabled) { if (actionKey == null) { actionKey = node.text; } if (zSlideComputer.ActionPermissions.ResetToDefault(actionKey, 0uL).HasValue) { GenericUpdateNodeAllowedDisplay(actionKey, node); } if (zSlideComputer.ActionPriorities.ResetToDefault(actionKey, 0uL).HasValue) { GenericUpdateNodePrioDisplay(node); } } } } [Obsolete] public static class SelectionMenuClass { public static Dictionary botSelection = new Dictionary(); public static Dictionary selectionBotNodes = new Dictionary(); public static Color selectedColor = new Color(0.25f, 0.16175f, 0f); public static PlayerAIBot toggleBotSelection(PlayerAIBot bot) { if (checkForUntrackedBot(bot)) { return null; } botSelection[bot.Agent.Owner.PlayerSlotIndex()] = !botSelection[bot.Agent.Owner.PlayerSlotIndex()]; return bot; } public static List getSelectedBots() { List list = new List(); foreach (PlayerAIBot bot in ZiMain.GetBotList()) { if (botSelection[bot.Agent.Owner.PlayerSlotIndex()]) { list.Add(bot); } } return list; } public static void SelectionFlipAllBots() { foreach (PlayerAIBot bot in ZiMain.GetBotList()) { toggleBotSelection(bot); updateColorBaesdOnSelection(selectionBotNodes[bot.Agent.Owner.PlayerSlotIndex()], bot); } } public static void SelectionToggleAllBots() { int num = botSelection.Values.Count((bool value) => value); int num2 = botSelection.Values.Count() - num; bool flag = num > num2; foreach (PlayerAIBot bot in ZiMain.GetBotList()) { setBotSelection(bot, !flag); updateColorBaesdOnSelection(selectionBotNodes[bot.Agent.Owner.PlayerSlotIndex()], bot); } } public static PlayerAIBot setBotSelection(PlayerAIBot bot, bool selected) { if (checkForUntrackedBot(bot)) { return null; } botSelection[bot.Agent.Owner.PlayerSlotIndex()] = selected; return bot; } private static bool checkForUntrackedBot(PlayerAIBot bot) { if ((Object)(object)bot == (Object)null) { ZiMain.log.LogError((object)"Can't toggle bot selection of null! This should not happen."); return true; } if (!botSelection.ContainsKey(bot.Agent.Owner.PlayerSlotIndex())) { throw new KeyNotFoundException($"The bot {bot} is not tracked for selection. This should't happen."); } return false; } public static sMenu.sMenuNode updateColorBaesdOnSelection(sMenu.sMenuNode node, PlayerAIBot bot) { //IL_0035: 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) if (checkForUntrackedBot(bot)) { return null; } if (botSelection[bot.Agent.Owner.PlayerSlotIndex()]) { node.SetColor(selectedColor); } else { node.SetColor(sMenuManager.defaultColor); } return node; } } } namespace BotControl.CustomActions { public class CustomActionBase : PlayerBotActionBase { public class Descriptor : Descriptor { private BotControl.CustomActions.Patches.CustomDescBase _Base; public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); } public void InitDescriptor(PlayerAIBot bot) { _Base = new BotControl.CustomActions.Patches.CustomDescBase((Descriptor)(object)this); ((Descriptor)this).Bot = bot; } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomActionBase(this); } public override bool IsActionAllowed(Descriptor desc) { return _Base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return _Base.CheckCollision(desc); } public override void OnQueued() { _Base.OnQueued(); } public override AccessLayers GetAccessLayersRuntime() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _Base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { _Base.InternalOnTerminated(); } public virtual void compareAction(ref Descriptor bestAction) { } } private BotControl.CustomActions.Patches.CustomBase _Base; public static bool Setup() { return true; } public CustomActionBase() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomActionBase(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomActionBase(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); } public void InitFromDescriptor(Descriptor desc) { _Base = new BotControl.CustomActions.Patches.CustomBase((PlayerBotActionBase)(object)this); ((Descriptor)desc).ActionBase = (PlayerBotActionBase)(object)this; ((PlayerBotActionBase)this).m_bot = ((Descriptor)desc).Bot; ((PlayerBotActionBase)this).m_agent = ((PlayerBotActionBase)this).m_bot.Agent; PlayerAgent agent = ((PlayerBotActionBase)this).m_agent; ((PlayerBotActionBase)this).m_loco = ((agent != null) ? agent.Locomotion : null); ((PlayerBotActionBase)this).m_descBase = (Descriptor)(object)desc; } public override void Stop() { _Base.Stop(); } public override bool Update() { return _Base.Update(); } public override bool IsActionAllowed(Descriptor desc) { return _Base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return _Base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _Base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _Base.OnWarped(position); } } public class dataStore { public PrioritySet customActionDescriptors = new PrioritySet(); public PrioritySet customActionBases = new PrioritySet(); public Descriptor bestAction; } public class ManualAction { public Descriptor ActionDescriptor; public PlayerAgent Commander; public PlayerAIBot Bot; public uint ID; private ManualAction() { } public ManualAction(Descriptor ActionDescriptor, PlayerAgent Commander, PlayerAIBot Bot, uint ID) { this.ActionDescriptor = ActionDescriptor; this.Commander = Commander; this.Bot = Bot; this.ID = ID; } } public static class zActions { public static Dictionary> manualActions = new Dictionary>(); internal static readonly Dictionary ActionDataStore = new Dictionary(); internal static dataStore GetOrCreateData(Descriptor desc) { return GetOrCreateData(desc.Bot); } internal static dataStore GetOrCreateData(PlayerBotActionBase botBase) { return GetOrCreateData(botBase.m_bot); } internal static dataStore GetOrCreateData(PlayerAIBot botBase) { int instanceID = ((Object)botBase).GetInstanceID(); if (!ActionDataStore.TryGetValue(instanceID, out var value)) { value = new dataStore(); ActionDataStore[instanceID] = value; } return value; } public static PlayerAgent isManualAction(Descriptor descriptor) { if (descriptor == null) { return null; } if (manualActions == null) { return null; } foreach (int key in manualActions.Keys) { foreach (ManualAction item in manualActions[key]) { Descriptor actionDescriptor = item.ActionDescriptor; if (actionDescriptor != null && ((Il2CppObjectBase)actionDescriptor).Pointer == ((Il2CppObjectBase)descriptor).Pointer) { return item.Commander; } } } if (descriptor.ParentActionBase != null) { return isManualAction(descriptor.ParentActionBase.DescBase); } return null; } } } namespace BotControl.CustomActions.Patches { [HarmonyPatch] internal class PlayerAiBotPatch { private static float updateInterval = 0.16f; private static float LastUpdate = 0f; [HarmonyPatch(typeof(PlayerAIBot), "UpdateActions")] [HarmonyPrefix] public static bool UpdateActions(PlayerAIBot __instance) { if (Time.time < LastUpdate + updateInterval) { return false; } return true; } [HarmonyPatch(typeof(PlayerAIBot), "Setup")] [HarmonyPrefix] public static void Setup(PlayerAIBot __instance) { zActions.GetOrCreateData(__instance); CustomActionRegistry.Setup(__instance); ZiMain.log.LogMessage((object)"init playerbot"); } } [HarmonyPatch] internal class CustomDescBase { private readonly Descriptor __instance; public CustomDescBase(Descriptor instance) { __instance = instance; } public void OnQueued() { OnQueuedBase(__instance); } public bool CheckCollision(Descriptor desc) { return CheckCollisionBase(__instance, desc); } public bool IsActionAllowed(Descriptor desc) { return IsActionAllowedBase(__instance, desc); } public AccessLayers GetAccessLayersRuntime() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return GetAccessLayersRuntimeBase(__instance); } public void InternalOnTerminated() { InternalOnTerminatedBase(__instance); } [HarmonyPatch(typeof(Descriptor), "OnQueued")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void OnQueuedBase(Descriptor __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "CheckCollision")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool CheckCollisionBase(Descriptor __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "IsActionAllowed")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool IsActionAllowedBase(Descriptor __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "GetAccessLayersRuntime")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static AccessLayers GetAccessLayersRuntimeBase(Descriptor __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(Descriptor), "InternalOnTerminated")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void InternalOnTerminatedBase(Descriptor __instance) { throw new NotImplementedException(); } } [HarmonyPatch] internal class CustomBase { private readonly PlayerBotActionBase __instance; public CustomBase(PlayerBotActionBase instance) { __instance = instance; } public void Stop() { StopBase(__instance); } public bool Update() { return UpdateBase(__instance); } public void OnWarped(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) OnWarpedBase(__instance, position); } public bool IsActionAllowed(Descriptor desc) { return IsActionAllowedBase(__instance, desc); } public bool CheckCollision(Descriptor desc) { return CheckCollisionBase(__instance, desc); } public AccessLayers GetAccessLayersRuntime() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return GetAccessLayersRuntimeBase(__instance); } [HarmonyPatch(typeof(PlayerBotActionBase), "Stop")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void StopBase(PlayerBotActionBase __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "Update")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool UpdateBase(PlayerBotActionBase __instance) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "OnWarped")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void OnWarpedBase(PlayerBotActionBase __instance, Vector3 position) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "IsActionAllowed")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool IsActionAllowedBase(PlayerBotActionBase __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "CheckCollision")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool CheckCollisionBase(PlayerBotActionBase __instance, Descriptor desc) { throw new NotImplementedException(); } [HarmonyPatch(typeof(PlayerBotActionBase), "GetAccessLayersRuntime")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static AccessLayers GetAccessLayersRuntimeBase(PlayerBotActionBase __instance) { throw new NotImplementedException(); } } [HarmonyPatch] public class RootPlayerBotActionPatch { [HarmonyPatch(typeof(RootPlayerBotAction), "Update")] [HarmonyPrefix] public static bool PreUpdate(RootPlayerBotAction __instance, ref bool __result) { zActions.GetOrCreateData((PlayerBotActionBase)(object)__instance).bestAction = null; return true; } [HarmonyPatch(typeof(RootPlayerBotAction), "Update")] [HarmonyPostfix] public static void PostUpdate(RootPlayerBotAction __instance, ref bool __result) { dataStore orCreateData = zActions.GetOrCreateData((PlayerBotActionBase)(object)__instance); foreach (CustomActionBase.Descriptor customActionDescriptor in orCreateData.customActionDescriptors) { customActionDescriptor.compareAction(ref orCreateData.bestAction); } if (orCreateData.bestAction != null) { ((PlayerBotActionBase)__instance).m_bot.StartAction(orCreateData.bestAction); } } } } namespace BotControl.CustomActions.CustomActions { public class CustomBotActionDropHere : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public Vector3 DropPosition; public float Haste; [Obsolete] public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } [Obsolete] public Descriptor(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionDropHere(this); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override void OnQueued() { base.OnQueued(); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { base.InternalOnTerminated(); } public virtual void CompareAction(ref Descriptor bestAction) { } } private enum State { Idle, Move, Drop, Finished, Failed } public Descriptor TravelAction; public Descriptor DropAction; private Descriptor m_desc; private State state; public static void TestStart(PlayerAIBot bot) { //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) Descriptor obj = new Descriptor(bot) { DropPosition = ((Agent)zStaticRefrences.LocalPlayer).Position }; ((Descriptor)obj).Prio = 13f; Descriptor descriptor = obj; bot.StartAction((Descriptor)(object)descriptor); } public new static bool Setup() { return false; } [Obsolete] public CustomBotActionDropHere() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } [Obsolete] public CustomBotActionDropHere(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionDropHere(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { InitFromDescriptor(desc); m_desc = desc; state = State.Idle; } public override void Stop() { base.Stop(); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)TravelAction); } public override bool Update() { if (base.Update()) { return true; } switch (state) { case State.Idle: UpdateIdle(); break; case State.Move: UpdateMove(); break; case State.Drop: UpdateDrop(); break; case State.Finished: ((Descriptor)m_desc).SetCompletionStatus((StatusType)3); return true; case State.Failed: ((Descriptor)m_desc).SetCompletionStatus((StatusType)4); return true; } return !((PlayerBotActionBase)this).IsActive(); } private bool VerifyDropPosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (zHelpers.CanBotReach(((PlayerBotActionBase)this).m_bot, m_desc.DropPosition)) { return true; } return false; } private bool VerifyBotCarrying() { if (!zHelpers.TryGetAgentBackpackItem(((PlayerBotActionBase)this).m_agent, (InventorySlot)8, out BackpackItem _)) { return false; } return true; } private void UpdateIdle() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0041: 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_0059: 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_0072: Expected O, but got Unknown if (!VerifyDropPosition()) { state = State.Failed; } if (!VerifyBotCarrying()) { state = State.Failed; } Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { DestinationPos = m_desc.DropPosition, DestinationType = (DestinationEnum)0, ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = m_desc.Haste, Persistent = false }; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { TravelAction = val; state = State.Move; FlexibleMethodDefinition method = new FlexibleMethodDefinition(new Action(OnTravelCompleted), new object[1] { TravelAction }); zActionSub.addOnTerminated((Descriptor)(object)TravelAction, method); } else { state = State.Failed; } } private void UpdateMove() { } private void UpdateDrop() { Enumerator enumerator = ((PlayerBotActionBase)this).m_bot.Actions.GetEnumerator(); while (enumerator.MoveNext()) { PlayerBotActionBase current = enumerator.Current; if (((Il2CppObjectBase)current).TryCast() != null) { ((PlayerBotActionBase)this).m_bot.StopAction(current.DescBase); break; } } state = State.Finished; } public void OnTravelCompleted(Descriptor descBase) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)descBase.Status == 3) { state = State.Drop; } else { state = State.Failed; } } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) base.OnWarped(position); } } internal class CustomBotActionExplore : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public int Prio = 5; private float lastLooked; public bool canExplore = true; private float lookCooldown = 5f; private List typeIgnoreList = new List(4) { typeof(RootPlayerBotAction).FullName, typeof(PlayerBotActionFollow).FullName, typeof(PlayerBotActionIdle).FullName, typeof(PlayerBotActionLook).FullName }; private List typeBlackList = new List(5) { typeof(PlayerBotActionCollectItem).FullName, typeof(PlayerBotActionAttack).FullName, typeof(PlayerBotActionRevive).FullName, typeof(PlayerBotActionHighlight).FullName, typeof(PlayerBotActionShareResourcePack).FullName }; public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); } public override void compareAction(ref Descriptor bestAction) { } public override void OnQueued() { ZiMain.log.LogWarning((object)("Hello Explore has been queued." + ((Descriptor)this).Bot.Agent.PlayerName)); base.OnQueued(); } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionExplore(this); } } public enum StateEnum { None, Finished, lookingForUnexplored, Moving, Idle } private StateEnum state; private VisitNode UnexploredNode; public static Dictionary ExplorePerms = new Dictionary(); public Descriptor travelAction; public new static bool Setup() { return true; } public static bool GetExplorePerm(PlayerAIBot bot) { return GetExplorePerm(bot.Agent); } public static bool GetExplorePerm(PlayerAgent agent) { return GetExplorePerm(agent.Owner.PlayerSlotIndex()); } public static bool GetExplorePerm(int index) { if (ExplorePerms.TryGetValue(index, out var value)) { return value; } return ExplorePerms[index] = false; } public CustomBotActionExplore() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionExplore(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionExplore(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); state = StateEnum.lookingForUnexplored; } public void ToggleCanExplore() { int key = ((PlayerBotActionBase)this).m_bot.Agent.Owner.PlayerSlotIndex(); bool flag = ExplorePerms[key]; ExplorePerms[key] = !flag; } public override bool Update() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Invalid comparison between Unknown and I4 //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_00e3: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_010c: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Invalid comparison between Unknown and I4 //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Invalid comparison between Unknown and I4 base.Update(); if (!GetExplorePerm(((PlayerBotActionBase)this).m_bot)) { if (travelAction != null) { ((PlayerBotActionBase)this).m_bot.StopAction((Descriptor)(object)travelAction); } ((PlayerBotActionBase)this).DescBase.SetCompletionStatus((StatusType)3); state = StateEnum.Finished; return true; } if (state == StateEnum.lookingForUnexplored) { if (UnexploredNode == null) { UnexploredNode = zVisitedManager.GetUnexploredLocation(((Agent)((PlayerBotActionBase)this).m_bot.Agent).Position); if (UnexploredNode == null) { ((PlayerBotActionBase)this).DescBase.SetCompletionStatus((StatusType)3); state = StateEnum.Finished; return false; } state = StateEnum.Idle; return false; } state = StateEnum.Idle; return false; } if (state == StateEnum.Idle) { if (travelAction == null || ((Descriptor)travelAction).IsTerminated()) { _ = ((PlayerBotActionBase)this).m_bot.Agent; Vector3 position = UnexploredNode.position; travelAction = new Descriptor(((PlayerBotActionBase)this).m_bot) { DestinationPos = position, Haste = 0.5f, WalkPosture = (PostureEnum)0, Radius = 0.5f, DestinationType = (DestinationEnum)0, Persistent = false, ParentActionBase = (PlayerBotActionBase)(object)this, Prio = 3f }; ((PlayerBotActionBase)this).m_bot.StartAction((Descriptor)(object)travelAction); FlexibleMethodDefinition method = new FlexibleMethodDefinition(new Action(OnTravelActionEvent), new object[1] { travelAction }); zActionSub.addOnTerminated((Descriptor)(object)travelAction, method); state = StateEnum.Moving; return false; } state = StateEnum.Moving; return !((PlayerBotActionBase)this).IsActive(); } if (state == StateEnum.Finished) { if ((int)((Descriptor)travelAction).Status == 3) { zChatHandler.sendChatMessage("I have looked everywhere!", ""); } if ((int)((Descriptor)travelAction).Status == 2) { ZiMain.log.LogWarning((object)"Travel action still active somehow."); } ((PlayerBotActionBase)this).DescBase.SetCompletionStatus((StatusType)(((int)((Descriptor)travelAction).Status == 3) ? 3 : 4)); ((PlayerBotActionBase)this).Stop(); return true; } if (state == StateEnum.Moving) { if (HasFoundEnemies()) { ((PlayerBotActionBase)this).m_bot.StopAction((Descriptor)(object)travelAction); state = StateEnum.Finished; return false; } if (UnexploredNode != null && UnexploredNode.discovered) { ((PlayerBotActionBase)this).m_bot.StopAction((Descriptor)(object)travelAction); state = StateEnum.lookingForUnexplored; return false; } } return !((PlayerBotActionBase)this).IsActive(); } public static bool HasFoundEnemies() { return zFindableManager.AllFoundFindables.Any((FindableObject obj) => obj.found && (int)obj.pingSyle == 2 && (Object)(object)obj.gameObject != (Object)null && obj.gameObject.activeInHierarchy); } public void OnTravelActionEvent(Descriptor descBase) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 travelAction = (Descriptor)descBase; UnexploredNode = null; if ((int)((Descriptor)travelAction).Status == 3) { state = StateEnum.lookingForUnexplored; } else if (((Descriptor)travelAction).IsTerminated()) { state = StateEnum.Finished; } } public override void Stop() { base.Stop(); } } public class CustomBotActionInsertPowerCell : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public LG_PowerGenerator_Core TargetGenerator; public float Haste = 1f; public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionInsertPowerCell(this); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override void OnQueued() { base.OnQueued(); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { base.InternalOnTerminated(); } public virtual void CompareAction(ref Descriptor bestAction) { } } private enum State { Idle, Move, StartInsert, Inserting, Finished, Failed } private Descriptor m_desc; private LG_PowerGenerator_Core TargetGenerator; private Descriptor TravelAction; private Descriptor LookAction; private GameObject m_powerCellInteractionObject; private BackpackItem item; private Vector3? TargetPosition; private float startInsertTimestamp; private float insertTime = 1f; private float Haste; private State state; public new static bool Setup() { return true; } public CustomBotActionInsertPowerCell() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionInsertPowerCell(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionInsertPowerCell(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); m_desc = desc; TargetGenerator = desc.TargetGenerator; Haste = desc.Haste; state = State.Idle; } public override void Stop() { base.Stop(); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)TravelAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); } public override bool Update() { if (base.Update()) { return true; } switch (state) { case State.Idle: UpdateIdle(); break; case State.Move: UpdateMove(); break; case State.StartInsert: UpdateStartInsert(); break; case State.Inserting: UpdateInserting(); break; case State.Finished: ((Descriptor)m_desc).SetCompletionStatus((StatusType)3); return true; case State.Failed: ((Descriptor)m_desc).SetCompletionStatus((StatusType)4); return true; } return !((PlayerBotActionBase)this).IsActive(); } private void UpdateIdle() { //IL_0016: 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_0022: 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_0033: 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_004b: 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_005f: Expected O, but got Unknown if (!VerifyTarget()) { state = State.Failed; return; } Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { DestinationPos = TargetPosition.Value, DestinationType = (DestinationEnum)0, ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = Haste, Persistent = true }; ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); LookAction = null; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { TravelAction = val; state = State.Move; } else { state = State.Failed; } } private bool VerifyTarget() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TargetGenerator == (Object)null) { return false; } if ((Object)(object)m_powerCellInteractionObject == (Object)null) { m_powerCellInteractionObject = ((Component)((Il2CppObjectBase)TargetGenerator.m_powerCellInteraction).Cast()).gameObject; } if (!m_powerCellInteractionObject.activeInHierarchy) { return false; } if (!zHelpers.TryGetAgentBackpackItem(((PlayerBotActionBase)this).m_agent, (InventorySlot)8, out item)) { return false; } if (item.ItemID != 131) { return false; } GetTargetPosition(); if (!zHelpers.CanBotReach(((PlayerBotActionBase)this).m_bot, TargetPosition.Value)) { return false; } return true; } private bool GetTargetPosition() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0057: Unknown result type (might be due to invalid IL or missing references) if (TargetPosition.HasValue) { return true; } GameObject gameObject = ((Component)TargetGenerator).gameObject; if ((Object)(object)gameObject == (Object)null) { return false; } Transform transform = gameObject.transform; Vector3 val = transform.position + transform.forward * 1.5f; Vector3 value = default(Vector3); if (!((PlayerBotActionBase)this).SnapPositionToNav(val, ref value)) { return false; } TargetPosition = value; return true; } private void UpdateMove() { //IL_0011: 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) //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) UpdateLookAction(); Vector3 val = ((Component)((PlayerBotActionBase)this).m_bot).transform.position - TargetPosition.Value; if (((Vector3)(ref val)).magnitude < 0.1f) { state = State.StartInsert; } } private void UpdateLookAction() { //IL_0010: 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_001c: 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_0038: 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_0051: Expected O, but got Unknown if (LookAction == null) { Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot, true) { ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = 0.5f, TargetType = (TargetTypeEnum)2, TargetObj = ((Component)TargetGenerator).transform }; ((Descriptor)val).EventDelegate = DelegateSupport.ConvertDelegate((Delegate)new Action(OnLookActionEvent)); TurnInfo turn = val.Turn; float prio = (val.Turn.SoftPrio = ((Descriptor)val).Prio); turn.Prio = prio; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { LookAction = val; } } } public void OnLookActionEvent(Descriptor descBase) { if (((Il2CppObjectBase)descBase).Pointer != ((Il2CppObjectBase)LookAction).Pointer) { ((PlayerBotActionBase)this).PrintError("Rogue action."); } if (descBase.IsTerminated()) { LookAction = null; } } private void UpdateStartInsert() { //IL_0017: 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_0032: Unknown result type (might be due to invalid IL or missing references) startInsertTimestamp = Time.time; TypeEnum reachHeight = ((PlayerBotActionBase)this).GetReachHeight(((Component)TargetGenerator).transform.position.y); ((PlayerBotActionBase)this).m_agent.Sync.SendGenericInteract(reachHeight, true); state = State.Inserting; } private void UpdateInserting() { UpdateLookAction(); if (!(Time.time > startInsertTimestamp + insertTime)) { return; } state = State.Finished; TargetGenerator.AttemptPowerCellInsert(((PlayerBotActionBase)this).m_agent.Owner, item.Instance); Enumerator enumerator = ((PlayerBotActionBase)this).m_bot.Actions.GetEnumerator(); while (enumerator.MoveNext()) { PlayerBotActionBase current = enumerator.Current; if (((Il2CppObjectBase)current).TryCast() != null) { ((PlayerBotActionBase)this).m_bot.StopAction(current.DescBase); break; } } ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)TravelAction); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) base.OnWarped(position); } } public class CustomBotActionInteractDoor : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public LG_DoorButton TargetButton; public LG_WeakDoor TargetDoor; public float Haste = 1f; public Vector3? TargetPosition; public MethodEnum method = (MethodEnum)7; private PositionReservation m_posReservation; private ObjectReservation m_objReservation; public static AccessLayers s_RequiredLayers = (AccessLayers)211; public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { //IL_000d: 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) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); ((Descriptor)this).RequiredLayers = Descriptor.s_RequiredLayers; } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionInteractDoor(this); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } private void GetTargetPosition() { //IL_001a: 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) if (!TargetPosition.HasValue) { TargetPosition = ((Component)((Descriptor)this).Bot).transform.position; SyncTable syncValues = ((Descriptor)this).Bot.SyncValues; if ((Object)(object)((syncValues != null) ? syncValues.Leader : null) != (Object)null) { SyncTable syncValues2 = ((Descriptor)this).Bot.SyncValues; TargetPosition = ((syncValues2 != null) ? new Vector3?(((Component)syncValues2.Leader).transform.position) : ((Vector3?)null)); } } } private void GetButton() { //IL_0062: 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_0078: 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) GetTargetPosition(); if ((Object)(object)TargetButton != (Object)null) { TargetDoor = ((Il2CppObjectBase)TargetButton.m_door).Cast(); } else { if ((Object)(object)TargetDoor == (Object)null) { return; } float num = float.MinValue; LG_DoorButton targetButton = null; foreach (LG_DoorButton item in (Il2CppArrayBase)(object)TargetDoor.m_buttons) { float num2 = Vector3.Dot(((Component)item).transform.forward, TargetPosition.Value - ((Component)item).transform.position); if (num2 > num) { num = num2; targetButton = item; } } TargetButton = targetButton; } } public override void OnQueued() { //IL_0069: 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_0030: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown base.OnQueued(); GetButton(); if (m_posReservation == null) { m_posReservation = new PositionReservation { CharacterID = ((Descriptor)this).Bot.Agent.CharacterID, Position = ((Component)TargetButton).transform.position, Radius = 0.5f }; } else { m_posReservation.Position = ((Component)TargetButton).transform.position; } PlayerManager.Current.AddPositionReservation(m_posReservation); GameObject val = null; if ((Object)(object)TargetButton != (Object)null && (Object)(object)((Component)TargetButton).gameObject != (Object)null) { val = ((Component)TargetButton).gameObject; } if ((Object)(object)val != (Object)null) { if (m_objReservation == null) { m_objReservation = new ObjectReservation { CharacterID = ((Descriptor)this).Bot.Agent.CharacterID, Object = val }; } else { m_objReservation.Object = val; } PlayerManager.Current.AddGameObjectReservation(m_objReservation); } } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { base.InternalOnTerminated(); PlayerManager.Current.RemovePositionReservation(m_posReservation); PlayerManager.Current.RemoveGameObjectReservation(m_objReservation); } public virtual void CompareAction(ref Descriptor bestAction) { } } private enum State { Idle, Move, StartUnlock, Unlocking, Press, InteractTime, Finished, Failed } private Descriptor TravelAction; private Descriptor LookAction; private Descriptor UnlockAction; private float Haste = 1f; private MethodEnum Method; private LG_DoorButton TargetButton; private LG_WeakDoor TargetDoor; private LG_WeakLock TargetLock; private Vector3 TargetLoction; private Descriptor m_desc; private State state; private static float interactTime = 1f; private float startInteractTimestamp; public new static bool Setup() { return false; } public CustomBotActionInteractDoor() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionInteractDoor(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionInteractDoor(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { //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) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); m_desc = desc; state = State.Idle; TargetButton = m_desc.TargetButton; TargetDoor = m_desc.TargetDoor; Haste = m_desc.Haste; Method = m_desc.method; } public override void Stop() { base.Stop(); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)TravelAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)UnlockAction); } public override bool Update() { if (base.Update()) { return true; } switch (state) { case State.Idle: UpdateStateIdle(); break; case State.Move: UpdateStateMove(); break; case State.StartUnlock: UpdateStateStartUnlock(); break; case State.Unlocking: UpdateStateUnlocking(); break; case State.Press: UpdateStatePress(); break; case State.InteractTime: UpdateStateInteractTime(); break; case State.Finished: ((Descriptor)m_desc).SetCompletionStatus((StatusType)3); return true; case State.Failed: ((Descriptor)m_desc).SetCompletionStatus((StatusType)4); return true; } return !((PlayerBotActionBase)this).IsActive(); } private void UpdateStateIdle() { //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_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0059: Expected O, but got Unknown if (!VerifyTarget()) { state = State.Failed; } Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { DestinationPos = TargetLoction, DestinationType = (DestinationEnum)0, ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = Haste, Persistent = true }; ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); LookAction = null; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { TravelAction = val; state = State.Move; FlexibleMethodDefinition method = new FlexibleMethodDefinition(new Action(OnTravelCompleted), new object[1] { TravelAction }); zActionSub.addOnTerminated((Descriptor)(object)TravelAction, method); } else { state = State.Failed; } } private bool VerifyTarget() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TargetButton == (Object)null) { return false; } if ((Object)(object)TargetDoor == (Object)null) { return false; } if (!GetTargetLocation()) { return false; } if (!zHelpers.CanBotReach(((PlayerBotActionBase)this).m_bot, TargetLoction)) { return false; } return true; } private bool GetTargetLocation() { //IL_0026: 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_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_0040: 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) LG_DoorButton targetButton = TargetButton; GameObject val = ((targetButton != null) ? ((Component)targetButton).gameObject : null); if ((Object)(object)val == (Object)null) { return false; } Transform transform = val.transform; Vector3 val2 = transform.position + transform.forward * RootPlayerBotAction.s_unlockStandDistance; if (!((PlayerBotActionBase)this).SnapPositionToNav(val2, ref TargetLoction)) { return false; } return true; } public void OnTravelCompleted(Descriptor descBase) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (state == State.Move && (int)descBase.Status != 3) { state = State.Failed; } } private void UpdateStateMove() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0021: Unknown result type (might be due to invalid IL or missing references) UpdateLookAction(); Vector3 val = ((Component)((PlayerBotActionBase)this).m_bot).transform.position - TargetLoction; if (((Vector3)(ref val)).magnitude < 1.5f) { GetLock(); if ((Object)(object)TargetLock == (Object)null) { state = State.Press; return; } state = State.StartUnlock; ((PlayerBotActionBase)this).m_bot.StopAction((Descriptor)(object)TravelAction); } } public void GetLock() { LG_WeakDoor val = ((Il2CppObjectBase)TargetButton.m_door).Cast(); if (val.WeakLocks == null || ((Il2CppArrayBase)(object)val.WeakLocks).Count == 0) { return; } foreach (LG_WeakLock item in (Il2CppArrayBase)(object)val.WeakLocks) { if (((Il2CppObjectBase)item.m_holder).Pointer == ((Il2CppObjectBase)TargetButton).Pointer) { TargetLock = item; break; } } } private void UpdateStateStartUnlock() { //IL_0019: 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_0026: 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_0033: 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_0045: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown _ = ((Descriptor)m_desc).Prio; GameObject gameObject = ((Component)TargetButton).gameObject; TargetTypeEnum targetType = (TargetTypeEnum)0; Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { TargetType = targetType, TargetGO = gameObject, Prio = 13f, ParentActionBase = (PlayerBotActionBase)(object)this, TargetPosition = gameObject.transform.position, Method = Method, Lock = TargetLock }; ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)TravelAction); if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { UnlockAction = val; state = State.Unlocking; FlexibleMethodDefinition method = new FlexibleMethodDefinition(new Action(OnUnlockCompleted), new object[1] { UnlockAction }); zActionSub.addOnTerminated((Descriptor)(object)UnlockAction, method); } else { state = State.Failed; } } private void UpdateStateUnlocking() { } private void UpdateStatePress() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0049: 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_0061: 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_0075: Expected O, but got Unknown //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_00f5: Unknown result type (might be due to invalid IL or missing references) if (!((LG_GenericButton)TargetButton).Interact(((PlayerBotActionBase)this).m_bot.Agent)) { state = State.Failed; return; } startInteractTimestamp = Time.time; Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { DestinationPos = TargetLoction, DestinationType = (DestinationEnum)0, ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = Haste, Persistent = true }; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { TravelAction = val; state = State.Move; FlexibleMethodDefinition method = new FlexibleMethodDefinition(new Action(OnTravelCompleted), new object[1] { TravelAction }); zActionSub.addOnTerminated((Descriptor)(object)TravelAction, method); } else { state = State.Failed; } state = State.InteractTime; TypeEnum reachHeight = ((PlayerBotActionBase)this).GetReachHeight(((Component)TargetButton).transform.position.y); ((PlayerBotActionBase)this).m_agent.Sync.SendGenericInteract(reachHeight, true); } private void UpdateStateInteractTime() { UpdateLookAction(); if (Time.time > startInteractTimestamp + interactTime) { state = State.Finished; ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)TravelAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)UnlockAction); } } private void UpdateLookAction() { //IL_0010: 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_001c: 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_0038: 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_0051: Expected O, but got Unknown if (LookAction == null) { Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot, true) { ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = 0.5f, TargetType = (TargetTypeEnum)2, TargetObj = ((Component)TargetButton).transform }; ((Descriptor)val).EventDelegate = DelegateSupport.ConvertDelegate((Delegate)new Action(OnLookActionEvent)); TurnInfo turn = val.Turn; float prio = (val.Turn.SoftPrio = ((Descriptor)val).Prio); turn.Prio = prio; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { LookAction = val; } } } public void OnLookActionEvent(Descriptor descBase) { if (((Il2CppObjectBase)descBase).Pointer != ((Il2CppObjectBase)LookAction).Pointer) { ((PlayerBotActionBase)this).PrintError("Rogue action."); } if (descBase.IsTerminated()) { LookAction = null; } } public void OnUnlockCompleted(Descriptor descBase) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)descBase.Status == 3) { state = State.Press; } else { state = State.Failed; } } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) base.OnWarped(position); } } public class CustomBotActionManualAttack : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public EnemyAgent TargetAgent; public AttackMeansEnum Means = (AttackMeansEnum)1; public PostureEnum Posture = (PostureEnum)2; public StanceEnum stance = (StanceEnum)3; public float Haste = 0.5f; public bool MovementAllowed = true; public PlayerAgent Commander; public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); ((Descriptor)this).RequiredLayers = (AccessLayers)0; } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionManualAttack(this); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override void OnQueued() { base.OnQueued(); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { base.InternalOnTerminated(); } public virtual void CompareAction(ref Descriptor bestAction) { } } public enum State { Idle, Move, Attack, Finished, Failed } private State state; private StanceEnum stance; private EnemyAgent TargetAgent; private AttackMeansEnum Means; private PostureEnum Posture; private float Haste = 0.85f; private bool MovementAllowed; private PlayerAgent Commander; private Descriptor m_desc; private Descriptor AttackAction; private Descriptor TravelAction; private Descriptor MeleAction; private static float walkNoiseCheckInterval = 1f; private static float nextWalkNoiseCheckTimestamp = 0f; private static float walkNoiseChance = 0.02f; private static float hitNoiseChance = 0.1f; private bool wasCooldownState; public new static bool Setup() { return true; } public CustomBotActionManualAttack() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionManualAttack(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionManualAttack(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); m_desc = desc; TargetAgent = desc.TargetAgent; Means = desc.Means; Posture = desc.Posture; Haste = desc.Haste; MovementAllowed = desc.MovementAllowed; Commander = desc.Commander; state = State.Idle; stance = desc.stance; } public override void Stop() { base.Stop(); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)AttackAction); } public override bool Update() { if (base.Update()) { return true; } switch (state) { case State.Idle: UpdateStateIdle(); break; case State.Move: UpdateStateMove(); break; case State.Attack: UpdateStateAttack(); break; case State.Finished: ((Descriptor)m_desc).SetCompletionStatus((StatusType)3); return true; case State.Failed: ((Descriptor)m_desc).SetCompletionStatus((StatusType)4); return true; } return !((PlayerBotActionBase)this).IsActive(); } private void UpdateStateIdle() { //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_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_004a: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown if (!VerifyTarget()) { state = State.Failed; } Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = Haste, TargetAgent = (Agent)(object)TargetAgent, Means = Means, Posture = Posture, Stance = stance, MovementAllowed = MovementAllowed }; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { AttackAction = val; state = State.Move; } else { state = State.Failed; } } private bool VerifyTarget() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TargetAgent == (Object)null) { return false; } if (!((Component)TargetAgent).gameObject.activeInHierarchy) { return false; } if ((Object)(object)Commander == (Object)null) { Commander = ((PlayerBotActionBase)this).m_bot.SyncValues.Leader; } if (!zHelpers.CanBotReach(((PlayerBotActionBase)this).m_bot, ((Component)TargetAgent).transform.position)) { return false; } return true; } private void UpdateStateMove() { //IL_0065: 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_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) if (MeleAction == null || (Object)(object)MeleAction.TargetAgent == (Object)null) { Descriptor attackAction = AttackAction; object meleAction; if (attackAction == null) { meleAction = null; } else { PlayerBotActionBase actionBase = ((Descriptor)attackAction).ActionBase; if (actionBase == null) { meleAction = null; } else { PlayerBotActionAttack obj = ((Il2CppObjectBase)actionBase).Cast(); if (obj == null) { meleAction = null; } else { Descriptor meleeAction = obj.m_meleeAction; meleAction = ((meleeAction != null) ? ((Il2CppObjectBase)meleeAction).Cast() : null); } } } MeleAction = (Descriptor)meleAction; } if (TravelAction == null || TravelAction.DestinationPos == Vector3.zero) { Descriptor meleAction2 = MeleAction; object travelAction; if (meleAction2 == null) { travelAction = null; } else { PlayerBotActionBase actionBase2 = ((Descriptor)meleAction2).ActionBase; if (actionBase2 == null) { travelAction = null; } else { PlayerBotActionMelee obj2 = ((Il2CppObjectBase)actionBase2).Cast(); if (obj2 == null) { travelAction = null; } else { Descriptor travelAction2 = obj2.m_travelAction; travelAction = ((travelAction2 != null) ? ((Il2CppObjectBase)travelAction2).Cast() : null); } } } TravelAction = (Descriptor)travelAction; } if (TravelAction == null || (TravelAction.DestinationPos == Vector3.zero && (Object)(object)TravelAction.DestinationObject == (Object)null)) { return; } if (((Descriptor)TravelAction).IsTerminated()) { state = State.Attack; } if (Time.time > nextWalkNoiseCheckTimestamp) { nextWalkNoiseCheckTimestamp = Time.time + walkNoiseCheckInterval; if (Random.value < walkNoiseChance) { MakePlayerNoise(((PlayerBotActionBase)this).m_agent); } } } private static void MakePlayerNoise(PlayerAgent player, float radius = 15f) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0035: 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_004a: 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_005c: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown if (!((Object)(object)player == (Object)null) && ((Agent)player).Alive) { AIG_CourseNode courseNode = ((Agent)player).CourseNode; if (courseNode != null) { NoiseManager.MakeNoise(new NM_NoiseData { noiseMaker = ((Il2CppObjectBase)player).Cast(), position = ((Component)player).transform.position, radiusMin = 0f, radiusMax = radius, yScale = 1f, node = courseNode, type = (NM_NoiseType)0, includeToNeightbourAreas = true, raycastFirstNode = false }); } } } private void UpdateStateAttack() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 if (!MeleAction.Strike) { MeleAction.Strike = true; } if (((Descriptor)AttackAction).IsTerminated()) { if ((int)((Descriptor)AttackAction).Status == 3) { if (Random.value < hitNoiseChance) { MakePlayerNoise(((PlayerBotActionBase)this).m_agent); } state = State.Finished; } else { state = State.Failed; } return; } if (wasCooldownState && (int)MeleAction.State == 4 && MeleAction.TargetAgent.Alive) { wasCooldownState = true; if (Random.value < hitNoiseChance * 2f) { MakePlayerNoise(((PlayerBotActionBase)this).m_agent); } } if ((int)MeleAction.State != 4) { wasCooldownState = false; } } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) base.OnWarped(position); } } [HarmonyPatch] public static class StrikeFix { [HarmonyPatch(typeof(PlayerBotActionAttack), "UpdateMeleeAttack")] [HarmonyPostfix] public static void PostUpdateMeleeAttack(PlayerBotActionAttack __instance) { if (__instance.m_meleeAction != null && Object.op_Implicit((Object)(object)zActions.isManualAction((Descriptor)(object)__instance.m_meleeAction)) && !__instance.m_meleeAction.Strike) { __instance.m_meleeAction.Strike = true; } } } public class CustomBotActionOpenContainer : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public LG_WeakResourceContainer TargetContainer; public float Haste = 1f; public MethodEnum method = (MethodEnum)7; private PositionReservation m_posReservation; private ObjectReservation m_objReservation; public static AccessLayers s_RequiredLayers = (AccessLayers)195; public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { //IL_000d: 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) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); ((Descriptor)this).RequiredLayers = Descriptor.s_RequiredLayers; } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionOpenContainer(this); } public override bool IsActionAllowed(Descriptor desc) { if (((Il2CppObjectBase)desc).TryCast() != null) { return false; } return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override void OnQueued() { //IL_0063: 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) //IL_0014: 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_0036: 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_0050: Expected O, but got Unknown //IL_00be: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown base.OnQueued(); if (m_posReservation == null) { m_posReservation = new PositionReservation { CharacterID = ((Descriptor)this).Bot.Agent.CharacterID, Position = ((Component)TargetContainer).transform.position, Radius = 0.5f }; } else { m_posReservation.Position = ((Component)TargetContainer).transform.position; } PlayerManager.Current.AddPositionReservation(m_posReservation); GameObject val = null; if ((Object)(object)TargetContainer != (Object)null && (Object)(object)((Component)TargetContainer).gameObject != (Object)null) { val = ((Component)TargetContainer).gameObject; } if ((Object)(object)val != (Object)null) { if (m_objReservation == null) { m_objReservation = new ObjectReservation { CharacterID = ((Descriptor)this).Bot.Agent.CharacterID, Object = val }; } else { m_objReservation.Object = val; } PlayerManager.Current.AddGameObjectReservation(m_objReservation); } } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { base.InternalOnTerminated(); PlayerManager.Current.RemovePositionReservation(m_posReservation); PlayerManager.Current.RemoveGameObjectReservation(m_objReservation); } public virtual void CompareAction(ref Descriptor bestAction) { } } private enum State { Idle, Move, StartUnlock, Unlocking, StartOpening, Opening, Open, Finished, Failed } private Descriptor TravelAction; private Descriptor LookAction; private Descriptor UnlockAction; private float Haste = 1f; private LG_WeakResourceContainer TargetContainer; private Vector3 TargetLoction; private Descriptor m_desc; private State state; private float openingTime = 1f; private float startOpeningTimestamp; public new static bool Setup() { return false; } public CustomBotActionOpenContainer() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionOpenContainer(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionOpenContainer(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); m_desc = desc; state = State.Idle; TargetContainer = m_desc.TargetContainer; Haste = m_desc.Haste; } public override void Stop() { ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)TravelAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)UnlockAction); base.Stop(); } public override bool Update() { if (base.Update()) { return true; } switch (state) { case State.Idle: UpdateStateIdle(); break; case State.Move: UpdateStateMove(); break; case State.StartUnlock: UpdateStateStartUnlock(); break; case State.Unlocking: UpdateStateUnlocking(); break; case State.StartOpening: UpdateStateStartOpening(); break; case State.Opening: UpdateStateOpening(); break; case State.Open: UpdateStateOpen(); break; case State.Finished: ((Descriptor)m_desc).SetCompletionStatus((StatusType)3); return true; case State.Failed: ((Descriptor)m_desc).SetCompletionStatus((StatusType)4); return true; } return !((PlayerBotActionBase)this).IsActive(); } private void UpdateStateIdle() { //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_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0059: Expected O, but got Unknown if (!VerifyTarget()) { state = State.Failed; } Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { DestinationPos = TargetLoction, DestinationType = (DestinationEnum)0, ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = Haste, Persistent = true }; ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); LookAction = null; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { TravelAction = val; state = State.Move; FlexibleMethodDefinition method = new FlexibleMethodDefinition(new Action(OnTravelCompleted), new object[1] { TravelAction }); zActionSub.addOnTerminated((Descriptor)(object)TravelAction, method); } else { state = State.Failed; } } private void UpdateStateMove() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0021: Unknown result type (might be due to invalid IL or missing references) UpdateLookAction(); Vector3 val = ((Component)((PlayerBotActionBase)this).m_bot).transform.position - TargetLoction; if (((Vector3)(ref val)).magnitude < 0.1f) { if ((Object)(object)TargetContainer.m_weakLock == (Object)null) { state = State.StartOpening; return; } state = State.StartUnlock; ((PlayerBotActionBase)this).m_bot.StopAction((Descriptor)(object)TravelAction); } } private void UpdateStateStartUnlock() { //IL_0019: 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_0026: 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_0033: 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_0045: 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_0056: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown _ = ((Descriptor)m_desc).Prio; GameObject gameObject = ((Component)TargetContainer).gameObject; TargetTypeEnum targetType = (TargetTypeEnum)1; Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { TargetType = targetType, TargetGO = gameObject, Prio = 13f, ParentActionBase = (PlayerBotActionBase)(object)this, TargetPosition = gameObject.transform.position, Method = m_desc.method, Lock = TargetContainer.m_weakLock }; ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)LookAction); if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { UnlockAction = val; state = State.Unlocking; FlexibleMethodDefinition method = new FlexibleMethodDefinition(new Action(OnUnlockCompleted), new object[1] { UnlockAction }); zActionSub.addOnTerminated((Descriptor)(object)UnlockAction, method); } else { state = State.Failed; } } private void UpdateStateUnlocking() { } private void UpdateStateStartOpening() { //IL_001d: 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_002c: 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) UpdateLookAction(); startOpeningTimestamp = Time.time; TypeEnum reachHeight = ((PlayerBotActionBase)this).GetReachHeight(((Component)TargetContainer).transform.position.y); ((PlayerBotActionBase)this).m_agent.Sync.SendGenericInteract(reachHeight, true); state = State.Opening; } private void UpdateStateOpening() { UpdateLookAction(); if (Time.time > startOpeningTimestamp + openingTime) { state = State.Open; } } private void UpdateStateOpen() { TargetContainer.TriggerOpen(false); ((PlayerBotActionBase)this).m_bot.StopAction((Descriptor)(object)TravelAction); ((PlayerBotActionBase)this).m_bot.StopAction((Descriptor)(object)LookAction); state = State.Finished; } public void OnTravelCompleted(Descriptor descBase) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (state == State.Move && (int)descBase.Status != 3) { state = State.Failed; } } public void OnUnlockCompleted(Descriptor descBase) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)descBase.Status == 3) { state = State.StartOpening; } else { state = State.Failed; } } private void UpdateLookAction() { //IL_0010: 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_001c: 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_0038: 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_0051: Expected O, but got Unknown if (LookAction == null) { Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot, true) { ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = 0.5f, TargetType = (TargetTypeEnum)2, TargetObj = ((Component)TargetContainer).transform }; ((Descriptor)val).EventDelegate = DelegateSupport.ConvertDelegate((Delegate)new Action(OnLookActionEvent)); TurnInfo turn = val.Turn; float prio = (val.Turn.SoftPrio = ((Descriptor)val).Prio); turn.Prio = prio; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { LookAction = val; } } } public void OnLookActionEvent(Descriptor descBase) { if (((Il2CppObjectBase)descBase).Pointer != ((Il2CppObjectBase)LookAction).Pointer) { ((PlayerBotActionBase)this).PrintError("Rogue action."); } if (descBase.IsTerminated()) { LookAction = null; } } private bool VerifyTarget() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TargetContainer == (Object)null) { return false; } if (!GetTargetLocation()) { return false; } if (!zHelpers.CanBotReach(((PlayerBotActionBase)this).m_bot, TargetLoction)) { return false; } return true; } private bool GetTargetLocation() { //IL_001f: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)TargetContainer).gameObject; if ((Object)(object)gameObject == (Object)null) { return false; } Transform transform = gameObject.transform; Vector3 val = transform.position - transform.up * 1.5f; if (!((PlayerBotActionBase)this).SnapPositionToNav(val, ref TargetLoction)) { return false; } return true; } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) base.OnWarped(position); } } public class CustomBotActionRefillSentry : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public SentryGunInstance TargetSentry; public float Haste; private PositionReservation m_posReservation; private ObjectReservation m_objReservation; public static AccessLayers s_RequiredLayers = (AccessLayers)1347; public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); ((Descriptor)this).RequiredLayers = s_RequiredLayers; } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionRefillSentry(this); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override void OnQueued() { //IL_0063: 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) //IL_0014: 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_0036: 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_0050: Expected O, but got Unknown //IL_00be: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown base.OnQueued(); if (m_posReservation == null) { m_posReservation = new PositionReservation { CharacterID = ((Descriptor)this).Bot.Agent.CharacterID, Position = ((Component)TargetSentry).transform.position, Radius = 0.5f }; } else { m_posReservation.Position = ((Component)TargetSentry).transform.position; } PlayerManager.Current.AddPositionReservation(m_posReservation); GameObject val = null; if ((Object)(object)TargetSentry != (Object)null && (Object)(object)((Component)TargetSentry).gameObject != (Object)null) { val = ((Component)TargetSentry).gameObject; } if ((Object)(object)val != (Object)null) { if (m_objReservation == null) { m_objReservation = new ObjectReservation { CharacterID = ((Descriptor)this).Bot.Agent.CharacterID, Object = val }; } else { m_objReservation.Object = val; } PlayerManager.Current.AddGameObjectReservation(m_objReservation); } } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { base.InternalOnTerminated(); PlayerManager.Current.RemovePositionReservation(m_posReservation); PlayerManager.Current.RemoveGameObjectReservation(m_objReservation); } public virtual void CompareAction(ref Descriptor bestAction) { } } protected enum State { Idle, Move, StartApply, Applying, Finished, Failed } private SentryGunInstance TargetSentry; private float Haste; private static float s_ApproachRadius = 1.1f; private static float s_VerifyRadiusMul = 1.15f; private static float s_duration = 1.5f; private Descriptor m_desc; private PlayerInventorySynced m_inventory; private State state; private Descriptor m_travelAction; private Descriptor m_equipAction; private Descriptor m_lookAction; private float ammoutCanGivePercent; private ItemEquippable m_item; private PlayerAmmoStorage AmmoStorage; private PlayerBackpack backpack; private float m_applyStartTime; public new static bool Setup() { return true; } public CustomBotActionRefillSentry() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionRefillSentry(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionRefillSentry(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); m_desc = desc; TargetSentry = m_desc.TargetSentry; Haste = m_desc.Haste; state = State.Idle; } public override void Stop() { base.Stop(); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)m_travelAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)m_lookAction); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)m_equipAction); } public override bool Update() { if (base.Update()) { return true; } switch (state) { case State.Idle: UpdateStateIdle(); break; case State.Move: UpdateStateMove(); break; case State.StartApply: UpdateStateStartApply(); break; case State.Applying: UpdateStateApplying(); break; case State.Finished: ((Descriptor)m_desc).SetCompletionStatus((StatusType)3); return true; case State.Failed: ((Descriptor)m_desc).SetCompletionStatus((StatusType)4); return true; } return !((PlayerBotActionBase)this).IsActive(); } private void UpdateStateIdle() { //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_0026: 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_0037: 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_004f: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown if (!VerifyTarget()) { state = State.Failed; } Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { DestinationPos = ((Component)TargetSentry).transform.position, DestinationType = (DestinationEnum)0, ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = Haste, Radius = 1f, Persistent = true }; ((Descriptor)val).EventDelegate = DelegateSupport.ConvertDelegate((Delegate)new Action(OnTravelCompleted)); ((PlayerBotActionBase)this).SafeStopAction((Descriptor)(object)m_lookAction); m_lookAction = null; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { m_travelAction = val; state = State.Move; } else { state = State.Failed; } } private bool VerifyTarget() { //IL_010c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TargetSentry == (Object)null) { return false; } if (!TargetSentry.NeedToolAmmo()) { return false; } backpack = PlayerBackpackManager.GetBackpack(((PlayerBotActionBase)this).m_agent.Owner); BackpackItem val = default(BackpackItem); if (!backpack.TryGetBackpackItem((InventorySlot)4, ref val)) { return false; } if (val == null) { return false; } if (val.ItemID != 127) { return false; } PlayerAgent agent = ((PlayerBotActionBase)this).m_agent; m_inventory = ((agent != null) ? ((Il2CppObjectBase)agent.Inventory).Cast() : null); if ((Object)(object)m_inventory == (Object)null) { return false; } m_item = ((Il2CppObjectBase)val.Instance).Cast(); AmmoStorage = PlayerBackpackManager.GetBackpack(((PlayerBotActionBase)this).m_bot.Agent.Owner).AmmoStorage; if (AmmoStorage == null) { return false; } ammoutCanGivePercent = AmmoStorage.ResourcePackAmmo.CostOfBullet / AmmoStorage.ResourcePackAmmo.AmmoMaxCap; if (!AmmoStorage.ResourcePackAmmo.HasBulletsLeft) { return false; } if (!zHelpers.CanBotReach(((PlayerBotActionBase)this).m_bot, ((Component)TargetSentry).transform.position)) { return false; } return true; } public void OnTravelCompleted(Descriptor descBase) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (state == State.Move && (int)descBase.Status != 3) { state = State.Failed; } } private void UpdateLookAction() { //IL_0010: 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_001c: 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_0038: 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_0051: Expected O, but got Unknown if (m_lookAction == null) { Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot, true) { ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = 0.5f, TargetType = (TargetTypeEnum)2, TargetObj = ((Component)TargetSentry).transform }; ((Descriptor)val).EventDelegate = DelegateSupport.ConvertDelegate((Delegate)new Action(OnLookActionEvent)); TurnInfo turn = val.Turn; float prio = (val.Turn.SoftPrio = ((Descriptor)val).Prio); turn.Prio = prio; if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { m_lookAction = val; } } } private void UpdateStateMove() { //IL_0027: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!VerifyTarget()) { state = State.Failed; } UpdateLookAction(); UpdateEquipAction(); Vector3 val = ((Component)((PlayerBotActionBase)this).m_bot).transform.position - ((Component)TargetSentry).transform.position; if (((Vector3)(ref val)).magnitude < 1.5f) { state = State.StartApply; } } private bool UpdateEquipAction() { //IL_0029: 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_0035: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if (m_equipAction == null && (Object)(object)((PlayerInventoryBase)m_inventory).WieldedItem != (Object)(object)m_item) { Descriptor val = new Descriptor(((PlayerBotActionBase)this).m_bot) { ParentActionBase = (PlayerBotActionBase)(object)this, Prio = ((Descriptor)m_desc).Prio, Haste = m_desc.Haste, Item = m_item }; ((Descriptor)val).EventDelegate = DelegateSupport.ConvertDelegate((Delegate)new Action(OnEquipActionEvent)); if (((PlayerBotActionBase)this).m_bot.RequestAction((Descriptor)(object)val)) { m_equipAction = val; } return false; } return true; } public void OnLookActionEvent(Descriptor descBase) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 if (((Il2CppObjectBase)descBase).Pointer != ((Il2CppObjectBase)m_lookAction).Pointer) { ((PlayerBotActionBase)this).PrintError("Rogue action."); } if ((int)((Descriptor)m_lookAction).Status != 2) { m_lookAction = null; } } public void OnEquipActionEvent(Descriptor descBase) { if (((Il2CppObjectBase)descBase).Pointer != ((Il2CppObjectBase)m_equipAction).Pointer) { ((PlayerBotActionBase)this).PrintError("Rogue action."); } if (descBase.IsTerminated()) { m_equipAction = null; } } private void UpdateStateStartApply() { m_applyStartTime = Time.time; state = State.Applying; } private void UpdateStateApplying() { if (UpdateEquipAction() && Time.time - m_applyStartTime > PlayerBotActionShareResourcePack.s_duration) { Apply(); } } private void Apply() { AmmoStorage.UpdateBulletsInPack((AmmoType)3, -1); TargetSentry.GiveAmmoRel(((PlayerBotActionBase)this).m_agent, 0f, 0f, ammoutCanGivePercent); state = State.Finished; ((PlayerBotActionBase)this).m_agent.Sound.Post(EVENTS.AMMOPACK_APPLY, true); if (AmmoStorage.GetBulletsInPack((AmmoType)3) < 1) { PlayerDialogManager.WantToStartDialog(138u, ((PlayerBotActionBase)this).m_agent); backpack.TryClearSlot((InventorySlot)4); ((PlayerBotActionBase)this).m_agent.Sound.Post(EVENTS.PACK_DISCARD, true); } ((Descriptor)m_desc).SetCompletionStatus((StatusType)3); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) base.OnWarped(position); } } public class CustomBotActionTemplate : CustomActionBase { public new class Descriptor : CustomActionBase.Descriptor { public Descriptor() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Descriptor(PlayerAIBot bot) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitDescriptor(bot); } public override PlayerBotActionBase CreateAction() { return (PlayerBotActionBase)(object)new CustomBotActionTemplate(this); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override void OnQueued() { base.OnQueued(); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void InternalOnTerminated() { base.InternalOnTerminated(); } public virtual void CompareAction(ref Descriptor bestAction) { } } public new static bool Setup() { return true; } public CustomBotActionTemplate() : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionTemplate(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public CustomBotActionTemplate(Descriptor desc) : base(ClassInjector.DerivedConstructorPointer()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); InitFromDescriptor(desc); } public override void Stop() { base.Stop(); } public override bool Update() { if (base.Update()) { return true; } return !((PlayerBotActionBase)this).IsActive(); } public override bool IsActionAllowed(Descriptor desc) { return base.IsActionAllowed(desc); } public override bool CheckCollision(Descriptor desc) { return base.CheckCollision(desc); } public override AccessLayers GetAccessLayersRuntime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return base.GetAccessLayersRuntime(); } public override void OnWarped(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) base.OnWarped(position); } } }