using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Numerics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Imperium.API.Types; using Imperium.API.Types.Networking; using Imperium.API.Types.Portals; using Imperium.Console; using Imperium.Console.Commands; using Imperium.Console.Registries; using Imperium.Core; using Imperium.Core.EventLogging; using Imperium.Core.Input; using Imperium.Core.Input.InputUtilsStatic; using Imperium.Core.Lifecycle; using Imperium.Core.Portal; using Imperium.Core.Scripts; using Imperium.Core.Settings; using Imperium.Extensions; using Imperium.Integration; using Imperium.Interface; using Imperium.Interface.Common; using Imperium.Interface.ConsoleUI; using Imperium.Interface.ImperiumUI; using Imperium.Interface.ImperiumUI.Windows.ArenaControl; using Imperium.Interface.ImperiumUI.Windows.ArenaControl.Widgets; using Imperium.Interface.ImperiumUI.Windows.ControlCenter; using Imperium.Interface.ImperiumUI.Windows.ControlCenter.Widgets; using Imperium.Interface.ImperiumUI.Windows.EventLog; using Imperium.Interface.ImperiumUI.Windows.LevelGeneration; using Imperium.Interface.ImperiumUI.Windows.ObjectExplorer; using Imperium.Interface.ImperiumUI.Windows.ObjectExplorer.ObjectListEntry; using Imperium.Interface.ImperiumUI.Windows.Portal; using Imperium.Interface.ImperiumUI.Windows.Preferences; using Imperium.Interface.ImperiumUI.Windows.Rendering; using Imperium.Interface.ImperiumUI.Windows.Teleport; using Imperium.Interface.ImperiumUI.Windows.Teleport.Widgets; using Imperium.Interface.ImperiumUI.Windows.Upgrades; using Imperium.Interface.ImperiumUI.Windows.Visualization; using Imperium.Interface.ImperiumUI.Windows.Visualization.ObjectVisualizerEntries; using Imperium.Interface.ImperiumUI.Windows.Visualization.Widgets; using Imperium.Interface.LayerSelector; using Imperium.Interface.MapUI; using Imperium.Networking; using Imperium.Patches; using Imperium.Types; using Imperium.Util; using Imperium.Visualizers; using Imperium.Visualizers.Objects; using JetBrains.Annotations; using Librarium; using Librarium.Binding; using Microsoft.CodeAnalysis; using MonoMod.Utils; using Newtonsoft.Json; using Photon.Pun; using RepoSteamNetworking.API; using RepoSteamNetworking.Networking; using RepoSteamNetworking.Networking.Serialization; using Steamworks; using Steamworks.Data; using TMPro; using Unity.VisualScripting; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; using UniverseLib.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Discord.Sdk")] [assembly: IgnoresAccessChecksTo("Domain_Reload")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")] [assembly: IgnoresAccessChecksTo("Unity.Localization")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.ResourceManager")] [assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("giosuel")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A powerful all-in-one debugging and admin tool to test and explore game mechanics and functionality in R.E.P.O.")] [assembly: AssemblyFileVersion("0.4.0.0")] [assembly: AssemblyInformationalVersion("0.4.0+b14c70743d9d71e64eb139c672afda6fa6d603c4")] [assembly: AssemblyProduct("Imperium Repo")] [assembly: AssemblyTitle("giosuel.Imperium")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/giosuel/imperium-repo")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { if (!EqualityComparer.Default.Equals(_item, item)) { return -1; } return 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace Imperium { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("giosuel.Imperium", "Imperium Repo", "0.4.0")] public class Imperium : BaseUnityPlugin { private static Harmony Harmony; private static ManualLogSource Log; private static ConfigFile configFile; internal static ImpBinding ActiveCamera; internal static MenuManager MenuManager => MenuManager.instance; internal static PlayerAvatar Player => PlayerAvatar.instance; internal static GameDirector GameDirector => GameDirector.instance; internal static ImpSettings Settings { get; private set; } internal static ImpOutput IO { get; private set; } internal static ImpNetworking Networking { get; set; } internal static StartupManager StartupManager { get; private set; } internal static PortalManager PortalManager { get; private set; } internal static ConsoleManager ConsoleManager { get; private set; } internal static GameManager GameManager { get; private set; } internal static ObjectManager ObjectManager { get; private set; } internal static PlayerManager PlayerManager { get; private set; } internal static ArenaManager ArenaManager { get; private set; } internal static Visualization Visualization { get; private set; } internal static ImpEventLog EventLog { get; private set; } internal static InputBlocker InputBlocker { get; private set; } internal static ImpMap Map { get; private set; } internal static ImpFreecam Freecam { get; private set; } internal static ImpNightVision NightVision { get; private set; } internal static TapeMeasure TapeMeasure { get; private set; } internal static ImpInputBindings InputBindings { get; private set; } internal static PositionIndicator PositionIndicator { get; private set; } internal static ImpInterfaceManager Interface { get; private set; } internal static WaypointManager WaypointManager { get; private set; } internal static bool IsImperiumInitialized { get; private set; } internal static bool IsImperiumLaunched { get; private set; } internal static ImpBinaryBinding IsImperiumEnabled { get; private set; } internal static ImpBinaryBinding IsLevelLoaded { get; private set; } internal static IBinding IsGameLevel { get; private set; } internal static GameObject GameObject { get; private set; } private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown configFile = ((BaseUnityPlugin)this).Config; Log = ((BaseUnityPlugin)this).Logger; IsLevelLoaded = new ImpBinaryBinding(false, (Action)null, (Action)null); IsGameLevel = (IBinding)(object)new ImpExternalBinding((Func)GameManager.IsGameLevel, (IBinding)(object)IsLevelLoaded, (Action)null, (Action)null); IsImperiumEnabled = new ImpBinaryBinding(false, (Action)null, (Action)null); Settings = new ImpSettings(((BaseUnityPlugin)this).Config); ((ImpBinding)(object)IsLevelLoaded).OnUpdate += OnLevelLoaded; IO = new ImpOutput(Log); StartupManager = new StartupManager(); Networking = new ImpNetworking(); PortalManager = new PortalManager(); if (ImpAssets.Load()) { Harmony = new Harmony("0.4.0"); PreLaunchPatches(); IsImperiumInitialized = true; IO.LogInfo("[INIT] Imperium has been successfully initialized \\o/"); } } internal static void Launch() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (IsImperiumInitialized && !IsImperiumLaunched) { GameObject = new GameObject("Imperium"); Object.DontDestroyOnLoad((Object)(object)GameObject); InputBlocker = new InputBlocker(); InputBindings = new ImpInputBindings(); ActiveCamera = (ImpBinding)(object)new ImpExternalBinding((Func)(() => Camera.main), (IBinding)(object)IsLevelLoaded, (Action)null, (Action)null); IO.BindNotificationSettings(Settings); Networking.BindAllowClients((IBinding)(object)Settings.Preferences.AllowClients); Interface = ImpInterfaceManager.Create(Settings.Preferences.Theme, GameObject.transform); EventLog = new ImpEventLog(); GameManager = ImpLifecycleObject.Create(GameObject.transform, (IBinding)(object)IsLevelLoaded, (IBinding)(object)ImpNetworking.ConnectedPlayers); ArenaManager = ImpLifecycleObject.Create(GameObject.transform, (IBinding)(object)IsLevelLoaded, (IBinding)(object)ImpNetworking.ConnectedPlayers); ObjectManager = ImpLifecycleObject.Create(GameObject.transform, (IBinding)(object)IsLevelLoaded, (IBinding)(object)ImpNetworking.ConnectedPlayers); PlayerManager = ImpLifecycleObject.Create(GameObject.transform, (IBinding)(object)IsLevelLoaded, (IBinding)(object)ImpNetworking.ConnectedPlayers); WaypointManager = ImpLifecycleObject.Create(GameObject.transform, (IBinding)(object)IsLevelLoaded, (IBinding)(object)ImpNetworking.ConnectedPlayers); ConsoleManager = ImpLifecycleObject.Create(GameObject.transform, (IBinding)(object)IsLevelLoaded, (IBinding)(object)ImpNetworking.ConnectedPlayers); ConsoleSettingsRegistry.RegisterSettings(ConsoleManager, Settings); ConsoleActionRegistry.RegisterActions(ConsoleManager); Visualization = new Visualization(GameObject.transform, ObjectManager, configFile); Map = ImpScript.Create(GameObject.transform); Freecam = ImpScript.Create(GameObject.transform); NightVision = ImpScript.Create(GameObject.transform); TapeMeasure = ImpScript.Create(GameObject.transform, ImpAssets.TapeIndicatorObject); PositionIndicator = ImpScript.Create(GameObject.transform, ImpAssets.PositionIndicatorObject); Harmony.PatchAll(); UnityExplorerIntegration.PatchFunctions(Harmony); IsImperiumLaunched = true; if (Settings.Preferences.EnableImperium.Value) { EnableImperium(); IsLevelLoaded.SetFalse(); } else { DisableImperium(); } } } internal static void DisableImperium() { if (IsImperiumLaunched && ((ImpBinding)(object)IsImperiumEnabled).Value) { IsImperiumEnabled.SetFalse(); Interface.Close(); PlayerManager.IsFlying.SetFalse(); Freecam.IsFreecamEnabled.SetFalse(); PositionIndicator.Deactivate(); TapeMeasure.Deactivate(); InputBindings.BaseMap.Disable(); InputBindings.StaticMap.Disable(); InputBindings.FreecamMap.Disable(); InputBindings.InterfaceMap.Disable(); } } internal static void EnableImperium() { if (IsImperiumLaunched && !((ImpBinding)(object)IsImperiumEnabled).Value) { IsImperiumEnabled.SetTrue(); Settings.LoadAll(); RegisterInterfaces(); InputBindings.BaseMap.Enable(); InputBindings.StaticMap.Enable(); InputBindings.FreecamMap.Enable(); InputBindings.InterfaceMap.Enable(); } } internal static void Unload() { if (IsImperiumLaunched) { Harmony.UnpatchSelf(); Networking.Unload(); DisableImperium(); PreLaunchPatches(); Object.Destroy((Object)(object)GameObject); IsImperiumLaunched = false; } } internal static void Reload() { Unload(); Launch(); IO.Send("[SYS] Successfully reloaded Imperium."); } private static void OnLevelLoaded(bool isLoaded) { if (isLoaded) { Settings.LoadAll(); } } private static void RegisterInterfaces() { Interface.OpenInterface.OnUpdate += delegate(BaseUI openInterface) { if (Object.op_Implicit((Object)(object)openInterface)) { PositionIndicator.Deactivate(); } }; Interface.RegisterInterface(ImpAssets.ImperiumUIObject, InputBindings.InterfaceMap.ImperiumUI, Array.Empty>()); Interface.RegisterInterface(ImpAssets.ConsoleUIObject, InputBindings.InterfaceMap.SpawningUI, Array.Empty>()); Interface.RegisterInterface(ImpAssets.MapUIObject, InputBindings.InterfaceMap.MapUI, new IBinding[1] { IsGameLevel }); Interface.RegisterInterface(ImpAssets.MinimapSettingsObject, null, Array.Empty>()); Interface.RefreshTheme(); IO.LogInfo("[SYS] Imperium interfaces have been registered! \\o/"); } private static void PreLaunchPatches() { Harmony.PatchAll(typeof(PreInitPatches)); } } internal static class LCMPluginInfo { public const string PLUGIN_GUID = "giosuel.Imperium"; public const string PLUGIN_NAME = "Imperium Repo"; public const string PLUGIN_VERSION = "0.4.0"; } } namespace Imperium.Visualizers { internal class EnemyGizmos : BaseVisualizer, EnemyGizmo> { internal readonly Dictionary EntityInfoConfigs = new Dictionary(); private readonly ConfigFile config; internal EnemyGizmos(Transform parent, IBinding> objectsBinding, IBinding isArenaLoaded, ConfigFile config) : base(parent, objectsBinding, (IBinding)null) { EnemyGizmos enemyGizmos = this; this.config = config; foreach (ExtendedEnemySetup item in Imperium.ObjectManager.LoadedEntities.Value) { EntityInfoConfigs[item.EnemyName] = new EntityGizmoConfig(item.EnemyName, config); } isArenaLoaded.OnTrigger += delegate { enemyGizmos.HardRefresh(objectsBinding.Value); }; } protected override void OnRefresh(IReadOnlyCollection objects) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown foreach (EnemyParent item in objects.Where((EnemyParent entity) => Object.op_Implicit((Object)(object)entity))) { if (!visualizerObjects.ContainsKey(((Object)item).GetInstanceID())) { if (!EntityInfoConfigs.TryGetValue(item.enemyName, out var value)) { value = new EntityGizmoConfig(item.enemyName, config); EntityInfoConfigs[item.enemyName] = value; } GameObject val = new GameObject($"ImpVis_EnemyGizmo_{((Object)item).GetInstanceID()}"); val.transform.SetParent(base.parent); EnemyGizmo enemyGizmo = val.AddComponent(); enemyGizmo.Init(value, item); visualizerObjects[((Object)item).GetInstanceID()] = enemyGizmo; } } } private void HardRefresh(IReadOnlyCollection objects) { ClearObjects(); OnRefresh(objects); } internal void VisionUpdate(EnemyVision vision) { if (!((Object)(object)vision?.Enemy == (Object)null) && visualizerObjects.TryGetValue(((Object)vision.Enemy.EnemyParent).GetInstanceID(), out var value)) { value.VisionUpdate(); } } internal void NoiseVisualizerUpdate(EnemyStateInvestigate instance, Vector3 origin) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (visualizerObjects.TryGetValue(((Object)instance.Enemy.EnemyParent).GetInstanceID(), out var value)) { value.NoiseUpdate(origin); } } } internal class LevelPointVisualizer : BaseVisualizer { private readonly GameObject levelPointParent; private readonly Color invalidColor = new Color(1f, 0.47f, 0.07f); private readonly Color validColor = new Color(0.06f, 1f, 0.64f); internal LevelPointVisualizer(Transform parent, ImpBinding isLoadedBinding, ImpBinding visibilityBinding) : base(parent, (IBinding)(object)isLoadedBinding, (IBinding)(object)visibilityBinding) { //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_002a: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown levelPointParent = new GameObject("ImpVis_LevelPoints"); levelPointParent.transform.SetParent(parent); } protected override void OnRefresh(bool isSceneLoaded) { //IL_0040: 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_0061: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_0102: 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_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_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) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_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) ClearObjects(); if (!isSceneLoaded) { return; } Dictionary dictionary = new Dictionary(); LevelPoint[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (LevelPoint val in array) { GameObject val2 = Object.Instantiate(ImpAssets.LevelPoint, levelPointParent.transform); val2.transform.localScale = Vector3.one * 0.14f; val2.transform.position = ((Component)val).transform.position; ComponentHolderProtocol.AddComponent((Object)(object)val2.transform.Find("point")); visualizerObjects.Add(((Object)val2).GetInstanceID(), (Component)(object)val2.transform); foreach (LevelPoint connectedPoint in val.ConnectedPoints) { if (Object.op_Implicit((Object)(object)connectedPoint)) { Edge key = new Edge(((Component)val).transform.position, ((Component)connectedPoint).transform.position); if (!dictionary.TryGetValue(key, out var value)) { value = Geometry.CreateLine(levelPointParent.transform, 0.025f, true, (string)null, (Color?)invalidColor, (Color?)invalidColor, false, (Vector3[])(object)new Vector3[2] { key.PointA + Vector3.up * 0.04f, key.PointB + Vector3.up * 0.04f }); visualizerObjects.Add(((Object)value).GetInstanceID(), (Component)(object)((Component)value).transform); dictionary[key] = value; } else { Geometry.SetLineColor(value, (Color?)validColor, (Color?)validColor); } } } } } } internal class NavMeshVisualizer : BaseVisualizer { private readonly GameObject navMeshParent; internal NavMeshVisualizer(Transform parent, ImpBinding isLoadedBinding, ImpBinding visibilityBinding) : base(parent, (IBinding)(object)isLoadedBinding, (IBinding)(object)visibilityBinding) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown navMeshParent = new GameObject("ImpVis_NavMesh"); navMeshParent.transform.SetParent(parent); } protected override void OnRefresh(bool _) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown ClearObjects(); int num = 0; foreach (Mesh navmeshSurface in Geometry.GetNavmeshSurfaces()) { GameObject val = new GameObject($"ImpVis_NavMeshSurface_{num}"); val.transform.SetParent(navMeshParent.transform); MeshRenderer val2 = val.AddComponent(); ((Renderer)val2).material = ImpAssets.NavmeshMaterial; MeshFilter val3 = val.AddComponent(); val3.mesh = navmeshSurface; val.AddComponent(); visualizerObjects[((Object)val).GetInstanceID()] = (Component)(object)val2; num++; } } internal void Refresh() { OnRefresh(_: true); } } internal class NoiseIndicators : ImpScript { private const int noiseIndicatorCount = 20; private const int noiseIndicatorDisplayTime = 10; private readonly NoiseIndicator[] noiseIndicators = new NoiseIndicator[20]; private int noiseIndex; private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown for (int i = 0; i < 20; i++) { GameObject val = new GameObject("ImpVis_NoiseIndicator" + i); val.transform.SetParent(((Component)this).transform); noiseIndicators[i] = val.AddComponent(); } ((ImpBinding)(object)Imperium.Settings.Visualization.NoiseIndicators).OnUpdate += delegate(bool value) { if (!value) { for (int j = 0; j < 20; j++) { noiseIndicators[j].Deactivate(); } } }; } internal void Clear() { NoiseIndicator[] array = noiseIndicators; foreach (NoiseIndicator noiseIndicator in array) { noiseIndicator.Deactivate(); } } internal void AddNoise(Vector3 position, float radius, bool isMuted) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (Imperium.Settings.Visualization.NoiseIndicators.Value && !(!Imperium.IsLevelLoaded) && !Imperium.GameManager.IsGameLoading) { noiseIndicators[noiseIndex].Activate(position, radius, 10, isMuted); noiseIndex = (noiseIndex + 1) % noiseIndicators.Length; } } } internal class ObjectInsights : BaseVisualizer, ObjectInsight> { private readonly ConfigFile config; internal readonly ImpBinding>> InsightVisibilityBindings = new ImpBinding>>(new Dictionary>(), (Dictionary>)null, (Action>>)null, (Action>>)null, false); private readonly ImpBinding>> registeredInsights = new ImpBinding>>(new Dictionary>(), (Dictionary>)null, (Action>>)null, (Action>>)null, false); private readonly HashSet insightVisualizerObjects = new HashSet(); private readonly Dictionary entityColliderCache = new Dictionary(); internal ObjectInsights(Transform parent, ConfigFile config) : base(parent, (IBinding>)null, (IBinding)null) { this.config = config; RegisterDefaultInsights(); Refresh(); foreach (var (_, val2) in InsightVisibilityBindings.Value) { val2.OnTrigger += Refresh; } registeredInsights.OnTrigger += Refresh; } internal void Refresh() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown if (!Imperium.IsLevelLoaded || InsightVisibilityBindings.Value.All((KeyValuePair> binding) => !binding.Value.Value)) { return; } GameObject[] array = Object.FindObjectsOfType(); foreach (GameObject val in array) { if (insightVisualizerObjects.Contains(((Object)val).GetInstanceID())) { continue; } foreach (Component item in from component in val.GetComponents() where Object.op_Implicit((Object)(object)component) select component) { InsightDefinition insightDefinition = FindMostMatchingInsightDefinition(((object)item).GetType()); if (insightDefinition != null) { if (!visualizerObjects.TryGetValue(((Object)item).GetInstanceID(), out var value)) { GameObject val2 = new GameObject($"Imp_ObjectInsight_{((Object)val).GetInstanceID()}"); val2.transform.SetParent(val.transform); insightVisualizerObjects.Add(((Object)val2).GetInstanceID()); value = val2.AddComponent(); value.Init(item, insightDefinition); visualizerObjects[((Object)item).GetInstanceID()] = value; } else if (insightDefinition != value.InsightDefinition) { value.UpdateInsightDefinition(insightDefinition); } } } } } internal InsightDefinition InsightsFor() where T : Component { if (registeredInsights.Value.TryGetValue(typeof(T), out var value)) { return value as InsightDefinition; } InsightDefinitionImpl insightDefinitionImpl = new InsightDefinitionImpl(registeredInsights.Value, InsightVisibilityBindings, config); registeredInsights.Value[typeof(T)] = (InsightDefinition)insightDefinitionImpl; registeredInsights.Refresh(); return insightDefinitionImpl; } private InsightDefinition FindMostMatchingInsightDefinition(Type inputType) { foreach (Type parentType in Debugging.GetParentTypes(inputType)) { if (registeredInsights.Value.TryGetValue(parentType, out var value)) { return value; } } return null; } private void RegisterDefaultInsights() { this.InsightsFor().SetNameGenerator((EnemyParent enemy) => enemy.enemyName).SetIsDisabledGenerator((EnemyParent enemy) => !enemy.Spawned) .RegisterInsight("Health", (EnemyParent enemy) => $"{enemy.Enemy.Health.health} HP") .RegisterInsight("Current State", GameManager.GetEnemyState) .RegisterInsight("Spawned Paused", (EnemyParent enemy) => Formatting.FormatSecondsMinutes(enemy.spawnedTimerPauseTimer)) .RegisterInsight("Spawned Timer", (EnemyParent enemy) => Formatting.FormatSecondsMinutes(enemy.SpawnedTimer)) .RegisterInsight("Despawned Timer", (EnemyParent enemy) => Formatting.FormatSecondsMinutes(enemy.DespawnedTimer)) .RegisterInsight("Valuable Timer", (EnemyParent enemy) => Formatting.FormatSecondsMinutes(enemy.valuableSpawnTimer)) .RegisterInsight("No Vision Timer", (EnemyParent enemy) => (!Object.op_Implicit((Object)(object)enemy.Enemy.Vision)) ? "?" : Formatting.FormatSecondsMinutes(enemy.Enemy.Vision.DisableTimer)) .RegisterInsight("Player Close", (EnemyParent enemy) => enemy.playerClose.ToString()) .RegisterInsight("Spawn Idle Timer", (EnemyParent _) => Formatting.FormatSecondsMinutes(EnemyDirector.instance.spawnIdlePauseTimer)) .RegisterInsight("Action Timer", (EnemyParent _) => Formatting.FormatSecondsMinutes(EnemyDirector.instance.enemyActionAmount)) .SetPositionOverride((EnemyParent enemy) => ((Component)enemy.Enemy).transform.position) .SetConfigKey("Enemies"); this.InsightsFor().SetNameGenerator((ExtractionPoint _) => "Extraction Point").RegisterInsight("Current State", (ExtractionPoint point) => ((object)(State)(ref point.currentState)).ToString()) .RegisterInsight("Haul Goal", (ExtractionPoint point) => SemiFunc.DollarGetString(point.haulGoal)) .RegisterInsight("Haul Current", (ExtractionPoint point) => SemiFunc.DollarGetString(point.haulCurrent)) .RegisterInsight("In Start Room", (ExtractionPoint point) => $"{point.inStartRoom}") .SetPositionOverride((ExtractionPoint point) => ((Component)point).transform.position) .SetConfigKey("Extraction Points"); this.InsightsFor().SetNameGenerator((ValuableObject valuable) => ((Object)valuable).name.Replace("Valuable ", "").Replace("(Clone)", "")).RegisterInsight("Value", (ValuableObject valuable) => "$" + SemiFunc.DollarGetString(Mathf.RoundToInt(valuable.dollarValueCurrent))) .RegisterInsight("Is Discovered", (ValuableObject valuable) => $"{valuable.discovered}") .RegisterInsight("Durability", (ValuableObject valuable) => $"{valuable.durabilityPreset.durability}") .RegisterInsight("Discovered Timer", (ValuableObject valuable) => $"{valuable.discoveredReminderTimer:0}s") .SetPositionOverride((ValuableObject valuable) => ((Component)valuable).transform.position) .SetConfigKey("Valuables"); } private Vector3 DefaultPositionOverride(Component obj) { //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_0084: 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_0099: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0034: Unknown result type (might be due to invalid IL or missing references) if (!entityColliderCache.TryGetValue(((Object)obj).GetInstanceID(), out var value)) { BoxCollider componentInChildren = obj.GetComponentInChildren(); Vector3? obj2; if (componentInChildren == null) { CapsuleCollider componentInChildren2 = obj.GetComponentInChildren(); obj2 = ((componentInChildren2 != null) ? new Vector3?(componentInChildren2.center) : null); } else { obj2 = componentInChildren.center; } value = obj2; entityColliderCache[((Object)obj).GetInstanceID()] = value; } if (!value.HasValue) { return obj.transform.position; } return obj.transform.position + Vector3.up * value.Value.y * obj.transform.localScale.y * 1.5f; } } internal class PlayerGizmos : BaseVisualizer, PlayerGizmo> { internal readonly Dictionary PlayerInfoConfigs = new Dictionary(); internal PlayerGizmos(Transform parent, IBinding> objectsBinding, ConfigFile config) : base(parent, objectsBinding, (IBinding)null) { foreach (PlayerAvatar player in Imperium.GameDirector.PlayerList) { PlayerInfoConfigs[player] = new PlayerGizmoConfig(player.playerName, config); } } protected override void OnRefresh(IReadOnlyCollection objects) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown ClearObjects(); foreach (PlayerAvatar @object in objects) { if (!visualizerObjects.ContainsKey(((Object)@object).GetInstanceID())) { GameObject val = new GameObject($"ImpVis_PlayerGizmo_{((Object)@object).GetInstanceID()}"); val.transform.SetParent(base.parent); PlayerGizmo playerGizmo = val.AddComponent(); if (!PlayerInfoConfigs.TryGetValue(@object, out var value)) { Imperium.IO.LogInfo("[ERR] Player was not found, no config loaded for insight."); continue; } playerGizmo.Init(value, ((Component)@object).GetComponent()); visualizerObjects[((Object)@object).GetInstanceID()] = playerGizmo; } } } internal void PlayerNoiseUpdate(PlayerAvatar player, float range) { visualizerObjects[((Object)player).GetInstanceID()].NoiseUpdate(range); } } public class StaticVisualizers : ImpScript { private readonly Dictionary VisualizerRegistry = new Dictionary(); private readonly HashSet EnabledVisualizers = new HashSet(); private readonly Dictionary>> VisualizerObjectMap = new Dictionary>>(); private static Material DefaultMaterial => ImpAssets.WireframeCyan; internal void Collider(bool isOn, string identifier, VisualizerIdentifier type, Material material = null, bool overrideInactive = false) { Visualize(identifier, isOn, VisualizeColliders, type, 0f, material, overrideInactive); } internal void Collider(bool isOn, Material material = null, bool overrideInactive = false) { Visualize(typeof(T).AssemblyQualifiedName, isOn, VisualizeColliders, VisualizerIdentifier.Component, 0f, material, overrideInactive); } internal void Point(bool isOn, string identifier, VisualizerIdentifier type, float radius = 1f, Material material = null, bool overrideInactive = false) { Visualize(identifier, isOn, VisualizePoint, type, radius, material, overrideInactive); } internal void Point(bool isOn, float radius = 1f, Material material = null, bool overrideInactive = false) { Visualize(typeof(T).AssemblyQualifiedName, isOn, VisualizePoint, VisualizerIdentifier.Component, radius, material, overrideInactive); } internal void Refresh(bool hardRefresh = false) { if (hardRefresh) { CollectionExtensions.Do(VisualizerObjectMap.Values.SelectMany((Dictionary> objs) => objs.Values).SelectMany((List list) => list), (Action)Object.Destroy); VisualizerObjectMap.Clear(); } foreach (string key in VisualizerRegistry.Keys) { ToggleVisualizer(key, EnabledVisualizers.Contains(key)); } } private void ToggleVisualizer(string uniqueIdentifier, bool isOn) { if (!VisualizerRegistry.TryGetValue(uniqueIdentifier, out var value)) { Imperium.IO.LogError("[VIS] Failed to toggle unregistered visualizer '" + uniqueIdentifier + "'. Aborting."); return; } if (!isOn) { EnabledVisualizers.Remove(uniqueIdentifier); if (!VisualizerObjectMap.TryGetValue(uniqueIdentifier, out var value2)) { return; } { foreach (List value5 in value2.Values) { ImpUtils.ToggleGameObjects(value5, isOn: false); } return; } } EnabledVisualizers.Add(uniqueIdentifier); if (!VisualizerObjectMap.TryGetValue(uniqueIdentifier, out var value3)) { value3 = new Dictionary>(); VisualizerObjectMap[uniqueIdentifier] = value3; } foreach (GameObject targetObject in GetTargetObjects(value.identifier, value.type, value.overrideInactive)) { if (value3.TryGetValue(((Object)targetObject).GetInstanceID(), out var value4)) { ImpUtils.ToggleGameObjects(value4, isOn: true); } else { value3.Add(((Object)targetObject).GetInstanceID(), value.visualizer(targetObject, value.size, value.material, value.overrideInactive).ToList()); } } } private void Visualize(string identifier, bool isOn, VisualizerFunc visualizer, VisualizerIdentifier type, float size, Material material, bool overrideInactive) { string text = $"{identifier}_{size}"; VisualizerRegistry[text] = new VisualizerDefinition(identifier, type, size, visualizer, material, overrideInactive); ToggleVisualizer(text, isOn); } private IEnumerable VisualizePoint(GameObject target, float size, Material material = null, bool overrideInactive = false) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) Transform val = (overrideInactive ? ((Component)this).transform : target.transform); GameObject val2 = Geometry.CreatePrimitive((PrimitiveType)0, val, material ?? DefaultMaterial, size, 0, $"ImpVis_{((Object)target).GetInstanceID()}", true, false, false); val2.transform.position = target.transform.position; return new <>z__ReadOnlySingleElementList(val2); } private static IEnumerable VisualizeColliders(GameObject target, float size, Material material = null, bool overrideInactive = false) { return (from collider in target.GetComponentsInChildren() select VisualizeBoxCollider(collider, material)).Concat(from collider in target.GetComponentsInChildren() select VisualizeCapsuleCollider(collider, material)).Concat(from collider in target.GetComponentsInChildren() select VisualizeSphereCollider(collider, material)).ToList(); } private static GameObject VisualizeBoxCollider(BoxCollider collider, Material material = null) { //IL_004d: 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_006f: 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) if (!Object.op_Implicit((Object)(object)collider)) { return null; } GameObject val = Geometry.CreatePrimitive((PrimitiveType)3, ((Component)collider).transform, material ?? DefaultMaterial, 1f, 0, $"ImpVis_{((Object)collider).GetInstanceID()}", true, false, false); Transform transform = ((Component)collider).transform; val.transform.position = transform.position; val.transform.localPosition = collider.center; val.transform.localScale = collider.size; val.transform.rotation = transform.rotation; return val; } private static GameObject VisualizeCapsuleCollider(CapsuleCollider collider, Material material = null) { //IL_004b: 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_0090: 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) if (!Object.op_Implicit((Object)(object)collider)) { return null; } GameObject val = Geometry.CreatePrimitive((PrimitiveType)1, ((Component)collider).transform, material ?? DefaultMaterial, 1f, 0, $"ImpVis_{((Object)collider).GetInstanceID()}", true, false, false); val.transform.position = ((Component)collider).transform.position; val.transform.localPosition = collider.center; val.transform.localScale = new Vector3(collider.radius * 2f, collider.height / 2f, collider.radius * 2f); val.transform.rotation = ((Component)collider).transform.rotation; return val; } private static GameObject VisualizeSphereCollider(SphereCollider collider, Material material = null) { //IL_004b: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)collider)) { return null; } GameObject val = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)collider).transform, material ?? DefaultMaterial, 1f, 0, $"ImpVis_{((Object)collider).GetInstanceID()}", true, false, false); val.transform.position = ((Component)collider).transform.position; val.transform.localPosition = collider.center; val.transform.localScale = Vector3.one * collider.radius; val.transform.rotation = ((Component)collider).transform.rotation; return val; } private static IEnumerable GetTargetObjects(string identifier, VisualizerIdentifier type, bool overrideInactive) { return type switch { VisualizerIdentifier.Tag => GameObject.FindGameObjectsWithTag(identifier), VisualizerIdentifier.Layer => (from obj in Object.FindObjectsByType((FindObjectsInactive)(overrideInactive ? 1 : 0), (FindObjectsSortMode)0) where obj.layer == LayerMask.NameToLayer(identifier) select obj).ToArray(), VisualizerIdentifier.Component => from obj in ((IEnumerable)Object.FindObjectsByType(Type.GetType(identifier), (FindObjectsSortMode)0)).Select((Func)delegate(Object obj) { GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null); if (val != null) { return val; } Component val2 = (Component)(object)((obj is Component) ? obj : null); return (val2 != null) ? val2.gameObject : null; }) where Object.op_Implicit((Object)(object)obj) select obj, _ => throw new ArgumentOutOfRangeException("type", type, null), }; } } } namespace Imperium.Visualizers.Objects { public class EnemyGizmo : MonoBehaviour { private const float visualizerTimeout = 2f; private EnemyParent enemyParent; private EntityGizmoConfig entityConfig; private LineRenderer lastHeardNoiseLine; private GameObject lastHeardNoiseDot; private const int pathSegmentCount = 30; private LineRenderer pathLine; private readonly GameObject[] pathDots = (GameObject[])(object)new GameObject[30]; private EnemyVision enemyVision; private GameObject coneStanding; private GameObject coneCrouching; private GameObject coneCrawling; private GameObject proximitySphereStanding; private GameObject proximitySphereCrouching; private GameObject playerCloseSphere; private GameObject playerVeryCloseSphere; private float lastUpdateTimer; private bool hasInitializedVision; internal void Init(EntityGizmoConfig config, EnemyParent entity) { //IL_003c: 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_00bc: 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_0106: Unknown result type (might be due to invalid IL or missing references) entityConfig = config; enemyParent = entity; enemyVision = entity.Enemy.Vision; pathLine = Geometry.CreateLine(((Component)this).transform, 0.04f, true, (string)null, (Color?)new Color(1f, 0.67f, 0.03f), (Color?)new Color(1f, 0.67f, 0.03f), true, Array.Empty()); for (int i = 0; i < 30; i++) { pathDots[i] = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)this).transform, ImpAssets.WireframeYellow, 1f, 0, (string)null, true, false, true); } lastHeardNoiseLine = Geometry.CreateLine(((Component)this).transform, 0.03f, true, (string)null, (Color?)new Color(1f, 0.43f, 0.44f), (Color?)new Color(1f, 0.43f, 0.44f), true, Array.Empty()); lastHeardNoiseDot = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)this).transform, new Color(1f, 1f, 1f), 0.2f, 0, (string)null, true, false, true); playerCloseSphere = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)enemyParent.Enemy).transform, ImpAssets.WireframeOrange, 40f, 0, (string)null, true, false, true); playerVeryCloseSphere = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)enemyParent.Enemy).transform, ImpAssets.WireframeRed, 12f, 0, (string)null, true, false, true); GameObject val = Object.Instantiate(ImpAssets.EnemyStatus, ((Component)this).transform); val.AddComponent().Init(enemyParent, entityConfig); if (enemyParent.Enemy.HasVision) { InitVisionObjects(enemyParent.Enemy.Vision); } } private void InitVisionObjects(EnemyVision vision) { coneStanding = CreateCone("standing", vision.VisionDotStanding, vision.VisionDistance, ImpAssets.WireframeCyan); coneCrouching = CreateCone("crouching", vision.VisionDotCrouch, vision.VisionDistance, ImpAssets.WireframeGreen); coneCrawling = CreateCone("crawl", vision.VisionDotCrawl, vision.VisionDistance, ImpAssets.WireframeRed); proximitySphereStanding = CreateSphere("standing", vision.VisionDistanceClose, ImpAssets.WireframeCyan); proximitySphereCrouching = CreateSphere("crouching", vision.VisionDistanceCloseCrouch, ImpAssets.WireframeRed); hasInitializedVision = true; } private (GameObject, GameObject) SelectActiveVisionObjects() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 GameObject val; GameObject val2; if ((int)enemyVision.Enemy.CurrentState == 10) { val = coneStanding; val2 = proximitySphereStanding; coneCrouching.SetActive(false); coneCrawling.SetActive(false); proximitySphereCrouching.SetActive(false); } else if (PlayerAvatar.instance.isCrawling && !PlayerAvatar.instance.isTumbling) { val = coneCrawling; val2 = proximitySphereCrouching; coneStanding.SetActive(false); coneCrouching.SetActive(false); proximitySphereStanding.SetActive(false); } else if (PlayerAvatar.instance.isCrouching || PlayerAvatar.instance.isTumbling) { val = coneCrouching; val2 = proximitySphereCrouching; coneStanding.SetActive(false); coneCrawling.SetActive(false); proximitySphereStanding.SetActive(false); } else { val = coneStanding; val2 = proximitySphereStanding; coneCrouching.SetActive(false); coneCrawling.SetActive(false); proximitySphereCrouching.SetActive(false); } if (entityConfig.Vision.Value) { val.SetActive(true); } if (entityConfig.Proximity.Value) { val2.SetActive(true); } return (val, val2); } private GameObject CreateCone(string identifier, float dot, float distance, Material material) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0058: 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) GameObject val = new GameObject("ImpVis_LoS_" + identifier); val.transform.SetParent(((Component)this).transform); val.SetActive(false); ((Renderer)val.AddComponent()).material = material; val.AddComponent().mesh = Geometry.CreateCone(Mathf.Acos(dot) * (180f / MathF.PI)); val.transform.localScale = Vector3.one * distance; return val; } private GameObject CreateSphere(string identifier, float radius, Material material) { return Geometry.CreatePrimitive((PrimitiveType)0, ((Component)this).transform, material, radius * 2f, 0, "ImpVis_Instant_" + identifier, true, false, true); } internal void NoiseUpdate(Vector3 origin) { //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_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_0097: Unknown result type (might be due to invalid IL or missing references) ((Component)lastHeardNoiseLine).gameObject.SetActive(entityConfig.Hearing.Value); lastHeardNoiseDot.gameObject.SetActive(entityConfig.Hearing.Value); if (entityConfig.Hearing.Value) { Geometry.SetLinePositions(lastHeardNoiseLine, (Vector3[])(object)new Vector3[2] { ((Component)enemyParent.Enemy).transform.position, origin }); lastHeardNoiseDot.gameObject.transform.position = origin; } } internal void VisionUpdate() { //IL_00a2: 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_0123: 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_0143: Unknown result type (might be due to invalid IL or missing references) if (hasInitializedVision && (entityConfig.Vision.Value || entityConfig.Proximity.Value)) { lastUpdateTimer = 2f; var (val, val2) = SelectActiveVisionObjects(); if (entityConfig.Vision.Value) { val.transform.SetParent(Imperium.Settings.Visualization.SmoothAnimations.Value ? enemyVision.VisionTransform : ((Component)this).transform); val.transform.position = enemyVision.VisionTransform.position; val.transform.rotation = Quaternion.LookRotation(enemyVision.VisionTransform.forward); } if (entityConfig.Proximity.Value) { val2.transform.SetParent(Imperium.Settings.Visualization.SmoothAnimations.Value ? enemyVision.VisionTransform : ((Component)this).transform); val2.transform.position = enemyVision.VisionTransform.position; val2.transform.rotation = Quaternion.LookRotation(enemyVision.VisionTransform.forward); } } } private void Update() { if (!Object.op_Implicit((Object)(object)enemyParent)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (hasInitializedVision) { if (!entityConfig.Vision.Value || lastUpdateTimer < 0f) { coneStanding.SetActive(false); coneCrouching.SetActive(false); coneCrawling.SetActive(false); } if (!entityConfig.Proximity.Value || lastUpdateTimer < 0f) { proximitySphereStanding.SetActive(false); proximitySphereCrouching.SetActive(false); } } DrawPathLines(entityConfig.Pathfinding.Value && ((Behaviour)enemyParent).enabled); DrawNoiseLine(entityConfig.Hearing.Value && ((Behaviour)enemyParent).enabled); DrawPlayerCloseSpheres(); int item = (SemiFunc.IsMultiplayer() ? ((MonoBehaviourPun)enemyParent).photonView.ViewID : ((Object)((Component)enemyParent).gameObject).GetInstanceID()); if (!Imperium.ObjectManager.DisabledObjects.Value.Contains(item)) { lastUpdateTimer -= Time.deltaTime; } } private void DrawNoiseLine(bool isShown) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 if (!isShown || (int)enemyParent.Enemy.CurrentState != 7) { ((Component)lastHeardNoiseLine).gameObject.SetActive(false); lastHeardNoiseDot.gameObject.SetActive(false); } } private void DrawPathLines(bool isShown) { //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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)enemyParent) || !Object.op_Implicit((Object)(object)enemyParent.Enemy.NavMeshAgent?.Agent)) { GameObject[] array = pathDots; foreach (GameObject val in array) { val.gameObject.SetActive(false); } ((Component)pathLine).gameObject.SetActive(false); return; } ((Component)pathLine).gameObject.SetActive(isShown); Vector3[] corners = enemyParent.Enemy.NavMeshAgent.Agent.path.corners; LineRenderer obj = pathLine; Vector3 position = ((Component)enemyParent.Enemy).transform.position; Vector3[] array2 = corners; int num = 0; Vector3[] array3 = (Vector3[])(object)new Vector3[1 + array2.Length]; array3[num] = position; num++; ReadOnlySpan readOnlySpan = new ReadOnlySpan(array2); readOnlySpan.CopyTo(new Span(array3).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; Geometry.SetLinePositions(obj, array3); for (int j = 0; j < 30; j++) { if (j < corners.Length) { pathDots[j].gameObject.SetActive(isShown); if (isShown) { pathDots[j].transform.position = corners[j]; pathDots[j].transform.localScale = Vector3.one * 0.15f; } } else { pathDots[j].gameObject.SetActive(false); } } } private void DrawPlayerCloseSpheres() { bool value = Imperium.Settings.Visualization.PlayerProximity.Value; playerCloseSphere.SetActive(value); } private void OnDestroy() { if (hasInitializedVision) { Object.Destroy((Object)(object)coneStanding); Object.Destroy((Object)(object)coneCrouching); Object.Destroy((Object)(object)coneCrawling); Object.Destroy((Object)(object)proximitySphereStanding); Object.Destroy((Object)(object)proximitySphereCrouching); } Object.Destroy((Object)(object)playerCloseSphere); Object.Destroy((Object)(object)playerVeryCloseSphere); } } internal class EntityGizmoConfig { internal readonly string entityName; internal readonly ImpConfig Info; internal readonly ImpConfig Pathfinding; internal readonly ImpConfig Proximity; internal readonly ImpConfig Vision; internal readonly ImpConfig Hearing; internal readonly ImpConfig Vitality; internal readonly ImpConfig Custom; internal EntityGizmoConfig(string entityName, ConfigFile config) { this.entityName = entityName; string text = entityName.Replace("\"", "").Replace("'", "").Replace("[", "") .Replace("]", "") .Replace("\n", "") .Replace("\t", "") .Replace("\\", ""); Info = new ImpConfig(config, "Visualization.EntityGizmos.Info", text, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); Pathfinding = new ImpConfig(config, "Visualization.EntityGizmos.Pathfinding", text, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); Proximity = new ImpConfig(config, "Visualization.EntityGizmos.Proximity", text, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); Vision = new ImpConfig(config, "Visualization.EntityGizmos.Vision", text, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); Hearing = new ImpConfig(config, "Visualization.EntityGizmos.Hearing", text, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); Vitality = new ImpConfig(config, "Visualization.EntityGizmos.Vitality", text, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); Custom = new ImpConfig(config, "Visualization.EntityGizmos.Custom", text, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); } } public class EnemyStatus : MonoBehaviour { private Transform healthBar; private Image healthBarImage; private TMP_Text healthBarText; private Transform detectionBar; private Image detectionBarImage; private TMP_Text detectionBarText; private EnemyParent enemy; private RectTransform canvasRect; private RectTransform panelRect; private Transform origin; private bool hasVision; private Vector3 panelOffset; private Gradient healthGradient; private EntityGizmoConfig config; private bool leFunniDuck; private float currentHealthValue; private const float smoothSpeed = 5f; private void Awake() { canvasRect = ((Component)((Component)this).transform).GetComponent(); panelRect = ((Component)((Component)this).transform.Find("Panel")).GetComponent(); ((Component)panelRect).gameObject.SetActive(false); healthBar = ((Transform)panelRect).Find("Health/Container/Bar"); healthBarImage = ((Component)healthBar).GetComponent(); healthBarText = ((Component)((Transform)panelRect).Find("Health/Container/Text")).GetComponent(); detectionBar = ((Transform)panelRect).Find("Detection/Container/Bar"); detectionBarImage = ((Component)detectionBar).GetComponent(); detectionBarText = ((Component)((Transform)panelRect).Find("Detection/Container/Text")).GetComponent(); detectionBarText.text = ""; SetHealthGradient(); } private void SetHealthGradient() { //IL_0008: 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) //IL_001e: 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_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_0053: 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_0072: 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_0099: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(Color.red, 0.3f), new GradientColorKey(Color.yellow, 0.6f), new GradientColorKey(Color.green, 1f) }; GradientAlphaKey[] array2 = (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey { alpha = 1f, time = 0f }, new GradientAlphaKey { alpha = 1f, time = 1f } }; healthGradient = new Gradient(); healthGradient.SetKeys(array, array2); } internal void Init(EnemyParent enemyParent, EntityGizmoConfig enemyConfig) { //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) enemy = enemyParent; config = enemyConfig; hasVision = enemy.Enemy.HasVision; origin = (enemy.Enemy.HasVision ? enemy.Enemy.Vision.VisionTransform : ((Component)enemy.Enemy).transform); panelOffset = GetPanelOffset(enemy); leFunniDuck = enemy.enemyName == "Apex Predator" && Random.Range(0, 100) < 5; if (!hasVision) { ((Component)((Transform)panelRect).Find("Detection")).gameObject.SetActive(false); } } private void Update() { //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_0074: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_01c1: 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_01d0: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min((float)enemy.Enemy.Health.healthCurrent / (float)enemy.Enemy.Health.health, 1f); currentHealthValue = Mathf.Lerp(currentHealthValue, num, Time.deltaTime * 5f); Transform obj = healthBar; Vector3 localScale = detectionBar.localScale; localScale.x = currentHealthValue; obj.localScale = localScale; ((Graphic)healthBarImage).color = healthGradient.Evaluate(currentHealthValue); healthBarText.text = $"{enemy.Enemy.Health.healthCurrent} HP"; if (hasVision) { int num2 = (((int)enemy.Enemy.CurrentState == 10) ? (enemy.Enemy.Vision.VisionsToTrigger + 1) : ((PlayerAvatar.instance.isCrawling && !PlayerAvatar.instance.isTumbling) ? (enemy.Enemy.Vision.VisionsToTriggerCrawl + 1) : ((!PlayerAvatar.instance.isCrouching && !PlayerAvatar.instance.isTumbling) ? (enemy.Enemy.Vision.VisionsToTrigger + 1) : (enemy.Enemy.Vision.VisionsToTriggerCrouch + 1)))); int valueOrDefault = MiscHelpers.GetValueOrDefault(enemy.Enemy.Vision.VisionsTriggered, Imperium.Player.photonView.ViewID); float x = Mathf.Min((float)valueOrDefault / (float)num2, 1f); Transform obj2 = detectionBar; localScale = detectionBar.localScale; localScale.x = x; obj2.localScale = localScale; detectionBarText.text = ((valueOrDefault < num2) ? ((valueOrDefault == 0) ? "Idle" : $"{Mathf.Min(valueOrDefault, num2)}/{num2}") : (leFunniDuck ? "Ducktected!" : "Detected!")); } } private void LateUpdate() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_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_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_00b9: 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_00d0: Unknown result type (might be due to invalid IL or missing references) Camera value = Imperium.ActiveCamera.Value; if (!Object.op_Implicit((Object)(object)value) || !Object.op_Implicit((Object)(object)enemy) || !enemy.Spawned || !config.Vitality.Value) { ((Component)panelRect).gameObject.SetActive(false); return; } Vector3 position = origin.position + panelOffset; ((Component)canvasRect).transform.position = position; ((Component)panelRect).gameObject.SetActive(true); Vector3 val = -(((Component)Imperium.ActiveCamera.Value).transform.position - ((Component)panelRect).transform.position); Quaternion rotation = Quaternion.LookRotation(val, Vector3.up); ((Component)panelRect).transform.rotation = rotation; } private static Vector3 GetPanelOffset(EnemyParent enemyParent) { //IL_000e: 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_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_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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)enemyParent).GetComponentInChildren() != (Object)null) { return Vector3.down * 0.2f; } if ((Object)(object)((Component)enemyParent).GetComponentInChildren() != (Object)null) { return Vector3.up * 0.6f; } if ((Object)(object)((Component)enemyParent).GetComponentInChildren() != (Object)null) { return Vector3.up * 0.4f; } if ((Object)(object)((Component)enemyParent).GetComponentInChildren() != (Object)null) { return Vector3.up * 2.4f; } return Vector3.up * 0.2f; } } public class LevelPointObject : MonoBehaviour { private 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_0023: 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) Transform transform = ((Component)this).transform; Vector3 position = ((Component)Imperium.ActiveCamera.Value).transform.position; position.y = ((Component)this).transform.position.y; transform.LookAt(position); } } public class NoiseIndicator : MonoBehaviour { private float timer; private bool isDone; private GameObject normalSphere; private GameObject spawnDecreaseSphere; private GameObject mutedSphere; internal void Awake() { normalSphere = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)this).transform, ImpAssets.FresnelOrange, 1f, 0, (string)null, true, false, false); spawnDecreaseSphere = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)this).transform, ImpAssets.FresnelRed, 1f, 0, (string)null, true, false, false); mutedSphere = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)this).transform, ImpAssets.FresnelWhite, 1f, 0, (string)null, true, false, false); } internal void Activate(Vector3 position, float radius, int time, bool isMuted) { //IL_0015: 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_0041: 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_005c: 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) timer = time; isDone = false; ((Component)this).transform.position = position; mutedSphere.transform.localScale = Vector3.one * radius; normalSphere.transform.localScale = Vector3.one * radius; spawnDecreaseSphere.transform.localScale = Vector3.one * radius; mutedSphere.SetActive(isMuted); normalSphere.SetActive(!isMuted && radius < 15f); spawnDecreaseSphere.SetActive(!isMuted && radius >= 15f); ((Component)this).gameObject.SetActive(true); } internal void Deactivate() { ((Component)this).gameObject.SetActive(false); } private void LateUpdate() { if (((ImpBinding)(object)Imperium.IsLevelLoaded).Value && !Imperium.GameManager.IsGameLoading) { if (timer >= 0f) { timer -= Time.deltaTime; } else if (!isDone) { Deactivate(); isDone = true; } } } } public class ObjectInsight : MonoBehaviour { private Component targetObject; private GameObject insightPanelObject; private Transform panelContainer; private Transform insightPanel; private RectTransform insightPanelRect; private RectTransform insightPanelCanvasRect; private TMP_Text panelObjectName; private TMP_Text panelObjectPersonalName; private GameObject panelEntryTemplate; private Image deathOverlay; private readonly Dictionary targetInsightEntries = new Dictionary(); private readonly ImpTimer overlayUpdateTimer = ImpTimer.ForInterval(1f); internal InsightDefinition InsightDefinition { get; private set; } internal void Init(Component target, InsightDefinition definition) { targetObject = target; InsightDefinition = definition; insightPanelObject = Object.Instantiate(ImpAssets.ObjectInsightPanel, ((Component)this).transform); panelContainer = insightPanelObject.transform.Find("Container"); insightPanel = panelContainer.Find("Panel"); insightPanelRect = ((Component)panelContainer).GetComponent(); insightPanelCanvasRect = insightPanelObject.GetComponent(); panelObjectName = ((Component)insightPanel.Find("Name")).GetComponent(); panelObjectPersonalName = ((Component)insightPanel.Find("PersonalName")).GetComponent(); deathOverlay = ((Component)insightPanel.Find("Death")).GetComponent(); panelEntryTemplate = ((Component)insightPanel.Find("Template")).gameObject; panelEntryTemplate.SetActive(false); InsightDefinition.Insights.OnUpdate += OnInsightsPrimaryUpdate; OnInsightsPrimaryUpdate(InsightDefinition.Insights.Value); UpdateInsightOverlay(); } internal void UpdateInsightDefinition(InsightDefinition definition) { InsightDefinition.Insights.OnUpdate -= OnInsightsPrimaryUpdate; InsightDefinition = definition; InsightDefinition.Insights.OnUpdate += OnInsightsPrimaryUpdate; } private void OnInsightsPrimaryUpdate(Dictionary> insights) { foreach (var (text2, func2) in insights) { if (!targetInsightEntries.TryGetValue(text2, out var value)) { targetInsightEntries[text2] = CreateInsightEntry(text2, func2); } else { value.Init(text2, func2, targetObject); } } foreach (string item in targetInsightEntries.Keys.ToHashSet().Except(insights.Keys.ToHashSet())) { Object.Destroy((Object)(object)((Component)targetInsightEntries[item]).gameObject); targetInsightEntries.Remove(item); } } private ObjectInsightEntry CreateInsightEntry(string insightName, Func insightGenerator) { if (targetInsightEntries.TryGetValue(insightName, out var value)) { Object.Destroy((Object)(object)((Component)value).gameObject); } GameObject val = Object.Instantiate(panelEntryTemplate, insightPanel); val.SetActive(true); ObjectInsightEntry objectInsightEntry = val.gameObject.AddComponent(); objectInsightEntry.Init(insightName, insightGenerator, targetObject); return objectInsightEntry; } private void UpdateInsightOverlay() { panelObjectName.text = ((InsightDefinition.NameGenerator != null) ? InsightDefinition.NameGenerator(targetObject) : ((Object)targetObject).GetInstanceID().ToString()); if (InsightDefinition.PersonalNameGenerator == null) { ((Component)panelObjectPersonalName).gameObject.SetActive(false); } else { panelObjectPersonalName.text = InsightDefinition.PersonalNameGenerator(targetObject); ((Component)panelObjectPersonalName).gameObject.SetActive(true); } if (InsightDefinition.IsDisabledGenerator != null && InsightDefinition.IsDisabledGenerator(targetObject)) { ((Component)deathOverlay).gameObject.SetActive(true); } else { ((Component)deathOverlay).gameObject.SetActive(false); } } private void LateUpdate() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_0119: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) Camera value = Imperium.ActiveCamera.Value; if (!Object.op_Implicit((Object)(object)value) || !Object.op_Implicit((Object)(object)targetObject) || !Object.op_Implicit((Object)(object)insightPanelCanvasRect)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } RenderTexture activeTexture = value.activeTexture; if (InsightDefinition.VisibilityBinding.Value) { Func isDisabledGenerator = InsightDefinition.IsDisabledGenerator; if ((isDisabledGenerator == null || !isDisabledGenerator(targetObject) || !Imperium.Settings.Visualization.SSHideDespawned.Value) && Object.op_Implicit((Object)(object)activeTexture) && ((ImpBinding)(object)Imperium.IsLevelLoaded).Value && !Imperium.GameManager.IsGameLoading) { Vector3 val = InsightDefinition.PositionOverride?.Invoke(targetObject) ?? targetObject.transform.position; Vector3 val2 = value.WorldToScreenPoint(val); if ((Physics.Linecast(((Component)value).transform.position, val) && !Imperium.Settings.Visualization.SSAlwaysOnTop.Value) || val2.z < 0f) { insightPanelObject.SetActive(false); return; } if (overlayUpdateTimer.Tick()) { UpdateInsightOverlay(); } float num = (float)((Texture)activeTexture).width / insightPanelCanvasRect.sizeDelta.x; float num2 = (float)((Texture)activeTexture).height / insightPanelCanvasRect.sizeDelta.y; float num3 = val2.x / num; float num4 = val2.y / num2; insightPanelRect.anchoredPosition = new Vector2(num3, num4); float num5 = Imperium.Settings.Visualization.SSOverlayScale.Value; if (Imperium.Settings.Visualization.SSAutoScale.Value) { num5 *= Math.Clamp(5f / Vector3.Distance(((Component)value).transform.position, val), 0.01f, 1f); } ((Component)this).transform.localScale = Vector3.one; ((Transform)insightPanelRect).localScale = num5 * Vector3.one; insightPanelObject.SetActive(true); return; } } insightPanelObject.SetActive(false); } } public class ObjectInsightEntry : MonoBehaviour { private Component targetComponent; private Func insightGenerator; private TMP_Text insightValueText; private readonly ImpTimer entryUpdateTimer = ImpTimer.ForInterval(0.2f); public void Init(string insightName, Func generator, Component target) { insightGenerator = generator; targetComponent = target; insightValueText = ((Component)((Component)this).transform.Find("Value")).GetComponent(); ((Component)((Component)this).transform.Find("Title")).GetComponent().text = insightName; insightValueText.text = insightGenerator(targetComponent); } private void Update() { if (entryUpdateTimer.Tick()) { insightValueText.text = insightGenerator(targetComponent); } } } public class PlayerGizmo : MonoBehaviour { private PlayerAvatar playerController; private PlayerGizmoConfig playerGizmoConfig; private GameObject noiseRangeSphere; internal void Init(PlayerGizmoConfig config, PlayerAvatar player) { playerGizmoConfig = config; playerController = player; noiseRangeSphere = Geometry.CreatePrimitive((PrimitiveType)0, ((Component)player).transform, ImpAssets.WireframeRed, 1f, 0, (string)null, true, false, true); } internal void NoiseUpdate(float range) { } private void Update() { if (!Object.op_Implicit((Object)(object)playerController)) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { DrawNoiseRange(playerGizmoConfig.NoiseRange.Value); } } private void DrawNoiseRange(bool isShown) { if (!isShown) { noiseRangeSphere.SetActive(false); } } } internal class PlayerGizmoConfig { internal readonly string playerName; internal readonly ImpBinding NoiseRange; internal PlayerGizmoConfig(string playerName, ConfigFile config) { this.playerName = playerName; NoiseRange = (ImpBinding)(object)new ImpConfig(config, "Visualization.PlayerGizmos", "NoiseRange", false, (Action)null, (Action)null, false, false, (string)null, (Func)null); } } } namespace Imperium.Util { internal struct Edge { public Vector3 PointA; public Vector3 PointB; public Edge(Vector3 a, Vector3 b) { //IL_0020: 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_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_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: 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) if (((Vector3)(ref a)).sqrMagnitude <= ((Vector3)(ref b)).sqrMagnitude) { PointA = a; PointB = b; } else { PointA = b; PointB = a; } } public override bool Equals(object obj) { //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_0027: 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) if (!(obj is Edge edge)) { return false; } if (PointA == edge.PointA) { return PointB == edge.PointB; } return false; } public override int GetHashCode() { return ((object)(Vector3)(ref PointA)).GetHashCode() ^ ((object)(Vector3)(ref PointB)).GetHashCode(); } } internal static class ImpAssets { internal static GameObject ImperiumTooltipObject; internal static GameObject ImperiumUIObject; internal static GameObject MapUIObject; internal static GameObject ConsoleUIObject; internal static GameObject LayerSelectorObject; internal static GameObject ComponentManagerObject; internal static GameObject MinimapOverlayObject; internal static GameObject MinimapSettingsObject; internal static GameObject ControlCenterWindowObject; internal static GameObject ObjectExplorerWindowObject; internal static GameObject InfoWindowObject; internal static GameObject LevelGenerationWindowObject; internal static GameObject EventLogWindowObject; internal static GameObject GameControlWindowObject; internal static GameObject RenderingWindowObject; internal static GameObject SaveEditorWindowObject; internal static GameObject TeleportationWindowObject; internal static GameObject VisualizationWindowObject; internal static GameObject PreferencesWindowObject; internal static GameObject PortalWindowObject; internal static GameObject UpgradesWindowObject; internal static Material FresnelWhite; internal static Material FresnelBlue; internal static Material FresnelYellow; internal static Material FresnelGreen; internal static Material FresnelRed; internal static Material FresnelOrange; internal static Material WireframePurple; internal static Material WireframeOrange; internal static Material WireframeCyan; internal static Material WireframeAmaranth; internal static Material WireframeYellow; internal static Material WireframeGreen; internal static Material WireframeRed; internal static Material XRay; internal static Material ShiggyMaterial; internal static Material NavmeshMaterial; internal static Sprite IconCommandAction; internal static Sprite IconCommandReload; internal static Sprite IconCommandSpawn; internal static Sprite IconCommandWindow; internal static Sprite IconCommandSetting; internal static Sprite IconVisualizer; internal static Sprite IconKillPlayer; internal static Sprite IconRevivePlayer; internal static Sprite IconGrabber; internal static Sprite IconControlCenter; internal static Sprite IconEventLog; internal static Sprite IconGameControl; internal static Sprite IconLevelGeneration; internal static Sprite IconObjectExplorer; internal static Sprite IconPortal; internal static Sprite IconPreferences; internal static Sprite IconRendering; internal static Sprite IconTeleportation; internal static Sprite IconUpgrades; internal static Sprite IconVisualizers; internal static GameObject PositionIndicatorObject; internal static GameObject TapeIndicatorObject; internal static GameObject WaypointOverlay; internal static GameObject ObjectInsightPanel; internal static GameObject WaypointBeacon; internal static GameObject LevelPoint; internal static GameObject EnemyStatus; internal static AudioClip ButtonClick; internal static AudioClip OpenClick; internal static AssetBundle ImperiumAssets; private static readonly Dictionary spriteCache = new Dictionary(); private static List logBuffer = new List(); internal static bool Load() { if (!LoadAssets()) { Imperium.IO.LogInfo("[INIT] Failed to load one or more assets from assembly, aborting!"); return false; } return true; } private static bool LoadAssets() { using (Stream stream = LoadResource("Imperium.resources.assets.imperium_assets")) { ImperiumAssets = AssetBundle.LoadFromStream(stream); } if ((Object)(object)ImperiumAssets == (Object)null) { Imperium.IO.LogError("[INIT] Failed to load assets from assembly, aborting!"); return false; } logBuffer = new List(); List source = new List(66) { LoadAsset(ImperiumAssets, "Prefabs/UI/tooltip.prefab", out ImperiumTooltipObject), LoadAsset(ImperiumAssets, "Prefabs/UI/imperium_ui.prefab", out ImperiumUIObject), LoadAsset(ImperiumAssets, "Prefabs/UI/layer_selector.prefab", out LayerSelectorObject), LoadAsset(ImperiumAssets, "Prefabs/UI/component_manager.prefab", out ComponentManagerObject), LoadAsset(ImperiumAssets, "Prefabs/UI/map_ui.prefab", out MapUIObject), LoadAsset(ImperiumAssets, "Prefabs/UI/minimap.prefab", out MinimapOverlayObject), LoadAsset(ImperiumAssets, "Prefabs/UI/minimap_settings.prefab", out MinimapSettingsObject), LoadAsset(ImperiumAssets, "Prefabs/UI/console_ui.prefab", out ConsoleUIObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/control_center.prefab", out ControlCenterWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/info.prefab", out InfoWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/level_generation.prefab", out LevelGenerationWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/event_log.prefab", out EventLogWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/object_explorer.prefab", out ObjectExplorerWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/preferences.prefab", out PreferencesWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/portal.prefab", out PortalWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/upgrades.prefab", out UpgradesWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/rendering.prefab", out RenderingWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/save_editor.prefab", out SaveEditorWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/game_control.prefab", out GameControlWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/teleportation.prefab", out TeleportationWindowObject), LoadAsset(ImperiumAssets, "Prefabs/UI/Windows/visualization.prefab", out VisualizationWindowObject), LoadAsset(ImperiumAssets, "Prefabs/tape_indicator.prefab", out TapeIndicatorObject), LoadAsset(ImperiumAssets, "Prefabs/position_indicator.prefab", out PositionIndicatorObject), LoadAsset(ImperiumAssets, "Prefabs/insight_panel.prefab", out ObjectInsightPanel), LoadAsset(ImperiumAssets, "Prefabs/waypoint_beacon.prefab", out WaypointBeacon), LoadAsset(ImperiumAssets, "Prefabs/level_point.prefab", out LevelPoint), LoadAsset(ImperiumAssets, "Prefabs/enemy_status.prefab", out EnemyStatus), LoadAsset(ImperiumAssets, "Prefabs/waypoint_overlay.prefab", out WaypointOverlay), LoadAsset(ImperiumAssets, "Materials/xray.mat", out XRay), LoadAsset(ImperiumAssets, "Materials/fresnel_white.mat", out FresnelWhite), LoadAsset(ImperiumAssets, "Materials/fresnel_blue.mat", out FresnelBlue), LoadAsset(ImperiumAssets, "Materials/fresnel_red.mat", out FresnelRed), LoadAsset(ImperiumAssets, "Materials/fresnel_orange.mat", out FresnelOrange), LoadAsset(ImperiumAssets, "Materials/fresnel_green.mat", out FresnelGreen), LoadAsset(ImperiumAssets, "Materials/fresnel_yellow.mat", out FresnelYellow), LoadAsset(ImperiumAssets, "Materials/wireframe_purple.mat", out WireframePurple), LoadAsset(ImperiumAssets, "Materials/wireframe_orange.mat", out WireframeOrange), LoadAsset(ImperiumAssets, "Materials/wireframe_cyan.mat", out WireframeCyan), LoadAsset(ImperiumAssets, "Materials/wireframe_amaranth.mat", out WireframeAmaranth), LoadAsset(ImperiumAssets, "Materials/wireframe_yellow.mat", out WireframeYellow), LoadAsset(ImperiumAssets, "Materials/wireframe_green.mat", out WireframeGreen), LoadAsset(ImperiumAssets, "Materials/wireframe_red.mat", out WireframeRed), LoadAsset(ImperiumAssets, "Materials/shig.mat", out ShiggyMaterial), LoadAsset(ImperiumAssets, "Materials/navmesh.mat", out NavmeshMaterial), LoadAsset(ImperiumAssets, "Icons/visualizer.png", out IconVisualizer), LoadAsset(ImperiumAssets, "Icons/setting.png", out IconCommandSetting), LoadAsset(ImperiumAssets, "Icons/action.png", out IconCommandAction), LoadAsset(ImperiumAssets, "Icons/reload.png", out IconCommandReload), LoadAsset(ImperiumAssets, "Icons/spawn.png", out IconCommandSpawn), LoadAsset(ImperiumAssets, "Icons/window.png", out IconCommandWindow), LoadAsset(ImperiumAssets, "Icons/kill.png", out IconKillPlayer), LoadAsset(ImperiumAssets, "Icons/revive.png", out IconRevivePlayer), LoadAsset(ImperiumAssets, "Icons/grabber.png", out IconGrabber), LoadAsset(ImperiumAssets, "ImperiumSprites/control.png", out IconControlCenter), LoadAsset(ImperiumAssets, "ImperiumSprites/notebook.png", out IconEventLog), LoadAsset(ImperiumAssets, "ImperiumSprites/game.png", out IconGameControl), LoadAsset(ImperiumAssets, "ImperiumSprites/blueprint.png", out IconLevelGeneration), LoadAsset(ImperiumAssets, "ImperiumSprites/explorer.png", out IconObjectExplorer), LoadAsset(ImperiumAssets, "ImperiumSprites/portal.png", out IconPortal), LoadAsset(ImperiumAssets, "ImperiumSprites/wrench.png", out IconPreferences), LoadAsset(ImperiumAssets, "ImperiumSprites/camera.png", out IconRendering), LoadAsset(ImperiumAssets, "ImperiumSprites/teleport.png", out IconTeleportation), LoadAsset(ImperiumAssets, "ImperiumSprites/upgrade.png", out IconUpgrades), LoadAsset(ImperiumAssets, "ImperiumSprites/visualizer.png", out IconVisualizers), LoadAsset(ImperiumAssets, "Audio/ButtonClick.wav", out ButtonClick), LoadAsset(ImperiumAssets, "Audio/OpenClick.ogg", out OpenClick) }; Imperium.IO.LogBlock(logBuffer, "Imperium Resource Loader"); return source.All((bool result) => result); } internal static Sprite LoadSpriteFromFiles(string spriteName) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0099: 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) string text = new string[3] { Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "images", spriteName + ".png" }.Aggregate(Path.Combine); if (spriteCache.TryGetValue(text, out var value)) { return value; } if (File.Exists(text)) { byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f)); spriteCache[spriteName] = value; return value; } } return null; } private static bool LoadAsset(AssetBundle assets, string path, out T loadedObject) where T : Object { loadedObject = assets.LoadAsset("Assets/Imperium/" + path); if (!Object.op_Implicit((Object)(object)loadedObject)) { Imperium.IO.LogError("[INIT] Object 'Assets/Imperium/" + path + "' missing from the embedded Imperium asset bundle."); return false; } logBuffer.Add("> Successfully loaded " + path.Split("/").Last() + " from asset bundle."); return true; } private static Stream LoadResource(string name) { return Assembly.GetExecutingAssembly().GetManifestResourceStream(name); } } public abstract class ImpAttributes { internal class HostOnly : Attribute { } internal class LocalMethod : Attribute { } internal class RemoteMethod : Attribute { } internal class HostMasterBinding : Attribute { } } public static class ImpMath { public static float SampleQuadraticBezier(float start, float end, float control, float t) { return (1f - t) * (1f - t) * start + 2f * (1f - t) * t * control + t * t * end; } public static float NormalizeFloat(float value) { string[] array = value.ToString(CultureInfo.InvariantCulture).Split('.'); if (array.Length == 1) { return value; } if (int.Parse(array[1]) == 0) { return (int)value; } return MathF.Round(value); } internal static Vector3 ClosestPointAlongRay(Ray ray, Vector3 point) { //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_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_001d: 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_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_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_002b: 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_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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Vector3 origin = ((Ray)(ref ray)).origin; Vector3 val = ((Ray)(ref ray)).origin + ((Ray)(ref ray)).direction; Vector3 val2 = val - origin; float num = Vector3.Dot(point - origin, val2); num = Mathf.Max(num, 0f); return ((Ray)(ref ray)).origin + ((Ray)(ref ray)).direction * num; } } internal class ImpOutput { [CompilerGenerated] private ManualLogSource P; private Dictionary> NotificationSettings; public ImpOutput(ManualLogSource logger) { P = logger; NotificationSettings = new Dictionary>(); base..ctor(); } internal void BindNotificationSettings(ImpSettings settings) { NotificationSettings = new Dictionary> { { NotificationType.GodMode, (ImpBinding)(object)settings.Preferences.NotificationsGodMode }, { NotificationType.OracleUpdate, (ImpBinding)(object)settings.Preferences.NotificationsOracle }, { NotificationType.Confirmation, (ImpBinding)(object)settings.Preferences.NotificationsConfirmation }, { NotificationType.SpawnReport, (ImpBinding)(object)settings.Preferences.NotificationsSpawnReports }, { NotificationType.Entities, (ImpBinding)(object)settings.Preferences.NotificationsEntities }, { NotificationType.Server, (ImpBinding)(object)settings.Preferences.NotificationsServer }, { NotificationType.AccessControl, (ImpBinding)(object)settings.Preferences.NotificationsAccessControl }, { NotificationType.Spawning, (ImpBinding)(object)settings.Preferences.NotificationsSpawning }, { NotificationType.Required, new ImpBinding(true, false, (Action)null, (Action)null, false) }, { NotificationType.Other, (ImpBinding)(object)settings.Preferences.NotificationsOther } }; } private bool IsNotificationEnabled(NotificationType type) { return NotificationSettings.GetValueOrDefault(type, null)?.Value ?? false; } internal void Send(string text, string title = "Imperium", bool isWarning = false, NotificationType type = NotificationType.Other) { //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) if (IsNotificationEnabled(type) && !Imperium.Settings.IsLoading) { SemiFunc.UIFocusText(text, Color.white, AssetManager.instance.colorYellow, 3f); } } internal void LogBlock(List lines, string title = "Imperium Monitoring") { if (Imperium.Settings.Preferences.GeneralLogging.Value) { title = "< " + title + " >"; int width = Mathf.Min(lines.Max((string line) => line.Length) + 4, 520); string text = string.Concat(Enumerable.Repeat("═", width - 2)); int num = (width - title.Length) / 2 - 1; if ((width - title.Length) / 2 % 2 == 0) { num++; } string text2 = string.Concat(Enumerable.Repeat(" ", num)); string text3 = "╒" + text + "╕\n"; text3 = text3 + "│" + text2 + title + text2 + "│\n"; text3 = text3 + "╞" + text + "╡\n"; text3 = lines.Aggregate(text3, delegate(string current, string line) { string text5 = ((line.Length > 512) ? (line.Substring(0, 512) + "...") : line); return current + ("│ " + text5).PadRight(width - 2) + " │\n"; }); text3 = text3 + "╘" + text + "╛"; string[] array = text3.Split("\n"); foreach (string text4 in array) { Log((LogLevel)8, text4.Trim()); } } } internal void Log(LogLevel level, string text) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) P.Log(level, (object)text); } internal void LogInfo(string text) { P.LogInfo((object)text); } internal void LogDebug(string text) { P.LogDebug((object)text); } internal void LogWarning(string text) { P.LogWarning((object)text); } internal void LogError(string text) { P.LogError((object)text); } } public class ImpStack : List { public void MoveToBackOrAdd(T item) { int num = IndexOf(item); if (num > -1) { Remove(item); } Add(item); } } internal class ImpTimer { private float initialTime; private float countdown; private ImpTimer() { } internal static ImpTimer ForInterval(float seconds) { return new ImpTimer { initialTime = seconds, countdown = seconds }; } internal void Set(float newTime) { initialTime = newTime; } internal bool Tick() { countdown -= Time.deltaTime; if (countdown <= 0f) { countdown = initialTime; return true; } return false; } internal void Reset() { countdown = initialTime; } } public abstract class ImpUtils { internal abstract class Interface { [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CanvasGroup group; public float targetAlpha; public float duration; public bool setInteractable; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = group.alpha; 5__3 = 0f; break; case 1: <>1__state = -1; break; } if (5__3 < duration) { group.alpha = Mathf.Lerp(5__2, targetAlpha, 5__3 / duration); 5__3 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } group.alpha = targetAlpha; group.interactable = setInteractable; group.blocksRaycasts = setInteractable; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RectTransform rect; public Vector2 direction; private float 5__2; private Vector2 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002a: 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_00c7: 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_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_0115: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = SlideInAnimation(rect, direction); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = 0f; 5__3 = rect.anchoredPosition; break; case 2: <>1__state = -1; break; } if (5__2 < 0.1f) { float num = 5__2 / 0.1f; float num2 = 10f * (1f - num); float num3 = 10f * Mathf.Sin(num2 * num * MathF.PI * 2f) * (1f - num); 5__2 += Time.deltaTime; rect.anchoredPosition = 5__3 + ((Vector2)(ref direction)).normalized * num3; <>2__current = null; <>1__state = 2; return true; } rect.anchoredPosition = 5__3; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__7 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Vector2 direction; public float offsetValue; public RectTransform rect; public CanvasGroup opacityGroup; private Vector2 5__2; private Vector2 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0020: 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_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_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_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_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_00a5: 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) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; Vector2 val = ((Vector2)(ref direction)).normalized * offsetValue; 5__2 = rect.anchoredPosition - val; 5__3 = rect.anchoredPosition; if (Object.op_Implicit((Object)(object)opacityGroup)) { opacityGroup.alpha = 0f; } 5__4 = 0f; break; } case 1: <>1__state = -1; break; } if (5__4 < 0.15f) { float num = 5__4 / 0.15f; rect.anchoredPosition = Vector2.Lerp(5__2, 5__3, num * num); if (Object.op_Implicit((Object)(object)opacityGroup)) { opacityGroup.alpha = Mathf.Lerp(0f, 1f, num); } 5__4 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } rect.anchoredPosition = 5__3; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static void BindDropdownInteractable(IBinding binding, Transform parent, bool inverted = false) { TMP_Dropdown dropdown = ((Component)parent.Find("Dropdown")).GetComponent(); ((Selectable)dropdown).interactable = (inverted ? (!binding.Value) : binding.Value); Transform obj = parent.Find("Title"); TMP_Text title = ((obj != null) ? ((Component)obj).GetComponent() : null); if (Object.op_Implicit((Object)(object)title)) { ToggleTextActive(title, inverted ? (!binding.Value) : binding.Value); } Transform obj2 = parent.Find("Dropdown/Label"); TMP_Text label = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); if (Object.op_Implicit((Object)(object)label)) { ToggleTextActive(label, inverted ? (!binding.Value) : binding.Value); } Transform obj3 = parent.Find("Dropdown/Arrow"); Image arrow = ((obj3 != null) ? ((Component)obj3).GetComponent() : null); if (Object.op_Implicit((Object)(object)arrow)) { ToggleImageActive(arrow, inverted ? (!binding.Value) : binding.Value); } binding.OnUpdate += delegate(bool isActive) { ((Selectable)dropdown).interactable = (inverted ? (!isActive) : isActive); if (Object.op_Implicit((Object)(object)title)) { ToggleTextActive(title, inverted ? (!isActive) : isActive); } if (Object.op_Implicit((Object)(object)label)) { ToggleTextActive(label, inverted ? (!isActive) : isActive); } if (Object.op_Implicit((Object)(object)arrow)) { ToggleImageActive(arrow, inverted ? (!isActive) : isActive); } }; } internal static void AddTooltip(TooltipDefinition tooltipDefinition, Transform element) { if (!Object.op_Implicit((Object)(object)tooltipDefinition.Tooltip)) { Imperium.IO.LogWarning("[UI] Failed to initialize tooltip for '" + Debugging.GetTransformPath(element) + "'. No tooltip provided."); return; } ImpInteractable impInteractable = ((Component)element).gameObject.AddComponent(); impInteractable.onOver += delegate(Vector2 position) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) tooltipDefinition.Tooltip.SetPosition(tooltipDefinition.Title, tooltipDefinition.Description, position, tooltipDefinition.HasAccess); }; impInteractable.onExit += delegate { tooltipDefinition.Tooltip.Deactivate(); }; } internal static void ToggleImageActive(Image image, bool isActive) { //IL_0002: 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) ((Graphic)image).color = ChangeAlpha(((Graphic)image).color, isActive ? 1f : 0.5f); } internal static void ToggleTextActive(TMP_Text text, bool isActive) { //IL_0002: 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) ((Graphic)text).color = ChangeAlpha(((Graphic)text).color, isActive ? 1f : 0.2f); } internal static Color ChangeAlpha(Color oldColor, float newAlpha) { //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_000a: Unknown result type (might be due to invalid IL or missing references) Color result = oldColor; result.a = newAlpha; return result; } internal static void ToggleCursorState(bool isShown) { Cursor.lockState = (CursorLockMode)((!isShown) ? 1 : 0); Cursor.visible = isShown; } [IteratorStateMachine(typeof(d__6))] internal static IEnumerator AnimateOpacityTo(CanvasGroup group, float duration, float targetAlpha, bool setInteractable = true) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0) { group = group, duration = duration, targetAlpha = targetAlpha, setInteractable = setInteractable }; } [IteratorStateMachine(typeof(d__7))] internal static IEnumerator SlideInAnimation(RectTransform rect, Vector2 direction, float offsetValue = 50f, CanvasGroup opacityGroup = null) { //IL_000e: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { rect = rect, direction = direction, offsetValue = offsetValue, opacityGroup = opacityGroup }; } [IteratorStateMachine(typeof(d__8))] internal static IEnumerator SlideInAndBounceAnimation(RectTransform rect, Vector2 direction) { //IL_000e: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { rect = rect, direction = direction }; } } internal abstract class Bindings { internal static void ToggleSet(IBinding> binding, T key, bool isOn) { if (isOn) { binding.Value.Add(key); } else { binding.Value.Remove(key); } binding.Set(binding.Value, true, true); } } internal abstract class Transpiling { internal static IEnumerable SkipWaitingForSeconds(IEnumerable instructions) { List list = new List(instructions); for (int i = 0; i < list.Count; i++) { if (i >= 2 && list[i].opcode == OpCodes.Stfld && list[i - 1].opcode == OpCodes.Newobj && list[i - 2].opcode == OpCodes.Ldc_R4) { list[i - 2].operand = 0f; } } return list.AsEnumerable(); } } public static T DictionaryGetOrNew(IDictionary map, string key) where T : new() { if (map.TryGetValue(key, out var value)) { return value; } return map[key] = new T(); } public static void ToggleGameObjects(IEnumerable list, bool isOn) { foreach (GameObject item in list.Where((GameObject obj) => Object.op_Implicit((Object)(object)obj))) { item.SetActive(isOn); } } public static Random CloneRandom(Random random) { Random random2 = new Random(); int[] source = Reflection.Get(random, "_seedArray"); Reflection.Set(random2, "_seedArray", source.ToArray()); Reflection.CopyField(random, random2, "_inextp"); Reflection.CopyField(random, random2, "_inext"); return random2; } public static T InvokeDefaultOnNull(Func callback) { try { return callback(); } catch (NullReferenceException) { return default(T); } } public static int ToggleLayerInMask(int layerMask, int layer) { if ((layerMask & (1 << layer)) != 0) { return layerMask & ~(1 << layer); } return layerMask | (1 << layer); } public static int ToggleLayersInMask(int layerMask, params int[] layers) { return layers.Aggregate(layerMask, ToggleLayerInMask); } public static bool RunSafe(Action action, string logTitle = null) { Exception exception; return RunSafe(action, out exception, logTitle); } private static bool RunSafe(Action action, out Exception exception, string logTitle = null) { try { action(); exception = null; return true; } catch (Exception ex) { exception = ex; if (logTitle != null) { Imperium.IO.LogBlock((from line in exception.StackTrace.Split('\n') select line.Trim()).ToList(), "[ERR] " + logTitle + ": " + exception.Message); } return false; } } public static bool DeserializeJsonSafe(string jsonString, out T deserializedObj) { try { deserializedObj = JsonConvert.DeserializeObject(jsonString); return deserializedObj != null; } catch (Exception ex) { Imperium.IO.LogError("[JSON] Exception: " + ex.Message); deserializedObj = default(T); return false; } } } public class MeshDataBuilder : MonoBehaviour { private void Awake() { GenerateMeshData(); } private void GenerateMeshData() { Mesh sharedMesh = ((Component)this).GetComponent().sharedMesh; SplitMesh(sharedMesh); SetVertexColors(sharedMesh); } private void SplitMesh(Mesh mesh) { //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_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_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) int[] triangles = mesh.triangles; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Vector2[] uv = mesh.uv; int num = triangles.Length; Vector3[] array = (Vector3[])(object)new Vector3[num]; Vector3[] array2 = (Vector3[])(object)new Vector3[num]; Vector2[] array3 = (Vector2[])(object)new Vector2[num]; for (int i = 0; i < num; i++) { array[i] = vertices[triangles[i]]; if (triangles.Length > i && normals.Length > triangles[i]) { array2[i] = normals[triangles[i]]; } if (uv.Length != 0) { array3[i] = uv[triangles[i]]; } triangles[i] = i; } mesh.vertices = array; mesh.normals = array2; mesh.uv = array3; mesh.triangles = triangles; } private void SetVertexColors(Mesh mesh) { //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_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_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_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) //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_008d: 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_00a2: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[3] { new Color(1f, 0f, 0f), new Color(0f, 1f, 0f), new Color(0f, 0f, 1f) }; Color32[] array2 = (Color32[])(object)new Color32[mesh.vertices.Length]; for (int i = 0; i < array2.Length; i += 3) { array2[i] = Color32.op_Implicit(array[0]); array2[i + 1] = Color32.op_Implicit(array[1]); array2[i + 2] = Color32.op_Implicit(array[2]); } mesh.colors32 = array2; } } internal static class Reflection { internal static void Invoke(T instance, string methodName, params object[] parameters) { typeof(T).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, parameters); } internal static R Invoke(T instance, string methodName, params object[] parameters) { object obj = typeof(T).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, parameters); if (obj is R) { return (R)obj; } throw new ArgumentOutOfRangeException(); } internal static IEnumerator GetCoroutine(T instance, string methodName) { return (IEnumerator)typeof(T).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, Array.Empty()); } internal static R Get(T instance, string fieldName, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { object value = typeof(T).GetField(fieldName, bindingFlags).GetValue(instance); return (R)value; } internal static void Set(T instance, string fieldName, V value, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { typeof(T).GetField(fieldName, bindingFlags).SetValue(instance, value); } internal static void SetProperty(T instance, string propertyName, V value, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { typeof(T).InvokeMember(propertyName, bindingFlags | BindingFlags.SetProperty, null, instance, new object[1] { value }); } internal static void CopyField(T source, T target, string fieldName, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { FieldInfo field = typeof(T).GetField(fieldName, bindingFlags); field.SetValue(target, field.GetValue(source)); } } public static class RichText { public static string Strikethrough(string value) { return "" + value + ""; } public static string Underlined(string value) { return "" + value + ""; } public static string Bold(string value) { return "" + value + ""; } public static string Italic(string value) { return "" + value + ""; } public static string Size(string value, int size) { return $"{value}"; } public static string GreyedOut(string value) { return "" + value + ""; } } } namespace Imperium.Types { public record ExtendedEnemySetup { public EnemySetup Enemy; public string EnemyName; public Difficulty Difficulty; public EnemyChecklist Checklist; public float SpawnedTimeMin; public float SpawnedTimeMax; public float DespawnedTimeMin; public float DespawnedTimeMax; [CompilerGenerated] protected virtual bool PrintMembers(StringBuilder builder) { RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("Enemy = "); builder.Append(Enemy); builder.Append(", EnemyName = "); builder.Append((object?)EnemyName); builder.Append(", Difficulty = "); builder.Append(((object)(Difficulty)(ref Difficulty)).ToString()); builder.Append(", Checklist = "); builder.Append(Checklist); builder.Append(", SpawnedTimeMin = "); builder.Append(SpawnedTimeMin.ToString()); builder.Append(", SpawnedTimeMax = "); builder.Append(SpawnedTimeMax.ToString()); builder.Append(", DespawnedTimeMin = "); builder.Append(DespawnedTimeMin.ToString()); builder.Append(", DespawnedTimeMax = "); builder.Append(DespawnedTimeMax.ToString()); return true; } } public struct ImpTheme { internal Color backgroundColor; internal Color primaryColor; internal Color? secondaryColor; internal Color textColor; } public enum Variant { BACKGROUND, FOREGROUND, LIGHTER, LIGHTEST, DARKER, DARKEST, FADED, BACKGROUND_DARKER, FADED_TEXT } public readonly struct StyleOverride { public string Path { get; } public Variant Variant { get; } public StyleOverride(string componentPath, Variant styleVariant) { Path = componentPath; Variant = styleVariant; } } public static class ImpThemeManager { private static readonly Dictionary Themes = new Dictionary { { "Repo", new ImpTheme { backgroundColor = HEXToRGB("#090B1CFB"), primaryColor = HEXToRGB("#3088BE"), textColor = HEXToRGB("#FFFFFF") } }, { "Imperium", new ImpTheme { backgroundColor = HEXToRGB("#4F0505FA"), primaryColor = HEXToRGB("#D63300"), textColor = HEXToRGB("#FFFFFF") } }, { "Shade", new ImpTheme { backgroundColor = HEXToRGB("#111621"), primaryColor = HEXToRGB("#464e6b"), textColor = HEXToRGB("#FFFFFF") } }, { "Prismarine", new ImpTheme { backgroundColor = HEXToRGB("#061C14FB"), primaryColor = HEXToRGB("#24C69E"), textColor = HEXToRGB("#FFFFFF") } }, { "Forest", new ImpTheme { backgroundColor = HEXToRGB("#0D170CFB"), primaryColor = HEXToRGB("#2A9130"), textColor = HEXToRGB("#FFFFFF") } }, { "Nordic", new ImpTheme { backgroundColor = HEXToRGB("#12131CFB"), primaryColor = HEXToRGB("#84A7BC"), textColor = HEXToRGB("#FFFFFF") } }, { "Nebula", new ImpTheme { backgroundColor = HEXToRGB("#2D082DFB"), primaryColor = HEXToRGB("#84168E"), textColor = HEXToRGB("#FFFFFF") } }, { "Vertex", new ImpTheme { backgroundColor = HEXToRGB("#23020AFB"), primaryColor = HEXToRGB("#B21845"), textColor = HEXToRGB("#FFFFFF") } } }; public static void Style(ImpTheme theme, Transform container, params StyleOverride[] colorOverrides) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)container)) { return; } for (int i = 0; i < colorOverrides.Length; i++) { StyleOverride styleOverride = colorOverrides[i]; object obj; if (string.IsNullOrEmpty(styleOverride.Path)) { obj = ((container != null) ? ((Component)container).GetComponent() : null); } else if (container == null) { obj = null; } else { Transform obj2 = container.Find(styleOverride.Path); obj = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); } Image val = (Image)obj; if (Object.op_Implicit((Object)(object)val)) { ((Graphic)val).color = GetColor(theme, styleOverride.Variant); } } } public static void StyleText(ImpTheme theme, Transform container, params StyleOverride[] colorOverrides) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)container)) { return; } for (int i = 0; i < colorOverrides.Length; i++) { StyleOverride styleOverride = colorOverrides[i]; object obj; if (string.IsNullOrEmpty(styleOverride.Path)) { obj = ((container != null) ? ((Component)container).GetComponent() : null); } else if (container == null) { obj = null; } else { Transform obj2 = container.Find(styleOverride.Path); obj = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); } TMP_Text val = (TMP_Text)obj; if (Object.op_Implicit((Object)(object)val)) { ((Graphic)val).color = GetColor(theme, styleOverride.Variant); } } } private static Color GetColor(ImpTheme theme, Variant variant) { //IL_0001: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_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_012f: 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_0141: 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_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_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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_00d2: 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_011d: 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_00d7: 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) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(theme.primaryColor, ref num, ref num2, ref num3); float num4 = default(float); float num5 = default(float); float num6 = default(float); Color.RGBToHSV(theme.backgroundColor, ref num4, ref num5, ref num6); float num7 = 0f; float num8 = 0f; float num9 = 0f; if (theme.secondaryColor.HasValue) { Color.RGBToHSV(theme.secondaryColor.Value, ref num7, ref num8, ref num9); } Color textColor = theme.textColor; return (Color)(variant switch { Variant.BACKGROUND => theme.backgroundColor, Variant.BACKGROUND_DARKER => Color.HSVToRGB(num4, num5, num6 * 0.9f), Variant.FOREGROUND => ((??)theme.secondaryColor) ?? theme.primaryColor, Variant.LIGHTEST => Color.HSVToRGB(num2, num2, num3 * 1.6f), Variant.LIGHTER => theme.secondaryColor.HasValue ? Color.HSVToRGB(num7, num8, num9 * 1.2f) : Color.HSVToRGB(num, num2, num3 * 1.2f), Variant.DARKER => Color.HSVToRGB(num, num2, num3 * 0.8f), Variant.DARKEST => Color.HSVToRGB(num, num2, num3 * 0.4f), Variant.FADED => Color.HSVToRGB(num, num2, num3 * 0.8f), Variant.FADED_TEXT => new Color(textColor.r, textColor.g, textColor.b, 0.8f), _ => throw new ArgumentOutOfRangeException(), }); } public static ImpBinding BindTheme(ImpBinding themeConfig) { ImpBinding themeBinding; if (Themes.TryGetValue(themeConfig.Value, out var value2)) { themeBinding = new ImpBinding(value2, default(ImpTheme), (Action)null, (Action)null, false); } else { themeConfig.Reset(true, true); themeBinding = new ImpBinding(Themes[themeConfig.DefaultValue], default(ImpTheme), (Action)null, (Action)null, false); } themeConfig.OnUpdate += delegate(string value) { themeBinding.Set(Themes[value], true, true); }; return themeBinding; } private static Color HEXToRGB(string hexColor) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); ColorUtility.TryParseHtmlString(hexColor, ref result); return result; } } internal class InsightDefinitionImpl : InsightDefinition where T : Component { private readonly ConfigFile config; private readonly Dictionary> globalInsights; private readonly ImpBinding>> insightVisibilityBindings; public ImpBinding>> Insights { get; } = new ImpBinding>>(new Dictionary>(), (Dictionary>)null, (Action>>)null, (Action>>)null, false); public Func NameGenerator { get; private set; } public Func PersonalNameGenerator { get; private set; } public Func IsDisabledGenerator { get; private set; } public Func PositionOverride { get; private set; } public ImpBinding VisibilityBinding { get; private set; } internal InsightDefinitionImpl(Dictionary> globalInsights, ImpBinding>> insightVisibilityBindings, ConfigFile config) { this.config = config; this.globalInsights = globalInsights; this.insightVisibilityBindings = insightVisibilityBindings; InheritPropertiesFromParents(); } public InsightDefinition SetNameGenerator(Func generator) { NameGenerator = (Component obj) => generator((T)(object)obj); PropagateTypeNameGenerator((Component obj) => generator((T)(object)obj)); return this; } public InsightDefinition SetPersonalNameGenerator(Func generator) { PersonalNameGenerator = (Component obj) => generator((T)(object)obj); PropagatePersonalNameGenerator((Component obj) => generator((T)(object)obj)); return this; } public InsightDefinition SetIsDisabledGenerator(Func generator) { IsDisabledGenerator = (Component obj) => generator((T)(object)obj); PropagateIsDisabledGenerator((Component obj) => generator((T)(object)obj)); return this; } public InsightDefinition SetPositionOverride(Func @override) { PositionOverride = (Component obj) => @override((T)(object)obj); PropagatePositionOverride((Component obj) => @override((T)(object)obj)); return this; } public InsightDefinition SetConfigKey(string configKey) { VisibilityBinding = (ImpBinding)(object)new ImpConfig(config, "Visualization.Insights", configKey, false, (Action)null, (Action)null, false, false, (string)null, (Func)null); insightVisibilityBindings.Value[typeof(T)] = VisibilityBinding; insightVisibilityBindings.Refresh(); return this; } public InsightDefinition RegisterInsight(string name, Func generator) { Insights.Value[name] = (Component obj) => generator((T)(object)obj); Insights.Refresh(); PropagateInsightRegister(name, (Component obj) => generator((T)(object)obj)); return this; } public InsightDefinition UnregisterInsight(string name) { if (!Insights.Value.ContainsKey(name)) { return this; } Insights.Value.Remove(name); Insights.Refresh(); PropagateInsightUnregister(name); return this; } private void InheritPropertiesFromParents() { List parentTypes = Debugging.GetParentTypes(); foreach (Type item in parentTypes) { if (!globalInsights.TryGetValue(item, out var value)) { continue; } Func value2; foreach (KeyValuePair> item2 in value.Insights.Value) { item2.Deconstruct(out var key, out value2); string key2 = key; Func value3 = value2; Insights.Value.TryAdd(key2, value3); } if (NameGenerator == null) { value2 = (NameGenerator = value.NameGenerator); } if (PersonalNameGenerator == null) { value2 = (PersonalNameGenerator = value.PersonalNameGenerator); } if (IsDisabledGenerator == null) { Func func = (IsDisabledGenerator = value.IsDisabledGenerator); } if (PositionOverride == null) { Func func2 = (PositionOverride = value.PositionOverride); } if (VisibilityBinding == null) { ImpBinding val = (VisibilityBinding = value.VisibilityBinding); } } } private void PropagateInsightUnregister(string insightName) { foreach (var (type2, insightDefinition2) in globalInsights) { if (type2.IsSubclassOf(typeof(T))) { insightDefinition2.RemoveInsightFromParent(insightName); } } } private void PropagateInsightRegister(string insightName, Func insightGenerator) { foreach (var (type2, insightDefinition2) in globalInsights) { if (type2.IsSubclassOf(typeof(T))) { insightDefinition2.AddInsightFromParent(insightName, insightGenerator); } } } private void PropagateTypeNameGenerator(Func generator) { foreach (var (type2, insightDefinition2) in globalInsights) { if (type2.IsSubclassOf(typeof(T))) { insightDefinition2.SetNameGeneratorFromParent(generator); } } } private void PropagatePersonalNameGenerator(Func generator) { foreach (var (type2, insightDefinition2) in globalInsights) { if (type2.IsSubclassOf(typeof(T))) { insightDefinition2.SetPersonalNameGeneratorFromParent(generator); } } } private void PropagateIsDisabledGenerator(Func generator) { foreach (var (type2, insightDefinition2) in globalInsights) { if (type2.IsSubclassOf(typeof(T))) { insightDefinition2.SetIsDisabledGeneratorFromParent(generator); } } } private void PropagatePositionOverride(Func @override) { foreach (var (type2, insightDefinition2) in globalInsights) { if (type2.IsSubclassOf(typeof(T))) { insightDefinition2.SetPositionOverrideFromParent(@override); } } } public void RemoveInsightFromParent(string insightName) { if (Insights.Value.ContainsKey(insightName)) { Insights.Value.Remove(insightName); Insights.Refresh(); } } public void AddInsightFromParent(string insightName, Func insightGenerator) { Insights.Value[insightName] = insightGenerator; Insights.Refresh(); } public void SetNameGeneratorFromParent(Func generator) { if (NameGenerator == null) { Func func2 = (NameGenerator = (Component obj) => generator((T)(object)obj)); } } public void SetPersonalNameGeneratorFromParent(Func generator) { if (PersonalNameGenerator == null) { Func func2 = (PersonalNameGenerator = (Component obj) => generator((T)(object)obj)); } } public void SetIsDisabledGeneratorFromParent(Func generator) { if (IsDisabledGenerator == null) { Func func2 = (IsDisabledGenerator = (Component obj) => generator((T)(object)obj)); } } public void SetPositionOverrideFromParent(Func @override) { if (PositionOverride == null) { Func func2 = (PositionOverride = (Component obj) => @override((T)(object)obj)); } } } public record MoonData { public Dictionary IndoorEntityRarities = new Dictionary(); public Dictionary OutdoorEntityRarities = new Dictionary(); public Dictionary DaytimeEntityRarities = new Dictionary(); public Dictionary ScrapRarities = new Dictionary(); public int maxIndoorPower; public int maxOutdoorPower; public int maxDaytimePower; public float indoorDeviation; public float daytimeDeviation; } } namespace Imperium.Patches { internal static class PreInitPatches { private static bool hasAutoLoaded; [HarmonyPostfix] [HarmonyPatch(typeof(BuildName), "Start")] private static void StartPatch(BuildName __instance) { TextMeshProUGUI component = ((Component)__instance).GetComponent(); ((TMP_Text)component).text = ((TMP_Text)component).text + " (Imperium v0.4.0)"; } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerAvatar), "Start")] private static void StartPatch(PlayerAvatar __instance) { if (!Object.op_Implicit((Object)(object)PlayerAvatar.instance) || !Imperium.IsImperiumInitialized) { return; } if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelMainMenu) { if (!Imperium.IsImperiumLaunched) { if (!ImpUtils.RunSafe(Imperium.Launch, "Imperium startup failed")) { Imperium.DisableImperium(); } } else { Imperium.EnableImperium(); } } else if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobbyMenu) { if (SemiFunc.IsMultiplayer()) { Imperium.Networking.RequestImperiumAccess(); } else { Imperium.Networking.OnAuthenticateResponse(); } } } [HarmonyPatch(typeof(RunManager), "Awake")] [HarmonyPrefix] private static void AwakeRunManagerPatch(RunManager __instance) { if (Imperium.Settings.Preferences.QuickloadAutoLaunch.Value && !hasAutoLoaded) { __instance.levelCurrent = __instance.levelMainMenu; } } [HarmonyPostfix] [HarmonyPatch(typeof(MainMenuOpen), "Awake")] private static void AwakePlayerAvatarPatch(MainMenuOpen __instance) { if (hasAutoLoaded) { return; } hasAutoLoaded = true; bool value = Imperium.Settings.Preferences.QuickloadAutoLaunch.Value; LaunchMode value2 = Imperium.Settings.Preferences.QuickloadLaunchMode.Value; if (value) { string path = Application.persistentDataPath + "/saves/REPO_SAVE_IMPERIUM/REPO_SAVE_IMPERIUM.es3"; if (!File.Exists(path)) { StatsManager.instance.SaveGame("REPO_SAVE_IMPERIUM"); } if (value2 == LaunchMode.Singleplayer) { __instance.MainMenuSetState(0); SemiFunc.MenuActionSingleplayerGame("REPO_SAVE_IMPERIUM", (List)null); } if (value2 == LaunchMode.Multiplayer) { __instance.MainMenuSetState(1); SemiFunc.MenuActionHostGame("REPO_SAVE_IMPERIUM", (List)null); } } } } } namespace Imperium.Patches.Systems { [HarmonyPatch(typeof(EnemyDirector))] internal static class EnemyDirectorPatch { [HarmonyPrefix] [HarmonyPatch("SetInvestigate")] private static bool SetInvestigatePrefixPatch(EnemyDirector __instance, Vector3 position, float radius, out bool __state) { //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_008c: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { __state = true; return true; } MethodBase method = new StackTrace().GetFrame(2).GetMethod(); if (method.ReflectedType == typeof(PlayerAvatar) || method.ReflectedType == typeof(PlayerVoiceChat)) { PlayerAvatar val = ((IEnumerable)GameDirector.instance.PlayerList).FirstOrDefault((Func)((PlayerAvatar player) => position == ((Component)player).transform.position + Vector3.up * 0.2f || position == ((Component)player.PlayerVisionTarget.VisionTransform).transform.position)); if (Object.op_Implicit((Object)(object)val) && Imperium.PlayerManager.MutedPlayers.Value.Contains(SteamId.op_Implicit(NetworkExtensions.GetSteamId(val)))) { __state = false; return false; } } __state = true; return true; } [HarmonyPostfix] [HarmonyPatch("SetInvestigate")] private static void SetInvestigatePostfixPatch(EnemyDirector __instance, Vector3 position, float radius, bool __state) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Imperium.Visualization.NoiseIndicators.AddNoise(position, radius, !__state); } } [HarmonyPatch(typeof(LevelGenerator))] internal static class LevelGeneratorPatch { [HarmonyPostfix] [HarmonyPatch("EnemySetup")] private static void EnemySetupPatch(LevelGenerator __instance) { Imperium.ObjectManager.InvokeObjectsChanged(); } } [HarmonyPatch(typeof(LoadingUI))] internal static class LoadingUIPatch { [HarmonyPostfix] [HarmonyPatch("StartLoading")] private static void StartLoadingPatch(LoadingUI __instance) { Imperium.IsLevelLoaded.SetFalse(); Imperium.GameManager.IsGameLoading = true; } [HarmonyPostfix] [HarmonyPatch(typeof(LoadingUI), "StopLoading")] private static void StopLoadingPatch(LoadingUI __instance) { Imperium.IsLevelLoaded.SetTrue(); Imperium.GameManager.IsGameLoading = false; } [HarmonyPrefix] [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] private static void LevelAnimationStartPatch(LoadingUI __instance) { if (Imperium.Settings.Preferences.SkipLoading.Value) { __instance.debugDisableLevelAnimation = true; } } } [HarmonyPatch(typeof(NavMeshBuilder))] public class NavMeshBuilderPatch { [HarmonyPostfix] [HarmonyPatch("UpdateNavMeshData")] private static void UpdateNavMeshDataPatch() { Imperium.Visualization.NavMeshVisualizer.Refresh(); } [HarmonyPostfix] [HarmonyPatch("UpdateNavMeshDataAsync")] private static void UpdateNavMeshDataAsyncPatch() { Imperium.Visualization.NavMeshVisualizer.Refresh(); } } [HarmonyPatch(typeof(PlayerAvatar))] internal static class PlayerAvatarPatch { } [HarmonyPatch(typeof(PlayerController))] internal static class PlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Update")] private static void StartPostfixPatch(PlayerController __instance) { } } [HarmonyPatch(typeof(RunManager))] internal static class RunManagerPatch { [HarmonyPrefix] [HarmonyPatch("ChangeLevel")] private static bool ChangeLevelPrefixPatch(RunManager __instance, bool _levelFailed, ChangeLevelType _changeLevelType) { if (_levelFailed) { return !Imperium.ArenaManager.DisableGameOver.Value; } return true; } [HarmonyPostfix] [HarmonyPatch("ChangeLevel")] private static void ChangeLevelPostfixPatch(RunManager __instance, bool _completedLevel, bool _levelFailed, ChangeLevelType _changeLevelType) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Imperium.EventLog.GameEvents.ChangeLevel(_completedLevel, _levelFailed, _changeLevelType); if (Imperium.GameManager.NextLevelNumberOverride > 0) { __instance.levelsCompleted = Imperium.GameManager.NextLevelNumberOverride - 1; SemiFunc.StatSetRunLevel(__instance.levelsCompleted); Imperium.GameManager.NextLevelNumberOverride = 0; } else if (Imperium.GameManager.CustomLevelNumber.Value > 0) { __instance.levelsCompleted = Imperium.GameManager.CustomLevelNumber.Value - 1; SemiFunc.StatSetRunLevel(__instance.levelsCompleted); } } } [HarmonyPatch(typeof(SemiFunc))] internal static class SemiFuncPatch { } } namespace Imperium.Patches.Objects { [HarmonyPatch(typeof(CursorManager))] internal static class CursorManagerPatch { [HarmonyPostfix] [HarmonyPatch("Unlock")] private static void UnlockPatch(CursorManager __instance, float _time) { if (Imperium.Interface.IsOpen()) { Cursor.visible = true; } } } [HarmonyPatch(typeof(EnemyHealth))] internal static class EnemyHealthPatch { [HarmonyPostfix] [HarmonyPatch("HurtRPC")] private static void HurtRPCPatch(EnemyHealth __instance, int _damage) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) string enemyName = __instance.enemy.EnemyParent.enemyName; if (Imperium.Visualization.EnemyGizmos.EntityInfoConfigs.TryGetValue(enemyName, out var value) && value.Vitality.Value) { int count = WorldSpaceUIParent.instance.valueLostList.Count; WorldSpaceUIParent.instance.ValueLostCreate(((Component)__instance.enemy).transform.position, _damage); if (WorldSpaceUIParent.instance.valueLostList.Count > count) { Imperium.GameManager.EnemyValueLostInstances.Add(WorldSpaceUIParent.instance.valueLostList.Last()); } } } } [HarmonyPatch(typeof(EnemyParent))] internal static class EnemyParentPatch { private static FieldInfo logicEnemyParentField; private static FieldInfo playerCloseLogicEnemyParentField; [HarmonyPrefix] [HarmonyPatch("Awake")] private static void AwakePatch(EnemyParent __instance) { logicEnemyParentField = Extensions.GetStateMachineTarget(typeof(EnemyParent).GetMethod("Logic", BindingFlags.Instance | BindingFlags.NonPublic)).DeclaringType.GetField("<>4__this", BindingFlags.Instance | BindingFlags.Public); playerCloseLogicEnemyParentField = Extensions.GetStateMachineTarget(typeof(EnemyParent).GetMethod("PlayerCloseLogic", BindingFlags.Instance | BindingFlags.NonPublic)).DeclaringType.GetField("<>4__this", BindingFlags.Instance | BindingFlags.Public); } [HarmonyPostfix] [HarmonyPatch("Awake")] private static void StartPatch(EnemyParent __instance) { Imperium.EventLog.EntityEvents.Awake(__instance); } [HarmonyPostfix] [HarmonyPatch("DespawnRPC")] private static void DespawnRPCPatch(EnemyParent __instance) { Imperium.EventLog.EntityEvents.Despawn(__instance); } [HarmonyPostfix] [HarmonyPatch("SpawnRPC")] private static void SpawnRPCPatch(EnemyParent __instance) { Imperium.EventLog.EntityEvents.Spawn(__instance); } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static bool LogicPrefixPatch(object __instance, out bool __result) { object? value = logicEnemyParentField.GetValue(__instance); EnemyParent val = (EnemyParent)((value is EnemyParent) ? value : null); int item = (SemiFunc.IsMultiplayer() ? ((MonoBehaviourPun)val).photonView.ViewID : ((Object)((Component)val).gameObject).GetInstanceID()); if (Imperium.ObjectManager.DisabledObjects.Value.Contains(item)) { __result = true; return false; } __result = false; return true; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static bool PlayerCloseLogicPrefixPatch(object __instance, out bool __result) { object? value = playerCloseLogicEnemyParentField.GetValue(__instance); EnemyParent val = (EnemyParent)((value is EnemyParent) ? value : null); int item = (SemiFunc.IsMultiplayer() ? ((MonoBehaviourPun)val).photonView.ViewID : ((Object)((Component)val).gameObject).GetInstanceID()); if (Imperium.ObjectManager.DisabledObjects.Value.Contains(item)) { __result = true; return false; } __result = false; return true; } } [HarmonyPatch(typeof(Enemy))] internal static class EnemyPatch { [HarmonyPostfix] [HarmonyPatch("EnemyTeleportedRPC")] private static void StartPatch(Enemy __instance, Vector3 teleportPosition) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Imperium.EventLog.EntityEvents.Teleport(__instance.EnemyParent, teleportPosition); } } [HarmonyPatch(typeof(EnemyStateInvestigate))] internal static class EnemyStateInvestigatePatch { [HarmonyPrefix] [HarmonyPatch("SetRPC")] private static void SetRPCPatch(EnemyStateInvestigate __instance, Vector3 position) { //IL_000b: 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) Imperium.Visualization.EnemyGizmos.NoiseVisualizerUpdate(__instance, position); Imperium.EventLog.EntityEvents.Investigating(__instance, position); } } [HarmonyPatch(typeof(EnemyVision))] internal static class EnemyVisionPatch { [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator result; public EnemyVision __instance; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; Imperium.Visualization.EnemyGizmos.VisionUpdate(__instance); break; } if (result.MoveNext()) { <>2__current = result.Current; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyTranspiler] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static IEnumerable VisionTranspiler(IEnumerable instructions) { //IL_0002: 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_0035: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(GameDirector), "PlayerList"), (string)null) }).Repeat((Action)delegate(CodeMatcher match) { match.Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate, List>>((Func, List>)GetPlayerList) }); }, (Action)null).Instructions(); } [IteratorStateMachine(typeof(d__1))] [HarmonyPostfix] [HarmonyPatch("Vision")] private static IEnumerator Vision(IEnumerator result, EnemyVision __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { result = result, __instance = __instance }; } private static List GetPlayerList(List players) { return players.Where((PlayerAvatar player) => !Imperium.PlayerManager.InvisiblePlayers.Value.Contains(SteamId.op_Implicit(NetworkExtensions.GetSteamId(player)))).ToList(); } } [HarmonyPatch(typeof(LevelGenerator))] internal static class LevelGeneratorPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void StartPatch(LevelGenerator __instance) { //IL_0071: 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_0088: Expected I4, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) if (Imperium.GameManager.ModuleOverride.Value == "") { __instance.DebugModule = null; } else { PrefabRef debugModule = ((IEnumerable)Imperium.ObjectManager.LoadedModules.Value).FirstOrDefault((Func)((PrefabRef module) => module.PrefabName == Imperium.GameManager.ModuleOverride.Value)); __instance.DebugModule = debugModule; Type val = (Type)Imperium.GameManager.OverrideModuleType.Value; switch ((int)val) { case 0: LevelGenerator.Instance.DebugNormal = true; break; case 1: LevelGenerator.Instance.DebugPassage = true; break; case 2: case 3: LevelGenerator.Instance.DebugDeadEnd = true; break; } } if (Imperium.ArenaManager.DisableEnemies.Value) { LevelGenerator.Instance.DebugNoEnemy = true; } if (Object.op_Implicit((Object)(object)Imperium.GameManager.NextLevelOverride)) { RunManager.instance.levelCurrent = Imperium.GameManager.NextLevelOverride; Imperium.GameManager.NextLevelOverride = null; } LevelGenerator.Instance.DebugLevelSize = ((Imperium.GameManager.CustomLevelSize.Value > 0f) ? Imperium.GameManager.CustomLevelSize.Value : 1f); LevelGenerator.Instance.DebugAmount = Imperium.GameManager.CustomModuleAmount.Value; ValuableDirector.instance.valuableDebug = (ValuableDebug)Imperium.GameManager.CustomValuableSpawns.Value; } } [HarmonyPatch(typeof(MenuCursor))] internal static class MenuCursorPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void UpdatePatch(MenuCursor __instance) { if (Imperium.Interface.IsOpen()) { __instance.mesh.SetActive(false); } } } [HarmonyPatch(typeof(PlayerHealth))] internal static class PlayerHealthPatch { } [HarmonyPatch(typeof(WorldSpaceUIValueLost))] internal static class WorldSpaceUIValueLostPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartPatch(WorldSpaceUIValueLost __instance) { //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_004f: Unknown result type (might be due to invalid IL or missing references) if (Imperium.GameManager.EnemyValueLostInstances.Contains(__instance)) { ((TMP_Text)__instance.text).text = $"-{__instance.value} HP"; __instance.scale *= 2f; ((Component)__instance).transform.localScale = __instance.scale; } } } } namespace Imperium.Networking { public class ImpNetEvent : INetworkSubscribable { private readonly string identifier; private readonly bool relayPackets; private readonly bool isPersistent; private readonly ImpNetworking networking; internal event Action OnServerReceive; internal event Action OnClientRecive; public ImpNetEvent(string identifier, ImpNetworking networking, bool relayPackets = false, bool allowUnauthenticated = false, bool isPersistent = false) { this.identifier = identifier + "_event"; this.networking = networking; this.relayPackets = relayPackets; this.isPersistent = isPersistent; networking.SubscribeChannel(this.identifier, OnPacketReceived, allowUnauthenticated); networking.RegisterSubscriber(this); Imperium.IO.LogDebug("[NET] Event " + identifier + " has been registered."); } [ImpAttributes.RemoteMethod] internal void DispatchToServer() { Imperium.IO.LogDebug("[NET] Client sends event " + identifier + " to server."); networking.SendPacket(identifier, null, (NetworkDestination)0); } [ImpAttributes.HostOnly] internal void DispatchToClients() { if (!SemiFunc.IsMasterClientOrSingleplayer()) { Imperium.IO.LogError("[NET] Trying to dispatch to clients from non-host. Blocked by Imperium policy."); Imperium.IO.LogError(Environment.StackTrace); } else { Imperium.IO.LogDebug("[NET] Server sends event " + identifier + " to clients."); networking.SendPacket(identifier, null, (NetworkDestination)1); OnClientReceived(); } } [ImpAttributes.HostOnly] internal void DispatchToClients(params ulong[] clientIds) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { Imperium.IO.LogError("[NET] Trying to dispatch to clients from non-host. Blocked by Imperium policy."); Imperium.IO.LogError(Environment.StackTrace); return; } Imperium.IO.LogDebug($"[NET] Server sends event {identifier} to clients: {clientIds}."); networking.SendPacket(identifier, null, (NetworkDestination)3, clientIds.Select((ulong id) => SteamId.op_Implicit(id)).ToArray()); } private void OnPacketReceived(ImpPacket packet) { //IL_0006: 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) if ((int)((NetworkPacket)packet).Header.Destination == 0) { Imperium.IO.LogDebug("[NET] Server received event " + identifier + "."); OnServerReceived(SteamId.op_Implicit(((NetworkPacket)packet).Header.Sender)); } else { Imperium.IO.LogDebug("[NET] Client received event " + identifier + "."); OnClientReceived(); } } private void OnServerReceived(ulong senderId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (senderId != SteamId.op_Implicit(RepoSteamNetwork.CurrentSteamId) && !Imperium.Settings.Preferences.AllowClients.Value) { Imperium.IO.LogDebug("[NET] Server blocked client event " + identifier + "."); return; } if (relayPackets) { DispatchToClients(); } this.OnServerReceive?.Invoke(senderId); } private void OnClientReceived() { this.OnClientRecive?.Invoke(); } public void Unsubscribe() { if (!isPersistent) { networking.Unsubscribe(identifier); } } public void BroadcastToClient(ulong clientId) { } } public class ImpNetMessage : INetworkSubscribable { private readonly string identifier; private readonly bool relayPackets; private readonly bool isPersistent; private readonly ImpNetworking networking; internal event Action OnServerReceive; internal event Action OnClientRecive; public ImpNetMessage(string identifier, ImpNetworking networking, bool relayPackets = false, bool allowUnauthenticated = false, bool isPersistent = false) { this.identifier = identifier + "_message"; this.networking = networking; this.relayPackets = relayPackets; this.isPersistent = isPersistent; networking.SubscribeChannel(this.identifier, OnPacketReceived, allowUnauthenticated); networking.RegisterSubscriber(this); Imperium.IO.LogDebug("[NET] Message " + identifier + " has been registered."); } [ImpAttributes.RemoteMethod] internal void DispatchToServer(T data) { Imperium.IO.LogDebug("[NET] Client sends message " + identifier + " to server."); networking.SendPacket(identifier, data, (NetworkDestination)0); } [ImpAttributes.HostOnly] internal void DispatchToClients(T data) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { Imperium.IO.LogError("[NET] Trying to dispatch to clients from non-host. Blocked by Imperium policy."); Imperium.IO.LogError(Environment.StackTrace); } else { Imperium.IO.LogDebug("[NET] Server sends message " + identifier + " to clients."); networking.SendPacket(identifier, data, (NetworkDestination)1); OnClientReceived(data); } } private void OnPacketReceived(ImpPacket packet) { //IL_0006: 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) if ((int)((NetworkPacket)packet).Header.Destination == 0) { Imperium.IO.LogDebug("[NET] Server received message " + identifier + "."); OnServerReceived((T)Convert.ChangeType(packet.Payload, typeof(T)), SteamId.op_Implicit(((NetworkPacket)packet).Header.Sender)); } else { Imperium.IO.LogDebug("[NET] Client received message " + identifier + "."); OnClientReceived((T)Convert.ChangeType(packet.Payload, typeof(T))); } } private void OnServerReceived(T data, ulong senderId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (senderId != SteamId.op_Implicit(RepoSteamNetwork.CurrentSteamId) && !Imperium.Settings.Preferences.AllowClients.Value) { Imperium.IO.LogDebug("[NET] Server blocked client message " + identifier + "."); return; } if (relayPackets) { DispatchToClients(data); } this.OnServerReceive?.Invoke(data, senderId); } private void OnClientReceived(T data) { this.OnClientRecive?.Invoke(data); } public void Unsubscribe() { if (!isPersistent) { networking.Unsubscribe(identifier); } } public void BroadcastToClient(ulong clientId) { } } public class ImpNetworkBinding : IBinding, IResettable, IRefreshable, INetworkSubscribable { private readonly Action onUpdateServer; private readonly IBinding masterBinding; private readonly string identifier; private readonly ImpNetworking networking; public T DefaultValue { get; } public T Value { get; private set; } public event Action OnUpdate; public event Action OnUpdateSecondary; public event Action OnTrigger; public event Action OnTriggerSecondary; public ImpNetworkBinding(string identifier, ImpNetworking networking, T currentValue = default(T), T defaultValue = default(T), Action onUpdateClient = null, Action onUpdateServer = null, IBinding masterBinding = null, bool allowUnauthenticated = false) { this.identifier = identifier + "_binding"; this.networking = networking; Value = currentValue; DefaultValue = ((masterBinding != null) ? masterBinding.DefaultValue : ((!EqualityComparer.Default.Equals(defaultValue, default(T))) ? defaultValue : currentValue)); OnUpdate += onUpdateClient; this.onUpdateServer = onUpdateServer; this.masterBinding = masterBinding; networking.SubscribeChannel(this.identifier, OnPacketReceived, allowUnauthenticated); networking.RegisterSubscriber(this); if (masterBinding != null && SemiFunc.IsMasterClientOrSingleplayer()) { Set(masterBinding.Value); } } private void OnPacketReceived(ImpPacket packet) { //IL_0006: 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) if ((int)((NetworkPacket)packet).Header.Destination == 0) { Imperium.IO.LogDebug("[NET] Server received binding update " + identifier + "."); OnServerReceived((BindingUpdateRequest)Convert.ChangeType(packet.Payload, typeof(BindingUpdateRequest)), SteamId.op_Implicit(((NetworkPacket)packet).Header.Sender)); } else { OnClientReceived((BindingUpdateRequest)Convert.ChangeType(packet.Payload, typeof(BindingUpdateRequest))); } } private void OnServerReceived(BindingUpdateRequest request, ulong senderId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (senderId != SteamId.op_Implicit(RepoSteamNetwork.CurrentSteamId) && !Imperium.Settings.Preferences.AllowClients.Value) { Imperium.IO.LogDebug("[NET] Server blocked client message " + identifier + "."); return; } networking.SendPacket(identifier, request, (NetworkDestination)1); OnClientReceived(request); } private void OnClientReceived(BindingUpdateRequest updatedValue) { Imperium.IO.LogDebug("[NET] Client received binding update " + identifier + "."); Value = updatedValue.Payload; if (updatedValue.InvokePrimaryUpdate) { this.OnUpdate?.Invoke(Value); this.OnTrigger?.Invoke(); } } public void Set(T updatedValue, bool invokePrimary = true, bool invokeSecondary = true) { Value = updatedValue; if (masterBinding != null && SemiFunc.IsMasterClientOrSingleplayer()) { masterBinding.Set(updatedValue, true, true); } if (invokeSecondary) { this.OnUpdateSecondary?.Invoke(updatedValue); this.OnTriggerSecondary?.Invoke(); } networking.SendPacket(identifier, new BindingUpdateRequest { Payload = updatedValue, InvokePrimaryUpdate = invokePrimary }, (NetworkDestination)2); } public void Refresh() { } public void Reset(bool invokePrimary = true, bool invokeSecondary = true) { Set(DefaultValue, invokePrimary, invokeSecondary); } public void Unsubscribe() { networking.Unsubscribe(identifier); } [ImpAttributes.HostOnly] public void BroadcastToClient(ulong clientId) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer()) { networking.SendPacket(identifier, new BindingUpdateRequest { Payload = Value, InvokePrimaryUpdate = true }, (NetworkDestination)3, SteamId.op_Implicit(clientId)); } } } public interface INetworkSubscribable { void Unsubscribe(); void BroadcastToClient(ulong clientId); } public class ImpNetworking { [CompilerGenerated] private sealed class d__30 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImpNetworking <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown int num = <>1__state; ImpNetworking impNetworking = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; impNetworking.authenticateEvent.DispatchToServer(); <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!Imperium.IsImperiumLaunched) { Imperium.IO.Send("Failed to acquire Imperium access! Shutting down...", "Imperium", isWarning: true); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly HashSet RegisteredNetworkSubscribers = new HashSet(); internal static readonly ImpBinding ConnectedPlayers = new ImpBinding(1, 0, (Action)null, (Action)null, false); internal readonly ImpNetworkBinding> ImperiumUsers; private readonly ImpNetEvent authenticateEvent; private readonly ImpNetEvent enableImperiumEvent; private readonly ImpNetEvent disableImperiumEvent; private readonly ImpNetEvent clientRequestValues; private readonly ImpNetMessage networkLog; private readonly Dictionary subscribers = new Dictionary(); internal bool ImperiumAccessGranted { get; private set; } public ImpNetworking() { RepoSteamNetwork.RegisterPacket(); RepoSteamNetwork.AddCallback((Action)OnPacketReceived); authenticateEvent = new ImpNetEvent("AuthenticateImperium", this, relayPackets: false, allowUnauthenticated: true, isPersistent: true); enableImperiumEvent = new ImpNetEvent("EnableImperium", this); disableImperiumEvent = new ImpNetEvent("DisableImperium", this); networkLog = new ImpNetMessage("NetworkLog", this); clientRequestValues = new ImpNetEvent("ClientRequestValues", this); ImperiumUsers = new ImpNetworkBinding>("ImperiumUsers", this, new HashSet { 0uL }); authenticateEvent.OnServerReceive += OnAuthenticateRequest; clientRequestValues.OnServerReceive += OnClientRequestValues; enableImperiumEvent.OnClientRecive += OnEnableImperiumAccess; disableImperiumEvent.OnClientRecive += OnDisableImperiumAccess; authenticateEvent.OnClientRecive += OnAuthenticateResponse; networkLog.OnClientRecive += OnLogReceived; } private void OnPacketReceived(ImpPacket packet) { //IL_0055: 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) if (!subscribers.TryGetValue(packet.Channel, out var value)) { Imperium.IO.LogWarning("[NET] Received packet in unknown channel: " + packet.Channel + ". Ignoring."); } else if (SemiFunc.IsMultiplayer() && !value.AllowUnauthenticated && !ImperiumUsers.Value.Contains(SteamId.op_Implicit(((NetworkPacket)packet).Header.Target))) { Imperium.IO.LogWarning($"[NET] Received packet from unauthenticated client: {((NetworkPacket)packet).Header.Target}. Blocking."); } else { value.OnPacket(packet); } } internal void Unsubscribe(string channel) { subscribers.Remove(channel); } internal void SubscribeChannel(string channel, Action callback, bool allowUnauthenticated) { if (subscribers.TryGetValue(channel, out var _)) { Imperium.IO.LogError("[NET] Subscription with duplicate identifier registered: " + channel); return; } subscribers[channel] = new ImpSubscription { OnPacket = callback, AllowUnauthenticated = allowUnauthenticated }; } internal void SendPacket(string channel, object data, NetworkDestination destination = 2, params SteamId[] clientIds) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) ImpPacket impPacket = new ImpPacket { Channel = channel, Payload = data }; if ((int)destination == 3) { NetworkExtensions.SendPacket((IEnumerable)clientIds, impPacket); } else if (GameManager.Multiplayer()) { RepoSteamNetwork.SendPacket(impPacket, destination); } else if ((int)destination != 1) { OnPacketReceived(impPacket); } } internal void BindAllowClients(IBinding allowClientsBinding) { if (SemiFunc.IsMasterClientOrSingleplayer()) { allowClientsBinding.OnUpdate += ToggleImperiumAccess; } } internal void RegisterSubscriber(INetworkSubscribable subscriber) { RegisteredNetworkSubscribers.Add(subscriber); } internal void SendLog(NetworkNotification report) { if (SemiFunc.IsMasterClientOrSingleplayer()) { networkLog.DispatchToClients(report); } } private static void OnLogReceived(NetworkNotification report) { Imperium.IO.Send(report.Message, report.Title ?? "Imperium Server", report.IsWarning, report.Type); } [ImpAttributes.HostOnly] private void OnClientRequestValues(ulong clientId) { foreach (INetworkSubscribable registeredNetworkSubscriber in RegisteredNetworkSubscribers) { registeredNetworkSubscriber.BroadcastToClient(clientId); } } [ImpAttributes.HostOnly] private void OnAuthenticateRequest(ulong senderId) { //IL_0001: 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_001b: Unknown result type (might be due to invalid IL or missing references) if (senderId == SteamId.op_Implicit(RepoSteamNetwork.CurrentSteamId)) { authenticateEvent.DispatchToClients(SteamId.op_Implicit(RepoSteamNetwork.CurrentSteamId)); ImperiumUsers.Set(ImperiumUsers.Value.Toggle(senderId)); return; } string text = NetworkExtensions.GetPlayerAvatar(SteamId.op_Implicit(senderId))?.playerName ?? $"#{senderId}"; if (Imperium.Settings.Preferences.AllowClients.Value) { Imperium.IO.Send("Imperium access was granted to client " + text + ".", "Imperium", isWarning: false, NotificationType.AccessControl); Imperium.IO.LogInfo($"[NET] Client #{senderId} successfully requested Imperium access ({text})!"); authenticateEvent.DispatchToClients(senderId); ImperiumUsers.Set(ImperiumUsers.Value.Toggle(senderId)); } else { Imperium.IO.Send("Imperium access was denied to client " + text + ".", "Imperium", isWarning: false, NotificationType.AccessControl); Imperium.IO.LogInfo($"[NET] Client #{senderId} failed to request Imperium access ({text})!"); } } [ImpAttributes.HostOnly] private void ToggleImperiumAccess(bool hasAccess) { if (hasAccess) { enableImperiumEvent.DispatchToClients(); } else { disableImperiumEvent.DispatchToClients(); } } [ImpAttributes.LocalMethod] internal void OnAuthenticateResponse() { ImperiumAccessGranted = true; Imperium.IO.Send("Imperium access was granted!", "Imperium", isWarning: false, NotificationType.AccessControl); Imperium.IO.LogInfo("[NET] Imperium access was granted! Launching Imperium..."); if (!Imperium.IsImperiumLaunched) { if (!ImpUtils.RunSafe(Imperium.Launch, "Imperium startup failed")) { Imperium.IO.Send("Imperium launch failed! Shutting down.", "Imperium", isWarning: false, NotificationType.Required); Imperium.DisableImperium(); } } else { Imperium.EnableImperium(); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { clientRequestValues.DispatchToServer(); } } [ImpAttributes.LocalMethod] private void OnDisableImperiumAccess() { if (!SemiFunc.IsMasterClientOrSingleplayer()) { ImperiumAccessGranted = false; Imperium.IO.Send("Imperium access was revoked!", "Imperium", isWarning: true, NotificationType.AccessControl); Imperium.IO.LogInfo("[NET] Imperium access was revoked!"); Imperium.DisableImperium(); } } [ImpAttributes.LocalMethod] private void OnEnableImperiumAccess() { if (!SemiFunc.IsMasterClientOrSingleplayer()) { ImperiumAccessGranted = true; Imperium.IO.Send("Imperium access was granted!", "Imperium", isWarning: false, NotificationType.AccessControl); Imperium.IO.LogInfo("[NET] Imperium access was granted! Launching Imperium..."); if (Imperium.IsImperiumLaunched) { Imperium.EnableImperium(); } else if (!ImpUtils.RunSafe(Imperium.Launch, "Imperium startup failed")) { Imperium.DisableImperium(); } clientRequestValues.DispatchToServer(); } } [ImpAttributes.RemoteMethod] internal void RequestImperiumAccess() { ImperiumAccessGranted = false; Imperium.DisableImperium(); ((MonoBehaviour)MenuManager.instance).StartCoroutine(waitForImperiumAccess()); } internal void ResetImperiumAccess() { ImperiumAccessGranted = false; } [IteratorStateMachine(typeof(d__30))] private IEnumerator waitForImperiumAccess() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__30(0) { <>4__this = this }; } public void Unload() { foreach (INetworkSubscribable registeredNetworkSubscriber in RegisteredNetworkSubscribers) { registeredNetworkSubscriber.Unsubscribe(); } RegisteredNetworkSubscribers.Clear(); } } public class ImpPacket : NetworkPacket { public string Channel; public object Payload; protected override void WriteData(SocketMessage socketMessage) { socketMessage.Write(Channel); socketMessage.Write(Payload); } protected override void ReadData(SocketMessage socketMessage) { Channel = socketMessage.Read(); Payload = socketMessage.Read(); } } public record ImpSubscription { public Action OnPacket { get; init; } public bool AllowUnauthenticated { get; init; } } } namespace Imperium.Interface { public abstract class BaseUI : MonoBehaviour { protected Transform container; protected RectTransform rect; protected ImpBinding theme; protected ImpTooltip tooltip; internal IBinding[] CanOpenBindings; [CanBeNull] internal ImpInterfaceManager interfaceManager; internal bool IsOpen { get; private set; } internal event Action onOpen; internal event Action onClose; public void InitUI(ImpBinding themeBinding, ImpTooltip impTooltip = null, IBinding[] canOpenBindings = null) { container = ((Component)this).transform.Find("Container"); Transform obj = ((Component)this).transform.Find("Container"); rect = ((obj != null) ? ((Component)obj).GetComponent() : null); tooltip = impTooltip; CanOpenBindings = canOpenBindings ?? Array.Empty>(); onOpen += OnOpen; onClose += OnClose; theme = themeBinding; if (theme != null) { theme.OnUpdate += OnThemePrimaryUpdate; ImpThemeManager.Style(theme.Value, container, new StyleOverride("", Variant.BACKGROUND), new StyleOverride("TitleBox", Variant.DARKER), new StyleOverride("Border", Variant.DARKER), new StyleOverride("Content", Variant.DARKER), new StyleOverride("Content/Border", Variant.DARKER)); ImpThemeManager.StyleText(theme.Value, container, new StyleOverride("TitleBox/Title", Variant.FOREGROUND)); } InitUI(); OnThemePrimaryUpdate(themeBinding.Value); if (Object.op_Implicit((Object)(object)container)) { ((Component)container).gameObject.SetActive(false); } Imperium.IO.LogInfo($"[OK] Successfully loaded {((object)this).GetType()} !"); } protected virtual void InitUI() { } private void CloseEvent(CallbackContext _) { Close(); } public void Close() { if (Object.op_Implicit((Object)(object)interfaceManager)) { interfaceManager.Close(); } else { OnUIClose(); } } public void Open() { if (Object.op_Implicit((Object)(object)interfaceManager)) { interfaceManager.Open(((object)this).GetType()); } else { OnUIOpen(); } } internal void OnUIClose() { if (Object.op_Implicit((Object)(object)container)) { ((Component)container).gameObject.SetActive(false); } IsOpen = false; this.onClose?.Invoke(); } internal void OnUIOpen() { bool isOpen = IsOpen; if (Object.op_Implicit((Object)(object)container)) { ((Component)container).gameObject.SetActive(true); } IsOpen = true; this.onOpen?.Invoke(isOpen); if (Imperium.Settings.Preferences.PlaySounds.Value) { GameUtils.PlayClip(ImpAssets.OpenClick); } } internal void InvokeOnOpen(bool wasOpen) { this.onOpen?.Invoke(wasOpen); } protected virtual void OnThemePrimaryUpdate(ImpTheme themeUpdate) { } protected virtual void OnOpen(bool wasOpen) { } protected virtual void OnClose() { } public virtual bool CanOpen() { return true; } } public class ImperiumDock : BaseUI { internal void RegisterDockButton(string buttonPath, ImpInterfaceManager dockInterfaceManager, string interfaceName, string interfaceDescription, params IBinding[] canOpenBindings) where T : BaseUI { Transform val = container.Find(buttonPath); Image buttonImage = ((Component)val).GetComponent(); ((Behaviour)buttonImage).enabled = dockInterfaceManager.IsOpen() && canOpenBindings.All((IBinding binding) => binding.Value); ImpButton.Bind("", val, delegate { if (canOpenBindings.All((IBinding binding) => binding.Value)) { dockInterfaceManager.Open(); } }, "", isIconButton: true, playClickSound: false, (IBinding)(object)theme, new TooltipDefinition { Tooltip = tooltip, Title = interfaceName, Description = interfaceDescription, HasAccess = true }, null, interactableInvert: false, canOpenBindings); dockInterfaceManager.OpenInterface.OnUpdate += delegate(BaseUI selectedInterface) { ((Behaviour)buttonImage).enabled = Object.op_Implicit((Object)(object)selectedInterface) && ((object)selectedInterface).GetType() == typeof(T); }; } protected override void OnThemePrimaryUpdate(ImpTheme themeUpdate) { ImpThemeManager.Style(themeUpdate, container, new StyleOverride("", Variant.BACKGROUND), new StyleOverride("Border", Variant.DARKER)); } protected override void OnOpen(bool wasOpen) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)rect) && !wasOpen) { ((MonoBehaviour)this).StartCoroutine(ImpUtils.Interface.SlideInAnimation(rect, Vector2.right)); } } } internal class ImpHighlighter : ImpWidget { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImpHighlighter <>4__this; private Vector2 5__2; private Vector2 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0052: 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_00e1: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_012a: 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_018f: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_0207: Expected O, but got Unknown int num = <>1__state; ImpHighlighter impHighlighter = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; impHighlighter.isShown = true; impHighlighter.panelGroup.alpha = 0f; ((Transform)impHighlighter.panelRect).localScale = Vector3.one; 5__4 = 0f; goto IL_00b8; case 1: <>1__state = -1; 5__4 += Time.deltaTime; goto IL_00b8; case 2: <>1__state = -1; 5__4 += Time.deltaTime; goto IL_016e; case 3: <>1__state = -1; 5__4 += Time.deltaTime; goto IL_01d9; case 4: <>1__state = -1; 5__4 = 0f; break; case 5: { <>1__state = -1; 5__4 += Time.deltaTime; break; } IL_00b8: if (5__4 < 0.2f) { impHighlighter.panelGroup.alpha = Mathf.Lerp(0f, 1f, 5__4 / 0.2f); <>2__current = null; <>1__state = 1; return true; } impHighlighter.panelGroup.alpha = 1f; 5__2 = impHighlighter.panelRect.sizeDelta; 5__3 = 5__2 + new Vector2(10f, 10f) * 2f; 5__4 = 0f; goto IL_016e; IL_01d9: if (5__4 < 0.2f) { impHighlighter.panelRect.sizeDelta = Vector2.Lerp(5__3, 5__2, 5__4 / 0.2f); <>2__current = null; <>1__state = 3; return true; } impHighlighter.panelRect.sizeDelta = 5__2; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 4; return true; IL_016e: if (5__4 < 0.2f) { impHighlighter.panelRect.sizeDelta = Vector2.Lerp(5__2, 5__3, 5__4 / 0.2f); <>2__current = null; <>1__state = 2; return true; } 5__4 = 0f; goto IL_01d9; } if (5__4 < 0.4f) { impHighlighter.panelGroup.alpha = Mathf.Lerp(1f, 0f, 5__4 / 0.4f); <>2__current = null; <>1__state = 5; return true; } impHighlighter.panelGroup.alpha = 0f; impHighlighter.isShown = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private RectTransform panelRect; private CanvasGroup panelGroup; private Coroutine showAnimationCoroutine; private bool isShown; private Transform realParent; private Transform fakeParent; private const float highlightFadeInTime = 0.2f; private const float highlightScaleTime = 0.2f; private const float highlightPauseTime = 1f; private const float highlightFadeOutTime = 0.4f; private void Awake() { realParent = ((Component)this).transform.parent; panelRect = ((Component)((Component)this).transform).GetComponent(); panelGroup = ((Component)panelRect).GetComponent(); panelGroup.alpha = 0f; } internal void Highlight(RectTransform elementTransform) { PlaceHighlighter(elementTransform); if (showAnimationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(showAnimationCoroutine); } showAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(highlightAnimation()); } [IteratorStateMachine(typeof(d__12))] private IEnumerator highlightAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this }; } private void PlaceHighlighter(RectTransform elementRect) { //IL_001f: 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_003f: 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_0059: 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) fakeParent = (Transform)(object)elementRect; ((Transform)panelRect).SetParent(fakeParent, false); panelRect.anchorMin = Vector2.zero; panelRect.anchorMax = Vector2.one; panelRect.offsetMin = Vector2.one * -3f; panelRect.offsetMax = Vector2.one * 3f; ((Transform)panelRect).SetParent(realParent, true); } private void Update() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (isShown && Object.op_Implicit((Object)(object)fakeParent)) { ((Component)this).transform.position = fakeParent.position; } } protected override void OnThemeUpdate(ImpTheme themeUpdate) { } } public class ImpTooltip : ImpWidget { [CompilerGenerated] private sealed class d__14 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImpTooltip <>4__this; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ImpTooltip impTooltip = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0f; 5__3 = impTooltip.panelGroup.alpha; break; case 1: <>1__state = -1; break; } if (5__2 < 0.1f) { float num2 = 5__2 / 0.1f; impTooltip.panelGroup.alpha = Mathf.Lerp(5__3, 0f, num2); 5__2 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } impTooltip.panelGroup.alpha = 0f; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImpTooltip <>4__this; public string title; public string text; public bool hasAccess; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown int num = <>1__state; ImpTooltip impTooltip = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; impTooltip.headerText.text = title; impTooltip.bodyText.text = text; impTooltip.accessIcon.gameObject.SetActive(!hasAccess); impTooltip.accessText.gameObject.SetActive(!hasAccess); LayoutRebuilder.ForceRebuildLayoutImmediate(impTooltip.panelRect); 5__2 = 0f; break; case 2: <>1__state = -1; break; } if (5__2 < 0.1f) { float alpha = 5__2 / 0.1f; impTooltip.panelGroup.alpha = alpha; 5__2 += Time.deltaTime; <>2__current = null; <>1__state = 2; return true; } impTooltip.panelGroup.alpha = 1f; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool isActive; private Transform panel; private RectTransform panelRect; private CanvasGroup panelGroup; private TMP_Text headerText; private TMP_Text bodyText; private GameObject accessIcon; private GameObject accessText; private CanvasScaler canvasScaler; private Coroutine showAnimationCoroutine; private void Awake() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_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) panel = ((Component)this).transform.Find("Panel"); headerText = ((Component)panel.Find("Header/Title")).GetComponent(); panelRect = ((Component)panel).GetComponent(); panelGroup = ((Component)panel).GetComponent(); accessIcon = ((Component)panel.Find("Header/Locked")).gameObject; bodyText = ((Component)panel.Find("Text")).GetComponent(); accessText = ((Component)panel.Find("Access")).gameObject; canvasScaler = ((Component)((Component)this).transform).GetComponent(); panelGroup.alpha = 0f; panel.position = Vector2.op_Implicit(new Vector2(((Component)this).transform.position.x, ((Component)this).transform.position.y)); } public void SetPosition(string title, string text, Vector2 cursorPosition, bool hasAccess = true) { //IL_005d: 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_0093: 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_00d9: 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_00f1: 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_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_0124: Unknown result type (might be due to invalid IL or missing references) if (!Imperium.Settings.Preferences.ShowTooltips.Value) { return; } ((Component)this).gameObject.SetActive(true); if (!isActive) { isActive = true; if (showAnimationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(showAnimationCoroutine); } showAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(showAnimation(title, text, hasAccess)); return; } float num = cursorPosition.x + 20f; Rect rect = panelRect.rect; bool flag = num + ((Rect)(ref rect)).width * canvasScaler.m_PrevScaleFactor > (float)Screen.width; float num2 = cursorPosition.y - 20f; rect = panelRect.rect; bool flag2 = num2 - ((Rect)(ref rect)).height * canvasScaler.m_PrevScaleFactor < 0f; float num3 = (flag ? cursorPosition.x : (cursorPosition.x + 15f)); float num4 = (flag2 ? cursorPosition.y : (cursorPosition.y - 20f)); ((Component)panel).transform.position = Vector2.op_Implicit(new Vector2(num3, num4)); panelRect.pivot = new Vector2((float)(flag ? 1 : 0), (float)((!flag2) ? 1 : 0)); } public void Deactivate() { isActive = false; if (showAnimationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(showAnimationCoroutine); } if (((Component)this).gameObject.activeInHierarchy) { ((MonoBehaviour)this).StartCoroutine(hideAnimation()); } } [IteratorStateMachine(typeof(d__13))] private IEnumerator showAnimation(string title, string text, bool hasAccess = true) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this, title = title, text = text, hasAccess = hasAccess }; } [IteratorStateMachine(typeof(d__14))] private IEnumerator hideAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } protected override void OnThemeUpdate(ImpTheme themeUpdate) { ImpThemeManager.Style(themeUpdate, panel, new StyleOverride("", Variant.BACKGROUND), new StyleOverride("Border", Variant.DARKER)); } } public record TooltipDefinition { public ImpTooltip Tooltip { get; init; } public string Title { get; init; } public string Description { get; init; } public bool HasAccess { get; init; } = true; } public abstract class ImpWidget : MonoBehaviour { protected IBinding theme; private global::Imperium.Interface.ImperiumUI.ImperiumUI parent; [CanBeNull] protected ImperiumWindow window; protected ImpTooltip tooltip { get; private set; } protected event Action onOpen; protected event Action onClose; internal void Init(IBinding themeBinding, ImpTooltip tooltipReference) { theme = themeBinding; tooltip = tooltipReference; theme.OnUpdate += OnThemeUpdate; InitWidget(); } internal void Init(IBinding themeBinding, ImpTooltip tooltipReference, ref Action onOpenAction, ref Action onCloseAction, global::Imperium.Interface.ImperiumUI.ImperiumUI widgetParent, ImperiumWindow widgetWindow) { parent = widgetParent; window = widgetWindow; onOpenAction = (Action)Delegate.Combine(onOpenAction, (Action)delegate { this.onOpen?.Invoke(); }); onCloseAction = (Action)Delegate.Combine(onCloseAction, (Action)delegate { this.onClose?.Invoke(); }); onOpenAction = (Action)Delegate.Combine(onOpenAction, new Action(OnOpen)); onCloseAction = (Action)Delegate.Combine(onCloseAction, new Action(OnClose)); Init(themeBinding, tooltipReference); } protected void RegisterElement(string elementPath) { } protected void CloseParent() { parent?.Close(); } protected virtual void OnOpen() { } protected virtual void OnClose() { } protected virtual void InitWidget() { } protected virtual void OnThemeUpdate(ImpTheme themeUpdate) { } } } namespace Imperium.Interface.SpawningUI { public class SpawningObjectEntry : MonoBehaviour { private GameObject selectedCover; private string objectName; private string objectNameNormalized; private SpawnObjectType spawnType { get; set; } internal void Init(SpawnObjectType type, string spawnObjectName, Action onClick, Action onHover, Dictionary typeDisplayNameMap, ImpBinding themeBinding) { spawnType = type; objectName = spawnObjectName; objectNameNormalized = NormalizeName(spawnObjectName); ImpButton.Bind("", ((Component)this).transform, delegate { onClick?.Invoke(); }, "", false, true, (IBinding)(object)themeBinding, null, null, false); selectedCover = ((Component)((Component)this).transform.Find("Selected")).gameObject; selectedCover.SetActive(false); ((Component)((Component)this).transform.Find("Name")).GetComponent().text = spawnObjectName; ((Component)((Component)this).transform.Find("Type")).GetComponent().text = typeDisplayNameMap.GetValueOrDefault(type, ""); ((Component)this).gameObject.AddComponent().onOver += onHover; themeBinding.OnUpdate += OnThemePrimaryUpdate; } private void OnThemePrimaryUpdate(ImpTheme themeUpdate) { ImpThemeManager.Style(themeUpdate, ((Component)this).transform, new StyleOverride("", Variant.FOREGROUND), new StyleOverride("Selected", Variant.FADED)); } internal void SetShown(bool isShown) { ((Component)this).gameObject.SetActive(isShown); SetSelected(isSelected: false); } internal void SetSelected(bool isSelected) { selectedCover.SetActive(isSelected); } internal bool OnInput(string inputText) { inputText = NormalizeName(inputText); bool flag = !string.IsNullOrEmpty(inputText) && objectNameNormalized.Contains(inputText); ((Component)this).gameObject.SetActive(flag); if (!flag) { SetSelected(isSelected: false); } return flag; } private static string NormalizeName(string input) { return new string(input.Trim().ToLower().Where(char.IsLetterOrDigit) .ToArray()); } } internal class SpawningUI : BaseUI { private const int MaxItemsShown = 8; private TMP_InputField input; private GameObject moreItems; private TMP_Text moreItemsText; private Transform entryContainer; private GameObject template; private readonly List entries = new List(); private SpawningObjectEntry previouslySpawnedObject; private int previouslySpawnedAmount; private int previouslySpawnedValue; private int selectedIndex = -1; private readonly Dictionary typeDisplayNames = new Dictionary { { SpawnObjectType.Entity, "Entity" }, { SpawnObjectType.Item, "Item" }, { SpawnObjectType.Valuable, "Valuable" } }; protected override void InitUI() { entryContainer = container.Find("Results"); template = ((Component)container.Find("Results/Template")).gameObject; template.SetActive(false); input = ((Component)container.Find("Input")).GetComponent(); moreItems = ((Component)container.Find("Results/MoreItems")).gameObject; moreItemsText = ((Component)container.Find("Results/MoreItems/Label")).GetComponent(); moreItems.SetActive(false); ((UnityEvent)(object)input.onValueChanged).AddListener((UnityAction)delegate { OnInput(input.text); }); ((UnityEvent)(object)input.onSubmit).AddListener((UnityAction)delegate { OnSubmit(); }); Imperium.InputBindings.BaseMap.PreviousItem.performed += OnSelectPrevious; Imperium.InputBindings.BaseMap.NextItem.performed += OnSelectNext; Imperium.InputBindings.BaseMap.SelectItem.performed += OnSelectNext; GenerateItems(); } private void GenerateItems() { foreach (ExtendedEnemySetup item in Imperium.ObjectManager.LoadedEntities.Value) { int currentIndex = entries.Count; GameObject val = Object.Instantiate(template, entryContainer); SpawningObjectEntry spawningEntry = val.AddComponent(); spawningEntry.Init(SpawnObjectType.Entity, item.EnemyName, delegate { Spawn(spawningEntry, 1, -1); }, delegate { SelectItemAndDeselectOthers(currentIndex); }, typeDisplayNames, theme); entries.Add(spawningEntry); } foreach (PrefabRef item2 in Imperium.ObjectManager.LoadedItems.Value) { int currentIndex2 = entries.Count; GameObject val2 = Object.Instantiate(template, entryContainer); SpawningObjectEntry spawningEntry2 = val2.AddComponent(); spawningEntry2.Init(SpawnObjectType.Item, item2.PrefabName, delegate { Spawn(spawningEntry2, 1, -1); }, delegate { SelectItemAndDeselectOthers(currentIndex2); }, typeDisplayNames, theme); entries.Add(spawningEntry2); } foreach (PrefabRef item3 in Imperium.ObjectManager.LoadedValuables.Value) { int currentIndex3 = entries.Count; GameObject val3 = Object.Instantiate(template, entryContainer); SpawningObjectEntry spawningEntry3 = val3.AddComponent(); spawningEntry3.Init(SpawnObjectType.Valuable, item3.PrefabName, delegate { Spawn(spawningEntry3, 1, -1); }, delegate { SelectItemAndDeselectOthers(currentIndex3); }, typeDisplayNames, theme); entries.Add(spawningEntry3); } } private void SelectItemAndDeselectOthers(int index) { selectedIndex = index; SelectItemAndDeselectOthers(); } private void SelectItemAndDeselectOthers() { for (int i = 0; i < entries.Count; i++) { entries[i].SetSelected(i == selectedIndex); } } private void OnSelectNext(CallbackContext callbackContext) { if (!base.IsOpen) { return; } int num = 0; do { if (selectedIndex == entries.Count - 1) { selectedIndex = 0; } else { selectedIndex++; } num++; if (num == entries.Count) { selectedIndex = -1; break; } } while (!((Component)entries[selectedIndex]).gameObject.activeSelf); if (selectedIndex > -1) { SelectItemAndDeselectOthers(); } if (input.text.Length > 0) { input.caretPosition = input.text.Length; } } private void OnSelectPrevious(CallbackContext callbackContext) { if (!base.IsOpen) { return; } int num = 0; do { if (selectedIndex == 0) { selectedIndex = entries.Count - 1; } else { selectedIndex--; } num++; if (num == entries.Count) { selectedIndex = -1; break; } } while (!((Component)entries[selectedIndex]).gameObject.activeSelf); if (selectedIndex > -1) { SelectItemAndDeselectOthers(); } if (input.text.Length > 0) { input.caretPosition = input.text.Length; } } private void SetMoreItemsText(int amount) { if (amount < 1) { moreItems.gameObject.SetActive(false); return; } moreItems.SetActive(true); moreItemsText.text = $"{amount} more results..."; moreItems.transform.SetAsLastSibling(); } private void Spawn(SpawningObjectEntry spawningObjectEntry, int amount, int value) { //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_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_007c: 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_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_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_00b2: 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) if (((ImpBinding)(object)Imperium.Freecam.IsFreecamEnabled).Value || ((ImpBinding)(object)Imperium.PlayerManager.IsFlying).Value) { Transform val = (((ImpBinding)(object)Imperium.Freecam.IsFreecamEnabled).Value ? ((Component)Imperium.Freecam).transform : ((Component)PlayerAvatar.instance.localCamera).transform); } else { Transform transform = ((Component)PlayerAvatar.instance.localCamera).transform; Vector3 val2 = transform.position + transform.forward * 3f; Ray val3 = default(Ray); ((Ray)(ref val3))..ctor(transform.position, transform.forward); RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, ref val4) && Vector3.Distance(transform.position, ((RaycastHit)(ref val4)).point) < Vector3.Distance(transform.position, val2)) { val2 = ((RaycastHit)(ref val4)).point; } } Close(); } private void OnInput(string text) { SpawnInputParameters inputParameters = GetInputParameters(text.Trim()); foreach (SpawningObjectEntry entry in entries) { entry.OnInput(inputParameters.Text); } bool flag = false; int num = 0; int num2 = 0; for (int i = 0; i < entries.Count; i++) { SpawningObjectEntry spawningObjectEntry = entries[i]; if (num > 8) { num2++; spawningObjectEntry.SetShown(isShown: false); } else if (spawningObjectEntry.OnInput(inputParameters.Text)) { num++; if (!flag) { spawningObjectEntry.SetSelected(isSelected: true); flag = true; selectedIndex = i; } else { spawningObjectEntry.SetSelected(isSelected: false); } } } SetMoreItemsText(num2); } private void OnSubmit() { SpawnInputParameters inputParameters = GetInputParameters(input.text.Trim()); if (selectedIndex > -1) { Spawn(entries[selectedIndex], inputParameters.Amount, inputParameters.Value); previouslySpawnedObject = entries[selectedIndex]; previouslySpawnedAmount = inputParameters.Amount; previouslySpawnedValue = inputParameters.Value; Close(); } else if (Object.op_Implicit((Object)(object)previouslySpawnedObject)) { Spawn(previouslySpawnedObject, previouslySpawnedAmount, previouslySpawnedValue); Close(); } } private static SpawnInputParameters GetInputParameters(string text) { int result = 1; int result2 = -1; List list = text.Split(" ").ToList(); int count = list.Count; if (count <= 2) { if (count > 1) { int.TryParse(list[1], out result); } } else { int.TryParse(list[list.Count - 1], out result2); int.TryParse(list[list.Count - 2], out result); } SpawnInputParameters result3 = default(SpawnInputParameters); result3.Text = list[0]; result3.Amount = result; result3.Value = result2; return result3; } protected override void OnOpen(bool wasOpen) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)rect) && !wasOpen) { ((MonoBehaviour)this).StartCoroutine(ImpUtils.Interface.SlideInAnimation(rect, Vector2.down)); } input.text = ""; input.ActivateInputField(); } protected override void OnThemePrimaryUpdate(ImpTheme themeUpdate) { ImpThemeManager.Style(themeUpdate, container, new StyleOverride("Input", Variant.BACKGROUND), new StyleOverride("Input/Border", Variant.DARKER), new StyleOverride("Results/MoreItems", Variant.DARKEST), new StyleOverride("Results/Template", Variant.DARKER)); } } internal readonly struct SpawnInputParameters { internal string Text { get; init; } internal int Amount { get; init; } internal int Value { get; init; } } } namespace Imperium.Interface.MapUI { internal class MapUI : BaseUI { private GameObject compass; private Transform compassNorth; private Transform compassEast; private Transform compassSouth; private Transform compassWest; private ImpSlider farClipSlider; private ImpSlider nearClipSlider; private Transform target; private Vector3 cameraViewOrigin = Vector3.zero; private Vector3 cameraTargetRotation; private float snapBackAnimationTimer; private float mouseOffsetX; private float mouseOffsetY; private RawImage textureFrame; private readonly ImpBinding selectedPlayer = new ImpBinding((PlayerAvatar)null, (PlayerAvatar)null, (Action)null, (Action)null, false); private readonly ImpBinding selectedEntity = new ImpBinding((EnemyParent)null, (EnemyParent)null, (Action)null, (Action)null, false); private readonly ImpBinding<(GameObject, string)> selectedMapHazard = new ImpBinding<(GameObject, string)>(); protected override void InitUI() { Imperium.InputBindings.BaseMap.Reset.performed += OnMapReset; Imperium.InputBindings.BaseMap.Minimap.performed += OnMinimapToggle; InitRenderTexture(); InitCompass(); InitSliders(); InitMapSettings(); InitTargetSelection(); global::Imperium.Interface.LayerSelector.LayerSelector layerSelector = ((Component)container.Find("LayerSelector")).gameObject.AddComponent(); layerSelector.InitUI(theme); layerSelector.Bind(new ImpBinding(true, false, (Action)null, (Action)null, false), (ImpBinding)(object)Imperium.Settings.Map.CameraLayerMask); ((ImpBinding)(object)Imperium.Settings.Map.RotationLock).OnTrigger += OnRotationLockChange; selectedPlayer.Set(Imperium.Player, true, true); Imperium.IsLevelLoaded.OnTrue += delegate { selectedPlayer.Set(Imperium.Player, true, true); }; } private void OnDrag(Vector3 delta) { //IL_0020: 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_0066: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_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_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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) if (Imperium.InputBindings.BaseMap.MapRotate.IsPressed()) { mouseOffsetX += delta.x * 0.25f; mouseOffsetY -= delta.y * 0.25f; mouseOffsetY = Mathf.Clamp(mouseOffsetY, -89.9f, 89.9f); if (delta.y > 1f) { Imperium.Map.CameraNearClip.Set(1f, true, true); Imperium.Map.CameraFarClip.Set(200f, true, true); } snapBackAnimationTimer = 0f; cameraTargetRotation = new Vector3(mouseOffsetX, mouseOffsetY, 0f); } else { if (!Imperium.InputBindings.BaseMap.MapPan.IsPressed()) { return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((0f - delta.x) * 0.0016f * Imperium.Settings.Map.CameraZoom.Value, (0f - delta.y) * 0.0016f * Imperium.Settings.Map.CameraZoom.Value, 0f); val = ((Component)Imperium.Map.Camera).transform.TransformDirection(val); cameraViewOrigin += val; selectedEntity.Set((EnemyParent)null, true, true); selectedPlayer.Set((PlayerAvatar)null, true, true); if (Object.op_Implicit((Object)(object)target)) { if (Imperium.Settings.Map.RotationLock.Value) { float num = mouseOffsetX; Quaternion rotation = target.rotation; mouseOffsetX = num + ((Quaternion)(ref rotation)).eulerAngles.y; } target = null; } snapBackAnimationTimer = 0f; cameraTargetRotation = new Vector3(mouseOffsetX, mouseOffsetY, 0f); } } protected override void OnThemePrimaryUpdate(ImpTheme themeUpdate) { ImpThemeManager.Style(themeUpdate, container, new StyleOverride("LayerSelector", Variant.BACKGROUND), new StyleOverride("LayerSelector/Border", Variant.DARKER), new StyleOverride("LayerSelector/ScrollView/Scrollbar", Variant.DARKEST), new StyleOverride("LayerSelector/ScrollView/Scrollbar/SlidingArea/Handle", Variant.LIGHTER), new StyleOverride("MapBorder", Variant.DARKER), new StyleOverride("MapSettings", Variant.BACKGROUND), new StyleOverride("MapSettings/Border", Variant.DARKER), new StyleOverride("TargetSelection", Variant.BACKGROUND), new StyleOverride("TargetSelection/Border", Variant.DARKER), new StyleOverride("Compass", Variant.FOREGROUND), new StyleOverride("Compass/Icon", Variant.FOREGROUND), new StyleOverride("FarClip", Variant.BACKGROUND), new StyleOverride("FarClip/Border", Variant.DARKER), new StyleOverride("NearClip", Variant.BACKGROUND), new StyleOverride("NearClip/Border", Variant.DARKER), new StyleOverride("ZoomSlider", Variant.BACKGROUND), new StyleOverride("ZoomSlider/Border", Variant.DARKER)); ImpThemeManager.StyleText(themeUpdate, container, new StyleOverride("Compass/North", Variant.FOREGROUND), new StyleOverride("Compass/East", Variant.FOREGROUND), new StyleOverride("Compass/South", Variant.FOREGROUND), new StyleOverride("Compass/West", Variant.FOREGROUND)); } private void OnRotationLockChange() { MoveCameraToTarget(target); } private static void OnMinimapToggle(CallbackContext _) { if (!Imperium.Interface.IsOpen() && SemiFunc.NoTextInputsActive()) { ((ImpBinding)(object)Imperium.Settings.Map.MinimapEnabled).Set(!Imperium.Settings.Map.MinimapEnabled.Value, true, true); } } private void OnMapReset(CallbackContext _) { OnMapReset(); } private void OnMapReset() { MoveCameraToTarget(((Component)PlayerAvatar.instance.localCamera).transform); } private void InitCompass() { compass = ((Component)container.Find("Compass")).gameObject; compass.SetActive(Imperium.Settings.Map.CompassEnabled.Value); compass.gameObject.AddComponent().onClick += OnMapReset; ((ImpBinding)(object)Imperium.Settings.Map.CompassEnabled).OnUpdate += compass.SetActive; compassNorth = compass.transform.Find("North"); compassEast = compass.transform.Find("East"); compassSouth = compass.transform.Find("West"); compassWest = compass.transform.Find("South"); } private void InitSliders() { ImpSlider.Bind("ZoomSlider", container, (IBinding)(object)Imperium.Settings.Map.CameraZoom, 1f, 100f, "", 0f, "x", (float value) => $"{Mathf.RoundToInt(value)}", false, false, true, true, (IBinding)(object)theme, null, null, false); ((Component)container.Find("ZoomSlider/MinIcon")).gameObject.AddComponent().onClick += delegate { ((ImpBinding)(object)Imperium.Settings.Map.CameraZoom).Set(1f, true, true); }; ((Component)container.Find("ZoomSlider/MaxIcon")).gameObject.AddComponent().onClick += delegate { ((ImpBinding)(object)Imperium.Settings.Map.CameraZoom).Set(100f, true, true); }; nearClipSlider = ImpSlider.Bind("FarClip", container, (IBinding)(object)Imperium.Map.CameraNearClip, -50f, 200f, "", 0f, "", (float value) => $"{Mathf.RoundToInt(value)}", false, false, true, false, (IBinding)(object)theme, null, null, false); ((Component)nearClipSlider).gameObject.SetActive(!Imperium.Settings.Map.AutoClipping.Value); ((ImpBinding)(object)Imperium.Settings.Map.AutoClipping).OnUpdate += delegate(bool value) { ((Component)nearClipSlider).gameObject.SetActive(!value); }; farClipSlider = ImpSlider.Bind("NearClip", container, (IBinding)(object)Imperium.Map.CameraFarClip, -50f, 200f, "", 0f, "", (float value) => $"{Mathf.RoundToInt(value)}", false, false, true, false, (IBinding)(object)theme, null, null, false); ((Component)farClipSlider).gameObject.SetActive(!Imperium.Settings.Map.AutoClipping.Value); ((ImpBinding)(object)Imperium.Settings.Map.AutoClipping).OnUpdate += delegate(bool value) { ((Component)farClipSlider).gameObject.SetActive(!value); }; } private void InitMapSettings() { ImpToggle.Bind("MapSettings/MinimapEnabled", container, (IBinding)(object)Imperium.Settings.Map.MinimapEnabled, "", (IBinding)(object)theme, true, null, null); ImpToggle.Bind("MapSettings/CompassEnabled", container, (IBinding)(object)Imperium.Settings.Map.CompassEnabled, "", (IBinding)(object)theme, true, null, null); ImpToggle.Bind("MapSettings/RotationLock", container, (IBinding)(object)Imperium.Settings.Map.RotationLock, "", (IBinding)(object)theme, true, null, new TooltipDefinition { Tooltip = tooltip, Description = "Whether the camera is clamped\nto the target's rotation" }); ImpToggle.Bind("MapSettings/UnlockView", container, (IBinding)(object)Imperium.Settings.Map.UnlockView, "", (IBinding)(object)theme, true, null, new TooltipDefinition { Tooltip = tooltip, Description = "When off, the camera resets to a 45 angle.\nWhen on, the camers resets to top-down view." }); ImpToggle.Bind("MapSettings/AutoClipping", container, (IBinding)(object)Imperium.Settings.Map.AutoClipping, "", (IBinding)(object)theme, true, null, null); ImpButton.Bind("MapSettings/MinimapSettings", container, delegate { Imperium.Interface.Open(); }, "", false, true, (IBinding)(object)theme, null, null, false); } private void InitTargetSelection() { selectedPlayer.OnUpdate += delegate(PlayerAvatar player) { if (Object.op_Implicit((Object)(object)player)) { selectedEntity.Set((EnemyParent)null, true, true); selectedMapHazard.Set(default((GameObject, string)), true, true); MoveCameraToTarget(((Component)player.localCamera).transform); } }; selectedEntity.OnUpdate += delegate(EnemyParent entity) { if (Object.op_Implicit((Object)(object)entity)) { selectedPlayer.Set((PlayerAvatar)null, true, true); selectedMapHazard.Set(default((GameObject, string)), true, true); target = ((Component)entity.Enemy).transform; MoveCameraToTarget(((Component)entity.Enemy).transform); } }; ImpMultiSelect.Bind("TargetSelection/Players", container, (IBinding)(object)selectedPlayer, (IBinding>)(object)Imperium.ObjectManager.CurrentPlayers, (PlayerAvatar player) => player.playerName, theme); ImpMultiSelect.Bind("TargetSelection/Entities", container, (IBinding)(object)selectedEntity, (IBinding>)(object)Imperium.ObjectManager.CurrentLevelEntities, (EnemyParent entity) => entity.enemyName, theme); } private void MoveCameraToTarget(Transform newTarget) { //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_003b: 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_0068: 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) if (Object.op_Implicit((Object)(object)newTarget)) { target = newTarget; float num; if (!Imperium.Settings.Map.RotationLock.Value) { num = 0f; } else { Quaternion rotation = target.rotation; num = ((Quaternion)(ref rotation)).eulerAngles.y; } float num2 = num; cameraTargetRotation = (Imperium.Settings.Map.UnlockView.Value ? new Vector3((float)Random.Range(0, 366), 40f, 0f) : new Vector3(num2, 89.9f, 0f)); snapBackAnimationTimer = 1f; if (Imperium.Settings.Map.UnlockView.Value) { Imperium.Map.SetCameraClipped(isClipped: false); } } } private void InitRenderTexture() { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007c: 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_0091: Unknown result type (might be due to invalid IL or missing references) textureFrame = ((Component)container.Find("Texture")).GetComponent(); ImpInteractable impInteractable = ((Component)textureFrame).gameObject.AddComponent(); impInteractable.onDrag += delegate(Vector2 _, Vector2 _, Vector2 delta) { //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) OnDrag(Vector2.op_Implicit(delta)); }; RectTransform component = ((Component)textureFrame).GetComponent(); Vector3[] array = (Vector3[])(object)new Vector3[4]; component.GetWorldCorners(array); Vector2 val = RectTransformUtility.WorldToScreenPoint((Camera)null, array[0]); Vector2 val2 = RectTransformUtility.WorldToScreenPoint((Camera)null, array[2]); int width = Mathf.RoundToInt(val2.x - val.x); int height = Mathf.RoundToInt(val2.y - val.y); textureFrame.texture = (Texture)(object)Imperium.Map.GetRenderTexture(width, height); } protected override void OnOpen(bool wasOpen) { ((Behaviour)Imperium.Map.Camera).enabled = true; } protected override void OnClose() { if (Imperium.Settings.Map.RotationLock.Value && Object.op_Implicit((Object)(object)target)) { mouseOffsetX = 0f; } } private void Update() { //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_0030: 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_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_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_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_00d5: 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) if (Imperium.Settings.Map.CompassEnabled.Value) { Quaternion rotation = ((Component)Imperium.Map.Camera).transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; compass.transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, y)); compassNorth.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); compassEast.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); compassSouth.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); compassWest.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); } } private void LateUpdate() { //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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_00ae: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation; if (snapBackAnimationTimer > 0f && Object.op_Implicit((Object)(object)target)) { float num = mouseOffsetX; float num2; if (!Imperium.Settings.Map.RotationLock.Value) { num2 = cameraTargetRotation.x; } else { float x = cameraTargetRotation.x; rotation = target.rotation; num2 = x - ((Quaternion)(ref rotation)).eulerAngles.y; } mouseOffsetX = Mathf.Lerp(num, num2, 1f - snapBackAnimationTimer); mouseOffsetY = Mathf.Lerp(mouseOffsetY, cameraTargetRotation.y, 1f - snapBackAnimationTimer); cameraViewOrigin = Vector3.Lerp(cameraViewOrigin, target.position, 1f - snapBackAnimationTimer); snapBackAnimationTimer -= Time.deltaTime; } else if (Object.op_Implicit((Object)(object)target)) { cameraViewOrigin = target.position; if (Imperium.Settings.Map.RotationLock.Value && Imperium.Map.Minimap.IsOpen) { mouseOffsetX = 0f; } } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 0f, -30f); float num3; if (!Object.op_Implicit((Object)(object)target) || !Imperium.Settings.Map.RotationLock.Value) { num3 = mouseOffsetX; } else { float num4 = mouseOffsetX; rotation = target.rotation; num3 = num4 + ((Quaternion)(ref rotation)).eulerAngles.y; } float num5 = num3; Quaternion val2 = Quaternion.Euler(mouseOffsetY, num5, 0f); Imperium.Map.SetCameraPosition(cameraViewOrigin + val2 * val, cameraViewOrigin); } } internal class MinimapOverlay : BaseUI { private TMP_Text locationText; private TMP_Text positionText; private TMP_Text rotationText; private TMP_Text levelText; private TMP_Text extractionText; private GameObject infoPanel; private GameObject locationPanel; private Transform mapBorder; private Canvas canvas; private RawImage textureFrame; private GameObject compass; private Transform compassNorth; private Transform compassEast; private Transform compassSouth; private Transform compassWest; private const float BorderThickness = 2f; internal Rect CameraRect { get; private set; } protected override void InitUI() { mapBorder = container.Find("MapBorder"); locationPanel = ((Component)container.Find("MapBorder/LocationPanel")).gameObject; locationText = ((Component)locationPanel.transform.Find("Text")).GetComponent(); infoPanel = ((Component)container.Find("MapBorder/InfoPanel")).gameObject; positionText = ((Component)container.Find("MapBorder/InfoPanel/Position")).GetComponent(); rotationText = ((Component)container.Find("MapBorder/InfoPanel/Rotation")).GetComponent(); levelText = ((Component)container.Find("MapBorder/InfoPanel/Level")).GetComponent(); extractionText = ((Component)container.Find("MapBorder/InfoPanel/Extraction")).GetComponent(); canvas = ((Component)this).GetComponent(); textureFrame = ((Component)container.Find("Texture")).GetComponent(); float baseCanvasScale = canvas.scaleFactor; ((ImpBinding)(object)Imperium.Settings.Map.MinimapScale).OnUpdate += delegate(float value) { InitMapScale(baseCanvasScale * value); }; InitCompass(); } protected override void OnOpen(bool wasOpen) { textureFrame.texture = (Texture)(object)Imperium.Map.Camera.targetTexture; ((Behaviour)Imperium.Map.Camera).enabled = true; } private void InitMapScale(float scaleFactor) { canvas.scaleFactor = scaleFactor; } protected override void OnThemePrimaryUpdate(ImpTheme themeUpdate) { ImpThemeManager.Style(themeUpdate, container.Find("MapBorder"), new StyleOverride("", Variant.DARKER), new StyleOverride("Compass", Variant.FOREGROUND), new StyleOverride("Compass/Icon", Variant.FOREGROUND), new StyleOverride("InfoPanel", Variant.BACKGROUND), new StyleOverride("InfoPanel/Border", Variant.DARKER), new StyleOverride("LocationPanel", Variant.BACKGROUND), new StyleOverride("LocationPanel/Border", Variant.DARKER)); ImpThemeManager.StyleText(themeUpdate, container.Find("MapBorder"), new StyleOverride("Compass/North", Variant.FOREGROUND), new StyleOverride("Compass/East", Variant.FOREGROUND), new StyleOverride("Compass/South", Variant.FOREGROUND), new StyleOverride("Compass/West", Variant.FOREGROUND), new StyleOverride("LocationPanel/Text", Variant.FOREGROUND), new StyleOverride("InfoPanel/Position", Variant.FOREGROUND), new StyleOverride("InfoPanel/PositionTitle", Variant.FOREGROUND), new StyleOverride("InfoPanel/Rotation", Variant.FOREGROUND), new StyleOverride("InfoPanel/RotationTitle", Variant.FOREGROUND), new StyleOverride("InfoPanel/Location", Variant.FOREGROUND), new StyleOverride("InfoPanel/LocationTitle", Variant.FOREGROUND), new StyleOverride("InfoPanel/Level", Variant.FOREGROUND), new StyleOverride("InfoPanel/LevelTitle", Variant.FOREGROUND), new StyleOverride("InfoPanel/Extraction", Variant.FOREGROUND), new StyleOverride("InfoPanel/ExtractionTitle", Variant.FOREGROUND)); } private void InitCompass() { compass = ((Component)container.Find("MapBorder/Compass")).gameObject; compass.SetActive(Imperium.Settings.Map.CompassEnabled.Value); ((ImpBinding)(object)Imperium.Settings.Map.CompassEnabled).OnUpdate += compass.SetActive; compassNorth = compass.transform.Find("North"); compassEast = compass.transform.Find("East"); compassSouth = compass.transform.Find("West"); compassWest = compass.transform.Find("South"); } private void Update() { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_014f: Unknown result type (might be due to invalid IL or missing references) if (!Imperium.Settings.Map.MinimapEnabled.Value || Imperium.Interface.IsOpen() || !SemiFunc.NoTextInputsActive() || ((ImpBinding)(object)Imperium.Freecam.IsFreecamEnabled).Value || !((ImpBinding)(object)Imperium.IsImperiumEnabled).Value || Imperium.GameManager.IsGameLoading || !Imperium.IsGameLevel.Value) { if (base.IsOpen) { Close(); } } else if (!base.IsOpen) { Open(); } if (base.IsOpen) { infoPanel.SetActive(Imperium.Settings.Map.MinimapInfoPanel.Value); locationPanel.SetActive(Imperium.Settings.Map.MinimapLocationPanel.Value); locationText.SetText(LevelGenerator.Instance.Level.NarrativeName, true); Quaternion rotation; if (Imperium.Settings.Map.MinimapInfoPanel.Value) { Vector3 position = ((Component)PlayerAvatar.instance).transform.position; positionText.text = Formatting.FormatVector(position, 0, "/", "") ?? ""; rotation = ((Component)PlayerAvatar.instance.localCamera).transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; rotationText.text = Formatting.FormatVector(eulerAngles, 0, "/", "°") ?? ""; levelText.text = $"{RunManager.instance.levelsCompleted + 1}"; extractionText.text = $"{RoundDirector.instance.extractionPointsCompleted}/{RoundDirector.instance.extractionPoints}"; } if (Imperium.Settings.Map.CompassEnabled.Value) { rotation = ((Component)Imperium.Map.Camera).transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; compass.transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, y)); compassNorth.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); compassEast.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); compassSouth.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); compassWest.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f - y)); } } } } internal class MinimapSettings : BaseUI { protected override void InitUI() { ImpToggle.Bind("Content/Gizmos/ShowInfoPanel", ((Component)this).transform, (IBinding)(object)Imperium.Settings.Map.MinimapInfoPanel, "", (IBinding)(object)theme, true, null, null); ImpToggle.Bind("Content/Gizmos/ShowLocationPanel", ((Component)this).transform, (IBinding)(object)Imperium.Settings.Map.MinimapLocationPanel, "", (IBinding)(object)theme, true, null, null); } protected override void OnThemePrimaryUpdate(ImpTheme themeUpdate) { ImpThemeManager.Style(themeUpdate, ((Component)this).transform, new StyleOverride("Content/Width/Overlay", Variant.LIGHTER), new StyleOverride("Content/Height/Overlay", Variant.LIGHTER)); } } } namespace Imperium.Interface.LayerSelector { internal class LayerSelector : BaseUI { private int selectedLayer; private GameObject layerTemplate; private readonly LayerToggle[] layerToggles = new LayerToggle[31]; private ImpBinding isEnabledBinding = new ImpBinding(false, false, (Action)null, (Action)null, false); private ImpBinding layerMaskBinding = new ImpBinding(0, 0, (Action)null, (Action)null, false); private Transform fovSlider; private Transform movementSpeedSlider; private Transform controlBorder; private const float toggleHeight = 12f; internal ImpFreecam Freecam { get; set; } protected override void InitUI() { //IL_0050: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)this).transform.Find("Container/LayerList") ?? ((Component)this).transform.Find("Content/Viewport/LayerList"); layerTemplate = ((Component)val.Find("Template")).gameObject; layerTemplate.SetActive(false); RectTransform component = ((Component)val).GetComponent(); component.sizeDelta = new Vector2(component.sizeDelta.x, (float)layerToggles.Length * 12f); float num = 0f; for (int i = 0; i < layerToggles.Length; i++) { GameObject val2 = Object.Instantiate(layerTemplate, val); val2.SetActive(true); layerToggles[i] = val2.AddComponent(); layerToggles[i].Init(LayerMask.LayerToName(i), i); int currentIndex = i; ((Component)layerToggles[i]).gameObject.AddComponent().onEnter += delegate { layerToggles[selectedLayer].SetSelected(isSelected: false); selectedLayer = currentIndex; layerToggles[selectedLayer].SetSelected(isSelected: true); }; ((UnityEvent)((Component)layerToggles[i]).GetComponent