using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Numerics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using BepInEx; using BepInEx.Logging; using FishNet.Object; using HowToFish.ExpansionKit.Packs; using HowToFish.ExpansionKit.Runtime; using HowToFish.ExpansionKit.Runtime.Content; using HowToFish.ExpansionKit.Runtime.Networking; using HowToFish.ExpansionKit.Runtime.Persistence; using HowToFish.ExpansionKit.Runtime.Rendering; using HowToFish.ExpansionKit.Runtime.Shops; using HowToFish.ExpansionKit.Runtime.World; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using TidehaulNets.Core; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TidehaulNets")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.3.0")] [assembly: AssemblyInformationalVersion("0.2.3")] [assembly: AssemblyProduct("TidehaulNets")] [assembly: AssemblyTitle("TidehaulNets")] [assembly: AssemblyVersion("0.2.3.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TidehaulNets { internal sealed class NetAssets : IPackAssetFactory, IDisposable { internal const string BundleName = "tidehaul.models"; private readonly AssetBundle bundle; private readonly NativeSceneMaterials materials = new NativeSceneMaterials(); private readonly Dictionary prefabs = new Dictionary(StringComparer.Ordinal); internal string Root { get; } internal string Hash { get; } internal NetAssets() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Root = Path.GetDirectoryName(typeof(Plugin).Assembly.Location); string text = Path.Combine(Root, "tidehaul.models"); Hash = PackSource.FileHash(text).ToLowerInvariant(); bundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)bundle)) { throw new InvalidDataException("The original Tidehaul Nets bundle could not be loaded."); } string[] array = new string[6] { "tidehaul_kit", "tidehaul_winch", "tidehaul_net", "tidehaul_net_stowed", "tidehaul_buoy", "tidehaul_tray" }; foreach (string text2 in array) { GameObject val = bundle.LoadAsset(text2); if (!Object.op_Implicit((Object)(object)val) || val.GetComponentsInChildren(true).Length != 0 || val.GetComponentsInChildren(true).Length != 0) { throw new InvalidDataException("The original net art is missing or contains unsupported runtime components: " + text2); } materials.Apply(val); prefabs.Add(text2, val); } } public GameObject Instantiate(string packKey, ArtRecipe art) { if (packKey != "tidehaul_nets" || art.Bundle != "tidehaul.models" || art.Sha256 != Hash) { throw new InvalidDataException("The net art does not match its registered pack."); } return Create(art.Prefab); } internal GameObject Create(string key) { if (!prefabs.TryGetValue(key, out GameObject value)) { throw new KeyNotFoundException("Unknown net model: " + key); } GameObject obj = Object.Instantiate(value); obj.SetActive(false); return obj; } internal static Bounds BoundsOf(GameObject model) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0077: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] componentsInChildren = model.GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { throw new InvalidDataException("The original model has no measurable rendered geometry."); } Bounds? val = null; MeshFilter[] array = componentsInChildren; foreach (MeshFilter val2 in array) { if (!Object.op_Implicit((Object)(object)val2.sharedMesh)) { throw new InvalidDataException("An original mesh is missing."); } Bounds val3 = NativeSceneMeshes.TransformBounds(val2.sharedMesh.bounds, model.transform.worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix); if (!val.HasValue) { val = val3; continue; } Bounds value = val.Value; ((Bounds)(ref value)).Encapsulate(val3); val = value; } return val ?? throw new InvalidDataException("The original model has no mesh bounds."); } public void Dispose() { materials.Dispose(); if (Object.op_Implicit((Object)(object)bundle)) { bundle.Unload(false); } } } internal sealed class NetBoatView : IDisposable { private readonly NetRuntime runtime; private readonly GameObject winch; private readonly GameObject net; private readonly GameObject stowed; private readonly GameObject buoy; private readonly GameObject fastUpgrade; private readonly GameObject capacityUpgrade; private readonly Rigidbody body; private readonly LineRenderer rope; private readonly LineRenderer guideRope; private readonly LineRenderer buoyRope; private readonly Transform buoyAttachment; private readonly Material ropeMaterial; private readonly AudioSource haulingSound; private readonly Transform lineExit; private readonly Transform fairlead; private readonly Transform mastBlock; private readonly Transform mastFeed; private readonly Transform boomBlock; private readonly Transform slew; private readonly Vector3 slewLocal; private readonly float deliveryYaw; private readonly Vector3 baseLocal; private readonly Vector3 stowedLocal; private readonly Vector3 deliveryLocal; private readonly Vector3 outboardClearLocal; private readonly Vector3 dischargeLocal; private readonly Vector3 hoistLocal; private readonly Vector3[] catchLocals; private readonly Vector3 controlLocal; private readonly float railLocalX; private readonly float railTopLocal; private readonly Transform? crank; private readonly Transform? drum; private readonly List fish = new List(); private string tickets = ""; private bool wasDeployed; private float displayedDeployment; private bool disposed; internal BoatMount Mount { get; } internal PackControl Primary { get; } internal Vector3 ControlLocal => controlLocal; internal Vector3 NetPosition => net.transform.position; internal Quaternion NetRotation => net.transform.rotation; internal bool WaterSuitable { get { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) Vector3 val = Mount.PhysicsPoint(outboardClearLocal); Vector3 val2 = Mount.PhysicsPoint(new Vector3(baseLocal.x, railTopLocal, baseLocal.z)); if (Vector3.Dot(((Component)Mount.Physics).transform.up, Vector3.up) < 0.65f || val2.y < WaterManager.WaterHeight - 0.3f) { return false; } RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(new Vector3(val.x, WaterManager.WaterHeight + 8f, val.z), Vector3.down, ref val3, 20f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val3)).point.y < WaterManager.WaterHeight - 2.7f; } return true; } } internal Vector3 DischargePosition { get { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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) BoatMount mount = Mount; float x = dischargeLocal.x; float y = deliveryLocal.y; NetMotionBounds authoredNetBounds = NetMotionPlanner.AuthoredNetBounds; return mount.PhysicsPoint(new Vector3(x, y + ((NetMotionBounds)(ref authoredNetBounds)).Min.Y - 0.1f, dischargeLocal.z)); } } internal NetBoatView(NetRuntime runtime, BoatMount mount, NetAssets assets) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_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_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Expected O, but got Unknown //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Expected O, but got Unknown //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Expected O, but got Unknown //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_070c: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_07f2: Unknown result type (might be due to invalid IL or missing references) //IL_0879: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08bb: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_0917: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_0973: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Expected O, but got Unknown //IL_0a2c: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Expected O, but got Unknown //IL_0aa1: Unknown result type (might be due to invalid IL or missing references) //IL_0aa8: Expected O, but got Unknown //IL_0b75: Unknown result type (might be due to invalid IL or missing references) //IL_0ba0: Unknown result type (might be due to invalid IL or missing references) //IL_0bab: Unknown result type (might be due to invalid IL or missing references) NetBoatView netBoatView = this; this.runtime = runtime; Mount = mount; mount.Root.localRotation = Quaternion.Euler(0f, -90f, 0f); if (!mount.TryDeck(new Vector3(-0.85f, 0f, -2.2f), ref baseLocal)) { throw new InvalidOperationException("The native boat has no supported stern equipment mount. Hull=" + ((object)mount.Boat.Mesh.bounds/*cast due to .constrained prefix*/).ToString() + "; root=" + ((object)mount.Root.position/*cast due to .constrained prefix*/).ToString() + "; rotation=" + ((object)mount.Root.eulerAngles/*cast due to .constrained prefix*/).ToString() + "; physics=" + ((object)mount.Physics.position/*cast due to .constrained prefix*/).ToString() + "; colliders=" + BoatManager.ColToBoat.Count); } baseLocal += Vector3.up * 0.015f; winch = Place(assets.Create("tidehaul_winch"), mount.Root, baseLocal); winch.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); lineExit = Find(winch, "line_exit") ?? throw new InvalidOperationException("The davit line exit is missing."); fairlead = Find(winch, "fairlead") ?? throw new InvalidOperationException("The winch fairlead is missing."); mastBlock = Find(winch, "mast_block") ?? throw new InvalidOperationException("The davit mast block is missing."); mastFeed = Find(winch, "mast_feed") ?? throw new InvalidOperationException("The fixed mast feed is missing."); boomBlock = Find(winch, "boom_block") ?? throw new InvalidOperationException("The boom pulley inlet is missing."); Transform? obj = Find(winch, "upgrade_fast_collar"); fastUpgrade = ((obj != null) ? ((Component)obj).gameObject : null) ?? throw new InvalidOperationException("The geared-winch visual marker is missing."); Transform? obj2 = Find(winch, "upgrade_capacity_collar"); capacityUpgrade = ((obj2 != null) ? ((Component)obj2).gameObject : null) ?? throw new InvalidOperationException("The reinforced-net visual marker is missing."); Transform val = Find(winch, "control") ?? throw new InvalidOperationException("The winch control marker is missing."); controlLocal = mount.Root.InverseTransformPoint(val.position); crank = Pivot(winch, "anchor_crank", "crank"); drum = Pivot(winch, "anchor_reel", "drum"); slew = Pivot(winch, "anchor_slew", "slew"); slewLocal = mount.Root.InverseTransformPoint(slew.position); lineExit.SetParent(slew, true); mastBlock.SetParent(slew, true); boomBlock.SetParent(slew, true); (Find(winch, "boom_tip") ?? throw new InvalidOperationException("The boom tip is missing.")).SetParent(slew, true); stowed = assets.Create("tidehaul_net_stowed"); Quaternion val2 = Quaternion.Euler(0f, 90f, 0f); Bounds folded = NativeSceneMeshes.TransformBounds(NetAssets.BoundsOf(stowed), Matrix4x4.Rotate(val2)); stowedLocal = FindStowedDeck(mount, folded); Place(stowed, mount.Root, stowedLocal); stowed.transform.localRotation = val2; Shader val3 = Shader.Find("Universal Render Pipeline/Lit"); if (!Object.op_Implicit((Object)(object)val3)) { throw new InvalidOperationException("The native rope shader is unavailable."); } ropeMaterial = new Material(val3); ropeMaterial.SetColor("_BaseColor", new Color(0.62f, 0.49f, 0.27f)); ropeMaterial.SetFloat("_Smoothness", 0f); GameObject[] array = (from renderer in winch.GetComponentsInChildren(true) select ((Component)renderer).gameObject).ToArray(); Primary = PackControl.Create(mount.Root, "Operate net winch", ControlLocal, new Vector3(0.5f, 0.55f, 0.45f), array, (Func)((Player _) => runtime.Label()), (Action)delegate { runtime.UsePrimary(); }, (Func)null); AudioSource val4 = NativeAccess.Get((object)(FishingRod)GameInfo.GetSpawnable((byte)61), "_slowReelSource"); if (!Object.op_Implicit((Object)(object)val4) || !Object.op_Implicit((Object)(object)val4.clip)) { throw new InvalidOperationException("The native reel sound is unavailable."); } haulingSound = winch.AddComponent(); haulingSound.clip = val4.clip; haulingSound.outputAudioMixerGroup = val4.outputAudioMixerGroup; haulingSound.loop = true; haulingSound.playOnAwake = false; haulingSound.spatialBlend = 1f; haulingSound.minDistance = 1f; haulingSound.maxDistance = 12f; haulingSound.volume = 0.16f; haulingSound.pitch = 0.65f; net = new GameObject("Tidehaul environmental net"); net.SetActive(false); Object.DontDestroyOnLoad((Object)(object)net); GameObject model = Place(assets.Create("tidehaul_net"), net.transform, Vector3.zero); ((Object)model).name = "Net mesh"; Transform val5 = Find(model, "hoist") ?? throw new InvalidOperationException("The authored net has no hoist marker."); hoistLocal = net.transform.InverseTransformPoint(val5.position); catchLocals = Enumerable.Range(0, 5).Select(delegate(int index) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Transform val11 = Find(model, "catch_" + (char)(97 + index)) ?? throw new InvalidOperationException("The authored net is missing catch marker " + (index + 1) + "."); return netBoatView.net.transform.InverseTransformPoint(val11.position); }).ToArray(); Vector3 val6 = mount.Root.InverseTransformPoint(lineExit.position); outboardClearLocal = val6 - hoistLocal - Vector3.up * 0.3f; Vector3 val7 = FindSlewDelivery(mount, out deliveryYaw); deliveryLocal = new Vector3(val7.x, outboardClearLocal.y, val7.z); MeasureGunwale(mount, out railLocalX, out railTopLocal); CreateMotionPlan(WaterManager.WaterHeight); dischargeLocal = FindDeckPosition(mount, deliveryLocal, (IEnumerable)(object)new Vector3[3] { new Vector3(0.3f, 0f, 0.05f), new Vector3(0.12f, 0f, 0.22f), new Vector3(0.12f, 0f, -0.22f) }, "catch discharge", baseLocal.y + 0.2f); body = net.AddComponent(); body.mass = 4f; body.linearDamping = 2f; body.angularDamping = 6f; body.constraints = (RigidbodyConstraints)112; body.isKinematic = true; body.useGravity = false; body.collisionDetectionMode = (CollisionDetectionMode)3; AddRim(new Vector3(0f, 0f, -0.6f), new Vector3(1.4f, 0.055f, 0.055f)); AddRim(new Vector3(0f, 0f, 0.6f), new Vector3(1.4f, 0.055f, 0.055f)); AddRim(new Vector3(-0.7f, 0f, 0f), new Vector3(0.055f, 0.055f, 1.2f)); AddRim(new Vector3(0.7f, 0f, 0f), new Vector3(0.055f, 0.055f, 1.2f)); BoxCollider obj3 = net.AddComponent(); ((Collider)obj3).isTrigger = true; obj3.center = new Vector3(0f, -0.34f, 0f); obj3.size = new Vector3(1.3f, 0.72f, 1.1f); buoy = Place(assets.Create("tidehaul_buoy"), null, Vector3.zero); Object.DontDestroyOnLoad((Object)(object)buoy); buoyAttachment = Find(buoy, "line_bottom") ?? throw new InvalidOperationException("The original buoy has no lower tether eye."); GameObject val8 = new GameObject("Tidehaul rope"); val8.transform.SetParent(mount.Root, false); rope = val8.AddComponent(); ((Renderer)rope).sharedMaterial = ropeMaterial; rope.positionCount = 3; rope.startWidth = (rope.endWidth = 0.028f); rope.useWorldSpace = true; GameObject val9 = new GameObject("Tidehaul davit line"); val9.transform.SetParent(mount.Root, false); guideRope = val9.AddComponent(); ((Renderer)guideRope).sharedMaterial = ropeMaterial; guideRope.positionCount = 6; guideRope.startWidth = (guideRope.endWidth = 0.025f); guideRope.useWorldSpace = true; GameObject val10 = new GameObject("Tidehaul buoy tether"); val10.transform.SetParent(mount.Root, false); buoyRope = val10.AddComponent(); ((Renderer)buoyRope).sharedMaterial = ropeMaterial; buoyRope.positionCount = 3; buoyRope.startWidth = (buoyRope.endWidth = 0.016f); buoyRope.useWorldSpace = true; winch.SetActive(false); stowed.SetActive(false); buoy.SetActive(false); ((Renderer)rope).enabled = false; ((Renderer)guideRope).enabled = false; ((Renderer)buoyRope).enabled = false; ((Component)Primary).gameObject.SetActive(false); Plugin.Log.LogInfo((object)($"Net mount {baseLocal}; rail x={railLocalX:F2}, top={railTopLocal:F2}; " + $"folded={stowedLocal}; discharge={dischargeLocal}; native boat {((NetworkBehaviour)mount.Boat).ObjectId}.")); } internal Vector3 CatchPosition(int index) { //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (index < 0 || index >= 5) { throw new ArgumentOutOfRangeException("index"); } int num = index / 2; float num2 = ((index % 2 == 0) ? (-0.18f) : 0.18f); BoatMount mount = Mount; float num3 = dischargeLocal.x + num2; float y = deliveryLocal.y; NetMotionBounds authoredNetBounds = NetMotionPlanner.AuthoredNetBounds; return mount.PhysicsPoint(new Vector3(num3, y + ((NetMotionBounds)(ref authoredNetBounds)).Min.Y - 0.1f + (float)num * 0.035f, dischargeLocal.z + (float)(num - 1) * 0.24f)); } internal Vector3 PredictedLocalPosition(float deploymentAmount) { //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_001a: Unknown result type (might be due to invalid IL or missing references) NetMotionPose val = CreateMotionPlan(WaterManager.WaterHeight).Sample(deploymentAmount); return Vector(((NetMotionPose)(ref val)).Position); } internal void Render(NetCycleSnapshot state) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Invalid comparison between Unknown and I4 //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected I4, but got Unknown //IL_02da: 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) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Invalid comparison between Unknown and I4 //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_074f: Unknown result type (might be due to invalid IL or missing references) if (disposed) { return; } bool valueOrDefault = state.Installed == true; winch.SetActive(valueOrDefault); ((Component)Primary).gameObject.SetActive(valueOrDefault); ((Renderer)guideRope).enabled = valueOrDefault; fastUpgrade.SetActive(valueOrDefault && runtime.PurchasedTier >= 2); capacityUpgrade.SetActive(valueOrDefault && runtime.PurchasedTier >= 3); net.SetActive(valueOrDefault && state.Phase != (NetPhase?)0); stowed.SetActive(valueOrDefault && state.Phase == (NetPhase?)0); ((Renderer)rope).enabled = valueOrDefault && state.Phase != (NetPhase?)0; bool flag = valueOrDefault && state.Phase != (NetPhase?)0; buoy.SetActive(flag); ((Renderer)buoyRope).enabled = flag; if (!valueOrDefault) { wasDeployed = false; displayedDeployment = 0f; if (haulingSound.isPlaying) { haulingSound.Stop(); } return; } bool flag2 = (int)state.Phase.GetValueOrDefault() == 3 && state.HaulPaused != true; if (flag2 && !haulingSound.isPlaying) { haulingSound.Play(); } else if (!flag2 && haulingSound.isPlaying) { haulingSound.Stop(); } NetCycleConfigState obj = state.Config ?? throw new InvalidOperationException("The net snapshot has no tuning."); double num = obj.LoweringSeconds ?? throw new InvalidOperationException("The net snapshot has no lowering duration."); double num2 = obj.HaulingSeconds ?? throw new InvalidOperationException("The net snapshot has no hauling duration."); double num3 = state.Phase switch { (NetPhase)0L => state.LoweringElapsedSeconds.Value / num, (NetPhase)1L => 1.0, (NetPhase)2L => 1.0 - state.HaulElapsedSeconds.Value / num2, _ => 0.0, }; NetMotionPose val = CreateMotionPlan(WaterManager.WaterHeight).Sample(Mathf.Clamp01((float)num3)); Vector3 val2 = Mount.PhysicsPoint(Vector(((NetMotionPose)(ref val)).Position)); Quaternion physicsRotation = Mount.PhysicsRotation; if (Mount.IsServer) { if (!wasDeployed || !flag) { net.transform.SetPositionAndRotation(val2, physicsRotation); body.position = val2; body.rotation = physicsRotation; body.linearVelocity = Vector3.zero; } body.isKinematic = true; body.MoveRotation(physicsRotation); body.MovePosition(val2); } else { body.isKinematic = true; float num4 = ((!wasDeployed || !flag) ? 1f : (1f - Mathf.Exp((0f - Time.deltaTime) * 12f))); displayedDeployment = Mathf.Lerp(displayedDeployment, Mathf.Clamp01((float)num3), num4); NetMotionPose val3 = CreateMotionPlan(WaterManager.WaterHeight, renderedFrame: true).Sample(displayedDeployment); net.transform.SetPositionAndRotation(Mount.Root.TransformPoint(Vector(((NetMotionPose)(ref val3)).Position)), Mount.Root.rotation); } wasDeployed = flag; Collider[] componentsInChildren = net.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = Mount.IsServer && flag; } Vector3 val4 = net.transform.TransformPoint(hoistLocal); Vector3 val5 = winch.transform.InverseTransformPoint(val4) - slew.localPosition; float num5 = (flag ? Mathf.Atan2(0f - val5.z, val5.x) : ((NetMotionPose)(ref val)).SlewRadians); slew.localRotation = Quaternion.Euler(0f, num5 * 57.29578f, 0f); Vector3 position = lineExit.position; guideRope.SetPosition(0, drum.position); guideRope.SetPosition(1, fairlead.position); guideRope.SetPosition(2, mastFeed.position); guideRope.SetPosition(3, mastBlock.position); guideRope.SetPosition(4, boomBlock.position); guideRope.SetPosition(5, position); rope.SetPosition(0, position); rope.SetPosition(1, (position + val4) * 0.5f); rope.SetPosition(2, val4); buoy.transform.rotation = Quaternion.identity; Vector3 value = buoy.transform.InverseTransformPoint(buoyAttachment.position); NetBuoyPose val6 = NetBuoyTether.Resolve(Motion(val4), Motion(value), Motion(Mount.PhysicsRotation * new Vector3(-0.35f, 0f, 0.1f)), WaterManager.WaterHeight, Mathf.Sin(Time.time * 2f) * 0.035f); buoy.transform.position = Vector(((NetBuoyPose)(ref val6)).Center); Vector3 position2 = buoyAttachment.position; buoyRope.SetPosition(0, val4); buoyRope.SetPosition(1, (val4 + position2) * 0.5f + Vector3.down * 0.012f); buoyRope.SetPosition(2, position2); if (flag2) { if (Object.op_Implicit((Object)(object)crank)) { crank.Rotate(Vector3.forward, Time.deltaTime * 170f, (Space)1); } if (Object.op_Implicit((Object)(object)drum)) { drum.Rotate(Vector3.forward, Time.deltaTime * 170f, (Space)1); } } else if ((int)state.Phase.GetValueOrDefault() == 1 && Mount.HorizontalSpeed <= 0.75f && WaterSuitable && Object.op_Implicit((Object)(object)drum)) { drum.Rotate(Vector3.forward, Time.deltaTime * -170f, (Space)1); } UpdateFish(state); } private void UpdateFish(NetCycleSnapshot state) { //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_0222: 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) List list = state.Tickets ?? throw new InvalidOperationException("The net catch snapshot is missing."); NetCycleConfigState config = state.Config; int num = ((config != null) ? config.Capacity : ((int?)null)) ?? throw new InvalidOperationException("The net snapshot has no capacity."); if (num < 1 || num > catchLocals.Length || list.Count > num) { throw new InvalidOperationException("The net snapshot exceeds the authored five-catch layout."); } string text = string.Join(",", list.Select((NetCatchTicketState ticket) => ticket.ItemId)); if (text != tickets) { foreach (GameObject item in fish) { Object.Destroy((Object)(object)item); } fish.Clear(); tickets = text; foreach (NetCatchTicketState item2 in list) { Item spawnable = GameInfo.GetSpawnable(item2.ItemId.Value); Renderer val = (Renderer)(((object)((Component)spawnable).GetComponentsInChildren(true).FirstOrDefault()) ?? ((object)((Component)spawnable).GetComponentsInChildren(true).First())); GameObject val2 = new GameObject("Netted " + spawnable.GetName(), new Type[2] { typeof(MeshFilter), typeof(MeshRenderer) }); val2.transform.SetParent(net.transform, false); val2.GetComponent().sharedMesh = spawnable.Mesh; val2.GetComponent().sharedMaterials = val.sharedMaterials; float[] array = new float[3]; Bounds bounds = spawnable.Mesh.bounds; array[0] = ((Bounds)(ref bounds)).size.x; bounds = spawnable.Mesh.bounds; array[1] = ((Bounds)(ref bounds)).size.y; bounds = spawnable.Mesh.bounds; array[2] = ((Bounds)(ref bounds)).size.z; float num2 = Mathf.Max(array); val2.transform.localScale = Vector3.one * (0.4f / num2); fish.Add(val2); } } for (int num3 = 0; num3 < fish.Count; num3++) { fish[num3].transform.localPosition = catchLocals[num3] + Vector3.up * (Mathf.Sin(Time.time * 2f + (float)num3) * 0.025f); fish[num3].transform.localRotation = Quaternion.Euler(0f, (float)(45 + num3 * 80) + Mathf.Sin(Time.time * 3f + (float)num3) * 6f, 0f); } } private NetMotionPlanner CreateMotionPlan(float waterHeight, bool renderedFrame = false) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown Vector3 val = (renderedFrame ? Mount.Root.TransformPoint(outboardClearLocal) : Mount.PhysicsPoint(outboardClearLocal)); float num = Vector3.Dot(renderedFrame ? Mount.Root.up : (Mount.PhysicsRotation * Vector3.up), Vector3.up); if (Mathf.Abs(num) < 0.1f) { throw new InvalidOperationException("The native boat is too steep for the net hoist."); } Vector3 value = outboardClearLocal; value.y += (waterHeight - 0.62f - val.y) / num; return new NetMotionPlanner(Motion(slewLocal), deliveryYaw, Motion(outboardClearLocal), Motion(value), railLocalX, railTopLocal, -1, NetMotionPlanner.AuthoredNetBounds); } internal float PredictedSlewDegrees(float amount) { //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) NetMotionPose val = CreateMotionPlan(WaterManager.WaterHeight).Sample(amount); return ((NetMotionPose)(ref val)).SlewRadians * 57.29578f; } private Vector3 FindSlewDelivery(BoatMount mount, out float yaw) { //IL_0021: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) float[] array = new float[3] { 105f, 110f, 100f }; Vector3 val2 = default(Vector3); for (int i = 0; i < array.Length; i++) { float num = array[i] * (MathF.PI / 180f); Vector3 val = Vector(NetMotionPlanner.SwingPosition(Motion(slewLocal), Motion(outboardClearLocal), num)); if (mount.TryDeck(val, ref val2) && !(val2.y > baseLocal.y + 0.2f)) { yaw = num; return val2; } } throw new InvalidOperationException("The crane's fixed-radius swing has no supported inboard unloading position."); } private void MeasureGunwale(BoatMount mount, out float railX, out float railTop) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) railX = baseLocal.x - 0.4f; railTop = baseLocal.y; bool flag = false; float num = baseLocal.x + 0.7f; float x = outboardClearLocal.x; NetMotionBounds authoredNetBounds = NetMotionPlanner.AuthoredNetBounds; float num2 = x + ((NetMotionBounds)(ref authoredNetBounds)).Max.X; Vector3 val = default(Vector3); for (int i = 0; i <= 24; i++) { float num3 = Mathf.Lerp(num, num2, (float)i / 24f); for (int j = -2; j <= 2; j++) { if (mount.TryDeck(new Vector3(num3, 0f, baseLocal.z + (float)j * 0.28f), ref val) && !(val.y < baseLocal.y - 0.08f)) { flag = true; railX = Mathf.Min(railX, val.x); railTop = Mathf.Max(railTop, val.y); } } } if (!flag) { throw new InvalidOperationException("The native gunwale could not be measured beside the net hoist."); } } private static Vector3 FindDeckPosition(BoatMount mount, Vector3 origin, IEnumerable offsets, string purpose, float maximumHeight = float.PositiveInfinity) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); foreach (Vector3 offset in offsets) { if (mount.TryDeck(origin + offset, ref val) && val.y <= maximumHeight) { return val; } } throw new InvalidOperationException("The native boat has no supported " + purpose + " position beside the winch."); } private Vector3 FindStowedDeck(BoatMount mount, Bounds folded) { //IL_0013: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0063: 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_0075: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00d8: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_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_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) Bounds val = NativeSceneMeshes.TransformBounds(NetAssets.BoundsOf(winch), Matrix4x4.TRS(winch.transform.localPosition, winch.transform.localRotation, winch.transform.localScale)); Vector3 val2 = mount.CollisionPoint(Vector3.zero); Quaternion collisionRotation = Quaternion.LookRotation(mount.CollisionPoint(Vector3.forward) - val2, mount.CollisionPoint(Vector3.up) - val2); Boat value; Collider[] source = (from collider in ((Component)NativeAccess.Get((object)mount.Boat, "_dynamicObjectColsHolder")).GetComponentsInChildren() where collider.enabled && !collider.isTrigger && BoatManager.ColToBoat.TryGetValue(collider, out value) && (Object)(object)value == (Object)(object)mount.Boat select collider).ToArray(); GameObject val3 = new GameObject("Tidehaul folded placement probe"); val3.transform.position = new Vector3(0f, -1000f, 0f); val3.layer = LayerMask.NameToLayer("Ignore Raycast"); BoxCollider probe = val3.AddComponent(); ((Collider)probe).isTrigger = true; probe.size = ((Bounds)(ref folded)).size + Vector3.one * 0.02f; try { Vector3[] array = (Vector3[])(object)new Vector3[4] { new Vector3(0.7f, 0f, -0.8f), new Vector3(0.95f, 0f, -0.75f), new Vector3(0.55f, 0f, -0.65f), new Vector3(1.15f, 0f, -0.65f) }; Vector3 val5 = default(Vector3); Vector3 val6 = default(Vector3); Vector3 val7 = default(Vector3); Vector3 val8 = default(Vector3); float num7 = default(float); foreach (Vector3 val4 in array) { if (!mount.TryDeck(baseLocal + val4, ref val5) || val5.y > baseLocal.y + 0.15f) { continue; } bool flag = true; float num2 = val5.y; float[] array2 = new float[2] { ((Bounds)(ref folded)).min.x - 0.025f, ((Bounds)(ref folded)).max.x + 0.025f }; foreach (float num4 in array2) { float[] array3 = new float[3] { ((Bounds)(ref folded)).min.z - 0.025f, 0f, ((Bounds)(ref folded)).max.z + 0.025f }; foreach (float num6 in array3) { if (!mount.TryDeck(val5 + new Vector3(num4, 0f, num6), ref val6) || Math.Abs(val6.y - val5.y) > 0.05f) { flag = false; } else { num2 = Mathf.Max(num2, val6.y); } } } if (flag) { ((Vector3)(ref val7))..ctor(val5.x, num2 + 0.035f - ((Bounds)(ref folded)).min.y, val5.z); Bounds envelope = new Bounds(val7 + ((Bounds)(ref folded)).center, probe.size); if (!((Bounds)(ref val)).Intersects(envelope) && !source.Any((Collider collider) => Physics.ComputePenetration((Collider)(object)probe, mount.CollisionPoint(((Bounds)(ref envelope)).center), collisionRotation, collider, ((Component)collider).transform.position, ((Component)collider).transform.rotation, ref val8, ref num7) && num7 > 0.001f)) { return val7; } } } } finally { Object.Destroy((Object)(object)val3); } throw new InvalidOperationException("The whole folded net has no clear, level deck footprint inside the gunwales."); } private static Vector3 Motion(Vector3 value) { //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) return new Vector3(value.x, value.y, value.z); } private static Vector3 Vector(Vector3 value) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(value.X, value.Y, value.Z); } private void AddRim(Vector3 center, Vector3 size) { //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) BoxCollider obj = net.AddComponent(); obj.center = center; obj.size = size; } private static GameObject Place(GameObject model, Transform? parent, Vector3 local) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) model.transform.SetParent(parent, false); model.transform.localPosition = local; model.SetActive(true); return model; } private static Transform? Find(GameObject root, string name) { return ((IEnumerable)root.GetComponentsInChildren(true)).FirstOrDefault((Func)((Transform value) => ((Object)value).name == name || ((Object)value).name == "marker_" + name)); } private static Transform Pivot(GameObject root, string anchorName, string markerName) { //IL_0049: 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) Transform obj = root.transform.Find(anchorName); Transform val = root.transform.Find("marker_" + markerName); if (!Object.op_Implicit((Object)(object)obj) || !Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The authored winch is missing an animated anchor or pivot."); } Transform transform = new GameObject("Animated " + markerName).transform; transform.SetParent(root.transform, false); transform.position = val.position; obj.SetParent(transform, true); return transform; } public void Dispose() { if (!disposed) { disposed = true; if (Object.op_Implicit((Object)(object)net)) { Object.Destroy((Object)(object)net); } if (Object.op_Implicit((Object)(object)buoy)) { Object.Destroy((Object)(object)buoy); } if (Object.op_Implicit((Object)(object)ropeMaterial)) { Object.Destroy((Object)(object)ropeMaterial); } runtime.Detached(this); } } } internal sealed class NetPurchaseStations : IDisposable { internal sealed class Station { internal string Key = ""; internal int MaximumTier; internal MountedIsland Island; internal GameObject Root; internal PackPurchaseControl Control; } private readonly NetRuntime runtime; private readonly NetAssets assets; private readonly PackWorldRuntime world; private readonly Dictionary stations = new Dictionary(StringComparer.Ordinal); private readonly Dictionary pending = new Dictionary(StringComparer.Ordinal); internal IReadOnlyList Controls => stations.Values.Select((Station station) => station.Control).ToArray(); internal NetPurchaseStations(NetRuntime runtime, NetAssets assets, PackWorldRuntime world) { this.runtime = runtime; this.assets = assets; this.world = world; world.SceneMounted += Mounted; world.SceneUnmounting += Unmounting; foreach (MountedIsland item in world.Mounted) { Mounted(item); } } private void Mounted(MountedIsland island) { bool flag; switch (island.Reference) { case "native:3": case "native:4": case "native:5": case "gamblers_reach:harbor": flag = true; break; default: flag = false; break; } if (flag) { pending.Add(island.Reference, island); } } internal void Tick() { //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_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) MountedIsland[] array = pending.Values.ToArray(); foreach (MountedIsland val in array) { if (!Object.op_Implicit((Object)(object)val.Root)) { continue; } Scene scene = val.Scene; if (!((Scene)(ref scene)).isLoaded) { continue; } scene = val.Scene; ItemPurchasable[] array2 = (from control in ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true)).Where(delegate(ItemPurchasable control) { bool flag = ((Component)control).gameObject.activeInHierarchy; if (flag) { Item val2 = NativeAccess.Get((object)control, "_itemToPurchase"); bool flag2 = ((val2 is FishingRod || val2 is Weapon) ? true : false); flag = flag2; } return flag; }) orderby (!(NativeAccess.Get((object)control, "_itemToPurchase") is FishingRod)) ? 1 : 0 select control).ToArray(); if (array2.Length == 0) { if (runtime.Ready && !IslandManager.IsLoading) { throw new InvalidOperationException("The net equipment shop has no fishing or weapon stock: " + val.Reference); } } else { Create(val, array2); pending.Remove(val.Reference); } } } private void Create(MountedIsland island, ItemPurchasable[] stock) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0134: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) Physics.SyncTransforms(); Scene scene = island.Scene; Purchasable[] neighbors = ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject root) => root.GetComponentsInChildren(true)).ToArray(); Vector3 wall; Vector3 normal; bool num = FindShopWall(stock, neighbors, out wall, out normal); Vector3 position = wall + normal * 0.305f; Vector3[] feet = Array.Empty(); if (!num && !FindShopCounter(stock, neighbors, out position, out normal, out feet)) { throw new InvalidOperationException("The net display has no clear wall or supported counter position alongside " + island.Reference + "'s shops."); } Station station = new Station { Key = island.Reference.Replace(':', '_'), Island = island, MaximumTier = ((island.Reference == "gamblers_reach:harbor") ? 2 : (island.NativeEngineId - 1)), Root = new GameObject("Tidehaul boat equipment service") }; station.Root.SetActive(false); station.Root.transform.SetParent(island.Additions, false); station.Root.transform.SetPositionAndRotation(position, Quaternion.LookRotation(normal)); GameObject obj = assets.Create("tidehaul_kit"); ((Object)obj).name = "Tidehaul display kit"; obj.transform.SetParent(station.Root.transform, false); obj.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); obj.SetActive(true); Renderer[] componentsInChildren = obj.GetComponentsInChildren(); Material sharedMaterial = componentsInChildren.First((Renderer renderer) => ((Object)renderer).name == "crate slats").sharedMaterial; ShelfPart(station.Root.transform, "Net display shelf", new Vector3(0f, -0.04f, 0f), new Vector3(0.84f, 0.08f, 0.58f), sharedMaterial); if (num) { float[] array = new float[2] { -0.28f, 0.28f }; foreach (float num3 in array) { ShelfPart(station.Root.transform, "Net shelf bracket", new Vector3(num3, -0.18f, -0.26f), new Vector3(0.06f, 0.28f, 0.12f), sharedMaterial); } GameObject val = new GameObject("Net display wall contact"); val.transform.SetParent(station.Root.transform, false); val.transform.position = wall; } else { Vector3[] array2 = feet; foreach (Vector3 val2 in array2) { Vector3 val3 = station.Root.transform.InverseTransformPoint(val2); float num4 = 0f - val3.y - 0.08f; ShelfPart(station.Root.transform, "Net display counter leg", new Vector3(val3.x, -0.08f - num4 * 0.5f, val3.z), new Vector3(0.075f, num4, 0.075f), sharedMaterial); GameObject val4 = new GameObject("Net display ground contact"); val4.transform.SetParent(station.Root.transform, false); val4.transform.position = val2; } } station.Control = PackPurchaseControl.Create(station.Root.transform, "Buy or upgrade boat net", new Vector3(0f, 0.22f, 0.02f), new Vector3(0.75f, 0.6f, 0.55f), componentsInChildren.Select((Renderer renderer) => ((Component)renderer).gameObject).ToArray(), (Func)((Player player) => Offer(station, player)), (Action)delegate(Player _, string quote) { runtime.SendPurchase(quote); }); stations.Add(station.Key, station); station.Root.SetActive(true); } private static bool FindShopCounter(ItemPurchasable[] stock, Purchasable[] neighbors, out Vector3 position, out Vector3 normal, out Vector3[] feet) { //IL_0018: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0324: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) RaycastHit val4 = default(RaycastHit); foreach (ItemPurchasable val in stock) { Quaternion val2 = Quaternion.Euler(0f, ((Component)val).transform.eulerAngles.y, 0f); Vector3[] array = (Vector3[])(object)new Vector3[6] { Vector3.right * 1.2f, Vector3.left * 1.2f, Vector3.forward * 1.4f, Vector3.back * 1.4f, Vector3.right * 2f, Vector3.left * 2f }; foreach (Vector3 val3 in array) { Vector3 center = ((Component)val).transform.position + val2 * val3; List list = new List(); float[] array2 = new float[2] { -0.3f, 0.3f }; foreach (float num in array2) { float[] array3 = new float[2] { -0.2f, 0.2f }; foreach (float num2 in array3) { if (Physics.Raycast(center + val2 * new Vector3(num, 0.2f, num2), Vector3.down, ref val4, 4f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val4)).normal.y > 0.8f && ((RaycastHit)(ref val4)).point.y > WaterManager.WaterHeight + 0.1f) { list.Add(((RaycastHit)(ref val4)).point); } } } if (list.Count == 4 && !(list.Max((Vector3 point) => point.y) - list.Min((Vector3 point) => point.y) > 0.3f)) { center.y = list.Max((Vector3 point) => point.y) + 0.95f; if (!neighbors.Any(delegate(Purchasable control) { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)control) && ((Component)control).gameObject.activeInHierarchy) { Vector3 val5 = Vector3.ProjectOnPlane(((Component)control).transform.position - center, Vector3.up); return ((Vector3)(ref val5)).magnitude < 0.85f; } return false; }) && !Physics.CheckBox(center + Vector3.up * 0.2f, new Vector3(0.42f, 0.24f, 0.29f), val2, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { position = center; normal = val2 * Vector3.forward; feet = list.ToArray(); return true; } } } } position = default(Vector3); normal = default(Vector3); feet = Array.Empty(); return false; } private static bool FindShopWall(ItemPurchasable[] stock, Purchasable[] neighbors, out Vector3 wall, out Vector3 normal) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: 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_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) RaycastHit val3 = default(RaycastHit); RaycastHit val6 = default(RaycastHit); RaycastHit val7 = default(RaycastHit); RaycastHit val8 = default(RaycastHit); foreach (ItemPurchasable val in stock) { Vector3[] array = (Vector3[])(object)new Vector3[8] { -((Component)val).transform.forward, ((Component)val).transform.right, -((Component)val).transform.right, ((Component)val).transform.forward, Vector3.left, Vector3.right, Vector3.forward, Vector3.back }; for (int j = 0; j < array.Length; j++) { Vector3 val2 = Vector3.ProjectOnPlane(array[j], Vector3.up); Vector3 normalized = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude < 0.9f || !Physics.Raycast(((Component)val).transform.position + Vector3.up * 0.7f, normalized, ref val3, 3.5f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1) || Math.Abs(((RaycastHit)(ref val3)).normal.y) > 0.15f) { continue; } val2 = Vector3.ProjectOnPlane(((RaycastHit)(ref val3)).normal, Vector3.up); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; Vector3 val4 = Vector3.Cross(Vector3.up, normalized2); float[] array2 = new float[5] { -1f, 1f, -1.8f, 1.8f, 0f }; foreach (float num in array2) { Vector3 val5 = ((RaycastHit)(ref val3)).point + val4 * num; if (!Physics.Raycast(val5 + normalized2 * 0.9f + Vector3.up * 0.1f, Vector3.down, ref val6, 5f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1) || ((RaycastHit)(ref val6)).normal.y < 0.8f) { continue; } val5.y = ((RaycastHit)(ref val6)).point.y + 1.15f; if (!Physics.Raycast(val5 + normalized2 * 0.65f, -normalized2, ref val7, 1.2f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1) || Vector3.Dot(((RaycastHit)(ref val7)).normal, normalized2) < 0.95f) { continue; } bool flag = true; float[] array3 = new float[2] { -0.38f, 0.38f }; foreach (float num2 in array3) { float[] array4 = new float[2] { -0.1f, 0.45f }; foreach (float num3 in array4) { if (!Physics.Raycast(((RaycastHit)(ref val7)).point + val4 * num2 + Vector3.up * num3 + normalized2 * 0.12f, -normalized2, ref val8, 0.18f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1) || Vector3.Dot(((RaycastHit)(ref val8)).normal, normalized2) < 0.95f) { flag = false; } } } Vector3 center = ((RaycastHit)(ref val7)).point + normalized2 * 0.305f + Vector3.up * 0.23f; if (flag && !neighbors.Any((Purchasable control) => Object.op_Implicit((Object)(object)control) && ((Component)control).gameObject.activeInHierarchy && Vector3.Distance(((Component)control).transform.position, center) < 0.85f) && !Physics.CheckBox(center, new Vector3(0.4f, 0.28f, 0.275f), Quaternion.LookRotation(normalized2), LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { wall = ((RaycastHit)(ref val7)).point; normal = normalized2; return true; } } } } wall = default(Vector3); normal = default(Vector3); return false; } private static void ShelfPart(Transform parent, string name, Vector3 center, Vector3 size, Material material) { //IL_0020: 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) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = name; obj.transform.SetParent(parent, false); obj.transform.localPosition = center; obj.transform.localScale = size; obj.layer = LayerMask.NameToLayer("Level"); obj.tag = "Level"; obj.GetComponent().sharedMaterial = material; } private PackPurchaseOffer Offer(Station station, Player player) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown int purchasedTier = runtime.PurchasedTier; int num = Math.Min(3, purchasedTier + 1); NetEquipmentTier val = NetEquipment.Tier(num); bool flag = purchasedTier == 0 && Object.op_Implicit((Object)(object)player.Holding.HeldItem) && player.Holding.HeldItem.ID == 195; string text = ((purchasedTier == 3) ? "All net upgrades purchased." : (NetEquipment.PurchaseBlock(purchasedTier, num, station.MaximumTier, Object.op_Implicit((Object)(object)BoatManager.Boat) && BoatManager.Boat.BoatUnlocked, runtime.Snapshot.Phase.Value, flag ? val.Cost : Math.Max(0, MoneyManager.Money)) ?? "")); string text2 = val.Capacity + " live fish / " + val.HaulingSeconds.ToString("0", CultureInfo.InvariantCulture) + "s haul\n" + ((purchasedTier == 0) ? "Mounts directly on the crew's boat." : "Permanent crew upgrade."); if (flag) { text2 += "\nRedeem held legacy kit instead of paying."; } if (num > station.MaximumTier && purchasedTier < 3) { text = "Next upgrade is sold on native island " + val.NativeIsland + "."; } return new PackPurchaseOffer(station.Key + "|" + num.ToString(CultureInfo.InvariantCulture), val.Title, (!flag) ? val.Cost : 0, text2, text); } internal bool TryResolve(string quote, out Station? station, out int requestedTier) { //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) station = null; requestedTier = 0; string[] array = quote.Split('|'); if (array.Length == 2 && int.TryParse(array[1], NumberStyles.None, CultureInfo.InvariantCulture, out requestedTier) && stations.TryGetValue(array[0], out station) && Object.op_Implicit((Object)(object)station.Root) && station.Root.activeInHierarchy) { Scene scene = station.Island.Scene; return ((Scene)(ref scene)).isLoaded; } return false; } private void Unmounting(MountedIsland island) { pending.Remove(island.Reference); Station[] array = stations.Values.Where((Station station2) => station2.Island == island).ToArray(); foreach (Station station in array) { stations.Remove(station.Key); if (Object.op_Implicit((Object)(object)station.Root)) { Object.Destroy((Object)(object)station.Root); } } } public void Dispose() { world.SceneMounted -= Mounted; world.SceneUnmounting -= Unmounting; foreach (Station value in stations.Values) { if (Object.op_Implicit((Object)(object)value.Root)) { Object.Destroy((Object)(object)value.Root); } } stations.Clear(); pending.Clear(); } } public sealed class NetSave { public int SchemaVersion { get; set; } = 2; public int? Tier { get; set; } public NetCycleSnapshot Cycle { get; set; } = new NetCycle().CreateSnapshot(); public byte LureIndex { get; set; } = 8; } public sealed class NetViewState { public NetSave State { get; set; } = new NetSave { Tier = 0 }; public int Operator { get; set; } = -1; public string Notice { get; set; } = ""; public float[] Position { get; set; } = new float[3]; public float[] Rotation { get; set; } = new float[4] { 0f, 0f, 0f, 1f }; } public sealed class NetRuntime : MonoBehaviour { [CompilerGenerated] private static class <>O { public static ItemCustomizer <0>__ConfigureKit; public static Func <1>__IsWorldItemSaveEligible; } public const string PackKey = "tidehaul_nets"; public const byte KitId = 195; public const ushort CollectionId = 48196; public const int KitCost = 1200; private static readonly HashSet SchoolFish = new HashSet { 0, 2, 4, 52 }; private static readonly JsonSerializerSettings Json = new JsonSerializerSettings { MissingMemberHandling = (MissingMemberHandling)1, MaxDepth = 32, TypeNameHandling = (TypeNameHandling)0 }; private NetCycle cycle = new NetCycle(); private NetAssets? assets; private PackChannel? channel; private IDisposable? registration; private NetBoatView? boatView; private NetPurchaseStations? shops; private NetViewState remote = new NetViewState(); private byte lureIndex = 8; private int operatorId = -1; private float nextPublish; private string notice = ""; private bool prepared; private int tier; public static NetRuntime? Current { get; private set; } public bool Ready { get { if (prepared) { return ExpansionPlatform.Current.Ready; } return false; } } public NetCycleSnapshot Snapshot { get { if (!IsServer) { return remote.State.Cycle; } return cycle.CreateSnapshot(); } } public BoatMount? Mount => boatView?.Mount; public PackControl? PrimaryControl => boatView?.Primary; public IReadOnlyList PurchaseStands => shops?.Controls ?? Array.Empty(); public int PurchasedTier { get { if (!IsServer) { return remote.State.Tier.GetValueOrDefault(); } return tier; } } public Vector3 NetPosition => boatView?.NetPosition ?? Vector3.zero; public Vector3 DischargePosition => boatView?.DischargePosition ?? Vector3.zero; public bool DeploymentWaterSuitable => boatView?.WaterSuitable ?? false; public bool IsServer { get { if (Object.op_Implicit((Object)(object)Server.Instance)) { return ((NetworkBehaviour)Server.Instance).IsServerInitialized; } return false; } } public string Notice { get { if (!IsServer && notice.Length == 0) { return remote.Notice; } return notice; } } public int CatchesUnloaded { get; private set; } public Vector3 PredictedNetLocalPosition(float deploymentAmount) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) return (boatView ?? throw new InvalidOperationException("The native net mount is not ready.")).PredictedLocalPosition(deploymentAmount); } public float PredictedSlewDegrees(float deploymentAmount) { return (boatView ?? throw new InvalidOperationException("The native net mount is not ready.")).PredictedSlewDegrees(deploymentAmount); } private void Awake() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0092: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)Current)) { throw new InvalidOperationException("Another net runtime is already active."); } Current = this; ExpansionPlatform.Current.RegisterExtension(new PackExtension("tidehaul_nets", (Func)PrepareSource, (Action)delegate(PackContentOptions options) { //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_0032: Expected O, but got Unknown options.Assets = (IPackAssetFactory)(object)assets; Dictionary itemCustomizers = options.ItemCustomizers; object obj = <>O.<0>__ConfigureKit; if (obj == null) { ItemCustomizer val = ConfigureKit; <>O.<0>__ConfigureKit = val; obj = (object)val; } itemCustomizers.Add("net_kit", (ItemCustomizer)obj); }) { PrepareGameplay = PrepareGameplay, GameplayReady = () => prepared, AcceptSavedRevision = (SavedPack saved, IReadOnlyDictionary code) => NetSaveRevision.Accept(saved.Key, saved.Version, saved.Fingerprint, code) }); } private static void ConfigureKit(ItemCustomization context) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0037: 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_0054: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00fd: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) NativeItemFactories.ConfigureStandardItem(context.Item, new StandardItemTuning { Cost = 1200, Worth = 600, IgnoredByMoneyNpc = false, IgnoredBySeagulls = true, QuestItem = false }); RigidMeshAdapter.Apply(context.Clone, context.Donor, context.Art ?? throw new InvalidOperationException("The net kit has no authored visual."), context.Visuals, new Options { InventoryRotation = new Vector3(12f, 30f, 0f) }); context.MarkVisualBound(); Bounds val = ArticulatedMeshAdapter.BodyBounds(((Component)context.Clone).transform, (IEnumerable)NativeAccess.Get((object)context.Clone, "_worldColliders")); Vector3 val2 = NativeAccess.Get((object)GameInfo.PlayerPrefab.Holding, "_jointTargetTargetOffset"); Vector3 val3 = Quaternion.Euler(context.Clone.HeldRot) * ((Bounds)(ref val)).center; NativeAccess.Set((object)context.Clone, "_heldPos", (object)(new Vector3(0.03f, -0.55f, 0.85f) - val2 - val3)); } private PackSource PrepareSource() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00ef: 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_0100: 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_0121: Expected O, but got Unknown //IL_0126: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01be: Expected O, but got Unknown //IL_01c3: Expected O, but got Unknown //IL_0202: Expected O, but got Unknown //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown assets = new NetAssets(); return new PackSource(new PackDefinition { Key = "tidehaul_nets", Title = "Tidehaul Nets", Version = "0.2.3", ExtensionHooks = new List { "tidehaul_boat_net" }, Collections = new List { new NetworkCollectionRecipe { Key = "equipment", Id = 48196 } }, Items = new List { new ItemRecipe { Key = "net_kit", Id = 195, Title = "Legacy Tidehaul Winch Kit", NativeDonor = "native:77", Kind = (PackItemKind)0, Cost = 1200, Worth = 600, Network = new NetworkBinding { CollectionId = 48196, Slot = 0 }, Art = new ArtRecipe { Bundle = "tidehaul.models", Sha256 = assets.Hash, Prefab = "tidehaul_kit" } } }, Shops = new List { new ShopRecipe { Key = "net_stock", Island = "native:3", Kind = (PackShopKind)0, Content = "tidehaul_nets:net_kit", Implementation = (RecipeImplementation)1, ExtensionHook = "tidehaul_boat_net", Placement = new PlacementRecipe { Pose = new PoseRecipe { Position = new VectorRecipe { X = 0f, Y = 1.2f, Z = -3f }, Yaw = 180f } } } } }, assets.Root, new Assembly[2] { typeof(Plugin).Assembly, typeof(NetCycle).Assembly }); } private IEnumerator PrepareGameplay() { ExpansionPlatform current = ExpansionPlatform.Current; current.Saves.RegisterParticipant("tidehaul_nets", (Func)CaptureSave, (Action)RestoreSave); channel = current.Channels.Register("tidehaul_nets", "winch", (Func)Act, (Func)CaptureView, (Action)ReceiveView); channel.Rejected += SetNotice; shops = new NetPurchaseStations(this, assets ?? throw new InvalidOperationException("Net art was not loaded."), current.World); registration = current.Boats.Register("tidehaul_nets", "winch", (Func)delegate(BoatMount mount) { boatView = new NetBoatView(this, mount, assets ?? throw new InvalidOperationException("Net art was not loaded.")); return boatView; }, (Func)TravelReason, (Action)delegate(string message) { notice = message; if (IsServer) { channel.Publish(); } else { SetNotice(message); } }, (Func)DrivingReason); prepared = true; yield break; } private NetSave StateForSave() { return new NetSave { Tier = tier, Cycle = cycle.CreateSnapshot(), LureIndex = lureIndex }; } private JToken CaptureSave() { return (JToken)(object)JObject.FromObject((object)StateForSave()); } private void RestoreSave(JToken? token) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 NetSave netSave = ((token == null) ? new NetSave { Tier = 0 } : (token.ToObject(JsonSerializer.Create(Json)) ?? throw new InvalidDataException("The saved boat net is empty."))); tier = ValidateState(netSave); cycle = NetCycle.Restore(netSave.Cycle); netSave.Tier = tier; netSave.SchemaVersion = 2; lureIndex = netSave.LureIndex; operatorId = -1; notice = (((int)cycle.Phase == 3) ? "Haul paused after loading. Operate the winch to continue." : ""); remote = new NetViewState { State = netSave, Notice = notice }; } private static int ValidateState(NetSave state) { if (state.LureIndex != 8 && state.LureIndex != 10) { throw new InvalidDataException("The boat-net save schema or catch pool is unsupported."); } int result = NetEquipment.RestoreTier(state.SchemaVersion, state.Tier, state.Cycle); if (state.Cycle.Tickets.Any((NetCatchTicketState ticket) => !ticket.ItemId.HasValue || !SchoolFish.Contains(ticket.ItemId.Value) || (state.LureIndex == 8 && ticket.ItemId == 2) || ticket.IsShiny != false || ticket.WeightFactor != 1.0)) { throw new InvalidDataException("The boat-net save contains unsupported catches or timings."); } return result; } private string CaptureView() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0021: 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_0061: 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_0073: 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_0091: 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_00a3: Unknown result type (might be due to invalid IL or missing references) Vector3 val = boatView?.NetPosition ?? Vector3.zero; Quaternion val2 = boatView?.NetRotation ?? Quaternion.identity; NetViewState netViewState = new NetViewState(); netViewState.State = StateForSave(); netViewState.Operator = operatorId; netViewState.Notice = notice; netViewState.Position = new float[3] { val.x, val.y, val.z }; netViewState.Rotation = new float[4] { val2.x, val2.y, val2.z, val2.w }; return JsonConvert.SerializeObject((object)netViewState); } private void ReceiveView(string json) { NetViewState netViewState = JsonConvert.DeserializeObject(json, Json) ?? throw new InvalidDataException("The net snapshot is empty."); ValidateState(netViewState.State); if (netViewState.Position == null || netViewState.Position.Length != 3 || netViewState.Rotation == null || netViewState.Rotation.Length != 4 || netViewState.Position.Concat(netViewState.Rotation).Any((float value) => !NativeAccess.Finite(value)) || netViewState.Notice == null || netViewState.Notice.Length > 512) { throw new InvalidDataException("The host sent an invalid net pose."); } if (!IsServer) { remote = netViewState; } } public void Send(string action) { if (!Ready || channel == null) { throw new InvalidOperationException("The boat net is still preparing."); } if (!IsServer) { notice = ""; } channel.Send(action, (action == "deploy") ? "" : (Snapshot.DeploymentId ?? "")); } public void SendPurchase(string quote) { if (!Ready || channel == null) { throw new InvalidOperationException("Boat equipment shops are still preparing."); } if (!IsServer) { notice = ""; } channel.Send("purchase", quote); } internal void UsePrimary() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected I4, but got Unknown NetCycleSnapshot snapshot = Snapshot; if (snapshot.Installed != true) { SetNotice("Buy the net at a boat-equipment dock first."); return; } switch (snapshot.Phase) { case (NetPhase)0L: Send("deploy"); break; case (NetPhase)1L: Send("haul"); break; case (NetPhase)2L: Send("haul"); break; case (NetPhase)3L: Send((snapshot.HaulPaused == true) ? "resume" : "pause"); break; case (NetPhase)4L: Send("unload"); break; default: throw new InvalidOperationException("The net has no supported control action for its phase."); } } private PackCommandResult Act(Player player, string action, string payload) { //IL_0258: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: 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_0260: 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_005e: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) if (action == "purchase") { return Purchase(player, payload); } if (!IsServer || !Ready || boatView == null || !boatView.Mount.Near(player, boatView.ControlLocal, 3f)) { return PackCommandResult.Reject("Operate the net winch from the boat."); } if (!cycle.Installed) { return PackCommandResult.Reject("Buy a net winch at the boat-equipment dock first."); } bool flag; switch (action) { case "haul": case "pause": case "resume": case "unload": flag = true; break; default: flag = false; break; } if (flag && payload != cycle.DeploymentId) { return PackCommandResult.Reject("The net changed. Look at the winch again."); } string actor = ((NetworkBehaviour)player).Owner.ClientId.ToString(CultureInfo.InvariantCulture); try { switch (action) { case "deploy": if (boatView.Mount.HorizontalSpeed > 0.75f) { return PackCommandResult.Reject("Stop the boat before lowering the net."); } if (!boatView.WaterSuitable) { return PackCommandResult.Reject("Move the boat over deeper, unobstructed water."); } Commit(delegate { lureIndex = (byte)((OnlineIslandManager.MaxIslandUnlocked >= 5) ? 10 : 8); cycle.BeginLowering(cycle.Revision, Guid.NewGuid().ToString("N")); }); break; case "haul": Commit(delegate { cycle.BeginHaul(cycle.Revision, actor); operatorId = ((NetworkBehaviour)player).Owner.ClientId; }); break; case "pause": Commit(delegate { cycle.PauseHaul(cycle.Revision, actor); operatorId = -1; }); break; case "resume": Commit(delegate { cycle.ResumeHaul(cycle.Revision, actor); operatorId = ((NetworkBehaviour)player).Owner.ClientId; }); break; case "unload": if (LooseItemCount() + cycle.TicketCount > 60) { return PackCommandResult.Reject("Sell or store some loose items before unloading the catch."); } Commit(delegate { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0087: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) IReadOnlyList readOnlyList = cycle.Unload(cycle.Revision); for (int i = 0; i < readOnlyList.Count; i++) { Item spawnable = GameInfo.GetSpawnable(readOnlyList[i].ItemId); Bounds val = ArticulatedMeshAdapter.BodyBounds(((Component)spawnable).transform, (IEnumerable)NativeAccess.Get((object)spawnable, "_worldColliders")); Quaternion val2 = ((((Bounds)(ref val)).size.z >= ((Bounds)(ref val)).size.x && ((Bounds)(ref val)).size.z >= ((Bounds)(ref val)).size.y) ? Quaternion.Euler(0f, 90f, 0f) : ((((Bounds)(ref val)).size.y > ((Bounds)(ref val)).size.x) ? Quaternion.Euler(0f, 0f, 90f) : Quaternion.identity)); Quaternion val3 = boatView.Mount.PhysicsRotation * val2; Vector3 val4 = boatView.CatchPosition(i) - val3 * ((Bounds)(ref val)).center; Item val5 = ItemManager.Instance.SpawnSavedItem(new SavedWorldItem { Item = new SavedItem { Exists = true, ItemID = readOnlyList[i].ItemId, Weight = (float)readOnlyList[i].WeightFactor, BettingMultiplier = 1f, KillScoreMultiplier = 1f }, Position = val4, Rotation = val3, IsDeadCreature = false }); if (!Object.op_Implicit((Object)(object)val5) || !Object.op_Implicit((Object)(object)val5.Creature) || val5.Creature._hp.Value <= 0) { throw new InvalidOperationException("The net did not release a living native fish."); } val5.RigidbodySync.StartSimulateLocal(default(Vector3), default(Quaternion)); val5.Rig.linearVelocity = boatView.Mount.Physics.GetPointVelocity(val4); int catchesUnloaded = CatchesUnloaded; CatchesUnloaded = catchesUnloaded + 1; } }); operatorId = -1; break; default: return PackCommandResult.Reject("Unknown net control."); } notice = ""; return PackCommandResult.Done(); } catch (NetActionException ex) { return PackCommandResult.Reject(((Exception)ex).Message); } } private PackCommandResult Purchase(Player player, string quote) { //IL_009d: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) if (!IsServer || !Ready || shops == null || !shops.TryResolve(quote, out NetPurchaseStations.Station station, out int requested) || station == null || player == null || !Object.op_Implicit((Object)(object)player) || Vector3.Distance(player.Transform.position, ((Component)station.Control).transform.position) > 3f || OnlineIslandManager.CurIsland != station.Island.NativeEngineId) { return PackCommandResult.Reject("Buy boat equipment from its nearby dock display."); } Item legacyKit = player.Holding.HeldItem; bool legacyCredit = tier == 0 && requested == 1 && legacyKit != null && Object.op_Implicit((Object)(object)legacyKit) && legacyKit.ID == 195 && (Object)(object)legacyKit.SyncedHolder == (Object)(object)player && !legacyKit.IsDestroying; int value = MoneyManager.Instance._money.Value; string text = NetEquipment.PurchaseBlock(tier, requested, station.MaximumTier, Object.op_Implicit((Object)(object)BoatManager.Boat) && BoatManager.Boat.BoatUnlocked, cycle.Phase, legacyCredit ? NetEquipment.Tier(1).Cost : value); if (text != null) { return PackCommandResult.Reject(text); } NetEquipmentTier upgrade = NetEquipment.Tier(requested); Commit(delegate { if (legacyCredit) { if (legacyKit == null || !Object.op_Implicit((Object)(object)legacyKit)) { throw new InvalidOperationException("The legacy kit disappeared before redemption."); } legacyKit.DestroyItem((byte)0, byte.MaxValue); } else { MoneyManager.RemoveMoney(upgrade.Cost, player); } if (tier == 0) { cycle.Install(cycle.Revision); } else { cycle.Upgrade(cycle.Revision, upgrade.Configuration()); } tier = requested; }); notice = ""; return PackCommandResult.Done(); } private void Commit(Action apply) { ExpansionPlatform.Current.Saves.Checkpoint(); apply(); ExpansionPlatform.Current.Saves.Checkpoint(); } private static int LooseItemCount() { return ItemManager.Items.Values.Distinct().Count((Func)NativeSaveBridge.IsWorldItemSaveEligible); } private void FixedUpdate() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_007e: 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_0153: Unknown result type (might be due to invalid IL or missing references) bool flag = !Ready || !IsServer || boatView == null || !cycle.Installed; if (!flag) { NetPhase phase = cycle.Phase; bool flag2 = (((int)phase == 0 || (int)phase == 4) ? true : false); flag = flag2; } if (flag) { return; } try { Player val = ((IEnumerable)PlayerManager.Players).FirstOrDefault((Func)((Player player) => Object.op_Implicit((Object)(object)player) && ((NetworkBehaviour)player).Owner.ClientId == operatorId)); bool flag3 = Object.op_Implicit((Object)(object)val) && boatView.Mount.Near(val, boatView.ControlLocal, 3f); NetPhase phase2 = cycle.Phase; bool haulPaused = cycle.HaulPaused; cycle.Advance(cycle.Revision, (double)Math.Min(Time.fixedDeltaTime, 0.1f), boatView.WaterSuitable, boatView.Mount.HorizontalSpeed > 0.75f, (operatorId < 0) ? null : operatorId.ToString(CultureInfo.InvariantCulture), flag3); if (cycle.CatchDue) { NetCatchTicket ticket = SelectCatch(); Commit(delegate { cycle.AcceptValidatedCatch(cycle.Revision, cycle.CatchOpportunity, ticket); }); } if (phase2 != cycle.Phase || haulPaused != cycle.HaulPaused) { ExpansionPlatform.Current.Saves.Checkpoint(); } } catch (Exception ex) { ExpansionPlatform.Current.Fail(ex); } } private NetCatchTicket SelectCatch() { //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown List list = ((lureIndex != 8) ? new byte[2] { 8, 10 } : new byte[1] { 8 }).SelectMany((byte index) => GameInfo.AllBaits[index].ItemWeights).Where(delegate(ItemInfoWeight entry) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)entry.Fishable)) { Item itemToSpawn = entry.Fishable.ItemToSpawn; Fish val = (Fish)(object)((itemToSpawn is Fish) ? itemToSpawn : null); if (val != null && ((object)val).GetType() == typeof(Fish) && (int)((Creature)val).BossType == 0 && !((Item)val).IsQuestItem && SchoolFish.Contains(((Item)val).ID)) { return entry.Weight > 0f; } } return false; }).ToList(); if (list.Count == 0) { throw new InvalidOperationException("The native school-fish pool is empty."); } using SHA256 sHA = SHA256.Create(); double num = (double)BitConverter.ToUInt32(sHA.ComputeHash(Encoding.UTF8.GetBytes(cycle.DeploymentId + ":" + cycle.CatchOpportunity)), 0) / 4294967296.0 * ((IEnumerable)list).Sum((Func)((ItemInfoWeight entry) => entry.Weight)); foreach (ItemInfoWeight item in list) { num -= (double)item.Weight; if (num < 0.0) { return new NetCatchTicket(item.Fishable.ItemToSpawn.ID, 1.0, false); } } throw new InvalidOperationException("The deterministic catch selection exceeded its native weight table."); } private void Update() { if (!Ready) { return; } try { shops?.Tick(); } catch (Exception ex) { ExpansionPlatform.Current.Fail(ex); return; } if (boatView != null) { boatView.Render(Snapshot); if (IsServer && Time.realtimeSinceStartup >= nextPublish) { nextPublish = Time.realtimeSinceStartup + 0.2f; channel.Publish(); } } } private string? TravelReason() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Snapshot.Installed != true || Snapshot.Phase == (NetPhase?)0) { return null; } return "Haul and unload the boat net before travelling to another island."; } private string? DrivingReason() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) return NetEquipment.DrivingBlock(Snapshot.Installed == true, Snapshot.Phase ?? throw new InvalidOperationException("The net snapshot has no phase.")); } internal void Detached(NetBoatView view) { if (boatView == view) { boatView = null; } } private void SetNotice(string message) { notice = message; remote.Notice = message; Plugin.Log.LogInfo((object)message); } internal string Label() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected I4, but got Unknown NetCycleSnapshot snapshot = Snapshot; if (Notice.Length != 0) { return Notice; } if (snapshot.Installed != true) { return "Buy a Tidehaul net at the boat-equipment dock"; } switch (snapshot.Phase) { case (NetPhase)0L: return "Deploy boat net\nNo bait needed - stop over deep water"; case (NetPhase)1L: return $"Lowering net: {snapshot.LoweringElapsedSeconds / snapshot.Config.LoweringSeconds:P0}\nRetrieve early"; case (NetPhase)2L: return $"Net catch: {snapshot.Tickets.Count}/{snapshot.Config.Capacity}\nBegin haul"; case (NetPhase)3L: return string.Format("{0} haul: {1:P0}\nStay by the winch", (snapshot.HaulPaused == true) ? "Resume" : "Pause", snapshot.HaulElapsedSeconds / snapshot.Config.HaulingSeconds); case (NetPhase)4L: if (snapshot.Tickets.Count != 0) { return $"Tip {snapshot.Tickets.Count} live fish onto the deck\nThey can flop away - finish your catch"; } return "Stow the empty net"; default: throw new InvalidOperationException("Unknown net phase."); } } private void OnDestroy() { registration?.Dispose(); PackChannel? obj = channel; if (obj != null) { obj.Dispose(); } shops?.Dispose(); assets?.Dispose(); if (Current == this) { Current = null; } } } [BepInPlugin("friends.howtofish.tidehaulnets", "Tidehaul Nets", "0.2.3")] [BepInDependency("howtofish.expansionkit.runtime", "0.7.2")] public sealed class Plugin : BaseUnityPlugin { public const string Id = "friends.howtofish.tidehaulnets"; public const string Version = "0.2.3"; internal static ManualLogSource Log { get; private set; } private void Awake() { Log = ((BaseUnityPlugin)this).Logger; ((Component)this).gameObject.AddComponent(); } } }