Decompiled source of GooeyArtifacts v1.1.0
plugins/GooeyArtifacts/GooeyArtifacts.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; 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.Logging; using EntityStates; using EntityStates.Missions.Moon; using GooeyArtifacts.Artifacts; using GooeyArtifacts.Artifacts.MonsterCopyPlayerInventories; using GooeyArtifacts.Artifacts.MovingInteractables; using GooeyArtifacts.Artifacts.PillarsEveryStage; using GooeyArtifacts.EntityStates; using GooeyArtifacts.EntityStates.MovingInteractables; using GooeyArtifacts.Items; using GooeyArtifacts.Patches; using GooeyArtifacts.Properties; using GooeyArtifacts.ThirdParty.Utils; using GooeyArtifacts.Utils; using GooeyArtifacts.Utils.Extensions; using HG; using HG.Reflection; using HarmonyLib; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Utils; using RoR2; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.Navigation; using RoR2.UI; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyInformationalVersion("1.0.0+bef395071f1dc4aabc854fa8e873955f1b844690")] [assembly: AssemblyProduct("GooeyArtifacts")] [assembly: AssemblyTitle("GooeyArtifacts")] [assembly: AssemblyCompany("GooeyArtifacts")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GooeyArtifacts { public class ContentPackProvider : IContentPackProvider { [CompilerGenerated] private sealed class <FinalizeAsync>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinalizeAsyncArgs args; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinalizeAsync>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; args.ReportProgress(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(); } } [CompilerGenerated] private sealed class <GenerateContentPackAsync>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ContentPackProvider <>4__this; public GetContentPackAsyncArgs args; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GenerateContentPackAsync>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ContentPackProvider contentPackProvider = <>4__this; if (num != 0) { return false; } <>1__state = -1; ContentPack.Copy(contentPackProvider._contentPack, args.output); args.ReportProgress(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(); } } [CompilerGenerated] private sealed class <LoadStaticContentAsync>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ContentPackProvider <>4__this; public LoadStaticContentAsyncArgs args; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadStaticContentAsync>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ContentPackProvider contentPackProvider = <>4__this; if (num != 0) { return false; } <>1__state = -1; contentPackProvider._contentPack.identifier = contentPackProvider.identifier; ItemDefs.AddItemDefsTo(contentPackProvider._contentPack.itemDefs); ArtifactDefs.AddArtifactDefsTo(contentPackProvider._contentPack.artifactDefs); contentPackProvider._contentPack.entityStateTypes.Add(EntityStateTypeAttribute.GetAllEntityStateTypes().ToArray()); args.ReportProgress(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 readonly ContentPack _contentPack = new ContentPack(); public string identifier => "Gorakh.GooeyArtifacts"; internal ContentPackProvider() { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown internal void Register() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)delegate(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); }; } [IteratorStateMachine(typeof(<LoadStaticContentAsync>d__5))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadStaticContentAsync>d__5(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<GenerateContentPackAsync>d__6))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GenerateContentPackAsync>d__6(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<FinalizeAsync>d__7))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinalizeAsync>d__7(0) { args = args }; } } internal static class LanguageFolderHandler { public static void Register(string searchFolder, string langFolderName = "lang") { string langFolderPath = Path.Combine(searchFolder, langFolderName); if (Directory.Exists(langFolderPath)) { Language.collectLanguageRootFolders += delegate(List<string> folders) { folders.Add(langFolderPath); }; } else { Log.Error("Lang folder not found: " + langFolderPath, "D:\\Git\\RoR2\\GooeyArtifacts\\GooeyArtifacts\\LanguageFolderHandler.cs", "Register", 21); } } } internal static class Log { private static readonly StringBuilder _sharedStringBuilder; private static readonly object _stringBuilderLock; private static readonly int _cachedCallerPathPrefixLength; private static ManualLogSource _logSource; static Log() { _sharedStringBuilder = new StringBuilder(256); _stringBuilderLock = new object(); _cachedCallerPathPrefixLength = getCallerPathPrefixLength("D:\\Git\\RoR2\\GooeyArtifacts\\GooeyArtifacts\\Log.cs"); static int getCallerPathPrefixLength([CallerFilePath] string callerPath = null) { int num = callerPath.LastIndexOf("GooeyArtifacts\\"); if (num >= 0) { return num + "GooeyArtifacts\\".Length; } Debug.LogError((object)"[GooeyArtifacts] Logger failed to determine caller path prefix length"); return 0; } } internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string buildCallerLogString(string callerPath, string callerMemberName, int callerLineNumber, object data) { lock (_stringBuilderLock) { return _sharedStringBuilder.Clear().Append(callerPath, _cachedCallerPathPrefixLength, callerPath.Length - _cachedCallerPathPrefixLength).Append(':') .Append(callerLineNumber) .Append(" (") .Append(callerMemberName) .Append("): ") .Append(data) .ToString(); } } [Conditional("DEBUG")] internal static void Debug(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogDebug((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Conditional("DEBUG")] internal static void Debug_NoCallerPrefix(object data) { _logSource.LogDebug(data); } internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogError((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Error_NoCallerPrefix(object data) { _logSource.LogError(data); } internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogFatal((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Fatal_NoCallerPrefix(object data) { _logSource.LogFatal(data); } internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogInfo((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Info_NoCallerPrefix(object data) { _logSource.LogInfo(data); } internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogMessage((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Message_NoCallerPrefix(object data) { _logSource.LogMessage(data); } internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogWarning((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Warning_NoCallerPrefix(object data) { _logSource.LogWarning(data); } internal static void LogType(LogLevel level, object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if ((level & 0x20) == 0) { _logSource.Log(level, (object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogType_NoCallerPrefix(LogLevel level, object data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if ((level & 0x20) == 0) { _logSource.Log(level, data); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Gorakh.GooeyArtifacts", "GooeyArtifacts", "1.1.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "Gorakh.GooeyArtifacts"; public const string PluginAuthor = "Gorakh"; public const string PluginName = "GooeyArtifacts"; public const string PluginVersion = "1.1.0"; private ContentPackProvider _contentPackProvider; internal static Main Instance { get; private set; } public static string PluginDirectory { get; private set; } private void Awake() { Instance = this; Stopwatch stopwatch = Stopwatch.StartNew(); Log.Init(((BaseUnityPlugin)this).Logger); _contentPackProvider = new ContentPackProvider(); _contentPackProvider.Register(); Prefabs.Init(); PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); LanguageFolderHandler.Register(PluginDirectory); stopwatch.Stop(); Log.Info_NoCallerPrefix($"Initialized in {stopwatch.Elapsed.TotalSeconds:F2} seconds"); } } public static class Prefabs { public static GameObject MonsterCopyPlayerInventoriesControllerPrefab { get; private set; } public static GameObject StagePillarChargeMissionControllerPrefab { get; private set; } public static GameObject SyncExternalNetObjectTransformPrefab { get; private set; } public static GameObject SyncExternalNetObjectPseudoParentPrefab { get; private set; } public static GameObject InteractableMoveControllerPrefab { get; private set; } private static GameObject createPrefab(string name, bool networked) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown GameObject val = new GameObject(); if (networked) { val.AddComponent<NetworkIdentity>(); } GameObject result = PrefabAPI.InstantiateClone(val, name, networked); Object.Destroy((Object)(object)val); return result; } internal static void Init() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) MonsterCopyPlayerInventoriesControllerPrefab = createPrefab("MonsterCopyPlayerInventoriesController", networked: true); MonsterCopyPlayerInventoriesControllerPrefab.AddComponent<SetDontDestroyOnLoad>(); MonsterCopyPlayerInventoriesControllerPrefab.AddComponent<Inventory>(); MonsterCopyPlayerInventoriesControllerPrefab.AddComponent<CopyPlayerInventories>(); MonsterCopyPlayerInventoriesControllerPrefab.AddComponent<TeamFilter>().teamIndex = (TeamIndex)(-1); MonsterCopyPlayerInventoriesControllerPrefab.AddComponent<EnemyInfoPanelInventoryProvider>(); StagePillarChargeMissionControllerPrefab = createPrefab("PillarChargeMissionController", networked: true); StagePillarChargeMissionControllerPrefab.AddComponent<StagePillarChargeMissionController>(); SyncExternalNetObjectTransformPrefab = createPrefab("SyncExternalNetObjectTransform", networked: true); NetworkTransform obj = SyncExternalNetObjectTransformPrefab.AddComponent<NetworkTransform>(); obj.transformSyncMode = (TransformSyncMode)1; obj.sendInterval = 0.25f; SyncExternalNetObjectTransformPrefab.AddComponent<SyncExternalNetworkedObjectTransform>(); SyncExternalNetObjectPseudoParentPrefab = createPrefab("SyncExternalNetObjectPseudoParentPrefab", networked: true); SyncExternalNetObjectPseudoParentPrefab.AddComponent<SyncExternalTransformPseudoParent>(); InteractableMoveControllerPrefab = createPrefab("InteractableMoveController", networked: true); EntityStateMachine val = InteractableMoveControllerPrefab.AddComponent<EntityStateMachine>(); val.initialStateType = new SerializableEntityStateType(typeof(MovingInteractableRestState)); val.mainStateType = new SerializableEntityStateType(typeof(MovingInteractableRestState)); InteractableMoveControllerPrefab.AddComponent<NetworkStateMachine>().stateMachines = (EntityStateMachine[])(object)new EntityStateMachine[1] { val }; InteractableMoveControllerPrefab.AddComponent<InteractableMoveController>(); } } } namespace GooeyArtifacts.Utils { public static class AssetLoadUtils { public static void LoadAssetTemporary<T>(string assetGuid, Action<T> onLoaded) where T : Object { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) StackTrace stackTrace = new StackTrace(); AssetReferenceT<T> assetReference = new AssetReferenceT<T>(assetGuid); AsyncOperationHandle<T> val = AssetAsyncReferenceManager<T>.LoadAsset(assetReference, (AsyncReferenceHandleUnloadType)0); val.Completed += delegate(AsyncOperationHandle<T> handle) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)handle.Status == 1) { onLoaded?.Invoke(handle.Result); } else { Log.Error_NoCallerPrefix($"Failed to load asset {assetGuid} ({typeof(T).FullName}) {stackTrace}"); } AssetAsyncReferenceManager<T>.UnloadAsset(assetReference); }; } } public class IconLoader { public static Sprite LoadSpriteFromBytes(byte[] imageBytes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //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) Texture2D val = new Texture2D(1, 1); if (ImageConversion.LoadImage(val, imageBytes)) { return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); } Log.Error("Failed to load image", "D:\\Git\\RoR2\\GooeyArtifacts\\GooeyArtifacts\\Utils\\IconLoader.cs", "LoadSpriteFromBytes", 16); return null; } } public static class NodeUtils { public static void SetNodeOccupied(NodeGraph nodeGraph, NodeIndex nodeIndex, bool occupied) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)nodeGraph)) { throw new ArgumentNullException("nodeGraph"); } DirectorCore instance = DirectorCore.instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } ref NodeReference[] occupiedNodes = ref instance.occupiedNodes; NodeReference value = default(NodeReference); ((NodeReference)(ref value))..ctor(nodeGraph, nodeIndex); int num = Array.IndexOf(occupiedNodes, value); if (num != -1 != occupied) { if (occupied) { instance.AddOccupiedNode(nodeGraph, nodeIndex); } else { ArrayUtils.ArrayRemoveAtAndResize<NodeReference>(ref occupiedNodes, num, 1); } } } } public class PathTraveller { public readonly struct TravelData { public readonly Vector3 CurrentPosition; public readonly Vector3 Direction; public readonly Vector3 InterpolatedNormal; public readonly float RemainingTotalDistance; public readonly bool IsAtEnd; public TravelData(Path path, PathNode start, PathNode end, float travelFraction, float remainingTotalDistance, bool isAtEnd) { //IL_0002: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) CurrentPosition = Vector3.Lerp(start.Position, end.Position, travelFraction); Vector3 val = end.Position - start.Position; Direction = ((Vector3)(ref val)).normalized; InterpolatedNormal = Quaternion.Slerp(Util.QuaternionSafeLookRotation(start.Normal), Util.QuaternionSafeLookRotation(end.Normal), travelFraction) * Vector3.forward; RemainingTotalDistance = remainingTotalDistance; IsAtEnd = isAtEnd; } } public readonly struct PathNode { public readonly Vector3 Position; public readonly Vector3 Normal; public readonly float MinJumpHeight; public PathNode(Path path, Waypoint waypoint, GameObject entity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Normal = default(Vector3); MinJumpHeight = waypoint.minJumpHeight; if (!path.nodeGraph.GetNodePosition(waypoint.nodeIndex, ref Position)) { Log.Error("Failed to find node position", "D:\\Git\\RoR2\\GooeyArtifacts\\GooeyArtifacts\\Utils\\PathTraveller.cs", ".ctor", 101); } else { Normal = WorldUtils.GetEnvironmentNormalAtPoint(Position, entity); } } } private readonly struct PathLinkData { public readonly PathNode Start; public readonly PathNode End; public readonly float TotalDistance; public readonly float RemainingTotalDistance; public PathLinkData(PathNode start, PathNode end, float remainingTotalDistance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Start = start; End = end; Vector3 val = End.Position - Start.Position; TotalDistance = ((Vector3)(ref val)).magnitude; RemainingTotalDistance = remainingTotalDistance + TotalDistance; } } public readonly Path Path; private int _lastWaypointIndex; private float _currentWaypointDistanceTravelled; private readonly PathLinkData[] _pathLinks = Array.Empty<PathLinkData>(); public PathTraveller(Path path, GameObject travellingEntity) { //IL_005c: 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) Path = path; if (Path.waypointsCount > 0) { _pathLinks = new PathLinkData[Path.waypointsCount - 1]; PathNode end = new PathNode(Path, Path[Path.waypointsCount - 1], travellingEntity); float num = 0f; for (int num2 = Path.waypointsCount - 2; num2 >= 0; num2--) { PathNode pathNode = new PathNode(Path, Path[num2], travellingEntity); PathLinkData pathLinkData = new PathLinkData(pathNode, end, num); _pathLinks[num2] = pathLinkData; num += pathLinkData.TotalDistance; end = pathNode; } } } public TravelData AdvancePosition(float moveDelta) { _currentWaypointDistanceTravelled += moveDelta; while (_lastWaypointIndex < Path.waypointsCount - 1) { PathLinkData pathLinkData = _pathLinks[_lastWaypointIndex]; if (_currentWaypointDistanceTravelled >= pathLinkData.TotalDistance) { _currentWaypointDistanceTravelled -= pathLinkData.TotalDistance; _lastWaypointIndex++; continue; } float travelFraction = Mathf.Clamp01(_currentWaypointDistanceTravelled / pathLinkData.TotalDistance); return new TravelData(Path, pathLinkData.Start, pathLinkData.End, travelFraction, pathLinkData.RemainingTotalDistance - _currentWaypointDistanceTravelled, isAtEnd: false); } PathLinkData pathLinkData2 = _pathLinks[^1]; return new TravelData(Path, pathLinkData2.Start, pathLinkData2.End, 1f, 0f, isAtEnd: true); } } public class SyncExternalNetworkedObjectTransform : NetworkBehaviour { [SyncVar] private GameObject _targetObject; private Vector3 _positionOffset = Vector3.zero; private Quaternion _rotationOffset = Quaternion.identity; public bool EnableClientTransformControl; private Transform transform; private NetworkTransform _netTransform; private Vector3 _targetPositionSmoothVelocity = Vector3.zero; private Vector4 _targetRotationSmoothVelocity = Vector4.zero; private NetworkInstanceId ____targetObjectNetId; public GameObject TargetObject { get { return _targetObject; } [Server] set { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void GooeyArtifacts.Utils.SyncExternalNetworkedObjectTransform::set_TargetObject(UnityEngine.GameObject)' called on client"); } else if (!((Object)(object)_targetObject == (Object)(object)value)) { if (Object.op_Implicit((Object)(object)_targetObject)) { Transform obj = _targetObject.transform; obj.position -= _positionOffset; obj.rotation *= Quaternion.Inverse(_rotationOffset); } Network_targetObject = value; if (Object.op_Implicit((Object)(object)_targetObject)) { Transform obj2 = _targetObject.transform; obj2.position += _positionOffset; obj2.rotation *= _rotationOffset; updateServerObjectTransform(); } } } } public Vector3 PositionOffset { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _positionOffset; } set { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_targetObject)) { Transform obj = _targetObject.transform; obj.position += value - _positionOffset; } _positionOffset = value; } } public Quaternion RotationOffset { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _rotationOffset; } set { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (Object.op_Implicit((Object)(object)_targetObject)) { Transform obj = _targetObject.transform; obj.rotation *= Quaternion.Inverse(_rotationOffset) * value; } _rotationOffset = value; } } public GameObject Network_targetObject { get { return _targetObject; } [param: In] set { ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref _targetObject, 1u, ref ____targetObjectNetId); } } private void Awake() { transform = ((Component)this).transform; _netTransform = ((Component)this).GetComponent<NetworkTransform>(); } private void OnDestroy() { if (NetworkServer.active) { TargetObject = null; } } public override void OnStartClient() { ((NetworkBehaviour)this).OnStartClient(); updateClientObjectTransform(); } private void Update() { if (NetworkServer.active) { updateServerObjectTransform(); } else { updateClientObjectTransform(smooth: true, Time.deltaTime); } } [Server] private void updateServerObjectTransform() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void GooeyArtifacts.Utils.SyncExternalNetworkedObjectTransform::updateServerObjectTransform()' called on client"); } else if (Object.op_Implicit((Object)(object)_targetObject)) { Transform val = _targetObject.transform; transform.SetPositionAndRotation(val.position - _positionOffset, val.rotation * Quaternion.Inverse(_rotationOffset)); } } private void updateClientObjectTransform() { updateClientObjectTransform(smooth: false, 0f); } private void updateClientObjectTransform(bool smooth, float deltaTime) { //IL_0007: 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) updateClientObjectTransform(transform.position, transform.rotation, smooth, deltaTime); } private void updateClientObjectTransform(Vector3 targetPosition, Quaternion targetRotation, bool smooth, float deltaTime) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_targetObject) && !EnableClientTransformControl) { Transform obj = _targetObject.transform; Vector3 val = obj.position - _positionOffset; Quaternion current = obj.rotation * Quaternion.Inverse(_rotationOffset); if (smooth) { float sendInterval = _netTransform.sendInterval; val = Vector3.SmoothDamp(val, targetPosition, ref _targetPositionSmoothVelocity, sendInterval, float.PositiveInfinity, deltaTime); current = QuaternionUtil.SmoothDamp(current, targetRotation, ref _targetRotationSmoothVelocity, sendInterval, float.PositiveInfinity, deltaTime); } else { val = targetPosition; current = targetRotation; _targetPositionSmoothVelocity = Vector3.zero; _targetRotationSmoothVelocity = Vector4.zero; } obj.SetPositionAndRotation(val + _positionOffset, current * _rotationOffset); } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(_targetObject); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_targetObject); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (initialState) { ____targetObjectNetId = reader.ReadNetworkId(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _targetObject = reader.ReadGameObject(); } } public override void PreStartClient() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkInstanceId)(ref ____targetObjectNetId)).IsEmpty()) { Network_targetObject = ClientScene.FindLocalObject(____targetObjectNetId); } } } public class SyncExternalTransformPseudoParent : NetworkBehaviour { [SyncVar] public GameObject TargetObject; [SyncVar] public GameObject Parent; private Transform transform; private NetworkInstanceId ___TargetObjectNetId; private NetworkInstanceId ___ParentNetId; public GameObject NetworkTargetObject { get { return TargetObject; } [param: In] set { ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref TargetObject, 1u, ref ___TargetObjectNetId); } } public GameObject NetworkParent { get { return Parent; } [param: In] set { ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref Parent, 2u, ref ___ParentNetId); } } private void Awake() { transform = ((Component)this).transform; } private void LateUpdate() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0058: 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) if (Object.op_Implicit((Object)(object)TargetObject) && Object.op_Implicit((Object)(object)Parent)) { Transform obj = TargetObject.transform; Transform obj2 = Parent.transform; Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); transform.GetLocalPositionAndRotation(ref val, ref val2); Vector3 val3 = obj2.TransformPoint(val); Quaternion val4 = obj2.rotation * val2; ((Component)obj).transform.SetPositionAndRotation(val3, val4); } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(TargetObject); writer.Write(Parent); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(TargetObject); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(Parent); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (initialState) { ___TargetObjectNetId = reader.ReadNetworkId(); ___ParentNetId = reader.ReadNetworkId(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { TargetObject = reader.ReadGameObject(); } if (((uint)num & 2u) != 0) { Parent = reader.ReadGameObject(); } } public override void PreStartClient() { //IL_0012: 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 (!((NetworkInstanceId)(ref ___TargetObjectNetId)).IsEmpty()) { NetworkTargetObject = ClientScene.FindLocalObject(___TargetObjectNetId); } if (!((NetworkInstanceId)(ref ___ParentNetId)).IsEmpty()) { NetworkParent = ClientScene.FindLocalObject(___ParentNetId); } } } public static class TransformUtils { public static bool IsPartOfEntity(Transform transform, GameObject entity) { if (!Object.op_Implicit((Object)(object)transform) || !Object.op_Implicit((Object)(object)entity)) { return false; } if (transform.IsChildOf(entity.transform)) { return true; } EntityLocator componentInParent = ((Component)transform).GetComponentInParent<EntityLocator>(); if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.entity) && ((Object)(object)componentInParent.entity == (Object)(object)entity || componentInParent.entity.transform.IsChildOf(entity.transform))) { return true; } return false; } } public static class WorldUtils { public static Vector3 GetEnvironmentNormalAtPoint(Vector3 position, float backtrackDistance = 1f) { //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_0007: Unknown result type (might be due to invalid IL or missing references) return GetEnvironmentNormalAtPoint(position, Vector3.up, backtrackDistance); } public static Vector3 GetEnvironmentNormalAtPoint(Vector3 position, Vector3 up, float backtrackDistance = 1f) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(position + up * backtrackDistance, -up), ref val, backtrackDistance * 1.5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { return ((RaycastHit)(ref val)).normal; } return Vector3.up; } public static Vector3 GetEnvironmentNormalAtPoint(Vector3 position, GameObject entity, float backtrackDistance = 1f) { //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_0008: Unknown result type (might be due to invalid IL or missing references) return GetEnvironmentNormalAtPoint(position, Vector3.up, entity, backtrackDistance); } public static Vector3 GetEnvironmentNormalAtPoint(Vector3 position, Vector3 up, GameObject entity, float backtrackDistance = 1f) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0032: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_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_008c: 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_00c0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)entity)) { return GetEnvironmentNormalAtPoint(position, up, backtrackDistance); } RaycastHit[] array = default(RaycastHit[]); int num = HGPhysics.RaycastAll(ref array, position + up * backtrackDistance, -up, backtrackDistance * 1.5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); Vector3 result; try { RaycastHit val = default(RaycastHit); float num2 = float.PositiveInfinity; for (int i = 0; i < num; i++) { RaycastHit val2 = array[i]; result = ((RaycastHit)(ref val2)).point - position; float sqrMagnitude = ((Vector3)(ref result)).sqrMagnitude; if (!(sqrMagnitude >= num2) && !TransformUtils.IsPartOfEntity(((RaycastHit)(ref val2)).transform, entity)) { val = val2; num2 = sqrMagnitude; } } result = (float.IsFinite(num2) ? ((RaycastHit)(ref val)).normal : Vector3.up); } finally { HGPhysics.ReturnResults(array); } return result; } } } namespace GooeyArtifacts.Utils.Extensions { public static class NetworkExtensions { public static void WriteItemPickupTimestamps(this NetworkWriter writer, FixedTimeStamp[] itemPickupTimeStamps) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) List<uint> list = new List<uint>(itemPickupTimeStamps.Length); for (uint num = 0u; num < itemPickupTimeStamps.Length; num++) { if (!((FixedTimeStamp)(ref itemPickupTimeStamps[num])).isInfinity) { list.Add(num); } } writer.WritePackedUInt32((uint)list.Count); foreach (uint item in list) { writer.WritePackedUInt32(item); } foreach (uint item2 in list) { NetworkExtensions.Write(writer, itemPickupTimeStamps[item2]); } } public static void ReadItemPickupTimestamps(this NetworkReader reader, FixedTimeStamp[] destItemPickupTimeStamps) { //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) uint num = reader.ReadPackedUInt32(); uint[] array = new uint[num]; for (int i = 0; i < num; i++) { array[i] = reader.ReadPackedUInt32(); } ArrayUtils.SetAll<FixedTimeStamp>(destItemPickupTimeStamps, ref FixedTimeStamp.positiveInfinity); uint[] array2 = array; foreach (uint num2 in array2) { destItemPickupTimeStamps[num2] = NetworkExtensions.ReadFixedTimeStamp(reader); } } } public static class PathExtensions { public static void RemoveDuplicateWaypoints(this Path path) { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) List<Waypoint> list = new List<Waypoint>(); path.WriteWaypointsToList(list); int num = 0; for (int num2 = list.Count - 1; num2 > 0; num2--) { Waypoint val = list[num2 - 1]; while (num2 < list.Count && ((Waypoint)(ref val)).Equals(list[num2])) { list.RemoveAt(num2); num++; } } if (num > 0) { path.Clear(); for (int num3 = list.Count - 1; num3 >= 0; num3--) { Waypoint val2 = list[num3]; path.PushWaypointToFront(val2.nodeIndex, val2.minJumpHeight); } } } public static float CalculateTotalDistance(this Path path) { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) float num = 0f; Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); for (int i = 0; i < path.waypointsCount - 1; i++) { if (!path.nodeGraph.GetNodePosition(path[i].nodeIndex, ref val)) { Log.Error($"Failed to get node position at index {i} in path", "D:\\Git\\RoR2\\GooeyArtifacts\\GooeyArtifacts\\Utils\\Extensions\\PathExtensions.cs", "CalculateTotalDistance", 52); } else if (!path.nodeGraph.GetNodePosition(path[i + 1].nodeIndex, ref val2)) { Log.Error($"Failed to get node position at index {i + 1} in path", "D:\\Git\\RoR2\\GooeyArtifacts\\GooeyArtifacts\\Utils\\Extensions\\PathExtensions.cs", "CalculateTotalDistance", 58); } else { num += Vector3.Distance(val, val2); } } return num; } } public static class TextureExtensions { } } namespace GooeyArtifacts.ThirdParty.Utils { public static class QuaternionUtil { public static Quaternion AngularVelocityToDerivative(Quaternion current, Vector3 angularVelocity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_004c: 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) Quaternion val = new Quaternion(angularVelocity.x, angularVelocity.y, angularVelocity.z, 0f) * current; return new Quaternion(0.5f * val.x, 0.5f * val.y, 0.5f * val.z, 0.5f * val.w); } public static Vector3 DerivativeToAngularVelocity(Quaternion current, Quaternion derivative) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) Quaternion val = derivative * Quaternion.Inverse(current); return new Vector3(2f * val.x, 2f * val.y, 2f * val.z); } public static Quaternion IntegrateRotation(Quaternion rotation, Vector3 angularVelocity, float deltaTime) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0030: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: 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_0008: Unknown result type (might be due to invalid IL or missing references) if (deltaTime < Mathf.Epsilon) { return rotation; } Quaternion val = AngularVelocityToDerivative(rotation, angularVelocity); Vector4 val2 = new Vector4(rotation.x + val.x * deltaTime, rotation.y + val.y * deltaTime, rotation.z + val.z * deltaTime, rotation.w + val.w * deltaTime); Vector4 normalized = ((Vector4)(ref val2)).normalized; return new Quaternion(normalized.x, normalized.y, normalized.z, normalized.w); } public static Quaternion SmoothDamp(Quaternion current, Quaternion target, ref Vector4 velocity, float smoothTime, float maxSpeed, float deltaTime) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00aa: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) if (deltaTime < Mathf.Epsilon) { return current; } float num = ((Quaternion.Dot(current, target) > 0f) ? 1f : (-1f)); target.x *= num; target.y *= num; target.z *= num; target.w *= num; Vector4 val = new Vector4(Mathf.SmoothDamp(current.x, target.x, ref velocity.x, smoothTime, maxSpeed, deltaTime), Mathf.SmoothDamp(current.y, target.y, ref velocity.y, smoothTime, maxSpeed, deltaTime), Mathf.SmoothDamp(current.z, target.z, ref velocity.z, smoothTime, maxSpeed, deltaTime), Mathf.SmoothDamp(current.w, target.w, ref velocity.w, smoothTime, maxSpeed, deltaTime)); Vector4 normalized = ((Vector4)(ref val)).normalized; Vector4 val2 = Vector4.Project(new Vector4(velocity.x, velocity.y, velocity.z, velocity.w), normalized); velocity.x -= val2.x; velocity.y -= val2.y; velocity.z -= val2.z; velocity.w -= val2.w; return new Quaternion(normalized.x, normalized.y, normalized.z, normalized.w); } } } namespace GooeyArtifacts.Properties { [DebuggerNonUserCode] [CompilerGenerated] [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { resourceMan = new ResourceManager("GooeyArtifacts.Properties.Resources", typeof(Resources).Assembly); } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] AllItemsBreakableIconDeselected => (byte[])ResourceManager.GetObject("AllItemsBreakableIconDeselected", resourceCulture); internal static byte[] AllItemsBreakableIconSelected => (byte[])ResourceManager.GetObject("AllItemsBreakableIconSelected", resourceCulture); internal static byte[] ExpiringItemsIconDeselected => (byte[])ResourceManager.GetObject("ExpiringItemsIconDeselected", resourceCulture); internal static byte[] ExpiringItemsIconSelected => (byte[])ResourceManager.GetObject("ExpiringItemsIconSelected", resourceCulture); internal static byte[] GenericBrokenItemPickupSprite => (byte[])ResourceManager.GetObject("GenericBrokenItemPickupSprite", resourceCulture); internal static byte[] ItemExpirationTimerIcon => (byte[])ResourceManager.GetObject("ItemExpirationTimerIcon", resourceCulture); internal static byte[] MonsterCopyPlayerItemsIconDeselected => (byte[])ResourceManager.GetObject("MonsterCopyPlayerItemsIconDeselected", resourceCulture); internal static byte[] MonsterCopyPlayerItemsIconSelected => (byte[])ResourceManager.GetObject("MonsterCopyPlayerItemsIconSelected", resourceCulture); internal static byte[] MovingInteractablesIconDeselected => (byte[])ResourceManager.GetObject("MovingInteractablesIconDeselected", resourceCulture); internal static byte[] MovingInteractablesIconSelected => (byte[])ResourceManager.GetObject("MovingInteractablesIconSelected", resourceCulture); internal static byte[] PillarsEveryStageIconDeselected => (byte[])ResourceManager.GetObject("PillarsEveryStageIconDeselected", resourceCulture); internal static byte[] PillarsEveryStageIconSelected => (byte[])ResourceManager.GetObject("PillarsEveryStageIconSelected", resourceCulture); internal static byte[] PlayerItemCurseIconDeselected => (byte[])ResourceManager.GetObject("PlayerItemCurseIconDeselected", resourceCulture); internal static byte[] PlayerItemCurseIconSelected => (byte[])ResourceManager.GetObject("PlayerItemCurseIconSelected", resourceCulture); internal Resources() { } } } namespace GooeyArtifacts.Patches { internal static class MonsterInventoryItemDisplayLayoutFixPatch { [CompilerGenerated] private static class <>O { public static hook_UpdateDisplay <0>__ItemInventoryDisplay_UpdateDisplay; } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__ItemInventoryDisplay_UpdateDisplay; if (obj == null) { hook_UpdateDisplay val = ItemInventoryDisplay_UpdateDisplay; <>O.<0>__ItemInventoryDisplay_UpdateDisplay = val; obj = (object)val; } ItemInventoryDisplay.UpdateDisplay += (hook_UpdateDisplay)obj; } private static void ItemInventoryDisplay_UpdateDisplay(orig_UpdateDisplay orig, ItemInventoryDisplay self) { orig.Invoke(self); LayoutRebuilder.MarkLayoutForRebuild(self.rectTransform); } } internal static class ObjectiveSourceModifierHook { public delegate void OverrideObjectiveSourceDelegate(ref ObjectiveSourceDescriptor descriptor, ref bool visible); [CompilerGenerated] private static class <>O { public static hook_GetObjectiveSources <0>__ObjectivePanelController_GetObjectiveSources; } public static event OverrideObjectiveSourceDelegate OverrideObjectiveSource; [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__ObjectivePanelController_GetObjectiveSources; if (obj == null) { hook_GetObjectiveSources val = ObjectivePanelController_GetObjectiveSources; <>O.<0>__ObjectivePanelController_GetObjectiveSources = val; obj = (object)val; } ObjectivePanelController.GetObjectiveSources += (hook_GetObjectiveSources)obj; } private static void ObjectivePanelController_GetObjectiveSources(orig_GetObjectiveSources orig, ObjectivePanelController self, CharacterMaster master, List<ObjectiveSourceDescriptor> output) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, master, output); if (ObjectiveSourceModifierHook.OverrideObjectiveSource == null) { return; } for (int num = output.Count - 1; num >= 0; num--) { ObjectiveSourceDescriptor descriptor = output[num]; bool visible = true; ObjectiveSourceModifierHook.OverrideObjectiveSource(ref descriptor, ref visible); if (visible) { output[num] = descriptor; } else { output.RemoveAt(num); } } } } internal static class PurchaseInteractionLockPositionSyncPatch { private delegate void orig_set_NetworklockGameObject(PurchaseInteraction self, GameObject value); private class ServerLockObjectTracker : MonoBehaviour { private SyncExternalTransformPseudoParent _pseudoParentController; public void SetLockObject(GameObject lockObject) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) bool num = Object.op_Implicit((Object)(object)_pseudoParentController) && (Object)(object)_pseudoParentController.TargetObject == (Object)(object)lockObject; bool flag = Object.op_Implicit((Object)(object)lockObject); if (num == flag) { return; } if (flag) { if (!Object.op_Implicit((Object)(object)_pseudoParentController)) { Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); lockObject.transform.GetPositionAndRotation(ref val, ref val2); Vector3 val3 = ((Component)this).transform.InverseTransformPoint(val); Quaternion val4 = Quaternion.Inverse(((Component)this).transform.rotation) * val2; GameObject val5 = Object.Instantiate<GameObject>(Prefabs.SyncExternalNetObjectPseudoParentPrefab, val3, val4); _pseudoParentController = val5.GetComponent<SyncExternalTransformPseudoParent>(); _pseudoParentController.NetworkParent = ((Component)this).gameObject; NetworkServer.Spawn(val5); } _pseudoParentController.NetworkTargetObject = lockObject; } else if (Object.op_Implicit((Object)(object)_pseudoParentController)) { NetworkServer.Destroy(((Component)_pseudoParentController).gameObject); } } } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) MethodInfo methodInfo = AccessTools.DeclaredPropertySetter(typeof(PurchaseInteraction), "NetworklockGameObject"); if ((object)methodInfo != null) { new Hook((MethodBase)methodInfo, (Delegate)new Action<orig_set_NetworklockGameObject, PurchaseInteraction, GameObject>(PurchaseInteraction_set_NetworklockGameObject)); } else { Log.Error("Unable to find lock object setter method", "D:\\Git\\RoR2\\GooeyArtifacts\\GooeyArtifacts\\Patches\\PurchaseInteractionLockPositionSyncPatch.cs", "Init", 24); } } private static void PurchaseInteraction_set_NetworklockGameObject(orig_set_NetworklockGameObject orig, PurchaseInteraction self, GameObject value) { orig(self, value); if (NetworkServer.active) { UnityObjectExtensions.EnsureComponent<ServerLockObjectTracker>(((Component)self).gameObject).SetLockObject(self.lockGameObject); } } } internal static class ShopTerminalPositionSyncPatch { [CompilerGenerated] private static class <>O { public static hook_Start <0>__ShopTerminalBehavior_Start; } [CompilerGenerated] private sealed class <waitForServerInitThenSyncTerminalTransform>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ShopTerminalBehavior terminalBehavior; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <waitForServerInitThenSyncTerminalTransform>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (Object.op_Implicit((Object)(object)terminalBehavior) && !Object.op_Implicit((Object)(object)terminalBehavior.serverMultiShopController)) { <>2__current = null; <>1__state = 1; return true; } if (!Object.op_Implicit((Object)(object)terminalBehavior) || !Object.op_Implicit((Object)(object)terminalBehavior.serverMultiShopController)) { return false; } Transform transform = ((Component)terminalBehavior.serverMultiShopController).transform; Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); ((Component)terminalBehavior).transform.GetPositionAndRotation(ref val, ref val2); Vector3 val3 = transform.InverseTransformPoint(val); Quaternion val4 = Quaternion.Inverse(transform.rotation) * val2; GameObject obj = Object.Instantiate<GameObject>(Prefabs.SyncExternalNetObjectPseudoParentPrefab, val3, val4); SyncExternalTransformPseudoParent component = obj.GetComponent<SyncExternalTransformPseudoParent>(); component.NetworkParent = ((Component)transform).gameObject; component.NetworkTargetObject = ((Component)terminalBehavior).gameObject; NetworkServer.Spawn(obj); 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(); } } [SystemInitializer(new Type[] { })] private static void Init() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__ShopTerminalBehavior_Start; if (obj == null) { hook_Start val = ShopTerminalBehavior_Start; <>O.<0>__ShopTerminalBehavior_Start = val; obj = (object)val; } ShopTerminalBehavior.Start += (hook_Start)obj; } private static void ShopTerminalBehavior_Start(orig_Start orig, ShopTerminalBehavior self) { orig.Invoke(self); if (NetworkServer.active) { ((MonoBehaviour)self).StartCoroutine(waitForServerInitThenSyncTerminalTransform(self)); } } [IteratorStateMachine(typeof(<waitForServerInitThenSyncTerminalTransform>d__2))] private static IEnumerator waitForServerInitThenSyncTerminalTransform(ShopTerminalBehavior terminalBehavior) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <waitForServerInitThenSyncTerminalTransform>d__2(0) { terminalBehavior = terminalBehavior }; } } } namespace GooeyArtifacts.Items { public static class ItemDefs { public static readonly ItemDef GenericBrokenItem; static ItemDefs() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) GenericBrokenItem = ScriptableObject.CreateInstance<ItemDef>(); ((Object)GenericBrokenItem).name = "GenericBrokenItem"; GenericBrokenItem.deprecatedTier = (ItemTier)5; GenericBrokenItem.canRemove = false; GenericBrokenItem.nameToken = "ITEM_GENERIC_BROKEN_NAME"; GenericBrokenItem.descriptionToken = "ITEM_GENERIC_BROKEN_DESC"; GenericBrokenItem.pickupToken = "ITEM_GENERIC_BROKEN_PICKUP"; GenericBrokenItem.isConsumed = true; GenericBrokenItem.pickupIconSprite = IconLoader.LoadSpriteFromBytes(Resources.GenericBrokenItemPickupSprite); } internal static void AddItemDefsTo(NamedAssetCollection<ItemDef> itemDefs) { itemDefs.Add((ItemDef[])(object)new ItemDef[1] { GenericBrokenItem }); } } } namespace GooeyArtifacts.EntityStates { [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] internal class EntityStateTypeAttribute : SearchableAttribute { public Type target => ((SearchableAttribute)this).target as Type; public static IEnumerable<Type> GetAllEntityStateTypes() { return from EntityStateTypeAttribute a in SearchableAttribute.GetInstances<EntityStateTypeAttribute>() select a.target; } } } namespace GooeyArtifacts.EntityStates.MovingInteractables { public class MovingInteractableBaseState : EntityState { protected SpawnCard spawnCard { get; private set; } public GameObject gameObject { get; private set; } public Transform transform { get; private set; } protected SyncExternalNetworkedObjectTransform transformSyncController { get; private set; } protected GraphType nodeGraphType { get; private set; } protected HullClassification hullSize { get; private set; } protected bool occupyPosition { get; private set; } public override void OnEnter() { //IL_006b: 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) ((EntityState)this).OnEnter(); InteractableMoveController component = ((EntityState)this).GetComponent<InteractableMoveController>(); spawnCard = component.SpawnCardServer; gameObject = component.InteractableObject; transformSyncController = component.TransformSyncController; if (Object.op_Implicit((Object)(object)gameObject)) { transform = gameObject.transform; } if (((EntityState)this).isAuthority) { if (Object.op_Implicit((Object)(object)spawnCard)) { nodeGraphType = spawnCard.nodeGraphType; hullSize = spawnCard.hullSize; occupyPosition = spawnCard.occupyPosition; } else { nodeGraphType = (GraphType)0; hullSize = (HullClassification)0; occupyPosition = true; } } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if ((!Object.op_Implicit((Object)(object)transform) || !Object.op_Implicit((Object)(object)gameObject)) && ((EntityState)this).isAuthority) { base.outer.SetNextStateToMain(); } } } [EntityStateType] public class MovingInteractableMoveToTargetState : MovingInteractableBaseState { private static readonly BoolConVar _cvDrawPathData = new BoolConVar("goo_draw_interactable_paths", (ConVarFlags)2, "0", ""); public Vector3 Destination; private Vector3 _startPosition; private Quaternion _startRotation = Quaternion.identity; private float _moveSpeed = 10f; private float _rotationSpeed = 135f; private float _stepHeight = 2f; private float _maxStepRotation = 35f; private Path _path; private PathTraveller _pathTraveller; private float _totalPathDistance; private float _estimatedTimeRemaining; private Vector3 _targetPosition; private Vector3 _directTargetPosition; private Quaternion _targetRotation = Quaternion.identity; private bool _targetAtEnd; private bool _hasCreatedPathVisualizers; private readonly List<MeshDrawer> _pathDrawers = new List<MeshDrawer>(); private MeshDrawer _currentPositionVisualizer; private MeshDrawer _currentTargetPositionVisualizer; private bool _areVisualizersActive; public override void OnEnter() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //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_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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) base.OnEnter(); _startPosition = base.transform.position; _startRotation = base.transform.rotation; if (((EntityState)this).isAuthority) { if (Object.op_Implicit((Object)(object)base.spawnCard)) { _moveSpeed = Mathf.Max(5f, Util.Remap((float)base.spawnCard.directorCreditCost, 0f, 50f, 10f, 7.5f)); } else { _moveSpeed = 10f; } Bounds val = default(Bounds); if (Util.GuessRenderBoundsMeshOnly(base.gameObject, ref val)) { Vector3 size = ((Bounds)(ref val)).size; float num = Mathf.Max(size.x, size.z); float y = size.y; float num2 = ((!(num > y)) ? Mathf.Sqrt(num / y) : (y / num)); _moveSpeed *= num2; _maxStepRotation *= num2; } _rotationSpeed = Mathf.Clamp(Util.Remap(_moveSpeed, 0f, 10f, 30f, 135f), 30f, 180f); if (tryInitializePath()) { _totalPathDistance = _pathTraveller.Path.CalculateTotalDistance(); } else { ((EntityState)this).outer.SetNextStateToMain(); } } } public override void OnSerialize(NetworkWriter writer) { ((EntityState)this).OnSerialize(writer); writer.Write(_moveSpeed); writer.Write(_totalPathDistance); writer.Write(_maxStepRotation); } public override void OnDeserialize(NetworkReader reader) { ((EntityState)this).OnDeserialize(reader); _moveSpeed = reader.ReadSingle(); _totalPathDistance = reader.ReadSingle(); _maxStepRotation = reader.ReadSingle(); } private bool tryInitializePath() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0083: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Invalid comparison between Unknown and I4 //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) SceneInfo instance = SceneInfo.instance; if (!Object.op_Implicit((Object)(object)instance)) { return false; } NodeGraph nodeGraph = instance.GetNodeGraph(base.nodeGraphType); if (!Object.op_Implicit((Object)(object)nodeGraph)) { return false; } PathRequest val = new PathRequest { startPos = PathRequestPosition.op_Implicit(base.transform.position), endPos = PathRequestPosition.op_Implicit(Destination), hullClassification = base.hullSize, maxJumpHeight = float.PositiveInfinity, maxSpeed = _moveSpeed, path = new Path(nodeGraph) }; PathTask val2 = nodeGraph.ComputePath(val); if (!val2.wasReachable || (int)val2.status != 2) { return false; } Path path = val2.path; path.RemoveDuplicateWaypoints(); if (path.waypointsCount < 1) { return false; } _path = path; _pathTraveller = new PathTraveller(_path, base.gameObject); if (base.occupyPosition) { float num = HullDef.Find(base.hullSize).radius * 5f; NodeIndex val3 = nodeGraph.FindClosestNode(base.transform.position, base.hullSize, num); if (val3 != NodeIndex.invalid) { NodeUtils.SetNodeOccupied(nodeGraph, val3, occupied: false); } NodeIndex val4 = nodeGraph.FindClosestNode(Destination, base.hullSize, num); if (val4 != NodeIndex.invalid) { NodeUtils.SetNodeOccupied(nodeGraph, val4, occupied: true); } } return true; } public override void FixedUpdate() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) base.FixedUpdate(); if (Object.op_Implicit((Object)(object)base.gameObject) && Object.op_Implicit((Object)(object)base.transform)) { if (((EntityState)this).isAuthority) { fixedUpdateAuthority(); } else { _estimatedTimeRemaining = Mathf.Max(0f, _totalPathDistance / _moveSpeed - ((EntityState)this).fixedAge); } float num = Mathf.Sqrt(Mathf.Min(1f, ((EntityState)this).fixedAge) * Mathf.Clamp01(Util.Remap(_estimatedTimeRemaining, 0f, 2.5f, 0f, 1f))); float num2 = MathF.PI * 4f * ((EntityState)this).fixedAge; if (Object.op_Implicit((Object)(object)base.transformSyncController)) { Quaternion val = base.transform.rotation * Quaternion.Inverse(base.transformSyncController.RotationOffset); base.transformSyncController.PositionOffset = val * new Vector3(0f, Mathf.Abs(Mathf.Sin(num2)) * _stepHeight * num, 0f); base.transformSyncController.RotationOffset = Quaternion.AngleAxis(Mathf.Sin(num2 + MathF.PI / 2f) * _maxStepRotation * num, Vector3.forward); } } } private void fixedUpdateAuthority() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_008a: 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_008e: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) if (_path == null || _pathTraveller == null) { ((EntityState)this).outer.SetNextStateToMain(); return; } setVisualizersActive(_cvDrawPathData.value); float moveDelta = _moveSpeed * Time.fixedDeltaTime; Vector3 val3; if (!_targetAtEnd) { PathTraveller.TravelData travelData = _pathTraveller.AdvancePosition(moveDelta); _directTargetPosition = travelData.CurrentPosition; Vector3 val = _directTargetPosition; Vector3 val2 = travelData.InterpolatedNormal; if (tryFindProperGroundPosition(val, -travelData.InterpolatedNormal, out var normal, out var properPosition)) { val = properPosition; val2 = normal; } val3 = travelData.Direction; if (((Vector3)(ref val3)).sqrMagnitude > Mathf.Epsilon) { _targetRotation = Util.QuaternionSafeLookRotation(travelData.Direction, val2); } _targetPosition = val; _targetAtEnd = travelData.IsAtEnd; _estimatedTimeRemaining = travelData.RemainingTotalDistance / _moveSpeed; } else { _estimatedTimeRemaining = 0f; } Vector3 val4 = base.transform.position; Quaternion val5 = base.transform.rotation; if (Object.op_Implicit((Object)(object)base.transformSyncController)) { val4 -= base.transformSyncController.PositionOffset; val5 *= Quaternion.Inverse(base.transformSyncController.RotationOffset); } float moveSpeed = _moveSpeed; float num = moveSpeed; val3 = _targetPosition - val4; moveSpeed = num + Mathf.Clamp(((Vector3)(ref val3)).sqrMagnitude / 25f, 1f, 5f); moveSpeed += Mathf.Max(0f, Util.Remap(_estimatedTimeRemaining, 0f, 1f, 5f, 0f)); val4 = Vector3.MoveTowards(val4, _targetPosition, moveSpeed * Time.fixedDeltaTime); val5 = Quaternion.RotateTowards(val5, _targetRotation, _rotationSpeed * Time.fixedDeltaTime); MeshDrawer currentTargetPositionVisualizer = _currentTargetPositionVisualizer; if (currentTargetPositionVisualizer != null) { currentTargetPositionVisualizer.transform.SetPositionAndRotation(_targetPosition, _targetRotation); } MeshDrawer currentPositionVisualizer = _currentPositionVisualizer; if (currentPositionVisualizer != null) { currentPositionVisualizer.transform.SetPositionAndRotation(val4, val5); } Vector3 val6 = val4; Quaternion val7 = val5; if (Object.op_Implicit((Object)(object)base.transformSyncController)) { val6 += base.transformSyncController.PositionOffset; val7 *= base.transformSyncController.RotationOffset; } base.transform.position = val6; base.transform.rotation = val7; if (_targetAtEnd) { val3 = val4 - _targetPosition; if (((Vector3)(ref val3)).sqrMagnitude <= 0.1f) { Vector3 eulerAngles = ((Quaternion)(ref _startRotation)).eulerAngles; eulerAngles.y = ((Quaternion)(ref _targetRotation)).eulerAngles.y + Random.Range(-15f, 15f); Quaternion targetRotation = Quaternion.Euler(eulerAngles); Vector3 directTargetPosition = _directTargetPosition; ((EntityState)this).outer.SetNextState((EntityState)(object)new MovingInteractableSettleState { TargetRotation = targetRotation, TargetPosition = directTargetPosition }); } } } public override void OnExit() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnExit(); if (Object.op_Implicit((Object)(object)base.transformSyncController)) { base.transformSyncController.PositionOffset = Vector3.zero; base.transformSyncController.RotationOffset = Quaternion.identity; } Path path = _path; if (path != null) { path.Dispose(); } _path = null; foreach (MeshDrawer pathDrawer in _pathDrawers) { try { pathDrawer.Dispose(); } catch (NullReferenceException) { if (Object.op_Implicit((Object)(object)pathDrawer.transform)) { EntityState.Destroy((Object)(object)((Component)pathDrawer.transform).gameObject); } } } _pathDrawers.Clear(); _currentPositionVisualizer = null; _currentTargetPositionVisualizer = null; } private bool tryFindProperGroundPosition(Vector3 position, Vector3 down, out Vector3 normal, out Vector3 properPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or mis